diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-06-29 06:28:18 -0400 |
---|---|---|
committer | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-07-07 07:23:44 -0400 |
commit | f53c346c08425b6448cf9729e882e4057ea505f0 (patch) | |
tree | 692f2bae986f3202ff49675fd62b722b49438db0 /sound | |
parent | af958c72af88405501fe61a43f8011614cff29f5 (diff) |
ASoC: twl6040: Simplify sample rate constraint handling
We can manage the sample rate constraints without the need
to maintain a variable and a pointer.
This simplifies the handling of the constraint, and makes it
more robust.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/twl6040.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 94108ce63c6b..c72268bf663a 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -89,7 +89,6 @@ struct twl6040_data { | |||
89 | u16 hs_right_step; | 89 | u16 hs_right_step; |
90 | u16 hf_left_step; | 90 | u16 hf_left_step; |
91 | u16 hf_right_step; | 91 | u16 hf_right_step; |
92 | struct snd_pcm_hw_constraint_list *sysclk_constraints; | ||
93 | struct twl6040_jack_data hs_jack; | 92 | struct twl6040_jack_data hs_jack; |
94 | struct snd_soc_codec *codec; | 93 | struct snd_soc_codec *codec; |
95 | struct workqueue_struct *workqueue; | 94 | struct workqueue_struct *workqueue; |
@@ -224,11 +223,6 @@ static unsigned int lp_rates[] = { | |||
224 | 96000, | 223 | 96000, |
225 | }; | 224 | }; |
226 | 225 | ||
227 | static struct snd_pcm_hw_constraint_list lp_constraints = { | ||
228 | .count = ARRAY_SIZE(lp_rates), | ||
229 | .list = lp_rates, | ||
230 | }; | ||
231 | |||
232 | static unsigned int hp_rates[] = { | 226 | static unsigned int hp_rates[] = { |
233 | 8000, | 227 | 8000, |
234 | 16000, | 228 | 16000, |
@@ -237,9 +231,9 @@ static unsigned int hp_rates[] = { | |||
237 | 96000, | 231 | 96000, |
238 | }; | 232 | }; |
239 | 233 | ||
240 | static struct snd_pcm_hw_constraint_list hp_constraints = { | 234 | static struct snd_pcm_hw_constraint_list sysclk_constraints[] = { |
241 | .count = ARRAY_SIZE(hp_rates), | 235 | { .count = ARRAY_SIZE(lp_rates), .list = lp_rates, }, |
242 | .list = hp_rates, | 236 | { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, |
243 | }; | 237 | }; |
244 | 238 | ||
245 | /* | 239 | /* |
@@ -1099,10 +1093,6 @@ static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, | |||
1099 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 1093 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); |
1100 | 1094 | ||
1101 | priv->pll_power_mode = ucontrol->value.enumerated.item[0]; | 1095 | priv->pll_power_mode = ucontrol->value.enumerated.item[0]; |
1102 | if (priv->pll_power_mode) | ||
1103 | priv->sysclk_constraints = &hp_constraints; | ||
1104 | else | ||
1105 | priv->sysclk_constraints = &lp_constraints; | ||
1106 | 1096 | ||
1107 | return 0; | 1097 | return 0; |
1108 | } | 1098 | } |
@@ -1370,7 +1360,7 @@ static int twl6040_startup(struct snd_pcm_substream *substream, | |||
1370 | 1360 | ||
1371 | snd_pcm_hw_constraint_list(substream->runtime, 0, | 1361 | snd_pcm_hw_constraint_list(substream->runtime, 0, |
1372 | SNDRV_PCM_HW_PARAM_RATE, | 1362 | SNDRV_PCM_HW_PARAM_RATE, |
1373 | priv->sysclk_constraints); | 1363 | &sysclk_constraints[priv->pll_power_mode]); |
1374 | 1364 | ||
1375 | return 0; | 1365 | return 0; |
1376 | } | 1366 | } |
@@ -1599,7 +1589,6 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1599 | goto work_err; | 1589 | goto work_err; |
1600 | } | 1590 | } |
1601 | 1591 | ||
1602 | priv->sysclk_constraints = &lp_constraints; | ||
1603 | priv->workqueue = create_singlethread_workqueue("twl6040-codec"); | 1592 | priv->workqueue = create_singlethread_workqueue("twl6040-codec"); |
1604 | if (!priv->workqueue) { | 1593 | if (!priv->workqueue) { |
1605 | ret = -ENOMEM; | 1594 | ret = -ENOMEM; |