* [PATCH] ASoC: simple-card: add "invert" property for detect GPIOs
@ 2014-11-01 3:22 Jianqun
2014-11-03 12:26 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Jianqun @ 2014-11-01 3:22 UTC (permalink / raw)
To: heiko, lgirdwood, broonie, perex, tiwai, Li.Xiubo, moinejf,
kuninori.morimoto.gx, jsarha, Guangyu.Chen, dgreid,
linux-rockchip, linux-kernel, alsa-devel
Cc: huangtao, cf, Jianqun
Since hardware may invert detect GPIO of headphone or mic, add one
property to support software invert.
Signed-off-by: Jianqun <jay.xu@rock-chips.com>
---
sound/soc/generic/simple-card.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index d1b7293..f1bb537 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -29,7 +29,9 @@ struct simple_card_data {
} *dai_props;
unsigned int mclk_fs;
int gpio_hp_det;
+ int gpio_hp_det_invert;
int gpio_mic_det;
+ int gpio_mic_det_invert;
struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
};
@@ -148,6 +150,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
simple_card_hp_jack_pins);
simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
+ simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
snd_soc_jack_add_gpios(&simple_card_hp_jack, 1,
&simple_card_hp_jack_gpio);
}
@@ -159,6 +162,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
ARRAY_SIZE(simple_card_mic_jack_pins),
simple_card_mic_jack_pins);
simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
+ simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
&simple_card_mic_jack_gpio);
}
@@ -381,6 +385,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
struct simple_card_data *priv)
{
struct device *dev = simple_priv_to_dev(priv);
+ enum of_gpio_flags flags;
u32 val;
int ret;
@@ -436,13 +441,15 @@ static int asoc_simple_card_parse_of(struct device_node *node,
return ret;
}
- priv->gpio_hp_det = of_get_named_gpio(node,
- "simple-audio-card,hp-det-gpio", 0);
+ priv->gpio_hp_det = of_get_named_gpio_flags(node,
+ "simple-audio-card,hp-det-gpio", 0, &flags);
+ priv->gpio_hp_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
if (priv->gpio_hp_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
- priv->gpio_mic_det = of_get_named_gpio(node,
- "simple-audio-card,mic-det-gpio", 0);
+ priv->gpio_mic_det = of_get_named_gpio_flags(node,
+ "simple-audio-card,mic-det-gpio", 0, &flags);
+ priv->gpio_mic_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
if (priv->gpio_mic_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: simple-card: add "invert" property for detect GPIOs
2014-11-01 3:22 [PATCH] ASoC: simple-card: add "invert" property for detect GPIOs Jianqun
@ 2014-11-03 12:26 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-11-03 12:26 UTC (permalink / raw)
To: Jianqun
Cc: heiko, lgirdwood, perex, tiwai, Li.Xiubo, moinejf,
kuninori.morimoto.gx, jsarha, Guangyu.Chen, dgreid,
linux-rockchip, linux-kernel, alsa-devel, huangtao, cf
[-- Attachment #1: Type: text/plain, Size: 183 bytes --]
On Sat, Nov 01, 2014 at 11:22:18AM +0800, Jianqun wrote:
> Since hardware may invert detect GPIO of headphone or mic, add one
> property to support software invert.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-03 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-01 3:22 [PATCH] ASoC: simple-card: add "invert" property for detect GPIOs Jianqun
2014-11-03 12:26 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).