Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5039016rwd; Tue, 23 May 2023 17:14:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bXf4W96e8gY7775Q5E5Pcl4YjdoqlMorhk6M4WdJ2L8VELyjfKsenQLJHWxhScMlD595G X-Received: by 2002:a05:6a00:2d02:b0:64d:5bf2:4b99 with SMTP id fa2-20020a056a002d0200b0064d5bf24b99mr915777pfb.22.1684887277023; Tue, 23 May 2023 17:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684887277; cv=none; d=google.com; s=arc-20160816; b=QECQV1igoEsg3uHovx2t1GRXqMQI+xaDtTFWIE7oMonV8hz4pFsNAHm9PrKw22II65 AHsuhokrMzTbtP0TJOWRzcE9g5K6kQ+69nG7n3uvt9Hqr6AWGEWKkc/owsvg7WBm73G+ n1M34eWgGEjIns1MXppGAQ6F6Li7DpMDu5D85/Yz4U/YKltmB6vfo5niRKFMys49pGZQ LAWAXEJHKLDUazqKJuXe55l4zbrDHj013HL/4Tg0aS2oacdiWMbBcTAxLr2UAdtS2+yO WsJltjyR42w4R301gC43iR9MwGgcmSyblnw8+6F0UcuYXX8ValQhNhFahK8Rov8RZcs3 Xq9g== 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=Uy/Z1ySOUfUShGzbWIcnHxdYF4h1eJNt1bs6mI3x3dY=; b=yTjfnzbYIYdIXTqwdK2tv780ZmtWCjeAvndN9KR64zFMfovKaYi2+jEHgq7d7bhL3K ZqdfaiKqdZ4FZhOl4IjjOXMjBVqBdgD9UZQdDgob0EvGiXFaDIkhREY2Iz7dX4WFp83W AiXX56gKytddsP2R4yDxqqTLvNm4RuFI7t7EPpkAC/tK/fNKXXvi2/oBmyBbyjM+zzvu wPKt/EvXk9TM05eslYMiU4s8VU/U5+QP3TaJ5zzdKaxj35GiFl7ErVi7hy0aJayD/A4N 38MYncIWU1VTZ6VS6eJgD4oHkl5IjVazCT5v6cWUgmio9dJYs6pnFfHTsf5BAgUD24PB Lyuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kHsnaQVu; 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 f80-20020a623853000000b0063354a65327si7075262pfa.395.2023.05.23.17.14.23; Tue, 23 May 2023 17:14: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=kHsnaQVu; 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 S238857AbjEWXxX (ORCPT + 99 others); Tue, 23 May 2023 19:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238822AbjEWXxW (ORCPT ); Tue, 23 May 2023 19:53:22 -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 8DC6C130 for ; Tue, 23 May 2023 16:53:19 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-335394455ecso1701835ab.1 for ; Tue, 23 May 2023 16:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684885997; x=1687477997; 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=Uy/Z1ySOUfUShGzbWIcnHxdYF4h1eJNt1bs6mI3x3dY=; b=kHsnaQVuEw2WXdiIqGc0aGmmo8qDDNWIhF0KOKLabM0wIGvzNdXrhscIgSlnEnjsP1 F0ybLGw2M2zfC2KyqgyqA7P5dIVgsXniJrkxY7QjIoDytMZn2I2Qu2Yl4qNjIH85jYBg 4G5XDD/Q6dDn2YvtAiIJoCujMusXm0CTN+aL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684885997; x=1687477997; 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=Uy/Z1ySOUfUShGzbWIcnHxdYF4h1eJNt1bs6mI3x3dY=; b=WmFYFaavcrNJk+OVPK+9fZNdaun04mg7De2vJgyzo90NA2gKLyUTX9RR5StV4d3JIk 2C+hlA4/JWs/IGtUTZsGWQmDrSQjboiPcGrMp7961nIu4zVrgVaNsj4fR66j8azBYZAz xUs2VtPPnnZTlafDuMtIHIRwPtK6ps1CHkrtEKDvnLa6jKC2rUHlkKuraLR16619YcDS itT2b4Z5b3usTR4+Pe+Z4L+vbIihsHFnGseukAdeqjOeQTxM+UtMWj1GeS27jvfToV+l 4gJthg5ETlY0koPtmU47SkYx4betl4pPjYrg6drv6BdfQCza7qIuNYQIb2LclNP1Xk9u K5mw== X-Gm-Message-State: AC+VfDzRymHraOe5jCI5oVssz/PVvw43Ox7zYHQ+WeYfqmA/jjicKAcM iSfV/BE98bTGOb0q5PBuZsERR1CTP9kGQfv7zL0= X-Received: by 2002:a92:dac4:0:b0:33a:1a98:559a with SMTP id o4-20020a92dac4000000b0033a1a98559amr5018402ilq.2.1684885997708; Tue, 23 May 2023 16:53:17 -0700 (PDT) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com. [209.85.166.181]) by smtp.gmail.com with ESMTPSA id e8-20020a02a788000000b004166c24e30dsm2683417jaj.32.2023.05.23.16.53.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 16:53:13 -0700 (PDT) Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-33828a86ee2so6995ab.0 for ; Tue, 23 May 2023 16:53:09 -0700 (PDT) X-Received: by 2002:a05:6e02:1949:b0:32b:7232:dac6 with SMTP id x9-20020a056e02194900b0032b7232dac6mr117857ilu.18.1684885989118; Tue, 23 May 2023 16:53:09 -0700 (PDT) MIME-Version: 1.0 References: <20230523193017.4109557-1-dianders@chromium.org> In-Reply-To: From: Doug Anderson Date: Tue, 23 May 2023 16:52:55 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/9] drm/panel and i2c-hid: Allow panels and touchscreens to power sequence together To: Dmitry Torokhov Cc: Jiri Kosina , Benjamin Tissoires , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, hsinyi@google.com, devicetree@vger.kernel.org, yangcong5@huaqin.corp-partner.google.com, linux-kernel@vger.kernel.org, Daniel Vetter , linux-arm-msm@vger.kernel.org, cros-qcom-dts-watchers@chromium.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hi, On Tue, May 23, 2023 at 2:39=E2=80=AFPM Dmitry Torokhov wrote: > > Hi Doug, > > On Tue, May 23, 2023 at 12:27:54PM -0700, Douglas Anderson wrote: > > > > The big motivation for this patch series is mostly described in the pat= ch > > ("drm/panel: Add a way for other devices to follow panel state"), but t= o > > quickly summarize here: for touchscreens that are connected to a panel = we > > need the ability to power sequence the two device together. This is not= a > > new need, but so far we've managed to get by through a combination of > > inefficiency, added costs, or perhaps just a little bit of brokenness. > > It's time to do better. This patch series allows us to do better. > > This seems to grow a new way of building relationship between panels and > associated devices. Can we make device_link_*() work for us? If you know of a way to make it work, that'd be great. ...but I don't _think_ it would be that easy. I haven't spent much time with the device_link APIs, though, so please correct me if I'm wrong. I guess my main issue with device_link would be that that ordering feels backward. Specifically, the device we're acting on (the one we're turning off and on) is the panel. We typically turn the panel off and on at times (during a modeset, when the lid is closed, or just if the system is idle). When this happens we'd like to remove power from both the panel and the touchscreen. Userspace is just not setup to power off touchscreens in tandem with the panel and sometimes (like in the case of a modeset) it might not even know it needs to. With device_link I believe that the "child" device is in charge of powering the parent. I think that would mean that to use device_link we'd need to make the panel be the child of the touchscreen. Then, I guess we'd tell the touchscreen not to power itself on if it had children and just wait for a child to power it on? It feels really awkward partly because the panel doesn't feel like it should be a child of the touchscreen and partially because it seems weird that the touchscreen would somehow need to know not to request power for itself when it has a child. ...if we're willing to accept the backwardness as described above and we can find a hack to keep the touchscreen from powering itself up, then I think things could be made to work OK-ish. I can try to investigate that route if it doesn't feel too ugly. ...oh, except for another problem. The initial power up of the i2c-hid device would also be a problem here. I guess with device_link we'd need to put all the power up work into "runtime resume". The problem is that upon initial power up we create "HID" sub-devices and (as far as I could tell) you can't do that during a runtime resume. :( We could put a special case to power the touchscreen up before the panel at probe time, but that could have other consequences? If we don't go with the backwardness then I think we're a bit stuck with some of the original problems. Specifically it means that unless userspace knows to turn off the touchscreen that the touchscreen would force the panel to never be power cycled. There's at least one panel (the one on sc7180-trogdor-homestar) where that's known to be a problem. It also means that we're back to drawing extra power if the touchscreen is left "on" but the panel power is turned off. Let me know if I'm misunderstanding. -Doug