[alsa-devel] [PATCH - alsa-lib 2/3] tlv: Handle 'holes' in SND_CTL_TLVT_DB_RANGE array

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Jul 19 18:01:10 CEST 2010


On Mon, Jul 19, 2010 at 05:51:27PM +0200, Takashi Iwai wrote:
> Peter Ujfalusi wrote:

> > If user asks for 1dB the snd_tlv_convert_from_dB will not find
> > the raw value, since the 1dB is not part of either range.

> In the case above, can't you set like

> 	TLV_DB_RANGE_HEAD(2),
> 	0, 2, TLV_DB_SCALE_ITEM(-1000, 500, 0),
> 	2, 4, TLV_DB_SCALE_ITEM(0, 200, 0)

> ??

So, this came from a review comment from me in response to a patch doing
just that.  The issue I had was that this definition of overlapping
ranges really feels like the kernel is bodging around limitations of the
userspace library - the library is already trying to find the best match
among the actual dB values available, it seems silly that it requires
the kernel to provide patches between the ranges.  It's moderately
painful, especially if you have a bunch of values that aren't very well
joined together in the hardware.


More information about the Alsa-devel mailing list