Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1590923rwr; Wed, 26 Apr 2023 18:17:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P8uv33MKtTma8Argy4KzsiA0RlNtkvgIk2UXjzLIYoKTXCAS4qWmk8a/FHvnb7LcOBuEr X-Received: by 2002:a05:6a00:1791:b0:63b:8dcc:84de with SMTP id s17-20020a056a00179100b0063b8dcc84demr358945pfg.4.1682558270215; Wed, 26 Apr 2023 18:17:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682558270; cv=pass; d=google.com; s=arc-20160816; b=j7beVFV77MrXjXeqEiZeoTpxbQa59jFtDMcgVS71i4N6HCfIhpkPbjtUfTOKg+nZHE lrximqui+Bme4oWGeWAnTeYMUiAVLgc4uF1zGgdyo31en0AWQ8NY3HavqktovK/o0jtf c9LSEjPXFZcgiFLwj7EPKMxSxhevFqUbQGA8axBFqQR1bBSkLQZSEtHM3LGAoJ7WY/Ye QFE0NXdro7hj4Cbb/GE9mXo9d/HP6X81Kt1QFD4yVYmp1PPYvTxxOQCRN77Z7gNnFXxb IaO+IZUT5uf5SmuC93S4NtoLPacMXk0XcfU8jpSiJgkjfGeHjVueetzZosF6noTeq6kK EDtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qAUq711HcYSqYuPgIlxU/avkF3pSpFk4gqq8i8Eh2zE=; b=z8OM4mdZA7s2G9Ua+ps3/bHSSREZK1K2uUJDAJuEyKocmBIU3WGCzou64qiZrCdDvQ f52i1ZaX3ZGiTaD+lGVD3vs86Pk92WRWsPmS+Qw99ItwEZ0bzOZnsotLlmqyoNo3gb90 lu6OX7Y9z8EjwGtSh6d6nPHpICDfGxVguXgQGzQ2rK2iItH7Rr4h2IDQYncNXQi8jmnk ZU4jONIIaFPCd9FQhOd0evAflSMZDa5yBGjDTsA5IztoIrX7e2IMcPTwSMs0LmTCxq2l Wz/HMU44PxVgT5ptcDtu/GN9SG4w20+xOGOh+g/luyKfefhsTCJJtVK8ugHCT+ihP1bC m4jQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=VI+tBHEZ; arc=pass (i=1 spf=pass spfdomain=labundy.com dkim=pass dkdomain=labundy.com dmarc=pass fromdomain=labundy.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a056a00008f00b0063b817e3f1esi17335919pfj.166.2023.04.26.18.17.38; Wed, 26 Apr 2023 18:17:50 -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=@NETORG5796793.onmicrosoft.com header.s=selector1-NETORG5796793-onmicrosoft-com header.b=VI+tBHEZ; arc=pass (i=1 spf=pass spfdomain=labundy.com dkim=pass dkdomain=labundy.com dmarc=pass fromdomain=labundy.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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242796AbjD0BII (ORCPT + 99 others); Wed, 26 Apr 2023 21:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240955AbjD0BIG (ORCPT ); Wed, 26 Apr 2023 21:08:06 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2072.outbound.protection.outlook.com [40.107.237.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7A9C0; Wed, 26 Apr 2023 18:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JR7j42Z5mNNhZUJS/HsgT7MEsNIxGS88NZe2bbmgmTjDSW5V7B9FDBPNARFm5KnDFEzkX1KszqhN0h5q2ubGny1JzzTZSdTLQRwq8we1Fza1tTjljuT2xuhq3ipeYGQM11leSuPGJfe6gBUxeo/DGvT1+rpw1QKNClQqCqJiaZtJXicisbY0jprrEyXE3+7OXDag4lPkkwvXoUiPfK0Hz6Z0YkMTCxcPSF63i6afOWDnP9nKW4aYqXCqAHCTAYcNux+raX8GlfGyB5tEU6asvDKsxqwVtmfa39NCrtjbZhrApoNpQcMPSSLAXR+26U3WXmrQeQaM0p5GFiEY47AENw== 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=qAUq711HcYSqYuPgIlxU/avkF3pSpFk4gqq8i8Eh2zE=; b=D18yE27YufomwbNkVsUGjGlxailkvn7ysxAe0HM87+khgezIXdXy/UK5xfhziMzoiH6907qegaYP7fQLAcKKyv+Q8Ze5CE34++FJUnmTx2ZEAMzoOVk6SL723YBw2umOaXfTj5k2Oj67GrlY4mcY8WiusKVfbNQS6OxictTabDUhvuqJ5UByggTeusjKkMsoOOCrTg2PlAT3Pkfk7w6gCKM1d1ecuYp4oLfe6iOBhf5d46hF3Be1O3r39lM3o1mGHEYvfXE9plTTeEJ5h0N8OllI2qep/VHDPhHDaCYGIrmQdG+akLcnuHehDN+i8/NNI1IA/mDOMFme9rxaObM6BQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=labundy.com; dmarc=pass action=none header.from=labundy.com; dkim=pass header.d=labundy.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORG5796793.onmicrosoft.com; s=selector1-NETORG5796793-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qAUq711HcYSqYuPgIlxU/avkF3pSpFk4gqq8i8Eh2zE=; b=VI+tBHEZGQgyAew5hqtcwlprAkSvILqqtm/OnFsBG5n/Onu/n8bpczm4iNLSzc8dpOkZvAINetrHQDWrMhFrvUfY73Vza0ONxhsJHAnlqb29cfROyNwjYXKYHbRi9F7SCPnLxI1/gBLVGt7GcvwlxgTocVuYAEZZvCQ5EbIU1lI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by CH0PR08MB8684.namprd08.prod.outlook.com (2603:10b6:610:18c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34; Thu, 27 Apr 2023 01:07:59 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::20b4:97da:18df:16dc]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::20b4:97da:18df:16dc%3]) with mapi id 15.20.6340.021; Thu, 27 Apr 2023 01:07:59 +0000 Date: Wed, 26 Apr 2023 20:07:57 -0500 From: Jeff LaBundy To: Fei Shao Cc: Douglas Anderson , Benjamin Tissoires , Rob Herring , linux-mediatek , Dmitry Torokhov , Jiri Kosina , Matthias Kaehlcke , Stephen Kitt , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] HID: i2c-hid: goodix: Add support for "goodix,no-reset-during-suspend" property Message-ID: References: <20230426144423.2820826-1-fshao@chromium.org> <20230426144423.2820826-3-fshao@chromium.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230426144423.2820826-3-fshao@chromium.org> X-ClientProxiedBy: DS7PR03CA0022.namprd03.prod.outlook.com (2603:10b6:5:3b8::27) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|CH0PR08MB8684:EE_ X-MS-Office365-Filtering-Correlation-Id: 94f53591-8648-4172-e0fb-08db46bbd798 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JK0rpSzMjyeruR/+o9YJidC0GYYxEnOl9Q9G40SLB7pixUh/pOMG0yirBDpqKwW6pQckaCkoqcdnouX5sy9T0npsUNjZtRmnxYKaPVZkZhpvYAv057xC0F8MRiZFfUoKHt+ROpy7Cjt2+KoGwKkcArKg1b3Y0pfXKoBTYLTGZiLTcLoNmwWRrLvIUFMVYMkYL1G90/MAvQo6THc7WVLK63MqA6d6THJtlnkFAWShr2T4DgbyCTrxEzaVidBVNSW2t3gejxp9x0kVCs6tic2Xgm9yWlD5r08AABf153bY2SJLoHj8gFXszIsuUnDp2eU8AvtxGSAxHu40o25Kt/091f7Qqn5hFB9pooS6eNw6WcWRb4MrKnMlq6xfmxPD2H4JN2KbupSAC0o303RNPyEmzcR45919Cuu+hJe7ji9r1OOWBf4N8BVKNQlXMnIQGmbWa07aUNvnvlGY1cMOrwSbU9yK83wM5Sk8hFmUZud9PeVdtniISe1kNJ1NtKXm6PTf/QPm+FiGLZkqy97KBavsvNwpYyIxIATOn+FxpwY8Ag7PFoUAH7megIqsI/UVWxzDMgbGkCWbmmJ1OMqQzzi9A5INvhhNZr7Dikwl8G/lQng= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(376002)(366004)(39830400003)(136003)(346002)(396003)(451199021)(54906003)(478600001)(86362001)(38100700002)(33716001)(8676002)(2906002)(8936002)(7416002)(6916009)(15650500001)(4326008)(66476007)(66556008)(316002)(66946007)(5660300002)(41300700001)(6512007)(186003)(26005)(6506007)(9686003)(83380400001)(6486002)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LdkbYZElJX/FFeSAhufRIJoQ2XebNUSVIIBIKrjbWGug6DUnepLFwgISMaAN?= =?us-ascii?Q?yoQtE3AoRN0IaNzktXV0hnTu1IaLSOxGcP58zJ0aSZvPoRSu6bIyrTfWhY2w?= =?us-ascii?Q?S2XGGFjAWRGiT9pas1rcMYGcJSsXDOKPhJY9y/D2DeeCtYjoLZ5n2vHNduIE?= =?us-ascii?Q?bKZjQ6GwP7KRomx1VNHNjaFnTe6WZbWrn9JlfALpS12mMoo+A9BHWQ39GL/w?= =?us-ascii?Q?L37OJuLYSotucFjcqwqV9u6kIl+paXfKNrYd4rkCUOF19eKtT27TwJZT0smp?= =?us-ascii?Q?YsayV2sb3EjtIob98D5vyWgg6Aun8Uo2OL7UbeNuFssqkGeudR7/mGCXfTig?= =?us-ascii?Q?yeJ4fvQIT/3p6tADjpXgLdHj5yihsYthHslTiHF3yCUFAkCsHOdkX51jah9G?= =?us-ascii?Q?SEb/7TVaXLGLXCttOvfMhi+UbeJU4LIiOs6QfCpX8NGDOj3+2EWxizT0C8Ac?= =?us-ascii?Q?G9swvhaN1C2vid1pAo3C2X8Ph43fS3e7dJDEeGUoSKFeUmKCWuHihJJ4EKPi?= =?us-ascii?Q?MI6i6hAlieLIEmpJN52uLiKmPpmzCR8To16Wlryk/abPq5EVE25Z3e3/i+Vk?= =?us-ascii?Q?BMnWC/kEPL3f8nRT0gpExl7toabZgsOfPeGXQqFWcDIO21UxA1m92XIjZ7wa?= =?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HS13MnYV5/nPy+p/JNZWSLGNCh?= =?us-ascii?Q?0FecsGSCmrgl/1y6INF3KVoTYlkHxId9Rb+B2PiP?= X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94f53591-8648-4172-e0fb-08db46bbd798 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2023 01:07:59.4596 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 00b69d09-acab-4585-aca7-8fb7c6323e6f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mZIgLvIU/wEN4JgKivm9ygwiJagtNF01RAGEifQ5s48xWLRpPwlkFT+LayijiIeJcMFs5v8tqkKvw/aWZjoxjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR08MB8684 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 Hi Fei, On Wed, Apr 26, 2023 at 10:44:22PM +0800, Fei Shao wrote: > In the beginning, commit 18eeef46d359 ("HID: i2c-hid: goodix: Tie the > reset line to true state of the regulator") introduced a change to tie > the reset line of the Goodix touchscreen to the state of the regulator > to fix a power leakage issue in suspend. > > After some time, the change was deemed unnecessary and was reverted in > commit 557e05fa9fdd ("HID: i2c-hid: goodix: Stop tying the reset line to > the regulator") due to difficulties in managing regulator notifiers for > designs like Evoker, which provides a second power rail to touchscreen. > > However, the revert caused a power regression on another Chromebook > device Steelix in the field, which has a dedicated always-on regulator > for touchscreen and was covered by the workaround in the first commit. > > To address both cases, this patch adds the support for the new > "goodix,no-reset-during-suspend" property in the driver: > - When set to true, the driver does not assert the reset GPIO during > power-down. > Instead, the GPIO will be asserted during power-up to ensure the > touchscreen always has a clean start and consistent behavior after > resuming. > This is for designs with a dedicated always-on regulator. > - When set to false or unset, the driver uses the original control flow > and asserts GPIO and disables regulators normally. > This is for the two-regulator and shared-regulator designs. > > Signed-off-by: Fei Shao > Reviewed-by: Douglas Anderson Great work; one tiny nit below. If you do not agree with it or have found precedent that suggests it is OK, feel free to ignore it. Either way: Reviewed-by: Jeff LaBundy > > --- > > Changes in v3: > - In power-down, only skip the GPIO but not the regulator calls if the > flag is set > > Changes in v2: > - Do not change the regulator_enable logic during power-up. > > drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c > index 0060e3dcd775..3ed365b50432 100644 > --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c > +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c > @@ -28,6 +28,7 @@ struct i2c_hid_of_goodix { > struct regulator *vdd; > struct regulator *vddio; > struct gpio_desc *reset_gpio; > + bool no_reset_during_suspend; > const struct goodix_i2c_hid_timing_data *timings; > }; > > @@ -37,6 +38,14 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops) > container_of(ops, struct i2c_hid_of_goodix, ops); > int ret; > > + if (ihid_goodix->no_reset_during_suspend) { > + /* > + * We assert reset GPIO here (instead of during power-down) to > + * ensure the device will have a clean state after powering up, > + * just like the normal scenarios will have. > + */ > + gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); > + } I don't think curly braces are technically required here, as there is only one statement within the conditional despite the comments making it appear otherwise. Maybe this would work too: /* ... */ if (...) gpiod_set_value_cansleep(...); Again however, I do not feel strongly about this. > ret = regulator_enable(ihid_goodix->vdd); > if (ret) > return ret; > @@ -60,7 +69,9 @@ static void goodix_i2c_hid_power_down(struct i2chid_ops *ops) > struct i2c_hid_of_goodix *ihid_goodix = > container_of(ops, struct i2c_hid_of_goodix, ops); > > - gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); > + if (!ihid_goodix->no_reset_during_suspend) > + gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); > + > regulator_disable(ihid_goodix->vddio); > regulator_disable(ihid_goodix->vdd); > } > @@ -91,6 +102,9 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client) > if (IS_ERR(ihid_goodix->vddio)) > return PTR_ERR(ihid_goodix->vddio); > > + ihid_goodix->no_reset_during_suspend = > + of_property_read_bool(client->dev.of_node, "goodix,no-reset-during-suspend"); > + > ihid_goodix->timings = device_get_match_data(&client->dev); > > return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0); > -- > 2.40.1.495.gc816e09b53d-goog > Kind regards, Jeff LaBundy