omap drivers switch to standard GPIO calls
PATCH 1/1 omap drivers switch to standard GPIO calls
From: David Brownell <[email protected]>
This updates most of the OMAP drivers which are in mainline to switch to using the cross-platform GPIO calls instead of the older OMAP-specific ones.
This is all fairly brainless/obvious stuff. Probably the most interesting bit is to observe that the omap-keypad code seems to now have a portable core that could work with non-OMAP matrix keypads. (That would improve with hardware IRQ debouncing enabled, of course...)
Signed-off-by David Brownell <[email protected]>
Signed-off-by Tony Lindgren <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc David Woodhouse <[email protected]>
---
By "most", I mean it omits three drivers I know have patches pending for the initial 2.6.28 merge window; their turn will come later. (And then there's arch/arm/*omap*/*c ... )
drivers/input/keyboard/omap-keypad.c | 27 ++++----- drivers/mtd/nand/ams-delta.c | 4 - drivers/video/omap/lcd_inn1610.c | 22 +++---- drivers/video/omap/lcd_osk.c | 10 +-- drivers/video/omap/lcd_sx1.c | 97 +++++++++++++++------------------ 5 files changed, 74 insertions(+), 86 deletions(-)
drivers/input/keyboard/omap-keypad.c +12 -15
@@ -72,12 +72,9 @@ static unsigned int *col_gpios;static void set_col_gpio_val (struct omap_kp *omap_kp,u8 value) {int col; -for (col =0 ; col < omap_kp->cols; col++) { -if (value & (1 << col)) -omap_set_gpio_dataout (col_gpios[col],1 ); -else -omap_set_gpio_dataout (col_gpios[col],0 ); - } + +for (col =0 ; col < omap_kp->cols; col++) +gpio_set_value (col_gpios[col], value & (1 << col)); }static u8 get_row_gpio_val (struct omap_kp *omap_kp)
@@ -86,7 +83,7 @@ static u8 get_row_gpio_val(struct omap_ku8 value =0 ;for (row =0 ; row < omap_kp->rows; row++) { -if (omap_get_gpio_datain (row_gpios[row])) +if (gpio_get_value (row_gpios[row])) value |= (1 << row); }return value;
@@ -333,23 +330,23 @@ static int __init omap_kp_probe(struct pif (cpu_is_omap24xx ()) {/* Cols: outputs */ for (col_idx =0 ; col_idx < omap_kp->cols; col_idx++) { -if (omap_request_gpio (col_gpios[col_idx]) <0 ) { +if (gpio_request (col_gpios[col_idx],"omap_kp_col" ) <0 ) {printk (KERN_ERR "Failed to request" "GPIO%d for keypad\n" , col_gpios[col_idx]); goto err1; } -omap_set_gpio_direction (col_gpios[col_idx],0 ); +gpio_direction_output (col_gpios[col_idx],0 ); }/* Rows: inputs */ for (row_idx =0 ; row_idx < omap_kp->rows; row_idx++) { -if (omap_request_gpio (row_gpios[row_idx]) <0 ) { +if (gpio_request (row_gpios[row_idx],"omap_kp_row" ) <0 ) {printk (KERN_ERR "Failed to request" "GPIO%d for keypad\n" , row_gpios[row_idx]); goto err2; } -omap_set_gpio_direction (row_gpios[row_idx],1 ); +gpio_direction_input (row_gpios[row_idx]); } }else { col_idx =0 ;
@@ -418,10 +415,10 @@ err3:device_remove_file (&pdev->dev, &dev_attr_enable); err2:for (i = row_idx -1 ; i >=0 ; i--) -omap_free_gpio (row_gpios[i]); +gpio_free (row_gpios[i]); err1:for (i = col_idx -1 ; i >=0 ; i--) -omap_free_gpio (col_gpios[i]); +gpio_free (col_gpios[i]);kfree (omap_kp);input_free_device (input_dev);
@@ -438,9 +435,9 @@ static int omap_kp_remove(struct platforif (cpu_is_omap24xx ()) {int i;for (i =0 ; i < omap_kp->cols; i++) -omap_free_gpio (col_gpios[i]); +gpio_free (col_gpios[i]);for (i =0 ; i < omap_kp->rows; i++) { -omap_free_gpio (row_gpios[i]); +gpio_free (row_gpios[i]);free_irq (OMAP_GPIO_IRQ (row_gpios[i]),0 ); } }else {
drivers/mtd/nand/ams-delta.c +2 -2
@@ -145,7 +145,7 @@ static void ams_delta_hwcontrol(struct mstatic int ams_delta_nand_ready (struct mtd_info *mtd) { -return omap_get_gpio_datain (AMS_DELTA_GPIO_PIN_NAND_RB ); +return gpio_get_value (AMS_DELTA_GPIO_PIN_NAND_RB ); }/*
@@ -185,7 +185,7 @@ static int __init ams_delta_init(void) this->read_buf = ams_delta_read_buf; this->verify_buf = ams_delta_verify_buf; this->cmd_ctrl = ams_delta_hwcontrol; -if (!omap_request_gpio (AMS_DELTA_GPIO_PIN_NAND_RB )) { +if (gpio_request (AMS_DELTA_GPIO_PIN_NAND_RB ,"nand_rdy" ) ==0 ) { this->dev_ready = ams_delta_nand_ready; }else { this->dev_ready =NULL ;
drivers/video/omap/lcd_inn1610.c +11 -11
@@ -32,43 +32,43 @@ static int innovator1610_panel_init(stru {int r =0 ; -if (omap_request_gpio (14 )) { +if (gpio_request (14 ,"lcd_en0" )) {pr_err (MODULE_NAME ": can't request GPIO 14\n" ); r =-1 ; goto exit; } -if (omap_request_gpio (15 )) { +if (gpio_request (15 ,"lcd_en1" )) {pr_err (MODULE_NAME ": can't request GPIO 15\n" ); -omap_free_gpio (14 ); +gpio_free (14 ); r =-1 ; goto exit; }/* configure GPIO(14, 15) as outputs */ -omap_set_gpio_direction (14 ,0 ); -omap_set_gpio_direction (15 ,0 ); +gpio_direction_output (14 ,0 ); +gpio_direction_output (15 ,0 ); exit:return r; }static void innovator1610_panel_cleanup (struct lcd_panel *panel) { -omap_free_gpio (15 ); -omap_free_gpio (14 ); +gpio_free (15 ); +gpio_free (14 ); }static int innovator1610_panel_enable (struct lcd_panel *panel) {/* set GPIO14 and GPIO15 high */ -omap_set_gpio_dataout (14 ,1 ); -omap_set_gpio_dataout (15 ,1 ); +gpio_set_value (14 ,1 ); +gpio_set_value (15 ,1 );return 0 ; }static void innovator1610_panel_disable (struct lcd_panel *panel) {/* set GPIO13, GPIO14 and GPIO15 low */ -omap_set_gpio_dataout (14 ,0 ); -omap_set_gpio_dataout (15 ,0 ); +gpio_set_value (14 ,0 ); +gpio_set_value (15 ,0 ); }static unsigned long innovator1610_panel_get_caps (struct lcd_panel *panel)
drivers/video/omap/lcd_osk.c +4 -6
@@ -29,6 +29,7 @@static int osk_panel_init (struct lcd_panel *panel,struct omapfb_device *fbdev) { +/* gpio2 was allocated in board init */ return 0 ; }
@@ -47,11 +48,8 @@ static int osk_panel_enable(struct lcd_p/* Set PWL level */ omap_writeb (0xFF ,OMAP_PWL_ENABLE ); -/* configure GPIO2 as output */ -omap_set_gpio_direction (2 ,0 ); - -/* set GPIO2 high */ -omap_set_gpio_dataout (2 ,1 ); +/* set GPIO2 high (lcd power enabled) */ +gpio_set_value (2 ,1 );return 0 ; }
@@ -65,7 +63,7 @@ static void osk_panel_disable(struct lcdomap_writeb (0x00 ,OMAP_PWL_CLK_ENABLE );/* set GPIO2 low */ -omap_set_gpio_dataout (2 ,0 ); +gpio_set_value (2 ,0 ); }static unsigned long osk_panel_get_caps (struct lcd_panel *panel)
drivers/video/omap/lcd_sx1.c +45 -52
190 lines not on this page · raw message