From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C733C433FE for ; Wed, 23 Nov 2022 21:32:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E9A1855C0; Wed, 23 Nov 2022 22:32:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4E360855BE; Wed, 23 Nov 2022 22:32:15 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id BA7A6855C0 for ; Wed, 23 Nov 2022 22:32:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D0811FB; Wed, 23 Nov 2022 13:32:18 -0800 (PST) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 434613F73D; Wed, 23 Nov 2022 13:32:11 -0800 (PST) Date: Wed, 23 Nov 2022 21:30:43 +0000 From: Andre Przywara To: Giulio Benetti Cc: u-boot@lists.denx.de, Jagan Teki , Anatolij Gustschin Subject: Re: [PATCH 2/2] sunxi: video: Add support for active low LCD power pin Message-ID: <20221123213043.3e293779@slackpad.lan> In-Reply-To: <20221122205703.1084533-2-giulio.benetti@benettiengineering.com> References: <20221122205703.1084533-1-giulio.benetti@benettiengineering.com> <20221122205703.1084533-2-giulio.benetti@benettiengineering.com> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Tue, 22 Nov 2022 21:57:03 +0100 Giulio Benetti wrote: Hi, > On some board gpio to power LCD can be active low, so let's add > CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW to allow this. This is all so very sadly outdated code, which could be all solved very nicely by just looking at the DT. Do you describe the backlight in the DT, for Linux, by any chance? Can we at least try to read that information from there, instead of adding Kconfig parameters for every variation? > Signed-off-by: Giulio Benetti > --- > arch/arm/mach-sunxi/Kconfig | 7 +++++++ > drivers/video/sunxi/sunxi_display.c | 4 ++++ > 2 files changed, 11 insertions(+) > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > index dbe6005daa..a7375b53a6 100644 > --- a/arch/arm/mach-sunxi/Kconfig > +++ b/arch/arm/mach-sunxi/Kconfig > @@ -867,6 +867,13 @@ config VIDEO_LCD_POWER > Set the power enable pin for the LCD panel. This takes a string in the > format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. > > +config VIDEO_LCD_POWER_ACTIVE_LOW > + bool "LCD panel power enable pin is inverted" > + depends on VIDEO_SUNXI > + default n > + ---help--- > + Set this if the lcd power pin is active low. > + > config VIDEO_LCD_RESET > string "LCD panel reset pin" > depends on VIDEO_SUNXI > diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c > index 2ee6212c58..12b542d65b 100644 > --- a/drivers/video/sunxi/sunxi_display.c > +++ b/drivers/video/sunxi/sunxi_display.c > @@ -588,7 +588,11 @@ static void sunxi_lcdc_panel_enable(void) > pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_POWER); > if (pin >= 0) { > gpio_request(pin, "lcd_power"); > +#ifdef CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW At the very least that should be using IS_ENABLED() and proper C code. Cheers, Andre > + gpio_direction_output(pin, 0); > +#else > gpio_direction_output(pin, 1); > +#endif > } > > if (reset_pin >= 0)