mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 09:12:39 +00:00
2e715fb4fc
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
126 lines
2.7 KiB
Diff
126 lines
2.7 KiB
Diff
From 72e5eb3d9511af2f056911d70c4d033d4fc674b2 Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Fri, 17 Feb 2023 15:07:29 +0100
|
|
Subject: [PATCH] drm/vc4: hvs: Use switch statement to simplify
|
|
vc4_hvs_get_fifo_from_output
|
|
|
|
Since we'll support BCM2712 soon, let's move the logic behind
|
|
vc4_hvs_get_fifo_from_output() to a switch to extend it more easily.
|
|
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_hvs.c | 80 +++++++++++++++++++----------------
|
|
1 file changed, 43 insertions(+), 37 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
|
|
@@ -620,57 +620,63 @@ int vc4_hvs_get_fifo_from_output(struct
|
|
u32 reg;
|
|
int ret;
|
|
|
|
- if (vc4->gen == VC4_GEN_4)
|
|
+ switch (vc4->gen) {
|
|
+ case VC4_GEN_4:
|
|
return output;
|
|
|
|
- /*
|
|
- * NOTE: We should probably use drm_dev_enter()/drm_dev_exit()
|
|
- * here, but this function is only used during the DRM device
|
|
- * initialization, so we should be fine.
|
|
- */
|
|
-
|
|
- switch (output) {
|
|
- case 0:
|
|
- return 0;
|
|
-
|
|
- case 1:
|
|
- return 1;
|
|
-
|
|
- case 2:
|
|
- reg = HVS_READ(SCALER_DISPECTRL);
|
|
- ret = FIELD_GET(SCALER_DISPECTRL_DSP2_MUX_MASK, reg);
|
|
- if (ret == 0)
|
|
- return 2;
|
|
-
|
|
- return 0;
|
|
-
|
|
- case 3:
|
|
- reg = HVS_READ(SCALER_DISPCTRL);
|
|
- ret = FIELD_GET(SCALER_DISPCTRL_DSP3_MUX_MASK, reg);
|
|
- if (ret == 3)
|
|
- return -EPIPE;
|
|
-
|
|
- return ret;
|
|
-
|
|
- case 4:
|
|
- reg = HVS_READ(SCALER_DISPEOLN);
|
|
- ret = FIELD_GET(SCALER_DISPEOLN_DSP4_MUX_MASK, reg);
|
|
- if (ret == 3)
|
|
- return -EPIPE;
|
|
+ case VC4_GEN_5:
|
|
+ /*
|
|
+ * NOTE: We should probably use
|
|
+ * drm_dev_enter()/drm_dev_exit() here, but this
|
|
+ * function is only used during the DRM device
|
|
+ * initialization, so we should be fine.
|
|
+ */
|
|
+
|
|
+ switch (output) {
|
|
+ case 0:
|
|
+ return 0;
|
|
+
|
|
+ case 1:
|
|
+ return 1;
|
|
+
|
|
+ case 2:
|
|
+ reg = HVS_READ(SCALER_DISPECTRL);
|
|
+ ret = FIELD_GET(SCALER_DISPECTRL_DSP2_MUX_MASK, reg);
|
|
+ if (ret == 0)
|
|
+ return 2;
|
|
+
|
|
+ return 0;
|
|
+
|
|
+ case 3:
|
|
+ reg = HVS_READ(SCALER_DISPCTRL);
|
|
+ ret = FIELD_GET(SCALER_DISPCTRL_DSP3_MUX_MASK, reg);
|
|
+ if (ret == 3)
|
|
+ return -EPIPE;
|
|
+
|
|
+ return ret;
|
|
+
|
|
+ case 4:
|
|
+ reg = HVS_READ(SCALER_DISPEOLN);
|
|
+ ret = FIELD_GET(SCALER_DISPEOLN_DSP4_MUX_MASK, reg);
|
|
+ if (ret == 3)
|
|
+ return -EPIPE;
|
|
+
|
|
+ return ret;
|
|
+
|
|
+ case 5:
|
|
+ reg = HVS_READ(SCALER_DISPDITHER);
|
|
+ ret = FIELD_GET(SCALER_DISPDITHER_DSP5_MUX_MASK, reg);
|
|
+ if (ret == 3)
|
|
+ return -EPIPE;
|
|
|
|
- return ret;
|
|
+ return ret;
|
|
|
|
- case 5:
|
|
- reg = HVS_READ(SCALER_DISPDITHER);
|
|
- ret = FIELD_GET(SCALER_DISPDITHER_DSP5_MUX_MASK, reg);
|
|
- if (ret == 3)
|
|
+ default:
|
|
return -EPIPE;
|
|
-
|
|
- return ret;
|
|
-
|
|
- default:
|
|
- return -EPIPE;
|
|
+ }
|
|
}
|
|
+
|
|
+ return -EPIPE;
|
|
}
|
|
|
|
static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc,
|