diff mbox

[RFC,9/9] ASoC: hda: Export API to change DSP power state

Message ID 1429276567-29007-10-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul April 17, 2015, 1:16 p.m. UTC
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/hda/intel/soc-hda-sst-dsp.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Mark Brown April 24, 2015, 5:33 p.m. UTC | #1
On Fri, Apr 17, 2015 at 06:46:07PM +0530, Vinod Koul wrote:

> +	if (state == SST_DSP_POWER_D0)
> +		ret = ctx->ops.set_state_D0(ctx);
> +	else if (state == SST_DSP_POWER_D3)
> +		ret = ctx->ops.set_state_D3(ctx);
> +	else
> +		dev_err(ctx->dev, "Power State=%x not supported", state);

Can we have a switch statement please?  I'm a bit unclear why this is
being exported as it is, shouldn't things be wrapped up more so that the
DSP code owns its own power state.
diff mbox

Patch

diff --git a/sound/soc/hda/intel/soc-hda-sst-dsp.c b/sound/soc/hda/intel/soc-hda-sst-dsp.c
index b133c63a0c20..4d4d01b496b3 100644
--- a/sound/soc/hda/intel/soc-hda-sst-dsp.c
+++ b/sound/soc/hda/intel/soc-hda-sst-dsp.c
@@ -480,6 +480,20 @@  int ssth_dsp_free0(struct ssth_lib *dsp)
 }
 EXPORT_SYMBOL_GPL(ssth_dsp_free0);
 
+int ssth_dsp_set_power_state(struct ssth_lib *ctx, int state)
+{
+	int ret = 0;
+
+	if (state == SST_DSP_POWER_D0)
+		ret = ctx->ops.set_state_D0(ctx);
+	else if (state == SST_DSP_POWER_D3)
+		ret = ctx->ops.set_state_D3(ctx);
+	else
+		dev_err(ctx->dev, "Power State=%x not supported", state);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(ssth_dsp_set_power_state);
+
 bool ssth_dsp_is_running(struct ssth_lib *ctx)
 {
 	bool ret = 0;