Use stratight-forward definition of CRT_HORIZONTAL_SYNC register fields
and use open-coded implementation for register manipulation

Signed-off-by: Mike Rapoport <mike.rapop...@gmail.com>
---
 drivers/staging/sm750fb/ddk750_mode.c | 7 +++++--
 drivers/staging/sm750fb/ddk750_reg.h  | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 2b2f1c1..d425ea1 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -90,8 +90,11 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
                                CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK));
 
                POKE32(CRT_HORIZONTAL_SYNC,
-               FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, 
pModeParam->horizontal_sync_width)
-               | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, 
pModeParam->horizontal_sync_start - 1));
+                       ((pModeParam->horizontal_sync_width <<
+                               CRT_HORIZONTAL_SYNC_WIDTH_SHIFT) &
+                               CRT_HORIZONTAL_SYNC_WIDTH_MASK) |
+                       ((pModeParam->horizontal_sync_start - 1) &
+                               CRT_HORIZONTAL_SYNC_START_MASK));
 
                POKE32(CRT_VERTICAL_TOTAL,
                FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, 
pModeParam->vertical_total - 1)
diff --git a/drivers/staging/sm750fb/ddk750_reg.h 
b/drivers/staging/sm750fb/ddk750_reg.h
index 1b55a7f..fc6fa23 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -1382,8 +1382,9 @@
 #define CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK         0xfff
 
 #define CRT_HORIZONTAL_SYNC                           0x080210
-#define CRT_HORIZONTAL_SYNC_WIDTH                     23:16
-#define CRT_HORIZONTAL_SYNC_START                     11:0
+#define CRT_HORIZONTAL_SYNC_WIDTH_SHIFT               16
+#define CRT_HORIZONTAL_SYNC_WIDTH_MASK                (0xff << 16)
+#define CRT_HORIZONTAL_SYNC_START_MASK                0xfff
 
 #define CRT_VERTICAL_TOTAL                            0x080214
 #define CRT_VERTICAL_TOTAL_TOTAL                      26:16
-- 
1.9.1

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to