mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 23:12:32 +00:00
1343acc8cd
Deleted (upstreamed): bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch [1] bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch [1] gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch [2] Manually rebased: bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch Manually reverted: generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=55b10b88ac8654fc2f31518aa349a2e643b37f18 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=958a8819d41420d7a74ed922a09cacc0ba3a4218 [3] https://lore.kernel.org/all/trinity-2a727d96-0335-4d03-8f30-e22a0e10112d-1643363480085@3c-app-gmx-bap33/ Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
110 lines
4.3 KiB
Diff
110 lines
4.3 KiB
Diff
From 7090c69d64c3871867e86adc5bf568d89608c965 Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Tue, 29 Jun 2021 09:53:52 +0200
|
|
Subject: [PATCH] drm/vc4: hdmi: Split the CEC disable / enable
|
|
functions in two
|
|
|
|
In order to ease further additions to the CEC enable and disable, let's
|
|
split the function into two functions, one to enable and the other to
|
|
disable.
|
|
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_hdmi.c | 75 ++++++++++++++++++++--------------
|
|
1 file changed, 45 insertions(+), 30 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
@@ -1756,7 +1756,7 @@ static irqreturn_t vc4_cec_irq_handler(i
|
|
return ret;
|
|
}
|
|
|
|
-static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
|
+static int vc4_hdmi_cec_enable(struct cec_adapter *adap)
|
|
{
|
|
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|
|
/* clock period in microseconds */
|
|
@@ -1775,38 +1775,53 @@ static int vc4_hdmi_cec_adap_enable(stru
|
|
val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) |
|
|
((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT);
|
|
|
|
- if (enable) {
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
|
|
- VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_5, val);
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_2,
|
|
- ((1500 / usecs) << VC4_HDMI_CEC_CNT_TO_1500_US_SHIFT) |
|
|
- ((1300 / usecs) << VC4_HDMI_CEC_CNT_TO_1300_US_SHIFT) |
|
|
- ((800 / usecs) << VC4_HDMI_CEC_CNT_TO_800_US_SHIFT) |
|
|
- ((600 / usecs) << VC4_HDMI_CEC_CNT_TO_600_US_SHIFT) |
|
|
- ((400 / usecs) << VC4_HDMI_CEC_CNT_TO_400_US_SHIFT));
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_3,
|
|
- ((2750 / usecs) << VC4_HDMI_CEC_CNT_TO_2750_US_SHIFT) |
|
|
- ((2400 / usecs) << VC4_HDMI_CEC_CNT_TO_2400_US_SHIFT) |
|
|
- ((2050 / usecs) << VC4_HDMI_CEC_CNT_TO_2050_US_SHIFT) |
|
|
- ((1700 / usecs) << VC4_HDMI_CEC_CNT_TO_1700_US_SHIFT));
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_4,
|
|
- ((4300 / usecs) << VC4_HDMI_CEC_CNT_TO_4300_US_SHIFT) |
|
|
- ((3900 / usecs) << VC4_HDMI_CEC_CNT_TO_3900_US_SHIFT) |
|
|
- ((3600 / usecs) << VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT) |
|
|
- ((3500 / usecs) << VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT));
|
|
-
|
|
- if (!vc4_hdmi->variant->external_irq_controller)
|
|
- HDMI_WRITE(HDMI_CEC_CPU_MASK_CLEAR, VC4_HDMI_CPU_CEC);
|
|
- } else {
|
|
- if (!vc4_hdmi->variant->external_irq_controller)
|
|
- HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC);
|
|
- HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
|
|
- VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
|
- }
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
|
|
+ VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_5, val);
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_2,
|
|
+ ((1500 / usecs) << VC4_HDMI_CEC_CNT_TO_1500_US_SHIFT) |
|
|
+ ((1300 / usecs) << VC4_HDMI_CEC_CNT_TO_1300_US_SHIFT) |
|
|
+ ((800 / usecs) << VC4_HDMI_CEC_CNT_TO_800_US_SHIFT) |
|
|
+ ((600 / usecs) << VC4_HDMI_CEC_CNT_TO_600_US_SHIFT) |
|
|
+ ((400 / usecs) << VC4_HDMI_CEC_CNT_TO_400_US_SHIFT));
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_3,
|
|
+ ((2750 / usecs) << VC4_HDMI_CEC_CNT_TO_2750_US_SHIFT) |
|
|
+ ((2400 / usecs) << VC4_HDMI_CEC_CNT_TO_2400_US_SHIFT) |
|
|
+ ((2050 / usecs) << VC4_HDMI_CEC_CNT_TO_2050_US_SHIFT) |
|
|
+ ((1700 / usecs) << VC4_HDMI_CEC_CNT_TO_1700_US_SHIFT));
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_4,
|
|
+ ((4300 / usecs) << VC4_HDMI_CEC_CNT_TO_4300_US_SHIFT) |
|
|
+ ((3900 / usecs) << VC4_HDMI_CEC_CNT_TO_3900_US_SHIFT) |
|
|
+ ((3600 / usecs) << VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT) |
|
|
+ ((3500 / usecs) << VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT));
|
|
+
|
|
+ if (!vc4_hdmi->variant->external_irq_controller)
|
|
+ HDMI_WRITE(HDMI_CEC_CPU_MASK_CLEAR, VC4_HDMI_CPU_CEC);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
+static int vc4_hdmi_cec_disable(struct cec_adapter *adap)
|
|
+{
|
|
+ struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|
|
+
|
|
+ if (!vc4_hdmi->variant->external_irq_controller)
|
|
+ HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC);
|
|
+
|
|
+ HDMI_WRITE(HDMI_CEC_CNTRL_5, HDMI_READ(HDMI_CEC_CNTRL_5) |
|
|
+ VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
|
+{
|
|
+ if (enable)
|
|
+ return vc4_hdmi_cec_enable(adap);
|
|
+ else
|
|
+ return vc4_hdmi_cec_disable(adap);
|
|
+}
|
|
+
|
|
static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
|
|
{
|
|
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|