From eb6008aebfe7be511b1d3dc72194eced60aed97a Mon Sep 17 00:00:00 2001 From: Phani Kumar Uppalapati Date: Wed, 26 Apr 2023 14:45:06 -0700 Subject: [PATCH] wcd939x: update register defaults for wcd939x codec Few register default values are incorrectly set for harmonium codec in the register map table. Fix it by setting correct values as per the hardware interface documentation. Change-Id: Ibcb517d6050a4932243ead396e6f89294aab4a23 Signed-off-by: Phani Kumar Uppalapati --- asoc/codecs/wcd939x/wcd939x-regmap.c | 12 ++++++------ asoc/codecs/wcd939x/wcd939x.c | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/asoc/codecs/wcd939x/wcd939x-regmap.c b/asoc/codecs/wcd939x/wcd939x-regmap.c index 96fb3fb345..95b9c83d66 100644 --- a/asoc/codecs/wcd939x/wcd939x-regmap.c +++ b/asoc/codecs/wcd939x/wcd939x-regmap.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -63,12 +63,12 @@ static struct reg_default wcd939x_defaults[] = { {WCD939X_MICB2_TEST_CTL_1, 0x1a}, {WCD939X_MICB2_TEST_CTL_2, 0x00}, {WCD939X_MICB2_TEST_CTL_3, 0x24}, - {WCD939X_MICB3_TEST_CTL_1, 0x1a}, - {WCD939X_MICB3_TEST_CTL_2, 0x00}, - {WCD939X_MICB3_TEST_CTL_3, 0xa4}, + {WCD939X_MICB3_TEST_CTL_1, 0x9a}, + {WCD939X_MICB3_TEST_CTL_2, 0x80}, + {WCD939X_MICB3_TEST_CTL_3, 0x24}, {WCD939X_MICB4_TEST_CTL_1, 0x1a}, - {WCD939X_MICB4_TEST_CTL_2, 0x00}, - {WCD939X_MICB4_TEST_CTL_3, 0xa4}, + {WCD939X_MICB4_TEST_CTL_2, 0x80}, + {WCD939X_MICB4_TEST_CTL_3, 0x24}, {WCD939X_ADC_VCM, 0x39}, {WCD939X_BIAS_ATEST, 0xe0}, {WCD939X_SPARE1, 0x00}, diff --git a/asoc/codecs/wcd939x/wcd939x.c b/asoc/codecs/wcd939x/wcd939x.c index 034ee11912..54ce030076 100644 --- a/asoc/codecs/wcd939x/wcd939x.c +++ b/asoc/codecs/wcd939x/wcd939x.c @@ -380,6 +380,7 @@ static int wcd939x_set_swr_clk_rate(struct snd_soc_component *component, static int wcd939x_init_reg(struct snd_soc_component *component) { + struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); snd_soc_component_update_bits(component, REG_FIELD_VALUE(BIAS, ANALOG_BIAS_EN, 0x01)); @@ -436,7 +437,8 @@ static int wcd939x_init_reg(struct snd_soc_component *component) snd_soc_component_update_bits(component, REG_FIELD_VALUE(HPH_OCP_CTL, SCD_OP_EN, 0x01)); - snd_soc_component_write(component, WCD939X_CFG0, 0x05); + if (wcd939x->version != WCD939X_VERSION_2_0) + snd_soc_component_write(component, WCD939X_CFG0, 0x05); return 0; }