[alsa-devel] ASoC: How to declare volume TLV dB scale?
Dear all, could someone please help me to understand the mixer controls TLV scale? What would be the DECLARE_TLV_DB_SCALE values for the following example? reg. value: 0 .. 0x3ff phys. value: 0dB .. -128dB volume: 100% .. 0%(mute)
What does TLV actually stand for?
Many thanks in advance, Sergej Sawazki
Sergej Sawazki wrote:
could someone please help me to understand the mixer controls TLV scale? What would be the DECLARE_TLV_DB_SCALE values for the following example?
reg. value: 0 .. 0x3ff phys. value: 0dB .. -128dB volume: 100% .. 0%(mute)
0% volume would be -∞ dB.
And how are the register values mapped between the min/max values? Does 0x200 correspond to -64 dB, or 50 % of the sample value, or 50 % of the volume?
What does TLV actually stand for?
Type-length-value. It's an implementation detail.
Regards, Clemens
On Fri, 12 Jun 2015 18:28:54 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
could someone please help me to understand the mixer controls TLV scale? What would be the DECLARE_TLV_DB_SCALE values for the following example?
reg. value: 0 .. 0x3ff phys. value: 0dB .. -128dB volume: 100% .. 0%(mute)
0% volume would be -∞ dB.
And how are the register values mapped between the min/max values? Does 0x200 correspond to -64 dB, or 50 % of the sample value, or 50 % of the volume?
The output of the DAC can be attenuated in 0.125dB steps, so 0x200 would be -64dB.
register value | attenuation level (dB) | volume (%) ---------------+------------------------+----------- 0x000 | 0.0 | 100 0x001 | -0.125 | ... | ... | ... 0x200 | -64.0 | ... | ... | ... 0x3fe | -127.75 | 0x3ff | -∞ (mute) | 0
Thanks, Sergej
Sergej Sawazki wrote:
On Fri, 12 Jun 2015 18:28:54 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
could someone please help me to understand the mixer controls TLV scale? What would be the DECLARE_TLV_DB_SCALE values for the following example?
reg. value: 0 .. 0x3ff phys. value: 0dB .. -128dB volume: 100% .. 0%(mute)
0% volume would be -∞ dB.
And how are the register values mapped between the min/max values? Does 0x200 correspond to -64 dB, or 50 % of the sample value, or 50 % of the volume?
The output of the DAC can be attenuated in 0.125dB steps, so 0x200 would be -64dB.
register value | attenuation level (dB) | volume (%) ---------------+------------------------+----------- 0x000 | 0.0 | 100 0x001 | -0.125 | ... | ... | ... 0x200 | -64.0 | ... | ... | ... 0x3fe | -127.75 | 0x3ff | -∞ (mute) | 0
0.125 dB is too small for the 0.01 dB resolution of DECLARE_TLV_DB_SCALE, so you have to use DB_MINMAX instead: TLV_DB_MINMAX_MUTE_ITEM(-128, 0)
Regards, Clemens
At Fri, 12 Jun 2015 21:47:46 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
On Fri, 12 Jun 2015 18:28:54 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
could someone please help me to understand the mixer controls TLV scale? What would be the DECLARE_TLV_DB_SCALE values for the following example?
reg. value: 0 .. 0x3ff phys. value: 0dB .. -128dB volume: 100% .. 0%(mute)
0% volume would be -∞ dB.
And how are the register values mapped between the min/max values? Does 0x200 correspond to -64 dB, or 50 % of the sample value, or 50 % of the volume?
The output of the DAC can be attenuated in 0.125dB steps, so 0x200 would be -64dB.
register value | attenuation level (dB) | volume (%) ---------------+------------------------+----------- 0x000 | 0.0 | 100 0x001 | -0.125 | ... | ... | ... 0x200 | -64.0 | ... | ... | ... 0x3fe | -127.75 | 0x3ff | -∞ (mute) | 0
0.125 dB is too small for the 0.01 dB resolution of DECLARE_TLV_DB_SCALE, so you have to use DB_MINMAX instead: TLV_DB_MINMAX_MUTE_ITEM(-128, 0)
And you need to implement the ctl get/put callback to revert the value as (0x3ff - raw value). An decrement value isn't supposed to work.
Takashi
On Sat, 13 Jun 2015 09:15:49 +0200, Takashi Iwai wrote:
At Fri, 12 Jun 2015 21:47:46 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
The output of the DAC can be attenuated in 0.125dB steps, so 0x200 would be -64dB.
0.125 dB is too small for the 0.01 dB resolution of DECLARE_TLV_DB_SCALE, so you have to use DB_MINMAX instead: TLV_DB_MINMAX_MUTE_ITEM(-128, 0)
And you need to implement the ctl get/put callback to revert the value as (0x3ff - raw value). An decrement value isn't supposed to work.
Clemens, Takashi, thanks for your answers.
I am getting the expected dB scaling with: DECLARE_TLV_DB_MINMAX_MUTE(vol_tlv, -12800, 0) does it make sense?
Regards, Sergej
Sergej Sawazki wrote:
On Sat, 13 Jun 2015 09:15:49 +0200, Takashi Iwai wrote:
Clemens Ladisch wrote:
0.125 dB is too small for the 0.01 dB resolution of DECLARE_TLV_DB_SCALE, so you have to use DB_MINMAX instead: TLV_DB_MINMAX_MUTE_ITEM(-128, 0)
And you need to implement the ctl get/put callback to revert the value as (0x3ff - raw value). An decrement value isn't supposed to work.
If you're using one of the SOC_xxx_TLV macros, you would set the 'invert' parameter.
I am getting the expected dB scaling with: DECLARE_TLV_DB_MINMAX_MUTE(vol_tlv, -12800, 0) does it make sense?
Yes. (-128 would have been -1.28 dB.)
Regards, Clemens
On Sat, 13 Jun 2015 12:29:35 +0200, Clemens Ladisch wrote:
Sergej Sawazki wrote:
On Sat, 13 Jun 2015 09:15:49 +0200, Takashi Iwai wrote:
And you need to implement the ctl get/put callback to revert the value as (0x3ff - raw value). An decrement value isn't supposed to work.
If you're using one of the SOC_xxx_TLV macros, you would set the 'invert' parameter.
I am getting the expected dB scaling with: DECLARE_TLV_DB_MINMAX_MUTE(vol_tlv, -12800, 0) does it make sense?
Yes. (-128 would have been -1.28 dB.)
Thanks.
Regards, Sergej
participants (3)
-
Clemens Ladisch
-
Sergej Sawazki
-
Takashi Iwai