diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-12-21 19:38:34 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-12-22 02:12:58 -0500 |
commit | d4b06d23ab1c5aefbb1377fb01939b555236f57f (patch) | |
tree | 0cfc94913edab14208d2f9e91bb957146fd8f72f /sound/pci/asihpi | |
parent | c382a5da5cda3e0d8a8f2e8809460285d0a7c1cb (diff) |
ALSA: asihpi - Volumes and meters may have 1 or 2 channels.
The channel count can be queried to determine which.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi')
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 44e6ef3e99cc..6e89e5b83a49 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -1410,6 +1410,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, | |||
1410 | struct snd_ctl_elem_info *uinfo) | 1410 | struct snd_ctl_elem_info *uinfo) |
1411 | { | 1411 | { |
1412 | u32 h_control = kcontrol->private_value; | 1412 | u32 h_control = kcontrol->private_value; |
1413 | u32 count; | ||
1413 | u16 err; | 1414 | u16 err; |
1414 | /* native gains are in millibels */ | 1415 | /* native gains are in millibels */ |
1415 | short min_gain_mB; | 1416 | short min_gain_mB; |
@@ -1424,8 +1425,12 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, | |||
1424 | step_gain_mB = VOL_STEP_mB; | 1425 | step_gain_mB = VOL_STEP_mB; |
1425 | } | 1426 | } |
1426 | 1427 | ||
1428 | err = hpi_meter_query_channels(h_control, &count); | ||
1429 | if (err) | ||
1430 | count = HPI_MAX_CHANNELS; | ||
1431 | |||
1427 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 1432 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
1428 | uinfo->count = 2; | 1433 | uinfo->count = count; |
1429 | uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; | 1434 | uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; |
1430 | uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; | 1435 | uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; |
1431 | uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; | 1436 | uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; |
@@ -2033,8 +2038,15 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi, | |||
2033 | static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, | 2038 | static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, |
2034 | struct snd_ctl_elem_info *uinfo) | 2039 | struct snd_ctl_elem_info *uinfo) |
2035 | { | 2040 | { |
2041 | u32 h_control = kcontrol->private_value; | ||
2042 | u32 count; | ||
2043 | u16 err; | ||
2044 | err = hpi_meter_query_channels(h_control, &count); | ||
2045 | if (err) | ||
2046 | count = HPI_MAX_CHANNELS; | ||
2047 | |||
2036 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 2048 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
2037 | uinfo->count = HPI_MAX_CHANNELS; | 2049 | uinfo->count = count; |
2038 | uinfo->value.integer.min = 0; | 2050 | uinfo->value.integer.min = 0; |
2039 | uinfo->value.integer.max = 0x7FFFFFFF; | 2051 | uinfo->value.integer.max = 0x7FFFFFFF; |
2040 | return 0; | 2052 | return 0; |