drm/bridge: dw-hdmi-i2s: add .get_eld support
authorJerome Brunet <jbrunet@baylibre.com>
Mon, 12 Aug 2019 12:50:16 +0000 (14:50 +0200)
committerNeil Armstrong <narmstrong@baylibre.com>
Wed, 14 Aug 2019 13:03:36 +0000 (15:03 +0200)
Provide the eld to the generic hdmi-codec driver.
This will let the driver enforce the maximum channel number and set the
channel allocation depending on the hdmi sink.

Cc: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190812125016.20169-1-jbrunet@baylibre.com
drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c

index 63b5756..cb07dc0 100644 (file)
@@ -14,6 +14,7 @@ struct dw_hdmi_audio_data {
 
 struct dw_hdmi_i2s_audio_data {
        struct dw_hdmi *hdmi;
+       u8 *eld;
 
        void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
        u8 (*read)(struct dw_hdmi *hdmi, int offset);
index b8ece9c..1d15cf9 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 
 #include <drm/bridge/dw_hdmi.h>
+#include <drm/drm_crtc.h>
 
 #include <sound/hdmi-codec.h>
 
@@ -121,6 +122,15 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
        dw_hdmi_audio_disable(hdmi);
 }
 
+static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf,
+                              size_t len)
+{
+       struct dw_hdmi_i2s_audio_data *audio = data;
+
+       memcpy(buf, audio->eld, min_t(size_t, MAX_ELD_BYTES, len));
+       return 0;
+}
+
 static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
                                  struct device_node *endpoint)
 {
@@ -144,6 +154,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
 static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
        .hw_params      = dw_hdmi_i2s_hw_params,
        .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
+       .get_eld        = dw_hdmi_i2s_get_eld,
        .get_dai_id     = dw_hdmi_i2s_get_dai_id,
 };
 
index 4e57b98..4044071 100644 (file)
@@ -2799,6 +2799,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
                struct dw_hdmi_i2s_audio_data audio;
 
                audio.hdmi      = hdmi;
+               audio.eld       = hdmi->connector.eld;
                audio.write     = hdmi_writeb;
                audio.read      = hdmi_readb;
                hdmi->enable_audio = dw_hdmi_i2s_audio_enable;