[alsa-devel] [PATCH 0/4] ASoC: prepare for Component conversion - step [2/6]
Hi Mark
One month passed. I will re-post prepare patches of "replace component" which is not yet accepted.
Because it is big patch-set, to avoid sending patch bomb, I will repost it as small amount of patch set. To reviewing from big picture, please check below patch-set.
Subject: Prepare to covert Codec/Platform into Component Date: Fri, 01 Sep 2017 14:18:11 +0900
I will continue to resend remainings if this small patch-sets were accepted. Total 6steps are needed
Kuninori Morimoto (4): ASoC: add snd_soc_component_read32 ASoC: add snd_soc_component_xxx_bias_level() ASoC: add snd_soc_component_cache_sync() ASoC: add snd_soc_dapm_kcontrol_component()
include/sound/soc.h | 78 ++++++++ sound/soc/soc-compress.c | 461 +++++++++++++++++++++++++++++++++++++++++++---- sound/soc/soc-core.c | 83 +++++---- sound/soc/soc-io.c | 14 ++ sound/soc/soc-pcm.c | 378 ++++++++++++++++++++++++++++++++++++-- 5 files changed, 929 insertions(+), 85 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current codec drivers are using snd_soc_read(). It will be replaced into snd_soc_component_read(), but these 2 are using different style. For example, it will be
- val = snd_soc_read(xxx, reg); + ret = snd_soc_component_read(xxx, reg, &val); + if (ret < 0) { + ... + }
To more smooth replace, let's add snd_soc_component_read32 which is copied from snd_soc_read()
- val = snd_soc_read(xxx, reg); + val = snd_soc_component_read32(xxx, reg);
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 2 ++ sound/soc/soc-io.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 6c80852..7475882 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1498,6 +1498,8 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec) /* component IO */ int snd_soc_component_read(struct snd_soc_component *component, unsigned int reg, unsigned int *val); +unsigned int snd_soc_component_read32(struct snd_soc_component *component, + unsigned int reg); int snd_soc_component_write(struct snd_soc_component *component, unsigned int reg, unsigned int val); int snd_soc_component_update_bits(struct snd_soc_component *component, diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 9b39390..20340ad 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c @@ -41,6 +41,20 @@ int snd_soc_component_read(struct snd_soc_component *component, } EXPORT_SYMBOL_GPL(snd_soc_component_read);
+unsigned int snd_soc_component_read32(struct snd_soc_component *component, + unsigned int reg) +{ + unsigned int val; + int ret; + + ret = snd_soc_component_read(component, reg, &val); + if (ret < 0) + return -1; + + return val; +} +EXPORT_SYMBOL_GPL(snd_soc_component_read32); + /** * snd_soc_component_write() - Write register value * @component: Component to write to
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_codec_xxx_bias_level() (= for Codec) will be removed soon. This patch Component version of it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 7475882..f69b13c 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1440,6 +1440,21 @@ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, }
/** + * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level + * @component: The COMPONENT for which to initialize the DAPM bias level + * @level: The DAPM level to initialize to + * + * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level(). + */ +static inline void +snd_soc_component_init_bias_level(struct snd_soc_component *component, + enum snd_soc_bias_level level) +{ + snd_soc_dapm_init_bias_level( + snd_soc_component_get_dapm(component), level); +} + +/** * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level * @codec: The CODEC for which to get the DAPM bias level * @@ -1452,6 +1467,19 @@ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( }
/** + * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level + * @component: The COMPONENT for which to get the DAPM bias level + * + * Returns: The current DAPM bias level of the COMPONENT. + */ +static inline enum snd_soc_bias_level +snd_soc_component_get_bias_level(struct snd_soc_component *component) +{ + return snd_soc_dapm_get_bias_level( + snd_soc_component_get_dapm(component)); +} + +/** * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level * @codec: The CODEC for which to set the level * @level: The level to set to @@ -1467,6 +1495,23 @@ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, }
/** + * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level + * @component: The COMPONENT for which to set the level + * @level: The level to set to + * + * Forces the COMPONENT bias level to a specific state. See + * snd_soc_dapm_force_bias_level(). + */ +static inline int +snd_soc_component_force_bias_level(struct snd_soc_component *component, + enum snd_soc_bias_level level) +{ + return snd_soc_dapm_force_bias_level( + snd_soc_component_get_dapm(component), + level); +} + +/** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol *
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_cache_sync() (= for Codec) will be removed soon. This patch Component version of it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h index f69b13c..4961f44 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1540,6 +1540,18 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec) return regcache_sync(codec->component.regmap); }
+/** + * snd_soc_component_cache_sync() - Sync the register cache with the hardware + * @component: COMPONENT to sync + * + * Note: This function will call regcache_sync() + */ +static inline int snd_soc_component_cache_sync( + struct snd_soc_component *component) +{ + return regcache_sync(component->regmap); +} + /* component IO */ int snd_soc_component_read(struct snd_soc_component *component, unsigned int reg, unsigned int *val);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
snd_soc_dapm_kcontrol_codec() (= for Codec) will be removed soon. This patch Component version of it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 4961f44..0668cbd 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1524,6 +1524,19 @@ static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec( return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol)); }
+/** + * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol + * @kcontrol: The kcontrol + * + * 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_kcontrol_component( + struct snd_kcontrol *kcontrol) +{ + return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol)); +} + /* codec IO */ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
participants (1)
-
Kuninori Morimoto