diff mbox series

[02/11] video: omap: add missing bitfield masks

Message ID 20200209184745.20473-3-dariobin@libero.it
State Superseded
Headers show
Series Add DM/DTS support for omap video driver | expand

Commit Message

Dario Binacchi Feb. 9, 2020, 6:47 p.m. UTC
Add, if missing, the bitfield masks in the setting macros of the LCD
controller registers.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
---

 drivers/video/am335x-fb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Lokesh Vutla Feb. 10, 2020, 4:06 a.m. UTC | #1
On 10/02/20 12:17 AM, Dario Binacchi wrote:
> Add, if missing, the bitfield masks in the setting macros of the LCD
> controller registers.

may be cleaner to use GENMASK

Thanks and regards,
Lokesh

> 
> Signed-off-by: Dario Binacchi <dariobin at libero.it>
> ---
> 
>  drivers/video/am335x-fb.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
> index 18e3bd1f35..ed445546ec 100644
> --- a/drivers/video/am335x-fb.c
> +++ b/drivers/video/am335x-fb.c
> @@ -26,14 +26,14 @@
>  #define LCDC_FMAX				200000000
>  
>  /* LCD Control Register */
> -#define LCD_CLK_DIVISOR(x)			((x) << 8)
> +#define LCD_CLK_DIVISOR(x)			(((x) & 0xFF) << 8)
>  #define LCD_RASTER_MODE				BIT(0)
>  /* LCD Clock Enable Register */
>  #define LCD_CORECLKEN				BIT(0)
>  #define LCD_LIDDCLKEN				BIT(1)
>  #define LCD_DMACLKEN				BIT(2)
>  /* LCD DMA Control Register */
> -#define LCD_DMA_BURST_SIZE(x)			((x) << 4)
> +#define LCD_DMA_BURST_SIZE(x)			(((x) & 0x07) << 4)
>  #define LCD_DMA_BURST_1				0x0
>  #define LCD_DMA_BURST_2				0x1
>  #define LCD_DMA_BURST_4				0x2
> @@ -46,9 +46,9 @@
>  #define LCD_HORLSB(x)				(((((x) >> 4)-1) & 0x3F) << 4)
>  #define LCD_HORMSB(x)				(((((x) >> 4)-1) & 0x40) >> 4)
>  /* LCD Timing_1 Register */
> -#define LCD_VBP(x)				((x) << 24)
> -#define LCD_VFP(x)				((x) << 16)
> -#define LCD_VSW(x)				(((x)-1) << 10)
> +#define LCD_VBP(x)				(((x) & 0xFF) << 24)
> +#define LCD_VFP(x)				(((x) & 0xFF) << 16)
> +#define LCD_VSW(x)				((((x) - 1) & 0x3F) << 10)
>  #define LCD_VERLSB(x)				(((x)-1) & 0x3FF)
>  /* LCD Timing_2 Register */
>  #define LCD_HSWMSB(x)				((((x)-1) & 0x3C0) << 21)
>
diff mbox series

Patch

diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index 18e3bd1f35..ed445546ec 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -26,14 +26,14 @@ 
 #define LCDC_FMAX				200000000
 
 /* LCD Control Register */
-#define LCD_CLK_DIVISOR(x)			((x) << 8)
+#define LCD_CLK_DIVISOR(x)			(((x) & 0xFF) << 8)
 #define LCD_RASTER_MODE				BIT(0)
 /* LCD Clock Enable Register */
 #define LCD_CORECLKEN				BIT(0)
 #define LCD_LIDDCLKEN				BIT(1)
 #define LCD_DMACLKEN				BIT(2)
 /* LCD DMA Control Register */
-#define LCD_DMA_BURST_SIZE(x)			((x) << 4)
+#define LCD_DMA_BURST_SIZE(x)			(((x) & 0x07) << 4)
 #define LCD_DMA_BURST_1				0x0
 #define LCD_DMA_BURST_2				0x1
 #define LCD_DMA_BURST_4				0x2
@@ -46,9 +46,9 @@ 
 #define LCD_HORLSB(x)				(((((x) >> 4)-1) & 0x3F) << 4)
 #define LCD_HORMSB(x)				(((((x) >> 4)-1) & 0x40) >> 4)
 /* LCD Timing_1 Register */
-#define LCD_VBP(x)				((x) << 24)
-#define LCD_VFP(x)				((x) << 16)
-#define LCD_VSW(x)				(((x)-1) << 10)
+#define LCD_VBP(x)				(((x) & 0xFF) << 24)
+#define LCD_VFP(x)				(((x) & 0xFF) << 16)
+#define LCD_VSW(x)				((((x) - 1) & 0x3F) << 10)
 #define LCD_VERLSB(x)				(((x)-1) & 0x3FF)
 /* LCD Timing_2 Register */
 #define LCD_HSWMSB(x)				((((x)-1) & 0x3C0) << 21)