Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1424436rdb; Mon, 2 Oct 2023 09:06:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwy8YsueMGTCFf1Co4hgRoUF+AC/kqs97sDmg9kgcbw6GO7H4yxlWKPYXuaHHttbdu4LLQ X-Received: by 2002:a05:6a20:9144:b0:154:6480:83a4 with SMTP id x4-20020a056a20914400b00154648083a4mr10511895pzc.14.1696262769467; Mon, 02 Oct 2023 09:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696262769; cv=none; d=google.com; s=arc-20160816; b=u/wJquOKaOXI3SSTZ2H4kkViAyb97sRYNjEgUs41YHyMkUVYWx58ULRgyuzOOmhNdE vdAIAaXYnRoPRC8EBW/LF4pYKWk5xy35j3Ndj4NhHJZY7RDHOn/YJ+QSfUC6ZA4dhHsu 9+Ko3aMJ0eAJlqYwVDk7KVBadYcOc+Wfz8Amq8UzGjTpGswmJzhOu+m6qI9n3UmzluGz NFV7extQMHb0xkZFifVWGi9cGy1N0+clQ83KmhPA/g+8cjS0nB3jxvGX9dW27GCQqbdF KTjrqzJjO5tRYHEArWoywiwqDf3tPvJkRFkB4bCej7caugAvwuvA7koOMT7Ho4lAW72N gVaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZBOIIDdnPBrAUg2W0OG8djMEz/SMMiLMxqwz49rRlkA=; fh=aMtcVPpq0VEGKtJeCK2HulsYu9xD32mtiHf9HITOT40=; b=oNCt4603e4Ex27zNdGNU2sa0GCLyE4Gptns5L3D9j2VVDxIVI8o819AZ2SNjUl2K3U BrmiJsE4kk6PXZxSOsniYDptH9mrI/Sv/BRKz+PDV4KB+XJz6yrxtQZSl7Ui2vU9pHB2 0r/p+1inGO/KNJE8PUhSBjgTfOJPVlqbDEUW6+NQqDxz3MWlPupbhUJ6PxTJQAkr4Gvb 02L+YZH3QJAwqAk/sldM01IGUAwF2E0PhEOVVyY6ZU49XIf+QFigVdCYa6a1dgPgTEjn aODRPELsI1t6Q2BJDHOq3iVS1kn5VH3YvBV0Ov2oWrxnAvVAe1w7KbcoI98N1t3uvWGA g9Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JNn2CsXE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l3-20020a056a00140300b00690d624f294si28351926pfu.322.2023.10.02.09.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 09:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JNn2CsXE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 67CBF801D587; Mon, 2 Oct 2023 08:48:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237886AbjJBPse (ORCPT + 99 others); Mon, 2 Oct 2023 11:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237798AbjJBPsc (ORCPT ); Mon, 2 Oct 2023 11:48:32 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E66EB93; Mon, 2 Oct 2023 08:48:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86986C433C7; Mon, 2 Oct 2023 15:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696261709; bh=rFA173u7TYSSDdMiO8zMnnvXrhNdNsDs7EeyJiXp5SQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JNn2CsXENcCuXB0l7pfRk1AHPhE9B5i3OL6CajMgO6oipyPQcW3EFZjDSbGpRtreA ZsghJsMFo4FunNaGoaNP2aus9jKDiV05cInibJ6bzCMYYLeOzme746dD9HBliMbFCw Dh50CNFM0FAF0orjaLK/BZZ0AFuOAmpgEUYqFFiDDt0zOuXxAPLpkWleQCJRKygeIK VtYBqZAYgxiaqemoK36acKkWaHVVa8vhJ3+H0IVC/t7vg6hyTyd4XqKFdMykXKKmDQ UUvmJpHx4p6Gcz7pIPeNJ4/Os02Jd7CEB83ujSFTQ+ihm0NGCWljsH9kN4NWytRK4k rJ/84ulmyrkYA== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qnL9w-0005a9-2L; Mon, 02 Oct 2023 17:48:37 +0200 Date: Mon, 2 Oct 2023 17:48:36 +0200 From: Johan Hovold To: Doug Anderson Cc: Johan Hovold , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Ripard , Dmitry Torokhov , LinusW , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:GPIO SUBSYSTEM" Subject: Re: [PATCH] HID: i2c-hid: fix handling of unpopulated devices Message-ID: References: <20230918125851.310-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:48:52 -0700 (PDT) On Mon, Oct 02, 2023 at 07:35:06AM -0700, Doug Anderson wrote: > On Mon, Oct 2, 2023 at 5:09 AM Johan Hovold wrote: > > Out of curiosity, are there any machines that actually need this > > "panel-follower" API today, or are saying above that this is just > > something that may be needed one day? > > Yes. See commit de0874165b83 ("drm/panel: Add a way for other devices > to follow panel state") where I point to Cong Yang's original patch > [1]. In that patch Cong was trying to make things work by assuming > probe ordering and manually taking some of the power sequencing stuff > out of some of the drivers in order to get things to work. > > [1] https://lore.kernel.org/r/20230519032316.3464732-1-yangcong5@huaqin.corp-partner.google.com Ok, thanks for the pointer. > > > > Don't you need to keep the touchscreen powered to support wakeup events > > > > (e.g. when not closing the lid)? > > > > > > No. The only reason you'd use panel follower is if the hardware was > > > designed such that the touchscreen needed to be power sequenced with > > > the panel. If the touchscreen can stay powered when the panel is off > > > then it is, by definition, not a panel follower. > > > > > > For a laptop I don't think most people expect the touchscreen to stay > > > powered when the screen is off. I certainly wouldn't expect it. If the > > > screen was off and I wanted to interact with the device, I would hit a > > > key on the keyboard or touch the trackpad. When the people designing > > > sc7180-trogdor chose to have the display and touchscreen share a power > > > rail they made a conscious choice that they didn't need the > > > touchscreen active when the screen was off. > > > > Sure, but that's a policy decision and not something that should be > > hard-coded in our drivers. > > If the touchscreen and panel can be powered separately then, sure, > it's a policy decision. > > In the cases where the touchscreen and panel need to be powered > together I'd say it's more than a policy decision. Even if it wasn't, > you have to make _some_ decision in the kernel. One could also argue > that if you say that you're going to force the panel to be powered on > whenever the touchscreen is on then that's just as much of a policy > decision, isn't it? I get your point, but with runtime pm suspending the touchpad after a timeout it seems that would still be the most flexible alternative which allows deferring the decision whether to support wakeup on touch events to the user. > In any case, the fact that there is a shared power rail / shared power > sequence is because the hardware designer intended them to either be > both off or both on. Whenever I asked the EEs that designed these > boards about leaving the touchscreen on while turning the panel power > off they always looked at me incredulously and asked why I would ever > do that. Although we can work around the hardware by powering the > panel in order to allow the touchscreen to be on, it's just not the > intention. I hear you, but users sometimes want do things with their hardware which may not have originally been intended (e.g. your kiosk example). > > > > But the main reason is still that requesting resources belongs in > > > > probe() and should not be deferred to some later random time where you > > > > cannot inform driver core of failures (e.g. for probe deferral if the > > > > interrupt controller is not yet available). > > > > > > OK, I guess the -EPROBE_DEFER is technically possible though probably > > > not likely in practice. ...so that's a good reason to make sure we > > > request the IRQ in probe even in the "panel follower" case. I still > > > beleive Benjamin would prefer that this was abstracted out and not in > > > the actual probe() routine, but I guess we can wait to hear from him. > > > > I talked to Benjamin at Kernel Recipes last week and I don't think he > > has any fundamental objections to the fix I'm proposing. > > Sure. I don't either though I'm hoping that we can come up with a more > complete solution long term. > > > > I prefer it as it makes the code easier to reason about and clearly > > marks the code paths that differ in case the device is a "panel > > follower". And since you said it also makes the code look more like what > > you originally intended, then I guess you should be ok with it too? > > It looks OK to me. The biggest objection I have is just that I dislike > it when code churns because two people disagree what the nicer style > is. It just makes for bigger diffs and more work to review things. Ok, but this isn't just about style as that initial_power_on() function which does all the magic needs to be broken up to fix the regression (unless you want to convolute the driver and defer resource lookups until panel power-on). I'll respin a v2 with that panel-property lookup change I mentioned and hopefully we can get this fixed this week. > > > One last idea I had while digging would be to wonder if we could > > > somehow solve this case with "IRQF_PROBE_SHARED". I guess that doesn't > > > work well together with "IRQF_NO_AUTOEN", but conceivably we could > > > have the interrupt handler return "IRQ_NONE" if the initial power up > > > never happened? I haven't spent much time poking with shared > > > interrupts though, so I don't know if there are other side effects... > > > > Yeah, that doesn't seem right, though. The interrupt line is not really > > shared, it's just that we need to check whether the device is populated > > before requesting the interrupt. > > I'm not convinced that marking it as shared is any "less right" than > extra work to request the interrupt after we've probed the device. > Fundamentally both are taking into account that another touchscreen > might be trying to probe with the same interrupt line. If you need to start to thinking about rewriting your interrupt handler, I'd say that qualifies as "less right". ;) Johan