Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5959622rwr; Mon, 24 Apr 2023 11:22:33 -0700 (PDT) X-Google-Smtp-Source: AKy350YbIV6oL8nCsGoCKJO5836r+eA2aNT5Yr83nEO6VR8jZ1hgHG3QZIGPRKqm1cBkHIdTKKl/ X-Received: by 2002:a17:902:c945:b0:1a6:7f14:707e with SMTP id i5-20020a170902c94500b001a67f14707emr17675427pla.9.1682360553001; Mon, 24 Apr 2023 11:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682360552; cv=none; d=google.com; s=arc-20160816; b=NP7atppAAoNLDS+mq1pIWGht+Ir6x18gF1qGT++2owIPSZw8z9xrAzVXmOA90beceB b5l9pwtm70DsJclA43u87OlLO3oLoVjDEAsVtMPThJuJQXtme3U9fnshaYrWYBQQVw23 ILwm03m2LksbhqxnSL3cXs7xfMZ4b2zSqOWfTwsLvUNLRB+9dTkQ/OSLPk6wAr1HEPJG 2er295G637SvCDrCuF7XjbT9RPd2DDZ7BaJelLLbpxRhT+VPcejqKk/T3XeTWgeMJaed pRSrWHboIqMINNnVcbSUzWEwxMykmZ9DF65LLYdCGM7n/E759JbjqjquMIkxrUAnHj04 fUOA== 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=j798mRgzagav4OXiZ0yBmBHNPfVDqUqZ2VrQzSezYUw=; b=c67kTjA72QJokPeU/YmU8o8KSDnZ9R9PosiK+DP7252QGtIYlp/wm8yHhN9v10UpF1 2oOkKh6mqiPyc6hrAz9bhyCN9XxERWPSCEIY0WcdiVJcSr24iquS1M0Dn+MH2gnxw+Up OlAtUvmJ0e2KQBemOjgDxxhFdPTpzSsJMMUG2cvvUU19Yw4ueGQoTOZVXzZ61q8SQraI QSSKR5Pt7yj5RdMPvP/e265fInZias3WMHxYgScZsq3WW3VFNMzjOswFSAkPA2H6qwK3 yAvSZLc/mefKaLrpP70WLRQ/3I52eqtQasVxVyUd84qOjr3w6eqyq8P4jUhgRc1acCPC /JHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N3cz31Io; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170903120a00b001a69fe5f560si12267087plh.444.2023.04.24.11.22.17; Mon, 24 Apr 2023 11:22:32 -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=N3cz31Io; 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 S231749AbjDXSRP (ORCPT + 99 others); Mon, 24 Apr 2023 14:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231481AbjDXSRO (ORCPT ); Mon, 24 Apr 2023 14:17:14 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B9B27EED for ; Mon, 24 Apr 2023 11:16:28 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-32b4e379000so13341845ab.2 for ; Mon, 24 Apr 2023 11:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1682360184; x=1684952184; 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=j798mRgzagav4OXiZ0yBmBHNPfVDqUqZ2VrQzSezYUw=; b=N3cz31Io2oZqrF4wM47UT59U/8cwec6KWT8Xp2Y+c8jbrjGcgBDxxX/GpFTcXbM3vT tEf1LpsMfdq5oXlQXtKn28JRBkYoP8sRPlzOj4RYbs+/iT2z+iXVA96lCsT1Eroo4qR7 VcOZ8Y8LHPJef0jYYVIBY0wWLowcXLHPflEA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682360184; x=1684952184; 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=j798mRgzagav4OXiZ0yBmBHNPfVDqUqZ2VrQzSezYUw=; b=JxnVgsWRIfu+dguSi+52T1oGqmEa8ojhntxHHn/v9z79EtjgU0SsX7QcT7j6xai2B+ IFLMCzR55GwFBW0kLBEutmvbaxU0MoQ6lhRxiCV9WWsfEliIKtutHAJcqZu6Y32WLOk0 pncfPQIYT5Sn7m2lQ/fXAk4BL2Iln4KpKvzugQJg5H/SBpbobnGMFvz1Auna9Lc4m3DW Whx73gLufpuvxNHbfWmARzN8ylfw+4DBkO2v21Cv/tiNDZXTFSzKslkD2vAr7SksMhiy 34fcDSrhWaT+Yg6RssEyIEOZkTmrlxo9MXee5CwR2U5DBRGsymmC4LX6EsL/fa2Al0wm ji9g== X-Gm-Message-State: AAQBX9dL7EQ+HC8ljgydkzG7TOw81r4mGJnvVebaIHokJPpECw2oj5IT nsnouB48wBs7ejh4ffQj9cFTpoQKTKdnFCcG+qk= X-Received: by 2002:a92:2904:0:b0:32a:ea4e:97d1 with SMTP id l4-20020a922904000000b0032aea4e97d1mr6798329ilg.10.1682360184605; Mon, 24 Apr 2023 11:16:24 -0700 (PDT) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com. [209.85.166.180]) by smtp.gmail.com with ESMTPSA id cl13-20020a0566383d0d00b0040faf05071asm3422648jab.156.2023.04.24.11.16.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Apr 2023 11:16:22 -0700 (PDT) Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-325f728402cso1100315ab.1 for ; Mon, 24 Apr 2023 11:16:22 -0700 (PDT) X-Received: by 2002:a05:6e02:1b83:b0:32a:f2a9:d1b7 with SMTP id h3-20020a056e021b8300b0032af2a9d1b7mr19498ili.10.1682360181408; Mon, 24 Apr 2023 11:16:21 -0700 (PDT) MIME-Version: 1.0 References: <20230418124953.3170028-1-fshao@chromium.org> <20230418124953.3170028-3-fshao@chromium.org> In-Reply-To: From: Doug Anderson Date: Mon, 24 Apr 2023 11:16:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] HID: i2c-hid: goodix: Add support for powered-in-suspend property To: Jeff LaBundy Cc: Fei Shao , Benjamin Tissoires , Rob Herring , linux-mediatek , Dmitry Torokhov , Jiri Kosina , Matthias Kaehlcke , Stephen Kitt , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 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 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 Hi, On Sun, Apr 23, 2023 at 8:38=E2=80=AFPM Jeff LaBundy wro= te: > > > @@ -37,13 +38,34 @@ static int goodix_i2c_hid_power_up(struct i2chid_op= s *ops) > > container_of(ops, struct i2c_hid_of_goodix, ops); > > int ret; > > > > - ret =3D regulator_enable(ihid_goodix->vdd); > > - if (ret) > > - return ret; > > - > > - ret =3D 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 (inste= ad of > > + * in power-down) to ensure that the device will have a c= lean > > + * state later on just like the normal scenarios would ha= ve. > > + * > > + * 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 =3D regulator_enable(ihid_goodix->vdd); > > + if (ret) > > + return ret; > > + > > + ret =3D regulator_enable(ihid_goodix->vddio); > > + if (ret) > > + return ret; > > + } > > Please let me know in case I have misunderstood, but I don't see a need > to change the regulator_enable/disable() logic if this property is set. > If the regulators are truly always-on, the regulator core already knows > what to do and we should not duplicate that logic here. > > Based on the alleged silicon erratum discussed in patch [1/2], it seems > we only want to control the behavior of the reset GPIO. Therefore, only > the calls to gpiod_set_value_cansleep() should be affected and the name > of the property updated to reflect what it's actually doing. This would be OK w/ me.