Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9803563rwp; Thu, 20 Jul 2023 09:54:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlENVbaM9JwIcHjcKnGi6sEt4TLrnTUg1O+E87dllfEsQ1g2X5vZx3xToQgxyWB3+iKlhdhv X-Received: by 2002:ac2:4c52:0:b0:4fb:8603:f6aa with SMTP id o18-20020ac24c52000000b004fb8603f6aamr3203474lfk.11.1689872086362; Thu, 20 Jul 2023 09:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689872086; cv=none; d=google.com; s=arc-20160816; b=W1IewSoZHRddzSFlb3bKmhLOizL7aDJ76buSENhf4S0LlugSfpQh/KyeOpiJVePAYY YZdOM2lGN2D7duLU+zfd+jG1c9V141C00PHd71mu9AUldL4wR8NDv2j3CcZC2ol9YDSV V8e75jPiNuD5cMtZI6eaq/hPR/YyKANz3DAJJ5TIj/4myaMXI4iteEQLtbPU0bBfcV8R PdhzbJOAGi1Su7cNvP3bOkhJuTMAG7qT0ZWU7fe/QCx6BJO/WSubwHq06Z9odLX2fe1d 7Lb3xcxvhDxq379vBvRLP4fDJ/1bCgYHGFWd3inkni68Pc+7/eVdLabaNb2vfN1ywCNv WVzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ocSaHX5NIVFNKYOsfv6n0BEBaxKRDPz0bQ1Rbnsgza0=; fh=QRO7XXblcFXCIeOmmEGR0g4Qass3ZWPHc1Uj1opzff4=; b=xh89dkiuw6PS4mHZaR4ehLaW0PIrfa/KS6FyhLgTMO6mwZAqW2VwkY77js1fIaI/aZ w1Tv+fZ+ADUZwSU84VU642rrco6H7WkwbB4OWH4wkIwenIQJEFaVhitsir9HhqgPpkn/ yE3tm0nhigatkNFHIVknSsv0qUsMT/NSLR4K3wjdVY53qJmjG3j75BXQKGm4c206nsqg FDjb4HXQahSb2t7MNBSRsAHbSr5K89cap0PktC+cEgffKWrHB6ItM4YzKkwlIw15aAY+ bx9GLFlPZo8fLvhqIHKe5OJrYkVtb6UQhWF9gMxYU0GmCMEui2juPQBunxGiBdYQQxg5 ie3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mpxA7JkB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a50eaca000000b0051e05ba162fsi926145edp.653.2023.07.20.09.54.20; Thu, 20 Jul 2023 09:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mpxA7JkB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjGTQ3L (ORCPT + 99 others); Thu, 20 Jul 2023 12:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbjGTQ3G (ORCPT ); Thu, 20 Jul 2023 12:29:06 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A82E75; Thu, 20 Jul 2023 09:29:04 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b74310566cso15339521fa.2; Thu, 20 Jul 2023 09:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689870543; x=1690475343; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ocSaHX5NIVFNKYOsfv6n0BEBaxKRDPz0bQ1Rbnsgza0=; b=mpxA7JkBj7jv1YVESB2ckxNUJcbRn22fEA0Jt09Oc9l3ibYw+ondIl8GseInFHhKsa LeYX0PQppKzyQtELehqZgaU8ouenxWto3oAzXI/94CCi/2L3DKNAtlj0+IXG6ySgYAlI 8Yv75xKwwNy11tuj5/6WnHqgRqdcGP940Iz5wkO0iqtCQKAg6kDJt/gR7/Izd7Z8A3q8 KmcSaPZ4ZKjhtXZW7ZIkDOcCcOVhEXflJQek0j8b1LU+/nbwV8/KYp1+qOy4Ph13m0vK FnH6qIuLD27RUDxhT/KmsXHT7TzzZSQULB3yZ8d1noJ6p+u9QOp7P+mW9jgyk5RqzX7A wliA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689870543; x=1690475343; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ocSaHX5NIVFNKYOsfv6n0BEBaxKRDPz0bQ1Rbnsgza0=; b=K7cwng99GC1lvlPhosqcGWfqwK310g3v2ZrJmweVdGsRWqdUFDpGJVTg3zuuKiXscq HFZ5xg8wwx8jP9+AFGFV3K+zVuOhb1MBHP7LeD8EQz3YsMJkH23NOjpRwde5TDh9p5Pb h1560kcDMSI3zxqOPpv+kdEqFJVDb5B+k7jarzj3IIGF3DduaFNlAEdy2XlmY4aVYJw2 oab+uXGcKjhyWROA81R7lv9pQu5sRkperfnxdCfdyfCfBt0MMyni6d+BcnrORCrmcOGZ aIY0YDRNAwxs/ScHnKDL5CWKIVDtEBaI0fBudDjC9HonfcAVmXoZrIQymJ+1vDf0azyY 1asQ== X-Gm-Message-State: ABy/qLatirkETS1Mq2iROuLLds6g6Q2ADiuZ7Tn4at5oVcIUeFgDwp1/ xB7bfa/39xn2gJi2y48b5cUgrluocpatu1cbuE8= X-Received: by 2002:a2e:3203:0:b0:2b6:e105:6174 with SMTP id y3-20020a2e3203000000b002b6e1056174mr2751836ljy.47.1689870542887; Thu, 20 Jul 2023 09:29:02 -0700 (PDT) MIME-Version: 1.0 References: <20230720061105.154821-1-victor.liu@nxp.com> <20230720112742.GA2525277@aspen.lan> In-Reply-To: <20230720112742.GA2525277@aspen.lan> From: Andy Shevchenko Date: Thu, 20 Jul 2023 19:28:26 +0300 Message-ID: Subject: Re: [PATCH] backlight: gpio_backlight: Drop output gpio direction check for initial power state To: Daniel Thompson Cc: Ying Liu , "dri-devel@lists.freedesktop.org" , "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "lee@kernel.org" , "jingoohan1@gmail.com" , "deller@gmx.de" , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 20, 2023 at 2:27=E2=80=AFPM Daniel Thompson wrote: > > On Thu, Jul 20, 2023 at 06:06:27AM +0000, Ying Liu wrote: > > Bootloader may leave gpio direction as input and gpio value as logical = low. > > It hints that initial backlight power state should be FB_BLANK_POWERDOW= N > > since the gpio value is literally logical low. > > To be honest this probably "hints" that the bootloader simply didn't > consider the backlight at all :-) . I'd rather the patch description > focus on what circumstances lead to the current code making a bad > decision. More like: > > If the GPIO pin is in the input state but the backlight is currently > off due to default pull downs then ... > > > So, let's drop output gpio > > direction check and only check gpio value to set the initial power stat= e. > > This check was specifically added by Bartosz so I'd be interested in his > opinion of this change (especially since he is now a GPIO maintainer)! > > What motivates (or motivated) the need to check the direction rather > than just read that current logic level on the pin? ... > > - else if (gpiod_get_direction(gbl->gpiod) =3D=3D 0 && > > - gpiod_get_value_cansleep(gbl->gpiod) =3D=3D 0) > > + else if (gpiod_get_value_cansleep(gbl->gpiod) =3D=3D 0) > > bl->props.power =3D FB_BLANK_POWERDOWN; The code before this patch needs a bit of elaboration. There is no prohibition on reading value for the pin that is in any direction. I.o.w. if the direction here is a problem it should have been configured beforehand. --=20 With Best Regards, Andy Shevchenko