aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 35b26014925f..af6e8026cb17 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -157,6 +157,10 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids);
157#define WM8785_PWRDNL 0x010 157#define WM8785_PWRDNL 0x010
158#define WM8785_TDM_MASK 0x1c0 158#define WM8785_TDM_MASK 0x1c0
159 159
160struct generic_data {
161 u8 ak4396_ctl2;
162};
163
160static void ak4396_write(struct oxygen *chip, unsigned int codec, 164static void ak4396_write(struct oxygen *chip, unsigned int codec,
161 u8 reg, u8 value) 165 u8 reg, u8 value)
162{ 166{
@@ -184,14 +188,15 @@ static void wm8785_write(struct oxygen *chip, u8 reg, unsigned int value)
184 188
185static void ak4396_init(struct oxygen *chip) 189static void ak4396_init(struct oxygen *chip)
186{ 190{
191 struct generic_data *data = chip->model_data;
187 unsigned int i; 192 unsigned int i;
188 193
189 chip->ak4396_ctl2 = AK4396_DEM_OFF | AK4396_DFS_NORMAL; 194 data->ak4396_ctl2 = AK4396_DEM_OFF | AK4396_DFS_NORMAL;
190 for (i = 0; i < 4; ++i) { 195 for (i = 0; i < 4; ++i) {
191 ak4396_write(chip, i, 196 ak4396_write(chip, i,
192 AK4396_CONTROL_1, AK4396_DIF_24_MSB | AK4396_RSTN); 197 AK4396_CONTROL_1, AK4396_DIF_24_MSB | AK4396_RSTN);
193 ak4396_write(chip, i, 198 ak4396_write(chip, i,
194 AK4396_CONTROL_2, chip->ak4396_ctl2); 199 AK4396_CONTROL_2, data->ak4396_ctl2);
195 ak4396_write(chip, i, 200 ak4396_write(chip, i,
196 AK4396_CONTROL_3, AK4396_PCM); 201 AK4396_CONTROL_3, AK4396_PCM);
197 ak4396_write(chip, i, AK4396_LCH_ATT, 0xff); 202 ak4396_write(chip, i, AK4396_LCH_ATT, 0xff);
@@ -235,17 +240,18 @@ static void generic_cleanup(struct oxygen *chip)
235static void set_ak4396_params(struct oxygen *chip, 240static void set_ak4396_params(struct oxygen *chip,
236 struct snd_pcm_hw_params *params) 241 struct snd_pcm_hw_params *params)
237{ 242{
243 struct generic_data *data = chip->model_data;
238 unsigned int i; 244 unsigned int i;
239 u8 value; 245 u8 value;
240 246
241 value = chip->ak4396_ctl2 & ~AK4396_DFS_MASK; 247 value = data->ak4396_ctl2 & ~AK4396_DFS_MASK;
242 if (params_rate(params) <= 54000) 248 if (params_rate(params) <= 54000)
243 value |= AK4396_DFS_NORMAL; 249 value |= AK4396_DFS_NORMAL;
244 else if (params_rate(params) < 120000) 250 else if (params_rate(params) < 120000)
245 value |= AK4396_DFS_DOUBLE; 251 value |= AK4396_DFS_DOUBLE;
246 else 252 else
247 value |= AK4396_DFS_QUAD; 253 value |= AK4396_DFS_QUAD;
248 chip->ak4396_ctl2 = value; 254 data->ak4396_ctl2 = value;
249 for (i = 0; i < 4; ++i) { 255 for (i = 0; i < 4; ++i) {
250 ak4396_write(chip, i, 256 ak4396_write(chip, i,
251 AK4396_CONTROL_1, AK4396_DIF_24_MSB); 257 AK4396_CONTROL_1, AK4396_DIF_24_MSB);
@@ -270,12 +276,14 @@ static void update_ak4396_volume(struct oxygen *chip)
270 276
271static void update_ak4396_mute(struct oxygen *chip) 277static void update_ak4396_mute(struct oxygen *chip)
272{ 278{
279 struct generic_data *data = chip->model_data;
273 unsigned int i; 280 unsigned int i;
274 u8 value; 281 u8 value;
275 282
276 value = chip->ak4396_ctl2 & ~AK4396_SMUTE; 283 value = data->ak4396_ctl2 & ~AK4396_SMUTE;
277 if (chip->dac_mute) 284 if (chip->dac_mute)
278 value |= AK4396_SMUTE; 285 value |= AK4396_SMUTE;
286 data->ak4396_ctl2 = value;
279 for (i = 0; i < 4; ++i) 287 for (i = 0; i < 4; ++i)
280 ak4396_write(chip, i, AK4396_CONTROL_2, value); 288 ak4396_write(chip, i, AK4396_CONTROL_2, value);
281} 289}
@@ -341,6 +349,7 @@ static const struct oxygen_model model_generic = {
341 .set_adc_params = set_wm8785_params, 349 .set_adc_params = set_wm8785_params,
342 .update_dac_volume = update_ak4396_volume, 350 .update_dac_volume = update_ak4396_volume,
343 .update_dac_mute = update_ak4396_mute, 351 .update_dac_mute = update_ak4396_mute,
352 .model_data_size = sizeof(struct generic_data),
344 .used_channels = OXYGEN_CHANNEL_A | 353 .used_channels = OXYGEN_CHANNEL_A |
345 OXYGEN_CHANNEL_C | 354 OXYGEN_CHANNEL_C |
346 OXYGEN_CHANNEL_SPDIF | 355 OXYGEN_CHANNEL_SPDIF |
@@ -362,6 +371,7 @@ static const struct oxygen_model model_meridian = {
362 .set_adc_params = set_ak5385_params, 371 .set_adc_params = set_ak5385_params,
363 .update_dac_volume = update_ak4396_volume, 372 .update_dac_volume = update_ak4396_volume,
364 .update_dac_mute = update_ak4396_mute, 373 .update_dac_mute = update_ak4396_mute,
374 .model_data_size = sizeof(struct generic_data),
365 .used_channels = OXYGEN_CHANNEL_B | 375 .used_channels = OXYGEN_CHANNEL_B |
366 OXYGEN_CHANNEL_C | 376 OXYGEN_CHANNEL_C |
367 OXYGEN_CHANNEL_SPDIF | 377 OXYGEN_CHANNEL_SPDIF |