Lines Matching full:ts3a227e
3 * TS3A227E Autonomous Audio Accessory Detection and Configuration Switch
21 #include "ts3a227e.h"
23 struct ts3a227e { struct
49 /* TS3A227E registers */
155 static void ts3a227e_jack_report(struct ts3a227e *ts3a227e) in ts3a227e_jack_report() argument
160 if (!ts3a227e->jack) in ts3a227e_jack_report()
163 if (ts3a227e->plugged) in ts3a227e_jack_report()
165 if (ts3a227e->mic_present) in ts3a227e_jack_report()
168 if (ts3a227e->buttons_held & (1 << i)) in ts3a227e_jack_report()
171 snd_soc_jack_report(ts3a227e->jack, report, TS3A227E_JACK_MASK); in ts3a227e_jack_report()
174 static void ts3a227e_new_jack_state(struct ts3a227e *ts3a227e, unsigned acc_reg) in ts3a227e_new_jack_state() argument
181 ts3a227e->plugged = plugged; in ts3a227e_new_jack_state()
183 if (mic_present != ts3a227e->mic_present) { in ts3a227e_new_jack_state()
184 ts3a227e->mic_present = mic_present; in ts3a227e_new_jack_state()
185 ts3a227e->buttons_held = 0; in ts3a227e_new_jack_state()
188 regmap_update_bits(ts3a227e->regmap, in ts3a227e_new_jack_state()
197 struct ts3a227e *ts3a227e = (struct ts3a227e *)data; in ts3a227e_interrupt() local
198 struct regmap *regmap = ts3a227e->regmap; in ts3a227e_interrupt()
200 struct device *dev = ts3a227e->dev; in ts3a227e_interrupt()
212 ts3a227e_new_jack_state(ts3a227e, acc_reg); in ts3a227e_interrupt()
224 ts3a227e->buttons_held |= (1 << i); in ts3a227e_interrupt()
226 ts3a227e->buttons_held &= ~(1 << i); in ts3a227e_interrupt()
229 ts3a227e_jack_report(ts3a227e); in ts3a227e_interrupt()
247 struct ts3a227e *ts3a227e = snd_soc_component_get_drvdata(component); in ts3a227e_enable_jack_detect() local
254 ts3a227e->jack = jack; in ts3a227e_enable_jack_detect()
255 ts3a227e_jack_report(ts3a227e); in ts3a227e_enable_jack_detect()
276 .name = "ti,ts3a227e",
295 static int ts3a227e_parse_device_property(struct ts3a227e *ts3a227e, in ts3a227e_parse_device_property() argument
331 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3, in ts3a227e_parse_device_property()
343 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_1, in ts3a227e_parse_device_property()
354 struct ts3a227e *ts3a227e; in ts3a227e_i2c_probe() local
359 ts3a227e = devm_kzalloc(&i2c->dev, sizeof(*ts3a227e), GFP_KERNEL); in ts3a227e_i2c_probe()
360 if (ts3a227e == NULL) in ts3a227e_i2c_probe()
363 i2c_set_clientdata(i2c, ts3a227e); in ts3a227e_i2c_probe()
364 ts3a227e->dev = dev; in ts3a227e_i2c_probe()
365 ts3a227e->irq = i2c->irq; in ts3a227e_i2c_probe()
367 ts3a227e->regmap = devm_regmap_init_i2c(i2c, &ts3a227e_regmap_config); in ts3a227e_i2c_probe()
368 if (IS_ERR(ts3a227e->regmap)) in ts3a227e_i2c_probe()
369 return PTR_ERR(ts3a227e->regmap); in ts3a227e_i2c_probe()
371 ret = ts3a227e_parse_device_property(ts3a227e, dev); in ts3a227e_i2c_probe()
379 "TS3A227E", ts3a227e); in ts3a227e_i2c_probe()
391 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_INTERRUPT_DISABLE, in ts3a227e_i2c_probe()
396 regmap_read(ts3a227e->regmap, TS3A227E_REG_ACCESSORY_STATUS, &acc_reg); in ts3a227e_i2c_probe()
397 ts3a227e_new_jack_state(ts3a227e, acc_reg); in ts3a227e_i2c_probe()
398 ts3a227e_jack_report(ts3a227e); in ts3a227e_i2c_probe()
406 struct ts3a227e *ts3a227e = dev_get_drvdata(dev); in ts3a227e_suspend() local
408 dev_dbg(ts3a227e->dev, "suspend disable irq\n"); in ts3a227e_suspend()
409 disable_irq(ts3a227e->irq); in ts3a227e_suspend()
416 struct ts3a227e *ts3a227e = dev_get_drvdata(dev); in ts3a227e_resume() local
418 dev_dbg(ts3a227e->dev, "resume enable irq\n"); in ts3a227e_resume()
419 enable_irq(ts3a227e->irq); in ts3a227e_resume()
430 { "ts3a227e", 0 },
437 { .compatible = "ti,ts3a227e", },
453 .name = "ts3a227e",
463 MODULE_DESCRIPTION("ASoC ts3a227e driver");