Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: hdmi-codec: add .get_dai_id support

ALSA SoC needs to know connected DAI ID for probing.
It is not a big problem if device/driver was only for sound,
but getting DAI ID will be difficult if device includes both
Video/Sound, like HDMI.
To solve this issue, this patch adds new .get_dai_id callback
on hdmi_codec_ops

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
96203fb4 24069b58

+22
+9
include/sound/hdmi-codec.h
··· 18 18 #ifndef __HDMI_CODEC_H__ 19 19 #define __HDMI_CODEC_H__ 20 20 21 + #include <linux/of_graph.h> 21 22 #include <linux/hdmi.h> 22 23 #include <drm/drm_edid.h> 23 24 #include <sound/asoundef.h> 25 + #include <sound/soc.h> 24 26 #include <uapi/sound/asound.h> 25 27 26 28 /* ··· 89 87 */ 90 88 int (*get_eld)(struct device *dev, void *data, 91 89 uint8_t *buf, size_t len); 90 + 91 + /* 92 + * Getting DAI ID 93 + * Optional 94 + */ 95 + int (*get_dai_id)(struct snd_soc_component *comment, 96 + struct device_node *endpoint); 92 97 }; 93 98 94 99 /* HDMI codec initalization data */
+13
sound/soc/codecs/hdmi-codec.c
··· 719 719 .pcm_new = hdmi_codec_pcm_new, 720 720 }; 721 721 722 + static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, 723 + struct device_node *endpoint) 724 + { 725 + struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); 726 + int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ 727 + 728 + if (hcp->hcd.ops->get_dai_id) 729 + ret = hcp->hcd.ops->get_dai_id(component, endpoint); 730 + 731 + return ret; 732 + } 733 + 722 734 static struct snd_soc_codec_driver hdmi_codec = { 723 735 .component_driver = { 724 736 .controls = hdmi_controls, ··· 739 727 .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), 740 728 .dapm_routes = hdmi_routes, 741 729 .num_dapm_routes = ARRAY_SIZE(hdmi_routes), 730 + .of_xlate_dai_id = hdmi_of_xlate_dai_id, 742 731 }, 743 732 }; 744 733