[alsa-devel] [PATCH] ASoC: TWL4030: PM fix for output amplifiers
Peter Ujfalusi
peter.ujfalusi at nokia.com
Tue Mar 23 08:59:13 CET 2010
On Tuesday 23 March 2010 09:05:39 Ujfalusi Peter (Nokia-D/Tampere) wrote:
> In any ways the output gains has to be handled with custom code no matter
> if the core has support for binding the volume controls to DAPM widget or
> not. The root of the problem is how the amplifiers are working:
> bit 4-5: Gain
> 0x0 - power down (mute)
> 0x1 - 6dB
> 0x2 - 0dB
> 0x3 - -6dB
>
> I don't have separate power bit.
> I can not just invert the range.
> I need to do the following:
> If 0 is coming, than I write that (mute, power down)
> If 2, than write two
> For 1 I write 3
> For 3 I write 1
> This gives nice gain range for the user space.
> 0x0 - power down (mute)
> 0x1 - -6dB
> 0x2 - 0dB
> 0x3 - 6dB
I just wonder, would something like this work:
Instead of the custom SOC_DOUBLE_R_TLV_TWL4030, which handles the output gains:
/*
* Gain controls tied to outputs
* -6 dB to 6 dB in 6 dB steps (mute instead of -12)
*/
static const unsigned int output_tlv[] = {
TLV_DB_RANGE_HEAD(4),
0, 0, TLV_DB_SCALE_ITEM(-1200, 0, 1),
3, 3, TLV_DB_SCALE_ITEM(-600, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(0, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(600, 0, 0),
};
SOC_DOUBLE_R_TLV("PreDriv Playback Volume",
TWL4030_REG_PREDL_CTL, TWL4030_REG_PREDR_CTL,
4, 3, 0, output_tvl),
I'm not sure about the tlv declaration, but is there a way to actually map the
gain/power control in the TWL in a standard way?
--
Péter
More information about the Alsa-devel
mailing list