.. | .. |
---|
330 | 330 | |
---|
331 | 331 | if (ucontrol->value.integer.value[0]) { |
---|
332 | 332 | /* 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) { |
---|
334 | 334 | dev_dbg(component->dev, |
---|
335 | 335 | "Disable noise suppression to enable ALC\n"); |
---|
336 | 336 | return -EINVAL; |
---|
.. | .. |
---|
354 | 354 | |
---|
355 | 355 | if (ucontrol->value.integer.value[0]) { |
---|
356 | 356 | /* 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) |
---|
358 | 358 | goto err; |
---|
359 | 359 | |
---|
360 | 360 | /* 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) & |
---|
362 | 362 | (DA7210_AUX1_L_ZC | DA7210_AUX1_R_ZC | DA7210_HP_L_ZC | |
---|
363 | 363 | DA7210_HP_R_ZC)) != (DA7210_AUX1_L_ZC | |
---|
364 | 364 | DA7210_AUX1_R_ZC | DA7210_HP_L_ZC | DA7210_HP_R_ZC)) |
---|
365 | 365 | goto err; |
---|
366 | 366 | |
---|
367 | 367 | /* 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); |
---|
369 | 369 | if (((val & DA7210_INPGA_L_VOL) < DA7210_INPGA_MIN_VOL_NS) || |
---|
370 | 370 | (((val & DA7210_INPGA_R_VOL) >> 4) < |
---|
371 | 371 | DA7210_INPGA_MIN_VOL_NS)) |
---|
372 | 372 | goto err; |
---|
373 | 373 | |
---|
374 | 374 | /* 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) < |
---|
376 | 376 | 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) < |
---|
378 | 378 | DA7210_AUX1_MIN_VOL_NS)) |
---|
379 | 379 | goto err; |
---|
380 | 380 | } |
---|
.. | .. |
---|
767 | 767 | /* Enable DAI */ |
---|
768 | 768 | snd_soc_component_write(component, DA7210_DAI_CFG3, DA7210_DAI_OE | DA7210_DAI_EN); |
---|
769 | 769 | |
---|
770 | | - dai_cfg1 = 0xFC & snd_soc_component_read32(component, DA7210_DAI_CFG1); |
---|
| 770 | + dai_cfg1 = 0xFC & snd_soc_component_read(component, DA7210_DAI_CFG1); |
---|
771 | 771 | |
---|
772 | 772 | switch (params_width(params)) { |
---|
773 | 773 | case 16: |
---|
.. | .. |
---|
874 | 874 | u32 dai_cfg1; |
---|
875 | 875 | u32 dai_cfg3; |
---|
876 | 876 | |
---|
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); |
---|
879 | 879 | |
---|
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))) |
---|
882 | 882 | return -EINVAL; |
---|
883 | 883 | |
---|
884 | 884 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
---|
.. | .. |
---|
924 | 924 | return 0; |
---|
925 | 925 | } |
---|
926 | 926 | |
---|
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) |
---|
928 | 928 | { |
---|
929 | 929 | 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; |
---|
931 | 931 | |
---|
932 | 932 | if (mute) |
---|
933 | 933 | snd_soc_component_write(component, DA7210_DAC_HPF, mute_reg | 0x4); |
---|
.. | .. |
---|
971 | 971 | |
---|
972 | 972 | /** |
---|
973 | 973 | * 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 |
---|
979 | 979 | * |
---|
980 | 980 | * Note: Supported PLL input frequencies are 12MHz, 13MHz, 13.5MHz, 14.4MHz, |
---|
981 | 981 | * 19.2MHz, 19.6MHz and 19.8MHz |
---|
| 982 | + * |
---|
| 983 | + * Return: Zero for success, negative error code for error |
---|
982 | 984 | */ |
---|
983 | 985 | static int da7210_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, |
---|
984 | 986 | int source, unsigned int fref, unsigned int fout) |
---|
.. | .. |
---|
1034 | 1036 | .set_fmt = da7210_set_dai_fmt, |
---|
1035 | 1037 | .set_sysclk = da7210_set_dai_sysclk, |
---|
1036 | 1038 | .set_pll = da7210_set_dai_pll, |
---|
1037 | | - .digital_mute = da7210_mute, |
---|
| 1039 | + .mute_stream = da7210_mute, |
---|
| 1040 | + .no_capture_mute = 1, |
---|
1038 | 1041 | }; |
---|
1039 | 1042 | |
---|
1040 | 1043 | static struct snd_soc_dai_driver da7210_dai = { |
---|
.. | .. |
---|
1333 | 1336 | int ret = 0; |
---|
1334 | 1337 | #if IS_ENABLED(CONFIG_I2C) |
---|
1335 | 1338 | ret = i2c_add_driver(&da7210_i2c_driver); |
---|
| 1339 | + if (ret) |
---|
| 1340 | + return ret; |
---|
1336 | 1341 | #endif |
---|
1337 | 1342 | #if defined(CONFIG_SPI_MASTER) |
---|
1338 | 1343 | ret = spi_register_driver(&da7210_spi_driver); |
---|