Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1188549rwb; Fri, 13 Jan 2023 09:00:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3M7GAaa1EdqUsRD0gCnHGeQQaxX2fRd2yvB6fvoX2JkvNPeyqA0rs1dcKQTcIv3yYKl1I X-Received: by 2002:a17:90a:ac12:b0:226:ca91:3979 with SMTP id o18-20020a17090aac1200b00226ca913979mr11084879pjq.26.1673629233677; Fri, 13 Jan 2023 09:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673629233; cv=none; d=google.com; s=arc-20160816; b=aBNyOVsz9XF/4og2vonYXrV8m1A5AI8dXHmtKyDNyezLvsWv7l6cwoTq/KLUvj8Ybf 7s8EK/sxVm2DXLiPrjfYY2CzM/AQMnbSWZWsCnzAfTV57C/ElTUkT25WDIvEhzWu9o2f hIRd6/JSrEGui0qCwgHmuM2xyd0Zghp9dnnMRyEYGKecx2Jzjs6OFxyzm5+2qeiz6ugR ajXytJRKSL/vkeBg6Vxb5LcsuVnabodbh2tplwAUehuZM6aYeoeIhkjrugKlPe7ttxpz UWGBftlwOU8insqQPDQs4bMRisQoiOEztDzH6QWTd12weMktaOelNLkgX9Zlyt5Ww+M1 1ETg== 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=8K/16wcw70g3853WB4bevqY45r4f6kMjEA+IYsdkDYY=; b=JFlQvt6N2yZTv9quCNwtQwQi2Q85NXjUHrl79udAeV3auQl++uHZWzRrfYRvqGCAvY vL2MR/BNtto20zLlnkX1uFdA0utJvpfW8/sKL4bKR+aEdddj39RTHBWRdMn5/ICzQmxS lfaqIV8X+q182tT018GlpiIoIsNlk7sdvAId2hgUjC3O7IQgzNtyfcblSXX8dDeJ6eN/ Y2szceOpkX928Hpf8WNYApGdmYGGLLYlgizizv/dGAnelrvu627/WKJnUX3pdv2z0qnP 9C8OuYHE/knrYqgcPHvOUyV0Yje1oWJ/QLy9lSbr0XaEVv8Lp/zzmsHYULKiSwfrPWO1 uwRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=iGJOEt8n; 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=raspberrypi.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk14-20020a17090b4a0e00b00213b2bb261asi22541941pjb.33.2023.01.13.09.00.27; Fri, 13 Jan 2023 09:00:33 -0800 (PST) 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=@raspberrypi.com header.s=google header.b=iGJOEt8n; 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=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbjAMQd5 (ORCPT + 53 others); Fri, 13 Jan 2023 11:33:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbjAMQdG (ORCPT ); Fri, 13 Jan 2023 11:33:06 -0500 Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22714D4BA for ; Fri, 13 Jan 2023 08:27:46 -0800 (PST) Received: by mail-vk1-xa2f.google.com with SMTP id w72so10414213vkw.7 for ; Fri, 13 Jan 2023 08:27:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8K/16wcw70g3853WB4bevqY45r4f6kMjEA+IYsdkDYY=; b=iGJOEt8ndx9S9t9mnzB3G2gCDTZNO1tXjhSiYvNzozMtXH/KeS6K3xEXo5Y6n0LSQX 2DgR8VBGHq7ZsloVs/sKaMKxiV47xE+PoyL/ffZ7zoLPkxjS1jtUnmXpP0y77WI70/BE U0s4dok1NhO5F1VBQRZihTY4nyT8PWMql/zNhM2pn4KpbDp/bhbLnvK9Wjz7vDHpOrXZ VABz8C5bMhkhhqnjRJzkB4jM3Bnyrk7yQvmMk/ONbBKBeTD7PIK/5k20wP4QvD85qcwo TgpuxLsEmJz0xnSwPWEu9i9KLHVC+1fR1yiLWyURT6iwhMqj4wwwsYuySwyG6Z+rwUVc A/7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=8K/16wcw70g3853WB4bevqY45r4f6kMjEA+IYsdkDYY=; b=kfIwSihRICowOMIkvpSYTMTLla9aCI4Muu2YFnUsxh37yosGEjWjw6UIuQ+MjmrBNy X7M86w3FFI82sZ8k6DVB801rxIblXbqmEpKN/PvpwMu1s5LAmJn9OUmt4Ex4JmxtZW6c NY7kndJAjfiJi/qRDuHpJGeovGrr6MXSRphiU7+Bf8NKtMv47MZ6XnLGj3SNsKKLL+C+ TCa2SY8g5+0tnIMueEaSXivY4QCIUPHU1NDs5+NbEMycpZr6kevCdNgvD4aiavVE/tQU r8VXemVin89Z2Hq6cMplEHHJbpITybmayjZI6HoMYzi0i2HNAfZPiPN+fYJ0Q2XXC9q5 jxiA== X-Gm-Message-State: AFqh2kpHHjrxo/XvDr1izyFP5kmN88rZ/S0dQ3Wj1uUYBp+leI8PNFG8 BA/vfJxXpEFlcaO1u8cycKDRTP4FLnsBPDpQj8cE/Q== X-Received: by 2002:a1f:1243:0:b0:3da:e97f:4dd7 with SMTP id 64-20020a1f1243000000b003dae97f4dd7mr1741706vks.36.1673627265794; Fri, 13 Jan 2023 08:27:45 -0800 (PST) MIME-Version: 1.0 References: <20230106030108.2542081-1-swboyd@chromium.org> In-Reply-To: <20230106030108.2542081-1-swboyd@chromium.org> From: Dave Stevenson Date: Fri, 13 Jan 2023 16:27:29 +0000 Message-ID: Subject: Re: [PATCH] drm/panel: boe-tv101wum-nl6: Ensure DSI writes succeed during disable To: Stephen Boyd Cc: Thierry Reding , Rob Clark , Douglas Anderson , Jitao Shi , yangcong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, patches@lists.linux.dev, linux-mediatek@lists.infradead.org, Dmitry Baryshkov , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi Stephen On Fri, 6 Jan 2023 at 03:01, Stephen Boyd wrote: > > The unprepare sequence has started to fail after moving to panel bridge > code in the msm drm driver (commit 007ac0262b0d ("drm/msm/dsi: switch to > DRM_PANEL_BRIDGE")). You'll see messages like this in the kernel logs: > > panel-boe-tv101wum-nl6 ae94000.dsi.0: failed to set panel off: -22 > > This is because boe_panel_enter_sleep_mode() needs an operating DSI link > to set the panel into sleep mode. Performing those writes in the > unprepare phase of bridge ops is too late, because the link has already > been torn down by the DSI controller in post_disable, i.e. the PHY has > been disabled, etc. See dsi_mgr_bridge_post_disable() for more details > on the DSI . > > Split the unprepare function into a disable part and an unprepare part. > For now, just the DSI writes to enter sleep mode are put in the disable > function. This fixes the panel off routine and keeps the panel happy. It is documented that the mipi_dsi_host_ops transfer function should be called with the host in any state [1], so the host driver is failing there. This sounds like the same issue I was addressing in adding the prepare_prev_first flag to drm_panel, and pre_enable_prev_first to drm_bridge via [2]. Defining prepare_prev_first for your panel would result in the host pre_enable being called before the panel prepare, and therefore the transfer calls from boe_panel_init_dcs_cmd boe_panel_prepare won't be relying on the DSI host powering up early. It will also call the panel unprepare before the DSI host bridge post_disable is called, and therefore the DSI host will still be powered up and the transfer won't fail. Actually I've just noted the comment at [3]. [2] is that framework fix that means that the magic workaround isn't required, but it will require this panel to opt in to the ordering change. Cheers. Dave [1] https://www.kernel.org/doc/html/latest/gpu/drm-kms-helpers.html#c.mipi_dsi_host_ops [2] https://patchwork.freedesktop.org/series/100252/ [3] https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/msm/dsi/dsi_manager.c#L47 > My Wormdingler has an integrated touchscreen that stops responding to > touch if the panel is only half disabled too. This patch fixes it. And > finally, this saves power when the screen is off because without this > fix the regulators for the panel are left enabled when nothing is being > displayed on the screen. > > Fixes: 007ac0262b0d ("drm/msm/dsi: switch to DRM_PANEL_BRIDGE") > Fixes: a869b9db7adf ("drm/panel: support for boe tv101wum-nl6 wuxga dsi video mode panel") > Cc: yangcong > Cc: Douglas Anderson > Cc: Jitao Shi > Cc: Sam Ravnborg > Cc: Rob Clark > Cc: Dmitry Baryshkov > Signed-off-by: Stephen Boyd > --- > drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c > index 857a2f0420d7..c924f1124ebc 100644 > --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c > +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c > @@ -1193,14 +1193,11 @@ static int boe_panel_enter_sleep_mode(struct boe_panel *boe) > return 0; > } > > -static int boe_panel_unprepare(struct drm_panel *panel) > +static int boe_panel_disable(struct drm_panel *panel) > { > struct boe_panel *boe = to_boe_panel(panel); > int ret; > > - if (!boe->prepared) > - return 0; > - > ret = boe_panel_enter_sleep_mode(boe); > if (ret < 0) { > dev_err(panel->dev, "failed to set panel off: %d\n", ret); > @@ -1209,6 +1206,16 @@ static int boe_panel_unprepare(struct drm_panel *panel) > > msleep(150); > > + return 0; > +} > + > +static int boe_panel_unprepare(struct drm_panel *panel) > +{ > + struct boe_panel *boe = to_boe_panel(panel); > + > + if (!boe->prepared) > + return 0; > + > if (boe->desc->discharge_on_disable) { > regulator_disable(boe->avee); > regulator_disable(boe->avdd); > @@ -1528,6 +1535,7 @@ static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *pa > } > > static const struct drm_panel_funcs boe_panel_funcs = { > + .disable = boe_panel_disable, > .unprepare = boe_panel_unprepare, > .prepare = boe_panel_prepare, > .enable = boe_panel_enable, > > base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2 > -- > https://chromeos.dev >