summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2025-09-19 15:54:28 +0300
committerMark Brown <broonie@kernel.org>2025-09-19 15:54:28 +0300
commitdfe3de7b5abe194f422dd92cf18fb5678fb918a7 (patch)
tree3179a1bb1be5d3730e0eb2a22132daa2b0147eae /include
parent2aa28b748fc967a2f2566c06bdad155fba8af7d8 (diff)
parentcb3c715d89607f8896c0f20fe528a08e7ebffea9 (diff)
downloadlinux-dfe3de7b5abe194f422dd92cf18fb5678fb918a7.tar.xz
ASoC: soc-dapm: prepare for hiding struct
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>: We would like to hide struct snd_soc_dapm_context from driver. So we need cleanup code first. These are preparation for it.
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc-component.h22
-rw-r--r--include/sound/soc-dapm.h12
-rw-r--r--include/sound/soc.h5
3 files changed, 18 insertions, 21 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 48e45cbe82e5..b954f34d6025 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -261,31 +261,19 @@ struct snd_soc_component {
list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
/**
- * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
- * embedded in
- * @dapm: The DAPM context to cast to the component
- *
- * This function must only be used on DAPM contexts that are known to be part of
- * a component (e.g. in a component driver). Otherwise the behavior is
- * undefined.
- */
-static inline struct snd_soc_component *snd_soc_dapm_to_component(
- struct snd_soc_dapm_context *dapm)
-{
- return container_of(dapm, struct snd_soc_component, dapm);
-}
-
-/**
- * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
+ * snd_soc_component_to_dapm() - Returns the DAPM context associated with a
* component
* @component: The component for which to get the DAPM context
*/
-static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
+static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
struct snd_soc_component *component)
{
return &component->dapm;
}
+// FIXME
+#define snd_soc_component_get_dapm snd_soc_component_to_dapm
+
/**
* snd_soc_component_cache_sync() - Sync the register cache with the hardware
* @component: COMPONENT to sync
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ed39458b94bf..75941324886b 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -583,11 +583,9 @@ struct snd_soc_dapm_update {
struct snd_soc_dapm_context {
enum snd_soc_bias_level bias_level;
- /* bit field */
- unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
- unsigned int suspend_bias_off:1; /* Use BIAS_OFF in suspend if the DAPM is idle */
+ bool idle_bias; /* Use BIAS_OFF instead of STANDBY when false */
- struct device *dev; /* from parent - for debug */
+ struct device *dev; /* from parent - for debug */ /* REMOVE ME */
struct snd_soc_component *component; /* parent component */
struct snd_soc_card *card; /* parent card */
@@ -660,6 +658,12 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
+struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm);
+struct snd_soc_card *snd_soc_dapm_to_card(struct snd_soc_dapm_context *dapm);
+struct snd_soc_component *snd_soc_dapm_to_component(struct snd_soc_dapm_context *dapm);
+
+bool snd_soc_dapm_get_idle_bias(struct snd_soc_dapm_context *dapm);
+void snd_soc_dapm_set_idle_bias(struct snd_soc_dapm_context *dapm, bool on);
/* dapm path setup */
int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1fffef311c41..ddc508ff7b9b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1120,6 +1120,11 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
return card && card->instantiated;
}
+static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
+{
+ return &card->dapm;
+}
+
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
struct snd_soc_pcm_runtime {
struct device *dev;