Re: [PULL] http://www.kernellabs.com/hg/~stoth/cx23885-mpx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2010-08-06 at 17:28 +0200, Hans Verkuil wrote:
> On Thursday 05 August 2010 14:11:09 Andy Walls wrote:

>  
> > The cx25840 module expects the volume control to have a range from
> > 0-65535.  It divides the input control value by 512 (i.e. volume >> 9).
> > If you are using a control in the cx23885 driver with a range from 0-100
> > or 0-255, that would explain why it doesn't work.
> > 
> > BTW, the actual relationship the cx25840 module is implementing is
> > explained in the end of this old post:
> > 
> > http://www.gossamer-threads.com/lists/ivtv/devel/39868#39868

 
 
> > > > I can say the V4L2 control to cx25840 volume scale mapping is a little
> > > > funny.  Here is documentation on the mapping from V4L2 volume control
> > > > values to dB to cx25840 register values:
> > > >
> > > > http://linuxtv.org/hg/v4l-dvb/file/9652f85e688a/linux/drivers/media/video/cx18/cx18-alsa-mixer.c#l38

> > > > It is non-linear at the bottom end with a reg value of 228 = 0xe4 for
> > > > 3/16ths of the entire range.  This is due to the cx25840 module's desire
> > > > to keep volume levels at the same perceptible level between the MSP400
> > > > and the CX2584x chips for users with multiple ivtv cards in their
> > > > machine.  (Yet another ivtv legacy.)
> > > >
> > > > You ought to look at what values are coming from the V4L2 volume control
> > > > slider and see what's wrong.  A V4L2 volume control value in the range
> > > > 0xee00-0xeeff should correspond to 0 dB gain.

> I had a discussion with Mauro on irc about this. The whole 0-65535 range for the
> volume in cx25840 is purely historical:

Well, yes.


>  the audio V4L1 'controls' always had that
> fixed range (you couldn't specify min and max values in V4L1) and that was just
> blindly propagated to V4L2.

Ah, I was unaware of the V4L1 origin.


> For V4L2 it would be much cleaner to base the min/max values on the hardware.

I really would like to specify things in dB or 0.1 dB for volume
controls.  Don't most of the chips' datasheets have a volume control
register value to dB specified anyway?   0 dB is a very meaningful data
point to anyone whose ever played with an audio mixer board.

ALSA controls have a somewhat elaborate scheme for creating controls
with a dB scale:

http://git.linuxtv.org/hverkuil/v4l-dvb.git?a=blob;f=drivers/media/video/cx18/cx18-alsa-mixer.c;h=341bddc00b774f5eb5338e224c55d6b8d973416a;hb=refs/heads/ctrlfw2#l135

Maybe I shouldn't have done 100ths of a dB (that's just silly) since the
'843 only supports steps of 0.5 dB, but I was copying from some example
code at the time.

Since the v4l2_ctrl framework handles negative values, it should be easy
enough to present a scale in 1 dB units to a user.

> The only disadvantage is that apps that store the default control volume in some
> config file will suddenly max out the volume if that driver changes the min/max
> values for the volume to 0-127 (same for bass, treble, etc).
> 
> Effectively you are changing the public API for these devices. Is it worthwhile
> doing this? The engineer in me says 'yes', but from a user-perspective it may
> not be such a great idea after all.

Well, blasting the volume at the user will be a one time, auto
correcting change (as the user scrambles for the volume control to save
his eardrums).


However, until subdev device node controls are exposed to userspace, I
see no pressing need right now to change the cx25840 module's volume
control.  

The current expected volume range is mostly a private API between the
bridge drivers (ivtv, pvrusb2, cx23885, cx231xx) and the cx25840 module.
(I assume Steven was just aware of the expected range, as the code has
no comments.)

When users can manipulate cascaded volume controls, e.g. a WM8775 volume
control followed by a CX25843 volume control, to do things like improve
audio noise performance, then using a meaningful scale between subdevs
will be more important.

Currently users will fiddle with the single V4L2 volume control to suit
their taste, no matter what the absolute range of values.

Regards,
Andy

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux