From patchwork Fri Jul 21 07:31:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13321461 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3BAEEB64DC for ; Fri, 21 Jul 2023 07:31:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E753810E0F7; Fri, 21 Jul 2023 07:31:42 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2055.outbound.protection.outlook.com [40.107.22.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4368510E0F7 for ; Fri, 21 Jul 2023 07:31:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IstlTZQfyGK8MwPmCmcPJzFjVNgbHQDJXtEudeebA0pln76iMBqNt0ig4Gdp/z+XF7QcQY4Z/DTrnH9T5z1+AHnBDFyV9qAfzKURoRzNeFqNMBMM4ggZ6DZIidTRoLmY7YxeS+F5nTgyioem8Dy1N9KbZxaqMO1VJcPB3Mt72Ftn1ci8gFPStRPG3gPUu1NJZdOTnTc5sLFDtnHQC3ib62YR7M4tAD8K2qfwjez0GRuW+vh88VZgh+Tq2zmsrKRiA6bbOcZzS3QXXP9hEgQWKCigc1v3N3IO+rqyvDkzwJM/gLXB5GJzctx/6nu7FcvWSLH+GIUg8SNiKq3yKfJGaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5UNaZGNev4novCdYIm2ldQldfepvYxuod0+t8U6p2bE=; b=BQqLJdnBd+HKF1GtbwCkKC2K3zVYQ+KreuMbNiajhFAbHGc6XKnTCTHKmLOyTNYYIZqIEqYh3bF0PEd2Wdx+cLj7MlW1Ixa01zpSBvsxO3kkJ9S1utaUaCqYqmIyzyOsNrjIK6Dh4y7D+pzft884IxK1cAIWUGuJXJWFM/ZFP4mKT64C2A2g0gxccwcx6uVw56EmWh0xOQalz3AAhQUmf62e1/+XKxLngAnz9ZnaIbN1/60qGea0bQOBMaXDF8q+Cu+z6HgaxLzafhVvF730lXKDkOEznpLv34ENO73BPimLll8L5Ac80jbLArgrZ+tBHgPPjJitEbRqG2goofGmAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5UNaZGNev4novCdYIm2ldQldfepvYxuod0+t8U6p2bE=; b=apo0NwzxNovDhbNlVdYzA47r17qHIXZmkFhzaAeg45XQrpipf8oQ8o6ZKXUQEbwg4J1VnFqe2oyx+n66/wkfy/mCd6Nf8YZHL7zALRNqWmnEhRRawms6q0yxrQA9o85ym7BITyuw+4a5nRXZERT672vQt/Ym5tlkzVtdsm2ZjYw= Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by DB9PR04MB8314.eurprd04.prod.outlook.com (2603:10a6:10:249::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 07:31:37 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6609.022; Fri, 21 Jul 2023 07:31:37 +0000 From: Ying Liu To: "dri-devel@lists.freedesktop.org" , "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state Thread-Topic: [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state Thread-Index: Adm7pWHkE3L5gGu8m0ilbj6s2t0e8g== Date: Fri, 21 Jul 2023 07:31:37 +0000 Message-ID: <20230721073555.1377236-1-victor.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:3:18::21) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) x-mailer: git-send-email 2.37.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7PR04MB7046:EE_|DB9PR04MB8314:EE_ x-ms-office365-filtering-correlation-id: 2e085f9b-d50d-4b48-3c54-08db89bc846c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +7tibUE2ixVyDDKbsvQJXaf7iGtraVMkAfl7qeVcNzMNGkupfHofn98EEBd7kDMqnh795bITKeyAKhYtRW6wQ8tYYy/CfKBMQguGn51/tI45AYSvQ81rMf3fOoKn/jHwY8zksv/cOvdtMoA4l2HsV91JAvIuedRb1zM9teeEr3DgL7hD0+p8o6Q9lr5BctIKzvtkK7m1AgoGc7JorrSnmb9/d3YroWSXDK3qT8N4x3TvixgfmOToaHeHec1WLLxZxINgADcsUHd78XAcuGrqKmUJSw45yatbNFN5rLPbKGe7uboKNxxwz1Vaendb6ERW9y8pyfGHqqMK8bfV8B/8Ggh8NYacJI3ZlfWhgtYYww+dpyCsAE4CmHTORZMkYDCYb1TMuH8hLFTXOXJItQyEAlFfPnmd41iTyYMUGYHXlF1mc+xBam5uTancC7k/+qRXnBN4BkMbOJ1ZhaB+BfOVKcUn9RuMO46uThsA8rkrWRWf59rijKLLRI6E2q8ZC0wtwSUhPeKbSqIrmC70sXcbzsxmDy5KIt6uSFFCXZ1KMMsjjLZM245ceNR460hnYESYV6r1PlKwcnZKRKEhQihlVe06bZHJIGj6WmsU/X6D7dga8f+JUhr0mQ53GLpnZdG4 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199021)(6512007)(71200400001)(64756008)(66446008)(66476007)(66556008)(4326008)(66946007)(52116002)(36756003)(6486002)(2906002)(110136005)(54906003)(316002)(478600001)(86362001)(1076003)(6506007)(83380400001)(2616005)(186003)(122000001)(38100700002)(38350700002)(5660300002)(8676002)(8936002)(41300700001)(7416002)(26005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?NiWZE13aWilcX0kM2AbE2ej?= =?iso-8859-1?q?B7ZnwfX3G5lRc3a3p+L5IIQ7ZH/IT6xdFb40vcyO3zVMJgMJoMKMfVgSR3Ev?= =?iso-8859-1?q?iAH877mQC7YHlDfw3c1qVtaiqoCE7eEa35byIsP1mGdy/9BAsCygwgfaZm6+?= =?iso-8859-1?q?vOHvnWNi4a7pd8JB0C7dngH8jPdyKzljh3PtYCy2Q342SUZzK9F63wqg0tyQ?= =?iso-8859-1?q?3VBJ0II9Mss2+n11vgedMHiMzB/Pe0zdKWVeRPzzPDpF0HrhqSAlON4WPM8Y?= =?iso-8859-1?q?drKn/yNf+kr5CBCQCSqC6TFbt7irsmrFMYeC7jKs/hFDVHM4f6rpU3hM7XEE?= =?iso-8859-1?q?3ci7I3726kBMYehN6fhSQ+vc+DtD5+Ok1A0rZVdKUuPtb1Ovd6VVS2NzdTDv?= =?iso-8859-1?q?lUtBHJX1edhgW38LwfgkjNSDKlkHNku7CXai31xCPWf74x83JQz6RxFSetVu?= =?iso-8859-1?q?AoflAVZ1qh4v66fO49A9tDUNJgcNTCQ9TyjYBz5xZWlQVUacKbKpqLqo2YX0?= =?iso-8859-1?q?ensxARagmly4k0FSXMYHIqI/e1EbHFoYU9GwogIlDP2dwdYE7whsYBi9Cdhs?= =?iso-8859-1?q?WCd9M0yTCL8Z0pNqppEbMp+op+cab6386MIkqCzOlnhwfCjzk04sJqXUo1jK?= =?iso-8859-1?q?ncKk/KBnP5YnV3FfrSPtNldelSm6diag4pv93xUQhgDO/gWyNeBOqwDqbRB/?= =?iso-8859-1?q?lZLTbNenvqWA9itamjbWXiyTJsuGUthsiZZ4gvxOcy6YZaKnlZCAjyTZfkOc?= =?iso-8859-1?q?BuweJzg0ssnxQN69YqjlmHk7X8fCQm26WmEZEjc4T/Zpl14J1GBGw6y2xat9?= =?iso-8859-1?q?zhD9FWsQrZmn34nEBaFf6j1zuiLJPi0Lwp0WmcnpbrC9jf22D7CIW/3S0gcx?= =?iso-8859-1?q?vMRMP2bqOz51yHY3L0vsN6LgJDGC1019m039OOdOESCXBL72v+atGVJA+O++?= =?iso-8859-1?q?tIDJhZXUln17aW4finlS/bfOiKC1SPAZSVCaH7jMXZY0RLPbXh0o12gyHoXS?= =?iso-8859-1?q?+1HmVkSBXui6n+vsRoTbT1fjXa1Iege8u0kiqQ5r80bkx0pBLpdiUFYy+1yK?= =?iso-8859-1?q?NP4GaUpNaVJzA3qogfD15E8i54nmdBs0VyjdERmFl1ZR56OvdGbHtDsIy0VB?= =?iso-8859-1?q?kbNljBuQBR7vDnmFe+e5ldmgB1+B2baKC9sU5uOz3V9doW4mUPMP8c8+fsSr?= =?iso-8859-1?q?NFzPQewznRPFLAXVcHXY+Eq8Rk7hWTEAsn7PCFm4qMZ8gNZ1blc5xInd6Bo3?= =?iso-8859-1?q?Frsqj48WW5EMY8I4sxgH4unVLqfrjwWexaO1H/22xyUcDEoPY1OFiP3jgfyM?= =?iso-8859-1?q?khHX6iJ2N3dh40iZkEu5izjege1aYc+tClu/PGPXw+tGPsAzWSYkbMBbWVHv?= =?iso-8859-1?q?32XwFF/CRGZMBne0TtAomte+/S5mzcAw2m/zKeumnVjnC5N67IISbR5oEDeS?= =?iso-8859-1?q?vnPm0OmOVWUwtepMmYQ2N0/migLZ4JOlOqXTxDeDLSKYd8A4cBzIzOfANBiM?= =?iso-8859-1?q?d6CJJmdK/K0nRYc6VtsXjR3t7IP9Xzz3nnnQ/0w6eZEdUyI7xFgpaqXS8tA4?= =?iso-8859-1?q?UmNZQ7enLpgv8TOFOx4k0RsXHZ559aMYx8V+OozRxgTSayl8AkvtD7TwVDAX?= =?iso-8859-1?q?Dgn1RjOjigdnv8inf?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e085f9b-d50d-4b48-3c54-08db89bc846c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2023 07:31:37.0813 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LZy4KYHSMWqSHLFxcpyCzH7jAD9f68gPGQkMt9BCieqnR0+5/zo9ERsj4i5yWsnt64RyqvyktefiGtPzF5vLNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8314 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "andy@kernel.org" , "daniel.thompson@linaro.org" , "jingoohan1@gmail.com" , "deller@gmx.de" , "lee@kernel.org" , "brgl@bgdev.pl" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If gpio pin is in input state but backlight is currently off due to default pull downs, then initial power state is set to FB_BLANK_UNBLANK in DT boot mode with phandle link and the backlight is effectively turned on in gpio_backlight_probe(), which is undesirable according to patch description of commit ec665b756e6f ("backlight: gpio-backlight: Correct initial power state handling"). Quote: --- If in DT boot we have phandle link then leave the GPIO in a state which the bootloader left it and let the user of the backlight to configure it further. --- So, let's drop output gpio direction check and only check gpio value to set the initial power state. Signed-off-by: Liu Ying --- v1->v2: * Improve patch description. (Daniel, Bartosz, Andy) drivers/video/backlight/gpio_backlight.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..38c46936fdcd 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -87,8 +87,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) /* Not booted with device tree or no phandle link to the node */ bl->props.power = def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; - else if (gpiod_get_direction(gbl->gpiod) == 0 && - gpiod_get_value_cansleep(gbl->gpiod) == 0) + else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) bl->props.power = FB_BLANK_POWERDOWN; else bl->props.power = FB_BLANK_UNBLANK;