sorry for replying this early comment now, i have to study on tlv first. > > +/* dl pga gain */ > > +static const char *const dl_pga_gain[] = { > > + "8Db", "7Db", "6Db", "5Db", "4Db", > > + "3Db", "2Db", "1Db", "0Db", "-1Db", > > + "-2Db", "-3Db", "-4Db", "-5Db", "-6Db", > > + "-7Db", "-8Db", "-9Db", "-10Db", "-40Db", > > +}; > > These gains should be put in TLVs rather than an enum so userspace can > handle them (also it should be dB not Db). You can handle irregular > step sizes like these with DECLARE_TLV_DB_SCALE(), there's several > examples in the code already. We declare this enum for user space to operate on enum directly, unlike alsa-lib, we use tinyalsa in Android, if declared in tlv, the mixer control just become a integer control, which is not informative for user space. > > +static int dl_pga_get(struct snd_kcontrol *kcontrol, > > + struct snd_ctl_elem_value *ucontrol) > > +{ > > + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); > > + struct mt6351_priv *priv = snd_soc_codec_get_drvdata(codec); > > + > > + ucontrol->value.integer.value[0] = priv->ana_gain[kcontrol->id.device]; > > + > > + if (ucontrol->value.integer.value[0] == 0x1f) /* reg idx for -40dB*/ > > + ucontrol->value.integer.value[0] = ARRAY_SIZE(dl_pga_gain) - 1; > > Why do this rewriting? A little awkward gain register here, the range is for 8dB ~ -10dB and -40dB, corresponding to reg index 0 ~ 18 and 31. 00000: +8dB. 00001: +7dB. 10010: -10dB 11111: -40dB(Mute). and where 19 ~ 30 is not defined, and shouldn't be set. i think tlv not yet support this kind of gain control? Maybe i'll just declare 8dB ~ -10dB for now. _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel