diff options
author | Mihai Serban <mihai.serban@nxp.com> | 2017-02-15 18:29:53 +0200 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | b1feb8be96a0b9de3348859db9091105a4066baf (patch) | |
tree | 555c3a4b0814b201332fbd025bf87988c2d04a98 /sound | |
parent | 29f5dc8d687aa9fb3a59c2b8b46a2dfb27a639c5 (diff) |
MLK-13799: ASoC: fsl: Add ASoC generic hdmi audio codec support
Use the new ASoC hdmi-codec infrastructure.
Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_hdmi.c | 43 | ||||
-rw-r--r-- | sound/soc/fsl/imx-hdmi.c | 2 |
2 files changed, 37 insertions, 8 deletions
diff --git a/sound/soc/fsl/fsl_hdmi.c b/sound/soc/fsl/fsl_hdmi.c index 4f2ac274b85c..0a0fafc360c9 100644 --- a/sound/soc/fsl/fsl_hdmi.c +++ b/sound/soc/fsl/fsl_hdmi.c @@ -34,6 +34,7 @@ #include <sound/pcm.h> #include <sound/soc.h> #include <sound/asoundef.h> +#include <sound/hdmi-codec.h> #include <video/mxc_hdmi.h> @@ -63,15 +64,15 @@ static void dumpregs(struct snd_soc_dai *dai) (hdmi_readb(HDMI_AUD_N2) << 8) | hdmi_readb(HDMI_AUD_N1); - dev_debug(dai->dev, "HDMI_PHY_CONF0 0x%02x\n", + dev_dbg(dai->dev, "HDMI_PHY_CONF0 0x%02x\n", hdmi_readb(HDMI_PHY_CONF0)); - dev_debug(dai->dev, "HDMI_MC_CLKDIS 0x%02x\n", + dev_dbg(dai->dev, "HDMI_MC_CLKDIS 0x%02x\n", hdmi_readb(HDMI_MC_CLKDIS)); - dev_debug(dai->dev, "HDMI_AUD_N[1-3] 0x%06x (%d)\n", + dev_dbg(dai->dev, "HDMI_AUD_N[1-3] 0x%06x (%d)\n", n, n); - dev_debug(dai->dev, "HDMI_AUD_CTS[1-3] 0x%06x (%d)\n", + dev_dbg(dai->dev, "HDMI_AUD_CTS[1-3] 0x%06x (%d)\n", cts, cts); - dev_debug(dai->dev, "HDMI_FC_AUDSCONF 0x%02x\n", + dev_dbg(dai->dev, "HDMI_FC_AUDSCONF 0x%02x\n", hdmi_readb(HDMI_FC_AUDSCONF)); } #else @@ -600,6 +601,33 @@ static const struct snd_soc_component_driver fsl_hdmi_component = { .name = "fsl-hdmi", }; +/* HDMI audio codec callbacks */ +static int fsl_hdmi_audio_hw_params(struct device *dev, void *data, + struct hdmi_codec_daifmt *fmt, + struct hdmi_codec_params *hparms) +{ + dev_dbg(dev, "[%s]: %u Hz, %d bit, %d channels\n", __func__, + hparms->sample_rate, hparms->sample_width, hparms->cea.channels); + + return 0; +} + +static void fsl_hdmi_audio_shutdown(struct device *dev, void *data) +{ + dev_dbg(dev, "[%s]\n", __func__); +} + +static const struct hdmi_codec_ops fsl_hdmi_audio_codec_ops = { + .hw_params = fsl_hdmi_audio_hw_params, + .audio_shutdown = fsl_hdmi_audio_shutdown, +}; + +static struct hdmi_codec_pdata codec_data = { + .ops = &fsl_hdmi_audio_codec_ops, + .i2s = 1, + .max_i2s_channels = 8, +}; + static int fsl_hdmi_dai_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -654,8 +682,9 @@ static int fsl_hdmi_dai_probe(struct platform_device *pdev) return ret; } - hdmi_data->codec_dev = platform_device_register_simple( - "hdmi-audio-codec", -1, NULL, 0); + hdmi_data->codec_dev = platform_device_register_data(&pdev->dev, + HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_NONE, + &codec_data, sizeof(codec_data)); if (IS_ERR(hdmi_data->codec_dev)) { dev_err(&pdev->dev, "failed to register HDMI audio codec\n"); ret = PTR_ERR(hdmi_data->codec_dev); diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c index a66ea0d6355e..e99a1ed81956 100644 --- a/sound/soc/fsl/imx-hdmi.c +++ b/sound/soc/fsl/imx-hdmi.c @@ -26,7 +26,7 @@ static struct snd_soc_dai_link imx_hdmi_dai_link = { .name = "i.MX HDMI Audio Tx", .stream_name = "i.MX HDMI Audio Tx", - .codec_dai_name = "hdmi-hifi", + .codec_dai_name = "hdmi-hifi.0", .codec_name = "hdmi-audio-codec", .platform_name = "imx-hdmi-audio", }; |