[U-Boot] [PATCH 04/21] sunxi: display: Fix gpio handling to work with the device-model
Simon Glass
sjg at chromium.org
Sat Apr 25 01:24:02 CEST 2015
Hi Hans,
On 24 April 2015 at 07:48, Hans de Goede <hdegoede at redhat.com> wrote:
> The device-model gpio functions may return another value then -1 as error,
> make the sunxi display code properly handle this.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> drivers/video/sunxi_display.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
I'm interested in your plan to get rid of sunxi_name_to_gpio().
> diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
> index 07c7a18..79a513c 100644
> --- a/drivers/video/sunxi_display.c
> +++ b/drivers/video/sunxi_display.c
> @@ -600,19 +600,19 @@ static void sunxi_lcdc_panel_enable(void)
> * white while the lcd inits.
> */
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
> - if (pin != -1) {
> + if (pin >= 0) {
> gpio_request(pin, "lcd_backlight_enable");
> gpio_direction_output(pin, 0);
> }
>
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
> - if (pin != -1) {
> + if (pin >= 0) {
> gpio_request(pin, "lcd_backlight_pwm");
> gpio_direction_output(pin, PWM_OFF);
> }
>
> reset_pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_RESET);
> - if (reset_pin != -1) {
> + if (reset_pin >= 0) {
> gpio_request(reset_pin, "lcd_reset");
> gpio_direction_output(reset_pin, 0); /* Assert reset */
> }
> @@ -620,12 +620,12 @@ static void sunxi_lcdc_panel_enable(void)
> /* Give the backlight some time to turn off and power up the panel. */
> mdelay(40);
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_POWER);
> - if (pin != -1) {
> + if (pin >= 0) {
> gpio_request(pin, "lcd_power");
> gpio_direction_output(pin, 1);
> }
>
> - if (reset_pin != -1)
> + if (reset_pin >= 0)
> gpio_direction_output(reset_pin, 1); /* De-assert reset */
> }
>
> @@ -640,11 +640,11 @@ static void sunxi_lcdc_backlight_enable(void)
> mdelay(40);
>
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
> - if (pin != -1)
> + if (pin >= 0)
> gpio_direction_output(pin, 1);
>
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
> - if (pin != -1)
> + if (pin >= 0)
> gpio_direction_output(pin, PWM_ON);
> }
>
> @@ -961,7 +961,7 @@ static void sunxi_vga_external_dac_enable(void)
> int pin;
>
> pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
> - if (pin != -1) {
> + if (pin >= 0) {
> gpio_request(pin, "vga_enable");
> gpio_direction_output(pin, 1);
> }
> --
> 2.3.5
>
Regards,
Simon
More information about the U-Boot
mailing list