From patchwork Tue Apr 18 12:49:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 84840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2831979vqo; Tue, 18 Apr 2023 06:06:36 -0700 (PDT) X-Google-Smtp-Source: AKy350aXnTiXGodEamwyzqFrM7np1slF93FMmsguVKVsegMIH8HPRFUrEZZKd0mg+d2RPKIwQNiN X-Received: by 2002:a05:6a00:2e0e:b0:63a:ea04:634a with SMTP id fc14-20020a056a002e0e00b0063aea04634amr27052737pfb.21.1681823196295; Tue, 18 Apr 2023 06:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681823196; cv=none; d=google.com; s=arc-20160816; b=OiE2trk31Wi2qurHqJwtVhxxvTRKPlPR7eBGdcN3/lImS9VijDgA8OayJlrSSD9VcJ owK8y6XyyoNQx9HB4+GaCXK6XTDwpLLIXgJgmYh9SLNHH00yRs/UTLUnAXCmyG5y0Z9V l+6aaRFlW4iC/6unZOLJ3BZfD8XTbtY2bEgPLskTGSmwldUQt/HCjvGhpsoWG1c8loci /+uAT0FgyG/r3HtgjZVGSJO/Aw64lcQO9nlwGe5xIm6+RQAiMoiPJOmCxbDq+ohug5IZ UPS9zJIqqQB5octokRmuhT0rqDEV02EV4ZlmJ2C+v4i5lZ8T7Y2tD30E/KlktgZfmmpH V3nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y4OHoFWLVHVOU1gGJFIZyvFQwj4I/n5rmO4u4kQqp5s=; b=lPPE/r53epCDXvcXQYXpzUb43g4aAMFsuM+a6byMxMf2pGXK2EzF7gtgYyGrFzngvs EDjUx31kpG4/0B+tc5Y+nrGSFpYmTLqdh9aXjWuSrBZ4BUitz2MSq6k0WXJI0OZyrUNB wFi+2hPTsG965PrkJxHs0nKwIhdkCqZ2aHUrmt+CYk+q6W1MzlEDSSLnPCKCPJ1RKNj5 iFEoIqxZ+ahd+xHzRYhGD9X8zAtj2EiS0a98Xx4l5jClj2crNqhlgYhDSQunQvG00QEJ 2caNVdKx1fyDduEYxlz5HYZd9aOdHoXkDPZ5CyiB0kNNmfXglLoR3rOfI0HQ3/kb7BPI bDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NaZDAMGr; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a634a0f000000b0051f0e959dc6si2475666pga.483.2023.04.18.06.06.21; Tue, 18 Apr 2023 06:06:36 -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=@chromium.org header.s=google header.b=NaZDAMGr; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbjDRMvR (ORCPT + 99 others); Tue, 18 Apr 2023 08:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbjDRMvP (ORCPT ); Tue, 18 Apr 2023 08:51:15 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3265716B14 for ; Tue, 18 Apr 2023 05:50:53 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-63b5fca48bcso1709370b3a.0 for ; Tue, 18 Apr 2023 05:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681822252; x=1684414252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y4OHoFWLVHVOU1gGJFIZyvFQwj4I/n5rmO4u4kQqp5s=; b=NaZDAMGrk+xiKbfMXkfc+hiiltFD0LlTuSqiIbDBkpzWQgLVSgj/O48zJ7VMGlzp68 pCDOEKpcmGwFU7dSgwQqjWorn5Z13vwzcfdi34+M2L5EwoQEbckdcNX1V9iuSn4j74qB 2IMNQfjqpLvm8WWUqmBcV11cHsW5gXqch7xqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681822252; x=1684414252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y4OHoFWLVHVOU1gGJFIZyvFQwj4I/n5rmO4u4kQqp5s=; b=JHGaqnaUaIUY+bpfM77v6IZYCU14s+Xb5uRK+kA1vXfWx+QvBXUDkLyC/PM2ytxzEl jif4nHtKorcEsW8EBEdpE8H92XKB/3nvBjyW/OMWFUUFDhZRhk7D8eWwOshyOAWRXAgh SgAaS/bLh7ApzklDd6wkPf+U4XpmoNwQS/DkIcDjaLZr2Oevr8DeCa5jaysPtFFgoFy1 K8+deOvjqf41jKeZgAraURKCySbmS5uaPCrb9937XdIbnXysmDXy28TKrv+I0ha5Cnc7 mVOo9h+gMr67fKlBhXkGCV+mbL2bdlfjfpOwU8x3Hk4n4xLJjTLWGKgbCDWufa89Mokx tP/Q== X-Gm-Message-State: AAQBX9dDOmZpIntqrP0ioBv/f2Z5LlX3pYOPobg63GhdFcf9Gny2ImeO 35SkQJBt5ueODqLZ03ZSipJ7XQ== X-Received: by 2002:a05:6a00:1483:b0:638:f0b1:4df1 with SMTP id v3-20020a056a00148300b00638f0b14df1mr25744364pfu.24.1681822252585; Tue, 18 Apr 2023 05:50:52 -0700 (PDT) Received: from fshao-glinux.tpe.corp.google.com ([2401:fa00:1:10:2fb7:301d:6083:752b]) by smtp.gmail.com with ESMTPSA id v11-20020a62a50b000000b0063afb08afeesm9323733pfm.67.2023.04.18.05.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 05:50:52 -0700 (PDT) From: Fei Shao To: Benjamin Tissoires , Douglas Anderson , Rob Herring Cc: linux-mediatek , Fei Shao , Dmitry Torokhov , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: input: goodix: Add powered-in-suspend property Date: Tue, 18 Apr 2023 20:49:51 +0800 Message-ID: <20230418124953.3170028-2-fshao@chromium.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230418124953.3170028-1-fshao@chromium.org> References: <20230418124953.3170028-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763519440248737005?= X-GMAIL-MSGID: =?utf-8?q?1763519440248737005?= We observed that on Chromebook device Steelix, if Goodix GT7375P touchscreen is powered in suspend (because, for example, it connects to an always-on regulator) and with the reset GPIO asserted, it will introduce about 14mW power leakage. This property is used to indicate that the touchscreen is powered in suspend. If it's set, the driver will stop asserting the reset GPIO in power-down, and it will do it in power-up instead to ensure that the state is always reset after resuming. Signed-off-by: Fei Shao Reviewed-by: Douglas Anderson Reviewed-by: Matthias Brugger --- Documentation/devicetree/bindings/input/goodix,gt7375p.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/goodix,gt7375p.yaml b/Documentation/devicetree/bindings/input/goodix,gt7375p.yaml index ce18d7dadae2..942acb286d77 100644 --- a/Documentation/devicetree/bindings/input/goodix,gt7375p.yaml +++ b/Documentation/devicetree/bindings/input/goodix,gt7375p.yaml @@ -43,6 +43,12 @@ properties: itself as long as it allows the main board to make signals compatible with what the touchscreen is expecting for its IO rails. + powered-in-suspend: + description: + This indicates that the touchscreen is powered in suspend, so the driver + will not assert the reset GPIO in power-down to prevent power leakage. + type: boolean + required: - compatible - reg From patchwork Tue Apr 18 12:49:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 84834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2823164vqo; Tue, 18 Apr 2023 05:57:02 -0700 (PDT) X-Google-Smtp-Source: AKy350baO1JB61PjFAdc9hxQr9q6MjOOSdfvS0+n0EhxvHb33DUhmC9chZEhum12WCjxrjVw2AkG X-Received: by 2002:a05:6a20:42aa:b0:ee:bfc0:2bfe with SMTP id o42-20020a056a2042aa00b000eebfc02bfemr15134845pzj.60.1681822622092; Tue, 18 Apr 2023 05:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681822622; cv=none; d=google.com; s=arc-20160816; b=Fmd20/SbBBnNgFF6Oj+aIxON/sxuDPv3FazsV+7/7YLTwnSZppK/M8aq9LFe2m7f/C KJa1hNtSLCQQmBDiZSHYCD63Gg7AlXo68lU3e6G9cSSDibVF/O/FO5Dmy3Dx4dvkRtor vuiamRQF5BgW2T+HgEAOXUL+PrGPAusGWuJcnzAGp4qKlO8LMjmlxUSA55B2HcyAkBvm BEr3TCxG08yoCezcXxqpqqKXhf8jwj7qObl1/jOezJKZad78OE2OUpsAoQ7SYkknWQs9 POum3+TadUDr+nWgq9lzdKcn2nUG7GB9bhdNoF7DpZp0SJ6tlfHqSPExxs3lenn72eio ipNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Papc1sXd+qDh/1CZbyPf6tKXYxl99aL3JhfvjUH30aw=; b=bI6+s9mE+ezD2UD3N3KMXyyqSg9FFJTCSBHbqagk22rYothW2gQGck8GC3rQnT16Tx BpcLrgwwAFxaXjQn13puGRO5fehzNN/Qe5BQWIDPzS+QdwxTdmS/oe/ghUIUc1zLNDot iP5BPSJGXS2Bd2zkLebx4Y+WjuqHv9ybkCg9/2qlTb+tLFKjlGo98xBNFOqb/IdF1Bda hPWJXA2p8ywM7vsI8RdfE1TKIYlDk9S4Z8YlquvIhN4Tu+UhJLLcDwC8tG7vrbP2H4rb IeLX0tDFMI7XKBSgfMY0mFnGEjNql9z5I9HUiuRi/X/ynkG9GXk8sOKkF0/tZcFRuDtt ICsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=W02vLdWJ; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a623803000000b0063b24c661c8si14034636pfa.364.2023.04.18.05.56.49; Tue, 18 Apr 2023 05:57:02 -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=@chromium.org header.s=google header.b=W02vLdWJ; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbjDRMv0 (ORCPT + 99 others); Tue, 18 Apr 2023 08:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232179AbjDRMvT (ORCPT ); Tue, 18 Apr 2023 08:51:19 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8393F16B30 for ; Tue, 18 Apr 2023 05:50:55 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-63b4bf2d74aso1729221b3a.2 for ; Tue, 18 Apr 2023 05:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681822255; x=1684414255; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Papc1sXd+qDh/1CZbyPf6tKXYxl99aL3JhfvjUH30aw=; b=W02vLdWJ3jV+eysJyBXOZkWpyU4OWVzVbN+pnYkJKHPtCh7O/8OzBlIMsLxX7PW6nI KCygHot6i9LcL4jrs0P04ul3KuPW4e9NzqPVzfenoRhX1c7dk2vGAvizQThTCS+fw7iT D9ZueUY62fFwpHtiVBQDwWXcMGdo7jK3LrapI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681822255; x=1684414255; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Papc1sXd+qDh/1CZbyPf6tKXYxl99aL3JhfvjUH30aw=; b=ik3j1C9qd38juQx8gBLMhqkqqWvI2xRy3WUYgkuMLcUEj3x6IdBJYyNf4ap/n/4EeC szTKIavTu/DAwk5Wy9vYq4S9VxUfpsmJooSrfk8vmFGbtQSmxG5dWVB4xzmdSWqqMXJx di6QtAzc1aFSEPwpc20pLdoRKWlA09jsHRjMU2/oxutdZg9j07QrdWIivj4pDSdYEVgB JTEG49vzQY1SvhAXgA7Ok01aadV4fcNTKs9wX5UBsyGx/uNv09SW0wOiGMXoyQVPdODV Ss+1rbkx62diS5x1PGc8D8Uusl5ufO+lOID4dUwwz28lQkQNRB0GaC6GrrBzljCdd8nP YGUA== X-Gm-Message-State: AAQBX9cFZmgVR/xwKH8BP+Nv1PLL0fDnfGRstMCLU+svpAEb5oXvZDNX E2urqVDkulT9t5cOxIfoxTBJWg== X-Received: by 2002:a05:6a00:99e:b0:63b:3e:cbee with SMTP id u30-20020a056a00099e00b0063b003ecbeemr27392282pfg.32.1681822254999; Tue, 18 Apr 2023 05:50:54 -0700 (PDT) Received: from fshao-glinux.tpe.corp.google.com ([2401:fa00:1:10:2fb7:301d:6083:752b]) by smtp.gmail.com with ESMTPSA id v11-20020a62a50b000000b0063afb08afeesm9323733pfm.67.2023.04.18.05.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 05:50:54 -0700 (PDT) From: Fei Shao To: Benjamin Tissoires , Douglas Anderson , Rob Herring Cc: linux-mediatek , Fei Shao , Dmitry Torokhov , Jiri Kosina , Matthias Kaehlcke , Stephen Kitt , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] HID: i2c-hid: goodix: Add support for powered-in-suspend property Date: Tue, 18 Apr 2023 20:49:52 +0800 Message-ID: <20230418124953.3170028-3-fshao@chromium.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230418124953.3170028-1-fshao@chromium.org> References: <20230418124953.3170028-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763518837415020481?= X-GMAIL-MSGID: =?utf-8?q?1763518837415020481?= 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 `powered-in-suspend` property in the driver that allows the driver to determine whether the touchscreen is still powered in suspend, and handle the reset GPIO accordingly as below: - When set to true, the driver does not assert the reset GPIO in power down. To ensure a clean start and the consistent behavior, it does the assertion in power up instead. This is for designs with a dedicated always-on regulator. - When set to false, the driver uses the original control flow and asserts GPIO and disable regulators normally. This is for the two-regulator and shared-regulator designs. Signed-off-by: Fei Shao Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 46 +++++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c index 0060e3dcd775..b438db8ca6f4 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 powered_in_suspend; const struct goodix_i2c_hid_timing_data *timings; }; @@ -37,13 +38,34 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops) container_of(ops, struct i2c_hid_of_goodix, ops); int ret; - ret = regulator_enable(ihid_goodix->vdd); - if (ret) - return ret; - - ret = regulator_enable(ihid_goodix->vddio); - if (ret) - return ret; + /* + * This is to ensure that the reset GPIO will be asserted and the + * regulators will be enabled for all cases. + */ + if (ihid_goodix->powered_in_suspend) { + /* + * This is not mandatory, but we assert reset here (instead of + * in power-down) to ensure that the device will have a clean + * state later on just like the normal scenarios would have. + * + * Also, since the regulators were not disabled in power-down, + * we don't need to enable them here. + */ + gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); + } else { + /* + * In this case, the reset is already asserted (either in + * probe or power-down). + * All we need is to enable the regulators. + */ + ret = regulator_enable(ihid_goodix->vdd); + if (ret) + return ret; + + ret = regulator_enable(ihid_goodix->vddio); + if (ret) + return ret; + } if (ihid_goodix->timings->post_power_delay_ms) msleep(ihid_goodix->timings->post_power_delay_ms); @@ -60,6 +82,13 @@ 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); + /* + * Don't assert reset GPIO or disable regulators if we're keeping the + * device powered in suspend. + */ + if (ihid_goodix->powered_in_suspend) + return; + gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); regulator_disable(ihid_goodix->vddio); regulator_disable(ihid_goodix->vdd); @@ -91,6 +120,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->powered_in_suspend = + of_property_read_bool(client->dev.of_node, "powered-in-suspend"); + ihid_goodix->timings = device_get_match_data(&client->dev); return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);