Lines Matching refs:rt5682
42 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_sdw_read() local
45 regmap_write(rt5682->sdw_regmap, RT5682_SDW_CMD, 0); in rt5682_sdw_read()
46 regmap_write(rt5682->sdw_regmap, RT5682_SDW_ADDR_H, (reg >> 8) & 0xff); in rt5682_sdw_read()
47 regmap_write(rt5682->sdw_regmap, RT5682_SDW_ADDR_L, (reg & 0xff)); in rt5682_sdw_read()
48 regmap_read(rt5682->sdw_regmap, RT5682_SDW_DATA_H, &data_h); in rt5682_sdw_read()
49 regmap_read(rt5682->sdw_regmap, RT5682_SDW_DATA_L, &data_l); in rt5682_sdw_read()
61 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_sdw_write() local
63 regmap_write(rt5682->sdw_regmap, RT5682_SDW_CMD, 1); in rt5682_sdw_write()
64 regmap_write(rt5682->sdw_regmap, RT5682_SDW_ADDR_H, (reg >> 8) & 0xff); in rt5682_sdw_write()
65 regmap_write(rt5682->sdw_regmap, RT5682_SDW_ADDR_L, (reg & 0xff)); in rt5682_sdw_write()
66 regmap_write(rt5682->sdw_regmap, RT5682_SDW_DATA_H, (val >> 8) & 0xff); in rt5682_sdw_write()
67 regmap_write(rt5682->sdw_regmap, RT5682_SDW_DATA_L, (val & 0xff)); in rt5682_sdw_write()
108 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); in rt5682_sdw_hw_params() local
121 if (!rt5682->slave) in rt5682_sdw_hw_params()
132 retval = sdw_stream_add_slave(rt5682->slave, &stream_config, in rt5682_sdw_hw_params()
208 regmap_update_bits(rt5682->regmap, RT5682_SDW_REF_CLK, in rt5682_sdw_hw_params()
210 regmap_update_bits(rt5682->regmap, RT5682_ADDA_CLK_1, in rt5682_sdw_hw_params()
213 regmap_update_bits(rt5682->regmap, RT5682_SDW_REF_CLK, in rt5682_sdw_hw_params()
215 regmap_update_bits(rt5682->regmap, RT5682_ADDA_CLK_1, in rt5682_sdw_hw_params()
226 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); in rt5682_sdw_hw_free() local
230 if (!rt5682->slave) in rt5682_sdw_hw_free()
233 sdw_stream_remove_slave(rt5682->slave, sdw_stream); in rt5682_sdw_hw_free()
300 struct rt5682_priv *rt5682; in rt5682_sdw_init() local
303 rt5682 = devm_kzalloc(dev, sizeof(*rt5682), GFP_KERNEL); in rt5682_sdw_init()
304 if (!rt5682) in rt5682_sdw_init()
307 dev_set_drvdata(dev, rt5682); in rt5682_sdw_init()
308 rt5682->slave = slave; in rt5682_sdw_init()
309 rt5682->sdw_regmap = regmap; in rt5682_sdw_init()
310 rt5682->is_sdw = true; in rt5682_sdw_init()
312 mutex_init(&rt5682->disable_irq_lock); in rt5682_sdw_init()
314 rt5682->regmap = devm_regmap_init(dev, NULL, dev, in rt5682_sdw_init()
316 if (IS_ERR(rt5682->regmap)) { in rt5682_sdw_init()
317 ret = PTR_ERR(rt5682->regmap); in rt5682_sdw_init()
324 ret = rt5682_get_ldo1(rt5682, dev); in rt5682_sdw_init()
328 regcache_cache_only(rt5682->sdw_regmap, true); in rt5682_sdw_init()
329 regcache_cache_only(rt5682->regmap, true); in rt5682_sdw_init()
335 rt5682->hw_init = false; in rt5682_sdw_init()
336 rt5682->first_hw_init = false; in rt5682_sdw_init()
338 mutex_init(&rt5682->calibrate_mutex); in rt5682_sdw_init()
339 INIT_DELAYED_WORK(&rt5682->jack_detect_work, in rt5682_sdw_init()
370 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_io_init() local
374 rt5682->disable_irq = false; in rt5682_io_init()
376 if (rt5682->hw_init) in rt5682_io_init()
379 regcache_cache_only(rt5682->sdw_regmap, false); in rt5682_io_init()
380 regcache_cache_only(rt5682->regmap, false); in rt5682_io_init()
381 if (rt5682->first_hw_init) in rt5682_io_init()
382 regcache_cache_bypass(rt5682->regmap, true); in rt5682_io_init()
387 if (!rt5682->first_hw_init) in rt5682_io_init()
394 regmap_read(rt5682->regmap, RT5682_DEVICE_ID, &val); in rt5682_io_init()
408 rt5682_calibrate(rt5682); in rt5682_io_init()
410 if (rt5682->first_hw_init) { in rt5682_io_init()
411 regcache_cache_bypass(rt5682->regmap, false); in rt5682_io_init()
412 regcache_mark_dirty(rt5682->regmap); in rt5682_io_init()
413 regcache_sync(rt5682->regmap); in rt5682_io_init()
416 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_2, in rt5682_io_init()
422 rt5682_apply_patch_list(rt5682, dev); in rt5682_io_init()
424 regmap_write(rt5682->regmap, RT5682_DEPOP_1, 0x0000); in rt5682_io_init()
426 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, in rt5682_io_init()
429 regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0080); in rt5682_io_init()
430 regmap_write(rt5682->regmap, RT5682_TEST_MODE_CTRL_1, 0x0000); in rt5682_io_init()
431 regmap_update_bits(rt5682->regmap, RT5682_BIAS_CUR_CTRL_8, in rt5682_io_init()
433 regmap_update_bits(rt5682->regmap, RT5682_CHARGE_PUMP_1, in rt5682_io_init()
435 regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1, in rt5682_io_init()
439 regmap_write(rt5682->regmap, RT5682_PLL2_INTERNAL, 0xa266); in rt5682_io_init()
440 regmap_write(rt5682->regmap, RT5682_PLL2_CTRL_1, 0x1700); in rt5682_io_init()
441 regmap_write(rt5682->regmap, RT5682_PLL2_CTRL_2, 0x0006); in rt5682_io_init()
442 regmap_write(rt5682->regmap, RT5682_PLL2_CTRL_3, 0x2600); in rt5682_io_init()
443 regmap_write(rt5682->regmap, RT5682_PLL2_CTRL_4, 0x0c8f); in rt5682_io_init()
444 regmap_write(rt5682->regmap, RT5682_PLL_TRACK_2, 0x3000); in rt5682_io_init()
445 regmap_write(rt5682->regmap, RT5682_PLL_TRACK_3, 0x4000); in rt5682_io_init()
446 regmap_update_bits(rt5682->regmap, RT5682_GLB_CLK, in rt5682_io_init()
450 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_2, in rt5682_io_init()
452 regmap_write(rt5682->regmap, RT5682_CBJ_CTRL_1, 0xd142); in rt5682_io_init()
453 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_5, 0x0700, 0x0600); in rt5682_io_init()
454 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_3, in rt5682_io_init()
456 regmap_update_bits(rt5682->regmap, RT5682_SAR_IL_CMD_1, in rt5682_io_init()
458 regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL, in rt5682_io_init()
462 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_2, in rt5682_io_init()
464 regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2, in rt5682_io_init()
470 &rt5682->jack_detect_work, msecs_to_jiffies(250)); in rt5682_io_init()
473 rt5682->hw_init = true; in rt5682_io_init()
474 rt5682->first_hw_init = true; in rt5682_io_init()
515 struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev); in rt5682_update_status() local
518 rt5682->hw_init = false; in rt5682_update_status()
524 if (rt5682->hw_init || status != SDW_SLAVE_ATTACHED) in rt5682_update_status()
605 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_clock_config() local
608 clk_freq = (rt5682->params.curr_dr_freq >> 1); in rt5682_clock_config()
633 regmap_write(rt5682->sdw_regmap, 0xe0, value); in rt5682_clock_config()
634 regmap_write(rt5682->sdw_regmap, 0xf0, value); in rt5682_clock_config()
644 struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev); in rt5682_bus_config() local
647 memcpy(&rt5682->params, params, sizeof(*params)); in rt5682_bus_config()
659 struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev); in rt5682_interrupt_callback() local
664 mutex_lock(&rt5682->disable_irq_lock); in rt5682_interrupt_callback()
665 if (status->control_port & 0x4 && !rt5682->disable_irq) { in rt5682_interrupt_callback()
667 &rt5682->jack_detect_work, msecs_to_jiffies(rt5682->irq_work_delay_time)); in rt5682_interrupt_callback()
669 mutex_unlock(&rt5682->disable_irq_lock); in rt5682_interrupt_callback()
696 struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev); in rt5682_sdw_remove() local
698 if (rt5682->hw_init) in rt5682_sdw_remove()
699 cancel_delayed_work_sync(&rt5682->jack_detect_work); in rt5682_sdw_remove()
714 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_dev_suspend() local
716 if (!rt5682->hw_init) in rt5682_dev_suspend()
719 cancel_delayed_work_sync(&rt5682->jack_detect_work); in rt5682_dev_suspend()
721 regcache_cache_only(rt5682->sdw_regmap, true); in rt5682_dev_suspend()
722 regcache_cache_only(rt5682->regmap, true); in rt5682_dev_suspend()
723 regcache_mark_dirty(rt5682->regmap); in rt5682_dev_suspend()
730 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_dev_system_suspend() local
734 if (!rt5682->hw_init) in rt5682_dev_system_suspend()
742 mutex_lock(&rt5682->disable_irq_lock); in rt5682_dev_system_suspend()
743 rt5682->disable_irq = true; in rt5682_dev_system_suspend()
746 mutex_unlock(&rt5682->disable_irq_lock); in rt5682_dev_system_suspend()
759 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); in rt5682_dev_resume() local
762 if (!rt5682->first_hw_init) in rt5682_dev_resume()
766 mutex_lock(&rt5682->disable_irq_lock); in rt5682_dev_resume()
767 if (rt5682->disable_irq == true) { in rt5682_dev_resume()
769 rt5682->disable_irq = false; in rt5682_dev_resume()
771 mutex_unlock(&rt5682->disable_irq_lock); in rt5682_dev_resume()
786 regcache_cache_only(rt5682->sdw_regmap, false); in rt5682_dev_resume()
787 regcache_cache_only(rt5682->regmap, false); in rt5682_dev_resume()
788 regcache_sync(rt5682->regmap); in rt5682_dev_resume()