summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-09-26 01:01:10 +0000
committerMark Brown <broonie@kernel.org>2017-09-27 10:11:14 -0700
commit7ba236ce58bd7ac8e360de81f834d9c446f7b063 (patch)
treef443c35583a4e4c83a71b09c7ce8bb35aadf724c /sound/soc/soc-core.c
parentf523acebbb74f3cf5840d801f2e4856c688bf14a (diff)
ASoC: add Component level set_bias_level
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 driver has .idle_bias_off for dapm bias. But Component driver doesn't have it, and dapm->idle_bias_off is set as "true". To keep compatibility, this patch adds "idle_bias_on" instead of ".idle_bias_off" on Component driver. dapm->idle_bias_off will be set by inverted idle_bias_on. When we replace Codec to Component, the driver which has ".idle_bias_off = true" is just remove it, and the driver which doesn't have it will have new ".idle_bias_on = true". Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index faed564670cd..fb3435121172 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3270,6 +3270,14 @@ static void snd_soc_component_drv_pcm_free(struct snd_soc_component *component,
component->driver->pcm_free(pcm);
}
+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)
{
@@ -3297,11 +3305,14 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
dapm->dev = dev;
dapm->component = component;
dapm->bias_level = SND_SOC_BIAS_OFF;
- dapm->idle_bias_off = true;
+ dapm->idle_bias_off = !driver->idle_bias_on;
+ dapm->suspend_bias_off = driver->suspend_bias_off;
if (driver->seq_notifier)
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;
INIT_LIST_HEAD(&component->dai_list);
mutex_init(&component->io_mutex);