From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbcKGO1F (ORCPT ); Mon, 7 Nov 2016 09:27:05 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:42677 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752597AbcKGO1E (ORCPT ); Mon, 7 Nov 2016 09:27:04 -0500 Message-ID: <1478528816.2461.25.camel@pengutronix.de> Subject: Re: [PATCH] drm: panel: simple-panel: get the enable gpio as-is From: Philipp Zabel To: Thierry Reding Cc: Chen-Yu Tsai , Icenowy Zheng , dri-devel , linux-kernel Date: Mon, 07 Nov 2016 15:26:56 +0100 In-Reply-To: <20161107131736.GD12559@ulmo.ba.sec> References: <20161106110903.14594-1-icenowy@aosc.xyz> <20161107131736.GD12559@ulmo.ba.sec> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, den 07.11.2016, 14:17 +0100 schrieb Thierry Reding: > On Mon, Nov 07, 2016 at 06:12:43PM +0800, Chen-Yu Tsai wrote: > > On Sun, Nov 6, 2016 at 7:09 PM, Icenowy Zheng wrote: > > > The enable gpio of simple-panel may be used by a simplefb or other > > > driver on the panel's display before the KMS driver get load. > > > > > > Get the GPIO as-is, so the panel won't be disabled, and the simplefb > > > can work. > > > > > > Signed-off-by: Icenowy Zheng > > > --- > > > drivers/gpu/drm/panel/panel-simple.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c > > > index 113db3c..ccee4c1 100644 > > > --- a/drivers/gpu/drm/panel/panel-simple.c > > > +++ b/drivers/gpu/drm/panel/panel-simple.c > > > @@ -312,7 +312,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) > > > return PTR_ERR(panel->supply); > > > > > > panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", > > > - GPIOD_OUT_LOW); > > > + GPIOD_ASIS); > > > > The GPIO requested as-is might be in input mode. You should change the > > gpiod_set_value calls to gpiod_direction_output calls. The later also > > allows you to give an initial value. Not sure if it checks for cansleep > > like the set_value calls though. > > I'd prefer not to add gpiod_direction_output() calls outside of > ->probe(). Instead, could we make this patch be smart about taking over > from an earlier user? Could it read the current direction and value of > the GPIO and not disable it if it had previously been enabled? Seconded, the PWM backlight driver in drivers/video/backlight/pwm_bl.c already does a similar thing. > And even if we go this extra mile there's a possibility that the GPIO > was just left dangling by earlier software (or hardware) and leaving it > on would actually be worse than turning the panel off. Is this something the encoder driver should communicate to the panel? That one will know whether its atomic_reset state is enabled or disabled. regards Philipp