[alsa-devel] [PATCH 4/4] ASoC: add Component level set_bias_level

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Aug 24 02:58:25 CEST 2017


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

In current ALSA SoC, Codec only has set_bias_level feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

Codec side bias related code has .idle_bias_off / .suspend_bias_off too.
These are used on dapm_idle_bias_off(), and it will return true if
.idle_bias_off was true, then, .suspend_bias_off is not used.
Now, Component site is using .idle_bias_off = true now.
This patch doesn't convert .idle_bias_off / .suspend_bias_off
for Component side, let's use current .idle_bias_off, as-is.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 include/sound/soc.h  |  4 ++++
 sound/soc/soc-core.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index e817830..bb62a29 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -799,6 +799,8 @@ struct snd_soc_component_driver {
 		       int source, unsigned int freq_in, unsigned int freq_out);
 	int (*set_jack)(struct snd_soc_component *component,
 			struct snd_soc_jack *jack,  void *data);
+	int (*set_bias_level)(struct snd_soc_component *component,
+			      enum snd_soc_bias_level level);
 
 	/* DT */
 	int (*of_xlate_dai_name)(struct snd_soc_component *component,
@@ -885,6 +887,8 @@ struct snd_soc_component {
 		       int source, unsigned int freq_in, unsigned int freq_out);
 	int (*set_jack)(struct snd_soc_component *component,
 			struct snd_soc_jack *jack,  void *data);
+	int (*set_bias_level)(struct snd_soc_component *component,
+			      enum snd_soc_bias_level level);
 
 	/* machine specific init */
 	int (*init)(struct snd_soc_component *component);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c2ef155..65999df 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3205,6 +3205,14 @@ static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
 	return component->driver->stream_event(component, event);
 }
 
+static int snd_soc_component_set_bias_level(struct snd_soc_dapm_context *dapm,
+					enum snd_soc_bias_level level)
+{
+	struct snd_soc_component *component = dapm->component;
+
+	return component->driver->set_bias_level(component, level);
+}
+
 static int snd_soc_component_initialize(struct snd_soc_component *component,
 	const struct snd_soc_component_driver *driver, struct device *dev)
 {
@@ -3235,6 +3243,8 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 		dapm->seq_notifier = snd_soc_component_seq_notifier;
 	if (driver->stream_event)
 		dapm->stream_event = snd_soc_component_stream_event;
+	if (driver->set_bias_level)
+		dapm->set_bias_level = snd_soc_component_set_bias_level;
 
 	component->controls = driver->controls;
 	component->num_controls = driver->num_controls;
-- 
1.9.1



More information about the Alsa-devel mailing list