From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:34:08
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(-)
--
1.9.1
From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:33:13
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
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(-)
@@ -256,7 +256,7 @@ int arizona_init_mono(struct snd_soc_codec *codec)intarizona_init_gpio(structsnd_soc_codec*codec){-structsnd_soc_dapm_context*dapm=snd_soc_codec_get_dapm(codec);+structsnd_soc_component*component=&codec->component;structarizona_priv*priv=snd_soc_codec_get_drvdata(codec);structarizona*arizona=priv->arizona;inti;
@@ -264,21 +264,24 @@ int arizona_init_gpio(struct snd_soc_codec *codec)switch(arizona->type){caseWM5110:caseWM8280:-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){caseARIZONA_GP_FN_DRC1_SIGNAL_DETECT:-snd_soc_dapm_enable_pin(dapm,"DRC1 Signal Activity");+snd_soc_component_enable_pin(component,+"DRC1 Signal Activity");break;caseARIZONA_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;
From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:33:29
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
drivers/extcon/extcon-arizona.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:33:37
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
drivers/regulator/arizona-micsupp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:33:49
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
include/sound/soc.h | 25 +++++++
sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 224 insertions(+)
From: Richard Fitzgerald <hidden> Date: 2016-11-28 17:33:59
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
drivers/input/misc/arizona-haptics.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
@@ -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);
Hi Richard,
On Mon, Nov 28, 2016 at 05:32:30PM +0000, Richard Fitzgerald wrote:
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.
Signed-off-by: Richard Fitzgerald <redacted>
If ASOC folks are fine with this then I am otto. Please merge with the rest of
Arizona changes.
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks.
--
Dmitry
From: Charles Keepax <hidden> Date: 2016-11-29 09:22:38
On Mon, Nov 28, 2016 at 05:32:26PM +0000, Richard Fitzgerald wrote:
quoted hunk
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
include/sound/soc.h | 25 +++++++
sound/soc/soc-utils.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 224 insertions(+)
From: Charles Keepax <hidden> Date: 2016-11-29 09:24:39
On Mon, Nov 28, 2016 at 05:32:27PM +0000, Richard Fitzgerald wrote:
quoted hunk
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.
Signed-off-by: Richard Fitzgerald <redacted>
---
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(-)
@@ -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;
From: Mark Brown <broonie@kernel.org> Date: 2016-12-01 21:46:19
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
From efd95c71f4892ad5d0d33099db25085763f4c6c3 Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <redacted>
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.
Signed-off-by: Richard Fitzgerald <redacted>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/extcon/extcon-arizona.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Mark Brown <broonie@kernel.org> Date: 2016-12-01 21:48:34
The 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
From 931afc4114c59b8fe8386db9fcdfe69a1322cae6 Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <redacted>
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.
Signed-off-by: Richard Fitzgerald <redacted>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/input/misc/arizona-haptics.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
@@ -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);
From: Mark Brown <broonie@kernel.org> Date: 2016-12-15 22:06:50
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
From 98cf9965c09fc3fe6d8bd9760dba1dec53e387cc Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <redacted>
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.
Signed-off-by: Richard Fitzgerald <redacted>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/arizona-micsupp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)