Skip to contentSkip to conversation

staging: olpc_dcon: convert to new cs5535 gpio API

PATCH In review Andres Salomon 1 participant 1 message Sep 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 staging: olpc_dcon: convert to new cs5535 gpio API

Drop the old geode_gpio crud, as well as the raw outl() calls; instead, use the Linux GPIO API where possible, and the cs5535_gpio API in other places.

Note that we don't actually clean up the driver properly yet (once loaded, it always remains loaded). That'll come later..

This patch is necessary for building the driver.

---
 arch/x86/include/asm/olpc.h                  |   10 +-
 drivers/staging/olpc_dcon/TODO               |    1 -
 drivers/staging/olpc_dcon/olpc_dcon.c        |    3 +-
 drivers/staging/olpc_dcon/olpc_dcon.h        |   20 ---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c   |  168 +++++++++++++++-----------
 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c |    4 +-
 include/linux/cs5535.h                       |    4 +
 7 files changed, 114 insertions(+), 96 deletions(-)
arch/x86/include/asm/olpc.h +7 -3
index 101229b..09610f2 100644
@@ -105,10 +105,14 @@ extern int olpc_ec_mask_unset(uint8_t bits);
 /* GPIO assignments */
 
 #define OLPC_GPIO_MIC_AC	1
-#define OLPC_GPIO_DCON_IRQ	geode_gpio(7)
+#define OLPC_GPIO_DCON_STAT0	5
+#define OLPC_GPIO_DCON_STAT1	6
+#define OLPC_GPIO_DCON_IRQ	7
 #define OLPC_GPIO_THRM_ALRM	geode_gpio(10)
-#define OLPC_GPIO_SMB_CLK	geode_gpio(14)
-#define OLPC_GPIO_SMB_DATA	geode_gpio(15)
+#define OLPC_GPIO_DCON_LOAD    11
+#define OLPC_GPIO_DCON_BLANK   12
+#define OLPC_GPIO_SMB_CLK      14
+#define OLPC_GPIO_SMB_DATA     15
 #define OLPC_GPIO_WORKAUX	geode_gpio(24)
 #define OLPC_GPIO_LID		geode_gpio(26)
 #define OLPC_GPIO_ECSCI		geode_gpio(27)
drivers/staging/olpc_dcon/TODO +0 -1
index ac2d3d0..35f9cda 100644
@@ -1,6 +1,5 @@
 TODO:
 	- checkpatch.pl cleanups
-	- port geode gpio calls to newer cs5535 API
 	- see if vx855 gpio API can be made similar enough to cs5535 so we can
 	  share more code
 	- allow simultaneous XO-1 and XO-1.5 support
drivers/staging/olpc_dcon/olpc_dcon.c +1 -2
index 75aa7a3..6cb365c 100644
@@ -28,7 +28,6 @@
 #include <asm/uaccess.h>
 #include <linux/ctype.h>
 #include <linux/reboot.h>
-#include <linux/gpio.h>
 #include <asm/tsc.h>
 #include <asm/olpc.h>
 
@@ -50,7 +49,7 @@ struct dcon_platform_data {
 	int (*init)(void);
 	void (*bus_stabilize_wiggle)(void);
 	void (*set_dconload)(int);
-	int (*read_status)(void);
+	u8 (*read_status)(void);
 };
 
 static struct dcon_platform_data *pdata;
drivers/staging/olpc_dcon/olpc_dcon.h +0 -20
index 6453ca4..e566d21 100644
@@ -29,26 +29,6 @@
 #define DCON_REG_SCAN_INT	9
 #define DCON_REG_BRIGHT		10
 
-/* GPIO registers (CS5536) */
-
-#define MSR_LBAR_GPIO		0x5140000C
-
-#define GPIOx_OUT_VAL     0x00
-#define GPIOx_OUT_EN      0x04
-#define GPIOx_IN_EN       0x20
-#define GPIOx_INV_EN      0x24
-#define GPIOx_IN_FLTR_EN  0x28
-#define GPIOx_EVNTCNT_EN  0x2C
-#define GPIOx_READ_BACK   0x30
-#define GPIOx_EVNT_EN     0x38
-#define GPIOx_NEGEDGE_EN  0x44
-#define GPIOx_NEGEDGE_STS 0x4C
-#define GPIO_FLT7_AMNT    0xD8
-#define GPIO_MAP_X        0xE0
-#define GPIO_MAP_Y        0xE4
-#define GPIO_FE7_SEL      0xF7
-
-
 /* Status values */
 
 #define DCONSTAT_SCANINT	0
drivers/staging/olpc_dcon/olpc_dcon_xo_1.c +100 -68

243 lines not on this page · raw message

drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c +2 -2
index cca6a23..4f56098 100644
@@ -195,9 +195,9 @@ static void dcon_set_dconload_xo_1_5(int val)
 	}
 }
 
-static int dcon_read_status_xo_1_5(void) 
+static u8 dcon_read_status_xo_1_5(void)
 {
-	int status;
+	u8 status;
 	
 	if (!dcon_was_irq())
 		return -1;
include/linux/cs5535.h +4 -0
index 213cc50..6fe2114 100644
@@ -103,11 +103,15 @@ static inline int cs5535_has_vsa2(void)
 #define GPIO_POSITIVE_EDGE_STS	0x48
 #define GPIO_NEGATIVE_EDGE_STS	0x4C
 
+#define GPIO_FLTR7_AMOUNT	0xD8
+
 #define GPIO_MAP_X		0xE0
 #define GPIO_MAP_Y		0xE4
 #define GPIO_MAP_Z		0xE8
 #define GPIO_MAP_W		0xEC
 
+#define GPIO_FE7_SEL		0xF7
+
 void cs5535_gpio_set(unsigned offset, unsigned int reg);
 void cs5535_gpio_clear(unsigned offset, unsigned int reg);
 int cs5535_gpio_isset(unsigned offset, unsigned int reg);
Signature · 1 line
1.5.6.5