1 From 72e5eb3d9511af2f056911d70c4d033d4fc674b2 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 17 Feb 2023 15:07:29 +0100
4 Subject: [PATCH] drm/vc4: hvs: Use switch statement to simplify
5 vc4_hvs_get_fifo_from_output
7 Since we'll support BCM2712 soon, let's move the logic behind
8 vc4_hvs_get_fifo_from_output() to a switch to extend it more easily.
10 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
12 drivers/gpu/drm/vc4/vc4_hvs.c | 80 +++++++++++++++++++----------------
13 1 file changed, 43 insertions(+), 37 deletions(-)
15 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
16 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
17 @@ -620,57 +620,63 @@ int vc4_hvs_get_fifo_from_output(struct
21 - if (vc4->gen == VC4_GEN_4)
27 - * NOTE: We should probably use drm_dev_enter()/drm_dev_exit()
28 - * here, but this function is only used during the DRM device
29 - * initialization, so we should be fine.
40 - reg = HVS_READ(SCALER_DISPECTRL);
41 - ret = FIELD_GET(SCALER_DISPECTRL_DSP2_MUX_MASK, reg);
48 - reg = HVS_READ(SCALER_DISPCTRL);
49 - ret = FIELD_GET(SCALER_DISPCTRL_DSP3_MUX_MASK, reg);
56 - reg = HVS_READ(SCALER_DISPEOLN);
57 - ret = FIELD_GET(SCALER_DISPEOLN_DSP4_MUX_MASK, reg);
62 + * NOTE: We should probably use
63 + * drm_dev_enter()/drm_dev_exit() here, but this
64 + * function is only used during the DRM device
65 + * initialization, so we should be fine.
76 + reg = HVS_READ(SCALER_DISPECTRL);
77 + ret = FIELD_GET(SCALER_DISPECTRL_DSP2_MUX_MASK, reg);
84 + reg = HVS_READ(SCALER_DISPCTRL);
85 + ret = FIELD_GET(SCALER_DISPCTRL_DSP3_MUX_MASK, reg);
92 + reg = HVS_READ(SCALER_DISPEOLN);
93 + ret = FIELD_GET(SCALER_DISPEOLN_DSP4_MUX_MASK, reg);
100 + reg = HVS_READ(SCALER_DISPDITHER);
101 + ret = FIELD_GET(SCALER_DISPDITHER_DSP5_MUX_MASK, reg);
109 - reg = HVS_READ(SCALER_DISPDITHER);
110 - ret = FIELD_GET(SCALER_DISPDITHER_DSP5_MUX_MASK, reg);
125 static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc,