Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1746775rwl; Thu, 5 Jan 2023 19:20:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXuURi1xgqHQSsSfVJ1rWs8LNxSN1ujiYe2hEnP2QoSs5Ieg2CDiWPx6eKAkcmrXtWEyOeYW X-Received: by 2002:a17:907:8b89:b0:7c1:6f86:eeb with SMTP id tb9-20020a1709078b8900b007c16f860eebmr42647802ejc.7.1672975225368; Thu, 05 Jan 2023 19:20:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672975225; cv=none; d=google.com; s=arc-20160816; b=P2x3MwmvA2jMfNQQw49dNcjrOpuXVRHhvX+OZZ8osWo3G5qMnoiwFplat3V1aGsuxb i64qipjJGjVOEzZ5mLgfL7lm0R+uM72lhLg0SfnB97trZjPGicuwlYlQJjLk3JX0u2rk cFItHnJNKK0L9h3/1G+O/ZD2WNHwFX28PIe2z36crKp9zeBA5pWZcS5S5wQe4sPnaMg0 z8ZVb30X6os6Gqu+HRb9ELntj+J5gzkRYeL+Z/7mprTnRHzTcU4iiCMwhzMr/Md943i/ QmTycWxC7Z6suHFsQ6Jietm/VW0NKX/wVs9Lue5JAZG+PQshSUkIQsJebMEc11/1hl9J VHsQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu2-20020a170906eec200b00840f80a0b03si31565002ejb.118.2023.01.05.19.20.12; Thu, 05 Jan 2023 19:20:25 -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 + 57 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 Content-Transfer-Encoding: 8bit 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 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 --- 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