From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Marek Vasut <marex@denx.de>, kernel@pengutronix.de, linux-imx@nxp.com
Subject: [PATCH 03/21] drm: mxsfb: Use BIT() macro to define register bitfields
Date: Mon, 9 Mar 2020 21:51:58 +0200 [thread overview]
Message-ID: <20200309195216.31042-4-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20200309195216.31042-1-laurent.pinchart@ideasonboard.com>
Using BIT() is preferred over manual shifts as it's more readable,
handles the 1 << 31 case properly, and avoids other mistakes as shown by
the DEBUG0_HSYNC and DEBUG0_VSYNC bits (that are currently unused). Use
it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/gpu/drm/mxsfb/mxsfb_regs.h | 56 +++++++++++++++---------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_regs.h b/drivers/gpu/drm/mxsfb/mxsfb_regs.h
index 932d7ea08fd5..713d8f830135 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_regs.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_regs.h
@@ -28,51 +28,51 @@
#define LCDC_V4_DEBUG0 0x1d0
#define LCDC_V3_DEBUG0 0x1f0
-#define CTRL_SFTRST (1 << 31)
-#define CTRL_CLKGATE (1 << 30)
-#define CTRL_BYPASS_COUNT (1 << 19)
-#define CTRL_VSYNC_MODE (1 << 18)
-#define CTRL_DOTCLK_MODE (1 << 17)
-#define CTRL_DATA_SELECT (1 << 16)
+#define CTRL_SFTRST BIT(31)
+#define CTRL_CLKGATE BIT(30)
+#define CTRL_BYPASS_COUNT BIT(19)
+#define CTRL_VSYNC_MODE BIT(18)
+#define CTRL_DOTCLK_MODE BIT(17)
+#define CTRL_DATA_SELECT BIT(16)
#define CTRL_SET_BUS_WIDTH(x) (((x) & 0x3) << 10)
#define CTRL_GET_BUS_WIDTH(x) (((x) >> 10) & 0x3)
#define CTRL_BUS_WIDTH_MASK (0x3 << 10)
#define CTRL_SET_WORD_LENGTH(x) (((x) & 0x3) << 8)
#define CTRL_GET_WORD_LENGTH(x) (((x) >> 8) & 0x3)
-#define CTRL_MASTER (1 << 5)
-#define CTRL_DF16 (1 << 3)
-#define CTRL_DF18 (1 << 2)
-#define CTRL_DF24 (1 << 1)
-#define CTRL_RUN (1 << 0)
+#define CTRL_MASTER BIT(5)
+#define CTRL_DF16 BIT(3)
+#define CTRL_DF18 BIT(2)
+#define CTRL_DF24 BIT(1)
+#define CTRL_RUN BIT(0)
-#define CTRL1_FIFO_CLEAR (1 << 21)
+#define CTRL1_FIFO_CLEAR BIT(21)
#define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16)
#define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf)
-#define CTRL1_CUR_FRAME_DONE_IRQ_EN (1 << 13)
-#define CTRL1_CUR_FRAME_DONE_IRQ (1 << 9)
+#define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13)
+#define CTRL1_CUR_FRAME_DONE_IRQ BIT(9)
#define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16)
#define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff)
#define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff)
#define TRANSFER_COUNT_GET_HCOUNT(x) ((x) & 0xffff)
-#define VDCTRL0_ENABLE_PRESENT (1 << 28)
-#define VDCTRL0_VSYNC_ACT_HIGH (1 << 27)
-#define VDCTRL0_HSYNC_ACT_HIGH (1 << 26)
-#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
-#define VDCTRL0_ENABLE_ACT_HIGH (1 << 24)
-#define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21)
-#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20)
-#define VDCTRL0_HALF_LINE (1 << 19)
-#define VDCTRL0_HALF_LINE_MODE (1 << 18)
+#define VDCTRL0_ENABLE_PRESENT BIT(28)
+#define VDCTRL0_VSYNC_ACT_HIGH BIT(27)
+#define VDCTRL0_HSYNC_ACT_HIGH BIT(26)
+#define VDCTRL0_DOTCLK_ACT_FALLING BIT(25)
+#define VDCTRL0_ENABLE_ACT_HIGH BIT(24)
+#define VDCTRL0_VSYNC_PERIOD_UNIT BIT(21)
+#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT BIT(20)
+#define VDCTRL0_HALF_LINE BIT(19)
+#define VDCTRL0_HALF_LINE_MODE BIT(18)
#define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff)
#define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff)
#define VDCTRL2_SET_HSYNC_PERIOD(x) ((x) & 0x3ffff)
#define VDCTRL2_GET_HSYNC_PERIOD(x) ((x) & 0x3ffff)
-#define VDCTRL3_MUX_SYNC_SIGNALS (1 << 29)
-#define VDCTRL3_VSYNC_ONLY (1 << 28)
+#define VDCTRL3_MUX_SYNC_SIGNALS BIT(29)
+#define VDCTRL3_VSYNC_ONLY BIT(28)
#define SET_HOR_WAIT_CNT(x) (((x) & 0xfff) << 16)
#define GET_HOR_WAIT_CNT(x) (((x) >> 16) & 0xfff)
#define SET_VERT_WAIT_CNT(x) ((x) & 0xffff)
@@ -80,11 +80,11 @@
#define VDCTRL4_SET_DOTCLK_DLY(x) (((x) & 0x7) << 29) /* v4 only */
#define VDCTRL4_GET_DOTCLK_DLY(x) (((x) >> 29) & 0x7) /* v4 only */
-#define VDCTRL4_SYNC_SIGNALS_ON (1 << 18)
+#define VDCTRL4_SYNC_SIGNALS_ON BIT(18)
#define SET_DOTCLK_H_VALID_DATA_CNT(x) ((x) & 0x3ffff)
-#define DEBUG0_HSYNC (1 < 26)
-#define DEBUG0_VSYNC (1 < 25)
+#define DEBUG0_HSYNC BIT(26)
+#define DEBUG0_VSYNC BIT(25)
#define MXSFB_MIN_XRES 120
#define MXSFB_MIN_YRES 120
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-03-09 19:53 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 19:51 [PATCH 00/21] drm: mxsfb: Add i.MX7 support Laurent Pinchart
2020-03-09 19:51 ` [PATCH 01/21] drm: mxsfb: Remove fbdev leftovers Laurent Pinchart
2020-03-23 20:23 ` Stefan Agner
2020-03-09 19:51 ` [PATCH 02/21] drm: mxsfb: Use drm_panel_bridge Laurent Pinchart
2020-03-23 21:27 ` Stefan Agner
2020-03-23 21:38 ` Sam Ravnborg
2020-03-23 23:50 ` Stefan Agner
2020-05-30 2:14 ` Laurent Pinchart
2020-06-02 13:12 ` Daniel Vetter
2020-06-02 14:34 ` Stefan Agner
2020-06-02 17:18 ` Laurent Pinchart
2020-06-02 17:13 ` Laurent Pinchart
2020-06-03 8:16 ` Daniel Vetter
2020-06-04 20:10 ` Sam Ravnborg
2020-03-09 19:51 ` Laurent Pinchart [this message]
2020-03-23 21:34 ` [PATCH 03/21] drm: mxsfb: Use BIT() macro to define register bitfields Stefan Agner
2020-03-09 19:51 ` [PATCH 04/21] drm: mxsfb: Remove unused macros from mxsfb_regs.h Laurent Pinchart
2020-03-23 21:36 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 05/21] drm: mxsfb: Clarify format and bus width configuration Laurent Pinchart
2020-03-23 21:42 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 06/21] drm: mxsfb: Pass mxsfb_drm_private pointer to mxsfb_reset_block() Laurent Pinchart
2020-03-23 21:43 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 07/21] drm: mxsfb: Use LCDC_CTRL register name explicitly Laurent Pinchart
2020-03-23 21:48 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 08/21] drm: mxsfb: Remove register definitions from mxsfb_crtc.c Laurent Pinchart
2020-03-23 21:49 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 09/21] drm: mxsfb: Remove unneeded includes Laurent Pinchart
2020-03-23 21:53 ` Stefan Agner
2020-05-30 0:33 ` Laurent Pinchart
2020-03-09 19:52 ` [PATCH 10/21] drm: mxsfb: Stop using DRM simple display pipeline helper Laurent Pinchart
2020-03-23 22:30 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 11/21] drm: mxsfb: Rename mxsfb_crtc.c to mxsfb_kms.c Laurent Pinchart
2020-03-23 22:31 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 12/21] drm: mxsfb: Move vblank event arm to CRTC .atomic_flush() Laurent Pinchart
2020-03-23 22:38 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 13/21] drm: mxsfb: Don't touch AXI clock in IRQ context Laurent Pinchart
2020-03-23 22:50 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 14/21] drm: mxsfb: Enable vblank handling Laurent Pinchart
2020-03-23 23:08 ` Stefan Agner
2020-03-24 10:37 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 15/21] drm: mxsfb: Remove mxsfb_devdata unused fields Laurent Pinchart
2020-03-23 23:15 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 16/21] drm: mxsfb: Add i.MX7 to the list of supported SoCs in Kconfig Laurent Pinchart
2020-03-10 16:28 ` Fabio Estevam
2020-03-10 16:32 ` Laurent Pinchart
2020-03-10 16:37 ` [PATCH v1.1 " Laurent Pinchart
2020-03-23 23:18 ` [PATCH " Stefan Agner
2020-03-09 19:52 ` [PATCH 17/21] drm: mxsfb: Update internal IP version number for i.MX6SX Laurent Pinchart
2020-03-23 23:20 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 18/21] drm: mxsfb: Drop non-OF support Laurent Pinchart
2020-03-23 23:23 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 19/21] drm: mxsfb: Turn mxsfb_set_pixel_fmt() into a void function Laurent Pinchart
2020-03-23 23:28 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 20/21] drm: mxsfb: Merge mxsfb_set_pixel_fmt() and mxsfb_set_bus_fmt() Laurent Pinchart
2020-03-23 23:34 ` Stefan Agner
2020-03-09 19:52 ` [PATCH 21/21] drm: mxsfb: Support the alpha plane Laurent Pinchart
2020-03-23 23:48 ` Stefan Agner
2020-05-30 2:44 ` Laurent Pinchart
2020-03-19 9:36 ` [PATCH 00/21] drm: mxsfb: Add i.MX7 support Laurent Pinchart
2020-04-12 16:37 ` Guido Günther
2020-05-26 15:13 ` Stefan Agner
2020-05-30 0:29 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200309195216.31042-4-laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=marex@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).