summaryrefslogtreecommitdiff
path: root/drivers/media/video/tvaudio.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-08-25 17:24:16 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-06 21:44:30 +0400
commit88af83048d3bdfe3de7aee54e7117afbc2f8dd58 (patch)
tree7d0b98f0092f7431ec008e3f5bcd9f92cfc59aa0 /drivers/media/video/tvaudio.c
parent4c04b7a1ada742aace5023aca57e537bf75b59ff (diff)
downloadlinux-88af83048d3bdfe3de7aee54e7117afbc2f8dd58.tar.xz
[media] tvaudio: fix compiler warnings
This is indeed a bug: balance and volume must be used to set the left and right channel volume. Fixed. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/tvaudio.c')
-rw-r--r--drivers/media/video/tvaudio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index c46a3bb95852..f22dbef9b95b 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1695,14 +1695,17 @@ static int tvaudio_s_ctrl(struct v4l2_subdev *sd,
case V4L2_CID_AUDIO_BALANCE:
{
int volume, balance;
+
if (!(desc->flags & CHIP_HAS_VOLUME))
break;
- volume = max(chip->left,chip->right);
+ volume = max(chip->left, chip->right);
balance = ctrl->value;
+ chip->left = (min(65536 - balance, 32768) * volume) / 32768;
+ chip->right = (min(balance, volume * (__u16)32768)) / 32768;
- chip_write(chip,desc->leftreg,desc->volfunc(chip->left));
- chip_write(chip,desc->rightreg,desc->volfunc(chip->right));
+ chip_write(chip, desc->leftreg, desc->volfunc(chip->left));
+ chip_write(chip, desc->rightreg, desc->volfunc(chip->right));
return 0;
}