X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Fsparc%2Fdbri.c;h=3d00e0797b11899042e5af98fa64a224ebc13597;hb=e1a2a51e684bfe9d6165992d4a065439617a3107;hp=376b98691c965bf228a585a0f619ed6a744fb50a;hpb=fe2520094d88018423dfc42b3cd0015f74e8adea;p=linux-2.6-omap-h63xx.git diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 376b98691c9..3d00e0797b1 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -53,7 +53,6 @@ * other DBRI low-level stuff */ -#include #include #include #include @@ -2279,14 +2278,25 @@ static int snd_cs4215_put_volume(struct snd_kcontrol *kcontrol, struct snd_dbri *dbri = snd_kcontrol_chip(kcontrol); struct dbri_streaminfo *info = &dbri->stream_info[kcontrol->private_value]; + unsigned int vol[2]; int changed = 0; - if (info->left_gain != ucontrol->value.integer.value[0]) { - info->left_gain = ucontrol->value.integer.value[0]; + vol[0] = ucontrol->value.integer.value[0]; + vol[1] = ucontrol->value.integer.value[1]; + if (kcontrol->private_value == DBRI_PLAY) { + if (vol[0] > DBRI_MAX_VOLUME || vol[1] > DBRI_MAX_VOLUME) + return -EINVAL; + } else { + if (vol[0] > DBRI_MAX_GAIN || vol[1] > DBRI_MAX_GAIN) + return -EINVAL; + } + + if (info->left_gain != vol[0]) { + info->left_gain = vol[0]; changed = 1; } - if (info->right_gain != ucontrol->value.integer.value[1]) { - info->right_gain = ucontrol->value.integer.value[1]; + if (info->right_gain != vol[1]) { + info->right_gain = vol[1]; changed = 1; } if (changed) {