From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753003AbcKGNag (ORCPT ); Mon, 7 Nov 2016 08:30:36 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35585 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbcKGNad (ORCPT ); Mon, 7 Nov 2016 08:30:33 -0500 Date: Mon, 7 Nov 2016 14:17:36 +0100 From: Thierry Reding To: Chen-Yu Tsai Cc: Icenowy Zheng , David Airlie , dri-devel , linux-kernel Subject: Re: [PATCH] drm: panel: simple-panel: get the enable gpio as-is Message-ID: <20161107131736.GD12559@ulmo.ba.sec> References: <20161106110903.14594-1-icenowy@aosc.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1sNVjLsmu1MXqwQ/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --1sNVjLsmu1MXqwQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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/pan= el/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, c= onst struct panel_desc *desc) > > return PTR_ERR(panel->supply); > > > > panel->enable_gpio =3D devm_gpiod_get_optional(dev, "enable", > > - GPIOD_OUT_LOW); > > + GPIOD_ASIS); >=20 > 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 =66rom an earlier user? Could it read the current direction and value of the GPIO and not disable it if it had previously been enabled? 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. Thierry --1sNVjLsmu1MXqwQ/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJYIH7uAAoJEN0jrNd/PrOh3Z0P/iXS/6kE/KG06XcdFFH3a52k ph48qV7+D77rtV1OZoySJFaKTpyaYfOkYC+DsRs6VzyCq9Dq/t33nXPTPlQZW2+m bnsVCNgLeK5/xaIccVHfkOQLw5ccPui2OlhFFY5dQzMSKsmVjw4NFcO6aTftD+J5 1neZqto71FlKKadZ2Mybp7ClXdGyS8j8MsbftzJH6bnO/q5o0Eaxkex6/GfC+bUB rtVxydQm9u7VloVCR8R8Moby8DyEuRDuLhK0vD4ZcI5+x3MJAfYleudQvNvhi5wg 9g8CoEEVz4Hj7uivVTLeu8qJR+M7Z7AO5PDJJkwsqgKtD/0yEgTT5hm3GVeEKjDF oyTAwsQTSFg928xljv53DJnIKMBKr6aHjmSQyyJmVAgZwOqhzgJw5nV8dbAqIwWo 8RO8HnxwWJ3EB+ycczfayv76OiYaZ4KTobF5YrdjNOO5cDwjDkjF2R5PjK9dSIJk Ql19gFCqANH/QLa86oqBFT/qbQzMo4jKXQ8n4Z28WXmegdIbW//5ARGmro6tStSy GOJkjdgBSzSI//A01RQPo4R7utMmNIiVU/9kdaENxLcd8CjWRa+EfQ6Y1IvRCHv4 i5SO1DxHhJc44RHiLkWMWmhfQOik/KhxfJFtFd23yYp/czlmAJsX0QsVwVNZaAcP ZbzYh7MudlrQFRLgyxAV =uYdD -----END PGP SIGNATURE----- --1sNVjLsmu1MXqwQ/--