mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-27 17:21:34 +00:00
105 lines
3.4 KiB
Diff
105 lines
3.4 KiB
Diff
From 86cad3dffc0c3a7216e208bb497b84a468e676cc Mon Sep 17 00:00:00 2001
|
|
From: Jonas Karlman <jonas@kwiboo.se>
|
|
Date: Sun, 16 Dec 2018 10:22:09 +0100
|
|
Subject: [PATCH 53/91] drm: dw-hdmi-i2s: add .get_eld callback for ALSA SoC
|
|
|
|
Add get_eld() callback and call hdmi_codec_eld_notify() when ELD has changed.
|
|
|
|
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
|
---
|
|
drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 +
|
|
.../gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 36 +++++++++++++++++++++-
|
|
2 files changed, 36 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
|
|
index 63b5756..69b8a97 100644
|
|
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
|
|
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
|
|
@@ -14,6 +14,7 @@ struct dw_hdmi_audio_data {
|
|
|
|
struct dw_hdmi_i2s_audio_data {
|
|
struct dw_hdmi *hdmi;
|
|
+ u8 eld[128];
|
|
|
|
void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
|
|
u8 (*read)(struct dw_hdmi *hdmi, int offset);
|
|
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
|
index 8f9c8a6..609ebad 100644
|
|
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
|
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
|
|
@@ -83,6 +83,32 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
|
|
hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0);
|
|
}
|
|
|
|
+static void dw_hdmi_i2s_update_eld(struct device *dev, u8 *eld)
|
|
+{
|
|
+ struct dw_hdmi_i2s_audio_data *audio = dev_get_platdata(dev);
|
|
+ struct platform_device *hcpdev = dev_get_drvdata(dev);
|
|
+
|
|
+ if (!audio || !hcpdev)
|
|
+ return;
|
|
+
|
|
+ if (!memcmp(audio->eld, eld, sizeof(audio->eld)))
|
|
+ return;
|
|
+
|
|
+ memcpy(audio->eld, eld, sizeof(audio->eld));
|
|
+
|
|
+ hdmi_codec_eld_notify(&hcpdev->dev);
|
|
+}
|
|
+
|
|
+static int dw_hdmi_i2s_get_eld(struct device *dev, void *data,
|
|
+ u8 *buf, size_t len)
|
|
+{
|
|
+ struct dw_hdmi_i2s_audio_data *audio = data;
|
|
+
|
|
+ memcpy(buf, audio->eld, min(sizeof(audio->eld), len));
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
|
|
struct device_node *endpoint)
|
|
{
|
|
@@ -106,16 +132,19 @@ 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,
|
|
};
|
|
|
|
static int snd_dw_hdmi_probe(struct platform_device *pdev)
|
|
{
|
|
- struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data;
|
|
+ struct dw_hdmi_i2s_audio_data *audio = dev_get_platdata(&pdev->dev);
|
|
struct platform_device_info pdevinfo;
|
|
struct hdmi_codec_pdata pdata;
|
|
struct platform_device *platform;
|
|
|
|
+ memset(audio->eld, 0, sizeof(audio->eld));
|
|
+
|
|
pdata.ops = &dw_hdmi_i2s_ops;
|
|
pdata.i2s = 1;
|
|
pdata.max_i2s_channels = 6;
|
|
@@ -135,13 +164,18 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev)
|
|
|
|
dev_set_drvdata(&pdev->dev, platform);
|
|
|
|
+ dw_hdmi_set_update_eld(audio->hdmi, dw_hdmi_i2s_update_eld);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
static int snd_dw_hdmi_remove(struct platform_device *pdev)
|
|
{
|
|
+ struct dw_hdmi_i2s_audio_data *audio = dev_get_platdata(&pdev->dev);
|
|
struct platform_device *platform = dev_get_drvdata(&pdev->dev);
|
|
|
|
+ dw_hdmi_set_update_eld(audio->hdmi, NULL);
|
|
+
|
|
platform_device_unregister(platform);
|
|
|
|
return 0;
|
|
--
|
|
2.7.4
|
|
|