Lines Matching refs:rt298
196 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_index_sync() local
200 snd_soc_component_write(component, rt298->index_cache[i].reg, in rt298_index_sync()
201 rt298->index_cache[i].def); in rt298_index_sync()
219 static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) in rt298_jack_detect() argument
227 if (!rt298->component) in rt298_jack_detect()
230 dapm = snd_soc_component_get_dapm(rt298->component); in rt298_jack_detect()
232 if (rt298->pdata.cbj_en) { in rt298_jack_detect()
233 regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf); in rt298_jack_detect()
235 if (*hp == rt298->is_hp_in) in rt298_jack_detect()
237 rt298->is_hp_in = *hp; in rt298_jack_detect()
240 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
249 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
251 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
254 regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24); in rt298_jack_detect()
257 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
260 regmap_read(rt298->regmap, RT298_CBJ_CTRL2, &val); in rt298_jack_detect()
265 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
268 regmap_read(rt298->regmap, in rt298_jack_detect()
274 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
280 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
285 regmap_write(rt298->regmap, RT298_SET_MIC1, 0x20); in rt298_jack_detect()
286 regmap_update_bits(rt298->regmap, in rt298_jack_detect()
290 regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf); in rt298_jack_detect()
292 regmap_read(rt298->regmap, RT298_GET_MIC1_SENSE, &buf); in rt298_jack_detect()
310 struct rt298_priv *rt298 = in rt298_jack_detect_work() local
316 if (rt298_jack_detect(rt298, &hp, &mic) < 0) in rt298_jack_detect_work()
325 snd_soc_jack_report(rt298->jack, status, in rt298_jack_detect_work()
333 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_mic_detect() local
335 rt298->jack = jack; in rt298_mic_detect()
339 if (rt298->jack->status & SND_JACK_HEADPHONE) in rt298_mic_detect()
341 if (rt298->jack->status & SND_JACK_MICROPHONE) { in rt298_mic_detect()
345 regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); in rt298_mic_detect()
347 snd_soc_jack_report(rt298->jack, rt298->jack->status, in rt298_mic_detect()
351 regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); in rt298_mic_detect()
365 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in is_mclk_mode() local
367 if (rt298->clk_id == RT298_SCLK_S_MCLK) in is_mclk_mode()
750 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_hw_params() local
764 switch (rt298->sys_clk) { in rt298_hw_params()
769 params_rate(params), rt298->sys_clk); in rt298_hw_params()
777 params_rate(params), rt298->sys_clk); in rt298_hw_params()
876 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_set_dai_sysclk() local
928 rt298->sys_clk = freq; in rt298_set_dai_sysclk()
929 rt298->clk_id = clk_id; in rt298_set_dai_sysclk()
981 struct rt298_priv *rt298 = data; in rt298_irq() local
986 ret = rt298_jack_detect(rt298, &hp, &mic); in rt298_irq()
989 regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x1, 0x1); in rt298_irq()
998 snd_soc_jack_report(rt298->jack, status, in rt298_irq()
1001 pm_wakeup_event(&rt298->i2c->dev, 300); in rt298_irq()
1009 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_probe() local
1011 rt298->component = component; in rt298_probe()
1012 INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work); in rt298_probe()
1014 if (rt298->i2c->irq) in rt298_probe()
1015 schedule_delayed_work(&rt298->jack_detect_work, in rt298_probe()
1022 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_remove() local
1024 cancel_delayed_work_sync(&rt298->jack_detect_work); in rt298_remove()
1025 rt298->component = NULL; in rt298_remove()
1031 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_suspend() local
1033 rt298->is_hp_in = -1; in rt298_suspend()
1034 regcache_cache_only(rt298->regmap, true); in rt298_suspend()
1035 regcache_mark_dirty(rt298->regmap); in rt298_suspend()
1042 struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); in rt298_resume() local
1044 regcache_cache_only(rt298->regmap, false); in rt298_resume()
1046 regcache_sync(rt298->regmap); in rt298_resume()
1182 struct rt298_priv *rt298; in rt298_i2c_probe() local
1187 rt298 = devm_kzalloc(&i2c->dev, sizeof(*rt298), in rt298_i2c_probe()
1189 if (NULL == rt298) in rt298_i2c_probe()
1192 rt298->regmap = devm_regmap_init(&i2c->dev, NULL, i2c, &rt298_regmap); in rt298_i2c_probe()
1193 if (IS_ERR(rt298->regmap)) { in rt298_i2c_probe()
1194 ret = PTR_ERR(rt298->regmap); in rt298_i2c_probe()
1200 regmap_read(rt298->regmap, in rt298_i2c_probe()
1208 rt298->index_cache = devm_kmemdup(&i2c->dev, rt298_index_def, in rt298_i2c_probe()
1210 if (!rt298->index_cache) in rt298_i2c_probe()
1213 rt298->index_cache_size = INDEX_CACHE_SIZE; in rt298_i2c_probe()
1214 rt298->i2c = i2c; in rt298_i2c_probe()
1215 i2c_set_clientdata(i2c, rt298); in rt298_i2c_probe()
1219 regmap_write(rt298->regmap, rt298->index_cache[i].reg, in rt298_i2c_probe()
1220 rt298->index_cache[i].def); in rt298_i2c_probe()
1222 regmap_write(rt298->regmap, rt298_reg[i].reg, in rt298_i2c_probe()
1226 rt298->pdata = *pdata; in rt298_i2c_probe()
1231 rt298->pdata = *(struct rt298_platform_data *) in rt298_i2c_probe()
1236 rt298->pdata.cbj_en = true; in rt298_i2c_probe()
1237 rt298->pdata.gpio2_en = false; in rt298_i2c_probe()
1241 regmap_update_bits(rt298->regmap, 0x04, 0x80, 0x80); in rt298_i2c_probe()
1242 regmap_update_bits(rt298->regmap, 0x1b, 0x860, 0x860); in rt298_i2c_probe()
1244 regmap_update_bits(rt298->regmap, 0x08, 0x20, 0x20); in rt298_i2c_probe()
1246 regmap_write(rt298->regmap, RT298_SET_AUDIO_POWER, AC_PWRST_D3); in rt298_i2c_probe()
1249 regmap_write(rt298->regmap, in rt298_i2c_probe()
1253 if (!rt298->pdata.cbj_en) { in rt298_i2c_probe()
1254 regmap_write(rt298->regmap, RT298_CBJ_CTRL2, 0x0000); in rt298_i2c_probe()
1255 regmap_write(rt298->regmap, RT298_MIC1_DET_CTRL, 0x0816); in rt298_i2c_probe()
1256 regmap_update_bits(rt298->regmap, in rt298_i2c_probe()
1259 regmap_update_bits(rt298->regmap, in rt298_i2c_probe()
1265 if (!rt298->pdata.gpio2_en) in rt298_i2c_probe()
1266 regmap_write(rt298->regmap, RT298_SET_DMIC2_DEFAULT, 0x40); in rt298_i2c_probe()
1268 regmap_write(rt298->regmap, RT298_SET_DMIC2_DEFAULT, 0); in rt298_i2c_probe()
1272 regmap_write(rt298->regmap, RT298_MISC_CTRL1, 0x0000); in rt298_i2c_probe()
1273 regmap_update_bits(rt298->regmap, in rt298_i2c_probe()
1276 regmap_write(rt298->regmap, RT298_UNSOLICITED_INLINE_CMD, 0x81); in rt298_i2c_probe()
1277 regmap_write(rt298->regmap, RT298_UNSOLICITED_HP_OUT, 0x82); in rt298_i2c_probe()
1278 regmap_write(rt298->regmap, RT298_UNSOLICITED_MIC1, 0x84); in rt298_i2c_probe()
1279 regmap_update_bits(rt298->regmap, RT298_IRQ_FLAG_CTRL, 0x2, 0x2); in rt298_i2c_probe()
1281 rt298->is_hp_in = -1; in rt298_i2c_probe()
1283 if (rt298->i2c->irq) { in rt298_i2c_probe()
1284 ret = request_threaded_irq(rt298->i2c->irq, NULL, rt298_irq, in rt298_i2c_probe()
1285 IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt298", rt298); in rt298_i2c_probe()
1302 struct rt298_priv *rt298 = i2c_get_clientdata(i2c); in rt298_i2c_remove() local
1305 free_irq(i2c->irq, rt298); in rt298_i2c_remove()