From nobody Sat Sep 21 07:34:05 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AF0DC4708E for ; Fri, 6 Jan 2023 03:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbjAFDCT (ORCPT ); Thu, 5 Jan 2023 22:02:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbjAFDBz (ORCPT ); Thu, 5 Jan 2023 22:01:55 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A433B6A0D0 for ; Thu, 5 Jan 2023 19:01:11 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id b2so365079pld.7 for ; Thu, 05 Jan 2023 19:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FLEA2wQkQBIO15nu3HyGaLDd58pUqyHA63e/BahflBg=; b=gr1lwpg+ZbMVA7VcYOW5YvvzRvyk56qGEw34yRLVGhuBq+su/XvHWcwtgeYG5Q5API kQWl20V6HCSzhC+y3lpli6F+e5NnCI736lNGtNY3CR7LWYw9K1WOVN8CmTdTLHH/VHT1 /UbBKNWAAha3z8idSR8hR8tlBNBJY87nnTfCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FLEA2wQkQBIO15nu3HyGaLDd58pUqyHA63e/BahflBg=; b=A9A3bps1d/RtzLNg6SS8iIYgOynQvcNDtXTxssk/0jMcYaf3hQ8L7/20RDMBvGmpp7 VUizjiuMkWFP5PviYpDo9JXyc3/a6RPAD/hyfU4Z1C43dOdVMUn1otvVxezi584yOf0J b2+JqDx2Ac2PQqLyNjw/MYh4Hol4xnQwGobqF+tQr2gNhNm5d7MtaEss8qQkdsRjPwZH wBZdkdizF3xTwrsbFygNkFplB/uNXXgw8gfhAxP8CceJIKaklPYgyGztlq8Yi9JHq05E hryci+CVcuPFczryGP+TXSKCFSpfcKNwf3GDFW1uVCUOO8Yaw1MvJeRVwpcLeewuhhFS ao/A== X-Gm-Message-State: AFqh2kqB/YXWl3qayyPrdU4PhQxeCfFAZc0TMjHoruef4cD47azAIqvp Wmf630UpF2At9y8WdNkJfMh0WQ== X-Google-Smtp-Source: AMrXdXsomxVgbccv1usflDMgeLmsRP7BhyBVOMFDU6WowU+xXCKfXlkP0R8LnNIfb1r5yNksWji+AQ== X-Received: by 2002:a05:6a20:cb44:b0:af:e129:cc4 with SMTP id hd4-20020a056a20cb4400b000afe1290cc4mr51387940pzb.41.1672974071148; Thu, 05 Jan 2023 19:01:11 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:11a:201:d024:f69:ad7c:2653]) by smtp.gmail.com with ESMTPSA id g38-20020a635666000000b004768b74f208sm21320pgm.4.2023.01.05.19.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 19:01:10 -0800 (PST) From: Stephen Boyd To: Thierry Reding Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, yangcong , Douglas Anderson , Jitao Shi , Sam Ravnborg , Rob Clark , Dmitry Baryshkov Subject: [PATCH] drm/panel: boe-tv101wum-nl6: Ensure DSI writes succeed during disable Date: Thu, 5 Jan 2023 19:01:08 -0800 Message-Id: <20230106030108.2542081-1-swboyd@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. 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 vid= eo mode panel") Cc: yangcong Cc: Douglas Anderson Cc: Jitao Shi Cc: Sam Ravnborg Cc: Rob Clark Cc: Dmitry Baryshkov Signed-off-by: Stephen Boyd Reviewed-by: Douglas Anderson --- 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/d= rm/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_pa= nel *boe) return 0; } =20 -static int boe_panel_unprepare(struct drm_panel *panel) +static int boe_panel_disable(struct drm_panel *panel) { struct boe_panel *boe =3D to_boe_panel(panel); int ret; =20 - if (!boe->prepared) - return 0; - ret =3D 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 *pan= el) =20 msleep(150); =20 + return 0; +} + +static int boe_panel_unprepare(struct drm_panel *panel) +{ + struct boe_panel *boe =3D 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_orien= tation(struct drm_panel *pa } =20 static const struct drm_panel_funcs boe_panel_funcs =3D { + .disable =3D boe_panel_disable, .unprepare =3D boe_panel_unprepare, .prepare =3D boe_panel_prepare, .enable =3D boe_panel_enable, base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2 --=20 https://chromeos.dev