Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: fsl_micfil: Add a flag to distinguish with different volume control types

On i.MX8MM the register of volume control has positive and negative
values. It is different from other platforms like i.MX8MP and i.MX93
which only have positive values. Add a volume_sx flag to use SX_TLV
volume control for this kind of platform. Use common TLV volume control
for other platforms.

Fixes: cdfa92eb90f5 ("ASoC: fsl_micfil: Correct the number of steps on SX controls")
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20241017071507.2577786-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Chancel Liu and committed by
Mark Brown
da95e891 9fc9ef05

+42 -1
+42 -1
sound/soc/fsl/fsl_micfil.c
··· 67 67 bool imx; 68 68 bool use_edma; 69 69 bool use_verid; 70 + bool volume_sx; 70 71 u64 formats; 71 72 }; 72 73 ··· 77 76 .fifo_depth = 8, 78 77 .dataline = 0xf, 79 78 .formats = SNDRV_PCM_FMTBIT_S16_LE, 79 + .volume_sx = true, 80 80 }; 81 81 82 82 static struct fsl_micfil_soc_data fsl_micfil_imx8mp = { ··· 86 84 .fifo_depth = 32, 87 85 .dataline = 0xf, 88 86 .formats = SNDRV_PCM_FMTBIT_S32_LE, 87 + .volume_sx = false, 89 88 }; 90 89 91 90 static struct fsl_micfil_soc_data fsl_micfil_imx93 = { ··· 97 94 .formats = SNDRV_PCM_FMTBIT_S32_LE, 98 95 .use_edma = true, 99 96 .use_verid = true, 97 + .volume_sx = false, 100 98 }; 101 99 102 100 static const struct of_device_id fsl_micfil_dt_ids[] = { ··· 321 317 return 0; 322 318 } 323 319 324 - static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { 320 + static const struct snd_kcontrol_new fsl_micfil_volume_controls[] = { 321 + SOC_SINGLE_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL, 322 + MICFIL_OUTGAIN_CHX_SHIFT(0), 0xF, 0, gain_tlv), 323 + SOC_SINGLE_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL, 324 + MICFIL_OUTGAIN_CHX_SHIFT(1), 0xF, 0, gain_tlv), 325 + SOC_SINGLE_TLV("CH2 Volume", REG_MICFIL_OUT_CTRL, 326 + MICFIL_OUTGAIN_CHX_SHIFT(2), 0xF, 0, gain_tlv), 327 + SOC_SINGLE_TLV("CH3 Volume", REG_MICFIL_OUT_CTRL, 328 + MICFIL_OUTGAIN_CHX_SHIFT(3), 0xF, 0, gain_tlv), 329 + SOC_SINGLE_TLV("CH4 Volume", REG_MICFIL_OUT_CTRL, 330 + MICFIL_OUTGAIN_CHX_SHIFT(4), 0xF, 0, gain_tlv), 331 + SOC_SINGLE_TLV("CH5 Volume", REG_MICFIL_OUT_CTRL, 332 + MICFIL_OUTGAIN_CHX_SHIFT(5), 0xF, 0, gain_tlv), 333 + SOC_SINGLE_TLV("CH6 Volume", REG_MICFIL_OUT_CTRL, 334 + MICFIL_OUTGAIN_CHX_SHIFT(6), 0xF, 0, gain_tlv), 335 + SOC_SINGLE_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL, 336 + MICFIL_OUTGAIN_CHX_SHIFT(7), 0xF, 0, gain_tlv), 337 + }; 338 + 339 + static const struct snd_kcontrol_new fsl_micfil_volume_sx_controls[] = { 325 340 SOC_SINGLE_SX_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL, 326 341 MICFIL_OUTGAIN_CHX_SHIFT(0), 0x8, 0xF, gain_tlv), 327 342 SOC_SINGLE_SX_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL, ··· 357 334 MICFIL_OUTGAIN_CHX_SHIFT(6), 0x8, 0xF, gain_tlv), 358 335 SOC_SINGLE_SX_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL, 359 336 MICFIL_OUTGAIN_CHX_SHIFT(7), 0x8, 0xF, gain_tlv), 337 + }; 338 + 339 + static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { 360 340 SOC_ENUM_EXT("MICFIL Quality Select", 361 341 fsl_micfil_quality_enum, 362 342 micfil_quality_get, micfil_quality_set), ··· 827 801 return 0; 828 802 } 829 803 804 + static int fsl_micfil_component_probe(struct snd_soc_component *component) 805 + { 806 + struct fsl_micfil *micfil = snd_soc_component_get_drvdata(component); 807 + 808 + if (micfil->soc->volume_sx) 809 + snd_soc_add_component_controls(component, fsl_micfil_volume_sx_controls, 810 + ARRAY_SIZE(fsl_micfil_volume_sx_controls)); 811 + else 812 + snd_soc_add_component_controls(component, fsl_micfil_volume_controls, 813 + ARRAY_SIZE(fsl_micfil_volume_controls)); 814 + 815 + return 0; 816 + } 817 + 830 818 static const struct snd_soc_dai_ops fsl_micfil_dai_ops = { 831 819 .probe = fsl_micfil_dai_probe, 832 820 .startup = fsl_micfil_startup, ··· 861 821 862 822 static const struct snd_soc_component_driver fsl_micfil_component = { 863 823 .name = "fsl-micfil-dai", 824 + .probe = fsl_micfil_component_probe, 864 825 .controls = fsl_micfil_snd_controls, 865 826 .num_controls = ARRAY_SIZE(fsl_micfil_snd_controls), 866 827 .legacy_dai_naming = 1,