[PATCH 14/21] staging: sm750fb: change definition of DE_DESTINATION fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Mike Rapoport <mike.rapoport@xxxxxxxxx>
---
 drivers/staging/sm750fb/sm750_accel.c | 15 ++++++---------
 drivers/staging/sm750fb/sm750_accel.h |  9 ++++-----
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index da4eaea..55c38ae 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -115,9 +115,8 @@ int hw_fillrect(struct lynx_accel *accel,
 	write_dpr(accel, DE_FOREGROUND, color); /* DPR14 */
 
 	write_dpr(accel, DE_DESTINATION,
-			FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE)|
-			FIELD_VALUE(0, DE_DESTINATION, X, x)|
-			FIELD_VALUE(0, DE_DESTINATION, Y, y)); /* dpr4 */
+		  ((x << DE_DESTINATION_X_SHIFT) & DE_DESTINATION_X_MASK) |
+		  (y & DE_DESTINATION_Y_MASK)); /* dpr4 */
 
 	write_dpr(accel, DE_DIMENSION,
 			FIELD_VALUE(0, DE_DIMENSION, X, width)|
@@ -259,9 +258,8 @@ unsigned int rop2)   /* ROP value */
 		  ((sx << DE_SOURCE_X_K1_SHIFT) & DE_SOURCE_X_K1_MASK) |
 		  (sy & DE_SOURCE_Y_K2_MASK)); /* dpr0 */
 	write_dpr(accel, DE_DESTINATION,
-		  FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
-		  FIELD_VALUE(0, DE_DESTINATION, X,    dx)  |
-		  FIELD_VALUE(0, DE_DESTINATION, Y,    dy)); /* dpr04 */
+		  ((dx << DE_DESTINATION_X_SHIFT) & DE_DESTINATION_X_MASK) |
+		  (dy & DE_DESTINATION_Y_MASK)); /* dpr04 */
 	write_dpr(accel, DE_DIMENSION,
 		  FIELD_VALUE(0, DE_DIMENSION, X,    width) |
 		  FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */
@@ -357,9 +355,8 @@ int hw_imageblit(struct lynx_accel *accel,
 		  DE_SOURCE_X_K1_MONO_MASK); /* dpr00 */
 
 	write_dpr(accel, DE_DESTINATION,
-		  FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
-		  FIELD_VALUE(0, DE_DESTINATION, X,    dx)    |
-		  FIELD_VALUE(0, DE_DESTINATION, Y,    dy)); /* dpr04 */
+		  ((dx << DE_DESTINATION_X_SHIFT) & DE_DESTINATION_X_MASK) |
+		  (dy & DE_DESTINATION_Y_MASK)); /* dpr04 */
 
 	write_dpr(accel, DE_DIMENSION,
 		  FIELD_VALUE(0, DE_DIMENSION, X,    width) |
diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h
index 0bbdcca..f8dc3f1 100644
--- a/drivers/staging/sm750fb/sm750_accel.h
+++ b/drivers/staging/sm750fb/sm750_accel.h
@@ -28,11 +28,10 @@
 #define DE_SOURCE_Y_K2_MASK                             0xffff
 
 #define DE_DESTINATION                                  0x4
-#define DE_DESTINATION_WRAP                             31:31
-#define DE_DESTINATION_WRAP_DISABLE                     0
-#define DE_DESTINATION_WRAP_ENABLE                      1
-#define DE_DESTINATION_X                                28:16
-#define DE_DESTINATION_Y                                15:0
+#define DE_DESTINATION_WRAP                             BIT(31)
+#define DE_DESTINATION_X_SHIFT                          16
+#define DE_DESTINATION_X_MASK                           (0x1fff << 16)
+#define DE_DESTINATION_Y_MASK                           0xffff
 
 #define DE_DIMENSION                                    0x8
 #define DE_DIMENSION_X                                  28:16
-- 
1.9.1

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



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux