ASoC: simple-card-utils: create jack inputs for aux_devs
v3 cover ASoC: simple-card-utils: create jack inputs for aux_devs
Add a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required.
Create a jack (for input-events) for jack devices in the auxiliary device list (aux_devs). A device which returns a valid value on get_jack_type counts as jack device; set_jack is required to add the jack to the device.
v1 -> v2: Auxiliary jack drivers return the correct snd_jack_type with
the function: get_jack_type.
- No devicetree changes in simple-card.
- soc-component: changed name to: get_jack_type.
- simple-jack-utils: updated algorithm to add jack devices.
A device which returns a valid value on get_jack_type counts as jack device
- ts3a227e: added devicetree property jack-type, added NULL check for jack.
v2 -> v3: ts3a227e: remove devictree property.
Astrid Rost (3):
[PATCH v3 1/3] ASoC: soc-component: add get_jack_type [PATCH v3 2/3] ASoC: simple-card-utils: create jack inputs for aux_devs [PATCH v3 3/3] ASoC: ts3a227e: add set_jack and get_jack_type
include/sound/simple_card_utils.h | 3 ++ include/sound/soc-component.h | 2 ++ sound/soc/codecs/ts3a227e.c | 20 ++++++++++- sound/soc/generic/simple-card-utils.c | 49 +++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 4 +++ sound/soc/soc-component.c | 20 +++++++++++ 6 files changed, 97 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
PATCH v3 1/3 ASoC: soc-component: add get_jack_type
Add function to return the jack type of snd_jack_types. This allows a generic card driver to add a jack with the specified type.
--- include/sound/soc-component.h | 2 ++ sound/soc/soc-component.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
include/sound/soc-component.h +2 -0
@@ -98,6 +98,7 @@ struct snd_soc_component_driver { int source, unsigned int freq_in, unsigned int freq_out);int (*set_jack)(struct snd_soc_component *component,struct snd_soc_jack *jack,void *data); +int (*get_jack_type)(struct snd_soc_component *component);/* DT */ int (*of_xlate_dai_name)(struct snd_soc_component *component,
@@ -384,6 +385,7 @@ int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id, unsigned int freq_out);int snd_soc_component_set_jack (struct snd_soc_component *component,struct snd_soc_jack *jack,void *data); +int snd_soc_component_get_jack_type (struct snd_soc_component *component);void snd_soc_component_seq_notifier (struct snd_soc_component *component,enum snd_soc_dapm_type type,int subseq);
sound/soc/soc-component.c +20 -0
@@ -256,6 +256,26 @@ int snd_soc_component_set_jack(struct snd_soc_component *component, }EXPORT_SYMBOL_GPL (snd_soc_component_set_jack); +/** +* snd_soc_component_get_jack_type +* @component: COMPONENTs +* +* Returns the jack type of the component +* This can either be the supported type or one read from +* devicetree with the property: jack-type. +*/ +int snd_soc_component_get_jack_type ( +struct snd_soc_component *component) +{ +int ret = -ENOTSUPP ; + +if (component->driver->get_jack_type) + ret = component->driver->get_jack_type (component); + +return soc_component_ret (component, ret); +} +EXPORT_SYMBOL_GPL (snd_soc_component_get_jack_type); +int snd_soc_component_module_get (struct snd_soc_component *component,void *mark,int upon_open) {
Signature · 1 line
2.30.2
PATCH v3 2/3 ASoC: simple-card-utils: create jack inputs for aux_devs
In reply to Astrid RostAdd a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required.
Create a jack (for input-events) for jack devices in the auxiliary device list (aux_devs). A device which returns a valid value on get_jack_type counts as jack device; set_jack is required to add the jack to the device.
--- include/sound/simple_card_utils.h | 3 ++ sound/soc/generic/simple-card-utils.c | 49 +++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 4 +++ 3 files changed, 56 insertions(+)
include/sound/simple_card_utils.h +3 -0
@@ -69,6 +69,7 @@ struct asoc_simple_priv { } *dai_props;struct asoc_simple_jack hp_jack;struct asoc_simple_jack mic_jack; +struct snd_soc_jack *aux_jacks;struct snd_soc_dai_link *dai_link;struct asoc_simple_dai *dais;struct snd_soc_dai_link_component *dlcs;
@@ -187,6 +188,8 @@ int asoc_simple_parse_pin_switches(struct snd_soc_card *card,int asoc_simple_init_jack (struct snd_soc_card *card,struct asoc_simple_jack *sjack,int is_hp,char *prefix,char *pin); +int asoc_simple_init_aux_jacks (struct asoc_simple_priv *priv, +char *prefix);int asoc_simple_init_priv (struct asoc_simple_priv *priv,struct link_info *li);int asoc_simple_remove (struct platform_device *pdev);
sound/soc/generic/simple-card-utils.c +49 -0
55 lines not on this page · raw message
sound/soc/generic/simple-card.c +4 -0
@@ -623,6 +623,10 @@ static int simple_soc_probe(struct snd_soc_card *card)if (ret <0 )return ret; + ret =asoc_simple_init_aux_jacks (priv,PREFIX ); +if (ret <0 ) +return ret; +return 0 ; }
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 10 lines · Astrid Rost
Add a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required.
Create a jack (for input-events) for jack devices in the auxiliary device list (
aux_devs). A device which returns a valid value onget_jack_typecounts as jack device;set_jackis required to add the jack to the device.
Quoted 6 lines
Signed-off-by Astrid Rost <[email protected]>--- include/sound/simple_card_utils.h | 3 ++ sound/soc/generic/simple-card-utils.c | 49 +++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 4 +++ 3 files changed, 56 insertions(+)
Given that everyone is really supposed to be using the audio-graph cards for new systems this should be hooked up there too.
Quoted 18 lines · Mark Brown
Quoted 10 lines · Astrid Rost
Add a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required.
Create a jack (for input-events) for jack devices in the auxiliary device list (
aux_devs). A device which returns a valid value onget_jack_typecounts as jack device;set_jackis required to add the jack to the device.Quoted 6 lines
Signed-off-by Astrid Rost <[email protected]>--- include/sound/simple_card_utils.h | 3 ++ sound/soc/generic/simple-card-utils.c | 49 +++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 4 +++ 3 files changed, 56 insertions(+)
Quoted 3 lines
Given that everyone is really supposed to be using the audio-graph cards for new systems this should be hooked up there too.
Hello,
Yes auxiliary devices are very useful, e.g. for GPIO. I can make a patch for audio-graph-card.c to add it.
Best Regards
Astrid
PATCH v3 3/3 ASoC: ts3a227e: add set_jack and get_jack_type
In reply to Astrid RostAdd set_jack and get_jack_type to allow simple-card-utils to add a jack for it.
--- sound/soc/codecs/ts3a227e.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
sound/soc/codecs/ts3a227e.c +19 -1
@@ -258,7 +258,25 @@ int ts3a227e_enable_jack_detect(struct snd_soc_component *component, }EXPORT_SYMBOL_GPL (ts3a227e_enable_jack_detect); -static struct snd_soc_component_driver ts3a227e_soc_driver; +static int ts3a227e_set_jack (struct snd_soc_component *component, +struct snd_soc_jack *jack,void *data) +{ +if (jack ==NULL ) +return -EINVAL ; + +return ts3a227e_enable_jack_detect (component, jack); +} + +static int ts3a227e_get_jack_type (struct snd_soc_component *component) +{ +return SND_JACK_HEADSET ; +} + +static const struct snd_soc_component_driver ts3a227e_soc_driver = { + .name ="ti,ts3a227e" , + .set_jack = ts3a227e_set_jack, + .get_jack_type = ts3a227e_get_jack_type, +};static const struct regmap_config ts3a227e_regmap_config = { .val_bits =8 ,
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 11 lines · Astrid Rost
Add a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required.
Create a jack (for input-events) for jack devices in the auxiliary device list (
aux_devs). A device which returns a valid value onget_jack_typecounts as jack device;set_jackis required to add the jack to the device.[...]
Applied to
broonie/sound.git for-next
Thanks!
[1/3] ASoC: soc-component: add get_jack_type
commit: df55122ba0955951a85ef3ffb19f0dcb0ad3ffbb
[2/3] ASoC: simple-card-utils: create jack inputs for aux_devs
commit: 9b271207ac83db362fac757d367923bde57dce86
[3/3] ASoC: ts3a227e: add set_jack and get_jack_type
commit: 087b9dda8658052a33031ef82a8d8ef77a7c94eaAll 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