diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-09-28 11:20:11 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-09-28 11:54:45 +0200 |
commit | 76ffe1e3fb2f65e98d7ed001c5a2b6f334655364 (patch) | |
tree | 9a05a9f27a3a0907dd6af081a2b149d72a303b89 | |
parent | sound: virtuoso: add headphone impedance control (diff) | |
download | linux-76ffe1e3fb2f65e98d7ed001c5a2b6f334655364.tar.xz linux-76ffe1e3fb2f65e98d7ed001c5a2b6f334655364.zip |
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>
-rw-r--r-- | sound/pci/oxygen/hifier.c | 1 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen.c | 1 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 4 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 13 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_cs43xx.c | 1 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_pcm179x.c | 3 |
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 = { .init = hifier_init, .cleanup = hifier_cleanup, .resume = hifier_resume, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_ak4396_params, .set_adc_params = set_cs5340_params, .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 = { .init = generic_init, .cleanup = generic_cleanup, .resume = generic_resume, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_ak4396_params, .set_adc_params = set_wm8785_params, .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 { void (*resume)(struct oxygen *chip); void (*pcm_hardware_filter)(unsigned int channel, struct snd_pcm_hardware *hardware); + unsigned int (*get_i2s_mclk)(struct oxygen *chip, unsigned int channel, + struct snd_pcm_hw_params *hw_params); void (*set_dac_params)(struct oxygen *chip, struct snd_pcm_hw_params *params); void (*set_adc_params)(struct oxygen *chip, @@ -163,6 +165,8 @@ void oxygen_update_spdif_source(struct oxygen *chip); /* oxygen_pcm.c */ int oxygen_pcm_init(struct oxygen *chip); +unsigned int oxygen_default_i2s_mclk(struct oxygen *chip, unsigned int channel, + struct snd_pcm_hw_params *hw_params); /* oxygen_io.c */ 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) } } -static unsigned int oxygen_i2s_mclk(struct snd_pcm_hw_params *hw_params) +unsigned int oxygen_default_i2s_mclk(struct oxygen *chip, + unsigned int channel, + struct snd_pcm_hw_params *hw_params) { if (params_rate(hw_params) <= 96000) return OXYGEN_I2S_MCLK_256; else return OXYGEN_I2S_MCLK_128; } +EXPORT_SYMBOL(oxygen_default_i2s_mclk); static unsigned int oxygen_i2s_bits(struct snd_pcm_hw_params *hw_params) { @@ -354,7 +357,7 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream, OXYGEN_REC_FORMAT_A_MASK); oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, oxygen_rate(hw_params) | - oxygen_i2s_mclk(hw_params) | + chip->model.get_i2s_mclk(chip, PCM_A, hw_params) | chip->model.adc_i2s_format | oxygen_i2s_bits(hw_params), OXYGEN_I2S_RATE_MASK | @@ -390,7 +393,8 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream, if (!is_ac97) oxygen_write16_masked(chip, OXYGEN_I2S_B_FORMAT, oxygen_rate(hw_params) | - oxygen_i2s_mclk(hw_params) | + chip->model.get_i2s_mclk(chip, PCM_B, + hw_params) | chip->model.adc_i2s_format | oxygen_i2s_bits(hw_params), OXYGEN_I2S_RATE_MASK | @@ -472,7 +476,8 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream, oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, oxygen_rate(hw_params) | chip->model.dac_i2s_format | - oxygen_i2s_mclk(hw_params) | + chip->model.get_i2s_mclk(chip, PCM_MULTICH, + hw_params) | oxygen_i2s_bits(hw_params), OXYGEN_I2S_RATE_MASK | 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 = { .cleanup = xonar_d1_cleanup, .suspend = xonar_d1_suspend, .resume = xonar_d1_resume, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_cs43xx_params, .set_adc_params = xonar_set_cs53x1_params, .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 = { .cleanup = xonar_d2_cleanup, .suspend = xonar_d2_suspend, .resume = xonar_d2_resume, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_pcm1796_params, .set_adc_params = xonar_set_cs53x1_params, .update_dac_volume = update_pcm1796_volume, @@ -801,6 +802,7 @@ static const struct oxygen_model model_xonar_hdav = { .suspend = xonar_hdav_suspend, .resume = xonar_hdav_resume, .pcm_hardware_filter = xonar_hdmi_pcm_hardware_filter, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_hdav_params, .set_adc_params = xonar_set_cs53x1_params, .update_dac_volume = update_pcm1796_volume, @@ -831,6 +833,7 @@ static const struct oxygen_model model_xonar_st = { .cleanup = xonar_st_cleanup, .suspend = xonar_st_suspend, .resume = xonar_st_resume, + .get_i2s_mclk = oxygen_default_i2s_mclk, .set_dac_params = set_st_params, .set_adc_params = xonar_set_cs53x1_params, .update_dac_volume = update_pcm1796_volume, |