Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9581554rwp; Thu, 20 Jul 2023 07:03:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvsPU0hvfbkyP/3RRe1ttg5pk6L0lM2n8g4abxr2V6swP31i7yFq5Nn8L7djstBV+COCXp X-Received: by 2002:a17:906:f9c2:b0:989:34a0:45b0 with SMTP id lj2-20020a170906f9c200b0098934a045b0mr4579796ejb.49.1689861821227; Thu, 20 Jul 2023 07:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689861821; cv=none; d=google.com; s=arc-20160816; b=sUFvbH6RA6p2CF68VZK+1Us4RMB0IUewT9R010J1hifOGbnyHOb4VqbRFf0dJDi46k yP6fFr2P4GDrE2Z3T0XOK2kd54l7aZLclg/uxkujuBkmmN7jtK39laCHRyNIuQqveJ9D a/vXhZOtbwTwigboP6BqapjVZK1yYrhSNoYBWzOeRJkNqpc21pKvPoegcbJ1SMhEPzgO KAcjcG8+bREDW+3x38UEuaH/t3cbDpoVuDIygy/uqMNG0KLeAm/AgE/RBV08bXRXnZwy e6WJd4SUCRYeXgm+K8u24TRhB8VS9S6nA3IwydYuodlUVbEP9LFCNBjMy6eGAuk/EP4U DpwQ== 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=j1ZGppFUGoT15EF4YCw8tI150/zjcmWJj2k2NeFQg9w=; fh=sRREzopSUgU7U8JIeMe6oNxZjZfB4jp+kVxes1mZVTM=; b=lp+C4dU6Ds5G7hfbOnCnDrF0he+G+uJp8+uNcz2XIAsQIeRHwpH8gSOy5HHX7DdjpW YZt0M26fPXg0iGf1K0AO7z457D3SngTLuAO/qPy4KtRdexGbSX9HGVRlRqwr6kzCFcjN G9fTCWaWmFaVSiQq7cH9Av5XtS7pbaX0jHZ/rMIrs5HylMxj6+I8wZyS7nF9BG0yoe74 5baFPWAy9FMQik2KOW5HJBJ6EkvjvfcwyMdtxg0cmt+C/JBUVP+bCZ0as1vJpCwZdBxo +/fV1c/Hl9Rh05dMTeVKMYWlxhZMo8QBNER9qcQmwSDtV8Ue8qsDN851LVR4Y63MhCar rmbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=es0BgeZa; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a1709066b8e00b00982a267a399si674114ejr.561.2023.07.20.07.03.04; Thu, 20 Jul 2023 07:03:41 -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=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=es0BgeZa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230321AbjGTM5G (ORCPT + 99 others); Thu, 20 Jul 2023 08:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbjGTM5F (ORCPT ); Thu, 20 Jul 2023 08:57:05 -0400 Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0F7269E for ; Thu, 20 Jul 2023 05:56:44 -0700 (PDT) Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-48137084a66so333634e0c.3 for ; Thu, 20 Jul 2023 05:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1689857803; x=1690462603; 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=j1ZGppFUGoT15EF4YCw8tI150/zjcmWJj2k2NeFQg9w=; b=es0BgeZaDaDOKqofQU0YHlAOa+KzCTxpREmCuxqWHQtEkfGhmDdxb7N5cUZJTGgMvx xMw9eFq+UZ86AKpp5hN/YnRtAuHi/UOqxhNZEc+5zikZVHRPSyAO5roxPCpH6cCTJ47U 7iiH8DkYAsiIeyNfME+fDNAsOIVby8Xbooiw1MDp+iquFx23/TVerqTlvCw6AHD/gHf/ Za/chXdMetU6rmRSlu0Oaa8ls9PFUMxAcQCVN6p/0jR6wSL1LVUW2o5K0b2un+wGgrwK r1LxlIcX/bB0QRy8XyTF2wz8b/0qcqfMtNSeSQrDqE6tEJqI3uns8+/tKYlWUfXj9YZT C+rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689857803; x=1690462603; 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=j1ZGppFUGoT15EF4YCw8tI150/zjcmWJj2k2NeFQg9w=; b=XymSc15/lkpIr4P6B98kx3WGOHMJnQsTUuI+O+QvmOTH19FVVpDG/wz4jNTTwqgfm2 jzG8BMgbkbagjSUw4T5madmNbPw/gWlPlbi7OBgerB1l9mkypO21Co5rBUD2SUXse71v e5Tn/o2MiuWQAMSEY/2+WqvH3n4VGUBrAQF1ktrqFyt2YoWJj4tCPf0R5Dii+q83FSRw WDKWSq+3n9PC8SmN2oNir5hH+J8hLUfMboXFvma9yh/6zWXR4C1PxK6mDiwN1id8htTC +xmwHTxEEIASSYK2881iVVHqnG0UeZ9MSze5nu7GKcRJ3TX2MZD4NlFkI6H06UsZELVR tzvA== X-Gm-Message-State: ABy/qLb58CXZ5ZPfZKOK1xc9ZUlXj2qqpDjIYa5G3Dee2l443dqJ51PH OGt65pMdqJlVOtiFGCLfVn1PJcLInOoXWakRLF6/oQ== X-Received: by 2002:a1f:cc86:0:b0:481:388e:b908 with SMTP id c128-20020a1fcc86000000b00481388eb908mr5707827vkg.6.1689857803203; Thu, 20 Jul 2023 05:56:43 -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: Bartosz Golaszewski Date: Thu, 20 Jul 2023 14:56:32 +0200 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 , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, 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 1: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? > > > Daniel. > [I'm done but since Bartosz and Linus were not on copy of the original > thread I've left the rest of the patch below as a convenience ;-) ] > This was done in commit: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO"). Let me quote myself from it: -- The GPIO backlight driver currently requests the line 'as is', without actively setting its direction. This can lead to problems: if the line is in input mode by default, we won't be able to drive it later when updating the status and also reading its initial value doesn't make sense for backlight setting. -- I agree with Thomas that it's highly unlikely the bootloader "hints" at any specific backlight settings. That being said, the change itself looks correct to me. The other branch of that if will always unblank the backlight if the GPIO is in input mode which may not be desirable. I don't see any obvious problem with this change, just make sure the commit message makes more sense. Bartosz