Lines Matching refs:rk3528

37 static void rk3528_codec_pa_ctrl(struct rk3528_codec_priv *rk3528, bool on)  in rk3528_codec_pa_ctrl()  argument
39 if (!rk3528->pa_ctl_gpio) in rk3528_codec_pa_ctrl()
43 gpiod_direction_output(rk3528->pa_ctl_gpio, on); in rk3528_codec_pa_ctrl()
44 msleep(rk3528->pa_ctl_delay_ms); in rk3528_codec_pa_ctrl()
46 gpiod_direction_output(rk3528->pa_ctl_gpio, on); in rk3528_codec_pa_ctrl()
52 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_codec_reset() local
54 reset_control_assert(rk3528->reset); in rk3528_codec_reset()
56 reset_control_deassert(rk3528->reset); in rk3528_codec_reset()
58 regmap_update_bits(rk3528->regmap, ACODEC_DIG00, in rk3528_codec_reset()
63 regmap_update_bits(rk3528->regmap, ACODEC_DIG02, in rk3528_codec_reset()
67 regmap_update_bits(rk3528->regmap, ACODEC_DIG00, in rk3528_codec_reset()
72 regmap_update_bits(rk3528->regmap, ACODEC_DIG02, in rk3528_codec_reset()
79 static int rk3528_codec_power_on(struct rk3528_codec_priv *rk3528) in rk3528_codec_power_on() argument
83 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_power_on()
86 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_power_on()
90 regmap_update_bits(rk3528->regmap, ACODEC_ANA01, in rk3528_codec_power_on()
94 regmap_update_bits(rk3528->regmap, ACODEC_ANA00, in rk3528_codec_power_on()
100 regmap_update_bits(rk3528->regmap, ACODEC_ANA01, in rk3528_codec_power_on()
105 static int rk3528_codec_power_off(struct rk3528_codec_priv *rk3528) in rk3528_codec_power_off() argument
111 regmap_update_bits(rk3528->regmap, ACODEC_ANA01, in rk3528_codec_power_off()
115 regmap_update_bits(rk3528->regmap, ACODEC_ANA00, in rk3528_codec_power_off()
125 static int rk3528_codec_dac_enable(struct rk3528_codec_priv *rk3528) in rk3528_codec_dac_enable() argument
129 regmap_update_bits(rk3528->regmap, ACODEC_ANA00, in rk3528_codec_dac_enable()
133 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
136 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
140 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
143 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
147 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_enable()
150 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_enable()
154 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_enable()
157 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_enable()
161 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
164 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
168 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
171 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
175 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
178 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
182 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_enable()
185 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_enable()
189 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_enable()
192 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_enable()
201 static int rk3528_codec_dac_disable(struct rk3528_codec_priv *rk3528) in rk3528_codec_dac_disable() argument
206 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_disable()
209 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_disable()
213 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_disable()
216 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_disable()
220 regmap_update_bits(rk3528->regmap, ACODEC_ANA09, in rk3528_codec_dac_disable()
223 regmap_update_bits(rk3528->regmap, ACODEC_ANA0D, in rk3528_codec_dac_disable()
227 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
230 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
234 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
237 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
241 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
244 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
248 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
251 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
255 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
258 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
262 regmap_update_bits(rk3528->regmap, ACODEC_ANA00, in rk3528_codec_dac_disable()
266 regmap_update_bits(rk3528->regmap, ACODEC_ANA08, in rk3528_codec_dac_disable()
269 regmap_update_bits(rk3528->regmap, ACODEC_ANA0C, in rk3528_codec_dac_disable()
276 static int rk3528_codec_dac_dig_config(struct rk3528_codec_priv *rk3528, in rk3528_codec_dac_dig_config() argument
299 regmap_update_bits(rk3528->regmap, ACODEC_DIG01, in rk3528_codec_dac_dig_config()
303 regmap_update_bits(rk3528->regmap, ACODEC_DIG02, in rk3528_codec_dac_dig_config()
314 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_set_dai_fmt() local
341 regmap_update_bits(rk3528->regmap, ACODEC_DIG01, in rk3528_set_dai_fmt()
344 regmap_update_bits(rk3528->regmap, ACODEC_DIG02, in rk3528_set_dai_fmt()
355 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_mute_stream() local
360 regmap_update_bits(rk3528->regmap, in rk3528_mute_stream()
364 regmap_update_bits(rk3528->regmap, in rk3528_mute_stream()
368 rk3528_codec_pa_ctrl(rk3528, false); in rk3528_mute_stream()
371 regmap_update_bits(rk3528->regmap, in rk3528_mute_stream()
375 regmap_update_bits(rk3528->regmap, in rk3528_mute_stream()
379 rk3528_codec_pa_ctrl(rk3528, true); in rk3528_mute_stream()
386 static int rk3528_codec_default_gains(struct rk3528_codec_priv *rk3528) in rk3528_codec_default_gains() argument
390 regmap_update_bits(rk3528->regmap, ACODEC_DIG06, in rk3528_codec_default_gains()
393 regmap_update_bits(rk3528->regmap, ACODEC_ANA0B, in rk3528_codec_default_gains()
396 regmap_update_bits(rk3528->regmap, ACODEC_ANA0F, in rk3528_codec_default_gains()
403 static int rk3528_codec_open_playback(struct rk3528_codec_priv *rk3528) in rk3528_codec_open_playback() argument
405 rk3528_codec_dac_enable(rk3528); in rk3528_codec_open_playback()
410 static int rk3528_codec_close_playback(struct rk3528_codec_priv *rk3528) in rk3528_codec_close_playback() argument
412 rk3528_codec_dac_disable(rk3528); in rk3528_codec_close_playback()
416 static int rk3528_codec_dlp_down(struct rk3528_codec_priv *rk3528) in rk3528_codec_dlp_down() argument
421 static int rk3528_codec_dlp_up(struct rk3528_codec_priv *rk3528) in rk3528_codec_dlp_up() argument
423 rk3528_codec_power_on(rk3528); in rk3528_codec_dlp_up()
433 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_hw_params() local
436 rk3528_codec_open_playback(rk3528); in rk3528_hw_params()
437 rk3528_codec_dac_dig_config(rk3528, params); in rk3528_hw_params()
447 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_pcm_shutdown() local
450 rk3528_codec_close_playback(rk3528); in rk3528_pcm_shutdown()
452 regcache_cache_only(rk3528->regmap, false); in rk3528_pcm_shutdown()
453 regcache_sync(rk3528->regmap); in rk3528_pcm_shutdown()
456 static int rk3528_codec_prepare(struct rk3528_codec_priv *rk3528) in rk3528_codec_prepare() argument
459 rk3528_codec_close_playback(rk3528); in rk3528_codec_prepare()
460 rk3528_codec_default_gains(rk3528); in rk3528_codec_prepare()
469 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_set_sysclk() local
475 ret = clk_set_rate(rk3528->mclk, freq); in rk3528_set_sysclk()
477 dev_err(rk3528->plat_dev, "Failed to set mclk %d\n", ret); in rk3528_set_sysclk()
509 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_codec_probe() local
511 rk3528->component = component; in rk3528_codec_probe()
513 rk3528_codec_dlp_up(rk3528); in rk3528_codec_probe()
514 rk3528_codec_prepare(rk3528); in rk3528_codec_probe()
515 regcache_cache_only(rk3528->regmap, false); in rk3528_codec_probe()
516 regcache_sync(rk3528->regmap); in rk3528_codec_probe()
523 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_codec_remove() local
525 rk3528_codec_pa_ctrl(rk3528, false); in rk3528_codec_remove()
526 rk3528_codec_power_off(rk3528); in rk3528_codec_remove()
527 regcache_cache_only(rk3528->regmap, false); in rk3528_codec_remove()
528 regcache_sync(rk3528->regmap); in rk3528_codec_remove()
533 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_codec_suspend() local
535 rk3528_codec_dlp_down(rk3528); in rk3528_codec_suspend()
536 regcache_cache_only(rk3528->regmap, true); in rk3528_codec_suspend()
537 clk_disable_unprepare(rk3528->mclk); in rk3528_codec_suspend()
538 clk_disable_unprepare(rk3528->pclk); in rk3528_codec_suspend()
545 struct rk3528_codec_priv *rk3528 = snd_soc_component_get_drvdata(component); in rk3528_codec_resume() local
548 ret = clk_prepare_enable(rk3528->pclk); in rk3528_codec_resume()
550 dev_err(rk3528->plat_dev, in rk3528_codec_resume()
555 ret = clk_prepare_enable(rk3528->mclk); in rk3528_codec_resume()
557 dev_err(rk3528->plat_dev, in rk3528_codec_resume()
562 regcache_cache_only(rk3528->regmap, false); in rk3528_codec_resume()
563 ret = regcache_sync(rk3528->regmap); in rk3528_codec_resume()
567 rk3528_codec_dlp_up(rk3528); in rk3528_codec_resume()
571 clk_disable_unprepare(rk3528->mclk); in rk3528_codec_resume()
573 clk_disable_unprepare(rk3528->pclk); in rk3528_codec_resume()
658 struct rk3528_codec_priv *rk3528; in rk3528_platform_probe() local
663 rk3528 = devm_kzalloc(&pdev->dev, sizeof(*rk3528), GFP_KERNEL); in rk3528_platform_probe()
664 if (!rk3528) in rk3528_platform_probe()
667 rk3528->plat_dev = &pdev->dev; in rk3528_platform_probe()
668 rk3528->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "acodec"); in rk3528_platform_probe()
669 if (IS_ERR(rk3528->reset)) in rk3528_platform_probe()
670 return PTR_ERR(rk3528->reset); in rk3528_platform_probe()
672 rk3528->pa_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "pa-ctl", in rk3528_platform_probe()
674 if (IS_ERR(rk3528->pa_ctl_gpio)) { in rk3528_platform_probe()
679 if (rk3528->pa_ctl_gpio) in rk3528_platform_probe()
681 &rk3528->pa_ctl_delay_ms); in rk3528_platform_probe()
684 rk3528->pa_ctl_gpio ? "Use" : "No use", in rk3528_platform_probe()
685 rk3528->pa_ctl_delay_ms); in rk3528_platform_probe()
688 rk3528_codec_pa_ctrl(rk3528, false); in rk3528_platform_probe()
690 rk3528->pclk = devm_clk_get(&pdev->dev, "pclk"); in rk3528_platform_probe()
691 if (IS_ERR(rk3528->pclk)) { in rk3528_platform_probe()
696 rk3528->mclk = devm_clk_get(&pdev->dev, "mclk"); in rk3528_platform_probe()
697 if (IS_ERR(rk3528->mclk)) { in rk3528_platform_probe()
702 ret = clk_prepare_enable(rk3528->pclk); in rk3528_platform_probe()
708 ret = clk_prepare_enable(rk3528->mclk); in rk3528_platform_probe()
722 rk3528->regmap = devm_regmap_init_mmio(&pdev->dev, base, in rk3528_platform_probe()
724 if (IS_ERR(rk3528->regmap)) { in rk3528_platform_probe()
725 ret = PTR_ERR(rk3528->regmap); in rk3528_platform_probe()
730 platform_set_drvdata(pdev, rk3528); in rk3528_platform_probe()
741 clk_disable_unprepare(rk3528->mclk); in rk3528_platform_probe()
743 clk_disable_unprepare(rk3528->pclk); in rk3528_platform_probe()
750 struct rk3528_codec_priv *rk3528 = in rk3528_platform_remove() local
753 clk_disable_unprepare(rk3528->mclk); in rk3528_platform_remove()
754 clk_disable_unprepare(rk3528->pclk); in rk3528_platform_remove()