hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/da7210.c
....@@ -330,7 +330,7 @@
330330
331331 if (ucontrol->value.integer.value[0]) {
332332 /* Check if noise suppression is enabled */
333
- if (snd_soc_component_read32(component, DA7210_CONTROL) & DA7210_NOISE_SUP_EN) {
333
+ if (snd_soc_component_read(component, DA7210_CONTROL) & DA7210_NOISE_SUP_EN) {
334334 dev_dbg(component->dev,
335335 "Disable noise suppression to enable ALC\n");
336336 return -EINVAL;
....@@ -354,27 +354,27 @@
354354
355355 if (ucontrol->value.integer.value[0]) {
356356 /* Check if ALC is enabled */
357
- if (snd_soc_component_read32(component, DA7210_ADC) & DA7210_ADC_ALC_EN)
357
+ if (snd_soc_component_read(component, DA7210_ADC) & DA7210_ADC_ALC_EN)
358358 goto err;
359359
360360 /* Check ZC for HP and AUX1 PGA */
361
- if ((snd_soc_component_read32(component, DA7210_ZERO_CROSS) &
361
+ if ((snd_soc_component_read(component, DA7210_ZERO_CROSS) &
362362 (DA7210_AUX1_L_ZC | DA7210_AUX1_R_ZC | DA7210_HP_L_ZC |
363363 DA7210_HP_R_ZC)) != (DA7210_AUX1_L_ZC |
364364 DA7210_AUX1_R_ZC | DA7210_HP_L_ZC | DA7210_HP_R_ZC))
365365 goto err;
366366
367367 /* Check INPGA_L_VOL and INPGA_R_VOL */
368
- val = snd_soc_component_read32(component, DA7210_IN_GAIN);
368
+ val = snd_soc_component_read(component, DA7210_IN_GAIN);
369369 if (((val & DA7210_INPGA_L_VOL) < DA7210_INPGA_MIN_VOL_NS) ||
370370 (((val & DA7210_INPGA_R_VOL) >> 4) <
371371 DA7210_INPGA_MIN_VOL_NS))
372372 goto err;
373373
374374 /* Check AUX1_L_VOL and AUX1_R_VOL */
375
- if (((snd_soc_component_read32(component, DA7210_AUX1_L) & DA7210_AUX1_L_VOL) <
375
+ if (((snd_soc_component_read(component, DA7210_AUX1_L) & DA7210_AUX1_L_VOL) <
376376 DA7210_AUX1_MIN_VOL_NS) ||
377
- ((snd_soc_component_read32(component, DA7210_AUX1_R) & DA7210_AUX1_R_VOL) <
377
+ ((snd_soc_component_read(component, DA7210_AUX1_R) & DA7210_AUX1_R_VOL) <
378378 DA7210_AUX1_MIN_VOL_NS))
379379 goto err;
380380 }
....@@ -767,7 +767,7 @@
767767 /* Enable DAI */
768768 snd_soc_component_write(component, DA7210_DAI_CFG3, DA7210_DAI_OE | DA7210_DAI_EN);
769769
770
- dai_cfg1 = 0xFC & snd_soc_component_read32(component, DA7210_DAI_CFG1);
770
+ dai_cfg1 = 0xFC & snd_soc_component_read(component, DA7210_DAI_CFG1);
771771
772772 switch (params_width(params)) {
773773 case 16:
....@@ -874,11 +874,11 @@
874874 u32 dai_cfg1;
875875 u32 dai_cfg3;
876876
877
- dai_cfg1 = 0x7f & snd_soc_component_read32(component, DA7210_DAI_CFG1);
878
- dai_cfg3 = 0xfc & snd_soc_component_read32(component, DA7210_DAI_CFG3);
877
+ dai_cfg1 = 0x7f & snd_soc_component_read(component, DA7210_DAI_CFG1);
878
+ dai_cfg3 = 0xfc & snd_soc_component_read(component, DA7210_DAI_CFG3);
879879
880
- if ((snd_soc_component_read32(component, DA7210_PLL) & DA7210_PLL_EN) &&
881
- (!(snd_soc_component_read32(component, DA7210_PLL_DIV3) & DA7210_PLL_BYP)))
880
+ if ((snd_soc_component_read(component, DA7210_PLL) & DA7210_PLL_EN) &&
881
+ (!(snd_soc_component_read(component, DA7210_PLL_DIV3) & DA7210_PLL_BYP)))
882882 return -EINVAL;
883883
884884 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
....@@ -924,10 +924,10 @@
924924 return 0;
925925 }
926926
927
-static int da7210_mute(struct snd_soc_dai *dai, int mute)
927
+static int da7210_mute(struct snd_soc_dai *dai, int mute, int direction)
928928 {
929929 struct snd_soc_component *component = dai->component;
930
- u8 mute_reg = snd_soc_component_read32(component, DA7210_DAC_HPF) & 0xFB;
930
+ u8 mute_reg = snd_soc_component_read(component, DA7210_DAC_HPF) & 0xFB;
931931
932932 if (mute)
933933 snd_soc_component_write(component, DA7210_DAC_HPF, mute_reg | 0x4);
....@@ -971,14 +971,16 @@
971971
972972 /**
973973 * da7210_set_dai_pll :Configure the codec PLL
974
- * @param codec_dai : pointer to codec DAI
975
- * @param pll_id : da7210 has only one pll, so pll_id is always zero
976
- * @param fref : MCLK frequency, should be < 20MHz
977
- * @param fout : FsDM value, Refer page 44 & 45 of datasheet
978
- * @return int : Zero for success, negative error code for error
974
+ * @codec_dai: pointer to codec DAI
975
+ * @pll_id: da7210 has only one pll, so pll_id is always zero
976
+ * @source: clock source
977
+ * @fref: MCLK frequency, should be < 20MHz
978
+ * @fout: FsDM value, Refer page 44 & 45 of datasheet
979979 *
980980 * Note: Supported PLL input frequencies are 12MHz, 13MHz, 13.5MHz, 14.4MHz,
981981 * 19.2MHz, 19.6MHz and 19.8MHz
982
+ *
983
+ * Return: Zero for success, negative error code for error
982984 */
983985 static int da7210_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
984986 int source, unsigned int fref, unsigned int fout)
....@@ -1034,7 +1036,8 @@
10341036 .set_fmt = da7210_set_dai_fmt,
10351037 .set_sysclk = da7210_set_dai_sysclk,
10361038 .set_pll = da7210_set_dai_pll,
1037
- .digital_mute = da7210_mute,
1039
+ .mute_stream = da7210_mute,
1040
+ .no_capture_mute = 1,
10381041 };
10391042
10401043 static struct snd_soc_dai_driver da7210_dai = {
....@@ -1333,6 +1336,8 @@
13331336 int ret = 0;
13341337 #if IS_ENABLED(CONFIG_I2C)
13351338 ret = i2c_add_driver(&da7210_i2c_driver);
1339
+ if (ret)
1340
+ return ret;
13361341 #endif
13371342 #if defined(CONFIG_SPI_MASTER)
13381343 ret = spi_register_driver(&da7210_spi_driver);