1 From e8dbad6d506b6fac992fdf74a7e3a66a38e554c3 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 27 Apr 2023 09:30:33 +0200
4 Subject: [PATCH] drm/vc4: txp: Add byte enable toggle bit
6 The MOPLET doesn't have the BYTE_ENABLE field to set, but the TXP and
7 MOP do, so let's add a boolean to control whether or not we need to set
10 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
12 drivers/gpu/drm/vc4/vc4_drv.h | 1 +
13 drivers/gpu/drm/vc4/vc4_txp.c | 6 +++++-
14 2 files changed, 6 insertions(+), 1 deletion(-)
16 --- a/drivers/gpu/drm/vc4/vc4_drv.h
17 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
18 @@ -563,6 +563,7 @@ struct vc4_crtc_data {
21 struct vc4_crtc_data base;
22 + unsigned int has_byte_enable:1;
25 extern const struct vc4_txp_data bcm2835_txp_data;
26 --- a/drivers/gpu/drm/vc4/vc4_txp.c
27 +++ b/drivers/gpu/drm/vc4/vc4_txp.c
28 @@ -291,6 +291,7 @@ static void vc4_txp_connector_atomic_com
29 struct drm_connector_state *conn_state = drm_atomic_get_new_connector_state(state,
31 struct vc4_txp *txp = connector_to_vc4_txp(conn);
32 + const struct vc4_txp_data *txp_data = txp->data;
33 struct drm_gem_dma_object *gem;
34 struct drm_display_mode *mode;
35 struct drm_framebuffer *fb;
36 @@ -313,9 +314,11 @@ static void vc4_txp_connector_atomic_com
39 ctrl = TXP_GO | TXP_EI |
40 - VC4_SET_FIELD(0xf, TXP_BYTE_ENABLE) |
41 VC4_SET_FIELD(txp_fmts[i], TXP_FORMAT);
43 + if (txp_data->has_byte_enable)
44 + ctrl |= VC4_SET_FIELD(0xf, TXP_BYTE_ENABLE);
46 if (fb->format->has_alpha)
47 ctrl |= TXP_ALPHA_ENABLE;
49 @@ -496,6 +499,7 @@ const struct vc4_txp_data bcm2835_txp_da
50 .hvs_available_channels = BIT(2),
53 + .has_byte_enable = true,
56 static int vc4_txp_bind(struct device *dev, struct device *master, void *data)