aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-03-30 15:04:51 -0400
committerMark Brown <broonie@kernel.org>2015-04-01 16:28:10 -0400
commitcd5d822688f3b32af286a76f7078dfe49c716282 (patch)
tree592a754811d8133fb283cd5faef6da5c12c94c75
parent37660b6daf6d28bb2206c95ec75c8063f2db1606 (diff)
ASoC: wm8350: Move delayed work struct from DAPM context to driver state
The wm8350 driver is the last driver that still uses the delayed_work field from the snd_soc_dapm_context struct. Moving this over to the driver's private data struct will allow us to remove the field from the DAPM context, which will drastically reduce its size. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wm8350.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index c81a9eab3e3e..c65e5a75fc1a 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -69,14 +69,14 @@ struct wm8350_data {
69 struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; 69 struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
70 int fll_freq_out; 70 int fll_freq_out;
71 int fll_freq_in; 71 int fll_freq_in;
72 struct delayed_work pga_work;
72}; 73};
73 74
74/* 75/*
75 * Ramp OUT1 PGA volume to minimise pops at stream startup and shutdown. 76 * Ramp OUT1 PGA volume to minimise pops at stream startup and shutdown.
76 */ 77 */
77static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec) 78static inline int wm8350_out1_ramp_step(struct wm8350_data *wm8350_data)
78{ 79{
79 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
80 struct wm8350_output *out1 = &wm8350_data->out1; 80 struct wm8350_output *out1 = &wm8350_data->out1;
81 struct wm8350 *wm8350 = wm8350_data->wm8350; 81 struct wm8350 *wm8350 = wm8350_data->wm8350;
82 int left_complete = 0, right_complete = 0; 82 int left_complete = 0, right_complete = 0;
@@ -140,9 +140,8 @@ static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
140/* 140/*
141 * Ramp OUT2 PGA volume to minimise pops at stream startup and shutdown. 141 * Ramp OUT2 PGA volume to minimise pops at stream startup and shutdown.
142 */ 142 */
143static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec) 143static inline int wm8350_out2_ramp_step(struct wm8350_data *wm8350_data)
144{ 144{
145 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
146 struct wm8350_output *out2 = &wm8350_data->out2; 145 struct wm8350_output *out2 = &wm8350_data->out2;
147 struct wm8350 *wm8350 = wm8350_data->wm8350; 146 struct wm8350 *wm8350 = wm8350_data->wm8350;
148 int left_complete = 0, right_complete = 0; 147 int left_complete = 0, right_complete = 0;
@@ -210,10 +209,8 @@ static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
210 */ 209 */
211static void wm8350_pga_work(struct work_struct *work) 210static void wm8350_pga_work(struct work_struct *work)
212{ 211{
213 struct snd_soc_dapm_context *dapm = 212 struct wm8350_data *wm8350_data =
214 container_of(work, struct snd_soc_dapm_context, delayed_work.work); 213 container_of(work, struct wm8350_data, pga_work.work);
215 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
216 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
217 struct wm8350_output *out1 = &wm8350_data->out1, 214 struct wm8350_output *out1 = &wm8350_data->out1,
218 *out2 = &wm8350_data->out2; 215 *out2 = &wm8350_data->out2;
219 int i, out1_complete, out2_complete; 216 int i, out1_complete, out2_complete;
@@ -226,9 +223,9 @@ static void wm8350_pga_work(struct work_struct *work)
226 for (i = 0; i <= 63; i++) { 223 for (i = 0; i <= 63; i++) {
227 out1_complete = 1, out2_complete = 1; 224 out1_complete = 1, out2_complete = 1;
228 if (out1->ramp != WM8350_RAMP_NONE) 225 if (out1->ramp != WM8350_RAMP_NONE)
229 out1_complete = wm8350_out1_ramp_step(codec); 226 out1_complete = wm8350_out1_ramp_step(wm8350_data);
230 if (out2->ramp != WM8350_RAMP_NONE) 227 if (out2->ramp != WM8350_RAMP_NONE)
231 out2_complete = wm8350_out2_ramp_step(codec); 228 out2_complete = wm8350_out2_ramp_step(wm8350_data);
232 229
233 /* ramp finished ? */ 230 /* ramp finished ? */
234 if (out1_complete && out2_complete) 231 if (out1_complete && out2_complete)
@@ -283,7 +280,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
283 out->ramp = WM8350_RAMP_UP; 280 out->ramp = WM8350_RAMP_UP;
284 out->active = 1; 281 out->active = 1;
285 282
286 schedule_delayed_work(&codec->dapm.delayed_work, 283 schedule_delayed_work(&wm8350_data->pga_work,
287 msecs_to_jiffies(1)); 284 msecs_to_jiffies(1));
288 break; 285 break;
289 286
@@ -291,7 +288,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
291 out->ramp = WM8350_RAMP_DOWN; 288 out->ramp = WM8350_RAMP_DOWN;
292 out->active = 0; 289 out->active = 0;
293 290
294 schedule_delayed_work(&codec->dapm.delayed_work, 291 schedule_delayed_work(&wm8350_data->pga_work,
295 msecs_to_jiffies(1)); 292 msecs_to_jiffies(1));
296 break; 293 break;
297 } 294 }
@@ -1492,7 +1489,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1492 /* Put the codec into reset if it wasn't already */ 1489 /* Put the codec into reset if it wasn't already */
1493 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1490 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
1494 1491
1495 INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8350_pga_work); 1492 INIT_DELAYED_WORK(&priv->pga_work, wm8350_pga_work);
1496 INIT_DELAYED_WORK(&priv->hpl.work, wm8350_hpl_work); 1493 INIT_DELAYED_WORK(&priv->hpl.work, wm8350_hpl_work);
1497 INIT_DELAYED_WORK(&priv->hpr.work, wm8350_hpr_work); 1494 INIT_DELAYED_WORK(&priv->hpr.work, wm8350_hpr_work);
1498 1495
@@ -1578,7 +1575,7 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1578 1575
1579 /* if there was any work waiting then we run it now and 1576 /* if there was any work waiting then we run it now and
1580 * wait for its completion */ 1577 * wait for its completion */
1581 flush_delayed_work(&codec->dapm.delayed_work); 1578 flush_delayed_work(&priv->pga_work);
1582 1579
1583 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1580 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
1584 1581