mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
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>
This commit is contained in:
@@ -35,4 +35,6 @@ struct asoc_simple_card_info {
|
||||
struct asoc_simple_dai codec_dai;
|
||||
};
|
||||
|
||||
struct snd_soc_jack *asoc_simple_card_get_hp_jack(void);
|
||||
|
||||
#endif /* __SIMPLE_CARD_H */
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user