[PATCH v6] ARM : mx35: 3ds-board: add framebuffer device
Sascha Hauer
s.hauer at pengutronix.de
Fri Mar 9 06:06:14 EST 2012
On Fri, Mar 09, 2012 at 01:05:21PM +0800, Wu Guoxing wrote:
> From: wu guoxing <b39297 at freescale.com>
>
> This patch adds framebuffer support for freescale mx35 3ds board
>
> Signed-off-by: Wu Guoxing <b39297 at freescale.com>
>
> arch/arm/mach-imx/mach-mx35_3ds.c | 121 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 121 insertions(+), 0 deletions(-)
>
> +static int lcd_power_gpio = -ENXIO;
> +
> +static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip,
> + void *data)
> +{
> + return !strcmp(chip->label, data);
> +}
> +
> +static int mc9s08dz60_lcd_gpio_get(void)
> +{
> + struct gpio_chip *chip;
> +
> + if (!gpio_is_valid(lcd_power_gpio)) {
> + chip = gpiochip_find(
> + "mc9s08dz60", mc9s08dz60_gpiochip_match);
> + if (chip) {
> + lcd_power_gpio = chip->base + 6;
> + if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
> + pr_err("error: gpio already requested by other!\n");
> + lcd_power_gpio = -ENXIO;
> + }
> + } else {
> + pr_err("error: didn't find mc9s08dz60 gpio chip\n");
> + lcd_power_gpio = -ENXIO;
> + }
> + }
> +
> + return lcd_power_gpio;
> +}
> +
> +static void mx35_3ds_lcd_set_power(struct plat_lcd_data *pd, unsigned int power)
> +{
> + int gpio;
> +
> + gpio = mc9s08dz60_lcd_gpio_get();
> + if (gpio_is_valid(gpio))
> + gpio_set_value_cansleep(gpio, power);
> +}
This looks unnecessary complicated. Please fold mc9s08dz60_lcd_gpio_get
into mx35_3ds_lcd_set_power:
if (!gpio_is_valid()) {
request()
}
if (gpio_is_valid()) {
set_value()
}
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the linux-arm-kernel
mailing list