Lines Matching full:rk3328
3 // rk3328 ALSA SoC Audio driver
56 static int rk3328_codec_reset(struct rk3328_codec_priv *rk3328) in rk3328_codec_reset() argument
58 regmap_write(rk3328->regmap, CODEC_RESET, 0x00); in rk3328_codec_reset()
60 regmap_write(rk3328->regmap, CODEC_RESET, 0x03); in rk3328_codec_reset()
67 struct rk3328_codec_priv *rk3328 = in rk3328_set_dai_fmt() local
82 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL1, in rk3328_set_dai_fmt()
103 regmap_update_bits(rk3328->regmap, DAC_INIT_CTRL2, in rk3328_set_dai_fmt()
111 struct rk3328_codec_priv *rk3328 = in rk3328_mute_stream() local
120 regmap_update_bits(rk3328->regmap, HPOUT_CTRL, in rk3328_mute_stream()
126 static int rk3328_codec_power_on(struct rk3328_codec_priv *rk3328, int wait_ms) in rk3328_codec_power_on() argument
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()
139 static int rk3328_codec_power_off(struct rk3328_codec_priv *rk3328, int wait_ms) in rk3328_codec_power_off() argument
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()
181 static int rk3328_codec_open_playback(struct rk3328_codec_priv *rk3328) in rk3328_codec_open_playback() argument
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()
235 static int rk3328_codec_close_playback(struct rk3328_codec_priv *rk3328) in rk3328_codec_close_playback() argument
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()
255 rk3328_codec_reset(rk3328); in rk3328_codec_close_playback()
257 regmap_update_bits(rk3328->regmap, DAC_PRECHARGE_CTRL, in rk3328_codec_close_playback()
268 struct rk3328_codec_priv *rk3328 = in rk3328_hw_params() local
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()
300 struct rk3328_codec_priv *rk3328 = in rk3328_pcm_startup() local
303 return rk3328_codec_open_playback(rk3328); in rk3328_pcm_startup()
309 struct rk3328_codec_priv *rk3328 = in rk3328_pcm_shutdown() local
312 rk3328_codec_close_playback(rk3328); in rk3328_pcm_shutdown()
326 .name = "rk3328-hifi",
354 struct rk3328_codec_priv *rk3328 = in rk3328_codec_probe() local
357 rk3328_codec_reset(rk3328); in rk3328_codec_probe()
358 rk3328_codec_power_on(rk3328, 0); in rk3328_codec_probe()
365 struct rk3328_codec_priv *rk3328 = in rk3328_codec_remove() local
368 rk3328_codec_close_playback(rk3328); in rk3328_codec_remove()
369 rk3328_codec_power_off(rk3328, 0); in rk3328_codec_remove()
425 struct rk3328_codec_priv *rk3328; in rk3328_platform_probe() local
430 rk3328 = devm_kzalloc(&pdev->dev, sizeof(*rk3328), GFP_KERNEL); in rk3328_platform_probe()
431 if (!rk3328) in rk3328_platform_probe()
445 &rk3328->spk_depop_time); 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()
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()
476 ret = PTR_ERR(rk3328->pclk); in rk3328_platform_probe()
480 ret = clk_prepare_enable(rk3328->pclk); 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()
499 platform_set_drvdata(pdev, 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",
533 MODULE_DESCRIPTION("ASoC rk3328 codec driver");