ASoC/arizona: Ensure pin searches use widget name prefix
Subsystems (9)
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 | 25 +++++ sound/soc/codecs/arizona.c | 13 ++- sound/soc/codecs/cs47l24.c | 2 +- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/codecs/wm8998.c | 2 +- sound/soc/soc-utils.c | 199 +++++++++++++++++++++++++++++++++++ 10 files changed, 254 insertions(+), 18 deletions(-)
Signature · 1 line
1.9.1
PATCH 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 | 25 +++++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+)
include/sound/soc.h +25 -0
@@ -1718,4 +1718,29 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)mutex_unlock (&dapm->card->dapm_mutex); } +extern int snd_soc_component_enable_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_enable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_disable_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_disable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_nc_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_nc_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); + +extern int snd_soc_component_get_pin_status (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_force_enable_pin ( +struct snd_soc_component *component, +const char *pin); +extern 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
Re: [PATCH 1/5] ASoC: core: Add component pin control functions
Quoted 59 lines · Richard Fitzgerald
It's often the case that a codec driver will need to control its own pins. However, if a
name_prefixhas been applied to this codec it must be included in the name passed to any of thesnd_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_componentinstead of a dapm context and automatically add the component'sname_prefixto 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.
Signed-off-by Richard Fitzgerald <[email protected]>--- include/sound/soc.h | 25 +++++++ sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+)include/sound/soc.h +15
-0@@ -1718,4 +1718,29 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)mutex_unlock (&dapm->card->dapm_mutex); } +extern int snd_soc_component_enable_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_enable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_disable_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_disable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_nc_pin (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_nc_pin_unlocked ( +struct snd_soc_component *component, +const char *pin);
include/sound/soc.h static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) · line 1745
Quoted 10 lines
include/sound/soc.h +10
-0+ +extern int snd_soc_component_get_pin_status (struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_force_enable_pin ( +struct snd_soc_component *component, +const char *pin); +extern int snd_soc_component_force_enable_pin_unlocked ( +struct snd_soc_component *component, +const char *pin); +
I don't believe we need these extern's C defaults to external linkage.
Thanks,
Charles
PATCH 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 | 13 ++++++++----- sound/soc/codecs/cs47l24.c | 2 +- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/codecs/wm8998.c | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-)
sound/soc/codecs/arizona.c +8 -5
@@ -256,7 +256,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 = &codec->component;struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);struct arizona *arizona = priv->arizona;int i;
@@ -264,21 +264,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 +1 -1
@@ -1138,7 +1138,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 (&codec->component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm5102.c +1 -1
@@ -1947,7 +1947,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 (&codec->component,"HAPTICS" ); priv->core.arizona->dapm = dapm;
sound/soc/codecs/wm5110.c +1 -1
@@ -2295,7 +2295,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 (&codec->component,"HAPTICS" );return 0 ;
sound/soc/codecs/wm8998.c +1 -1
@@ -1327,7 +1327,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 (&codec->component,"HAPTICS" );return 0 ; }
Signature · 1 line
1.9.1
Re: [PATCH 2/5] ASoC: arizona: Use component pin control functions
Quoted 22 lines · Richard Fitzgerald
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_prefixapplied to it.Replace the
snd_soc_dapm_x_pinfunctions with the equivalentsnd_soc_component_x_pinfunctions so that anyname_prefixwill be handled automatically.Signed-off-by Richard Fitzgerald <[email protected]>--- sound/soc/codecs/arizona.c | 13 ++++++++----- sound/soc/codecs/cs47l24.c | 2 +- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/codecs/wm8998.c | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-)sound/soc/codecs/arizona.c +0
-0
sound/soc/codecs/arizona.c int arizona_init_mono(struct snd_soc_codec *codec) · line 259
Quoted 5 lines
sound/soc/codecs/arizona.c +1
-1@@ -256,7 +256,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 = &codec->component;
We should probably use snd_soc_dapm_to_component(dapm); here.
Quoted 37 lines
sound/soc/codecs/arizona.c +7
-4struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);struct arizona *arizona = priv->arizona;int i;@@ -264,21 +264,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 +0
-0
sound/soc/codecs/cs47l24.c static int cs47l24_codec_probe(struct snd_soc_codec *codec) · line 1141
Quoted 5 lines
sound/soc/codecs/cs47l24.c +1
-1@@ -1138,7 +1138,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 (&codec->component,"HAPTICS" );
ditto for these calls as well.
Quoted 44 lines
sound/soc/codecs/cs47l24.c +0
-0return 0 ;sound/soc/codecs/wm5102.c +1
-1@@ -1947,7 +1947,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 (&codec->component,"HAPTICS" ); priv->core.arizona->dapm = dapm;sound/soc/codecs/wm5110.c +1
-1@@ -2295,7 +2295,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 (&codec->component,"HAPTICS" );return 0 ;sound/soc/codecs/wm8998.c +1
-1@@ -1327,7 +1327,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 (&codec->component,"HAPTICS" );return 0 ; }Signature · 1 line
1.9.1
Thanks,
Charles
PATCH 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
Mark Brown
maintainerApplied "regulator: arizona-micsupp: Use SoC component pin control functions" to the regulator tree
The patch
regulator: arizona-micsupp: Use SoC component pin control functions
has been applied to the regulator tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.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
98cf9965c09fc3fe6d8bd9760dba1dec53e387ccMon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Thu, 15 Dec 2016 14:43:49 +0000
Subject: [PATCH] regulator: arizona-micsupp: Use SoC component pin control
functions
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_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
2.11.0
PATCH 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
@@ -274,9 +274,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);
@@ -284,7 +285,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);
@@ -349,6 +350,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;
@@ -356,7 +358,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
Mark Brown
maintainerApplied "extcon: arizona: Use SoC component pin control functions" to the asoc tree
The patch
extcon: arizona: Use SoC 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
efd95c71f4892ad5d0d33099db25085763f4c6c3Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Tue, 29 Nov 2016 15:44:41 +0000
Subject: [PATCH] extcon: arizona: Use SoC component pin control functions
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_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
@@ -274,9 +274,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);
@@ -284,7 +285,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);
@@ -349,6 +350,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;
@@ -356,7 +358,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
2.10.2
PATCH 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
Re: [PATCH 5/5] Input: arizona-haptics - Use SoC component pin control functions
Hi Richard,
Quoted 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]>
If ASOC folks are fine with this then I am otto. Please merge with the rest of Arizona changes.
Thanks.
Signature · 1 line
Dmitry
Mark Brown
maintainerApplied "Input: arizona-haptics - Use SoC component pin control functions" to the asoc tree
In reply to Richard FitzgeraldThe patch
Input: arizona-haptics - Use SoC 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
931afc4114c59b8fe8386db9fcdfe69a1322cae6Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Tue, 29 Nov 2016 15:44:42 +0000
Subject: [PATCH] Input: arizona-haptics - Use SoC component pin control
functions
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_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
2.10.2