aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/oxygen/oxygen_mixer.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-03-19 08:19:41 +0100
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:28 +0200
commitf009ad9b39e6484d8e36e9e5029c07eab8c12e8f (patch)
tree79b4bc6bb9c9b9cbf5a410fc8e83120b46bdb310 /sound/pci/oxygen/oxygen_mixer.c
parentfa5d8106cb52e5df28673f59cc25af520dc83382 (diff)
[ALSA] oxygen: change model-specific PCM device configuration
When specifying which PCM devices to use, model drivers now use flags that also specify the routing between PCM devices and DMA channels instead of just DMA channel bits. This simplifies some code that checks for these flags. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_mixer.c')
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c202
1 files changed, 104 insertions, 98 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 4e77b79b3b6..6b5ff6e0fad 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -737,90 +737,111 @@ static const struct snd_kcontrol_new controls[] = {
},
};
-static const struct snd_kcontrol_new monitor_a_controls[] = {
+static const struct {
+ unsigned int pcm_dev;
+ struct snd_kcontrol_new controls[2];
+} monitor_controls[] = {
{
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Switch",
- .info = snd_ctl_boolean_mono_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_A,
+ .pcm_dev = CAPTURE_0_FROM_I2S_1,
+ .controls = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Switch",
+ .info = snd_ctl_boolean_mono_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_A,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Volume",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+ .info = monitor_volume_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_A_HALF_VOL
+ | (1 << 8),
+ .tlv = { .p = monitor_db_scale, },
+ },
+ },
},
{
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Volume",
- .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
- SNDRV_CTL_ELEM_ACCESS_TLV_READ,
- .info = monitor_volume_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_A_HALF_VOL | (1 << 8),
- .tlv = { .p = monitor_db_scale, },
+ .pcm_dev = CAPTURE_0_FROM_I2S_2,
+ .controls = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Switch",
+ .info = snd_ctl_boolean_mono_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_B,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Volume",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+ .info = monitor_volume_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL
+ | (1 << 8),
+ .tlv = { .p = monitor_db_scale, },
+ },
+ },
},
-};
-static const struct snd_kcontrol_new monitor_b_controls[] = {
{
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Switch",
- .info = snd_ctl_boolean_mono_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_B,
+ .pcm_dev = CAPTURE_2_FROM_I2S_2,
+ .controls = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Switch",
+ .index = 1,
+ .info = snd_ctl_boolean_mono_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_B,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Input Monitor Volume",
+ .index = 1,
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+ .info = monitor_volume_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL
+ | (1 << 8),
+ .tlv = { .p = monitor_db_scale, },
+ },
+ },
},
{
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Volume",
- .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
- SNDRV_CTL_ELEM_ACCESS_TLV_READ,
- .info = monitor_volume_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL | (1 << 8),
- .tlv = { .p = monitor_db_scale, },
- },
-};
-static const struct snd_kcontrol_new monitor_2nd_b_controls[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Switch",
- .index = 1,
- .info = snd_ctl_boolean_mono_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_B,
- },
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Analog Input Monitor Volume",
- .index = 1,
- .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
- SNDRV_CTL_ELEM_ACCESS_TLV_READ,
- .info = monitor_volume_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL | (1 << 8),
- .tlv = { .p = monitor_db_scale, },
- },
-};
-static const struct snd_kcontrol_new monitor_c_controls[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Digital Input Monitor Switch",
- .info = snd_ctl_boolean_mono_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_C,
- },
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Digital Input Monitor Volume",
- .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
- SNDRV_CTL_ELEM_ACCESS_TLV_READ,
- .info = monitor_volume_info,
- .get = monitor_get,
- .put = monitor_put,
- .private_value = OXYGEN_ADC_MONITOR_C_HALF_VOL | (1 << 8),
- .tlv = { .p = monitor_db_scale, },
+ .pcm_dev = CAPTURE_1_FROM_SPDIF,
+ .controls = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Digital Input Monitor Switch",
+ .info = snd_ctl_boolean_mono_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_C,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Digital Input Monitor Volume",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+ .info = monitor_volume_info,
+ .get = monitor_get,
+ .put = monitor_put,
+ .private_value = OXYGEN_ADC_MONITOR_C_HALF_VOL
+ | (1 << 8),
+ .tlv = { .p = monitor_db_scale, },
+ },
+ },
},
};
@@ -905,32 +926,17 @@ static int add_controls(struct oxygen *chip,
int oxygen_mixer_init(struct oxygen *chip)
{
+ unsigned int i;
int err;
err = add_controls(chip, controls, ARRAY_SIZE(controls));
if (err < 0)
return err;
- if (chip->model->used_channels & OXYGEN_CHANNEL_A) {
- err = add_controls(chip, monitor_a_controls,
- ARRAY_SIZE(monitor_a_controls));
- if (err < 0)
- return err;
- } else if (chip->model->used_channels & OXYGEN_CHANNEL_B) {
- err = add_controls(chip, monitor_b_controls,
- ARRAY_SIZE(monitor_b_controls));
- if (err < 0)
- return err;
- }
- if ((chip->model->used_channels & (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B))
- == (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B)) {
- err = add_controls(chip, monitor_2nd_b_controls,
- ARRAY_SIZE(monitor_2nd_b_controls));
- if (err < 0)
- return err;
- }
- if (chip->model->used_channels & OXYGEN_CHANNEL_C) {
- err = add_controls(chip, monitor_c_controls,
- ARRAY_SIZE(monitor_c_controls));
+ for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) {
+ if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev))
+ continue;
+ err = add_controls(chip, monitor_controls[i].controls,
+ ARRAY_SIZE(monitor_controls[i].controls));
if (err < 0)
return err;
}