aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r--sound/pci/oxygen/oxygen.c2
-rw-r--r--sound/pci/oxygen/oxygen.h1
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c21
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c7
-rw-r--r--sound/pci/oxygen/virtuoso.c1
5 files changed, 24 insertions, 8 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 4f809bdc75e1..60af3a7d9824 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -350,6 +350,7 @@ static const struct oxygen_model model_generic = {
350 .update_dac_volume = update_ak4396_volume, 350 .update_dac_volume = update_ak4396_volume,
351 .update_dac_mute = update_ak4396_mute, 351 .update_dac_mute = update_ak4396_mute,
352 .model_data_size = sizeof(struct generic_data), 352 .model_data_size = sizeof(struct generic_data),
353 .dac_channels = 8,
353 .used_channels = OXYGEN_CHANNEL_A | 354 .used_channels = OXYGEN_CHANNEL_A |
354 OXYGEN_CHANNEL_C | 355 OXYGEN_CHANNEL_C |
355 OXYGEN_CHANNEL_SPDIF | 356 OXYGEN_CHANNEL_SPDIF |
@@ -372,6 +373,7 @@ static const struct oxygen_model model_meridian = {
372 .update_dac_volume = update_ak4396_volume, 373 .update_dac_volume = update_ak4396_volume,
373 .update_dac_mute = update_ak4396_mute, 374 .update_dac_mute = update_ak4396_mute,
374 .model_data_size = sizeof(struct generic_data), 375 .model_data_size = sizeof(struct generic_data),
376 .dac_channels = 8,
375 .used_channels = OXYGEN_CHANNEL_B | 377 .used_channels = OXYGEN_CHANNEL_B |
376 OXYGEN_CHANNEL_C | 378 OXYGEN_CHANNEL_C |
377 OXYGEN_CHANNEL_SPDIF | 379 OXYGEN_CHANNEL_SPDIF |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 4894dbd28126..9ec9e6bab7d7 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -85,6 +85,7 @@ struct oxygen_model {
85 void (*update_dac_volume)(struct oxygen *chip); 85 void (*update_dac_volume)(struct oxygen *chip);
86 void (*update_dac_mute)(struct oxygen *chip); 86 void (*update_dac_mute)(struct oxygen *chip);
87 size_t model_data_size; 87 size_t model_data_size;
88 u8 dac_channels;
88 u8 used_channels; 89 u8 used_channels;
89 u8 function_flags; 90 u8 function_flags;
90 u16 dac_i2s_format; 91 u16 dac_i2s_format;
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6b7420fdd026..21b227a94ace 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -28,8 +28,10 @@
28static int dac_volume_info(struct snd_kcontrol *ctl, 28static int dac_volume_info(struct snd_kcontrol *ctl,
29 struct snd_ctl_elem_info *info) 29 struct snd_ctl_elem_info *info)
30{ 30{
31 struct oxygen *chip = ctl->private_data;
32
31 info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 33 info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
32 info->count = 8; 34 info->count = chip->model->dac_channels;
33 info->value.integer.min = 0; 35 info->value.integer.min = 0;
34 info->value.integer.max = 0xff; 36 info->value.integer.max = 0xff;
35 return 0; 37 return 0;
@@ -42,7 +44,7 @@ static int dac_volume_get(struct snd_kcontrol *ctl,
42 unsigned int i; 44 unsigned int i;
43 45
44 mutex_lock(&chip->mutex); 46 mutex_lock(&chip->mutex);
45 for (i = 0; i < 8; ++i) 47 for (i = 0; i < chip->model->dac_channels; ++i)
46 value->value.integer.value[i] = chip->dac_volume[i]; 48 value->value.integer.value[i] = chip->dac_volume[i];
47 mutex_unlock(&chip->mutex); 49 mutex_unlock(&chip->mutex);
48 return 0; 50 return 0;
@@ -57,7 +59,7 @@ static int dac_volume_put(struct snd_kcontrol *ctl,
57 59
58 changed = 0; 60 changed = 0;
59 mutex_lock(&chip->mutex); 61 mutex_lock(&chip->mutex);
60 for (i = 0; i < 8; ++i) 62 for (i = 0; i < chip->model->dac_channels; ++i)
61 if (value->value.integer.value[i] != chip->dac_volume[i]) { 63 if (value->value.integer.value[i] != chip->dac_volume[i]) {
62 chip->dac_volume[i] = value->value.integer.value[i]; 64 chip->dac_volume[i] = value->value.integer.value[i];
63 changed = 1; 65 changed = 1;
@@ -100,11 +102,14 @@ static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info)
100 static const char *const names[3] = { 102 static const char *const names[3] = {
101 "Front", "Front+Surround", "Front+Surround+Back" 103 "Front", "Front+Surround", "Front+Surround+Back"
102 }; 104 };
105 struct oxygen *chip = ctl->private_data;
106 unsigned int count = 2 + (chip->model->dac_channels == 8);
107
103 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 108 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
104 info->count = 1; 109 info->count = 1;
105 info->value.enumerated.items = 3; 110 info->value.enumerated.items = count;
106 if (info->value.enumerated.item > 2) 111 if (info->value.enumerated.item >= count)
107 info->value.enumerated.item = 2; 112 info->value.enumerated.item = count - 1;
108 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); 113 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]);
109 return 0; 114 return 0;
110} 115}
@@ -167,12 +172,14 @@ void oxygen_update_dac_routing(struct oxygen *chip)
167static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) 172static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
168{ 173{
169 struct oxygen *chip = ctl->private_data; 174 struct oxygen *chip = ctl->private_data;
175 unsigned int count = 2 + (chip->model->dac_channels == 8);
170 int changed; 176 int changed;
171 177
172 mutex_lock(&chip->mutex); 178 mutex_lock(&chip->mutex);
173 changed = value->value.enumerated.item[0] != chip->dac_routing; 179 changed = value->value.enumerated.item[0] != chip->dac_routing;
174 if (changed) { 180 if (changed) {
175 chip->dac_routing = min(value->value.enumerated.item[0], 2u); 181 chip->dac_routing = min(value->value.enumerated.item[0],
182 count - 1);
176 spin_lock_irq(&chip->reg_lock); 183 spin_lock_irq(&chip->reg_lock);
177 oxygen_update_dac_routing(chip); 184 oxygen_update_dac_routing(chip);
178 spin_unlock_irq(&chip->reg_lock); 185 spin_unlock_irq(&chip->reg_lock);
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index 2785660957d0..df1d0cae1dad 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -119,10 +119,15 @@ static int oxygen_open(struct snd_pcm_substream *substream,
119 119
120 runtime->private_data = (void *)(uintptr_t)channel; 120 runtime->private_data = (void *)(uintptr_t)channel;
121 runtime->hw = *oxygen_hardware[channel]; 121 runtime->hw = *oxygen_hardware[channel];
122 if (channel == PCM_C) { 122 switch (channel) {
123 case PCM_C:
123 runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 | 124 runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 |
124 SNDRV_PCM_RATE_64000); 125 SNDRV_PCM_RATE_64000);
125 runtime->hw.rate_min = 44100; 126 runtime->hw.rate_min = 44100;
127 break;
128 case PCM_MULTICH:
129 runtime->hw.channels_max = chip->model->dac_channels;
130 break;
126 } 131 }
127 if (chip->model->pcm_hardware_filter) 132 if (chip->model->pcm_hardware_filter)
128 chip->model->pcm_hardware_filter(channel, &runtime->hw); 133 chip->model->pcm_hardware_filter(channel, &runtime->hw);
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 7b240c778759..665115d23627 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -310,6 +310,7 @@ static const struct oxygen_model model_xonar = {
310 .set_adc_params = set_cs5381_params, 310 .set_adc_params = set_cs5381_params,
311 .update_dac_volume = update_pcm1796_volume, 311 .update_dac_volume = update_pcm1796_volume,
312 .update_dac_mute = update_pcm1796_mute, 312 .update_dac_mute = update_pcm1796_mute,
313 .dac_channels = 8,
313 .used_channels = OXYGEN_CHANNEL_B | 314 .used_channels = OXYGEN_CHANNEL_B |
314 OXYGEN_CHANNEL_C | 315 OXYGEN_CHANNEL_C |
315 OXYGEN_CHANNEL_SPDIF | 316 OXYGEN_CHANNEL_SPDIF |