diff options
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index dfb198d0415b..f16461844c5c 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1989,8 +1989,23 @@ static int cx25840_probe(struct i2c_client *client, | |||
1989 | v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, | 1989 | v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, |
1990 | V4L2_CID_HUE, -128, 127, 1, 0); | 1990 | V4L2_CID_HUE, -128, 127, 1, 0); |
1991 | if (!is_cx2583x(state)) { | 1991 | if (!is_cx2583x(state)) { |
1992 | default_volume = 228 - cx25840_read(client, 0x8d4); | 1992 | default_volume = cx25840_read(client, 0x8d4); |
1993 | default_volume = ((default_volume / 2) + 23) << 9; | 1993 | /* |
1994 | * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume | ||
1995 | * scale mapping limits to avoid -ERANGE errors when | ||
1996 | * initializing the volume control | ||
1997 | */ | ||
1998 | if (default_volume > 228) { | ||
1999 | /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */ | ||
2000 | default_volume = 228; | ||
2001 | cx25840_write(client, 0x8d4, 228); | ||
2002 | } | ||
2003 | else if (default_volume < 20) { | ||
2004 | /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */ | ||
2005 | default_volume = 20; | ||
2006 | cx25840_write(client, 0x8d4, 20); | ||
2007 | } | ||
2008 | default_volume = (((228 - default_volume) >> 1) + 23) << 9; | ||
1994 | 2009 | ||
1995 | state->volume = v4l2_ctrl_new_std(&state->hdl, | 2010 | state->volume = v4l2_ctrl_new_std(&state->hdl, |
1996 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, | 2011 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, |