diff options
author | Vinod Koul <vinod.koul@intel.com> | 2014-09-19 07:16:03 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-09-25 10:22:23 -0400 |
commit | 0121327c1a68bc8c80f240c2794e682722b69051 (patch) | |
tree | 516a8f170dd1789a4afcc4730fb8a67b0cafd8cb | |
parent | 6df5d768050f31d810dd3ba0ad8210922c3e9b6d (diff) |
ASoC: Intel: mfld-pcm: add control for powering up/down dsp
When we have PCM (FE/BE) opened or DAPM widgets triggered we need power
up/down DSP accordingly. The DSP will do ref count of these requests
i.e. link these runtime_get/put calls of DSP
Also fix some preexisting spacing error.
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/sst-mfld-platform-pcm.c | 16 | ||||
-rw-r--r-- | sound/soc/intel/sst-mfld-platform.h | 17 |
2 files changed, 25 insertions, 8 deletions
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 8e1b2c14291c..aa9b600dfc9b 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c | |||
@@ -322,6 +322,16 @@ static int sst_platform_init_stream(struct snd_pcm_substream *substream) | |||
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | static int power_up_sst(struct sst_runtime_stream *stream) | ||
326 | { | ||
327 | return stream->ops->power(sst->dev, true); | ||
328 | } | ||
329 | |||
330 | static void power_down_sst(struct sst_runtime_stream *stream) | ||
331 | { | ||
332 | stream->ops->power(sst->dev, false); | ||
333 | } | ||
334 | |||
325 | static int sst_media_open(struct snd_pcm_substream *substream, | 335 | static int sst_media_open(struct snd_pcm_substream *substream, |
326 | struct snd_soc_dai *dai) | 336 | struct snd_soc_dai *dai) |
327 | { | 337 | { |
@@ -351,6 +361,10 @@ static int sst_media_open(struct snd_pcm_substream *substream, | |||
351 | /* allocate memory for SST API set */ | 361 | /* allocate memory for SST API set */ |
352 | runtime->private_data = stream; | 362 | runtime->private_data = stream; |
353 | 363 | ||
364 | ret_val = power_up_sst(stream); | ||
365 | if (ret_val < 0) | ||
366 | return ret_val; | ||
367 | |||
354 | /* Make sure, that the period size is always even */ | 368 | /* Make sure, that the period size is always even */ |
355 | snd_pcm_hw_constraint_step(substream->runtime, 0, | 369 | snd_pcm_hw_constraint_step(substream->runtime, 0, |
356 | SNDRV_PCM_HW_PARAM_PERIODS, 2); | 370 | SNDRV_PCM_HW_PARAM_PERIODS, 2); |
@@ -370,6 +384,8 @@ static void sst_media_close(struct snd_pcm_substream *substream, | |||
370 | int ret_val = 0, str_id; | 384 | int ret_val = 0, str_id; |
371 | 385 | ||
372 | stream = substream->runtime->private_data; | 386 | stream = substream->runtime->private_data; |
387 | power_down_sst(stream); | ||
388 | |||
373 | str_id = stream->stream_info.str_id; | 389 | str_id = stream->stream_info.str_id; |
374 | if (str_id) | 390 | if (str_id) |
375 | ret_val = stream->ops->close(sst->dev, str_id); | 391 | ret_val = stream->ops->close(sst->dev, str_id); |
diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h index 7092ee3e96a3..19f83ec51613 100644 --- a/sound/soc/intel/sst-mfld-platform.h +++ b/sound/soc/intel/sst-mfld-platform.h | |||
@@ -120,15 +120,16 @@ struct compress_sst_ops { | |||
120 | }; | 120 | }; |
121 | 121 | ||
122 | struct sst_ops { | 122 | struct sst_ops { |
123 | int (*open) (struct device *dev, struct snd_sst_params *str_param); | 123 | int (*open)(struct device *dev, struct snd_sst_params *str_param); |
124 | int (*stream_init) (struct device *dev, struct pcm_stream_info *str_info); | 124 | int (*stream_init)(struct device *dev, struct pcm_stream_info *str_info); |
125 | int (*stream_start) (struct device *dev, int str_id); | 125 | int (*stream_start)(struct device *dev, int str_id); |
126 | int (*stream_drop) (struct device *dev, int str_id); | 126 | int (*stream_drop)(struct device *dev, int str_id); |
127 | int (*stream_pause) (struct device *dev, int str_id); | 127 | int (*stream_pause)(struct device *dev, int str_id); |
128 | int (*stream_pause_release) (struct device *dev, int str_id); | 128 | int (*stream_pause_release)(struct device *dev, int str_id); |
129 | int (*stream_read_tstamp) (struct device *dev, struct pcm_stream_info *str_info); | 129 | int (*stream_read_tstamp)(struct device *dev, struct pcm_stream_info *str_info); |
130 | int (*send_byte_stream)(struct device *dev, struct snd_sst_bytes_v2 *bytes); | 130 | int (*send_byte_stream)(struct device *dev, struct snd_sst_bytes_v2 *bytes); |
131 | int (*close) (struct device *dev, unsigned int str_id); | 131 | int (*close)(struct device *dev, unsigned int str_id); |
132 | int (*power)(struct device *dev, bool state); | ||
132 | }; | 133 | }; |
133 | 134 | ||
134 | struct sst_runtime_stream { | 135 | struct sst_runtime_stream { |