]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-omap/linus/0050-cx25840-Prevent-device-probe-failure-due-to-volume-c.patch
netbase: automatically bring up usb0 on BeagleBoard xM
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap / linus / 0050-cx25840-Prevent-device-probe-failure-due-to-volume-c.patch
1 From 99ce7fb9211326fed836b7dee035f8a4b1df0250 Mon Sep 17 00:00:00 2001
2 From: Andy Walls <awalls@md.metrocast.net>
3 Date: Sun, 5 Dec 2010 19:42:30 -0300
4 Subject: [PATCH 50/65] cx25840: Prevent device probe failure due to volume control ERANGE error
6 This patch fixes a regression that crept into 2.6.36.
8 The volume control scale in the cx25840 driver has an unusual mapping
9 from register values to v4l2 volume control values.  Enforce the mapping
10 limits, so that the default volume control setting does not fall out of
11 bounds to prevent the cx25840 module device probe from failing.
13 Signed-off-by: Andy Walls <awalls@md.metrocast.net>
14 Cc: Hans Verkuil <hverkuil@xs4all.nl>
15 Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
16 ---
17  drivers/media/video/cx25840/cx25840-core.c |   19 +++++++++++++++++--
18  1 files changed, 17 insertions(+), 2 deletions(-)
20 diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
21 index dfb198d..f164618 100644
22 --- a/drivers/media/video/cx25840/cx25840-core.c
23 +++ b/drivers/media/video/cx25840/cx25840-core.c
24 @@ -1989,8 +1989,23 @@ static int cx25840_probe(struct i2c_client *client,
25         v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
26                         V4L2_CID_HUE, -128, 127, 1, 0);
27         if (!is_cx2583x(state)) {
28 -               default_volume = 228 - cx25840_read(client, 0x8d4);
29 -               default_volume = ((default_volume / 2) + 23) << 9;
30 +               default_volume = cx25840_read(client, 0x8d4);
31 +               /*
32 +                * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume
33 +                * scale mapping limits to avoid -ERANGE errors when
34 +                * initializing the volume control
35 +                */
36 +               if (default_volume > 228) {
37 +                       /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */
38 +                       default_volume = 228;
39 +                       cx25840_write(client, 0x8d4, 228);
40 +               }
41 +               else if (default_volume < 20) {
42 +                       /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */
43 +                       default_volume = 20;
44 +                       cx25840_write(client, 0x8d4, 20);
45 +               }
46 +               default_volume = (((228 - default_volume) >> 1) + 23) << 9;
47  
48                 state->volume = v4l2_ctrl_new_std(&state->hdl,
49                         &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
50 -- 
51 1.6.6.1