ASoC/arizona: Ensure pin searches use widget name prefix
Subsystems (9)
v2 cover ASoC/arizona: Ensure pin searches use widget name prefix
The name of a codec pin can have an optional prefix string, which is defined by the audio machine driver. The snd_soc_dapm_x_pin functions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.
This patch chain adds new helper functions that take a non-prefixed name for a specific ASoC component and internally add that component's prefix. The other patches update the arizona drivers to use these new functions.
Richard Fitzgerald (5):
ASoC: core: Add component pin control functions
ASoC: arizona: Use component pin control functions
regulator: arizona-micsupp: Use SoC component pin control functions
extcon: arizona: Use SoC component pin control functions
Input: arizona-haptics - Use SoC component pin control functions
drivers/extcon/extcon-arizona.c | 8 +- drivers/input/misc/arizona-haptics.c | 13 ++- drivers/regulator/arizona-micsupp.c | 6 +- include/sound/soc.h | 20 ++++ sound/soc/codecs/arizona.c | 12 ++- sound/soc/codecs/cs47l24.c | 3 +- sound/soc/codecs/wm5102.c | 3 +- sound/soc/codecs/wm5110.c | 3 +- sound/soc/codecs/wm8997.c | 3 +- sound/soc/codecs/wm8998.c | 3 +- sound/soc/soc-utils.c | 199 +++++++++++++++++++++++++++++++++++ 11 files changed, 255 insertions(+), 18 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/5 ASoC: core: Add component pin control functions
It's often the case that a codec driver will need to control its own pins. However, if a name_prefix has been applied to this codec it must be included in the name passed to any of the snd_soc_dapm_x_pin() functions.
The behaviour of the existing pin control functions is reasonable, since you may want to search for a fully-specified name within the scope of an entire card. This means that we can't apply the prefix in these functions because it will break card-scope searches.
Constructing a prefixed string "manually" in codec drivers leads to a lot of repetition of the same code.
To make this tidier in codec drivers this patch adds a new set of equivalent functions that take a struct snd_soc_component instead of a dapm context and automatically add the component's name_prefix to the given name. This makes it a simple change in codec drivers to be prefix-safe.
The new functions are not quite trivial enough to be inlines and the compiler won't be able to compile-away any part of them.
Although it looks somewhat inefficient to have to allocate a temporary buffer and combine strings, the current design of the widget list doesn't lend itself to a more optimized implementation - it's a single list of all widgets on a card and is searched linearly for a matching string. As pin state changes are generally low-frequency events it's unlikely to be a significant issue - at least not enough to rewrite the widget list handling just for this.
--- include/sound/soc.h | 20 +++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+)
include/sound/soc.h +20 -0
@@ -1718,4 +1718,24 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)mutex_unlock (&dapm->card->dapm_mutex); } +int snd_soc_component_enable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_enable_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_disable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_disable_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_nc_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_nc_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_get_pin_status (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_force_enable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_force_enable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +#endif
sound/soc/soc-utils.c +199 -0
205 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 2/5 ASoC: arizona: Use component pin control functions
In reply to Richard FitzgeraldWe need to modify the state of some of our own pins and are currently not taking account that the pin name may have a name_prefix applied to it.
Replace the snd_soc_dapm_x_pin functions with the equivalent snd_soc_component_x_pin functions so that any name_prefix will be handled automatically.
--- sound/soc/codecs/arizona.c | 12 ++++++++---- sound/soc/codecs/cs47l24.c | 3 ++- sound/soc/codecs/wm5102.c | 3 ++- sound/soc/codecs/wm5110.c | 3 ++- sound/soc/codecs/wm8997.c | 3 ++- sound/soc/codecs/wm8998.c | 3 ++- 6 files changed, 18 insertions(+), 9 deletions(-)
sound/soc/codecs/arizona.c +8 -4
@@ -257,6 +257,7 @@ int arizona_init_mono(struct snd_soc_codec *codec)int arizona_init_gpio (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);struct arizona *arizona = priv->arizona;int i;
@@ -264,21 +265,24 @@ int arizona_init_gpio(struct snd_soc_codec *codec)switch (arizona->type) {case WM5110 :case WM8280 : -snd_soc_dapm_disable_pin (dapm,"DRC2 Signal Activity" ); +snd_soc_component_disable_pin (component, +"DRC2 Signal Activity" );break ;default :break ; } -snd_soc_dapm_disable_pin (dapm,"DRC1 Signal Activity" ); +snd_soc_component_disable_pin (component,"DRC1 Signal Activity" );for (i =0 ; i <ARRAY_SIZE (arizona->pdata.gpio_defaults); i++) {switch (arizona->pdata.gpio_defaults[i] &ARIZONA_GPN_FN_MASK ) {case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT : -snd_soc_dapm_enable_pin (dapm,"DRC1 Signal Activity" ); +snd_soc_component_enable_pin (component, +"DRC1 Signal Activity" );break ;case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT : -snd_soc_dapm_enable_pin (dapm,"DRC2 Signal Activity" ); +snd_soc_component_enable_pin (component, +"DRC2 Signal Activity" );break ;default :break ;
sound/soc/codecs/cs47l24.c +2 -1
@@ -1115,6 +1115,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)static int cs47l24_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct cs47l24_priv *priv =snd_soc_codec_get_drvdata (codec);int ret;
@@ -1138,7 +1139,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)if (ret) goto err_adsp2_codec_probe; -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm5102.c +2 -1
@@ -1931,6 +1931,7 @@ static irqreturn_t wm5102_adsp2_irq(int irq, void *data)static int wm5102_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm5102_priv *priv =snd_soc_codec_get_drvdata (codec);int ret;
@@ -1947,7 +1948,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)arizona_init_gpio (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" ); priv->core.arizona->dapm = dapm;
sound/soc/codecs/wm5110.c +2 -1
@@ -2273,6 +2273,7 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data)static int wm5110_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm5110_priv *priv =snd_soc_codec_get_drvdata (codec);int i, ret;
@@ -2295,7 +2296,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)if (ret) goto err_adsp2_codec_probe; -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm8997.c +2 -1
@@ -1060,12 +1060,13 @@ static int wm8997_set_fll(struct snd_soc_codec *codec, int fll_id, int source,static int wm8997_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm8997_priv *priv =snd_soc_codec_get_drvdata (codec);arizona_init_spk (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" ); priv->core.arizona->dapm = dapm;
sound/soc/codecs/wm8998.c +2 -1
@@ -1320,6 +1320,7 @@ static int wm8998_codec_probe(struct snd_soc_codec *codec) {struct wm8998_priv *priv =snd_soc_codec_get_drvdata (codec);struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm); priv->core.arizona->dapm = dapm;
@@ -1327,7 +1328,7 @@ static int wm8998_codec_probe(struct snd_soc_codec *codec)arizona_init_gpio (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ; }
Signature · 1 line
1.9.1
PATCH v2 3/5 regulator: arizona-micsupp: Use SoC component pin control functions
In reply to Richard FitzgeraldThe name of a codec pin can have an optional prefix string, which is defined by the SoC machine driver. The snd_soc_dapm_x_pin functions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.
Switch to using the snd_soc_component_x_pin equivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.
--- drivers/regulator/arizona-micsupp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/arizona-micsupp.c +4 -2
@@ -45,6 +45,7 @@ static void arizona_micsupp_check_cp(struct work_struct *work)struct arizona_micsupp *micsupp = container_of(work, struct arizona_micsupp, check_cp_work);struct snd_soc_dapm_context *dapm = micsupp->arizona->dapm; +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct arizona *arizona = micsupp->arizona;struct regmap *regmap = arizona->regmap;unsigned int reg;
@@ -59,9 +60,10 @@ static void arizona_micsupp_check_cp(struct work_struct *work)if (dapm) {if ((reg & (ARIZONA_CPMIC_ENA |ARIZONA_CPMIC_BYPASS )) ==ARIZONA_CPMIC_ENA ) -snd_soc_dapm_force_enable_pin (dapm,"MICSUPP" ); +snd_soc_component_force_enable_pin (component, +"MICSUPP" );else -snd_soc_dapm_disable_pin (dapm,"MICSUPP" ); +snd_soc_component_disable_pin (component,"MICSUPP" );snd_soc_dapm_sync (dapm); }
Signature · 1 line
1.9.1
PATCH v2 4/5 extcon: arizona: Use SoC component pin control functions
In reply to Richard FitzgeraldThe name of a codec pin can have an optional prefix string, which is defined by the SoC machine driver. The snd_soc_dapm_x_pin functions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.
Switch to using the snd_soc_component_x_pin equivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.
--- drivers/extcon/extcon-arizona.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/extcon/extcon-arizona.c +5 -3
@@ -270,9 +270,10 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)struct arizona *arizona = info->arizona;const char *widget =arizona_extcon_get_micbias (info);struct snd_soc_dapm_context *dapm = arizona->dapm; +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);int ret; - ret =snd_soc_dapm_force_enable_pin (dapm, widget); + ret =snd_soc_component_force_enable_pin (component, widget);if (ret !=0 )dev_warn (arizona->dev,"Failed to enable %s: %d\n" , widget, ret);
@@ -280,7 +281,7 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)snd_soc_dapm_sync (dapm);if (!arizona->pdata.micd_force_micbias) { - ret =snd_soc_dapm_disable_pin (arizona->dapm, widget); + ret =snd_soc_component_disable_pin (component, widget);if (ret !=0 )dev_warn (arizona->dev,"Failed to disable %s: %d\n" , widget, ret);
@@ -345,6 +346,7 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)struct arizona *arizona = info->arizona;const char *widget =arizona_extcon_get_micbias (info);struct snd_soc_dapm_context *dapm = arizona->dapm; +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);bool change;int ret;
@@ -352,7 +354,7 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)ARIZONA_MICD_ENA ,0 , &change); - ret =snd_soc_dapm_disable_pin (dapm, widget); + ret =snd_soc_component_disable_pin (component, widget);if (ret !=0 ) dev_warn(arizona->dev, "Failed to disable %s: %d\n",
Signature · 1 line
1.9.1
PATCH v2 5/5 Input: arizona-haptics - Use SoC component pin control functions
In reply to Richard FitzgeraldThe name of a codec pin can have an optional prefix string, which is defined by the SoC machine driver. The snd_soc_dapm_x_pin functions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.
Switch to using the snd_soc_component_x_pin equivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.
--- drivers/input/misc/arizona-haptics.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/input/misc/arizona-haptics.c +9 -4
@@ -37,6 +37,8 @@ static void arizona_haptics_work(struct work_struct *work) struct arizona_haptics, work);struct arizona *arizona = haptics->arizona; +struct snd_soc_component *component = +snd_soc_dapm_to_component (arizona->dapm);int ret;if (!haptics->arizona->dapm) {
@@ -66,7 +68,7 @@ static void arizona_haptics_work(struct work_struct *work)return ; } - ret =snd_soc_dapm_enable_pin (arizona->dapm,"HAPTICS" ); + ret =snd_soc_component_enable_pin (component,"HAPTICS" );if (ret !=0 ) {dev_err (arizona->dev,"Failed to start HAPTICS: %d\n" , ret);
@@ -81,7 +83,7 @@ static void arizona_haptics_work(struct work_struct *work) } }else {/* This disable sequence will be a noop if already enabled */ - ret =snd_soc_dapm_disable_pin (arizona->dapm,"HAPTICS" ); + ret =snd_soc_component_disable_pin (component,"HAPTICS" );if (ret !=0 ) {dev_err (arizona->dev,"Failed to disable HAPTICS: %d\n" , ret);
@@ -140,11 +142,14 @@ static int arizona_haptics_play(struct input_dev *input, void *data,static void arizona_haptics_close (struct input_dev *input) {struct arizona_haptics *haptics =input_get_drvdata (input); +struct snd_soc_component *component;cancel_work_sync (&haptics->work); -if (haptics->arizona->dapm) -snd_soc_dapm_disable_pin (haptics->arizona->dapm,"HAPTICS" ); +if (haptics->arizona->dapm) { + component =snd_soc_dapm_to_component (haptics->arizona->dapm); +snd_soc_component_disable_pin (component,"HAPTICS" ); + } }static int arizona_haptics_probe (struct platform_device *pdev)
Signature · 1 line
1.9.1
Chanwoo Choi
maintainerRe: [PATCH V2 4/5] extcon: arizona: Use SoC component pin control functions
In reply to Richard FitzgeraldHi Richard,
I have no any objection for this patch.
But, the patch4 is dependent on patch1.
After finished the review of patch1,
I'll add acekd-by tag.
Best Regards,
Chanwoo Choi
Quoted 58 lines · Richard Fitzgerald
The name of a codec pin can have an optional prefix string, which is defined by the SoC machine driver. The
snd_soc_dapm_x_pinfunctions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.Switch to using the
snd_soc_component_x_pinequivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.Signed-off-by Richard Fitzgerald <[email protected]>--- drivers/extcon/extcon-arizona.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/extcon/extcon-arizona.c +5
-3@@ -270,9 +270,10 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)struct arizona *arizona = info->arizona;const char *widget =arizona_extcon_get_micbias (info);struct snd_soc_dapm_context *dapm = arizona->dapm; +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);int ret; - ret =snd_soc_dapm_force_enable_pin (dapm, widget); + ret =snd_soc_component_force_enable_pin (component, widget);if (ret !=0 )dev_warn (arizona->dev,"Failed to enable %s: %d\n" , widget, ret);@@ -280,7 +281,7 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)snd_soc_dapm_sync (dapm);if (!arizona->pdata.micd_force_micbias) { - ret =snd_soc_dapm_disable_pin (arizona->dapm, widget); + ret =snd_soc_component_disable_pin (component, widget);if (ret !=0 )dev_warn (arizona->dev,"Failed to disable %s: %d\n" , widget, ret);@@ -345,6 +346,7 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)struct arizona *arizona = info->arizona;const char *widget =arizona_extcon_get_micbias (info);struct snd_soc_dapm_context *dapm = arizona->dapm; +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);bool change;int ret;@@ -352,7 +354,7 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)ARIZONA_MICD_ENA ,0 , &change); - ret =snd_soc_dapm_disable_pin (dapm, widget); + ret =snd_soc_component_disable_pin (component, widget);if (ret !=0 ) dev_warn(arizona->dev, "Failed to disable %s: %d\n",
Re: [PATCH V2 5/5] Input: arizona-haptics - Use SoC component pin control functions
In reply to Richard FitzgeraldQuoted 11 lines · Richard Fitzgerald
The name of a codec pin can have an optional prefix string, which is defined by the SoC machine driver. The
snd_soc_dapm_x_pinfunctions take the fully-specified name including the prefix and so the existing code would fail to find the pin if the audio machine driver had added a prefix.Switch to using the
snd_soc_component_x_pinequivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.Signed-off-by Richard Fitzgerald <[email protected]>
Quoted 55 lines
--- drivers/input/misc/arizona-haptics.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/input/misc/arizona-haptics.c +9
-4@@ -37,6 +37,8 @@ static void arizona_haptics_work(struct work_struct *work) struct arizona_haptics, work);struct arizona *arizona = haptics->arizona; +struct snd_soc_component *component = +snd_soc_dapm_to_component (arizona->dapm);int ret;if (!haptics->arizona->dapm) {@@ -66,7 +68,7 @@ static void arizona_haptics_work(struct work_struct *work)return ; } - ret =snd_soc_dapm_enable_pin (arizona->dapm,"HAPTICS" ); + ret =snd_soc_component_enable_pin (component,"HAPTICS" );if (ret !=0 ) {dev_err (arizona->dev,"Failed to start HAPTICS: %d\n" , ret);@@ -81,7 +83,7 @@ static void arizona_haptics_work(struct work_struct *work) } }else {/* This disable sequence will be a noop if already enabled */ - ret =snd_soc_dapm_disable_pin (arizona->dapm,"HAPTICS" ); + ret =snd_soc_component_disable_pin (component,"HAPTICS" );if (ret !=0 ) {dev_err (arizona->dev,"Failed to disable HAPTICS: %d\n" , ret);@@ -140,11 +142,14 @@ static int arizona_haptics_play(struct input_dev *input, void *data,static void arizona_haptics_close (struct input_dev *input) {struct arizona_haptics *haptics =input_get_drvdata (input); +struct snd_soc_component *component;cancel_work_sync (&haptics->work); -if (haptics->arizona->dapm) -snd_soc_dapm_disable_pin (haptics->arizona->dapm,"HAPTICS" ); +if (haptics->arizona->dapm) { + component =snd_soc_dapm_to_component (haptics->arizona->dapm); +snd_soc_component_disable_pin (component,"HAPTICS" ); + } }static int arizona_haptics_probe (struct platform_device *pdev)Signature · 1 line
1.9.1
Signature · 1 line
Dmitry
Mark Brown
maintainerApplied "ASoC: core: Add component pin control functions" to the asoc tree
In reply to Richard FitzgeraldThe patch
ASoC: core: Add component pin control functions
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
1b4d9c22191583ef1fb7433417b2ceb2a608d887Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Tue, 29 Nov 2016 15:44:38 +0000
Subject: [PATCH] ASoC: core: Add component pin control functions
It's often the case that a codec driver will need to control its own pins. However, if a name_prefix has been applied to this codec it must be included in the name passed to any of the snd_soc_dapm_x_pin() functions.
The behaviour of the existing pin control functions is reasonable, since you may want to search for a fully-specified name within the scope of an entire card. This means that we can't apply the prefix in these functions because it will break card-scope searches.
Constructing a prefixed string "manually" in codec drivers leads to a lot of repetition of the same code.
To make this tidier in codec drivers this patch adds a new set of equivalent functions that take a struct snd_soc_component instead of a dapm context and automatically add the component's name_prefix to the given name. This makes it a simple change in codec drivers to be prefix-safe.
The new functions are not quite trivial enough to be inlines and the compiler won't be able to compile-away any part of them.
Although it looks somewhat inefficient to have to allocate a temporary buffer and combine strings, the current design of the widget list doesn't lend itself to a more optimized implementation - it's a single list of all widgets on a card and is searched linearly for a matching string. As pin state changes are generally low-frequency events it's unlikely to be a significant issue - at least not enough to rewrite the widget list handling just for this.
--- include/sound/soc.h | 20 +++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+)
include/sound/soc.h +20 -0
@@ -1697,4 +1697,24 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)mutex_unlock (&dapm->card->dapm_mutex); } +int snd_soc_component_enable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_enable_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_disable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_disable_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_nc_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_nc_pin_unlocked (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_get_pin_status (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_force_enable_pin (struct snd_soc_component *component, +const char *pin); +int snd_soc_component_force_enable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +#endif
sound/soc/soc-utils.c +199 -0
205 lines not on this page · raw message
Signature · 1 line
2.10.2
Mark Brown
maintainerRe: [PATCH V2 4/5] extcon: arizona: Use SoC component pin control functions
In reply to Chanwoo ChoiQuoted 3 lines · Chanwoo Choi
But, the patch4 is dependent on patch1.
After finished the review of patch1,
I'll add acekd-by tag.
Or you can just pull in that patch, whichever is easiest - I've created a tag:
The following changes since commit 1001354ca34179f3db924eb66672442a173147dc:
Linux 4.9-rc1 (2016-10-15 12:17:50 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/asoc-dapm-pin-component
for you to fetch changes up to 1b4d9c22191583ef1fb7433417b2ceb2a608d887:
ASoC: core: Add component pin control functions (2016-11-30 17:16:09 +0000)
----------------------------------------------------------------
ASoC: Pin enable controls for components
Provide an interface for devices to manipulate their own pins in DAPM without being affected by the renaming facilities provided by ASoC for machine drivers.
----------------------------------------------------------------
Richard Fitzgerald (1):
ASoC: core: Add component pin control functions
include/sound/soc.h | 20 +++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+)
Mark Brown
maintainerRe: [PATCH V2 5/5] Input: arizona-haptics - Use SoC component pin control functions
In reply to Dmitry TorokhovQuoted 7 lines · Dmitry Torokhov
Quoted 3 lines · Richard Fitzgerald
Switch to using the
snd_soc_component_x_pinequivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.Acked-by Dmitry Torokhov <[email protected]>
Do you want me to apply this or do you want to apply it in your tree? I've created a tag:
The following changes since commit 1001354ca34179f3db924eb66672442a173147dc:
Linux 4.9-rc1 (2016-10-15 12:17:50 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tags/asoc-dapm-pin-component
for you to fetch changes up to 1b4d9c22191583ef1fb7433417b2ceb2a608d887:
ASoC: core: Add component pin control functions (2016-11-30 17:16:09 +0000)
----------------------------------------------------------------
ASoC: Pin enable controls for components
Provide an interface for devices to manipulate their own pins in DAPM without being affected by the renaming facilities provided by ASoC for machine drivers.
----------------------------------------------------------------
Richard Fitzgerald (1):
ASoC: core: Add component pin control functions
include/sound/soc.h | 20 +++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+)
Mark Brown
maintainerApplied "ASoC: arizona: Use component pin control functions" to the asoc tree
In reply to Richard FitzgeraldThe patch
ASoC: arizona: Use component pin control functions
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
35f4403edb21d8b162beb3ab82b2087f4063f19dMon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Tue, 29 Nov 2016 15:44:39 +0000
Subject: [PATCH] ASoC: arizona: Use component pin control functions
We need to modify the state of some of our own pins and are currently not taking account that the pin name may have a name_prefix applied to it.
Replace the snd_soc_dapm_x_pin functions with the equivalent snd_soc_component_x_pin functions so that any name_prefix will be handled automatically.
--- sound/soc/codecs/arizona.c | 12 ++++++++---- sound/soc/codecs/cs47l24.c | 3 ++- sound/soc/codecs/wm5102.c | 3 ++- sound/soc/codecs/wm5110.c | 3 ++- sound/soc/codecs/wm8997.c | 3 ++- sound/soc/codecs/wm8998.c | 3 ++- 6 files changed, 18 insertions(+), 9 deletions(-)
sound/soc/codecs/arizona.c +8 -4
@@ -257,6 +257,7 @@ EXPORT_SYMBOL_GPL(arizona_init_mono);int arizona_init_gpio (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);struct arizona *arizona = priv->arizona;int i;
@@ -264,21 +265,24 @@ int arizona_init_gpio(struct snd_soc_codec *codec)switch (arizona->type) {case WM5110 :case WM8280 : -snd_soc_dapm_disable_pin (dapm,"DRC2 Signal Activity" ); +snd_soc_component_disable_pin (component, +"DRC2 Signal Activity" );break ;default :break ; } -snd_soc_dapm_disable_pin (dapm,"DRC1 Signal Activity" ); +snd_soc_component_disable_pin (component,"DRC1 Signal Activity" );for (i =0 ; i <ARRAY_SIZE (arizona->pdata.gpio_defaults); i++) {switch (arizona->pdata.gpio_defaults[i] &ARIZONA_GPN_FN_MASK ) {case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT : -snd_soc_dapm_enable_pin (dapm,"DRC1 Signal Activity" ); +snd_soc_component_enable_pin (component, +"DRC1 Signal Activity" );break ;case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT : -snd_soc_dapm_enable_pin (dapm,"DRC2 Signal Activity" ); +snd_soc_component_enable_pin (component, +"DRC2 Signal Activity" );break ;default :break ;
sound/soc/codecs/cs47l24.c +2 -1
@@ -1115,6 +1115,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)static int cs47l24_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct cs47l24_priv *priv =snd_soc_codec_get_drvdata (codec);int ret;
@@ -1138,7 +1139,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)if (ret) goto err_adsp2_codec_probe; -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm5102.c +2 -1
@@ -1931,6 +1931,7 @@ static irqreturn_t wm5102_adsp2_irq(int irq, void *data)static int wm5102_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm5102_priv *priv =snd_soc_codec_get_drvdata (codec);int ret;
@@ -1947,7 +1948,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)arizona_init_gpio (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" ); priv->core.arizona->dapm = dapm;
sound/soc/codecs/wm5110.c +2 -1
@@ -2273,6 +2273,7 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data)static int wm5110_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm5110_priv *priv =snd_soc_codec_get_drvdata (codec);int i, ret;
@@ -2295,7 +2296,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)if (ret) goto err_adsp2_codec_probe; -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm8997.c +2 -1
@@ -1060,12 +1060,13 @@ static struct snd_soc_dai_driver wm8997_dai[] = {static int wm8997_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm);struct wm8997_priv *priv =snd_soc_codec_get_drvdata (codec);arizona_init_spk (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" ); priv->core.arizona->dapm = dapm;
sound/soc/codecs/wm8998.c +2 -1
@@ -1320,6 +1320,7 @@ static int wm8998_codec_probe(struct snd_soc_codec *codec) {struct wm8998_priv *priv =snd_soc_codec_get_drvdata (codec);struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec); +struct snd_soc_component *component =snd_soc_dapm_to_component (dapm); priv->core.arizona->dapm = dapm;
@@ -1327,7 +1328,7 @@ static int wm8998_codec_probe(struct snd_soc_codec *codec)arizona_init_gpio (codec);arizona_init_notifiers (codec); -snd_soc_dapm_disable_pin (dapm,"HAPTICS" ); +snd_soc_component_disable_pin (component,"HAPTICS" );return 0 ; }
Signature · 1 line
2.10.2
Dmitry Torokhov
maintainerRe: [PATCH V2 5/5] Input: arizona-haptics - Use SoC component pin control functions
In reply to Mark BrownQuoted 10 lines · Mark Brown
Quoted 7 lines · Dmitry Torokhov
Quoted 3 lines · Richard Fitzgerald
Switch to using the
snd_soc_component_x_pinequivalent functions that take a specified SoC component and automatically add the name prefix to the provided pin name.Acked-by Dmitry Torokhov <[email protected]>Do you want me to apply this or do you want to apply it in your tree?
Please apply though your tree, I should not have anything conflicting in mine, and grouped on the same branch the changes make more sense.
Thanks!
Signature · 1 line
Dmitry
Re: [PATCH V2 4/5] extcon: arizona: Use SoC component pin control functions
In reply to Mark BrownDear Mark,
Quoted 8 lines · Mark Brown
Quoted 3 lines · Chanwoo Choi
But, the patch4 is dependent on patch1.
After finished the review of patch1,
I'll add acekd-by tag.Or you can just pull in that patch, whichever is easiest - I've created a tag:
I hope that you apply this patch on your tree with my Acked tag.
[snip]
Signature · 2 lines
Best Regards, Chanwoo Choi