From patchwork Fri Jan 6 03:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 39916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp608631wrt; Thu, 5 Jan 2023 19:03:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXt3wloyxnzxkITTZU6/hOBl1L61CdDHNTG9Sg6EMMI6fly9bEMfq4b73i+UFlzS+O7/DQXa X-Received: by 2002:a17:902:70cb:b0:189:cada:4294 with SMTP id l11-20020a17090270cb00b00189cada4294mr52005112plt.5.1672974190768; Thu, 05 Jan 2023 19:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672974190; cv=none; d=google.com; s=arc-20160816; b=UcB+SUEHgSX/491q6KOX0eDxrEk1dUW+a7xupEIA5tjVozhBn8rLbUWXidlDjZpVvU T5SCJnygK0+WXSXvq5lq6iCyL15fu09pWj3KJ0x3GwDDuGY6fNbSIlUYZKWuNW4k1LHp AXRGlomRzfABfULKnuRr7UQp4ldRcfm5Rp+uo/MJzE5bSAJfruQ7cFmUsoJS7B3s0J/3 ZG1wi4WYkvKxj1DOVGwRN4IW7EBdSjgiPb4u4/UBqyXDQbCY4rivm1ZMS7uXF7kNk0d0 24mOgjd622J+5kAefM8wx4Mf9j4XMx0fP24mhDe/eAFsANYaVVCx4+J2xzYx4mhDDWFV fKQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FLEA2wQkQBIO15nu3HyGaLDd58pUqyHA63e/BahflBg=; b=thD4i0lb3rulKzLlM4uQX/4aDEat68t4l8apXimgR5xREf6/NLavAcB0q683pnRbmc 5atDcGHF1qcqiPBVmfP/d4XhoCRBRlp9IAzyASfqTMzI5yXQyqUx+9o8wZ/maMMo7DwS D65bP3a/FXBVTMAnD2WwPIB0NmnGrEq8wwSVIE8Cq8iLo84OjjJAyXvjffPR/wURo7bV fnlRwRkugHKtVBnvFBgAcORyogU1PTMY/icYu9tFRtHRUyJEl8kVxK6vnztqI5cdd+yz iCx+XhmES1zI8Api0eJLUl79Tva2iLHFIBUjsJdbkIE0ltUsZLt51vIQd0eJn0kroOf9 RSFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gr1lwpg+; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a1709029a4a00b00189bbc95db1si37252263plv.11.2023.01.05.19.02.58; Thu, 05 Jan 2023 19:03:10 -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=@chromium.org header.s=google header.b=gr1lwpg+; 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 S231854AbjAFDCQ (ORCPT + 99 others); Thu, 5 Jan 2023 22:02:16 -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-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 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754240585024379846?= X-GMAIL-MSGID: =?utf-8?q?1754240585024379846?= 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 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 Reviewed-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2 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,