diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-03-26 00:01:46 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-27 18:58:20 -0400 |
commit | af7e2be96623785816c1a6e521307b7af11ad016 (patch) | |
tree | 77997b7aefb98175fbe0da5cd93bdef2b84cc7fa /sound/soc/sh | |
parent | 415f1cb29d3be865b034b528058c7115bc262f43 (diff) |
ASoC: rsrc-card: add .be_hw_params_fixup support for convert rate
Current rsnd-dpcm-card is supporting DPCM FE/BE sound card.
This patch adds .be_hw_params_fixup and enabled sampling convert rate.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/rcar/rsrc-card.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 3baeab726bc3..a68517afe615 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c | |||
@@ -63,6 +63,7 @@ struct rsrc_card_priv { | |||
63 | } dai_props[RSRC_FB_NUM]; | 63 | } dai_props[RSRC_FB_NUM]; |
64 | struct snd_soc_codec_conf codec_conf; | 64 | struct snd_soc_codec_conf codec_conf; |
65 | struct snd_soc_dai_link dai_link[RSRC_FB_NUM]; | 65 | struct snd_soc_dai_link dai_link[RSRC_FB_NUM]; |
66 | u32 convert_rate; | ||
66 | }; | 67 | }; |
67 | 68 | ||
68 | #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) | 69 | #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) |
@@ -154,6 +155,21 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) | |||
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
156 | 157 | ||
158 | static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | ||
159 | struct snd_pcm_hw_params *params) | ||
160 | { | ||
161 | struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
162 | struct snd_interval *rate = hw_param_interval(params, | ||
163 | SNDRV_PCM_HW_PARAM_RATE); | ||
164 | |||
165 | if (!priv->convert_rate) | ||
166 | return 0; | ||
167 | |||
168 | rate->min = rate->max = priv->convert_rate; | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | |||
157 | static int | 173 | static int |
158 | rsrc_card_sub_parse_of(struct rsrc_card_priv *priv, | 174 | rsrc_card_sub_parse_of(struct rsrc_card_priv *priv, |
159 | struct device_node *np, | 175 | struct device_node *np, |
@@ -347,6 +363,9 @@ static int rsrc_card_dai_link_of(struct device_node *node, | |||
347 | dai_link->ops = &rsrc_card_ops; | 363 | dai_link->ops = &rsrc_card_ops; |
348 | dai_link->init = rsrc_card_dai_init; | 364 | dai_link->init = rsrc_card_dai_init; |
349 | 365 | ||
366 | if (idx == IDX_CODEC) | ||
367 | dai_link->be_hw_params_fixup = rsrc_card_be_hw_params_fixup; | ||
368 | |||
350 | dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); | 369 | dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); |
351 | dev_dbg(dev, "\tcpu : %s / %04x / %d\n", | 370 | dev_dbg(dev, "\tcpu : %s / %04x / %d\n", |
352 | dai_link->cpu_dai_name, | 371 | dai_link->cpu_dai_name, |
@@ -394,8 +413,12 @@ static int rsrc_card_parse_of(struct device_node *node, | |||
394 | priv->snd_card.of_dapm_routes = of_data->routes; | 413 | priv->snd_card.of_dapm_routes = of_data->routes; |
395 | priv->snd_card.num_of_dapm_routes = of_data->num_routes; | 414 | priv->snd_card.num_of_dapm_routes = of_data->num_routes; |
396 | 415 | ||
397 | dev_dbg(dev, "New rsrc-audio-card: %s\n", priv->snd_card.name ? | 416 | /* sampling rate convert */ |
398 | priv->snd_card.name : ""); | 417 | of_property_read_u32(node, "convert-rate", &priv->convert_rate); |
418 | |||
419 | dev_dbg(dev, "New rsrc-audio-card: %s (%d)\n", | ||
420 | priv->snd_card.name ? priv->snd_card.name : "", | ||
421 | priv->convert_rate); | ||
399 | 422 | ||
400 | /* FE/BE */ | 423 | /* FE/BE */ |
401 | for (i = 0; i < RSRC_FB_NUM; i++) { | 424 | for (i = 0; i < RSRC_FB_NUM; i++) { |