[media] tvaudio: fix compiler warnings
authorHans Verkuil <hans.verkuil@cisco.com>
Thu, 25 Aug 2011 13:24:16 +0000 (10:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 6 Sep 2011 17:44:30 +0000 (14:44 -0300)
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>
drivers/media/video/tvaudio.c

index c46a3bb95852a7da7ad866387ec1b602c29bc5a6..f22dbef9b95b72bfe4bf06f2a6d9aa185573bcf2 100644 (file)
@@ -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;
        }