From b62b2da7bd3cf6d691d1a7bd87e5054cda3cf9dd Mon Sep 17 00:00:00 2001 From: Binyuan Lan Date: Wed, 16 May 2018 10:28:31 +0800 Subject: [PATCH] ASoC: rockchip: rk817-codec: fixup spk-volume and pdm bug Change-Id: Idd7ac0b0a12c75d8c43a57d8c8f9ecfccd399894 Signed-off-by: Binyuan Lan --- sound/soc/codecs/rk817_codec.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c index 3316f247bbcc..6d7ec02fa76a 100644 --- a/sound/soc/codecs/rk817_codec.c +++ b/sound/soc/codecs/rk817_codec.c @@ -247,6 +247,14 @@ static int rk817_codec_ctl_gpio(struct rk817_codec_priv *rk817, return 0; } +static int rk817_reset(struct snd_soc_codec *codec) +{ + snd_soc_write(codec, RK817_CODEC_DTOP_LPT_SRST, 0x40); + snd_soc_write(codec, RK817_CODEC_DDAC_POPD_DACST, 0x02); + + return 0; +} + static struct rk817_reg_val_typ playback_power_up_list[] = { {RK817_CODEC_AREF_RTCFG1, 0x40}, {RK817_CODEC_DDAC_POPD_DACST, 0x02}, @@ -262,7 +270,7 @@ static struct rk817_reg_val_typ playback_power_up_list[] = { {RK817_CODEC_DI2S_RXCMD_TSD, 0x00}, {RK817_CODEC_DI2S_RSD, 0x00}, - {RK817_CODEC_DI2S_CKM, 0x00}, + /* {RK817_CODEC_DI2S_CKM, 0x00}, */ {RK817_CODEC_DI2S_RXCR1, 0x00}, {RK817_CODEC_DI2S_RXCMD_TSD, 0x20}, {RK817_CODEC_DTOP_VUCTIME, 0xf4}, @@ -302,7 +310,7 @@ static struct rk817_reg_val_typ capture_power_up_list[] = { {RK817_CODEC_DI2S_RXCMD_TSD, 0x00}, {RK817_CODEC_DI2S_RSD, 0x00}, - {RK817_CODEC_DI2S_CKM, 0x00}, + /* {RK817_CODEC_DI2S_CKM, 0x00}, */ {RK817_CODEC_DI2S_RXCR1, 0x00}, {RK817_CODEC_DI2S_RXCMD_TSD, 0x20}, {RK817_CODEC_DTOP_VUCTIME, 0xf4}, @@ -581,10 +589,6 @@ static int rk817_playback_path_put(struct snd_kcontrol *kcontrol, return -EINVAL; } - if (rk817->capture_path != 0 && rk817->pdmdata_out_enable) - snd_soc_update_bits(codec, RK817_CODEC_DI2S_CKM, - PDM_EN_MASK, PDM_EN_ENABLE); - return 0; } @@ -893,6 +897,8 @@ static int rk817_probe(struct snd_soc_codec *codec) rk817->playback_path = OFF; rk817->capture_path = MIC_OFF; + rk817_reset(codec); + snd_soc_add_codec_controls(codec, rk817_snd_path_controls, ARRAY_SIZE(rk817_snd_path_controls)); return 0; @@ -984,9 +990,9 @@ static int rk817_codec_parse_dt_property(struct device *dev, DBG("spk mute delay %dms --- hp mute delay %dms\n", rk817->spk_mute_delay, rk817->hp_mute_delay); - ret = of_property_read_u32(node, "skp-volume", &rk817->spk_volume); + ret = of_property_read_u32(node, "spk-volume", &rk817->spk_volume); if (ret < 0) { - DBG("%s() Can not read property skp-volume\n", __func__); + DBG("%s() Can not read property spk-volume\n", __func__); rk817->spk_volume = OUT_VOLUME; } if (rk817->spk_volume < 3)