Skip to content

Commit

Permalink
arm: omap: board-ldp: use generic dpi panel's gpio handling
Browse files Browse the repository at this point in the history
The ldp board file currently requests gpios required to configure the NEC DPI
panel, and provides platform_enable/disable callbacks to configure them.

These tasks have been moved to the generic dpi panel driver itself and shouldn't
be done in the board files.

Remove the gpio requests and the platform callbacks from the board file.
Configure the gpio information in generic dpi panel's platform data so that it's
passed to the panel driver.

Signed-off-by: Archit Taneja <archit@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Archit Taneja authored and Tomi Valkeinen committed Apr 4, 2013
1 parent 130cbe5 commit fa2a02f
Showing 1 changed file with 9 additions and 52 deletions.
61 changes: 9 additions & 52 deletions arch/arm/mach-omap2/board-ldp.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,34 +181,13 @@ static inline void __init ldp_init_smsc911x(void)

/* LCD */

static int ldp_backlight_gpio;
static int ldp_lcd_enable_gpio;

#define LCD_PANEL_RESET_GPIO 55
#define LCD_PANEL_QVGA_GPIO 56

static int ldp_panel_enable_lcd(struct omap_dss_device *dssdev)
{
if (gpio_is_valid(ldp_lcd_enable_gpio))
gpio_direction_output(ldp_lcd_enable_gpio, 1);
if (gpio_is_valid(ldp_backlight_gpio))
gpio_direction_output(ldp_backlight_gpio, 1);

return 0;
}

static void ldp_panel_disable_lcd(struct omap_dss_device *dssdev)
{
if (gpio_is_valid(ldp_lcd_enable_gpio))
gpio_direction_output(ldp_lcd_enable_gpio, 0);
if (gpio_is_valid(ldp_backlight_gpio))
gpio_direction_output(ldp_backlight_gpio, 0);
}

static struct panel_generic_dpi_data ldp_panel_data = {
.name = "nec_nl2432dr22-11b",
.platform_enable = ldp_panel_enable_lcd,
.platform_disable = ldp_panel_disable_lcd,
.num_gpios = 4,
/* gpios filled in code */
};

static struct omap_dss_device ldp_lcd_device = {
Expand All @@ -231,41 +210,19 @@ static struct omap_dss_board_info ldp_dss_data = {

static void __init ldp_display_init(void)
{
int r;

static struct gpio gpios[] __initdata = {
{LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "LCD RESET"},
{LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "LCD QVGA"},
};

r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
if (r) {
pr_err("Cannot request LCD GPIOs, error %d\n", r);
return;
}
ldp_panel_data.gpios[2] = LCD_PANEL_RESET_GPIO;
ldp_panel_data.gpios[3] = LCD_PANEL_QVGA_GPIO;

omap_display_init(&ldp_dss_data);
}

static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio)
{
int r;

struct gpio gpios[] = {
{gpio + 7 , GPIOF_OUT_INIT_LOW, "LCD ENABLE"},
{gpio + 15, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT"},
};

r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
if (r) {
pr_err("Cannot request LCD GPIOs, error %d\n", r);
ldp_backlight_gpio = -EINVAL;
ldp_lcd_enable_gpio = -EINVAL;
return r;
}

ldp_backlight_gpio = gpio + 15;
ldp_lcd_enable_gpio = gpio + 7;
ldp_panel_data.gpios[0] = gpio + 7;
ldp_panel_data.gpio_invert[0] = true;

ldp_panel_data.gpios[1] = gpio + 15;
ldp_panel_data.gpio_invert[1] = true;

return 0;
}
Expand Down

0 comments on commit fa2a02f

Please sign in to comment.