Lines Matching refs:ts3a227e
22 struct ts3a227e { struct
154 static void ts3a227e_jack_report(struct ts3a227e *ts3a227e) in ts3a227e_jack_report() argument
159 if (!ts3a227e->jack) in ts3a227e_jack_report()
162 if (ts3a227e->plugged) in ts3a227e_jack_report()
164 if (ts3a227e->mic_present) in ts3a227e_jack_report()
167 if (ts3a227e->buttons_held & (1 << i)) in ts3a227e_jack_report()
170 snd_soc_jack_report(ts3a227e->jack, report, TS3A227E_JACK_MASK); in ts3a227e_jack_report()
173 static void ts3a227e_new_jack_state(struct ts3a227e *ts3a227e, unsigned acc_reg) in ts3a227e_new_jack_state() argument
180 ts3a227e->plugged = plugged; in ts3a227e_new_jack_state()
182 if (mic_present != ts3a227e->mic_present) { in ts3a227e_new_jack_state()
183 ts3a227e->mic_present = mic_present; in ts3a227e_new_jack_state()
184 ts3a227e->buttons_held = 0; in ts3a227e_new_jack_state()
187 regmap_update_bits(ts3a227e->regmap, in ts3a227e_new_jack_state()
196 struct ts3a227e *ts3a227e = (struct ts3a227e *)data; in ts3a227e_interrupt() local
197 struct regmap *regmap = ts3a227e->regmap; in ts3a227e_interrupt()
199 struct device *dev = ts3a227e->dev; in ts3a227e_interrupt()
211 ts3a227e_new_jack_state(ts3a227e, acc_reg); in ts3a227e_interrupt()
223 ts3a227e->buttons_held |= (1 << i); in ts3a227e_interrupt()
225 ts3a227e->buttons_held &= ~(1 << i); in ts3a227e_interrupt()
228 ts3a227e_jack_report(ts3a227e); in ts3a227e_interrupt()
246 struct ts3a227e *ts3a227e = snd_soc_component_get_drvdata(component); in ts3a227e_enable_jack_detect() local
253 ts3a227e->jack = jack; in ts3a227e_enable_jack_detect()
254 ts3a227e_jack_report(ts3a227e); in ts3a227e_enable_jack_detect()
294 static int ts3a227e_parse_device_property(struct ts3a227e *ts3a227e, in ts3a227e_parse_device_property() argument
330 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3, in ts3a227e_parse_device_property()
342 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_1, in ts3a227e_parse_device_property()
353 struct ts3a227e *ts3a227e; in ts3a227e_i2c_probe() local
358 ts3a227e = devm_kzalloc(&i2c->dev, sizeof(*ts3a227e), GFP_KERNEL); in ts3a227e_i2c_probe()
359 if (ts3a227e == NULL) in ts3a227e_i2c_probe()
362 i2c_set_clientdata(i2c, ts3a227e); in ts3a227e_i2c_probe()
363 ts3a227e->dev = dev; in ts3a227e_i2c_probe()
364 ts3a227e->irq = i2c->irq; in ts3a227e_i2c_probe()
366 ts3a227e->regmap = devm_regmap_init_i2c(i2c, &ts3a227e_regmap_config); in ts3a227e_i2c_probe()
367 if (IS_ERR(ts3a227e->regmap)) in ts3a227e_i2c_probe()
368 return PTR_ERR(ts3a227e->regmap); in ts3a227e_i2c_probe()
370 ret = ts3a227e_parse_device_property(ts3a227e, dev); in ts3a227e_i2c_probe()
378 "TS3A227E", ts3a227e); in ts3a227e_i2c_probe()
390 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_INTERRUPT_DISABLE, in ts3a227e_i2c_probe()
395 regmap_read(ts3a227e->regmap, TS3A227E_REG_ACCESSORY_STATUS, &acc_reg); in ts3a227e_i2c_probe()
396 ts3a227e_new_jack_state(ts3a227e, acc_reg); in ts3a227e_i2c_probe()
397 ts3a227e_jack_report(ts3a227e); in ts3a227e_i2c_probe()
405 struct ts3a227e *ts3a227e = dev_get_drvdata(dev); in ts3a227e_suspend() local
407 dev_dbg(ts3a227e->dev, "suspend disable irq\n"); in ts3a227e_suspend()
408 disable_irq(ts3a227e->irq); in ts3a227e_suspend()
415 struct ts3a227e *ts3a227e = dev_get_drvdata(dev); in ts3a227e_resume() local
417 dev_dbg(ts3a227e->dev, "resume enable irq\n"); in ts3a227e_resume()
418 enable_irq(ts3a227e->irq); in ts3a227e_resume()