From 9c516a47d24cf29e75eb8a0e67dec38bde48997b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 9 Apr 2012 19:40:00 +0100 Subject: [PATCH] --- yaml --- r: 305649 b: refs/heads/master c: fde39a6b15612943673555aec7237f9e7228f27d h: refs/heads/master i: 305647: 8d4e7d6c58f33137b45aa8c08b8b187bd59fda1f v: v3 --- [refs] | 2 +- trunk/sound/soc/codecs/wm1250-ev1.c | 43 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 75a74d408adf..7e2676a560f6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5f6ac59f7019c568f6657707efe210ab92e61b9c +refs/heads/master: fde39a6b15612943673555aec7237f9e7228f27d diff --git a/trunk/sound/soc/codecs/wm1250-ev1.c b/trunk/sound/soc/codecs/wm1250-ev1.c index 0766b5fabae7..e0b51e9f8b12 100644 --- a/trunk/sound/soc/codecs/wm1250-ev1.c +++ b/trunk/sound/soc/codecs/wm1250-ev1.c @@ -79,6 +79,48 @@ static const struct snd_soc_dapm_route wm1250_ev1_dapm_routes[] = { { "WM1250 Output", NULL, "DAC" }, }; +static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct wm1250_priv *wm1250 = snd_soc_codec_get_drvdata(dai->codec); + + switch (params_rate(params)) { + case 8000: + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, + 1); + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, + 1); + break; + case 16000: + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, + 0); + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, + 1); + break; + case 32000: + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, + 1); + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, + 0); + break; + case 64000: + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, + 0); + gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, + 0); + break; + default: + return -EINVAL; + } + + return 0; +} + +static const struct snd_soc_dai_ops wm1250_ev1_ops = { + .hw_params = wm1250_ev1_hw_params, +}; + static struct snd_soc_dai_driver wm1250_ev1_dai = { .name = "wm1250-ev1", .playback = { @@ -95,6 +137,7 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = { .rates = SNDRV_PCM_RATE_8000, .formats = SNDRV_PCM_FMTBIT_S16_LE, }, + .ops = &wm1250_ev1_ops, }; static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {