According to our audio codec(TAS5756) spec, the min. value of digital gain register is -103dB,
different to the next gain value by 0.5dB, and the total gain level is 255.
So we have below setting in our driver:
===
static const DECLARE_TLV_DB_SCALE(digital_tlv, -10350, 50, 1);
static const struct snd_kcontrol_new tas5756m_controls[] = {
SOC_SINGLE_TLV("Digital Playback Volume",
TAS5756M_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
}
=====
We can know the max digital value is 24dB (-103dB+0.5dB*254).
If we would like to limit the digital gain volume to be less than -7dB, and we also want to have control volume from 0% to 100%, how could we do it in the audio driver?
Thanks.
Hi Seven
one can look in alsa documentation and try to use for example DECLARE_TLV_DB_LINEAR
"Writing an ALSA Driver"
https://www.alsa-project.org/~tiwai/writing-an-alsa-driver.pdf
If it is necessary to perform that in driver, this depends on its implementation
(driver sources), one can add restriction when performing i2c low level control to codec volume
register adding compare codes and after that writing limited volume data to register.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi igorpadykov,
We also find there is another way to limit the gain value in driver:
Using SOC_SINGLE_RANGE_TLV to replace SOC_SINGLE_TLV that could limit the gain value with a range.
This could resolve our problem.
Thanks for your information.
SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert)