Prechádzať zdrojové kódy

asoc: wcd937x: Fix register names and properties

Update the register names and default values to
be same as the software document of codec.

CRs-Fixed: 2334177
Change-Id: Iec3ce76dceb44cef64c1f38a6cd75cb40ee2a539
Signed-off-by: Tanya Dixit <[email protected]>
Tanya Dixit 6 rokov pred
rodič
commit
46ec0f2835

+ 6 - 6
asoc/codecs/wcd937x/wcd937x-registers.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _WCD937X_REGISTERS_H
@@ -330,9 +330,9 @@ enum {
 #define WCD937X_DIGITAL_CDC_REQ_CTL                 (WCD937X_BASE_ADDRESS+0x457)
 #define WCD937X_DIGITAL_CDC_AMIC_CTL                (WCD937X_BASE_ADDRESS+0x45A)
 #define WCD937X_DIGITAL_CDC_DMIC_CTL                (WCD937X_BASE_ADDRESS+0x45B)
-#define WCD937X_DIGITAL_CDC_DMIC0_CTL               (WCD937X_BASE_ADDRESS+0x45C)
-#define WCD937X_DIGITAL_CDC_DMIC1_CTL               (WCD937X_BASE_ADDRESS+0x45D)
-#define WCD937X_DIGITAL_CDC_DMIC2_CTL               (WCD937X_BASE_ADDRESS+0x45E)
+#define WCD937X_DIGITAL_CDC_DMIC1_CTL               (WCD937X_BASE_ADDRESS+0x45C)
+#define WCD937X_DIGITAL_CDC_DMIC2_CTL               (WCD937X_BASE_ADDRESS+0x45D)
+#define WCD937X_DIGITAL_CDC_DMIC3_CTL               (WCD937X_BASE_ADDRESS+0x45E)
 #define WCD937X_DIGITAL_EFUSE_CTL                   (WCD937X_BASE_ADDRESS+0x45F)
 #define WCD937X_DIGITAL_EFUSE_PRG_CTL               (WCD937X_BASE_ADDRESS+0x460)
 #define WCD937X_DIGITAL_EFUSE_TEST_CTL_0            (WCD937X_BASE_ADDRESS+0x461)
@@ -374,8 +374,8 @@ enum {
 #define WCD937X_DIGITAL_SWR_HM_TEST                 (WCD937X_BASE_ADDRESS+0x494)
 #define WCD937X_DIGITAL_PAD_CTL_PDM_RX0             (WCD937X_BASE_ADDRESS+0x495)
 #define WCD937X_DIGITAL_PAD_CTL_PDM_RX1             (WCD937X_BASE_ADDRESS+0x496)
-#define WCD937X_DIGITAL_PAD_CTL_PDM_RX2             (WCD937X_BASE_ADDRESS+0x497)
-#define WCD937X_DIGITAL_PAD_CTL_PDM_TX              (WCD937X_BASE_ADDRESS+0x498)
+#define WCD937X_DIGITAL_PAD_CTL_PDM_TX0             (WCD937X_BASE_ADDRESS+0x497)
+#define WCD937X_DIGITAL_PAD_CTL_PDM_TX1             (WCD937X_BASE_ADDRESS+0x498)
 #define WCD937X_DIGITAL_PAD_INP_DIS_0               (WCD937X_BASE_ADDRESS+0x499)
 #define WCD937X_DIGITAL_PAD_INP_DIS_1               (WCD937X_BASE_ADDRESS+0x49A)
 #define WCD937X_DIGITAL_DRIVE_STRENGTH_0            (WCD937X_BASE_ADDRESS+0x49B)

+ 16 - 15
asoc/codecs/wcd937x/wcd937x-regmap.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/regmap.h>
@@ -236,7 +236,7 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIE_CRACK_INT_DIE_CRK_DET_INT1, 0x02 },
 	{ WCD937X_DIE_CRACK_INT_DIE_CRK_DET_INT2, 0x60 },
 	{ WCD937X_DIGITAL_PAGE_REGISTER,          0x00 },
-	{ WCD937X_DIGITAL_CHIP_ID0,               0x00 },
+	{ WCD937X_DIGITAL_CHIP_ID0,               0x01 },
 	{ WCD937X_DIGITAL_CHIP_ID1,               0x00 },
 	{ WCD937X_DIGITAL_CHIP_ID2,               0x0A },
 	{ WCD937X_DIGITAL_CHIP_ID3,               0x01 },
@@ -273,12 +273,12 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_CDC_HPH_DSM_C_2,        0xB1 },
 	{ WCD937X_DIGITAL_CDC_HPH_DSM_C_3,        0x17 },
 	{ WCD937X_DIGITAL_CDC_HPH_DSM_R1,         0x4B },
-	{ WCD937X_DIGITAL_CDC_HPH_DSM_R2,         0x27 },
+	{ WCD937X_DIGITAL_CDC_HPH_DSM_R2,         0x26 },
 	{ WCD937X_DIGITAL_CDC_HPH_DSM_R3,         0x32 },
 	{ WCD937X_DIGITAL_CDC_HPH_DSM_R4,         0x57 },
-	{ WCD937X_DIGITAL_CDC_HPH_DSM_R4,         0x63 },
-	{ WCD937X_DIGITAL_CDC_HPH_DSM_R4,         0x7C },
-	{ WCD937X_DIGITAL_CDC_HPH_DSM_R4,         0x57 },
+	{ WCD937X_DIGITAL_CDC_HPH_DSM_R5,         0x63 },
+	{ WCD937X_DIGITAL_CDC_HPH_DSM_R6,         0x7C },
+	{ WCD937X_DIGITAL_CDC_HPH_DSM_R7,         0x57 },
 	{ WCD937X_DIGITAL_CDC_AUX_DSM_A1_0,       0x00 },
 	{ WCD937X_DIGITAL_CDC_AUX_DSM_A1_1,       0x01 },
 	{ WCD937X_DIGITAL_CDC_AUX_DSM_A2_0,       0x96 },
@@ -322,9 +322,9 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_CDC_REQ_CTL,            0x01 },
 	{ WCD937X_DIGITAL_CDC_AMIC_CTL,           0x07 },
 	{ WCD937X_DIGITAL_CDC_DMIC_CTL,           0x00 },
-	{ WCD937X_DIGITAL_CDC_DMIC0_CTL,          0x01 },
 	{ WCD937X_DIGITAL_CDC_DMIC1_CTL,          0x01 },
 	{ WCD937X_DIGITAL_CDC_DMIC2_CTL,          0x01 },
+	{ WCD937X_DIGITAL_CDC_DMIC3_CTL,          0x01 },
 	{ WCD937X_DIGITAL_EFUSE_CTL,              0x2B },
 	{ WCD937X_DIGITAL_EFUSE_PRG_CTL,          0x00 },
 	{ WCD937X_DIGITAL_EFUSE_TEST_CTL_0,       0x00 },
@@ -337,7 +337,7 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_INTR_MODE,              0x00 },
 	{ WCD937X_DIGITAL_INTR_MASK_0,            0xFF },
 	{ WCD937X_DIGITAL_INTR_MASK_1,            0xFF },
-	{ WCD937X_DIGITAL_INTR_MASK_2,            0xFF },
+	{ WCD937X_DIGITAL_INTR_MASK_2,            0x0F },
 	{ WCD937X_DIGITAL_INTR_STATUS_0,          0x00 },
 	{ WCD937X_DIGITAL_INTR_STATUS_1,          0x00 },
 	{ WCD937X_DIGITAL_INTR_STATUS_2,          0x00 },
@@ -366,8 +366,9 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_SWR_HM_TEST,            0x00 },
 	{ WCD937X_DIGITAL_PAD_CTL_PDM_RX0,        0xF1 },
 	{ WCD937X_DIGITAL_PAD_CTL_PDM_RX1,        0xF1 },
-	{ WCD937X_DIGITAL_PAD_CTL_PDM_RX2,        0xF1 },
-	{ WCD937X_DIGITAL_PAD_CTL_PDM_TX,         0xF1 },
+	{ WCD937X_DIGITAL_PAD_CTL_PDM_TX0,        0xF1 },
+	{ WCD937X_DIGITAL_PAD_CTL_PDM_TX1,        0xF1 },
+	{ WCD937X_DIGITAL_PAD_INP_DIS_0,          0x00 },
 	{ WCD937X_DIGITAL_PAD_INP_DIS_1,          0x00 },
 	{ WCD937X_DIGITAL_DRIVE_STRENGTH_0,       0x00 },
 	{ WCD937X_DIGITAL_DRIVE_STRENGTH_1,       0x00 },
@@ -390,7 +391,7 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_SPARE_0,                0x00 },
 	{ WCD937X_DIGITAL_SPARE_1,                0x00 },
 	{ WCD937X_DIGITAL_SPARE_2,                0x00 },
-	{ WCD937X_DIGITAL_EFUSE_REG_0,            0xFF },
+	{ WCD937X_DIGITAL_EFUSE_REG_0,            0x00 },
 	{ WCD937X_DIGITAL_EFUSE_REG_1,            0xFF },
 	{ WCD937X_DIGITAL_EFUSE_REG_2,            0xFF },
 	{ WCD937X_DIGITAL_EFUSE_REG_3,            0xFF },
@@ -411,10 +412,10 @@ static const struct reg_default wcd937x_defaults[] = {
 	{ WCD937X_DIGITAL_EFUSE_REG_18,           0xFF },
 	{ WCD937X_DIGITAL_EFUSE_REG_19,           0xFF },
 	{ WCD937X_DIGITAL_EFUSE_REG_20,           0x0E },
-	{ WCD937X_DIGITAL_EFUSE_REG_21,           0x8F },
-	{ WCD937X_DIGITAL_EFUSE_REG_22,           0x16 },
-	{ WCD937X_DIGITAL_EFUSE_REG_23,           0x00 },
-	{ WCD937X_DIGITAL_EFUSE_REG_24,           0x00 },
+	{ WCD937X_DIGITAL_EFUSE_REG_21,           0x00 },
+	{ WCD937X_DIGITAL_EFUSE_REG_22,           0x00 },
+	{ WCD937X_DIGITAL_EFUSE_REG_23,           0xF8 },
+	{ WCD937X_DIGITAL_EFUSE_REG_24,           0x16 },
 	{ WCD937X_DIGITAL_EFUSE_REG_25,           0x00 },
 	{ WCD937X_DIGITAL_EFUSE_REG_26,           0x00 },
 	{ WCD937X_DIGITAL_EFUSE_REG_27,           0x00 },

+ 36 - 37
asoc/codecs/wcd937x/wcd937x-tables.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018 , The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 , The Linux Foundation. All rights reserved.
  */
 
 #include <linux/types.h>
@@ -318,9 +318,9 @@ const u8 wcd937x_reg_access[WCD937X_REG(WCD937X_REGISTERS_MAX_SIZE)] = {
 	[WCD937X_REG(WCD937X_DIGITAL_CDC_REQ_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_CDC_AMIC_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_CDC_DMIC_CTL)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_CDC_DMIC0_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_CDC_DMIC1_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_CDC_DMIC2_CTL)] = RD_WR_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_CDC_DMIC3_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_PRG_CTL)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_TEST_CTL_0)] = RD_WR_REG,
@@ -362,9 +362,8 @@ const u8 wcd937x_reg_access[WCD937X_REG(WCD937X_REGISTERS_MAX_SIZE)] = {
 	[WCD937X_REG(WCD937X_DIGITAL_SWR_HM_TEST)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_RX0)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_RX1)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_RX2)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_TX)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_TX)] = RD_WR_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_TX0)] = RD_WR_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_PAD_CTL_PDM_TX1)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_PAD_INP_DIS_0)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_PAD_INP_DIS_1)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_DRIVE_STRENGTH_0)] = RD_WR_REG,
@@ -388,36 +387,36 @@ const u8 wcd937x_reg_access[WCD937X_REG(WCD937X_REGISTERS_MAX_SIZE)] = {
 	[WCD937X_REG(WCD937X_DIGITAL_SPARE_0)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_SPARE_1)] = RD_WR_REG,
 	[WCD937X_REG(WCD937X_DIGITAL_SPARE_2)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_0)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_1)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_2)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_3)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_4)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_5)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_6)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_7)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_8)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_9)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_10)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_11)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_12)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_13)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_14)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_15)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_16)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_17)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_18)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_19)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_20)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_21)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_22)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_23)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_24)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_25)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_26)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_27)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_28)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_29)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_30)] = RD_WR_REG,
-	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_31)] = RD_WR_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_0)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_1)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_2)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_3)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_4)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_5)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_6)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_7)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_8)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_9)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_10)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_11)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_12)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_13)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_14)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_15)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_16)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_17)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_18)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_19)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_20)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_21)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_22)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_23)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_24)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_25)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_26)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_27)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_28)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_29)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_30)] = RD_REG,
+	[WCD937X_REG(WCD937X_DIGITAL_EFUSE_REG_31)] = RD_REG,
 };

+ 5 - 5
asoc/codecs/wcd937x/wcd937x.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/module.h>
@@ -1024,17 +1024,17 @@ static int wcd937x_codec_enable_dmic(struct snd_soc_dapm_widget *w,
 	case 0:
 	case 1:
 		dmic_clk_cnt = &(wcd937x->dmic_0_1_clk_cnt);
-		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC0_CTL;
+		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC1_CTL;
 		break;
 	case 2:
 	case 3:
 		dmic_clk_cnt = &(wcd937x->dmic_2_3_clk_cnt);
-		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC1_CTL;
+		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC2_CTL;
 		break;
 	case 4:
 	case 5:
 		dmic_clk_cnt = &(wcd937x->dmic_4_5_clk_cnt);
-		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC2_CTL;
+		dmic_clk_reg = WCD937X_DIGITAL_CDC_DMIC3_CTL;
 		break;
 	default:
 		dev_err(component->dev, "%s: Invalid DMIC Selection\n",
@@ -2098,7 +2098,7 @@ static int wcd937x_soc_codec_probe(struct snd_soc_component *component)
 
 	wcd937x->component = component;
 	variant = (snd_soc_component_read32(
-			component, WCD937X_DIGITAL_EFUSE_REG_0) & 0x0E) >> 1;
+			component, WCD937X_DIGITAL_EFUSE_REG_0) & 0x1E) >> 1;
 	wcd937x->variant = variant;
 
 	wcd937x->fw_data = devm_kzalloc(component->dev,