summaryrefslogtreecommitdiff
path: root/drivers/staging/easycap/easycap_ioctl.c
diff options
context:
space:
mode:
authorMike Thomas <rmthomas@sciolus.org>2010-11-07 20:05:51 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-09 16:31:15 -0800
commit94155cf4195bb3be0068481dc21e8688eda2e051 (patch)
tree05a9ae9eb45ed7e957d2318763724c61b4b56786 /drivers/staging/easycap/easycap_ioctl.c
parent849322a0f114e52d05e16fe8349843c980cff2c6 (diff)
staging/easycap: Add option to set the hardware audio gain
A new module parameter adjusts the gain of the AC'97 audio chip, if one is present. Attenuation as well as amplification should be possible according to the datasheet, but attenuation seems not to work yet. Signed-off-by: Mike Thomas <rmthomas@sciolus.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/easycap/easycap_ioctl.c')
-rw-r--r--drivers/staging/easycap/easycap_ioctl.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c
index 3fe13851aba0..7c46cb22daeb 100644
--- a/drivers/staging/easycap/easycap_ioctl.c
+++ b/drivers/staging/easycap/easycap_ioctl.c
@@ -873,18 +873,26 @@ i1 = 0;
while (0xFFFFFFFF != easycap_control[i1].id) {
if (V4L2_CID_AUDIO_VOLUME == easycap_control[i1].id) {
if ((easycap_control[i1].minimum > value) || \
- (easycap_control[i1].maximum < value))
+ (easycap_control[i1].maximum < value))
value = easycap_control[i1].default_value;
+ if ((easycap_control[i1].minimum <= peasycap->volume) && \
+ (easycap_control[i1].maximum >= \
+ peasycap->volume)) {
+ if (peasycap->volume == value) {
+ SAM("unchanged volume at 0x%02X\n", value);
+ return 0;
+ }
+ }
peasycap->volume = value;
mood = (16 > peasycap->volume) ? 16 : \
((31 < peasycap->volume) ? 31 : \
(__s8) peasycap->volume);
if (!audio_gainset(peasycap->pusb_device, mood)) {
- SAM("adjusting volume to 0x%01X\n", mood);
+ SAM("adjusting volume to 0x%02X\n", mood);
return 0;
} else {
SAM("WARNING: failed to adjust volume to " \
- "0x%1X\n", mood);
+ "0x%2X\n", mood);
return -ENOENT;
}
break;