aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-09-28 05:20:11 -0400
committerTakashi Iwai <tiwai@suse.de>2009-09-28 05:54:45 -0400
commit76ffe1e3fb2f65e98d7ed001c5a2b6f334655364 (patch)
tree9a05a9f27a3a0907dd6af081a2b149d72a303b89 /sound
parenta361e247b4e36c567b44fef354ab595458422d44 (diff)
sound: oxygen: allow custom MCLK rates
Add a callback that allows model drivers to modify the default I2S MCLK rate. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/oxygen/hifier.c1
-rw-r--r--sound/pci/oxygen/oxygen.c1
-rw-r--r--sound/pci/oxygen/oxygen.h4
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c13
-rw-r--r--sound/pci/oxygen/xonar_cs43xx.c1
-rw-r--r--sound/pci/oxygen/xonar_pcm179x.c3
6 files changed, 19 insertions, 4 deletions
diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c
index 2079c100aabc..e3c229b63311 100644
--- a/sound/pci/oxygen/hifier.c
+++ b/sound/pci/oxygen/hifier.c
@@ -170,6 +170,7 @@ static const struct oxygen_model model_hifier = {
170 .init = hifier_init, 170 .init = hifier_init,
171 .cleanup = hifier_cleanup, 171 .cleanup = hifier_cleanup,
172 .resume = hifier_resume, 172 .resume = hifier_resume,
173 .get_i2s_mclk = oxygen_default_i2s_mclk,
173 .set_dac_params = set_ak4396_params, 174 .set_dac_params = set_ak4396_params,
174 .set_adc_params = set_cs5340_params, 175 .set_adc_params = set_cs5340_params,
175 .update_dac_volume = update_ak4396_volume, 176 .update_dac_volume = update_ak4396_volume,
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index c986c5ebf65b..d12fd9efe94e 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -361,6 +361,7 @@ static const struct oxygen_model model_generic = {
361 .init = generic_init, 361 .init = generic_init,
362 .cleanup = generic_cleanup, 362 .cleanup = generic_cleanup,
363 .resume = generic_resume, 363 .resume = generic_resume,
364 .get_i2s_mclk = oxygen_default_i2s_mclk,
364 .set_dac_params = set_ak4396_params, 365 .set_dac_params = set_ak4396_params,
365 .set_adc_params = set_wm8785_params, 366 .set_adc_params = set_wm8785_params,
366 .update_dac_volume = update_ak4396_volume, 367 .update_dac_volume = update_ak4396_volume,
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 2ac3b3c8253f..6147216af744 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -78,6 +78,8 @@ struct oxygen_model {
78 void (*resume)(struct oxygen *chip); 78 void (*resume)(struct oxygen *chip);
79 void (*pcm_hardware_filter)(unsigned int channel, 79 void (*pcm_hardware_filter)(unsigned int channel,
80 struct snd_pcm_hardware *hardware); 80 struct snd_pcm_hardware *hardware);
81 unsigned int (*get_i2s_mclk)(struct oxygen *chip, unsigned int channel,
82 struct snd_pcm_hw_params *hw_params);
81 void (*set_dac_params)(struct oxygen *chip, 83 void (*set_dac_params)(struct oxygen *chip,
82 struct snd_pcm_hw_params *params); 84 struct snd_pcm_hw_params *params);
83 void (*set_adc_params)(struct oxygen *chip, 85 void (*set_adc_params)(struct oxygen *chip,
@@ -163,6 +165,8 @@ void oxygen_update_spdif_source(struct oxygen *chip);
163/* oxygen_pcm.c */ 165/* oxygen_pcm.c */
164 166
165int oxygen_pcm_init(struct oxygen *chip); 167int oxygen_pcm_init(struct oxygen *chip);
168unsigned int oxygen_default_i2s_mclk(struct oxygen *chip, unsigned int channel,
169 struct snd_pcm_hw_params *hw_params);
166 170
167/* oxygen_io.c */ 171/* oxygen_io.c */
168 172
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index 1e98333366df..9dff6954c397 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -271,13 +271,16 @@ static unsigned int oxygen_rate(struct snd_pcm_hw_params *hw_params)
271 } 271 }
272} 272}
273 273
274static unsigned int oxygen_i2s_mclk(struct snd_pcm_hw_params *hw_params) 274unsigned int oxygen_default_i2s_mclk(struct oxygen *chip,
275 unsigned int channel,
276 struct snd_pcm_hw_params *hw_params)
275{ 277{
276 if (params_rate(hw_params) <= 96000) 278 if (params_rate(hw_params) <= 96000)
277 return OXYGEN_I2S_MCLK_256; 279 return OXYGEN_I2S_MCLK_256;
278 else 280 else
279 return OXYGEN_I2S_MCLK_128; 281 return OXYGEN_I2S_MCLK_128;
280} 282}
283EXPORT_SYMBOL(oxygen_default_i2s_mclk);
281 284
282static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params) 285static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params)
283{ 286{
@@ -354,7 +357,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream,
354 OXYGEN_REC_FORMAT_A_MASK); 357 OXYGEN_REC_FORMAT_A_MASK);
355 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, 358 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT,
356 oxygen_rate(hw_params) | 359 oxygen_rate(hw_params) |
357 oxygen_i2s_mclk(hw_params) | 360 chip->model.get_i2s_mclk(chip, PCM_A, hw_params) |
358 chip->model.adc_i2s_format | 361 chip->model.adc_i2s_format |
359 oxygen_i2s_bits(hw_params), 362 oxygen_i2s_bits(hw_params),
360 OXYGEN_I2S_RATE_MASK | 363 OXYGEN_I2S_RATE_MASK |
@@ -390,7 +393,8 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,
390 if (!is_ac97) 393 if (!is_ac97)
391 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, 394 oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT,
392 oxygen_rate(hw_params) | 395 oxygen_rate(hw_params) |
393 oxygen_i2s_mclk(hw_params) | 396 chip->model.get_i2s_mclk(chip, PCM_B,
397 hw_params) |
394 chip->model.adc_i2s_format | 398 chip->model.adc_i2s_format |
395 oxygen_i2s_bits(hw_params), 399 oxygen_i2s_bits(hw_params),
396 OXYGEN_I2S_RATE_MASK | 400 OXYGEN_I2S_RATE_MASK |
@@ -472,7 +476,8 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,
472 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, 476 oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT,
473 oxygen_rate(hw_params) | 477 oxygen_rate(hw_params) |
474 chip->model.dac_i2s_format | 478 chip->model.dac_i2s_format |
475 oxygen_i2s_mclk(hw_params) | 479 chip->model.get_i2s_mclk(chip, PCM_MULTICH,
480 hw_params) |
476 oxygen_i2s_bits(hw_params), 481 oxygen_i2s_bits(hw_params),
477 OXYGEN_I2S_RATE_MASK | 482 OXYGEN_I2S_RATE_MASK |
478 OXYGEN_I2S_FORMAT_MASK | 483 OXYGEN_I2S_FORMAT_MASK |
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
index 330c5e755917..a83f827feb34 100644
--- a/sound/pci/oxygen/xonar_cs43xx.c
+++ b/sound/pci/oxygen/xonar_cs43xx.c
@@ -321,6 +321,7 @@ static const struct oxygen_model model_xonar_d1 = {
321 .cleanup = xonar_d1_cleanup, 321 .cleanup = xonar_d1_cleanup,
322 .suspend = xonar_d1_suspend, 322 .suspend = xonar_d1_suspend,
323 .resume = xonar_d1_resume, 323 .resume = xonar_d1_resume,
324 .get_i2s_mclk = oxygen_default_i2s_mclk,
324 .set_dac_params = set_cs43xx_params, 325 .set_dac_params = set_cs43xx_params,
325 .set_adc_params = xonar_set_cs53x1_params, 326 .set_adc_params = xonar_set_cs53x1_params,
326 .update_dac_volume = update_cs43xx_volume, 327 .update_dac_volume = update_cs43xx_volume,
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c
index cf94e4432a3f..35b3fb4071fb 100644
--- a/sound/pci/oxygen/xonar_pcm179x.c
+++ b/sound/pci/oxygen/xonar_pcm179x.c
@@ -771,6 +771,7 @@ static const struct oxygen_model model_xonar_d2 = {
771 .cleanup = xonar_d2_cleanup, 771 .cleanup = xonar_d2_cleanup,
772 .suspend = xonar_d2_suspend, 772 .suspend = xonar_d2_suspend,
773 .resume = xonar_d2_resume, 773 .resume = xonar_d2_resume,
774 .get_i2s_mclk = oxygen_default_i2s_mclk,
774 .set_dac_params = set_pcm1796_params, 775 .set_dac_params = set_pcm1796_params,
775 .set_adc_params = xonar_set_cs53x1_params, 776 .set_adc_params = xonar_set_cs53x1_params,
776 .update_dac_volume = update_pcm1796_volume, 777 .update_dac_volume = update_pcm1796_volume,
@@ -801,6 +802,7 @@ static const struct oxygen_model model_xonar_hdav = {
801 .suspend = xonar_hdav_suspend, 802 .suspend = xonar_hdav_suspend,
802 .resume = xonar_hdav_resume, 803 .resume = xonar_hdav_resume,
803 .pcm_hardware_filter = xonar_hdmi_pcm_hardware_filter, 804 .pcm_hardware_filter = xonar_hdmi_pcm_hardware_filter,
805 .get_i2s_mclk = oxygen_default_i2s_mclk,
804 .set_dac_params = set_hdav_params, 806 .set_dac_params = set_hdav_params,
805 .set_adc_params = xonar_set_cs53x1_params, 807 .set_adc_params = xonar_set_cs53x1_params,
806 .update_dac_volume = update_pcm1796_volume, 808 .update_dac_volume = update_pcm1796_volume,
@@ -831,6 +833,7 @@ static const struct oxygen_model model_xonar_st = {
831 .cleanup = xonar_st_cleanup, 833 .cleanup = xonar_st_cleanup,
832 .suspend = xonar_st_suspend, 834 .suspend = xonar_st_suspend,
833 .resume = xonar_st_resume, 835 .resume = xonar_st_resume,
836 .get_i2s_mclk = oxygen_default_i2s_mclk,
834 .set_dac_params = set_st_params, 837 .set_dac_params = set_st_params,
835 .set_adc_params = xonar_set_cs53x1_params, 838 .set_adc_params = xonar_set_cs53x1_params,
836 .update_dac_volume = update_pcm1796_volume, 839 .update_dac_volume = update_pcm1796_volume,