Lines Matching +full:spk +full:- +full:shutdown
1 // SPDX-License-Identifier: GPL-2.0
22 * 0: -39dB
58 regmap_write(rk3328->regmap, CODEC_RESET, 0x00); in rk3328_codec_reset()
60 regmap_write(rk3328->regmap, CODEC_RESET, 0x03); in rk3328_codec_reset()
68 snd_soc_component_get_drvdata(dai->component); in rk3328_set_dai_fmt()
79 return -EINVAL; in rk3328_set_dai_fmt()
82 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL1, in rk3328_set_dai_fmt()
100 return -EINVAL; in rk3328_set_dai_fmt()
103 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL2, in rk3328_set_dai_fmt()
112 snd_soc_component_get_drvdata(dai->component); in rk3328_mute_stream()
120 regmap_update_bits(rk3328->regmap, HPOUT_CTRL, in rk3328_mute_stream()
128 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_power_on()
131 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_power_on()
141 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_power_off()
144 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_power_off()
185 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_open_playback()
190 regmap_update_bits(rk3328->regmap, in rk3328_codec_open_playback()
197 msleep(rk3328->spk_depop_time); in rk3328_codec_open_playback()
198 gpiod_set_value(rk3328->mute, 0); in rk3328_codec_open_playback()
200 regmap_update_bits(rk3328->regmap, HPOUTL_GAIN_CTRL, in rk3328_codec_open_playback()
202 regmap_update_bits(rk3328->regmap, HPOUTR_GAIN_CTRL, in rk3328_codec_open_playback()
239 gpiod_set_value(rk3328->mute, 1); in rk3328_codec_close_playback()
241 regmap_update_bits(rk3328->regmap, HPOUTL_GAIN_CTRL, in rk3328_codec_close_playback()
243 regmap_update_bits(rk3328->regmap, HPOUTR_GAIN_CTRL, in rk3328_codec_close_playback()
247 regmap_update_bits(rk3328->regmap, in rk3328_codec_close_playback()
254 /* Workaround for silence when changed Fs 48 -> 44.1kHz */ in rk3328_codec_close_playback()
257 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_close_playback()
269 snd_soc_component_get_drvdata(dai->component); in rk3328_hw_params()
286 return -EINVAL; in rk3328_hw_params()
288 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL2, DAC_VDL_MASK, val); in rk3328_hw_params()
291 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL3, in rk3328_hw_params()
301 snd_soc_component_get_drvdata(dai->component); in rk3328_pcm_startup()
310 snd_soc_component_get_drvdata(dai->component); in rk3328_pcm_shutdown()
320 .shutdown = rk3328_pcm_shutdown,
326 .name = "rk3328-hifi",
424 struct device_node *rk3328_np = pdev->dev.of_node; in rk3328_platform_probe()
430 rk3328 = devm_kzalloc(&pdev->dev, sizeof(*rk3328), GFP_KERNEL); in rk3328_platform_probe()
432 return -ENOMEM; in rk3328_platform_probe()
437 dev_err(&pdev->dev, "missing 'rockchip,grf'\n"); in rk3328_platform_probe()
444 ret = of_property_read_u32(rk3328_np, "spk-depop-time-ms", in rk3328_platform_probe()
445 &rk3328->spk_depop_time); in rk3328_platform_probe()
447 dev_info(&pdev->dev, "spk_depop_time use default value.\n"); in rk3328_platform_probe()
448 rk3328->spk_depop_time = 200; in rk3328_platform_probe()
451 rk3328->mute = gpiod_get_optional(&pdev->dev, "mute", GPIOD_OUT_HIGH); in rk3328_platform_probe()
452 if (IS_ERR(rk3328->mute)) in rk3328_platform_probe()
453 return PTR_ERR(rk3328->mute); in rk3328_platform_probe()
459 if (!rk3328->mute && of_machine_is_compatible("pine64,rock64")) { in rk3328_platform_probe()
460 dev_warn(&pdev->dev, "assuming implicit control of GPIO_MUTE; update devicetree if possible\n"); in rk3328_platform_probe()
464 rk3328->mclk = devm_clk_get(&pdev->dev, "mclk"); in rk3328_platform_probe()
465 if (IS_ERR(rk3328->mclk)) in rk3328_platform_probe()
466 return PTR_ERR(rk3328->mclk); in rk3328_platform_probe()
468 ret = clk_prepare_enable(rk3328->mclk); in rk3328_platform_probe()
471 clk_set_rate(rk3328->mclk, INITIAL_FREQ); in rk3328_platform_probe()
473 rk3328->pclk = devm_clk_get(&pdev->dev, "pclk"); in rk3328_platform_probe()
474 if (IS_ERR(rk3328->pclk)) { in rk3328_platform_probe()
475 dev_err(&pdev->dev, "can't get acodec pclk\n"); in rk3328_platform_probe()
476 ret = PTR_ERR(rk3328->pclk); in rk3328_platform_probe()
480 ret = clk_prepare_enable(rk3328->pclk); in rk3328_platform_probe()
482 dev_err(&pdev->dev, "failed to enable acodec pclk\n"); in rk3328_platform_probe()
492 rk3328->regmap = devm_regmap_init_mmio(&pdev->dev, base, in rk3328_platform_probe()
494 if (IS_ERR(rk3328->regmap)) { in rk3328_platform_probe()
495 ret = PTR_ERR(rk3328->regmap); in rk3328_platform_probe()
501 ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_rk3328, in rk3328_platform_probe()
510 clk_disable_unprepare(rk3328->pclk); in rk3328_platform_probe()
513 clk_disable_unprepare(rk3328->mclk); in rk3328_platform_probe()
518 { .compatible = "rockchip,rk3328-codec", },
525 .name = "rk3328-codec",
532 MODULE_AUTHOR("Sugar Zhang <sugar.zhang@rock-chips.com>");