From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6] ARM : mx35: 3ds-board: add framebuffer device
Date: Fri, 9 Mar 2012 12:06:14 +0100 [thread overview]
Message-ID: <20120309110614.GC3852@pengutronix.de> (raw)
In-Reply-To: <1331269521-20784-1-git-send-email-b39297@freescale.com>
On Fri, Mar 09, 2012 at 01:05:21PM +0800, Wu Guoxing wrote:
> From: wu guoxing <b39297@freescale.com>
>
> This patch adds framebuffer support for freescale mx35 3ds board
>
> Signed-off-by: Wu Guoxing <b39297@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 |
prev parent reply other threads:[~2012-03-09 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-09 5:05 [PATCH v6] ARM : mx35: 3ds-board: add framebuffer device Wu Guoxing
2012-03-09 11:06 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120309110614.GC3852@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).