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: 123620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp32309vqg; Fri, 21 Jul 2023 00:36:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlHzArWhN3QqCaL6MujpmNm7HACagrLJhKVHxJcBQ26oUA2gZUtcjyp/jT5dl4iO0OedDnC9 X-Received: by 2002:a17:906:1098:b0:982:a454:6d20 with SMTP id u24-20020a170906109800b00982a4546d20mr1114928eju.54.1689925014372; Fri, 21 Jul 2023 00:36:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689925014; cv=pass; d=google.com; s=arc-20160816; b=bHWZoBIC1LIQyOxJseryj1USX8K69ds2N9Zs+hCJ0KAliq7+jUkYCICj0xoGQ5nsHr 91k3W5PdxNV5IIcDH5dzG8w3QiewyUd+DdLJRc3ocNbFqAESjR7KPFcGVHVJ7YlJtOGv 2o6euDPEvzx1P7JdyT1hWKM4bIUs4YAgDMqpf4/Hff8F5A5ERjJUq/H5rsAfpQ8j9JmZ iwmQ4sS09TGmHIKkQU4qIyJ3pcurlj5t5MPj8TvERL2yO5y2dmXAnpbljcCrG/5VWn/G CL8TYOfCUhspoc3z8WwTDOGAQDQGKv84H185NwP0/rRKzkPZbRTbhEaKLPoijImC3eGM pQiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=5UNaZGNev4novCdYIm2ldQldfepvYxuod0+t8U6p2bE=; fh=JjrxNEoPAioc1w1P6PWbeVrAbJ4DTKvD7s67NCSML84=; b=jmTgWO0LHrJ+BGqoORFphc8Rz7otAyyHsWsp/Ml/QyWOdHEpAlHo3YMiCeIr6NBHeI u8DKOrDVxxhbI6eQUX3sdEEDGu/Khf1nKthwTSdZUYCUdsXew1vi2TKa9FMe6ZQ8Q5hm N3MyBtLHj2DdsT03oFZxa7QS+uUUtM+Kx6Tsy3/84n0F1NTTrxkaHOv+BmFSz3XwttZ5 PY9GXfP2FiCEGXQF0m8vaPNo8y/sj/NTBYZFB/Is45dqHERw1tIy4cIS8k+97cP0PQAY BrZM0hL0kDZ11XeDcM+BPM5VAluEe7T3781FHezB4UdZXg4QZmmR2mkwgEndmtCmXbZL A9Bw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=apo0Nwzx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc12-20020a170906f90c00b00987383af65asi1692583ejb.582.2023.07.21.00.36.28; Fri, 21 Jul 2023 00:36:54 -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=@nxp.com header.s=selector2 header.b=apo0Nwzx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229736AbjGUHbn (ORCPT + 99 others); Fri, 21 Jul 2023 03:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbjGUHbm (ORCPT ); Fri, 21 Jul 2023 03:31:42 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2077.outbound.protection.outlook.com [40.107.22.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9861199D; Fri, 21 Jul 2023 00:31:40 -0700 (PDT) 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" CC: "lee@kernel.org" , "daniel.thompson@linaro.org" , "jingoohan1@gmail.com" , "deller@gmx.de" , "andy@kernel.org" , "linus.walleij@linaro.org" , "brgl@bgdev.pl" 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772014811691422181 X-GMAIL-MSGID: 1772014811691422181 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;