aboutsummaryrefslogtreecommitdiffstats
path: root/testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch
diff options
context:
space:
mode:
authorHe Yangxuan <yangxuan8282@gmail.com>2018-11-16 23:09:10 +0800
committerNatanael Copa <ncopa@alpinelinux.org>2018-11-26 15:26:48 +0000
commit8dc0e43d5a410a6f173c14caaa625adaf45f11f4 (patch)
tree8818259554accdf24310ae8aef8a0ed4a06427d5 /testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch
parent9a88176c5408adb5321fa11300cb63e4dbea80ed (diff)
downloadaports-8dc0e43d5a410a6f173c14caaa625adaf45f11f4.tar.bz2
aports-8dc0e43d5a410a6f173c14caaa625adaf45f11f4.tar.xz
testing/linux-amlogic: new aport
This kernel package add support for Amlogic S9xxx device. Supported devices include many android box and some SBC like Odroid C2, Khadas Vim, Nanopi K2. This package based on mainline kernel, and apply some patches from mainline amlogic developer.
Diffstat (limited to 'testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch')
-rw-r--r--testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch b/testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch
new file mode 100644
index 0000000000..fbff6c8d89
--- /dev/null
+++ b/testing/linux-amlogic/0018-drm-bridge-dw-hdmi-Use-AUTO-CTS-setup-mode-when-non-.patch
@@ -0,0 +1,75 @@
+From e282ad866be628951a95d297207c9a5580f4101d Mon Sep 17 00:00:00 2001
+From: Neil Armstrong <narmstrong@baylibre.com>
+Date: Mon, 2 Jul 2018 12:21:55 +0200
+Subject: [PATCH] drm: bridge: dw-hdmi: Use AUTO CTS setup mode when non-AHB
+ audio
+
+Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
+---
+ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 41 ++++++++++++++++++++-----------
+ 1 file changed, 26 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+index 3c136f2b..a68ffbb 100644
+--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+@@ -430,8 +430,12 @@ static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts,
+ /* nshift factor = 0 */
+ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3);
+
+- hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
+- HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
++ /* Use Auto CTS mode with CTS is unknown */
++ if (cts)
++ hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
++ HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
++ else
++ hdmi_writeb(hdmi, 0, HDMI_AUD_CTS3);
+ hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2);
+ hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
+
+@@ -501,24 +505,31 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
+ {
+ unsigned long ftdms = pixel_clk;
+ unsigned int n, cts;
++ u8 config3;
+ u64 tmp;
+
+ n = hdmi_compute_n(sample_rate, pixel_clk);
+
+- /*
+- * Compute the CTS value from the N value. Note that CTS and N
+- * can be up to 20 bits in total, so we need 64-bit math. Also
+- * note that our TDMS clock is not fully accurate; it is accurate
+- * to kHz. This can introduce an unnecessary remainder in the
+- * calculation below, so we don't try to warn about that.
+- */
+- tmp = (u64)ftdms * n;
+- do_div(tmp, 128 * sample_rate);
+- cts = tmp;
++ config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID);
+
+- dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n",
+- __func__, sample_rate, ftdms / 1000000, (ftdms / 1000) % 1000,
+- n, cts);
++ if (config3 & HDMI_CONFIG3_AHBAUDDMA) {
++ /*
++ * Compute the CTS value from the N value. Note that CTS and N
++ * can be up to 20 bits in total, so we need 64-bit math. Also
++ * note that our TDMS clock is not fully accurate; it is
++ * accurate to kHz. This can introduce an unnecessary remainder
++ * in the calculation below, so we don't try to warn about that.
++ */
++ tmp = (u64)ftdms * n;
++ do_div(tmp, 128 * sample_rate);
++ cts = tmp;
++
++ dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n",
++ __func__, sample_rate,
++ ftdms / 1000000, (ftdms / 1000) % 1000,
++ n, cts);
++ } else
++ cts = 0;
+
+ spin_lock_irq(&hdmi->audio_lock);
+ hdmi->audio_n = n;