summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-component.h5
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h4
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/soc/soc-dapm.c7
5 files changed, 20 insertions, 6 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index e538784746db..2a2b74b24a60 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -237,8 +237,7 @@ struct snd_soc_component {
* the driver will be marked as BROKEN when these fields are removed.
*/
- /* Don't use these, use snd_soc_component_get_dapm() */
- struct snd_soc_dapm_context dapm;
+ struct snd_soc_dapm_context *dapm;
/* machine specific init */
int (*init)(struct snd_soc_component *component);
@@ -268,7 +267,7 @@ struct snd_soc_component {
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
struct snd_soc_component *component)
{
- return &component->dapm;
+ return component->dapm;
}
/**
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 010d63db5436..6f3e1b57cda3 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -627,6 +627,8 @@ enum snd_soc_dapm_direction {
#define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN)
#define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT)
+struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev);
+
int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
int snd_soc_dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
int snd_soc_dapm_pinctrl_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index aa0fe6b80293..7d8376c8e1be 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1076,7 +1076,7 @@ struct snd_soc_card {
struct list_head dobj_list;
/* Generic DAPM context for the card */
- struct snd_soc_dapm_context dapm;
+ struct snd_soc_dapm_context *dapm;
struct snd_soc_dapm_stats dapm_stats;
#ifdef CONFIG_DEBUG_FS
@@ -1136,7 +1136,7 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
{
- return &card->dapm;
+ return card->dapm;
}
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e4b21bf39e59..355ccc95f28b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2556,6 +2556,10 @@ int snd_soc_register_card(struct snd_soc_card *card)
if (!card->name || !card->dev)
return -EINVAL;
+ card->dapm = snd_soc_dapm_alloc(card->dev);
+ if (!card->dapm)
+ return -ENOMEM;
+
dev_set_drvdata(card->dev, card);
INIT_LIST_HEAD(&card->widgets);
@@ -2840,6 +2844,10 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver,
struct device *dev)
{
+ component->dapm = snd_soc_dapm_alloc(dev);
+ if (!component->dapm)
+ return -ENOMEM;
+
INIT_LIST_HEAD(&component->dai_list);
INIT_LIST_HEAD(&component->dobj_list);
INIT_LIST_HEAD(&component->card_list);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4c2007c61ca1..7aef57dcb2a7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -165,6 +165,11 @@ static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...)
kfree(buf);
}
+struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev)
+{
+ return devm_kzalloc(dev, sizeof(struct snd_soc_dapm_context), GFP_KERNEL);
+}
+
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm)
{
if (dapm->component)
@@ -1076,7 +1081,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
if (ret != 0)
goto out;
- if (dapm != &card->dapm)
+ if (dapm != card->dapm)
ret = snd_soc_dapm_force_bias_level(dapm, level);
if (ret != 0)