Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4339550pxv; Tue, 20 Jul 2021 01:03:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziSwGHEBDbwyKXNCohKwzkF5Ca5P8Ebijq465J7TzpUznQkFx+zdeImxzX5zBVSme2iO53 X-Received: by 2002:a17:906:3e0b:: with SMTP id k11mr31305060eji.305.1626768216394; Tue, 20 Jul 2021 01:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626768216; cv=none; d=google.com; s=arc-20160816; b=S5rdYDwNVCdzRYM/zz5dMAx5mW9VSc7tuY+g8bER+nhyVdnPf8N8ZD/IBO84cgvgBe 4kGjLYprTCOaexbph0EINRedX1b6dgeDAnfViA3yk0fET7JXTdof7VgRyqDF+U5qbLBp zn9kG99Ba7cafD5Ixy0B7fpcfCwjAGu+67JgQJLIIsA7dzz0+snALCyklISj6Z270AnH 1ZW4OYOlXqi3Is6MrCXkjErwwWgFDbvBZ8udeYL0ux0ByILOyojTnSmx6p+6J2Ee6LWK EYUghJzjAnvEMpXHIGycK96+VaIDE8J5KYlrUwY6o/mItLtLxL5HW+mdWPaGgEjnAVBg HWLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LTrV5RbVeDNyG1pYgWpiiRkaajyN4AH34gq6Sc1Ja5U=; b=nqTJeLmDXBs7tVY3o+O5MOQEQbx0oOmL45WeZ5UWLB5tBjrEgyoe/h5UUX+SphrLBU ZZK68Jp7fiR5mDDCvbTKkJrBR8XBpflJ+RTnuMB/PNwhdH8mHv7t3iWEMX5f0DtSdzvg PMJr+ZmgLMP/9ds1FnDm6dbiV7Ryi25T2j4T49ALksYgEwvZiycvZWv/S5a0H0TxL+Wj WtVaz+NOAmYp39H/qL1Abf7FeaMscysy6DcpjBd4lBQo6wGXisoHReuUcdV7k6SPVTAX kGjiLltP+wP06vG5jHBYUzCnTliiCOEZPbr7pmhsJR4wCu0ETFPkAWIud2Lhcl11nquf Cynw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NnU2ZAi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si26175376ejx.447.2021.07.20.01.03.11; Tue, 20 Jul 2021 01:03:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NnU2ZAi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229726AbhGTHU6 (ORCPT + 99 others); Tue, 20 Jul 2021 03:20:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45563 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhGTHUz (ORCPT ); Tue, 20 Jul 2021 03:20:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626768094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LTrV5RbVeDNyG1pYgWpiiRkaajyN4AH34gq6Sc1Ja5U=; b=NnU2ZAi7Fgxdq1HPF8do9QLB25YnmCnNYvVftLS/Zw6RvH/lizgAfEvds++Jy7YiLXW1EL P4RtDsN9QAlyHWY26MJtDEsDGeR4eLE67jvgKr5hjqaV2IhxkuWzkKREEsNWZYZLG8eCti A9Yet7Zfi1+LfEfoQSCTY8nyxI53cdg= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-530-GTZjbMMZOZyqJa8T3g3FDw-1; Tue, 20 Jul 2021 04:01:32 -0400 X-MC-Unique: GTZjbMMZOZyqJa8T3g3FDw-1 Received: by mail-pj1-f70.google.com with SMTP id j11-20020a17090a840bb029017582e03c3bso1389401pjn.7 for ; Tue, 20 Jul 2021 01:01:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LTrV5RbVeDNyG1pYgWpiiRkaajyN4AH34gq6Sc1Ja5U=; b=TYF/Zs5u7IFM8cng7qjwpMFfjLbC/rMJ8CZDZI70mo6vVz0riI0jHfn11eNfLHCf0y opC7BfLuMUZm8c2GrAe3mjskkwuDTSixSTxN53Nk/FeE6J+ni2DKXRbUzwpb4hkITspA a/awRP6eEDD9O18ArqChxGh96He6lWWMRNd7BHTSZ/dzUFVBfeGl2Tr/81Inpj2MGJ4D toE6/Z75reTl+ssb0QjiNARFeR7Bdl23jI3CV3UYigOrzcuj1I7BE8hDGxq1DZ68895t CWB61PFSxN9qg4CT6Xm/m+vdSRJ60HHqRtTN++fxBOTAajHOnb53IR+3eRqWw+a5CgqJ 2jWw== X-Gm-Message-State: AOAM530ztbEJ7sBCZS5P8IRidbjjP+RwY8yYqHXHPREp35THzGfQoI5l IKXMm476JzZexgCxOSL0C6O3OWW6SAY1XABIuEC6DMrCQK5Pf828PklcgH/MKSoeiqMGquBzaQb xrV9gGuZuj34XMkbZ9ZDa6FPaa0wZKlEIlvc2iSeA X-Received: by 2002:aa7:9687:0:b029:337:3b49:df24 with SMTP id f7-20020aa796870000b02903373b49df24mr21001798pfk.35.1626768091743; Tue, 20 Jul 2021 01:01:31 -0700 (PDT) X-Received: by 2002:aa7:9687:0:b029:337:3b49:df24 with SMTP id f7-20020aa796870000b02903373b49df24mr21001779pfk.35.1626768091519; Tue, 20 Jul 2021 01:01:31 -0700 (PDT) MIME-Version: 1.0 References: <20210625081818.v2.1.I358cae5e33f742765fd38485d6ddf1a4a978644d@changeid> In-Reply-To: From: Benjamin Tissoires Date: Tue, 20 Jul 2021 10:01:20 +0200 Message-ID: Subject: Re: [PATCH v2] HID: i2c-hid: goodix: Tie the reset line to true state of the regulator To: Jiri Kosina Cc: Douglas Anderson , Dan Carpenter , "open list:HID CORE LAYER" , lkml Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 9:50 PM Jiri Kosina wrote: > > On Fri, 25 Jun 2021, Douglas Anderson wrote: > > > The regulator for the touchscreen could be: > > * A dedicated regulator just for the touchscreen. > > * A regulator shared with something else in the system. > > * An always-on regulator. > > > > How we want the "reset" line to behave depends a bit on which of those > > three cases we're in. Currently the code is written with the > > assumption that it has a dedicated regulator, but that's not really > > guaranteed to be the case. > > > > The problem we run into is that if we leave the touchscreen powered on > > (because someone else is requesting the regulator or it's an always-on > > regulator) and we assert reset then we apparently burn an extra 67 mW > > of power. That's not great. > > > > Let's instead tie the control of the reset line to the true state of > > the regulator as reported by regulator notifiers. If we have an > > always-on regulator our notifier will never be called. If we have a > > shared regulator then our notifier will be called when the touchscreen > > is truly turned on or truly turned off. > > > > Using notifiers like this nicely handles all the cases without > > resorting to hacks like pretending that there is no "reset" GPIO if we > > have an always-on regulator. > > > > NOTE: if the regulator is on a shared line it's still possible that > > things could be a little off. Specifically, this case is not handled > > even after this patch: > > 1. Suspend goodix (send "sleep", goodix stops requesting regulator on) > > 2. Other regulator user turns off (regulator fully turns off). > > 3. Goodix driver gets notified and asserts reset. > > 4. Other regulator user turns on. > > 5. Goodix driver gets notified and deasserts reset. > > 6. Nobody resumes goodix. > > > > With that set of steps we'll have reset deasserted but we will have > > lost the results of the I2C_HID_PWR_SLEEP from the suspend path. That > > means we might be in higher power than we could be even if the goodix > > driver thinks things are suspended. Presumably, however, we're still > > in better shape than if we were asserting "reset" the whole time. If > > somehow the above situation is actually affecting someone and we want > > to do better we can deal with it when we have a real use case. > > > > Signed-off-by: Douglas Anderson > > Applied, thanks Doug. Thanks Jiri for taking this one in. FWIW, I am really glad Doug made the effort of splitting i2c-hid-core and i2c-hid-goodix, because this is the kind of patch that would have been a nightmare to make it generic :) Cheers, Benjamin > > -- > Jiri Kosina > SUSE Labs >