
On Tue, 14 Jan 2020 10:48:24 +0100, jeff_chang(張世佳) wrote:
Dear Takashi:
Thank for your replying.
1.> +static int mt6660_component_get_volsw(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol) {
+struct snd_soc_component *component = +snd_soc_kcontrol_component(kcontrol); +struct mt6660_chip *chip = (struct mt6660_chip *) +snd_soc_component_get_drvdata(component); +int ret = -EINVAL;
+if (!strcmp(kcontrol->id.name, "Chip Rev")) { +ucontrol->value.integer.value[0] = chip->chip_rev & 0x0f; +ret = 0; +} +return ret;
So, "T0 SEL" control gets always an error when reading? Then can't we pass simply NULL for get ops instead?
Jeff : T0 SEL use snd_soc_get_volsw, it will not use this function.
Then what's the reason of this hackish check?
- So here both 24 and 32 bits data are handled equally, and...
....
+ret = snd_soc_component_update_bits(dai->component, +MT6660_REG_TDM_CFG3, 0x3f0, word_len << 4);
... word_len is same for both S32 and S24 formats, so there can be no difference between S24 and S32 format handling in the code. Meanwhile, the supported formats are:
+#define STUB_FORMATS(SNDRV_PCM_FMTBIT_S16_LE | \ +SNDRV_PCM_FMTBIT_U16_LE | \ +SNDRV_PCM_FMTBIT_S24_LE | \ +SNDRV_PCM_FMTBIT_U24_LE | \ +SNDRV_PCM_FMTBIT_S32_LE | \ +SNDRV_PCM_FMTBIT_U32_LE)
Are you sure that S24_* formats really work properly?
Also, the code has no check / setup of the format signedness. Do unsigned formats (U16, U24, etc) really work as expected, too?
Jeff : Yes, it works.
So, for the codec, it doesn't matter at all about the signedness and the alingment of 32bit / 24bit of the incoming signals, but magically handled as is? Interesting...
thanks,
Takashi