summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorXing Zheng <zhengxing@rock-chips.com>2018-04-21 21:46:57 +0800
committerXing Zheng <zhengxing@rock-chips.com>2018-04-25 09:38:35 +0800
commit8fcec454166eb30a1f232dd9d11ebdc229d6e850 (patch)
treebac5cc9cd81e5b821505c63a844f71bec2c10748 /sound
parent6530305c0ddf2ff8bc3ffddf84918275df024df4 (diff)
HACK-TO-REVERT: ASoC: simple-card: add support hp/mic detect for internal codec
This is a local patch, because our simple-card is too backward from upstream. This will take more time on the cherry-pick patch and verification. In order to speed up the progress, I put this local patch and please revert it after I merge the new patches of simple-card. Change-Id: If566cf66c69d3a4fccbffc423433e6b724a23c04 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index ce55ed74c619..974bfaa3f271 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -33,6 +33,7 @@ struct simple_card_data {
int gpio_hp_det_invert;
int gpio_mic_det;
int gpio_mic_det_invert;
+ bool codec_hp_det;
struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
};
@@ -137,6 +138,12 @@ static struct snd_soc_jack_gpio simple_card_mic_jack_gpio = {
.debounce_time = 150,
};
+struct snd_soc_jack *asoc_simple_card_get_hp_jack(void)
+{
+ return &simple_card_hp_jack;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_get_hp_jack);
+
static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
struct asoc_simple_dai *set)
{
@@ -210,6 +217,14 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
&simple_card_mic_jack_gpio);
}
+
+ if (priv->codec_hp_det)
+ snd_soc_card_jack_new(rtd->card, "Headphones",
+ SND_JACK_HEADPHONE,
+ &simple_card_hp_jack,
+ simple_card_hp_jack_pins,
+ ARRAY_SIZE(simple_card_hp_jack_pins));
+
return 0;
}
@@ -514,6 +529,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
if (priv->gpio_mic_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
+ priv->codec_hp_det = of_property_read_bool(node,
+ "simple-audio-card,codec-hp-det");
+
if (!priv->snd_card.name)
priv->snd_card.name = priv->snd_card.dai_link->name;
@@ -566,6 +584,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
priv->gpio_hp_det = -ENOENT;
priv->gpio_mic_det = -ENOENT;
+ priv->codec_hp_det = false;
+
/* Get room for the other properties */
priv->dai_props = devm_kzalloc(dev,
sizeof(*priv->dai_props) * num_links,