Commit 764aafdb authored by Shengjiu Wang's avatar Shengjiu Wang Committed by Mark Brown

ASoC: simple-card-utils: Support configure pin_name for asoc_simple_init_jack

Currently the pin_name is fixed in asoc_simple_init_jack, but some driver
may use a different pin_name. So add a new parameter in
asoc_simple_init_jack for configuring pin_name.

If this parameter is NULL, then the default pin_name is used.
Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1594822179-1849-2-git-send-email-shengjiu.wang@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a3f6bf8e
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include <sound/soc.h> #include <sound/soc.h>
#define asoc_simple_init_hp(card, sjack, prefix) \ #define asoc_simple_init_hp(card, sjack, prefix) \
asoc_simple_init_jack(card, sjack, 1, prefix) asoc_simple_init_jack(card, sjack, 1, prefix, NULL)
#define asoc_simple_init_mic(card, sjack, prefix) \ #define asoc_simple_init_mic(card, sjack, prefix) \
asoc_simple_init_jack(card, sjack, 0, prefix) asoc_simple_init_jack(card, sjack, 0, prefix, NULL)
struct asoc_simple_dai { struct asoc_simple_dai {
const char *name; const char *name;
...@@ -131,7 +131,7 @@ int asoc_simple_parse_pin_switches(struct snd_soc_card *card, ...@@ -131,7 +131,7 @@ int asoc_simple_parse_pin_switches(struct snd_soc_card *card,
int asoc_simple_init_jack(struct snd_soc_card *card, int asoc_simple_init_jack(struct snd_soc_card *card,
struct asoc_simple_jack *sjack, struct asoc_simple_jack *sjack,
int is_hp, char *prefix); int is_hp, char *prefix, char *pin);
int asoc_simple_init_priv(struct asoc_simple_priv *priv, int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct link_info *li); struct link_info *li);
......
...@@ -540,7 +540,8 @@ EXPORT_SYMBOL_GPL(asoc_simple_parse_pin_switches); ...@@ -540,7 +540,8 @@ EXPORT_SYMBOL_GPL(asoc_simple_parse_pin_switches);
int asoc_simple_init_jack(struct snd_soc_card *card, int asoc_simple_init_jack(struct snd_soc_card *card,
struct asoc_simple_jack *sjack, struct asoc_simple_jack *sjack,
int is_hp, char *prefix) int is_hp, char *prefix,
char *pin)
{ {
struct device *dev = card->dev; struct device *dev = card->dev;
enum of_gpio_flags flags; enum of_gpio_flags flags;
...@@ -557,12 +558,12 @@ int asoc_simple_init_jack(struct snd_soc_card *card, ...@@ -557,12 +558,12 @@ int asoc_simple_init_jack(struct snd_soc_card *card,
if (is_hp) { if (is_hp) {
snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix); snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix);
pin_name = "Headphones"; pin_name = pin ? pin : "Headphones";
gpio_name = "Headphone detection"; gpio_name = "Headphone detection";
mask = SND_JACK_HEADPHONE; mask = SND_JACK_HEADPHONE;
} else { } else {
snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix); snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix);
pin_name = "Mic Jack"; pin_name = pin ? pin : "Mic Jack";
gpio_name = "Mic detection"; gpio_name = "Mic detection";
mask = SND_JACK_MICROPHONE; mask = SND_JACK_MICROPHONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment