Skip to content

Commit

Permalink
[media] tvaudio: fix compiler warnings
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Sep 6, 2011
1 parent 4c04b7a commit 88af830
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/media/video/tvaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 88af830

Please sign in to comment.