]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/stm: ltdc: add mask for lxcr register
authorYannick Fertre <yannick.fertre@foss.st.com>
Fri, 12 Jul 2024 13:14:23 +0000 (15:14 +0200)
committerRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Fri, 19 Jul 2024 09:34:50 +0000 (11:34 +0200)
The purpose of this mask is to simplify writing to the lxcr
register and not to forget any fields.

Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240712131423.98405-1-yannick.fertre@foss.st.com
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
drivers/gpu/drm/stm/ltdc.c

index 93ec0c8322b228aafbd05371aa8c87d5fcb926b0..425b7f56e0bea2066540a7fc23d331decf783736 100644 (file)
 #define LXCR_COLKEN    BIT(1)          /* Color Keying Enable */
 #define LXCR_CLUTEN    BIT(4)          /* Color Look-Up Table ENable */
 #define LXCR_HMEN      BIT(8)          /* Horizontal Mirroring ENable */
+#define LXCR_MASK (LXCR_LEN | LXCR_COLKEN | LXCR_CLUTEN | LXCR_HMEN)
 
 #define LXWHPCR_WHSTPOS        GENMASK(11, 0)  /* Window Horizontal StarT POSition */
 #define LXWHPCR_WHSPPOS        GENMASK(27, 16) /* Window Horizontal StoP POSition */
@@ -802,8 +803,7 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc,
 
        /* Disable all layers */
        for (layer_index = 0; layer_index < ldev->caps.nb_layers; layer_index++)
-               regmap_write_bits(ldev->regmap, LTDC_L1CR + layer_index * LAY_OFS,
-                                 LXCR_CLUTEN | LXCR_LEN, 0);
+               regmap_write_bits(ldev->regmap, LTDC_L1CR + layer_index * LAY_OFS, LXCR_MASK, 0);
 
        /* disable IRQ */
        regmap_clear_bits(ldev->regmap, LTDC_IER, IER_FUWIE | IER_FUEIE | IER_RRIE | IER_TERRIE);
@@ -1468,7 +1468,7 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane,
        if (newstate->rotation & DRM_MODE_REFLECT_X)
                val |= LXCR_HMEN;
 
-       regmap_write_bits(ldev->regmap, LTDC_L1CR + lofs, LXCR_LEN | LXCR_CLUTEN | LXCR_HMEN, val);
+       regmap_write_bits(ldev->regmap, LTDC_L1CR + lofs, LXCR_MASK, val);
 
        /* Commit shadow registers = update plane at next vblank */
        if (ldev->caps.plane_reg_shadow)
@@ -1506,7 +1506,7 @@ static void ltdc_plane_atomic_disable(struct drm_plane *plane,
        u32 lofs = plane->index * LAY_OFS;
 
        /* Disable layer */
-       regmap_write_bits(ldev->regmap, LTDC_L1CR + lofs, LXCR_LEN | LXCR_CLUTEN |  LXCR_HMEN, 0);
+       regmap_write_bits(ldev->regmap, LTDC_L1CR + lofs, LXCR_MASK, 0);
 
        /* Reset the layer transparency to hide any related background color */
        regmap_write_bits(ldev->regmap, LTDC_L1CACR + lofs, LXCACR_CONSTA, 0x00);