diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2020-08-31 14:00:44 +0800 |
---|---|---|
committer | Shengjiu Wang <shengjiu.wang@nxp.com> | 2020-08-31 18:08:17 +0800 |
commit | 07a298166a6473854adedb7341f351edb118cbe7 (patch) | |
tree | f5f4e6198f1cb02f8a957c96718bfd427db1be09 /sound/soc/fsl/imx-cdnhdmi.c | |
parent | b44c92d68ac76eb16084b36c1bebe560a61532db (diff) |
MLK-24611-3: ASoC: imx-cdnhdmi: Add hdmi jack
Add hdmi jack, which report the plug/unplug status.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Diffstat (limited to 'sound/soc/fsl/imx-cdnhdmi.c')
-rw-r--r-- | sound/soc/fsl/imx-cdnhdmi.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-cdnhdmi.c b/sound/soc/fsl/imx-cdnhdmi.c index 94e161747329..dd3e453a206f 100644 --- a/sound/soc/fsl/imx-cdnhdmi.c +++ b/sound/soc/fsl/imx-cdnhdmi.c @@ -31,6 +31,8 @@ struct imx_cdnhdmi_data { struct snd_soc_dai_link dai; struct snd_soc_card card; + struct snd_soc_jack hdmi_jack; + struct snd_soc_jack_pin hdmi_jack_pin; int protocol; u32 support_rates[SUPPORT_RATE_NUM]; u32 support_rates_num; @@ -359,6 +361,27 @@ static int imx_cdnhdmi_rx_rates_get(struct snd_kcontrol *kcontrol, return 0; } +static int imx_cdnhdmi_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_component *component = codec_dai->component; + struct imx_cdnhdmi_data *data = snd_soc_card_get_drvdata(card); + int ret; + + data->hdmi_jack_pin.pin = "HDMI Jack"; + data->hdmi_jack_pin.mask = SND_JACK_LINEOUT; + /* enable jack detection */ + ret = snd_soc_card_jack_new(card, "HDMI Jack", SND_JACK_LINEOUT, + &data->hdmi_jack, &data->hdmi_jack_pin, 1); + if (ret) { + dev_err(card->dev, "Can't new HDMI Jack %d\n", ret); + return ret; + } + + return hdmi_codec_set_jack_detect(component, &data->hdmi_jack); +}; + static struct snd_kcontrol_new imx_cdnhdmi_ctrls[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -482,6 +505,7 @@ static int imx_cdnhdmi_probe(struct platform_device *pdev) data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; + data->dai.init = imx_cdnhdmi_init; if (of_property_read_bool(pdev->dev.of_node, "hdmi-out")) { data->dai.playback_only = true; |