From patchwork Fri May 3 21:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653445 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5161BC4345F for ; Fri, 3 May 2024 21:36:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1CA01128F7; Fri, 3 May 2024 21:36:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="W+/vD/tG"; dkim-atps=neutral Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CD6F1124B3 for ; Fri, 3 May 2024 21:36:26 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e4c4fb6af3so950735ad.0 for ; Fri, 03 May 2024 14:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772185; x=1715376985; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d+m8p2+fwwMHEcaYlRhsoMqeDao9Xs+fgyRTTXxpyQQ=; b=W+/vD/tGhnARKRyybp0mu2Z40trgfWrk7e/lHh9mTQQkfjeqzbl89xQA8db1hkam8g sGlj4j2ZYpIdE3NTftgGWUY8Y47j/YqIKC8WKp+iBcmds6p+2kotxdQyk7TfwieHYUeZ ECQRZKdjz8RZZ3uzw4iVwTBCModhbe+qtF5fs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772185; x=1715376985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d+m8p2+fwwMHEcaYlRhsoMqeDao9Xs+fgyRTTXxpyQQ=; b=UKH180T5KSzH1DIVDdaEy2c+hA/Xxpp+NcMWbvRoqf4vTuEUiu3uSFV4Ucp1CXjeOv nDGjNBNX3aTTXcX1bu8OE1H4Gi8NbGdwKJTOI2MwTOHUhC2EZ/W+Yf2MIPCuU8maX7dP Q9vlhcWJfNqAD3HiD64QKiKQO/e9AohS65wc3TtUvmaosIgcgAkrebXtXJz+bJ21bVt1 BX8dfswAMPwP0pg66HXvzRo2q6fdwOO1e2ZEwpey2HwZXXMQACkWND+aW8jrec6wc83J 6O3eDiTUS5CfF8XmoVY+Iio4lOb+0nReXZQEsyC+hgw4WuKjzO+N5x+Pmf86Dd9EnQjz sgcQ== X-Gm-Message-State: AOJu0YyQSCrNJ9li0nKCrmKuuWj1QsjVErSnK5jkP9DR80IpU3KVnzid BC/ZGuq3RDVtqR4w76Qi87paLuyGyP22n4MtkTpdbypc7EclTedcDXwhQEwLP2mPHknFZp08d8J ecQ== X-Google-Smtp-Source: AGHT+IEe8XlbR/2YlPVfssvvzVEwgr7rfoy9E26NkJtjDWBN5xy4JZSBQ68VuPVn9y4gwaS+LyUeIg== X-Received: by 2002:a17:902:c407:b0:1e5:e676:4b09 with SMTP id k7-20020a170902c40700b001e5e6764b09mr5664110plk.25.1714772185179; Fri, 03 May 2024 14:36:25 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:24 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Luca Weiss , Konrad Dybcio , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 01/48] drm/panel: raydium-rm692e5: Stop tracking prepared Date: Fri, 3 May 2024 14:32:42 -0700 Message-ID: <20240503143327.RFT.v2.1.I784238de4810658212a5786b219f128460562a37@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Luca Weiss Cc: Konrad Dybcio Signed-off-by: Douglas Anderson Tested-by: Luca Weiss --- Changes in v2: - New drivers/gpu/drm/panel/panel-raydium-rm692e5.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c index a613ba5b816c..21d97f6b8a2f 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c @@ -23,7 +23,6 @@ struct rm692e5_panel { struct drm_dsc_config dsc; struct regulator_bulk_data supplies[3]; struct gpio_desc *reset_gpio; - bool prepared; }; static inline struct rm692e5_panel *to_rm692e5_panel(struct drm_panel *panel) @@ -171,9 +170,6 @@ static int rm692e5_prepare(struct drm_panel *panel) struct device *dev = &ctx->dsi->dev; int ret; - if (ctx->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) { dev_err(dev, "Failed to enable regulators: %d\n", ret); @@ -213,8 +209,6 @@ static int rm692e5_prepare(struct drm_panel *panel) mipi_dsi_generic_write_seq(ctx->dsi, 0xfe, 0x00); - ctx->prepared = true; - return 0; } @@ -222,13 +216,9 @@ static int rm692e5_unprepare(struct drm_panel *panel) { struct rm692e5_panel *ctx = to_rm692e5_panel(panel); - if (!ctx->prepared) - return 0; - gpiod_set_value_cansleep(ctx->reset_gpio, 1); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - ctx->prepared = false; return 0; } From patchwork Fri May 3 21:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653446 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00EB8C4345F for ; Fri, 3 May 2024 21:36:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 083331126A7; Fri, 3 May 2024 21:36:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Papm5o6R"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59C6B1126A7 for ; Fri, 3 May 2024 21:36:29 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e3f17c6491so779015ad.2 for ; Fri, 03 May 2024 14:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772187; x=1715376987; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YlLGPoCdKZFYuD2WMpAl+nCcCPU9f5yFXStRl2ODaEI=; b=Papm5o6RfYMaTy5PtMHHA8OoTj4dTr//8E+dlKAwQH5OviCyDGU5M38xQxOtFvYh6P MGlpO+71JdVSZT8NJmSLHms9tvREnohdBdPg542YnjDnowwBcm11Eg6nX+7SLBpLPXnb s2SWScz9r41IazQyWohhhTsWlX27S5vKF8auA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772187; x=1715376987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YlLGPoCdKZFYuD2WMpAl+nCcCPU9f5yFXStRl2ODaEI=; b=EuJMz0/0IBExIO8Kqpab2bnBoik6awK6cRISBU5xvIJyZsaUe+QwERkEbXEVqD6FMf YMMbdPUYGH3JIvwRcer/7VPpfIHZ0en0AkLoN7XNDe4zBEy7OijQCbx0/fUCAy3tXydA 5iuR7VJXVW1NKHN7wEll0CkTpr7wm+f+QlUcmlJl2C/jcIQIr4HTvBJRl+M/DdKCuQYX jAAl9eyvEPeiBKMd8CK6daMdnTI39LND9Zs06BLDHoRXC7X1p/DgZts76pTbJQPcIgU2 cm8QnFPMQutiINlP/dQTcjbqSkebDZrhn1JC9VTTafJ4viSoCbRX/DoIcF6whHVRFiOR YkwA== X-Gm-Message-State: AOJu0YxiLoldEUTpDlnJV0ekqMhdZC7cOYpv5l74b7TLab4GMFJdnfsb ksasdTtx7DE8NygSq4M1NHkCYz/CsiGcNl29B88WBagX+GU6d9Xt1O2n6IoEyOR1NnYponOK7di GVQ== X-Google-Smtp-Source: AGHT+IFaMjrOZx6PlnR9YpeAGNYEPKz0BZS22xq3/WCuAMWn8FGGgonr0VuEXbwoSJfpxSoPjNw6pg== X-Received: by 2002:a17:902:db0e:b0:1ec:3227:94ea with SMTP id m14-20020a170902db0e00b001ec322794eamr4805493plx.67.1714772187608; Fri, 03 May 2024 14:36:27 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:27 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jerry Han , Jitao Shi , Rock Wang , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , Jerry Han , Jessica Zhang , Maarten Lankhorst , Matthias Brugger , Sam Ravnborg , Thomas Zimmermann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [RFT PATCH v2 02/48] drm/panel: boe-himax8279d: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:32:43 -0700 Message-ID: <20240503143327.RFT.v2.2.Ia3f254ab6e04e4f7afba6c066454498c8fb01324@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. NOTE: as part of this, transition the panel's direct calls to its disable/unprepare functions in shutdown/remove to call through DRM panel. Cc: Jerry Han Cc: Jitao Shi Cc: Rock Wang Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-boe-himax8279d.c | 31 +++----------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c index e225840b0d67..12e14615298b 100644 --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c @@ -47,9 +47,6 @@ struct panel_info { struct gpio_desc *enable_gpio; struct gpio_desc *pp33_gpio; struct gpio_desc *pp18_gpio; - - bool prepared; - bool enabled; }; static inline struct panel_info *to_panel_info(struct drm_panel *panel) @@ -86,17 +83,12 @@ static int boe_panel_disable(struct drm_panel *panel) struct panel_info *pinfo = to_panel_info(panel); int err; - if (!pinfo->enabled) - return 0; - err = mipi_dsi_dcs_set_display_off(pinfo->link); if (err < 0) { dev_err(panel->dev, "failed to set display off: %d\n", err); return err; } - pinfo->enabled = false; - return 0; } @@ -105,9 +97,6 @@ static int boe_panel_unprepare(struct drm_panel *panel) struct panel_info *pinfo = to_panel_info(panel); int err; - if (!pinfo->prepared) - return 0; - err = mipi_dsi_dcs_set_display_off(pinfo->link); if (err < 0) dev_err(panel->dev, "failed to set display off: %d\n", err); @@ -121,8 +110,6 @@ static int boe_panel_unprepare(struct drm_panel *panel) disable_gpios(pinfo); - pinfo->prepared = false; - return 0; } @@ -131,9 +118,6 @@ static int boe_panel_prepare(struct drm_panel *panel) struct panel_info *pinfo = to_panel_info(panel); int err; - if (pinfo->prepared) - return 0; - gpiod_set_value(pinfo->pp18_gpio, 1); /* T1: 5ms - 6ms */ usleep_range(5000, 6000); @@ -180,8 +164,6 @@ static int boe_panel_prepare(struct drm_panel *panel) /* T7: 20ms - 21ms */ usleep_range(20000, 21000); - pinfo->prepared = true; - return 0; poweroff: @@ -194,9 +176,6 @@ static int boe_panel_enable(struct drm_panel *panel) struct panel_info *pinfo = to_panel_info(panel); int ret; - if (pinfo->enabled) - return 0; - usleep_range(120000, 121000); ret = mipi_dsi_dcs_set_display_on(pinfo->link); @@ -205,8 +184,6 @@ static int boe_panel_enable(struct drm_panel *panel) return ret; } - pinfo->enabled = true; - return 0; } @@ -917,11 +894,11 @@ static void panel_remove(struct mipi_dsi_device *dsi) struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi); int err; - err = boe_panel_disable(&pinfo->base); + err = drm_panel_disable(&pinfo->base); if (err < 0) dev_err(&dsi->dev, "failed to disable panel: %d\n", err); - err = boe_panel_unprepare(&pinfo->base); + err = drm_panel_unprepare(&pinfo->base); if (err < 0) dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err); @@ -936,8 +913,8 @@ static void panel_shutdown(struct mipi_dsi_device *dsi) { struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi); - boe_panel_disable(&pinfo->base); - boe_panel_unprepare(&pinfo->base); + drm_panel_disable(&pinfo->base); + drm_panel_unprepare(&pinfo->base); } static struct mipi_dsi_driver panel_driver = { From patchwork Fri May 3 21:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653447 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DBC1C10F16 for ; Fri, 3 May 2024 21:36:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D60B01129FD; Fri, 3 May 2024 21:36:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Uj4IxLlj"; dkim-atps=neutral Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 800E61129FD for ; Fri, 3 May 2024 21:36:32 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1ecd9dab183so19697105ad.1 for ; Fri, 03 May 2024 14:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772191; x=1715376991; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ivwzpk8LV8o9VOgpaEI0wSikxdx7Ris0rIA4UDrHOxM=; b=Uj4IxLljsHU8f9iqXkcELEtu7bHvpfHM1mwQ+eCgI4z8/TM8lLp/Cg8fxIGWGPRrOH ojTsxI1WNkrKbrufZc0RwsuNdkXGjgKr3PXl8XGJmvKNlpVZ223J9VFY+rmpcU8ajZp/ wGm49SgeQioT9QwN6X3fum6qXOFWQsFmOmOhU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772191; x=1715376991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ivwzpk8LV8o9VOgpaEI0wSikxdx7Ris0rIA4UDrHOxM=; b=MJ/khWhG1iza6MSHXByD8PhbOxUvTtbbdHidyWPVegHYpFSEKpQrxzsgDoK9JWfERr xbx4GlZE64jPmKmGdS1RmSKgpqhSMO41eG2MtG97FdzLM7Be93RudzCCqs6i6T0IWQEJ XhaNWdiN43R5pMIIoqnyNejKNswVHCcJ2glZJdrHxW6n5jak1m3sun2c27geoy8VyK7X yY1ppQ35FyTM0D2k9ftnPesAOdLzSmIyNS7vakYXZ15eA265CCg6/maEazDxVrXXD8AC mTzSrWwfVQVjr5l61ogTnnGDpk83sN+pHg90L3Eonpz5EpbB/keAOH+FBHk7cPK4AzBc wMXg== X-Gm-Message-State: AOJu0YxRlBZ+ETJi8e7ULUbD8NVrlg/vHqpX+TEnjck6LM7w3GC4e4Jr r78sxokCLe0wMyxqCP3dpG3wI5TlzvNsY6smGu907Fu21XRPwSFbYGA1esHeinLhXvk7xvhlD0Z /2A== X-Google-Smtp-Source: AGHT+IEhtQwHX90SwQBe2NnOXhamncltrhxwpD6fYsYZstR87YJRnxBbL7AN6shwzv3NIn/AynD71A== X-Received: by 2002:a17:902:d093:b0:1e0:a2cf:62e8 with SMTP id v19-20020a170902d09300b001e0a2cf62e8mr6761839plv.10.1714772190912; Fri, 03 May 2024 14:36:30 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:30 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jerry Han , Jitao Shi , Rock Wang , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , Jerry Han , Jessica Zhang , Maarten Lankhorst , Matthias Brugger , Sam Ravnborg , Thomas Zimmermann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [RFT PATCH v2 03/48] drm/panel: boe-himax8279d: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:44 -0700 Message-ID: <20240503143327.RFT.v2.3.I19086c524d38f28f746befe85cb39ffda9d2f666@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Jerry Han Cc: Jitao Shi Cc: Rock Wang Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-boe-himax8279d.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c index 12e14615298b..df746baae301 100644 --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c @@ -894,14 +894,6 @@ static void panel_remove(struct mipi_dsi_device *dsi) struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi); int err; - err = drm_panel_disable(&pinfo->base); - if (err < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", err); - - err = drm_panel_unprepare(&pinfo->base); - if (err < 0) - dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err); - err = mipi_dsi_detach(dsi); if (err < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); @@ -909,14 +901,6 @@ static void panel_remove(struct mipi_dsi_device *dsi) drm_panel_remove(&pinfo->base); } -static void panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&pinfo->base); - drm_panel_unprepare(&pinfo->base); -} - static struct mipi_dsi_driver panel_driver = { .driver = { .name = "panel-boe-himax8279d", @@ -924,7 +908,6 @@ static struct mipi_dsi_driver panel_driver = { }, .probe = panel_probe, .remove = panel_remove, - .shutdown = panel_shutdown, }; module_mipi_dsi_driver(panel_driver); From patchwork Fri May 3 21:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653448 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4779C10F16 for ; Fri, 3 May 2024 21:36:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EA6F112A00; Fri, 3 May 2024 21:36:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MOgP2lZk"; dkim-atps=neutral Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id AAD1C112A00 for ; Fri, 3 May 2024 21:36:35 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1e5c7d087e1so1043385ad.0 for ; Fri, 03 May 2024 14:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772194; x=1715376994; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oJSS1xLEfY3Y1Nc4TX+Fmok5eKTdIJMR9yqmN0qgIiI=; b=MOgP2lZkWRhrXT1H5f1JWr7hNDTueBQrZTDZuzaYTqFt9SRdy+JXLPW4OXB0n6I42k kC9VDiphjjp7ZT4YnJ5kK4WDGPx1jFYeJ31LRsfPJ4jPnZUmVlUB8quEcVjVfkGXy3h8 VnlwlF2MSA6ul9oqbo/3t8rb2PcZ7sNEfd3oI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772194; x=1715376994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oJSS1xLEfY3Y1Nc4TX+Fmok5eKTdIJMR9yqmN0qgIiI=; b=kn1snX02QoVfEF+uqL/myEdfm9XixaE//2LDDx258J7oWIpsUM9xaXpFGsVlOqZ12X xAfVxHTSvsqneAq9miCh+pzlQ+76jXTO/qRlRqeNsx9pfWJxhFyhzqRM2wUO2u0sLaGf cmmPmJRu5YzljprPLzh9qImYTzHMv9kGqef67Ebm7t2HL9vsLv4MPp9eQ4TaUNp94P8l MPrOlOoo9ZcV5WOA24fDZM2xBSmH+UqvjR28/5ex8Vimuuj0BM54Nw/yYHkyrzd8e+R1 B6COzM6XYAJRscnQ4irJmoxVO68b2p2QS9gDNgMg1n6x/65/egoLEgEjnU02SRdw9T96 +fEw== X-Gm-Message-State: AOJu0Yye1IhsxCoKphI6emHE7JDCgscBQRUlEDYo6f0TgDwdVarbGxRt /BPYVHQCHuggjJ63/x0FoK/cQGK6hSldyaAb+hEZqjfhv3RdV6vtkou1m2u8W25VBLjIiyjZJdZ e6A== X-Google-Smtp-Source: AGHT+IF/xaXv/X0Wte4aZNJO+64pdFolxJxdcSTQcUQ0uEZBKmCrVQEqCkWitBuj2PfiwIvx+UWLZQ== X-Received: by 2002:a17:903:41d1:b0:1ec:22ca:b290 with SMTP id u17-20020a17090341d100b001ec22cab290mr5154916ple.21.1714772194313; Fri, 03 May 2024 14:36:34 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:32 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jitao Shi , Cong Yang , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Matthias Brugger , Sam Ravnborg , Thomas Zimmermann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [RFT PATCH v2 04/48] drm/panel: boe-tv101wum-nl6: Stop tracking prepared Date: Fri, 3 May 2024 14:32:45 -0700 Message-ID: <20240503143327.RFT.v2.4.Ib501f2eceb62016e09cfb17bca29bde0f605a567@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Jitao Shi Cc: Cong Yang Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 0ffe8f8c01de..667e1bb4a58b 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -50,8 +50,6 @@ struct boe_panel { struct regulator *avee; struct regulator *avdd; struct gpio_desc *enable_gpio; - - bool prepared; }; enum dsi_cmd_type { @@ -1450,9 +1448,6 @@ 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); @@ -1471,8 +1466,6 @@ static int boe_panel_unprepare(struct drm_panel *panel) regulator_disable(boe->pp3300); } - boe->prepared = false; - return 0; } @@ -1481,9 +1474,6 @@ static int boe_panel_prepare(struct drm_panel *panel) struct boe_panel *boe = to_boe_panel(panel); int ret; - if (boe->prepared) - return 0; - gpiod_set_value(boe->enable_gpio, 0); usleep_range(1000, 1500); @@ -1523,8 +1513,6 @@ static int boe_panel_prepare(struct drm_panel *panel) goto poweroff; } - boe->prepared = true; - return 0; poweroff: From patchwork Fri May 3 21:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653449 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29452C4345F for ; Fri, 3 May 2024 21:36:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 473F1112A01; Fri, 3 May 2024 21:36:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="epieQBs9"; dkim-atps=neutral Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTPS id 103D6112A01 for ; Fri, 3 May 2024 21:36:37 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1ecddf96313so1021735ad.2 for ; Fri, 03 May 2024 14:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772197; x=1715376997; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kta59gfQkdmQ0TL4kfPKXK/PL72P/0YD8zIuorS00AE=; b=epieQBs9qmqnvlmKyhkbyn1BgUi2DTP09m84nrAmWi9oQT8ERy9rO+2vRgLvndnAFB 90h+grHFGXcwGqtC0SaynqF1U+pFFkB4vYlF7/6ph5tgh0FUCaA4bV7Uw/DV3TsvW1Cf tmPzTPGRCyXs5L0eNrMdgBv+FwAnnCSPGzynI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772197; x=1715376997; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kta59gfQkdmQ0TL4kfPKXK/PL72P/0YD8zIuorS00AE=; b=uIIs3wARTOzu2zQqaL3SA08kD/AazK0Po0CI0TUrtziFoUSJR3Ej0II+EpUe7ppG4Z WW0tBjGSdsDduzHdNGcCjQBsFTdlWVOlfiPeGt706qSRtrIRg3fs1A5Xk8xUaU8UBRAA 7J5BkgRVu8QjYlhh3cNADSaB241EVIvqPsBuWKINBb6SSdQIJilWVu8EIiKqkMM+qt9j yGvlsMQnx5I2xtV8LQpcf1M4uP2q2gcu3qbQNQXEp1D+soMFt1100/17PzYQ28nHQpYl lJI3LH9fSJBiuUPlGaBDMFhywvfAaF0rMGQFDVBHui0Yqh7kvqkFkizjhR/4qTExi/st nc7A== X-Gm-Message-State: AOJu0YzpW7PWOpxN7GAcIQAkXEv7NffPYSlFqS7TFtsgYEBjBJLYxYqk uiuqiXw2O6zfEPjQN95629PWOjeu+6hsc0pzsTKjwe0uw1Bw8iNO+SixCVu3mJxCKwtxD0umyWa 9Hw== X-Google-Smtp-Source: AGHT+IHVhWhn4/nQtVyQZZLqUsnywWTqYGnhPIFneTo2Pek/30GOWy84nbyfus1Fy+LIRhpR3w7cFQ== X-Received: by 2002:a17:902:d4c7:b0:1e5:4f5:7fa7 with SMTP id o7-20020a170902d4c700b001e504f57fa7mr5769734plg.21.1714772197003; Fri, 03 May 2024 14:36:37 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:36 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jitao Shi , Cong Yang , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Matthias Brugger , Sam Ravnborg , Thomas Zimmermann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [RFT PATCH v2 05/48] drm/panel: boe-tv101wum-nl6: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:46 -0700 Message-ID: <20240503143327.RFT.v2.5.I5bd120aa0b7d17a1149ea43cc4852492834058c0@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Mediatek and Qualcomm boards. Both of those drivers appear to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Jitao Shi Cc: Cong Yang Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 667e1bb4a58b..77b20e24cac7 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1910,21 +1910,11 @@ static int boe_panel_probe(struct mipi_dsi_device *dsi) return ret; } -static void boe_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct boe_panel *boe = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&boe->base); - drm_panel_unprepare(&boe->base); -} - static void boe_panel_remove(struct mipi_dsi_device *dsi) { struct boe_panel *boe = mipi_dsi_get_drvdata(dsi); int ret; - boe_panel_shutdown(dsi); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); @@ -1972,7 +1962,6 @@ static struct mipi_dsi_driver boe_panel_driver = { }, .probe = boe_panel_probe, .remove = boe_panel_remove, - .shutdown = boe_panel_shutdown, }; module_mipi_dsi_driver(boe_panel_driver); From patchwork Fri May 3 21:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653450 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 872ABC25B5F for ; Fri, 3 May 2024 21:36:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEDA1112A03; Fri, 3 May 2024 21:36:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ynbp2ER9"; dkim-atps=neutral Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3F6B112A03 for ; Fri, 3 May 2024 21:36:40 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ec69e3dbcfso1120605ad.0 for ; Fri, 03 May 2024 14:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772199; x=1715376999; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gCoTs68fkVHbhVnPnaiJoDVVCaB+mneUDffLrqHY7lM=; b=Ynbp2ER9ifaRkF9M/UofcRtqGE/OZzqsVwpMhKKYsi+9NwgrKo7nFcLLtKKi+1XIeJ wNIgc8hXTS/pl7RSeVbFSsHdr9pqCTqYq22k7dgPQsZabKOU6xO+hHsopei8hkOCv+23 WPltaNyN91yeHbQN8qXIF2tYWqH7D3G2UyMuA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772199; x=1715376999; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gCoTs68fkVHbhVnPnaiJoDVVCaB+mneUDffLrqHY7lM=; b=B4p+WZRKu0Z/xbUmltdHSWosasMu7k5d3yDx0jwWHJHxXv+esS/yPaJuLJB5Lx/dhB lmhGDA8uOxonIG8StcoEyZh/lDobPzUqlV9vcJh3EdS7vU2O108AIzHHZ5Gu6bGDpeyv vkZuGK4PqtQuwza/GGkGNB77p1qIr0olzXvkqzzZX1Kf5UHiuucJ6OUR/Q4Hn2z27Vgp f+r2v5sQjFBSIVHe3bndynrfpITOGnTZK9QapvgZOmBZ8LGthaRN4TJmZHYj8IHwJxAy vqk2rimItWSYzn8t7tIqh+FbrUm7YEuWUgTcayAqugBEvwZyZ8f+ANFCTb2fFz0Mgq6c xW/g== X-Gm-Message-State: AOJu0Yyuf32IH+ZrblX6DsvHKBUTdDlsRS/c+KrTYfIsuPZ/3pMXDeVo Md+drjBv/rLKGWxt255p2NOZA7ryjt2ex4Pot6509dIUXjxP/pGpV0OMC1SzIPpkS7mQSwI8dwK 4nQ== X-Google-Smtp-Source: AGHT+IELE7rVEQIWwU2v7bYG2I6EIH6w07IbYCviD6Ulwew4A7zRTV/QWIpp+ISdHunRXglP3i8Fyw== X-Received: by 2002:a17:902:e5c4:b0:1ec:2274:8205 with SMTP id u4-20020a170902e5c400b001ec22748205mr5122613plf.48.1714772199273; Fri, 03 May 2024 14:36:39 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:38 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 06/48] drm/panel: edp: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:32:47 -0700 Message-ID: <20240503143327.RFT.v2.6.I4d1bf08781593c08127e506422687ab19fd3c824@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-edp.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 6db277efcbb7..344f67871d41 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -222,11 +222,8 @@ struct edp_panel_entry { struct panel_edp { struct drm_panel base; - bool enabled; bool no_hpd; - bool prepared; - ktime_t prepared_time; ktime_t powered_on_time; ktime_t unprepared_time; @@ -395,14 +392,9 @@ static int panel_edp_disable(struct drm_panel *panel) { struct panel_edp *p = to_panel_edp(panel); - if (!p->enabled) - return 0; - if (p->desc->delay.disable) msleep(p->desc->delay.disable); - p->enabled = false; - return 0; } @@ -420,17 +412,11 @@ static int panel_edp_suspend(struct device *dev) static int panel_edp_unprepare(struct drm_panel *panel) { - struct panel_edp *p = to_panel_edp(panel); int ret; - /* Unpreparing when already unprepared is a no-op */ - if (!p->prepared) - return 0; - ret = pm_runtime_put_sync_suspend(panel->dev); if (ret < 0) return ret; - p->prepared = false; return 0; } @@ -542,21 +528,14 @@ static int panel_edp_resume(struct device *dev) static int panel_edp_prepare(struct drm_panel *panel) { - struct panel_edp *p = to_panel_edp(panel); int ret; - /* Preparing when already prepared is a no-op */ - if (p->prepared) - return 0; - ret = pm_runtime_get_sync(panel->dev); if (ret < 0) { pm_runtime_put_autosuspend(panel->dev); return ret; } - p->prepared = true; - return 0; } @@ -565,9 +544,6 @@ static int panel_edp_enable(struct drm_panel *panel) struct panel_edp *p = to_panel_edp(panel); unsigned int delay; - if (p->enabled) - return 0; - delay = p->desc->delay.enable; /* @@ -598,8 +574,6 @@ static int panel_edp_enable(struct drm_panel *panel) panel_edp_wait(p->powered_on_time, p->desc->delay.powered_on_to_enable); - p->enabled = true; - return 0; } @@ -869,7 +843,6 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc, if (!panel) return -ENOMEM; - panel->enabled = false; panel->prepared_time = 0; panel->desc = desc; panel->aux = aux; From patchwork Fri May 3 21:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653451 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08789C4345F for ; Fri, 3 May 2024 21:36:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 27D2D112A04; Fri, 3 May 2024 21:36:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dz2/wjmk"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E4CC112603 for ; Fri, 3 May 2024 21:36:44 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ec69e3dbcfso1120925ad.0 for ; Fri, 03 May 2024 14:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772202; x=1715377002; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b/gDi06ypcwTUid62LmhVpKtIZZa53PC46cbq17u59E=; b=dz2/wjmkZ+ZbUcSAih9Fy6H01L6okgBgRnisl8Fl4WnamLouEE5HbTDx2lul7oesEL GSV7F/tQv2vC/Qu+wmo5G8c4ZDflnAft6dszwDg7XJUzRBW91SDqry0VBeclQj1tH3LS ZEcZzJ12amTTp4ZhWBzUNO+uLoYWNgjB/e/UY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772202; x=1715377002; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b/gDi06ypcwTUid62LmhVpKtIZZa53PC46cbq17u59E=; b=gsE4JAW1Jd4g05wGpBWm5Ug2wIJzWJqXOVxA/3rTUrnQqgw5PboATdAe6gGDC+dC0U dvNTV14fiCLSlis5+c5IACn0EXZr6V/AY70jP6RI36G+bFdZlVnRgpk5mGHG8TOVtB6z 5EYLQYYQCdjxFclwHt84TxX7bJEIawaS0ONBf+sW7qLxIVyPbXxOMNPp7j2tuXRbMWZA JM8bPQkyFpndPTEnbdBxPsYb8KBkZa08cDzUhZwQhFCirrlil1Y+rUsbixg/LNsqv2c1 +rgv9oUSg7V+YSExTg3Ziw8ucSI76evxm1CWsk8nKKpjsxhadbJ1NnDg3cs97Swws4wp AlDQ== X-Gm-Message-State: AOJu0YxKRnVKmzX6zs/RzpFJOGbKXsrvTxTNfzFyXDOXc2sUvuvNOLEV EEwBcpOogl3K0/+AcWiTamosf2N47dk91eMcGIQU+Ab7XtEcj/S+h3Cbo0bMUWfJm3p/q07qJ34 RNg== X-Google-Smtp-Source: AGHT+IHVkT5EJTIYXQXBX5EIce/1Ex+Br0DGJO9Vob3PlE0kbtZ2ROcTXrJAG7DEeHfLLcWqrz5ILQ== X-Received: by 2002:a17:902:ce8a:b0:1e4:9ad5:a666 with SMTP id f10-20020a170902ce8a00b001e49ad5a666mr4922430plg.25.1714772202526; Fri, 03 May 2024 14:36:42 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:40 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 07/48] drm/panel: edp: Add a comment about unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:48 -0700 Message-ID: <20240503143327.RFT.v2.7.Icff7f7005d997773d585e36aba9ed41a9865201f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, it's very difficult to know exactly which DRM modeset drivers are using panel-edp due to the sheer number of panels it handles. For now, we'll leave the calls and just add a comment to keep people from copying this code. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. - panel-edp and panel-simple just get a comment now. drivers/gpu/drm/panel/panel-edp.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 344f67871d41..9c4c5c0e39a3 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -944,13 +944,34 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc, return err; } -static void panel_edp_remove(struct device *dev) +static void panel_edp_shutdown(struct device *dev) { struct panel_edp *panel = dev_get_drvdata(dev); - drm_panel_remove(&panel->base); + /* + * NOTE: the following two calls don't really belong here. It is the + * responsibility of a correctly written DRM modeset driver to call + * drm_atomic_helper_shutdown() at shutdown time and that should + * cause the panel to be disabled / unprepared if needed. For now, + * however, we'll keep these calls due to the sheer number of + * different DRM modeset drivers used with panel-edp. The fact that + * we're calling these and _also_ the drm_atomic_helper_shutdown() + * will try to disable/unprepare means that we can get a warning about + * trying to disable/unprepare an already disabled/unprepared panel, + * but that's something we'll have to live with until we've confirmed + * that all DRM modeset drivers are properly calling + * drm_atomic_helper_shutdown(). + */ drm_panel_disable(&panel->base); drm_panel_unprepare(&panel->base); +} + +static void panel_edp_remove(struct device *dev) +{ + struct panel_edp *panel = dev_get_drvdata(dev); + + drm_panel_remove(&panel->base); + panel_edp_shutdown(dev); pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); @@ -961,14 +982,6 @@ static void panel_edp_remove(struct device *dev) panel->drm_edid = NULL; } -static void panel_edp_shutdown(struct device *dev) -{ - struct panel_edp *panel = dev_get_drvdata(dev); - - drm_panel_disable(&panel->base); - drm_panel_unprepare(&panel->base); -} - static const struct display_timing auo_b101ean01_timing = { .pixelclock = { 65300000, 72500000, 75000000 }, .hactive = { 1280, 1280, 1280 }, From patchwork Fri May 3 21:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653452 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B389C25B5C for ; Fri, 3 May 2024 21:36:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1289D112603; Fri, 3 May 2024 21:36:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g3iLaffZ"; dkim-atps=neutral Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id 20726112603 for ; Fri, 3 May 2024 21:36:46 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1e4f341330fso1078735ad.0 for ; Fri, 03 May 2024 14:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772204; x=1715377004; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=paGqFOJ2nhC87MmLby9MgxTeHu7XKJBlCB1L6uiDNwg=; b=g3iLaffZ1sPpzK3l+rV2uP0PyTZUVvDFmXrzRdpuSzevMSvk84+vGwkcstSWO+JEw1 9rkNoJ0X0pb1Ql1TX8bFH6ZZP6qKHJB9uuLth4+M7D59YmIJ2bqPTFtR+Y/nVGQZUtil /JdcRVwl9FJpGiiyk9//gq1fAy6HNUZUiyqYk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772204; x=1715377004; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=paGqFOJ2nhC87MmLby9MgxTeHu7XKJBlCB1L6uiDNwg=; b=ON6gtYYt8F4ittHIzhGLyTn4spDbNrsZ/vfZrdff26dj0J7nzWFkGHFZWoQqhFBT7P Dj/reKrBpXAaBfD8ddCG7d2RyeglHiU1Bj6ar9np0TPJFeE7ee3VDfhSU6a9c7PTo2as 5ODPBD33VkALMc0hpGJjoyvncU7gSLbOGuz/YB2o/boo7z3X4xnuLRD9c+FuXGuCQOaP Tda+j8K58G806c6gLasWAbINDcd+Uh92FZZVqhngWZOKCNONE+nR87hqboWkHy92mce2 V5LW9fxcs8qHxAkjNsA13+wINuCr2GEYrVRYGut7xua1ldA05VVM7jHtZZQLFbcB5prU uIgQ== X-Gm-Message-State: AOJu0Yxmkyhl+1Hv1KLXXZWYyUHL0Ye7Ooz+no2fGHoDebbWH7MZnIg/ CvTEAjJ1U1j8x+HClySLXGbSEXfvsniSPdGSbHG2idYqvXRWM2SwIrvKAQ8iTF4qiYa7/QmfP9s MZA== X-Google-Smtp-Source: AGHT+IEx3Ot96pqT0JZWFoeg3B/jPEk44kYlrdOtlaungPQljCh2vyyJ0lZPjiPjtxRQep5DNsRVJQ== X-Received: by 2002:a17:902:c40c:b0:1e4:df0c:a570 with SMTP id k12-20020a170902c40c00b001e4df0ca570mr4139211plk.8.1714772204518; Fri, 03 May 2024 14:36:44 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:43 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Chris Zhong , Lin Huang , Brian Norris , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 08/48] drm/panel: innolux-p079zca: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:32:49 -0700 Message-ID: <20240503143327.RFT.v2.8.I99c73621fe3fba067a5e7ee6a1f6293c23371e1e@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Chris Zhong Cc: Lin Huang Cc: Brian Norris Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-innolux-p079zca.c | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index 485178a99910..5833d3a0fc79 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -51,9 +51,6 @@ struct innolux_panel { struct regulator_bulk_data *supplies; struct gpio_desc *enable_gpio; - - bool prepared; - bool enabled; }; static inline struct innolux_panel *to_innolux_panel(struct drm_panel *panel) @@ -61,26 +58,11 @@ static inline struct innolux_panel *to_innolux_panel(struct drm_panel *panel) return container_of(panel, struct innolux_panel, base); } -static int innolux_panel_disable(struct drm_panel *panel) -{ - struct innolux_panel *innolux = to_innolux_panel(panel); - - if (!innolux->enabled) - return 0; - - innolux->enabled = false; - - return 0; -} - static int innolux_panel_unprepare(struct drm_panel *panel) { struct innolux_panel *innolux = to_innolux_panel(panel); int err; - if (!innolux->prepared) - return 0; - err = mipi_dsi_dcs_set_display_off(innolux->link); if (err < 0) dev_err(panel->dev, "failed to set display off: %d\n", err); @@ -104,8 +86,6 @@ static int innolux_panel_unprepare(struct drm_panel *panel) if (err < 0) return err; - innolux->prepared = false; - return 0; } @@ -114,9 +94,6 @@ static int innolux_panel_prepare(struct drm_panel *panel) struct innolux_panel *innolux = to_innolux_panel(panel); int err; - if (innolux->prepared) - return 0; - gpiod_set_value_cansleep(innolux->enable_gpio, 0); err = regulator_bulk_enable(innolux->desc->num_supplies, @@ -178,8 +155,6 @@ static int innolux_panel_prepare(struct drm_panel *panel) /* T7: 5ms */ usleep_range(5000, 6000); - innolux->prepared = true; - return 0; poweroff: @@ -189,18 +164,6 @@ static int innolux_panel_prepare(struct drm_panel *panel) return err; } -static int innolux_panel_enable(struct drm_panel *panel) -{ - struct innolux_panel *innolux = to_innolux_panel(panel); - - if (innolux->enabled) - return 0; - - innolux->enabled = true; - - return 0; -} - static const char * const innolux_p079zca_supply_names[] = { "power", }; @@ -407,10 +370,8 @@ static int innolux_panel_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs innolux_panel_funcs = { - .disable = innolux_panel_disable, .unprepare = innolux_panel_unprepare, .prepare = innolux_panel_prepare, - .enable = innolux_panel_enable, .get_modes = innolux_panel_get_modes, }; From patchwork Fri May 3 21:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653453 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FD2EC4345F for ; Fri, 3 May 2024 21:36:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC8D7112A05; Fri, 3 May 2024 21:36:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ETUuttk8"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E309112A05 for ; Fri, 3 May 2024 21:36:48 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1eab16c8d83so854755ad.3 for ; Fri, 03 May 2024 14:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772206; x=1715377006; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AM3srp3tc9xHdA4+vQgvWU13AmEZ/1q1evFgoZKKMpU=; b=ETUuttk8VpHAlXc/Phhu08iW19QpEm4lWVAuDmbJsSssj6cBX3+gyHCUqvxJilNUBk O5vG8ahDpE57WT7BG3rSJ/S55TlA4pFuPxlgjaZ7VoAPBsVBmkQfJoBBvoUKukCO1Kxs Pa20UF5HXv1zGPizyVLeU8PKpOITIcNPG6TB8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772206; x=1715377006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AM3srp3tc9xHdA4+vQgvWU13AmEZ/1q1evFgoZKKMpU=; b=Q0W6TGDj1h1SPTndlcc1yjkhtnkutfA1xcD3+TfyJ6VH7ncNIWR7yF24xkryiBJVpX odYYGkxSjYi6FmI6BiXHU1PqOvibtmNNJ/LahM/c9gEe3fqawl1GFLZJj/7z/hXu5k74 Fv8EwQuqZwDH8dbgOcDTqnywOa9ix8OyBZn96nMXQ4/O5JOIiT5dksdpMfgh7t8ltq3R YMR9EfsamRvzvNeTlCZ3KDtJVLQggfPP/gKr4fuRs/RAwNKgx12z1BbBhC+QJ2vI5648 4QEmDobpHt6e9QrMuhUHd7UHNWg9lqKANdXqMVX9XhWI2bJ5rP2o7VGzsdlU0tJwco6a /fAw== X-Gm-Message-State: AOJu0Yy4CdPvA+gNaCuFCa1iFz0xMJPSw7H1Fg8DuBu/FsytfaRq5hVN jH2pGvYZ0BZ1jp7Swq1deqFXXBsycLpdk0lK3PQcbC2hcsJU2u0Legyhk73i3JiiDyDWtUlc24z Vcw== X-Google-Smtp-Source: AGHT+IHQD9LkPID127xDFcCRAQJiVGTr5XKbdWyjPjZmELM/1pOIiovaPXVxv+TzcgrmiYCp2kAmvQ== X-Received: by 2002:a17:903:1211:b0:1e0:115c:e03c with SMTP id l17-20020a170903121100b001e0115ce03cmr4713172plh.53.1714772206553; Fri, 03 May 2024 14:36:46 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:45 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Chris Zhong , Lin Huang , Brian Norris , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 09/48] drm/panel: innolux-p079zca: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:50 -0700 Message-ID: <20240503143327.RFT.v2.9.Iaddb8e0cab570e2f8066a4baf1d49239a820b799@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Rockchip boards. The Rockchip driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Chris Zhong Cc: Lin Huang Cc: Brian Norris Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-innolux-p079zca.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index 5833d3a0fc79..280f0fc35b67 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -471,13 +471,6 @@ static void innolux_panel_remove(struct mipi_dsi_device *dsi) struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi); int err; - err = drm_panel_unprepare(&innolux->base); - if (err < 0) - dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err); - - err = drm_panel_disable(&innolux->base); - if (err < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", err); err = mipi_dsi_detach(dsi); if (err < 0) @@ -486,14 +479,6 @@ static void innolux_panel_remove(struct mipi_dsi_device *dsi) innolux_panel_del(innolux); } -static void innolux_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi); - - drm_panel_unprepare(&innolux->base); - drm_panel_disable(&innolux->base); -} - static struct mipi_dsi_driver innolux_panel_driver = { .driver = { .name = "panel-innolux-p079zca", @@ -501,7 +486,6 @@ static struct mipi_dsi_driver innolux_panel_driver = { }, .probe = innolux_panel_probe, .remove = innolux_panel_remove, - .shutdown = innolux_panel_shutdown, }; module_mipi_dsi_driver(innolux_panel_driver); From patchwork Fri May 3 21:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653454 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E67D2C10F16 for ; Fri, 3 May 2024 21:36:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 347B4112ABA; Fri, 3 May 2024 21:36:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OSb9ZXin"; dkim-atps=neutral Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 311AC112A08 for ; Fri, 3 May 2024 21:36:50 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ecddf96313so1022935ad.2 for ; Fri, 03 May 2024 14:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772209; x=1715377009; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NGK5xSZNNlb2uRbxmyeRSuB7caWdrwYvtVpURnzxX80=; b=OSb9ZXinj8bZnvxHNLg2C6Kcg7Z6cYGKKYYUBka7RcJquOc8i6LJAcCfrRZchFxqda 5zmO+ER+BNOoMvF/RcojCEg6J5ZGe4a5+/8WbI8CDf5FHEBCJjqN4JcHJ3y1TddBFymR Y7mlvti++23kDSOZ8STBcTyxC3b+oIPuhhutY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772209; x=1715377009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NGK5xSZNNlb2uRbxmyeRSuB7caWdrwYvtVpURnzxX80=; b=vC5fD/VxxVbC8Ga+PzNT6Ts+UVq70fDmhYjMlvXgeP0Gzts8m3vGtrwMyq4LcfpSrY N7/kmArms1KsrZoqydR+3/dn0SHh/YYv9FXueAklYpnQ/2Epnw5ju9D6UyrFNP4cs1O9 +v37nkhirAVSLidCCDfHNBBsqaL0DkedUz06eISqY+ME//QFM3dvCFCbcUDNLaylIXx/ ftpc9iNRMAW8+/c7fM8D9JgOmPunnbua72m4wjyd5Zr4rhtWzi2aysnHugaFVUvMHxC/ kyRZ7P+HcCnxwOdZrXBcfD8CKi5pAB3MCA7x4U9J97PKRFPhJT/nh1HPS/KYFw3f/PBO e6cg== X-Gm-Message-State: AOJu0YxmkOKS1nA5AjFN72xNLk4sDBcS3oY2Lvfh8BOV6n7ZkR/DxcD2 D4QneXVUjXjBvKSNYrgxpxBvpeXopI3M3HTNfMsX+LEIUA/3gBKiNxur4MMJpmEAq50pAe0obKc 7Hw== X-Google-Smtp-Source: AGHT+IEempTTTQ3d9Vy5vnr244sB3FyliFh1+HIKi7tUNUcNLkibMfoJWgsA8T7pfYRVD6IrR06Bvw== X-Received: by 2002:a17:902:b617:b0:1dd:e114:121c with SMTP id b23-20020a170902b61700b001dde114121cmr3627968pls.56.1714772208843; Fri, 03 May 2024 14:36:48 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:47 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jacobe Zang , Nicolas Belin , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 10/48] drm/panel: khadas-ts050: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:32:51 -0700 Message-ID: <20240503143327.RFT.v2.10.Ibed1026f20cab08c90fa376e68c2f23a343e826b@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Jacobe Zang Cc: Nicolas Belin Cc: Neil Armstrong Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-khadas-ts050.c | 28 ---------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-khadas-ts050.c b/drivers/gpu/drm/panel/panel-khadas-ts050.c index c54be0cc3f08..e35762ebdbd1 100644 --- a/drivers/gpu/drm/panel/panel-khadas-ts050.c +++ b/drivers/gpu/drm/panel/panel-khadas-ts050.c @@ -26,9 +26,6 @@ struct khadas_ts050_panel { struct gpio_desc *reset_gpio; struct gpio_desc *enable_gpio; struct khadas_ts050_panel_data *panel_data; - - bool prepared; - bool enabled; }; struct khadas_ts050_panel_cmd { @@ -642,9 +639,6 @@ static int khadas_ts050_panel_prepare(struct drm_panel *panel) unsigned int i; int err; - if (khadas_ts050->prepared) - return 0; - gpiod_set_value_cansleep(khadas_ts050->enable_gpio, 0); err = regulator_enable(khadas_ts050->supply); @@ -708,8 +702,6 @@ static int khadas_ts050_panel_prepare(struct drm_panel *panel) usleep_range(10000, 11000); - khadas_ts050->prepared = true; - return 0; poweroff: @@ -726,11 +718,6 @@ static int khadas_ts050_panel_unprepare(struct drm_panel *panel) struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel); int err; - if (!khadas_ts050->prepared) - return 0; - - khadas_ts050->prepared = false; - err = mipi_dsi_dcs_enter_sleep_mode(khadas_ts050->link); if (err < 0) dev_err(panel->dev, "failed to enter sleep mode: %d\n", err); @@ -747,31 +734,17 @@ static int khadas_ts050_panel_unprepare(struct drm_panel *panel) return 0; } -static int khadas_ts050_panel_enable(struct drm_panel *panel) -{ - struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel); - - khadas_ts050->enabled = true; - - return 0; -} - static int khadas_ts050_panel_disable(struct drm_panel *panel) { struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel); int err; - if (!khadas_ts050->enabled) - return 0; - err = mipi_dsi_dcs_set_display_off(khadas_ts050->link); if (err < 0) dev_err(panel->dev, "failed to set display off: %d\n", err); usleep_range(10000, 11000); - khadas_ts050->enabled = false; - return 0; } @@ -815,7 +788,6 @@ static int khadas_ts050_panel_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs khadas_ts050_panel_funcs = { .prepare = khadas_ts050_panel_prepare, .unprepare = khadas_ts050_panel_unprepare, - .enable = khadas_ts050_panel_enable, .disable = khadas_ts050_panel_disable, .get_modes = khadas_ts050_panel_get_modes, }; From patchwork Fri May 3 21:32:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653455 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C668C25B5C for ; Fri, 3 May 2024 21:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0DC3112D84; Fri, 3 May 2024 21:36:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OlEa2q9n"; dkim-atps=neutral Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04C53112A09 for ; Fri, 3 May 2024 21:36:51 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1ec4dc64c6cso1156305ad.0 for ; Fri, 03 May 2024 14:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772211; x=1715377011; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xpAqyGRZ35mrxRmKBHfboZzq/mHfdewzPnwv0OdchAs=; b=OlEa2q9nTLc4KgRybtpqaooRrkWpRil5myza9cBrn9/w3WCRGXpzO7/HTMlvoJ7sW4 9b7kmOtiO6ItUdozRJVci6SE9phcDvG8FdP+iDlwIUOdwEYTUSCA9l0aEMzyWzROoB3O xHE3dZVI2DZBpBj9GthIxw7GDi8WI9W0psjtA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772211; x=1715377011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xpAqyGRZ35mrxRmKBHfboZzq/mHfdewzPnwv0OdchAs=; b=WXQwuK34zxXd7odC0tXKR7DGVNfvpQkz/vjEZMkJ9IXHqSX8tgPWV5L36Dmp4OXDJj wONcpLD/CavE2frCru9ASc1XGhA0KdePfpvX5ZAjN/jg/17zrWvCqEu0heVUyZePwsxw VjP062ZYq+2m15XfshOzKxEZOZY/jDyVRJ/T7rZkZWHzjnuJYm11NxlA3gJG3vl1vUud 1BOT59ITe/TR5+AyakgA+7xXhSDXQppHJfY4x2G408aP5GG0Bx04rpI98BWKMqJyQTbl EhtVNxyK1yMUMwjplp009ruidCV3xG1dLCKj/Cv4/77l8e7zh2/dJ9s8vHxnvR/vkYTa CMyA== X-Gm-Message-State: AOJu0Yy7LmXRQpiAxYp9QFaD7o9Ok5GVG1RyHuBiebxuO3wP6qcSZCAH hGdYbqQBAtuawWgvS63YIHYXLYSSz8TX3U06VQf9c9JIpUpAUVTLzK81oZh2SoZy1JuS6rhFnv3 oQw== X-Google-Smtp-Source: AGHT+IHPgak4KhT/VY1k6i6WU80Ppl8jX085UmJogG4vsMPYn1oTd7Du1ToJIYk6Efeso5tSI4Y1lg== X-Received: by 2002:a17:902:ce87:b0:1e0:983c:d686 with SMTP id f7-20020a170902ce8700b001e0983cd686mr5162135plg.20.1714772210940; Fri, 03 May 2024 14:36:50 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:50 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Jacobe Zang , Nicolas Belin , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 11/48] drm/panel: khadas-ts050: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:52 -0700 Message-ID: <20240503143327.RFT.v2.11.I1ee65e7905bf5bf46a0e6c5126ac3c7aa25cb80b@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Jacobe Zang Cc: Nicolas Belin Cc: Neil Armstrong Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-khadas-ts050.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-khadas-ts050.c b/drivers/gpu/drm/panel/panel-khadas-ts050.c index e35762ebdbd1..14932cb3defc 100644 --- a/drivers/gpu/drm/panel/panel-khadas-ts050.c +++ b/drivers/gpu/drm/panel/panel-khadas-ts050.c @@ -880,16 +880,6 @@ static void khadas_ts050_panel_remove(struct mipi_dsi_device *dsi) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); drm_panel_remove(&khadas_ts050->base); - drm_panel_disable(&khadas_ts050->base); - drm_panel_unprepare(&khadas_ts050->base); -} - -static void khadas_ts050_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct khadas_ts050_panel *khadas_ts050 = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&khadas_ts050->base); - drm_panel_unprepare(&khadas_ts050->base); } static struct mipi_dsi_driver khadas_ts050_panel_driver = { @@ -899,7 +889,6 @@ static struct mipi_dsi_driver khadas_ts050_panel_driver = { }, .probe = khadas_ts050_panel_probe, .remove = khadas_ts050_panel_remove, - .shutdown = khadas_ts050_panel_shutdown, }; module_mipi_dsi_driver(khadas_ts050_panel_driver); From patchwork Fri May 3 21:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653456 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95A1CC4345F for ; Fri, 3 May 2024 21:36:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9250112E33; Fri, 3 May 2024 21:36:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dLJ6Mnyf"; dkim-atps=neutral Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id A0FBD112E33 for ; Fri, 3 May 2024 21:36:54 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1ed0abbf706so1068175ad.2 for ; Fri, 03 May 2024 14:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772213; x=1715377013; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fIbC9LrwuAAq79Jeay6jAxq6GRcu3tw3vRcfcGuhdCM=; b=dLJ6Mnyfmys2BL8O0VBKqUW9UCK2zxzDsLEDllWi+bLYq8QqIGXSK8Q8CbTs866sZ4 I8Bx5aXLP/YpSsVLP99CIEU3jWj2XPtLew3k3BxlVXVAVjjm6/j98WY3UFJ/tIlp7GvW QbjHhiPMOnIn1JXV2UJPghqXlFJYBX8pzdVFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772213; x=1715377013; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fIbC9LrwuAAq79Jeay6jAxq6GRcu3tw3vRcfcGuhdCM=; b=EDgEeLzCM+XjxavqgNYNdatj40Ey0BoRmp29pQm/ESQDU+flWnhFmrc6KWcZ+ebCny ZFETUgl8RHycWou8qLKRAePspMk6h8sAzmjR7tWE341NPZD2fGPS/2CH4zSfGDmWFbYr YGkvjKHQTHg84+ICMC7+epvwA4p3TTsqJHJZ0DFaXsF1zvhgLOY5aobf2FD6j26xybt2 OHLKtaRhjbVg3a3PWvyX10Nd/WxArAYuMXonHV9SsUMpAoXA+8sxe+TWE9cSE+bvR7nN qNZ6DJ0cE/g0VQcy3d7i3/E7G7NgUnwAeIgYWVErOTR3I9ZxP4/D0u6dFC0ifTn3XaSS M76Q== X-Gm-Message-State: AOJu0YwEFnkuebMeSEQvXUvQKwJbBCUiZS9JbcE891PIpOSpaGI+SCaj KMpZykNje1gsAs0gQUNCb3zasanuoCEY+bIWLKPBLQBgGNh83rI1/PvYpoTD9oTvOASPJ/SP5hX LSA== X-Google-Smtp-Source: AGHT+IEJVtpxW/vIwHLrsnoyEyV1IoA8JCw5mhGllbU5SBDs6pbVC07r9dJwje7IMXdKxtbI6jQipw== X-Received: by 2002:a17:902:9f98:b0:1eb:6468:7fc3 with SMTP id g24-20020a1709029f9800b001eb64687fc3mr3513255plq.62.1714772213125; Fri, 03 May 2024 14:36:53 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:52 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Brian Norris , Chris Zhong , Nickey Yang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 12/48] drm/panel: kingdisplay-kd097d04: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:32:53 -0700 Message-ID: <20240503143327.RFT.v2.12.I711d07c4f4738df199697fd534c452cdfa46a21f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Brian Norris Cc: Chris Zhong Cc: Nickey Yang Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../drm/panel/panel-kingdisplay-kd097d04.c | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c index 17f8d80cf2b3..88d775e000d4 100644 --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -23,9 +23,6 @@ struct kingdisplay_panel { struct regulator *supply; struct gpio_desc *enable_gpio; - - bool prepared; - bool enabled; }; struct kingdisplay_panel_cmd { @@ -185,15 +182,10 @@ static int kingdisplay_panel_disable(struct drm_panel *panel) struct kingdisplay_panel *kingdisplay = to_kingdisplay_panel(panel); int err; - if (!kingdisplay->enabled) - return 0; - err = mipi_dsi_dcs_set_display_off(kingdisplay->link); if (err < 0) dev_err(panel->dev, "failed to set display off: %d\n", err); - kingdisplay->enabled = false; - return 0; } @@ -202,9 +194,6 @@ static int kingdisplay_panel_unprepare(struct drm_panel *panel) struct kingdisplay_panel *kingdisplay = to_kingdisplay_panel(panel); int err; - if (!kingdisplay->prepared) - return 0; - err = mipi_dsi_dcs_enter_sleep_mode(kingdisplay->link); if (err < 0) { dev_err(panel->dev, "failed to enter sleep mode: %d\n", err); @@ -220,8 +209,6 @@ static int kingdisplay_panel_unprepare(struct drm_panel *panel) if (err < 0) return err; - kingdisplay->prepared = false; - return 0; } @@ -231,9 +218,6 @@ static int kingdisplay_panel_prepare(struct drm_panel *panel) int err, regulator_err; unsigned int i; - if (kingdisplay->prepared) - return 0; - gpiod_set_value_cansleep(kingdisplay->enable_gpio, 0); err = regulator_enable(kingdisplay->supply); @@ -275,8 +259,6 @@ static int kingdisplay_panel_prepare(struct drm_panel *panel) /* T7: 10ms */ usleep_range(10000, 11000); - kingdisplay->prepared = true; - return 0; poweroff: @@ -289,18 +271,6 @@ static int kingdisplay_panel_prepare(struct drm_panel *panel) return err; } -static int kingdisplay_panel_enable(struct drm_panel *panel) -{ - struct kingdisplay_panel *kingdisplay = to_kingdisplay_panel(panel); - - if (kingdisplay->enabled) - return 0; - - kingdisplay->enabled = true; - - return 0; -} - static const struct drm_display_mode default_mode = { .clock = 229000, .hdisplay = 1536, @@ -341,7 +311,6 @@ static const struct drm_panel_funcs kingdisplay_panel_funcs = { .disable = kingdisplay_panel_disable, .unprepare = kingdisplay_panel_unprepare, .prepare = kingdisplay_panel_prepare, - .enable = kingdisplay_panel_enable, .get_modes = kingdisplay_panel_get_modes, }; From patchwork Fri May 3 21:32:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653457 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F5AFC25B5C for ; Fri, 3 May 2024 21:36:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 888AA112EA2; Fri, 3 May 2024 21:36:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="e6B1xBL4"; dkim-atps=neutral Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6FA4112EA2 for ; Fri, 3 May 2024 21:36:56 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1223375ad.0 for ; Fri, 03 May 2024 14:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772216; x=1715377016; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vb3TgP/wCNf81D+aV3nRlzqlLyhQoFFUaND2nsUQhqU=; b=e6B1xBL4eHGDJq3sXiII13XDvRBBpqdt2qrL5LtZm5SJnr9HkR0jrDrEirtmuUkLlf 8Vdlo1JFRhyjRPfGzQlzn8pLljI9kSaC6xOo0j9ZXKAFH8r0M3dvxwKC+ZAPRjrzoHho HZVs0miXx67xJfFry+qB8x1uYyiocKmYEBM30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772216; x=1715377016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vb3TgP/wCNf81D+aV3nRlzqlLyhQoFFUaND2nsUQhqU=; b=QkkupHIKrar2EDRZmJHSKJKIdpinD0i+GejLwD6pE7p+Sj8DeDk8Wzv3oTifPyFKr2 zzyLlcARqykB5YhGiVjOmBnXiMPyFJn19e4oYHo6lClxOfle3Qm0TRVkYzMiF74wJSdg F1SrnlWfV6GE696zhKz9b73iZMl3mGQ3Zkf+cOaKAZqbCFFgpbwduqHNr0CgJX7aL+SC 0OOwZch/v2Lz0oPt/Gx77IOHevpq5a5R5lYc9rVr3QM2jHxXBxKXwQWOUuhP5bP0wonl GX2NFAYc5RX6beGUkEDNw/KvovMQMZdj3udjMyzRJ3oDY3w+XlZjTydan7bToGJGHEl8 lNBw== X-Gm-Message-State: AOJu0YyFpjDfk4ni/c3UAoGN9UtbdNtJ+fjg+wjX39ogk+Cv7pogXoah 7qomf8HWrhu28hizGxpQ7M04qegCEC+3sMxNtl2PwEUfKceSwbFmc90ekvaNy7WiUyW3o6PsztT l0Q== X-Google-Smtp-Source: AGHT+IFNtgQI4tL4b59ZXyBnIDIYmn8Ia9hPYK7earn8DOm88NvX2c1QDLLSGNTvuzAvGjP8xynfPQ== X-Received: by 2002:a17:903:2306:b0:1eb:1af8:309f with SMTP id d6-20020a170903230600b001eb1af8309fmr5572876plh.4.1714772215701; Fri, 03 May 2024 14:36:55 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:54 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Brian Norris , Chris Zhong , Nickey Yang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 13/48] drm/panel: kingdisplay-kd097d04: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:54 -0700 Message-ID: <20240503143327.RFT.v2.13.I6c7c84b1560dd374f6e7e8dc50f419a870d31d31@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Rockchip boards. The Rockchip driver appear to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Brian Norris Cc: Chris Zhong Cc: Nickey Yang Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-kingdisplay-kd097d04.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c index 88d775e000d4..d6b912277196 100644 --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -389,14 +389,6 @@ static void kingdisplay_panel_remove(struct mipi_dsi_device *dsi) struct kingdisplay_panel *kingdisplay = mipi_dsi_get_drvdata(dsi); int err; - err = drm_panel_unprepare(&kingdisplay->base); - if (err < 0) - dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err); - - err = drm_panel_disable(&kingdisplay->base); - if (err < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", err); - err = mipi_dsi_detach(dsi); if (err < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); @@ -404,14 +396,6 @@ static void kingdisplay_panel_remove(struct mipi_dsi_device *dsi) kingdisplay_panel_del(kingdisplay); } -static void kingdisplay_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct kingdisplay_panel *kingdisplay = mipi_dsi_get_drvdata(dsi); - - drm_panel_unprepare(&kingdisplay->base); - drm_panel_disable(&kingdisplay->base); -} - static struct mipi_dsi_driver kingdisplay_panel_driver = { .driver = { .name = "panel-kingdisplay-kd097d04", @@ -419,7 +403,6 @@ static struct mipi_dsi_driver kingdisplay_panel_driver = { }, .probe = kingdisplay_panel_probe, .remove = kingdisplay_panel_remove, - .shutdown = kingdisplay_panel_shutdown, }; module_mipi_dsi_driver(kingdisplay_panel_driver); From patchwork Fri May 3 21:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653458 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4534AC4345F for ; Fri, 3 May 2024 21:37:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AD0F113290; Fri, 3 May 2024 21:37:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="U8ik875N"; dkim-atps=neutral Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 007F311328E for ; Fri, 3 May 2024 21:36:59 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5c6bd3100fcso75615a12.3 for ; Fri, 03 May 2024 14:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772218; x=1715377018; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xn3kmqG9n+u6RTxNsaXpW9ople5vt6wNE5CodtGeIeA=; b=U8ik875NqGUjOnP5heUxRFWrJK1FJlCaz1LlfB0f7bysR25oMEOPM4jMP4Xg7qkywQ 0iZa+7XicVnt6F4NLEOrs5gBjCxMpWzat0mdJ75iZmwrPMl4llMOzLhUjDS18caZP1NO 7md5jPnFDloX15nmOcSkGga6ZSJsVaCoTE2Z4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772218; x=1715377018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xn3kmqG9n+u6RTxNsaXpW9ople5vt6wNE5CodtGeIeA=; b=VBE/iwCLBGDSDwGIS6h0h0NAzpOlEROI3+XVSC3e993k0+4MmUf5UPoALyV0/1fbTb a+f85kLSozcM1vgtYi4FmQpawmxrNvLVyph2M34i+USkliEDvHDkc1zov/XsnSj9ZleT /ZXTQicf1TSvdYNh4DXreBX94ry8rshjmb4CWoSJo/ZXjKaK2cIJFcF5O6zTNwI/aoAr fCqgJgNlyd2w1GHtwGXogWoVgpYkTUFaRN37/qzH+hj7aAis+Nhrccol7o1rsUBosGje MbL1ppBb6g7UFCbWd4XsDsAzBvbV5oGKGnusD9+U+KDqQZd8e6jwZF3hl+0irm8yi3dk RrYw== X-Gm-Message-State: AOJu0Yx9djeVum5kAjdFyN5j1LQXaEJHzxXft1GM/lh3RS3j9nKHivn1 ZxDPqYmfxlEAS9CAnozw4DgKV5H2Sr5U+sW24M1+WofdlTFwFnbHl8428oJa6vcKlp24I05yOZO oBw== X-Google-Smtp-Source: AGHT+IHU+zTKbiqkq2N+BAjsxHc3GvfIh424IhHaVXyvXNqc/r0rVspgmWUaRIVseSK1shOdJ8cBgw== X-Received: by 2002:a17:90b:400b:b0:2b2:9b67:198a with SMTP id ie11-20020a17090b400b00b002b29b67198amr4603020pjb.34.1714772218223; Fri, 03 May 2024 14:36:58 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:36:57 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Quentin Schulz , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 14/48] drm/panel: ltk050h3146w: Stop tracking prepared Date: Fri, 3 May 2024 14:32:55 -0700 Message-ID: <20240503143327.RFT.v2.14.I264417152e65b4a2e374666010666fa1c2d973fc@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: "Heiko Stübner" Cc: Quentin Schulz Signed-off-by: Douglas Anderson Reviewed-by: Quentin Schulz Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c index 1a26205701b5..5894bf30524a 100644 --- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c @@ -36,7 +36,6 @@ struct ltk050h3146w { struct regulator *vci; struct regulator *iovcc; const struct ltk050h3146w_desc *panel_desc; - bool prepared; }; static const struct ltk050h3146w_cmd page1_cmds[] = { @@ -521,9 +520,6 @@ static int ltk050h3146w_unprepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (!ctx->prepared) - return 0; - ret = mipi_dsi_dcs_set_display_off(dsi); if (ret < 0) { dev_err(ctx->dev, "failed to set display off: %d\n", ret); @@ -539,8 +535,6 @@ static int ltk050h3146w_unprepare(struct drm_panel *panel) regulator_disable(ctx->iovcc); regulator_disable(ctx->vci); - ctx->prepared = false; - return 0; } @@ -550,9 +544,6 @@ static int ltk050h3146w_prepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (ctx->prepared) - return 0; - dev_dbg(ctx->dev, "Resetting the panel\n"); ret = regulator_enable(ctx->vci); if (ret < 0) { @@ -593,8 +584,6 @@ static int ltk050h3146w_prepare(struct drm_panel *panel) msleep(50); - ctx->prepared = true; - return 0; disable_iovcc: From patchwork Fri May 3 21:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653459 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D0B4C4345F for ; Fri, 3 May 2024 21:37:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 991A3113292; Fri, 3 May 2024 21:37:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mPl40IRE"; dkim-atps=neutral Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67108113291 for ; Fri, 3 May 2024 21:37:02 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1e3c3aa8938so872975ad.1 for ; Fri, 03 May 2024 14:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772221; x=1715377021; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Y9nTdENQ7Wsy544i8JrWRgyMyQ3M74fjSP7BIF4QEI=; b=mPl40IREgw212F0pttDsQ7pppB7txT2UhAAU3OgGWP8SGzrlJeDvSUQ3Jtc48rVtaX PJVQO4ZFJK2oMH80y0TjMIuq3FGH3mfeJeMaGWgDAvQAedrjQa4v/6F3GtNxzy/pQvFV SWM4HAqV+Kv6GxSQyOjB9p0AUVGu4LS/+7eJ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772221; x=1715377021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Y9nTdENQ7Wsy544i8JrWRgyMyQ3M74fjSP7BIF4QEI=; b=XlM2rqwzhYFWfbO6CxvIPz2qWKKjEMZNpUt3EQqx2e3q30cGJP5iVK1Ufs6fSfurKS /kFU6Jiwk4CiTN8amP/80oshTGP4gXkfw+FkjkolbGeG8hD8BlayQWqvYx/r4hkZMJOB qkrfzboaDxHdHqappaSFDtF96STya7B9NeJ7My7Z9T+5uL2PcpLt3rTVf83xw7B2+iS+ OxMJkMK1z4+mbZ2zwK5zDAwQ9bq83vSutZAca7VXss4Mv/UXIkvUOC4S8yaxwF7CGCR2 1XCdtOeGArmFBDEIkK/+1Jc177ChpRPIHP29Z+goNUbk5WTPSeA/usjULLAladV8D+JM sXlA== X-Gm-Message-State: AOJu0Yw1icwmKTU/omARrsyd3fBwit8P915IHDiifVk1/ZTi/nlSL2LQ Nlx3RrCxDVxd0rE18nDvEZCfBKBqGcjoFzgQeWNpl/LL2CkyzquVO7bPd5hsKHmrraE2+cDA0a+ 5Ag== X-Google-Smtp-Source: AGHT+IG9ldtVTieXA1Mk9918TqXU0GmNr1vS54kcAamhylLrurY6wy29CnNThSUyMLFqb7DbECdGsQ== X-Received: by 2002:a17:902:a60c:b0:1e4:6938:6fe3 with SMTP id u12-20020a170902a60c00b001e469386fe3mr3701239plq.58.1714772220922; Fri, 03 May 2024 14:37:00 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:00 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Quentin Schulz , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 15/48] drm/panel: ltk050h3146w: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:56 -0700 Message-ID: <20240503143327.RFT.v2.15.Ibeb2e5692e34b136afe4cf55532f0696ab3f5eed@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: "Heiko Stübner" Cc: Quentin Schulz Signed-off-by: Douglas Anderson Reviewed-by: Quentin Schulz Tested-by: Quentin Schulz # RK3399 Puma with Tested-by: Quentin Schulz # PX30 Ringneck Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c index 5894bf30524a..292aa26a456d 100644 --- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c @@ -673,27 +673,11 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi) return 0; } -static void ltk050h3146w_shutdown(struct mipi_dsi_device *dsi) -{ - struct ltk050h3146w *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = drm_panel_unprepare(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret); - - ret = drm_panel_disable(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret); -} - static void ltk050h3146w_remove(struct mipi_dsi_device *dsi) { struct ltk050h3146w *ctx = mipi_dsi_get_drvdata(dsi); int ret; - ltk050h3146w_shutdown(dsi); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); @@ -725,7 +709,6 @@ static struct mipi_dsi_driver ltk050h3146w_driver = { }, .probe = ltk050h3146w_probe, .remove = ltk050h3146w_remove, - .shutdown = ltk050h3146w_shutdown, }; module_mipi_dsi_driver(ltk050h3146w_driver); From patchwork Fri May 3 21:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653460 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A4C5C10F16 for ; Fri, 3 May 2024 21:37:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8B34113293; Fri, 3 May 2024 21:37:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZX/TWgLr"; dkim-atps=neutral Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F9B1113293 for ; Fri, 3 May 2024 21:37:04 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e3c3aa8938so873175ad.1 for ; Fri, 03 May 2024 14:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772223; x=1715377023; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WGe/o9E+2J3mWXQ+Ut7332ISLmsjuHNvcfhFlYYK3u0=; b=ZX/TWgLr1sJookd/cuuepueKZOSneK6q84Uj7GVTlzQYtlw4UmKcQL7rSW8CdJ1Hw0 d+kJbnB44+7FSwW+GylxFFVr0ohOe+/XFIorjeMoDzBRT91PJqz80gsWwWNTcktXliyL H8aRWqkPbrzq6two6UBE5EgtTmMIMzm744POI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772223; x=1715377023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WGe/o9E+2J3mWXQ+Ut7332ISLmsjuHNvcfhFlYYK3u0=; b=K6+G/aDMYuFL8J40tpCItxhj1VOo8MopO/eLTPctcwouEJBybw/dMT5xpCrGnUs+nk XyQMlL3RmQDwhtfnrVY/f4kTzvlI06IBTcOjMr592+LIuxkFseD8VhYFY4ujnzec5jDb NnGKrPEGJvSZgR0k25sqYdBcD6MqoRPAJNZ8pSh6oWiUMhOTSFKt34np2NiLgvpgTeQN bBOAjl8r1TaFdjp8f3zCEaCkKu8+056EN/1grcnENAT845gbfb6xH9ycAkp0BR0PHxZ1 AkTX6bzYSMh1CqDqxjSEte2xS8VsZTlzMVzQUuhUNBNC9YlHfJEzipY9otRsaPrNa4f/ 32yw== X-Gm-Message-State: AOJu0YwJXy8ZBE/ASM6cToQzTUA6xoc9W3XuZpzCmnO+YOnxaHX6aL/H OX0H8WCTtjjgEDPbWJ3CSwV2w59SjfHrArotc4s1fAn56AOgEW0cSkLLjSLOAofky11/wKpwARv wzA== X-Google-Smtp-Source: AGHT+IEgRFrCTmA76ZQ+ZA/ZsnLrxvKdZ+FvjBO/HzwbNFAg+uY38D+QTINvkSf/bzeDzCo33IN3pA== X-Received: by 2002:a17:902:d386:b0:1e7:d492:1206 with SMTP id e6-20020a170902d38600b001e7d4921206mr4129620pld.53.1714772222926; Fri, 03 May 2024 14:37:02 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:02 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 16/48] drm/panel: ltk500hd1829: Stop tracking prepared Date: Fri, 3 May 2024 14:32:57 -0700 Message-ID: <20240503143327.RFT.v2.16.I4f574b87fe24765ddd4424437159b37a6481aa1a@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c index a4c9a5cb9811..ef27cab08f1d 100644 --- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c @@ -40,7 +40,6 @@ struct ltk500hd1829 { struct regulator *vcc; struct regulator *iovcc; const struct ltk500hd1829_desc *panel_desc; - bool prepared; }; static const struct ltk500hd1829_cmd ltk101b4029w_init[] = { @@ -492,9 +491,6 @@ static int ltk500hd1829_unprepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (!ctx->prepared) - return 0; - ret = mipi_dsi_dcs_set_display_off(dsi); if (ret < 0) dev_err(panel->dev, "failed to set display off: %d\n", ret); @@ -510,8 +506,6 @@ static int ltk500hd1829_unprepare(struct drm_panel *panel) regulator_disable(ctx->iovcc); regulator_disable(ctx->vcc); - ctx->prepared = false; - return 0; } @@ -522,9 +516,6 @@ static int ltk500hd1829_prepare(struct drm_panel *panel) unsigned int i; int ret; - if (ctx->prepared) - return 0; - ret = regulator_enable(ctx->vcc); if (ret < 0) { dev_err(ctx->dev, "Failed to enable vci supply: %d\n", ret); @@ -568,8 +559,6 @@ static int ltk500hd1829_prepare(struct drm_panel *panel) goto disable_iovcc; } - ctx->prepared = true; - return 0; disable_iovcc: From patchwork Fri May 3 21:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653461 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1F54C4345F for ; Fri, 3 May 2024 21:37:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 072D211328E; Fri, 3 May 2024 21:37:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Vltl9Aaz"; dkim-atps=neutral Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3657D112A08 for ; Fri, 3 May 2024 21:37:06 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e5715a9ebdso1040965ad.2 for ; Fri, 03 May 2024 14:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772225; x=1715377025; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OurSfwTANRkudP5WoG3OHb0cRgGIUvtMPN3apL/0E6k=; b=Vltl9AazbsDnC3aCH1gAoXbVw5wLU3luwB7d+/n0WKK7WcdWKCFMqukK77bF5p0Thm XhNaYmGOk4f9ezXl8SuIqKCSFzc0iGQ3NPuB/KcueAmpjQ4gD4y2TCa93NV6cj3JNwV5 NjdfWhR/wdvnZfw8Cdhz7Urc/bjj3pw+iLa28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772225; x=1715377025; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OurSfwTANRkudP5WoG3OHb0cRgGIUvtMPN3apL/0E6k=; b=R2sLCPzFDyrM3/7QfwEYtD/Yw9M06246270WYUSYE6AtrEZNQW3cx2GwT/FqOChobU OMYc6HyiRg3HuxrOH07D8E6FEbe+TOO2J0dP2gfuOEKDZS1aPFUjzC1U0LpcIY30G+An pAmAv6SlpaDRSnJqoZXI/qLjASlC/ni1+WSmiBAO2wcK8iLUuQ6+QpXO28J4X4mVNTso 5st88cYYUT0ishwiPtA5IcbZkcFDdURbZHeQqhMOEyf0yKcUx3xCzRp4EXWJ9dUqWSqZ +YmXYRvLQ0+bv+yIGzBQzJkKUOXksYQAjzL1nT9vVsdwmL6forJ7k3ZPbP1MZOK54xn2 FhiQ== X-Gm-Message-State: AOJu0YxEaeNEDKBelFKOirJ/N4AVD1XHmSq5e29sar0S2EaKti5W+aZS h16fa5/fEx8XETB6usc1QvplRs8lGVU8xSOHCNjpi5MSj0eC8xmozxD7/TSd/jUU4E02dGNe6VX YIA== X-Google-Smtp-Source: AGHT+IH9vby0Or/VZX1bepw3qRTBDCpHhFvXpQCEjgbtETO8XlYEb0zz4N/sIP1EkhPbEGMjNfnqIA== X-Received: by 2002:a17:902:e802:b0:1e6:40f1:9357 with SMTP id u2-20020a170902e80200b001e640f19357mr4411172plg.8.1714772225244; Fri, 03 May 2024 14:37:05 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:04 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 17/48] drm/panel: ltk500hd1829: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:32:58 -0700 Message-ID: <20240503143327.RFT.v2.17.If3edcf846f754b425959980039372a9fd1599ecc@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-leadtek-ltk500hd1829.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c index ef27cab08f1d..6b18cf00fd4a 100644 --- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c @@ -662,27 +662,11 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi) return 0; } -static void ltk500hd1829_shutdown(struct mipi_dsi_device *dsi) -{ - struct ltk500hd1829 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = drm_panel_unprepare(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret); - - ret = drm_panel_disable(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret); -} - static void ltk500hd1829_remove(struct mipi_dsi_device *dsi) { struct ltk500hd1829 *ctx = mipi_dsi_get_drvdata(dsi); int ret; - ltk500hd1829_shutdown(dsi); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); @@ -710,7 +694,6 @@ static struct mipi_dsi_driver ltk500hd1829_driver = { }, .probe = ltk500hd1829_probe, .remove = ltk500hd1829_remove, - .shutdown = ltk500hd1829_shutdown, }; module_mipi_dsi_driver(ltk500hd1829_driver); From patchwork Fri May 3 21:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653462 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BF68C25B5C for ; Fri, 3 May 2024 21:37:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 92B1C113294; Fri, 3 May 2024 21:37:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PaO6uvjw"; dkim-atps=neutral Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTPS id C48A0113294 for ; Fri, 3 May 2024 21:37:08 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1ecff927a45so1151135ad.0 for ; Fri, 03 May 2024 14:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772227; x=1715377027; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9+/1qUyCdCzkVssOOJ1mxYlZquUA9CwegGnK+VEhW+o=; b=PaO6uvjwCzkhILFSG0v2eEcqTxD2x5P8e1WQoOFZ2TeD/gl0pPT0fC/UpC/2ZFF2mc Uz8kowblHMFDRU6Y+epSgqGQuonVjaWyiAtlDyuDicwFBazWe/XNL+Aqq7qCxhfMFAzf EAlcEucaTXODAOE2BGhR0E5IBORqzWSZJ1BuU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772227; x=1715377027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9+/1qUyCdCzkVssOOJ1mxYlZquUA9CwegGnK+VEhW+o=; b=LP9kdCjvUsQrqyooTO3z/0GM/rIuKW85w6/DpM1NOp0Z37SN3kUnBa42tZ+okVjBpS 4hjOBYSYEopJp0m1WtjE/9zVZhRIO3W3cI5J02+bIQNfq5tctBjxyeCQ0QUomn9lHOcB ppKVYWcialEx9vQTnZpPiUoqR9uivFBWYzE5ydji6YfeTM1I4A/Z2kx0RI4hTJjeeAOK nVkyjmZ/0SU51i7Pl26vLYhlIbIga1wqz7oi2GheNy1bAJWfMbW5tpUQQXuVSZ1DHkqt QwZ7HjU3dMymTi7PUIYwnIQmWq/KAQ64j6/zHNdvoUWdVKLvIA6S1AnFvCcXn1z3/ap+ cFUw== X-Gm-Message-State: AOJu0YwcAzgzVwlllCuUWXz7L5hmKW8GPX+VnGJeV/0TYCuYqpje5XL+ vHC+YlK4ZWPQQBYHiLsDUywCFZREFT9whpoxSLiAnoxbY4DC6A/h6GWxNAltjV9+44x/VxZqxcv 71g== X-Google-Smtp-Source: AGHT+IGTWXuB+YR8b+Za+D7wJjlj72NgkCjkNj7UREApXr3TOavCp/wlhNUfEqh97guBF+8UAksjJg== X-Received: by 2002:a17:903:2344:b0:1ec:2bca:5aa8 with SMTP id c4-20020a170903234400b001ec2bca5aa8mr5189630plh.6.1714772227116; Fri, 03 May 2024 14:37:07 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:06 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Sumit Semwal , Benni Steini , Joel Selvaraj , Marijn Suijten , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 18/48] drm/panel: novatek-nt36672a: Stop tracking prepared Date: Fri, 3 May 2024 14:32:59 -0700 Message-ID: <20240503143327.RFT.v2.18.I13a06b9e6f5920659b1e5d12543b3cd9066383b8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Sumit Semwal Cc: Benni Steini Cc: Joel Selvaraj Cc: Marijn Suijten Signed-off-by: Douglas Anderson Tested-by: Joel Selvaraj --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c index 3886372415c2..35aace79613a 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -72,8 +72,6 @@ struct nt36672a_panel { struct regulator_bulk_data supplies[ARRAY_SIZE(nt36672a_regulator_names)]; struct gpio_desc *reset_gpio; - - bool prepared; }; static inline struct nt36672a_panel *to_nt36672a_panel(struct drm_panel *panel) @@ -119,9 +117,6 @@ static int nt36672a_panel_unprepare(struct drm_panel *panel) struct nt36672a_panel *pinfo = to_nt36672a_panel(panel); int ret; - if (!pinfo->prepared) - return 0; - /* send off cmds */ ret = nt36672a_send_cmds(panel, pinfo->desc->off_cmds, pinfo->desc->num_off_cmds); @@ -147,8 +142,6 @@ static int nt36672a_panel_unprepare(struct drm_panel *panel) if (ret < 0) dev_err(panel->dev, "power_off failed ret = %d\n", ret); - pinfo->prepared = false; - return ret; } @@ -179,9 +172,6 @@ static int nt36672a_panel_prepare(struct drm_panel *panel) struct nt36672a_panel *pinfo = to_nt36672a_panel(panel); int err; - if (pinfo->prepared) - return 0; - err = nt36672a_panel_power_on(pinfo); if (err < 0) goto poweroff; @@ -221,8 +211,6 @@ static int nt36672a_panel_prepare(struct drm_panel *panel) msleep(120); - pinfo->prepared = true; - return 0; poweroff: From patchwork Fri May 3 21:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653463 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CF82C4345F for ; Fri, 3 May 2024 21:37:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88D57113295; Fri, 3 May 2024 21:37:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PmIrPFrM"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DA48113295 for ; Fri, 3 May 2024 21:37:10 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e65a1370b7so1136475ad.3 for ; Fri, 03 May 2024 14:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772229; x=1715377029; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jCEzmsJkNVqJjLKEek1G559OvdmwxBqijlKTr/wX13A=; b=PmIrPFrMnfU6p1yTzoFc4s3BCOEQ6oDwjv8jtaRFrDGH+w3lQhtE3xn1rODdbt7pBe sOpS1sD/XQO/PzrXpAZUdHptJWiIKq9FOkc+4XDUT23H37C3nywNnLkxWxIktQIIQs5B Q/fmo/Co6Yw5mqvNl6DLKa6hBE8hTsUygSr5E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772229; x=1715377029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jCEzmsJkNVqJjLKEek1G559OvdmwxBqijlKTr/wX13A=; b=V0iMv2pPXhKQ5qvG8iQViWBn8Xel3+mtyG4zgYpU0QBU589aCwD3K+0IViyIVLjYsH 2HnwQIy07EapGQylSx1vTSHUrIZD7D+Lg99p8iQomVAqOwK/MiHo9j17kI4IpxJ98Jw9 FJ52CeIgjqjdzrAP0EQu6jivQ7/QG3gYoxDKuDdEIj4OlbW4gMMFDj24/1bJ/CjmA1Fi 2dQ8iPUEF2g2ZrZ7xyFew5Dqfo6E/m9eh/09no4f6hkojDk6cNs8puXfMuzpK+S+mj13 cI5jmr9J+j2d9GPDA823TP73PdTlgnGG9fWitwDo2RF1qeRd/ZC1CfuyfD/SVsYvJfNW NXIA== X-Gm-Message-State: AOJu0YztqKrwsLVhBy2GQzAYwCp14egxvDtKn6Q256C3lKPf+oaL/CWX CBkwH6n7Xx86bVb7tAYOB1x4Jsxg8j5ZigAYsx94+TbVALMvW8HZMw7fX2rbk5BexbYroqJBcS3 RLg== X-Google-Smtp-Source: AGHT+IF/zJruBSwTUZM1XWyjeIBA3vGsxjzRfWQyTdUJXMgAkw1voDP5oQ1EzE0p/oXqEfQ5DM+Pdw== X-Received: by 2002:a17:902:bb17:b0:1ec:7b0d:9eb9 with SMTP id im23-20020a170902bb1700b001ec7b0d9eb9mr3415331plb.64.1714772229039; Fri, 03 May 2024 14:37:09 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:08 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Sumit Semwal , Benni Steini , Joel Selvaraj , Marijn Suijten , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 19/48] drm/panel: novatek-nt36672a: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:00 -0700 Message-ID: <20240503143327.RFT.v2.19.I67819ba5513d4ef85f254a68b22a3402b4cdf30f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Qualcomm boards. The Qualcomm driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Sumit Semwal Cc: Benni Steini Cc: Joel Selvaraj Cc: Marijn Suijten Signed-off-by: Douglas Anderson Tested-by: Joel Selvaraj --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c index 35aace79613a..c2abd20e0734 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -656,14 +656,6 @@ static void nt36672a_panel_remove(struct mipi_dsi_device *dsi) struct nt36672a_panel *pinfo = mipi_dsi_get_drvdata(dsi); int err; - err = drm_panel_unprepare(&pinfo->base); - if (err < 0) - dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err); - - err = drm_panel_disable(&pinfo->base); - if (err < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", err); - err = mipi_dsi_detach(dsi); if (err < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); @@ -671,14 +663,6 @@ static void nt36672a_panel_remove(struct mipi_dsi_device *dsi) drm_panel_remove(&pinfo->base); } -static void nt36672a_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct nt36672a_panel *pinfo = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&pinfo->base); - drm_panel_unprepare(&pinfo->base); -} - static const struct of_device_id tianma_fhd_video_of_match[] = { { .compatible = "tianma,fhd-video", .data = &tianma_fhd_video_panel_desc }, { }, @@ -692,7 +676,6 @@ static struct mipi_dsi_driver nt36672a_panel_driver = { }, .probe = nt36672a_panel_probe, .remove = nt36672a_panel_remove, - .shutdown = nt36672a_panel_shutdown, }; module_mipi_dsi_driver(nt36672a_panel_driver); From patchwork Fri May 3 21:33:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653464 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50001C10F16 for ; Fri, 3 May 2024 21:37:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68264113297; Fri, 3 May 2024 21:37:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TLoJvQ/5"; dkim-atps=neutral Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id A855B113296 for ; Fri, 3 May 2024 21:37:12 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1ec92e355bfso1189645ad.3 for ; Fri, 03 May 2024 14:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772231; x=1715377031; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AkEQE93f5W3qrIiQKk9BZKKCez6HKRClYa+QpRpQRiA=; b=TLoJvQ/5hvsntZ+9aUhtA9RT41PFE/iytWPRltKFEZwBW71gr4e/lipxZFgxHAkr08 lxm/20LVb6C73IrPvo4m9uF1PLz61qO7WwAMpE6KKivm48c0eGalQtmuc0RYMvpf1n48 Onl9LBR2ewBXQHSRauQ/15IgGy7xeN6ILUilc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772231; x=1715377031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AkEQE93f5W3qrIiQKk9BZKKCez6HKRClYa+QpRpQRiA=; b=hHqXsfBH8ogfkuR3R6TKoQDjO+dmnzopK9XAbltHYV+CS5iQHo8DXzz3sxEUxDujyI WAixQlcUdE4tkFfnQVIz+vZAzG774bP+cqzGYg9j99coFER7W0rTuGu1L9mMXJM3SpFQ kQStO3ibvkHsfJp6Rr4QbTMhA0eV/jJRonfxRWY0VRHIt1jGk0WVUrveNcHAJV2D6qGq JRB3HTfu7EXa2Sv5djL1iu8tiga02aJHsLw0kxzgfEMBXPV+sjYXnM/74e/EKRYUzesZ hTXIK2gHU3w0ECfL96nncSk4XhaIdA36bzh3usH6onbNuGUJFlcgACxyyfmpm6GovD0N vQXg== X-Gm-Message-State: AOJu0YxpnYZXLjpHgH3gZ2zbiEXntgeocVQvtg+meqHlLSiu/BjvI9iX VJoCyer7IkD2bCYx+/pGB56eVkYA4yHauFx3qm4sTYU1Agsxk1MM0uRozbREz3cHry3IiGDf9kw jIQ== X-Google-Smtp-Source: AGHT+IErDEdWQJDxA1HZWTCGw5TL3HdjrluPTuCRLtiAQGGfIJv8XgK1D0yAqk5RVYxDWbW7F4IUEA== X-Received: by 2002:a17:902:ecc7:b0:1e3:ca5a:2d9a with SMTP id a7-20020a170902ecc700b001e3ca5a2d9amr4783895plh.53.1714772231641; Fri, 03 May 2024 14:37:11 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:10 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Stefan Mavrodiev , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 20/48] drm/panel: olimex-lcd-olinuxino: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:01 -0700 Message-ID: <20240503143327.RFT.v2.20.I6a96d762be98321e02f56b5864359258d65d9da8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Stefan Mavrodiev Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../drm/panel/panel-olimex-lcd-olinuxino.c | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c index 4819ada69482..8a687d3ba236 100644 --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c @@ -64,9 +64,6 @@ struct lcd_olinuxino { struct i2c_client *client; struct mutex mutex; - bool prepared; - bool enabled; - struct regulator *supply; struct gpio_desc *enable_gpio; @@ -78,30 +75,13 @@ static inline struct lcd_olinuxino *to_lcd_olinuxino(struct drm_panel *panel) return container_of(panel, struct lcd_olinuxino, panel); } -static int lcd_olinuxino_disable(struct drm_panel *panel) -{ - struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel); - - if (!lcd->enabled) - return 0; - - lcd->enabled = false; - - return 0; -} - static int lcd_olinuxino_unprepare(struct drm_panel *panel) { struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel); - if (!lcd->prepared) - return 0; - gpiod_set_value_cansleep(lcd->enable_gpio, 0); regulator_disable(lcd->supply); - lcd->prepared = false; - return 0; } @@ -110,27 +90,11 @@ static int lcd_olinuxino_prepare(struct drm_panel *panel) struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel); int ret; - if (lcd->prepared) - return 0; - ret = regulator_enable(lcd->supply); if (ret < 0) return ret; gpiod_set_value_cansleep(lcd->enable_gpio, 1); - lcd->prepared = true; - - return 0; -} - -static int lcd_olinuxino_enable(struct drm_panel *panel) -{ - struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel); - - if (lcd->enabled) - return 0; - - lcd->enabled = true; return 0; } @@ -195,10 +159,8 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs lcd_olinuxino_funcs = { - .disable = lcd_olinuxino_disable, .unprepare = lcd_olinuxino_unprepare, .prepare = lcd_olinuxino_prepare, - .enable = lcd_olinuxino_enable, .get_modes = lcd_olinuxino_get_modes, }; @@ -264,9 +226,6 @@ static int lcd_olinuxino_probe(struct i2c_client *client) lcd->eeprom.num_modes = 4; } - lcd->enabled = false; - lcd->prepared = false; - lcd->supply = devm_regulator_get(dev, "power"); if (IS_ERR(lcd->supply)) return PTR_ERR(lcd->supply); From patchwork Fri May 3 21:33:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653465 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D28CC4345F for ; Fri, 3 May 2024 21:37:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A600A11329A; Fri, 3 May 2024 21:37:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cx3RwMEB"; dkim-atps=neutral Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEFBA113298 for ; Fri, 3 May 2024 21:37:14 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e3ca546d40so1026175ad.3 for ; Fri, 03 May 2024 14:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772233; x=1715377033; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tTn5MbULQaeKHbflLx1nU+BRyKgxWcgq1caqQZJZ4uA=; b=cx3RwMEBJyWTzM4XmtrjS7X/8ZF2SpOIElAd1Xz1N29UvmhZIMSu9TPVNCTZ701I62 E45Xbfm1pxrRzsjMEB3GNln7WMoeacCoiE7WqmiizffzK1Q4tgNVSujDWWJdJlZm4oFw PNjQmMGoyUfJsMC509KMNXMNj1WpLjLimACeg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772233; x=1715377033; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tTn5MbULQaeKHbflLx1nU+BRyKgxWcgq1caqQZJZ4uA=; b=wTwEvNjs9fOsaaKRaDIcu9+xyecl098ALfTRmqn2wkT884U0aLALtBJc1+x6JStf1T /nUtB7iWQyVwDLpH7j4CFkAdGuSx4eHJnKZ1CUKaqADS2Oc0MyAtHpdD1P5qjC24wKe6 LXWqSpQnU7N6ADhUyZoe8hzDVdWh+40zgqjFS9XX7oxkRNZkQj5r95FRtL+Jq6+oI7VZ 4vUH35egFPQ8FbUe8tiSUm6/iVErt0SH/0Rnqwnpk5BTnGa+bc9UL1QgoC53phy4IdRE 293ltUmFhJjp6e/giPoKC5ACKi/RCfidTAFGG8ebzhrHeXYXvwJamttEF9mzcSGV3dHl L65g== X-Gm-Message-State: AOJu0Yw84xCPUFaW4dlFhtc/BHIV71SZ0rROT8kZVQMnCdsWZ9R6t8WR +rrgrHcg0BzWyDG4GtZhtAl0JjaG36iil+5+vSXv4TzST7HAZLAxJMZhngzn/5Hp5fvvFsr/Iy0 bkg== X-Google-Smtp-Source: AGHT+IEj6p7S/rBweU0qKixBlNVALPCuJKnvCSE6LujqLm3S0J98P3JUSBEGZTwGCVPY2YIYmiJT9w== X-Received: by 2002:a17:902:da87:b0:1e2:1915:2479 with SMTP id j7-20020a170902da8700b001e219152479mr4889534plx.12.1714772233439; Fri, 03 May 2024 14:37:13 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:12 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Stefan Mavrodiev , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 21/48] drm/panel: olimex-lcd-olinuxino: Don't call unprepare+disable at remove Date: Fri, 3 May 2024 14:33:02 -0700 Message-ID: <20240503143327.RFT.v2.21.I4c79deffb7551ecfb0378302f8dee1275fd1c060@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Stefan Mavrodiev Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c index 8a687d3ba236..94ae8c8270b8 100644 --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c @@ -251,9 +251,6 @@ static void lcd_olinuxino_remove(struct i2c_client *client) struct lcd_olinuxino *panel = i2c_get_clientdata(client); drm_panel_remove(&panel->panel); - - drm_panel_disable(&panel->panel); - drm_panel_unprepare(&panel->panel); } static const struct of_device_id lcd_olinuxino_of_ids[] = { From patchwork Fri May 3 21:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653466 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 665F4C4345F for ; Fri, 3 May 2024 21:37:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8549C113291; Fri, 3 May 2024 21:37:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aJ2n9sBP"; dkim-atps=neutral Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0853011329B for ; Fri, 3 May 2024 21:37:17 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1ecd3867556so924555ad.0 for ; Fri, 03 May 2024 14:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772236; x=1715377036; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9kb398tnZbF7fJMJErZr2qa99FcR7DjSwRYR6pHqFAA=; b=aJ2n9sBPLEdVJFh1KQeM0n+ud4RtE4ZrgdoejIvs4IZICtEqNB1RME/PLXC32GtPWJ eG03RQEGbbclLMahLAXhFBrU1EnFGHHGy6QEP85b5RLKm4drdb0OGZ5fcR/nBUIBts7c Oq0eZd6iP5sYH8+ffq8hziRTSTSzEFvEKi+Hk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772236; x=1715377036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9kb398tnZbF7fJMJErZr2qa99FcR7DjSwRYR6pHqFAA=; b=aI0ti4Y89gJnmHkbv5hqkNWltmbwRGECh+zBvBAWMyPXNP2U9VJgTl3A4nEADP1RvN rQ9reViyD1Pfu8OqnmzwkJHswtPRETQMEEIvHJeJnC7owFuCL0fo1ZoPMoMj7rdWvLPs v4fZSUb5a6lGs3gALhYBkLnjm47CRKyvsWRBqxIPuHxEv3VW9xIHbhGTwbreR787JNbc In+S1h/kU9rVhiOdeBWB+aog9dIsbfEqaZcGkNopWpckgVSaBjhKG1pSv95fFlYVoSgi 2D/xJXU+nu9MNxaQSjI6zr8JRpLxO44Rds7wFfkU8DJUy12OA6friiP4ui/FlMk166TK 7mdw== X-Gm-Message-State: AOJu0YyL+VrjA1H7BmOrKUVO27F+JeX3yAvADz2NRgITF58MRSXmcOWs kuQDejCu+fLpxFXyJ6Vi1UhX9IR8CUnpugJq+sKgbpW9cKETkH25oDhCqdVJ71UOmNmKXg40QDf Ztw== X-Google-Smtp-Source: AGHT+IHwYPDlKJY3i9orrstWVpc4QIsGJstcoDV81Owbok8H8JVv/jrLAEu/UHN2wqnlkUP+yYrQEQ== X-Received: by 2002:a17:902:d2c5:b0:1eb:992b:789b with SMTP id n5-20020a170902d2c500b001eb992b789bmr4648219plc.2.1714772235805; Fri, 03 May 2024 14:37:15 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:14 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Peter Ujfalusi , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 22/48] drm/panel: osd-osd101t2587-53ts: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:03 -0700 Message-ID: <20240503143327.RFT.v2.22.Ic7f6b4ae48027668940a756090cfc454645d3da4@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Peter Ujfalusi Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../drm/panel/panel-osd-osd101t2587-53ts.c | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c index 493e0504f6f7..c0da7d9512e8 100644 --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c @@ -21,9 +21,6 @@ struct osd101t2587_panel { struct regulator *supply; - bool prepared; - bool enabled; - const struct drm_display_mode *default_mode; }; @@ -37,13 +34,8 @@ static int osd101t2587_panel_disable(struct drm_panel *panel) struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); int ret; - if (!osd101t2587->enabled) - return 0; - ret = mipi_dsi_shutdown_peripheral(osd101t2587->dsi); - osd101t2587->enabled = false; - return ret; } @@ -51,11 +43,7 @@ static int osd101t2587_panel_unprepare(struct drm_panel *panel) { struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); - if (!osd101t2587->prepared) - return 0; - regulator_disable(osd101t2587->supply); - osd101t2587->prepared = false; return 0; } @@ -63,16 +51,8 @@ static int osd101t2587_panel_unprepare(struct drm_panel *panel) static int osd101t2587_panel_prepare(struct drm_panel *panel) { struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); - int ret; - if (osd101t2587->prepared) - return 0; - - ret = regulator_enable(osd101t2587->supply); - if (!ret) - osd101t2587->prepared = true; - - return ret; + return regulator_enable(osd101t2587->supply); } static int osd101t2587_panel_enable(struct drm_panel *panel) @@ -80,15 +60,10 @@ static int osd101t2587_panel_enable(struct drm_panel *panel) struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); int ret; - if (osd101t2587->enabled) - return 0; - ret = mipi_dsi_turn_on_peripheral(osd101t2587->dsi); if (ret) return ret; - osd101t2587->enabled = true; - return ret; } From patchwork Fri May 3 21:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653467 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FAC2C10F16 for ; Fri, 3 May 2024 21:37:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DECB11329B; Fri, 3 May 2024 21:37:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MC9Fs8W2"; dkim-atps=neutral Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6123511329B for ; Fri, 3 May 2024 21:37:19 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e834159f40so687075ad.2 for ; Fri, 03 May 2024 14:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772238; x=1715377038; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YjHl+DB7wvFQ0erRTiSGp5Vkb60hgkc17VF3W8JYnEQ=; b=MC9Fs8W2cmSAdbwD+K9rNrtvdOVKoBaHusOUIiU+wieqpbdGMwGbhRUi0ftxhVCRKV ibv+z1OjDq7XtjUA1l/jL+mvowxHC2fv0CB7//bCCtoMcZWUTO0SR/yAA15owm9Z2OJC YUk7eaoqEXfzTj54Jp+dm3lSX/yKJNjYjsjeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772238; x=1715377038; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YjHl+DB7wvFQ0erRTiSGp5Vkb60hgkc17VF3W8JYnEQ=; b=wlqys++/Bd7duXh0jeJ+j0gSzLIvffvcn5RF0REECJEr9fvZnETt69xvq+t1K73X/b lwqzQa+bbBRrA8HMxdxfCZDcOuhPobL+5eDOkpDcfcId0TP1AC/FGk0e+WH7jVEEU9Qw F4SIAHqMnzesjr8g599K/YNgxCT0xSZRWmyz2MqtyNforZWAZp5QlrgFmaDA9Vod4sa6 w4aWCJgs3EzKJw7Q/LfEVsyjDIGGEYARxuxnD7iKtsLPv0+ZC5ZbelWLQFESvSRmmCua qh9ftsGjbNlJeLd1LdsfEqzHVyMWiPMid+77hxpGAsrgxOVrVnjeSKppcOg8GzRrPvud DcUQ== X-Gm-Message-State: AOJu0YxMKXR/3FC8ZdnBpJ1eHrxlL7aFjxrXwaQpZZwvtM9msTRxYI4q MmggLoUhwQ9wpLOKrTV1v9JWg8xLoeVIDP8f1ef+2QuYsxzT92uFPQJgmntgaJRp0QBy4zwboV+ P7Q== X-Google-Smtp-Source: AGHT+IHGkmJTrA+QEdoj0aZR/Y9uwm9CMi5KsoludQGf1jksEPkLR67IdZOHw27LEYo4LBKbqkaXGw== X-Received: by 2002:a17:902:e807:b0:1e5:556:60e2 with SMTP id u7-20020a170902e80700b001e5055660e2mr4570462plg.5.1714772238405; Fri, 03 May 2024 14:37:18 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:17 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Peter Ujfalusi , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 23/48] drm/panel: osd-osd101t2587-53ts: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:04 -0700 Message-ID: <20240503143327.RFT.v2.23.Ic533ce1323b94230d4155f9364c2b7c1bc47e798@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by TI OMAP boards. The OMAP driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Peter Ujfalusi Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c index c0da7d9512e8..dbea84f51514 100644 --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c @@ -186,11 +186,6 @@ static void osd101t2587_panel_remove(struct mipi_dsi_device *dsi) struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi); int ret; - ret = drm_panel_disable(&osd101t2587->base); - if (ret < 0) - dev_warn(&dsi->dev, "failed to disable panel: %d\n", ret); - - drm_panel_unprepare(&osd101t2587->base); drm_panel_remove(&osd101t2587->base); ret = mipi_dsi_detach(dsi); @@ -198,14 +193,6 @@ static void osd101t2587_panel_remove(struct mipi_dsi_device *dsi) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); } -static void osd101t2587_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&osd101t2587->base); - drm_panel_unprepare(&osd101t2587->base); -} - static struct mipi_dsi_driver osd101t2587_panel_driver = { .driver = { .name = "panel-osd-osd101t2587-53ts", @@ -213,7 +200,6 @@ static struct mipi_dsi_driver osd101t2587_panel_driver = { }, .probe = osd101t2587_panel_probe, .remove = osd101t2587_panel_remove, - .shutdown = osd101t2587_panel_shutdown, }; module_mipi_dsi_driver(osd101t2587_panel_driver); From patchwork Fri May 3 21:33:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653468 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C68A2C4345F for ; Fri, 3 May 2024 21:37:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D017111329C; Fri, 3 May 2024 21:37:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Hhx5mQdq"; dkim-atps=neutral Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2176111329C for ; Fri, 3 May 2024 21:37:22 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1e834159f40so687265ad.2 for ; Fri, 03 May 2024 14:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772241; x=1715377041; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T4ZnBWaIKiuSZ6rYgD6PXXRcgsfalihno55gNzam3kQ=; b=Hhx5mQdqOgPvYAzBd9eOnqsM2LwYRIyXUP+vMArFkPBpGyKxjKYpiaOzhn/8xWYmWR oHxoqGUEcRhjMQmWI//Pr4Xnu/TkkEiYvAdRcnk3lTxDSTdXQacUjblf6jtQIPMhrmtU YYLX//UovoezxVZ0Tehds0Sesgkpcsi/Aiq7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772241; x=1715377041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4ZnBWaIKiuSZ6rYgD6PXXRcgsfalihno55gNzam3kQ=; b=PgHsyKkW9TBKOAHEDjaIfZ/2HeON6G5KMbaUE/KJL2F0xO/XVUiqU1XqsOEb89Fe2y R9nMIb/eJYVEn4+Wx/EodZm75B6K695DoYPu3nV+VGG6ntd3HkCHFkw52ITz6lXjo46Y cVF0BRnuEfRM6K8xsQ5HdxDPI8CLI8UJPEQdVuVJQgMGRiibNECS9OUA5UTXh26KWWEY +PNrDkvvNlyGhlDDTerKhRnGqP3Q9YjFVi9khtw0EaxzljVUqEoeM2S7cX8/72pMmnte XG/hm/4rG82e0dKvBgGhaLRoM7YNGYMzJTVs7mlBN5xmB5Ic4GTtelB/q0WAchTPCGFK hDDQ== X-Gm-Message-State: AOJu0YzUKQOW6u6lHRVxmbxs6a5lgA9ehjyJ7Gy4Uns9dDy85VJ52SsC /9RCLuwyxHfNRyV5yJNRM6ZG8J5v97i3gfNqnpHMTdQF4bLWft0cuZve2EslsqucrMRtXdZKYmn LJQ== X-Google-Smtp-Source: AGHT+IFBu/Hjhl9CXDDNgZhms0TZtEM8WWT7JEQNvy6BxJ5HNCgPTDI2jWO6fbS+Td4nj2A1qpFYHw== X-Received: by 2002:a17:902:6503:b0:1e0:a3dd:82df with SMTP id b3-20020a170902650300b001e0a3dd82dfmr4006853plk.38.1714772240760; Fri, 03 May 2024 14:37:20 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:19 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 24/48] drm/panel: samsung-atna33xc20: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:05 -0700 Message-ID: <20240503143327.RFT.v2.24.Ibb4f923363a27167c480a432e52884b117221974@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-samsung-atna33xc20.c | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c index a9f0d214a900..a322dd0a532f 100644 --- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c @@ -25,8 +25,6 @@ struct atana33xc20_panel { struct drm_panel base; - bool prepared; - bool enabled; bool el3_was_on; bool no_hpd; @@ -143,13 +141,8 @@ static int atana33xc20_disable(struct drm_panel *panel) { struct atana33xc20_panel *p = to_atana33xc20(panel); - /* Disabling when already disabled is a no-op */ - if (!p->enabled) - return 0; - gpiod_set_value_cansleep(p->el_on3_gpio, 0); p->el_on3_off_time = ktime_get_boottime(); - p->enabled = false; /* * Keep track of the fact that EL_ON3 was on but we haven't power @@ -173,10 +166,6 @@ static int atana33xc20_enable(struct drm_panel *panel) { struct atana33xc20_panel *p = to_atana33xc20(panel); - /* Enabling when already enabled is a no-op */ - if (p->enabled) - return 0; - /* * Once EL_ON3 drops we absolutely need a power cycle before the next * enable or the backlight will never come on again. The code ensures @@ -195,20 +184,14 @@ static int atana33xc20_enable(struct drm_panel *panel) atana33xc20_wait(p->powered_on_time, 400); gpiod_set_value_cansleep(p->el_on3_gpio, 1); - p->enabled = true; return 0; } static int atana33xc20_unprepare(struct drm_panel *panel) { - struct atana33xc20_panel *p = to_atana33xc20(panel); int ret; - /* Unpreparing when already unprepared is a no-op */ - if (!p->prepared) - return 0; - /* * Purposely do a put_sync, don't use autosuspend. The panel's tcon * seems to sometimes crash when you stop giving it data and this is @@ -220,26 +203,19 @@ static int atana33xc20_unprepare(struct drm_panel *panel) ret = pm_runtime_put_sync_suspend(panel->dev); if (ret < 0) return ret; - p->prepared = false; return 0; } static int atana33xc20_prepare(struct drm_panel *panel) { - struct atana33xc20_panel *p = to_atana33xc20(panel); int ret; - /* Preparing when already prepared is a no-op */ - if (p->prepared) - return 0; - ret = pm_runtime_get_sync(panel->dev); if (ret < 0) { pm_runtime_put_autosuspend(panel->dev); return ret; } - p->prepared = true; return 0; } From patchwork Fri May 3 21:33:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653469 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BAB28C25B5C for ; Fri, 3 May 2024 21:37:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C8AB11329E; Fri, 3 May 2024 21:37:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="hH8S4p13"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C53D11329E for ; Fri, 3 May 2024 21:37:24 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1226175ad.0 for ; Fri, 03 May 2024 14:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772242; x=1715377042; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HRQb/I07011T3t9lbY5bJjPOFJ2fx1sx6agjLTdJWzE=; b=hH8S4p13+Dn4V9sfyMDsVrglGLUJQPwcrHqpseImtf/83hQxNVDtrZ1JhmL658m3kc UDgEcVz1QTHTV7/s0vxl0o1ny3g9Xx0ih+NKC4fQZYtcgBT8EsXSvzE+rxx09TubIQgb LViGg5ApkJWu5jd6WbnOSX/Fgsc8BjGzJJ644= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772242; x=1715377042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HRQb/I07011T3t9lbY5bJjPOFJ2fx1sx6agjLTdJWzE=; b=Owpgg3aDHtyl1RiwWRxYUWA8CmJLnd93gbY1QBLK2rJk3kmUdVT9C48tT86+g/VMbV OA6tzHOiPE2J/AhV+k+zkTNPz1sliAFGujtNmhN1f3YAEFW2BTKpyO0I1XPoV5jd/e9c Gfs52VfHllVGrVQOqq+5buTsAIxsU5vsRmQdnwnaaxcgYd7aNN8qtE1ucnY5OIbmU1sb 8PL9gKPN6F6zyyEyoZl4u2if8B4pBDRi9YsCruM/KFSLnN+kGCJrh+7yE2bSS976Q5Uq hIs8p+UK5+aHM033lVD+Ku+dbH3NbFOfSQVZSzqvNuE5GO/itNFgBCWHHocEEHvPeI2j fe7Q== X-Gm-Message-State: AOJu0Yz9zqEjbRyVLgBrJPf71fhfGbYRFU4Mprsu2poUQq6elJGmcLWc MxKuZYtsv9U0e3tVO8TuRehpmITQawic96+5SaeauFBBKvX9CacbQlfLpbt6eqvGCun7pnmGdMQ 3hw== X-Google-Smtp-Source: AGHT+IF6CDvqfSrYxn7iKNnjnE2VAXasLzRdp4BnWV2DoDu3VKywSCP3Ny+zWphkbKiYpV8TR9pS2g== X-Received: by 2002:a17:902:cec7:b0:1e2:817b:460a with SMTP id d7-20020a170902cec700b001e2817b460amr4432991plg.34.1714772242613; Fri, 03 May 2024 14:37:22 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:21 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 25/48] drm/panel: samsung-atna33xc20: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:06 -0700 Message-ID: <20240503143327.RFT.v2.25.Iaeacccf98e6cb729b8fc3a782725769cd66812ad@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Qualcomm boards. The Qualcomm driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c index a322dd0a532f..9a482a744b8c 100644 --- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c @@ -327,21 +327,10 @@ static void atana33xc20_remove(struct dp_aux_ep_device *aux_ep) struct atana33xc20_panel *panel = dev_get_drvdata(dev); drm_panel_remove(&panel->base); - drm_panel_disable(&panel->base); - drm_panel_unprepare(&panel->base); drm_edid_free(panel->drm_edid); } -static void atana33xc20_shutdown(struct dp_aux_ep_device *aux_ep) -{ - struct device *dev = &aux_ep->dev; - struct atana33xc20_panel *panel = dev_get_drvdata(dev); - - drm_panel_disable(&panel->base); - drm_panel_unprepare(&panel->base); -} - static const struct of_device_id atana33xc20_dt_match[] = { { .compatible = "samsung,atna33xc20", }, { /* sentinal */ } @@ -362,7 +351,6 @@ static struct dp_aux_ep_driver atana33xc20_driver = { }, .probe = atana33xc20_probe, .remove = atana33xc20_remove, - .shutdown = atana33xc20_shutdown, }; static int __init atana33xc20_init(void) From patchwork Fri May 3 21:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653470 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CF88C4345F for ; Fri, 3 May 2024 21:37:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E51211329F; Fri, 3 May 2024 21:37:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NuR/UiW/"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id E685B11329F for ; Fri, 3 May 2024 21:37:26 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e834159f40so687655ad.2 for ; Fri, 03 May 2024 14:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772246; x=1715377046; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M2B/kTWdyUau2alXgEoUxYv1c4k3su/yovwNR5wduBo=; b=NuR/UiW/BplP62S7a8Uyv1idSUWIpiBNQPiDRX4RZNE77J++s0wWPIQu7dfyjhTxsm wq/+gZzHqzejhqAbgazArJY0jx8o2oorCPT51Z9eWX0ZDefxBuLl1vHSmdZWaVQzYy0Z qPvd9mkH3APOHT/IVHSUDUJSmyC0N7a34quFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772246; x=1715377046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M2B/kTWdyUau2alXgEoUxYv1c4k3su/yovwNR5wduBo=; b=YTvPqpr7t3t491MY2Fxl8uW0jLod/uUmTZvtPc+7cOun0tSDogZNMKLvjcPyU6lVCG k6/up4BylAYwgEnxv6I2pJVJhHQH5Miff5bsnnZEXwghIfBiy4QGTP0xKMPl7debkpyz XzgkIUCvJVvEaOBob3Aeu5vDzXnjlbB5UJ5TxoB+f72BVUOg8ucxjKhxwq6XyXOoKl5B ujj+gGHelowulmR9bCOHPOetwWoCgceZN1tNMCMaryraPlFTkQF+dLCE4o0WIN4N5TJm gLfJeU2Nxct31uWdG9t/ag9y+Bcsql/BlTclaeFUFoJHv81ftKTjTPRn1nb6pQgfYSE3 52PQ== X-Gm-Message-State: AOJu0YzmqzqC7WUTDxWzZjlK8B6fqLPILAjDAPM5SkRnX/OhlhIy0QHe xhoCpVrvAf/CgfDEMhk4MXq5ZQSU8mNqt6CPvx+O4U/m04uDQ+3TgUeVsV+Ifv3ZyqwY3YnndHo /ig== X-Google-Smtp-Source: AGHT+IHeLoFfHMC/OUeeJoDhqoJSJfOwPhDJNHriFCGoke4s3Yn0fXRdNzl+m82UbjoOonNJKwQK5Q== X-Received: by 2002:a17:902:d386:b0:1eb:519e:e05f with SMTP id e6-20020a170902d38600b001eb519ee05fmr3748669pld.45.1714772245858; Fri, 03 May 2024 14:37:25 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:24 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 26/48] drm/panel: simple: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:07 -0700 Message-ID: <20240503143327.RFT.v2.26.I865be97dd393d6ae3c3a3cd1358c95fdbca0fe83@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Signed-off-by: Douglas Anderson Acked-by: Sui Jingfeng --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-simple.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index dcb6d0b6ced0..42d902d2bbbe 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -138,9 +138,6 @@ struct panel_desc { struct panel_simple { struct drm_panel base; - bool enabled; - - bool prepared; ktime_t unprepared_time; @@ -290,14 +287,9 @@ static int panel_simple_disable(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); - if (!p->enabled) - return 0; - if (p->desc->delay.disable) msleep(p->desc->delay.disable); - p->enabled = false; - return 0; } @@ -317,18 +309,12 @@ static int panel_simple_suspend(struct device *dev) static int panel_simple_unprepare(struct drm_panel *panel) { - struct panel_simple *p = to_panel_simple(panel); int ret; - /* Unpreparing when already unprepared is a no-op */ - if (!p->prepared) - return 0; - pm_runtime_mark_last_busy(panel->dev); ret = pm_runtime_put_autosuspend(panel->dev); if (ret < 0) return ret; - p->prepared = false; return 0; } @@ -356,21 +342,14 @@ static int panel_simple_resume(struct device *dev) static int panel_simple_prepare(struct drm_panel *panel) { - struct panel_simple *p = to_panel_simple(panel); int ret; - /* Preparing when already prepared is a no-op */ - if (p->prepared) - return 0; - ret = pm_runtime_get_sync(panel->dev); if (ret < 0) { pm_runtime_put_autosuspend(panel->dev); return ret; } - p->prepared = true; - return 0; } @@ -378,14 +357,9 @@ static int panel_simple_enable(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); - if (p->enabled) - return 0; - if (p->desc->delay.enable) msleep(p->desc->delay.enable); - p->enabled = true; - return 0; } @@ -609,7 +583,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) if (!panel) return -ENOMEM; - panel->enabled = false; panel->desc = desc; panel->supply = devm_regulator_get(dev, "power"); From patchwork Fri May 3 21:33:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653471 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD0DDC10F16 for ; Fri, 3 May 2024 21:37:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ADB5110F880; Fri, 3 May 2024 21:37:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YfBBG958"; dkim-atps=neutral Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id 433A4112A0A for ; Fri, 3 May 2024 21:37:29 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1ed0abbf706so1070875ad.2 for ; Fri, 03 May 2024 14:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772248; x=1715377048; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vm5pMW+JcxQoAhIpk954JqF6buuPfxcd3q3C5XmFPm8=; b=YfBBG958od2GNyv+dJWRRtxtvOKginBwT1m0PRl+OEiA2aMIv4LhaR4p7lAJTUA+9d yRfrEWCpJ2D4+6EnZPE93+u0AosPzUKPnD0q0/z4dnKrIFu/tSxqHVh75wIAIQSuzd7L GVorhifXBxDyidGILkEXW4+O9CGOa83eKAiNc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772248; x=1715377048; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vm5pMW+JcxQoAhIpk954JqF6buuPfxcd3q3C5XmFPm8=; b=PGyzSsw8vk/ZlTIzzqDrTOiSAgIs6RaZchWMwOFB16r5A3F5KBa+MaEZC2CDc1YqL9 Nvc2nwMxCbsvtk8CKJBVxky/Gy/R8yS5GaxDdNZzArhzIXTMBagb7eDZczszGfXk9C9R gbgMk0Dzs+jnA34BJokS2FRJBI/J9nJaBlJ3Q/bR7MrokWSNPwYRJkB9cAIfYboOEqv/ mj9DFzI02pPxPkvphNbe5KIL6dXawD3qKWqzAyL4Ds5xiUnOM5hEOAdVLR+DhCSQuXVh vr1quqEA4r4JI6EGRyvq4C4VLz+U8m5xGeSW3QNdt8EbL685NwzvH4D02V4KdcFQJ1u+ YWBA== X-Gm-Message-State: AOJu0Yzi234Rjc8MCLJzcPhFF+W1l2VZYh8ddz2UqlnpTmoJW6w/PTaE hCs9a/ja7jXPidisR8fe9CC4/DCGKL8Qq5AkXauB3gM2DCZQzHlboIInh9nlDDEZz8Yfsmp+I89 YeA== X-Google-Smtp-Source: AGHT+IFYxFgWOwV/QXfwpPyO6iPfA33qW7XGRgN/4aov9d0tBWLiBcNJ5IccHks/fAhE+4fNaDTPow== X-Received: by 2002:a17:902:e54d:b0:1e6:7731:80 with SMTP id n13-20020a170902e54d00b001e677310080mr5258220plf.11.1714772248114; Fri, 03 May 2024 14:37:28 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:27 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 27/48] drm/panel: simple: Add a comment about unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:08 -0700 Message-ID: <20240503143327.RFT.v2.27.I639183ac987e139092491a94e22d46a5d857580c@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, it's very difficult to know exactly which DRM modeset drivers are using panel-simple due to the sheer number of panels it handles. For now, we'll leave the calls and just add a comment to keep people from copying this code. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. - panel-edp and panel-simple just get a comment now. drivers/gpu/drm/panel/panel-simple.c | 33 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 42d902d2bbbe..f39122ffdead 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -716,26 +716,39 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return err; } -static void panel_simple_remove(struct device *dev) +static void panel_simple_shutdown(struct device *dev) { struct panel_simple *panel = dev_get_drvdata(dev); - drm_panel_remove(&panel->base); + /* + * NOTE: the following two calls don't really belong here. It is the + * responsibility of a correctly written DRM modeset driver to call + * drm_atomic_helper_shutdown() at shutdown time and that should + * cause the panel to be disabled / unprepared if needed. For now, + * however, we'll keep these calls due to the sheer number of + * different DRM modeset drivers used with panel-simple. The fact that + * we're calling these and _also_ the drm_atomic_helper_shutdown() + * will try to disable/unprepare means that we can get a warning about + * trying to disable/unprepare an already disabled/unprepared panel, + * but that's something we'll have to live with until we've confirmed + * that all DRM modeset drivers are properly calling + * drm_atomic_helper_shutdown(). + */ drm_panel_disable(&panel->base); drm_panel_unprepare(&panel->base); - - pm_runtime_dont_use_autosuspend(dev); - pm_runtime_disable(dev); - if (panel->ddc) - put_device(&panel->ddc->dev); } -static void panel_simple_shutdown(struct device *dev) +static void panel_simple_remove(struct device *dev) { struct panel_simple *panel = dev_get_drvdata(dev); - drm_panel_disable(&panel->base); - drm_panel_unprepare(&panel->base); + drm_panel_remove(&panel->base); + panel_simple_shutdown(dev); + + pm_runtime_dont_use_autosuspend(dev); + pm_runtime_disable(dev); + if (panel->ddc) + put_device(&panel->ddc->dev); } static const struct drm_display_mode ampire_am_1280800n3tzqw_t00h_mode = { From patchwork Fri May 3 21:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653472 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6C03C25B5C for ; Fri, 3 May 2024 21:37:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 396FF10FC15; Fri, 3 May 2024 21:37:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="XwmZVWC8"; dkim-atps=neutral Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA61610FC15 for ; Fri, 3 May 2024 21:37:31 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1eab16dcfd8so1102645ad.0 for ; Fri, 03 May 2024 14:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772251; x=1715377051; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qk2LC4K5RJqsx2QB9+nJgz+tBqijGejd/DYbrsWwU0M=; b=XwmZVWC88pZQVRFv+Pst8RfpETW0CU3Mnot7BVtCgN+AjT4ePNlTJtAICtpfUlMUBp vL9KEkALeeNcQd8e3PeveED54TEeeg7XV7JZxKI5ed6HLqHdcEi/S0ExDCNKoR91yqki zTOPcVhINBirKndhmoFZSPmBd+EZeC5++Chpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772251; x=1715377051; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qk2LC4K5RJqsx2QB9+nJgz+tBqijGejd/DYbrsWwU0M=; b=Hr4QQr8YoDgbTygDKY+D1J5MkvNkg3NNPSPzwRVZnH/h/0YOxWqZTGLZ1t5R2tLI5/ JLxN3S79Dc/RuocU32MBkInUCzBIr+C//8uZYugDMOWJm9WUAcaGIIxGGCu2R5IeNslo ubcL12ovQ6WUUfa9FDj47UXyq+w1QNv/PDO3cwVlG4kFS1ZwdZa43ih2VPeF8kk/BL9r gB3k3xhTKXRsrb91Tiv9D4m9kPUeJ8zH9LrKVIxvzN2dL8HaL/plzF9+8RW/ZORzVUUK 9G7wM2fJ8nX1m0JT1oBMWLUzDPMeyOLimCegSdr1p23jgrUQlI56LXXq6uqUUZOB4Otj UPfw== X-Gm-Message-State: AOJu0Yz2U4JoCub4vxhJh1RXzOwhV/NKFBnTyzfegyi8vjhEV1NCVleQ qx0kVs2YAbymZL3p7vEMiBZgYn4Y8l+Jkx3xAGNO4xMv/EQ96i3neJf4oHP0EftHrfNH6+cGrj3 6iw== X-Google-Smtp-Source: AGHT+IF25tSPTopP9g7n30MtXJROijO2HKPmfXJa+9xCs2KvJx4G7kvTTz0Y7toa0BkNX3wlMPNHNw== X-Received: by 2002:a17:902:f685:b0:1eb:309a:ebdc with SMTP id l5-20020a170902f68500b001eb309aebdcmr5394677plg.30.1714772250902; Fri, 03 May 2024 14:37:30 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:30 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 28/48] drm/panel: tdo-tl070wsh30: Stop tracking prepared Date: Fri, 3 May 2024 14:33:09 -0700 Message-ID: <20240503143327.RFT.v2.28.I5025ab14adc2efeef1be1843648547fb725106be@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Neil Armstrong Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c index d8487bc6d611..36f27c664b69 100644 --- a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c +++ b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c @@ -24,8 +24,6 @@ struct tdo_tl070wsh30_panel { struct regulator *supply; struct gpio_desc *reset_gpio; - - bool prepared; }; static inline @@ -39,9 +37,6 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel) struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = to_tdo_tl070wsh30_panel(panel); int err; - if (tdo_tl070wsh30->prepared) - return 0; - err = regulator_enable(tdo_tl070wsh30->supply); if (err < 0) return err; @@ -74,8 +69,6 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel) msleep(20); - tdo_tl070wsh30->prepared = true; - return 0; } @@ -84,9 +77,6 @@ static int tdo_tl070wsh30_panel_unprepare(struct drm_panel *panel) struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = to_tdo_tl070wsh30_panel(panel); int err; - if (!tdo_tl070wsh30->prepared) - return 0; - err = mipi_dsi_dcs_set_display_off(tdo_tl070wsh30->link); if (err < 0) dev_err(panel->dev, "failed to set display off: %d\n", err); @@ -103,8 +93,6 @@ static int tdo_tl070wsh30_panel_unprepare(struct drm_panel *panel) regulator_disable(tdo_tl070wsh30->supply); - tdo_tl070wsh30->prepared = false; - return 0; } From patchwork Fri May 3 21:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653473 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88CF7C4345F for ; Fri, 3 May 2024 21:37:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B466D112A0A; Fri, 3 May 2024 21:37:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ev1E4bbM"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8452112A0A for ; Fri, 3 May 2024 21:37:34 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ecff927a45so1153715ad.0 for ; Fri, 03 May 2024 14:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772253; x=1715377053; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j0ij9ytrBMTlh/tBwBQfGeyqwsUC3qnXNREpsQEX2pQ=; b=ev1E4bbMrijdHKf3nB6OnpMx1jpkAMW1OuBdskjIEvdGD7Pi3F49GyewM0WIk0VL67 TMPkUHJig8GXM8e3LeJ/KdsXBjAktDZbq8gIjbfWUfJ8sEyWqbECh9Td8l57ruSTjaYa K4aQVU9o2uS/DXaZZ+F5mBMtEah0UcJD/IAMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772253; x=1715377053; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j0ij9ytrBMTlh/tBwBQfGeyqwsUC3qnXNREpsQEX2pQ=; b=DcWOw/88X6wklK8JQoD2ua3ip0ZdeNl1wQlZYch/c7V5HpRPRhfCFjVJSu0pXvdoGm p3KxZmK3dFrO+9bumRE1JcBAiuD1NmMSthTXZCJjAGbfCuf78ffoZDfRni1fu4/TGzuI 10eeHeihkk7DZeV6FPUfr1afohM89WoejSqZDSrx+03psGNiSeo3pIk7P0k7jEmvCq8n dzloTsdH9glPHr7NSgAsGyC+fx1+6N0iHNf3qigJRfkXFR+8GWUot68vrVRLb0tgK+eX bLDn41K1rHXS5pjYJHLmHw9tUFyW/i9xXEjr6Hx+xrEfJNcaQmexlhw2atLbY80q7y7b 8wBg== X-Gm-Message-State: AOJu0YyfiJd4KTgYj07375efJ1iyDwKq02Dcm+fAjTUIOU3wfkUbaEFg 8f2sKFwPUqsLNYpzWkO4RNTcfziGj9KsdDR+GAI1pcqI5GafeLVY87epP9IJBjeNTiMgX6jzd9J iIA== X-Google-Smtp-Source: AGHT+IGZhFFrirxel2mH4hhJVW+YPU9/55QLc4j01+5DJlTA0WMSbmDxlLpFOw990mv8yfllPRRAHg== X-Received: by 2002:a17:902:ef8b:b0:1e2:c554:a93c with SMTP id iz11-20020a170902ef8b00b001e2c554a93cmr2868203plb.29.1714772253398; Fri, 03 May 2024 14:37:33 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:32 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 29/48] drm/panel: tdo-tl070wsh30: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:10 -0700 Message-ID: <20240503143327.RFT.v2.29.I46ff4e28c260bcd8e81205debd0994e76fd8aeac@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Neil Armstrong Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c index 36f27c664b69..227f97f9b136 100644 --- a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c +++ b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c @@ -208,16 +208,6 @@ static void tdo_tl070wsh30_panel_remove(struct mipi_dsi_device *dsi) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); drm_panel_remove(&tdo_tl070wsh30->base); - drm_panel_disable(&tdo_tl070wsh30->base); - drm_panel_unprepare(&tdo_tl070wsh30->base); -} - -static void tdo_tl070wsh30_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&tdo_tl070wsh30->base); - drm_panel_unprepare(&tdo_tl070wsh30->base); } static struct mipi_dsi_driver tdo_tl070wsh30_panel_driver = { @@ -227,7 +217,6 @@ static struct mipi_dsi_driver tdo_tl070wsh30_panel_driver = { }, .probe = tdo_tl070wsh30_panel_probe, .remove = tdo_tl070wsh30_panel_remove, - .shutdown = tdo_tl070wsh30_panel_shutdown, }; module_mipi_dsi_driver(tdo_tl070wsh30_panel_driver); From patchwork Fri May 3 21:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653474 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 414D0C4345F for ; Fri, 3 May 2024 21:37:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B00E112A0D; Fri, 3 May 2024 21:37:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YN0io0Sb"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0EC85112A0B for ; Fri, 3 May 2024 21:37:37 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1ed835f3c3cso1043575ad.3 for ; Fri, 03 May 2024 14:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772256; x=1715377056; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uiw1xydznhtSh3tRBtRhpS0zYaaoLUo2meLrU+lEUtM=; b=YN0io0SbP/R5NF8ZwQ+udsLC/XzeEjYWIqV2yHP77wpAqZ84XG1bVtgw8QjZgl3Vsd Jmz6m1BNjz3cvsA3OxHsGhnWlX8NqLDTaxY/qL2bqNXD9A8JAYV3RHVKpoMQe/6LczLM F+R+yFef/QNut2aW1fbcqnR6KQXWbcytlx1Is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772256; x=1715377056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uiw1xydznhtSh3tRBtRhpS0zYaaoLUo2meLrU+lEUtM=; b=IweErIekt6TRikUtfZ3vLYyxwLK2utdG/WvwLl6kwWf0d7wavwWlDFCim9oK21t4rt fDdtUPNauUTw5zNulKEdwVMjxxZakuF2BW0lLOXujuWzc+wjPnxBiiTBScZP/ZtiN7yJ +3A7BUHbCG4I8l0ajEc00itBEp6IIuY7H+vPQ1kReL7DuzDaR7RAQsRxZSXkIHwVeymm oGxAUUMmAWlMMGjJqe/p0+QkE9VuFyeaEQLYttxLmBRW1Bq4U9VmE8zxCjv09uDDYuGK H34JvNMNBWolaAjY2g6gdPL8zjVm0Qp4WsH36VNbAf2xfYOM3ddRrfY1RO5cwtcD3mVt TKFQ== X-Gm-Message-State: AOJu0Yx9TTkUGketDTjnY2zyouMG7hCYa0adr8nE/T4/MIfcJxeYL/7O I/6mUvxCSm4ApjzJZIX1QBUh0qmB35CWYfW6WNULvASzEeTTP9k67vO7nK2EPaXrRKeUIJ+GuMc /2A== X-Google-Smtp-Source: AGHT+IFe81rGj8McqUJlsjyFTCj7SugLiyekq3wZXTXyN5wCjggXDovNiqeay6g57DA6tB8RQd7/nQ== X-Received: by 2002:a17:902:e750:b0:1e7:b7a7:9f20 with SMTP id p16-20020a170902e75000b001e7b7a79f20mr5609022plf.59.1714772256078; Fri, 03 May 2024 14:37:36 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:35 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 30/48] drm/panel: xinpeng-xpp055c272: Stop tracking prepared Date: Fri, 3 May 2024 14:33:11 -0700 Message-ID: <20240503143327.RFT.v2.30.I2145be78ce28327f4588c2c21370f22fd79d28b8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c index 8670386498a4..8262c00670cf 100644 --- a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c +++ b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c @@ -52,7 +52,6 @@ struct xpp055c272 { struct gpio_desc *reset_gpio; struct regulator *vci; struct regulator *iovcc; - bool prepared; }; static inline struct xpp055c272 *panel_to_xpp055c272(struct drm_panel *panel) @@ -136,9 +135,6 @@ static int xpp055c272_unprepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (!ctx->prepared) - return 0; - ret = mipi_dsi_dcs_set_display_off(dsi); if (ret < 0) dev_err(ctx->dev, "failed to set display off: %d\n", ret); @@ -152,8 +148,6 @@ static int xpp055c272_unprepare(struct drm_panel *panel) regulator_disable(ctx->iovcc); regulator_disable(ctx->vci); - ctx->prepared = false; - return 0; } @@ -163,9 +157,6 @@ static int xpp055c272_prepare(struct drm_panel *panel) struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; - if (ctx->prepared) - return 0; - dev_dbg(ctx->dev, "Resetting the panel\n"); ret = regulator_enable(ctx->vci); if (ret < 0) { @@ -209,8 +200,6 @@ static int xpp055c272_prepare(struct drm_panel *panel) msleep(50); - ctx->prepared = true; - return 0; disable_iovcc: From patchwork Fri May 3 21:33:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653475 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 058CCC4345F for ; Fri, 3 May 2024 21:37:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D15A112A0B; Fri, 3 May 2024 21:37:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bfGi0nrd"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C95F112A0B for ; Fri, 3 May 2024 21:37:40 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ecc23e6c9dso730405ad.2 for ; Fri, 03 May 2024 14:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772258; x=1715377058; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/OkjbvX0C1irAjMh4DggDyOVbw/aLDxkOK/5mqNSwoE=; b=bfGi0nrd79gvKM2yHEVQX5lF2C+C5bgI1jFjZqd84MQytRuU9iLKrVYLTNK7Rt5tCO 9uY2fq4Es2MOHmGi+ijioiHiwDrwQC0HdHZlC9om11nCbQaa/u2pPCjjCCs2xOPUmQsF 18tVTI95AF5JAMYlRlpAsTfklJ8yhmn70+fNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772258; x=1715377058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/OkjbvX0C1irAjMh4DggDyOVbw/aLDxkOK/5mqNSwoE=; b=QjRcPflmGOojgocuYeHdneY8a85Js38kGPm3JtJ2a782kU5sCJKtx55k2oSk8uZ6Di OqepGsrytuozMhnabXQ4i7YJLM9/4lUN8GRp12AVIaDhvDhrzscJhtp5i54/2KrOP6uH PQd78kAeVsToIB8y69pT9gW8ae6QiDVvUhBSuIe/z4Om7w8OP+qxX0fX04vnf1cPQgud vyRLK4oIxPEY3EPwX5HBsPm7OfyMF4J7HxO+r22DIM5NggkgsmztWhQjhtNe+nUpJelF cWH4AUJeUbeY4YC9Kz5NC2PJIX2GmO98T4nu3afT512sNSlmU6AHqpFxvDes1nSV2aoP 69xQ== X-Gm-Message-State: AOJu0YzDmxqJDgqRJcg5pc39NVvyB6DQdr4i+lKfeDbV5LiLziRJrQin Sr5L4SElLE22DxLxThw2TTmhXtJcIkZmKJ7naFSfhYR4bPU6qqcchEV6SNj480Y8g8wBX72F97K 6Lg== X-Google-Smtp-Source: AGHT+IGYHi4nDiwk/CzlytVTK20zaPGarGSgcOiG/MYrHHmtbd3gAzexe8vp7KqG0wrEiuiufOiKDQ== X-Received: by 2002:a17:903:1108:b0:1e5:5bd7:e2b7 with SMTP id n8-20020a170903110800b001e55bd7e2b7mr3948148plh.34.1714772258578; Fri, 03 May 2024 14:37:38 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:38 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 31/48] drm/panel: xinpeng-xpp055c272: Don't call unprepare+disable at shutdown/remove Date: Fri, 3 May 2024 14:33:12 -0700 Message-ID: <20240503143327.RFT.v2.31.Ib97e67a9877070698afbec4f8ede091b2bf89a1f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Rockchip boards. The Rockchip driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: "Heiko Stübner" Signed-off-by: Douglas Anderson Reviewed-by: Heiko Stuebner --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-xinpeng-xpp055c272.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c index 8262c00670cf..22a14006765e 100644 --- a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c +++ b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c @@ -306,27 +306,11 @@ static int xpp055c272_probe(struct mipi_dsi_device *dsi) return 0; } -static void xpp055c272_shutdown(struct mipi_dsi_device *dsi) -{ - struct xpp055c272 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = drm_panel_unprepare(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret); - - ret = drm_panel_disable(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret); -} - static void xpp055c272_remove(struct mipi_dsi_device *dsi) { struct xpp055c272 *ctx = mipi_dsi_get_drvdata(dsi); int ret; - xpp055c272_shutdown(dsi); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); @@ -347,7 +331,6 @@ static struct mipi_dsi_driver xpp055c272_driver = { }, .probe = xpp055c272_probe, .remove = xpp055c272_remove, - .shutdown = xpp055c272_shutdown, }; module_mipi_dsi_driver(xpp055c272_driver); From patchwork Fri May 3 21:33:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653476 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE3DCC25B5C for ; Fri, 3 May 2024 21:37:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E35CC112A0E; Fri, 3 May 2024 21:37:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="m/EtyHku"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9346F112A0E for ; Fri, 3 May 2024 21:37:41 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ecc23e6c9dso730565ad.2 for ; Fri, 03 May 2024 14:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772260; x=1715377060; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O/Sm++Egsx8q7rlUkwUyB5q6Cu7fnuL8sFgKBvzduqs=; b=m/EtyHku5+kq6rVlmQfD4vlgQItHTwXNzQ/x9RtPJsMHxvSO1PgLKDsHjw55otHlLM KIGT2eEDDIk6Xqh3XAmw0RmKJUyjHbeaMcyEgcLvPFEjy4M3cmW9xOnUxOOS9mF1g5+D lCVn+eJoR+w3YDYvNcCNO6vA1E4EaKIpww8R8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772260; x=1715377060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O/Sm++Egsx8q7rlUkwUyB5q6Cu7fnuL8sFgKBvzduqs=; b=l4Tl2cetMve0iaSTRlnoZUprj6QqaU9Y8L2JYAuDmb4OZElgbJEqc+01QILruif0FE 5M9tVPtnqypto9M+8VJvMwCmC+WtHRVBzFprpypZA85spxyNeWLsjIt5/654HEpnwfwJ AQ2cMTcSEMMibi0vvgRRim+noFmWfQZlFXUsYa6qN8xwgcjp9XwNNLiN51MMPVaNMXFw azBdxH0TPV05uRWszyyyMkkoAmi0K5z0sLadIGr0EXdyEP26mHxI8QoB+LtK6kHbngik aVLNtvJkkOTXL4900LopEansSDYUHySs8EjZsFI5LkeDb17UtoiV/DQhGGvakqf97bh/ +BAg== X-Gm-Message-State: AOJu0YzHspZzHkAgX5zqg2hcAIf9b4aa/nR0r/6QFeDFpj1g2HMxFft9 SpHjQjmKXw3+UmjwfPfn/mUixCbi3w4ITAGhiC+Xe6vzZ2bi2l/PPmvfNS5SrnEWrPdFWzJXGFG Qpg== X-Google-Smtp-Source: AGHT+IGCLyeRka7bEbj1rtJf7J0U2tyRPC1SfBgt3k9U7tPl56QaTyO/M7OMcuQw3XwRdMK87YcijA== X-Received: by 2002:a17:902:cec2:b0:1e4:47bf:6926 with SMTP id d2-20020a170902cec200b001e447bf6926mr5145949plg.4.1714772260615; Fri, 03 May 2024 14:37:40 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:39 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Vinay Simha BN , Sumit Semwal , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 32/48] drm/panel: jdi-lt070me05000: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:13 -0700 Message-ID: <20240503143327.RFT.v2.32.I2e991044def6644c18ad8d7d686f4f3006f278de@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. NOTE: as part of this, transition the panel's direct calls to its disable function in shutdown/remove to call through DRM panel. Cc: Vinay Simha BN Cc: Sumit Semwal Signed-off-by: Douglas Anderson --- Note: since we are able to identify that this panel only appears to be used on Qualcomm boards and we have to touch the shutdown/remove path in this patch anyway, we could possibly squash this with the next patch that removes the disable call in shutdown/remove. For now I'm keeping them separate just to keep the concepts separate. Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-jdi-lt070me05000.c | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c index f9a69f347068..4ddddee6fa1e 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -37,9 +37,6 @@ struct jdi_panel { struct gpio_desc *dcdc_en_gpio; struct backlight_device *backlight; - bool prepared; - bool enabled; - const struct drm_display_mode *mode; }; @@ -176,13 +173,8 @@ static int jdi_panel_disable(struct drm_panel *panel) { struct jdi_panel *jdi = to_jdi_panel(panel); - if (!jdi->enabled) - return 0; - backlight_disable(jdi->backlight); - jdi->enabled = false; - return 0; } @@ -192,9 +184,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel) struct device *dev = &jdi->dsi->dev; int ret; - if (!jdi->prepared) - return 0; - jdi_panel_off(jdi); ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies); @@ -207,8 +196,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel) gpiod_set_value(jdi->dcdc_en_gpio, 0); - jdi->prepared = false; - return 0; } @@ -218,9 +205,6 @@ static int jdi_panel_prepare(struct drm_panel *panel) struct device *dev = &jdi->dsi->dev; int ret; - if (jdi->prepared) - return 0; - ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies); if (ret < 0) { dev_err(dev, "regulator enable failed, %d\n", ret); @@ -250,8 +234,6 @@ static int jdi_panel_prepare(struct drm_panel *panel) goto poweroff; } - jdi->prepared = true; - return 0; poweroff: @@ -272,13 +254,8 @@ static int jdi_panel_enable(struct drm_panel *panel) { struct jdi_panel *jdi = to_jdi_panel(panel); - if (jdi->enabled) - return 0; - backlight_enable(jdi->backlight); - jdi->enabled = true; - return 0; } @@ -475,7 +452,7 @@ static void jdi_panel_remove(struct mipi_dsi_device *dsi) struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi); int ret; - ret = jdi_panel_disable(&jdi->base); + ret = drm_panel_disable(&jdi->base); if (ret < 0) dev_err(&dsi->dev, "failed to disable panel: %d\n", ret); @@ -491,7 +468,7 @@ static void jdi_panel_shutdown(struct mipi_dsi_device *dsi) { struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi); - jdi_panel_disable(&jdi->base); + drm_panel_disable(&jdi->base); } static struct mipi_dsi_driver jdi_panel_driver = { From patchwork Fri May 3 21:33:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653477 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9DE7C4345F for ; Fri, 3 May 2024 21:37:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E4341132A0; Fri, 3 May 2024 21:37:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jZY0VKb7"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9308E113296 for ; Fri, 3 May 2024 21:37:43 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ecd9dab183so19701345ad.1 for ; Fri, 03 May 2024 14:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772262; x=1715377062; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HlKkW94AChnsvIhCVySiJbRiNalT5tOJ34PXKTcPDbA=; b=jZY0VKb77DS9wQelm7e1wC6bCZkWt6SZpQ3L0KSRgygFlRv8lbeRhb0pw00iEyJrCs RxObw/fWnztmMBwR5hizFG19OKAS5tdsDRLU2ktyvNE8vOJXvYTmoQxfelGGdA/28ByD 5JX26+sXY3On7LAK6lvaonJZVuFgKY8ZglfPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772262; x=1715377062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HlKkW94AChnsvIhCVySiJbRiNalT5tOJ34PXKTcPDbA=; b=eagOAgY0bDeas7Z5F+BJA1o54+0Ude6K7ahWoR8EsrH96Tqr9XpYfib75TYhePdfAs 0A0e/r/gkd3vmiYTWx10nu0qrTbovyl57hUQqXweloNujonEf95+z4oBdzTy5EvbO7Q9 ckV0i6mljnMU1OQX8BKt/3mKdCI2HR2ko7vYQnyHyC5ffz3qz7Ex3xfXmormO3CAwz4d AU8PNZR86DwkzXKmlBwKaw0Uaqp0GrAtqvTV5VE746fQc8ocYp8AH3npjPfvH26+Y8hj R88q0br/t+ePyTfCtbKODClCMQpSPhbwVSKWtiK4hFtMcrziwFRjApMr2uzeDi2JJiMR X6nA== X-Gm-Message-State: AOJu0YyLibphyJOf/waWIsVT+ZAUIfznYYlAm227d3YrlmgsPPvaoNHy Lei+KVys/nmIK3jW6iy2k8WZ3dacGrDcDtwJcWfH9WaiufRylqomq/q7yWxtE3H3AF8bqrFOIlw EMw== X-Google-Smtp-Source: AGHT+IEq5AgUw6GyV8pe9okGVdoOhJW8iWaIkyS1EF9ClHC3n8yX96iFTRmuWTK/fQ6r8ShwT0dFzQ== X-Received: by 2002:a17:903:41cb:b0:1eb:8299:db35 with SMTP id u11-20020a17090341cb00b001eb8299db35mr10401266ple.32.1714772262650; Fri, 03 May 2024 14:37:42 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:41 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Vinay Simha BN , Sumit Semwal , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 33/48] drm/panel: jdi-lt070me05000: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:14 -0700 Message-ID: <20240503143327.RFT.v2.33.I5f3426e511e77b93c247e0aac114bd12b2b2a933@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Qualcomm boards. The Qualcomm driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Vinay Simha BN Cc: Sumit Semwal Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c index 4ddddee6fa1e..b1ce186de261 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -452,10 +452,6 @@ static void jdi_panel_remove(struct mipi_dsi_device *dsi) struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi); int ret; - ret = drm_panel_disable(&jdi->base); - if (ret < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", ret); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", @@ -464,13 +460,6 @@ static void jdi_panel_remove(struct mipi_dsi_device *dsi) jdi_panel_del(jdi); } -static void jdi_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&jdi->base); -} - static struct mipi_dsi_driver jdi_panel_driver = { .driver = { .name = "panel-jdi-lt070me05000", @@ -478,7 +467,6 @@ static struct mipi_dsi_driver jdi_panel_driver = { }, .probe = jdi_panel_probe, .remove = jdi_panel_remove, - .shutdown = jdi_panel_shutdown, }; module_mipi_dsi_driver(jdi_panel_driver); From patchwork Fri May 3 21:33:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653478 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2D62C4345F for ; Fri, 3 May 2024 21:37:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D315B1132A1; Fri, 3 May 2024 21:37:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OxU2RUoe"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 044631132A1 for ; Fri, 3 May 2024 21:37:46 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e5c7d087e1so1051535ad.0 for ; Fri, 03 May 2024 14:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772265; x=1715377065; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wZDXX5+LO4KCYTMyL9bFp7mWqxckeafU4NqU6b6Zl+A=; b=OxU2RUoeUWzcSOQe6eFJjJnByUme+g5+9t0rPDLXcCCwPYFl+N3/fTN+Z01XXLZTxq 2qofvtsk//AWlg3a6fPEDvmvhowdq/dZ6taks/cHc+xuUXbCjAoUMTJHKv8MpbayTuXQ XFeBTQd2HLTXNIAyv0VARtREA+yIGulRpO4Bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772265; x=1715377065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wZDXX5+LO4KCYTMyL9bFp7mWqxckeafU4NqU6b6Zl+A=; b=See/muHFgE4NjfzCDa8p3CBX2dQFi1OLGr3W/Bv8MUjQ/4UzR1mRba5/sQaEHPu8+z sADvhAaklXncYTaVa1mWpGeQtDXIkVJbwLp5rzRXlo878G5x2Au406UgVXkETWySo7Of cC9dGM/tsze73uYm6jSXJZr9hW6Vzwvk1L/WO1s+6aBpB7Vfuw/lISGlYRXu1nZ2LwLt 4RnMVgnn5bntlMwFpliTNWgvl0z+y8XIymdtJuwgF1VmOtGAtdS6KhzWo3LIJHrvYLr3 3EwnWueykj1hAihi39Xaii4AfyXJzHGrLQv9SZay0u/H4+dEl6h3c217ztqsX0/sYxda rHkA== X-Gm-Message-State: AOJu0Yw1u8Ghx/EG5hTnYXIYwtDcibXJtoMDOgy5wVB8ZN75CBHWsqW7 ilMs9VnMujUq6hY7bImLXplnaFyKkilVHRHTseZFlgae7wo1fFve+m6geyKwMf3S7bedwXPDXLT VuQ== X-Google-Smtp-Source: AGHT+IEM/QZtMkwvjlLIFbPnkF0+gcBny1uUrL28BGWnqjNaJ9gJCfvZsyvZC8Acyq8l9IiCgiHpFQ== X-Received: by 2002:a17:903:41d1:b0:1ec:22ca:b290 with SMTP id u17-20020a17090341d100b001ec22cab290mr5158303ple.21.1714772264830; Fri, 03 May 2024 14:37:44 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:44 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Werner Johansson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 34/48] drm/panel: panasonic-vvx10f034n00: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:15 -0700 Message-ID: <20240503143327.RFT.v2.34.I7278e956ffd1cf686e737834578d4bb3ea527c7f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Werner Johansson Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../drm/panel/panel-panasonic-vvx10f034n00.c | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c index 8ba6d8287938..822ca2f971eb 100644 --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c @@ -32,9 +32,6 @@ struct wuxga_nt_panel { struct regulator *supply; - bool prepared; - bool enabled; - ktime_t earliest_wake; const struct drm_display_mode *mode; @@ -53,28 +50,16 @@ static int wuxga_nt_panel_on(struct wuxga_nt_panel *wuxga_nt) static int wuxga_nt_panel_disable(struct drm_panel *panel) { struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel); - int mipi_ret, bl_ret = 0; - - if (!wuxga_nt->enabled) - return 0; - - mipi_ret = mipi_dsi_shutdown_peripheral(wuxga_nt->dsi); - - wuxga_nt->enabled = false; - return mipi_ret ? mipi_ret : bl_ret; + return mipi_dsi_shutdown_peripheral(wuxga_nt->dsi); } static int wuxga_nt_panel_unprepare(struct drm_panel *panel) { struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel); - if (!wuxga_nt->prepared) - return 0; - regulator_disable(wuxga_nt->supply); wuxga_nt->earliest_wake = ktime_add_ms(ktime_get_real(), MIN_POFF_MS); - wuxga_nt->prepared = false; return 0; } @@ -85,9 +70,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel) int ret; s64 enablewait; - if (wuxga_nt->prepared) - return 0; - /* * If the user re-enabled the panel before the required off-time then * we need to wait the remaining period before re-enabling regulator @@ -117,8 +99,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel) goto poweroff; } - wuxga_nt->prepared = true; - return 0; poweroff: @@ -127,18 +107,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel) return ret; } -static int wuxga_nt_panel_enable(struct drm_panel *panel) -{ - struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel); - - if (wuxga_nt->enabled) - return 0; - - wuxga_nt->enabled = true; - - return 0; -} - static const struct drm_display_mode default_mode = { .clock = 164402, .hdisplay = 1920, @@ -178,7 +146,6 @@ static const struct drm_panel_funcs wuxga_nt_panel_funcs = { .disable = wuxga_nt_panel_disable, .unprepare = wuxga_nt_panel_unprepare, .prepare = wuxga_nt_panel_prepare, - .enable = wuxga_nt_panel_enable, .get_modes = wuxga_nt_panel_get_modes, }; From patchwork Fri May 3 21:33:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653479 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB797C25B5C for ; Fri, 3 May 2024 21:37:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C882113296; Fri, 3 May 2024 21:37:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PhUWoEw4"; dkim-atps=neutral Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id C1054113296 for ; Fri, 3 May 2024 21:37:47 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1228315ad.0 for ; Fri, 03 May 2024 14:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772267; x=1715377067; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JIn+sWO9dEDf1DvG5c+RzmcIdDo8LI3xPQg/VI7zljA=; b=PhUWoEw4ArnQEIEyZ/yWwkrGB0w/8cL2SLgDWpfapVb4Gm21KM9hgfJ+pwkgeIdga9 UJjJkiUrVMfKD8RurUM4nf65Kp3UZzB/6Wnchl4toJcSfWfLlngAhqpAUX/Jx32moW7f N8fU8x1W5yMI2RZLChQshs2lF3HXcc97o64Tg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772267; x=1715377067; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JIn+sWO9dEDf1DvG5c+RzmcIdDo8LI3xPQg/VI7zljA=; b=P9+CNUluyaMrw7dvzET4iUu7QCmwakTqq9jertbKGsZCH65OEsgYaY134ZM+aUdMUG KNJFbaR9tTOlGgwGXVYVFTdVe7MmeQQZZIs8Ub8CEcPltxLKcAnRXKayZU6CBh+iHzDw gHFWTHWoBKnt2qqv0TXQKHTmURFLki5xhO737uAFKcNt7wM0btMY4swLQKrFzKs5p4aF ESPWUwKrhDnJSYmcV2n2G29U3v8DjNV+WF6ADdAMOGEdNT0D6L1fYh3xvx07F7JaBymI dlEM4IzrxQzuXf+H6t0uuT54S9iKPbPh1nFMPWa5VQbFs05VO93We76qz7rccirBxhHW /s1g== X-Gm-Message-State: AOJu0YzMhfZizY9bGG1EWH9R8UhdJVQu3eUmgmNmbxCGIhsbv94++4yk trZKPYO0VgLLt3DOnwA1+yhZugNp5GE2riVvc1iJ1/TACloYWBHP9v6xQ7QlTQ4WYgl+8CWmZX5 QxQ== X-Google-Smtp-Source: AGHT+IFgOtsvmnCpgD9YCuirDNOd6sEAldzPJUUEeKJ2LJEqLasuF33MZxCdPNTGTti/0Ofhqu2Ztw== X-Received: by 2002:a17:902:f54c:b0:1eb:5b59:fab9 with SMTP id h12-20020a170902f54c00b001eb5b59fab9mr5096772plf.53.1714772266832; Fri, 03 May 2024 14:37:46 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:46 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Werner Johansson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 35/48] drm/panel: panasonic-vvx10f034n00: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:16 -0700 Message-ID: <20240503143327.RFT.v2.35.I1562c864ee35a9c166765488c95104b7e4e562da@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. Unfortunately, grepping mainline for this panel's compatible string shows no hits, so we can't be 100% sure if the DRM modeset driver used with this panel has been fixed. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Werner Johansson Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c index 822ca2f971eb..d1c5c9bc3c56 100644 --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c @@ -222,10 +222,6 @@ static void wuxga_nt_panel_remove(struct mipi_dsi_device *dsi) struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi); int ret; - ret = drm_panel_disable(&wuxga_nt->base); - if (ret < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", ret); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); @@ -233,13 +229,6 @@ static void wuxga_nt_panel_remove(struct mipi_dsi_device *dsi) wuxga_nt_panel_del(wuxga_nt); } -static void wuxga_nt_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&wuxga_nt->base); -} - static struct mipi_dsi_driver wuxga_nt_panel_driver = { .driver = { .name = "panel-panasonic-vvx10f034n00", @@ -247,7 +236,6 @@ static struct mipi_dsi_driver wuxga_nt_panel_driver = { }, .probe = wuxga_nt_panel_probe, .remove = wuxga_nt_panel_remove, - .shutdown = wuxga_nt_panel_shutdown, }; module_mipi_dsi_driver(wuxga_nt_panel_driver); From patchwork Fri May 3 21:33:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653480 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5185FC10F16 for ; Fri, 3 May 2024 21:37:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C48A1132A3; Fri, 3 May 2024 21:37:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NCMOUs/i"; dkim-atps=neutral Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id A850B1132A3 for ; Fri, 3 May 2024 21:37:50 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1228605ad.0 for ; Fri, 03 May 2024 14:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772269; x=1715377069; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L0iO3yAQ8KkSt7Wokb68l77QkaHVGUqroVg9qjrT7Jw=; b=NCMOUs/iEKMH5Gbp5GwC81zfKCBT7nllCy3Vv7Hr4NsvdZI9dJ2OytGl4XDESHauCe 9vgw3u2Z2zA0RODW/w7VheIbkv57BYLLaEQxUt4sSOGgfBtfoC7tkxSaNm9WWudkCfdI xzPLYSLZ//48y2ct7Z5I6B/Ns2SqN5xF1hw1o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772269; x=1715377069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L0iO3yAQ8KkSt7Wokb68l77QkaHVGUqroVg9qjrT7Jw=; b=Z3jCJULwFF65Pa7jNrpecuV++OIsQs4qPzw6h5nDM4oUi2TdmYSgbQQTu75MpXF+CJ JsOex2uMGVjnoUbwkMP8NiNv2KMHtLNoGmWhM6y0F82zHKFs9/QdisfZ071+D6j6nul4 d+Qk9PfuEuI1tALxu15WmHprDEN9UVYsM7Q5AjWRuSwHudevhSzrk2hBb/8QufXjrRhM gD/2m/+00O9+7rs9cK5XdU8v68Kvp63LWXjG6NHI+0u7RZEt0yeFFmwLrnQJmXpxWm55 r/JYva1pxRh88fP0EYUhEbNnI7Le5WcErR/WLXpSmSNbYNhb5yV9UA4BvwbFsWSHqqiy BC8A== X-Gm-Message-State: AOJu0YzOOTDAc1XIkjHoFnC4dtvoVJaaaLQSFpKSEMaN60zLh8ou70KX +40iDUHphFS2l6Fq9Eq+ia5ciu/j2O82fkRw+n/z3qI/ocs1UC0ae7DnxQ+NlcvsTgOi2/ueT1Q WUg== X-Google-Smtp-Source: AGHT+IEJXRtPeQGcDuRFCN51uInhuJn+mY1i1wPYgk00iOIMC5r7aJDHEYH9EmcUpqfMP7eJW7lrPw== X-Received: by 2002:a17:902:7797:b0:1e3:e39a:2e49 with SMTP id o23-20020a170902779700b001e3e39a2e49mr3858363pll.18.1714772269071; Fri, 03 May 2024 14:37:49 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:48 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Marco Franchi , Fabio Estevam , Laurentiu Palcu , Pengutronix Kernel Team , imx@lists.linux.dev, Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 36/48] drm/panel: seiko-43wvf1g: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:17 -0700 Message-ID: <20240503143327.RFT.v2.36.Idda91d310ca2e4f5a4ab4ca6eaf1afdaf14eeb51@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Marco Franchi Cc: Fabio Estevam Cc: Laurentiu Palcu Cc: Pengutronix Kernel Team Cc: imx@lists.linux.dev Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 40 --------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c index 658c7c040570..98480904126c 100644 --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c @@ -44,8 +44,6 @@ struct seiko_panel_desc { struct seiko_panel { struct drm_panel base; - bool prepared; - bool enabled; const struct seiko_panel_desc *desc; struct regulator *dvdd; struct regulator *avdd; @@ -122,25 +120,10 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel, return num; } -static int seiko_panel_disable(struct drm_panel *panel) -{ - struct seiko_panel *p = to_seiko_panel(panel); - - if (!p->enabled) - return 0; - - p->enabled = false; - - return 0; -} - static int seiko_panel_unprepare(struct drm_panel *panel) { struct seiko_panel *p = to_seiko_panel(panel); - if (!p->prepared) - return 0; - gpiod_set_value_cansleep(p->enable_gpio, 0); regulator_disable(p->avdd); @@ -150,8 +133,6 @@ static int seiko_panel_unprepare(struct drm_panel *panel) regulator_disable(p->dvdd); - p->prepared = false; - return 0; } @@ -160,9 +141,6 @@ static int seiko_panel_prepare(struct drm_panel *panel) struct seiko_panel *p = to_seiko_panel(panel); int err; - if (p->prepared) - return 0; - err = regulator_enable(p->dvdd); if (err < 0) { dev_err(panel->dev, "failed to enable dvdd: %d\n", err); @@ -180,8 +158,6 @@ static int seiko_panel_prepare(struct drm_panel *panel) gpiod_set_value_cansleep(p->enable_gpio, 1); - p->prepared = true; - return 0; disable_dvdd: @@ -189,18 +165,6 @@ static int seiko_panel_prepare(struct drm_panel *panel) return err; } -static int seiko_panel_enable(struct drm_panel *panel) -{ - struct seiko_panel *p = to_seiko_panel(panel); - - if (p->enabled) - return 0; - - p->enabled = true; - - return 0; -} - static int seiko_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector) { @@ -228,10 +192,8 @@ static int seiko_panel_get_timings(struct drm_panel *panel, } static const struct drm_panel_funcs seiko_panel_funcs = { - .disable = seiko_panel_disable, .unprepare = seiko_panel_unprepare, .prepare = seiko_panel_prepare, - .enable = seiko_panel_enable, .get_modes = seiko_panel_get_modes, .get_timings = seiko_panel_get_timings, }; @@ -246,8 +208,6 @@ static int seiko_panel_probe(struct device *dev, if (!panel) return -ENOMEM; - panel->enabled = false; - panel->prepared = false; panel->desc = desc; panel->dvdd = devm_regulator_get(dev, "dvdd"); From patchwork Fri May 3 21:33:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653481 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEEDAC4345F for ; Fri, 3 May 2024 21:37:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D755A112A0C; Fri, 3 May 2024 21:37:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kaguv1m6"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 029821132A3 for ; Fri, 3 May 2024 21:37:51 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1ec5387aed9so1022235ad.3 for ; Fri, 03 May 2024 14:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772271; x=1715377071; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rL+8TR+FVEOGHEmIclktS5Eo1OM2fp+pjfqU2SfLZsA=; b=kaguv1m68kEa2Fqi/Wvpr5LjSRxLgwD+5b4oxTI8kyhAd/wkOP14g53S7NEdj2uzay 8cvhlBI8nsq432QcC+m1CXnmharN6mMHheJ8LaySVlr7I+bgvFuX9RK3kHMO4X/qO5x5 Nq/WVgGTU4r1H2Pdq/cGXLiL1R8l0e9LLjms4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772271; x=1715377071; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rL+8TR+FVEOGHEmIclktS5Eo1OM2fp+pjfqU2SfLZsA=; b=ge5494kF6Jw5hKsbfasuu7vVAhYPoxxmfmfvHR/jxFLhHdMvN+mVCN30/W3VYxHuTG q+zSr8ucJljtzY/IRwQ9b1m9q22dSnZIrsgC4FmaVJeZ3T5J/1FVmNfvXQUlfUJ1mcLl YJymNnqGyt0Xs5qgKQVkH7Oe4fGqMLCodDmpm5LM3B6qu3XYwkhGllYjE4zyls7KvePf x8hsMuaDj0X/SGkDLFS7/TkipgVr3KA1i5/ck0/dZiVIMJ9d/poC2Ye9xfpu5h+wrJMT nFNyGb0c2CIB97ukGpn/roJhDKqKFAK8bi3+dRWPFC732QLsWTEjue+dwduYejlvQsU2 uj4A== X-Gm-Message-State: AOJu0Yz7d7LcuCZBtVkzDcD+b/EB7RFw3DWEOkAkNr6JgvUWSWNXiuvQ /Ob5TB1pwU6/5du5rl6Ai2TnP68lpL2ttQLvAhIsEIMEAz99O833ENSNaXod5w47wXN9eebsPAY 8DQ== X-Google-Smtp-Source: AGHT+IGqOILtOMpTQpdNPww4A4HTkoN+afOAFJGfdSt9UtYlGc1IDjYPsnnRSAg9cfQkss7IrOZqZQ== X-Received: by 2002:a17:902:b495:b0:1ea:f7d4:cf2b with SMTP id y21-20020a170902b49500b001eaf7d4cf2bmr3601945plr.17.1714772271011; Fri, 03 May 2024 14:37:51 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:50 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Marco Franchi , Fabio Estevam , Laurentiu Palcu , Pengutronix Kernel Team , imx@lists.linux.dev, Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 37/48] drm/panel: seiko-43wvf1g: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:18 -0700 Message-ID: <20240503143327.RFT.v2.37.Ief712fb6720cb98bdf9ec8644362d028b6554f9b@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by IMX boards. As far as I can tell, all IMX boards are now correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Marco Franchi Cc: Fabio Estevam Cc: Laurentiu Palcu Cc: Pengutronix Kernel Team Cc: imx@lists.linux.dev Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c index 98480904126c..8a3fe531c641 100644 --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c @@ -243,14 +243,6 @@ static void seiko_panel_remove(struct platform_device *pdev) struct seiko_panel *panel = platform_get_drvdata(pdev); drm_panel_remove(&panel->base); - drm_panel_disable(&panel->base); -} - -static void seiko_panel_shutdown(struct platform_device *pdev) -{ - struct seiko_panel *panel = platform_get_drvdata(pdev); - - drm_panel_disable(&panel->base); } static const struct display_timing seiko_43wvf1g_timing = { @@ -306,7 +298,6 @@ static struct platform_driver seiko_panel_platform_driver = { }, .probe = seiko_panel_platform_probe, .remove_new = seiko_panel_remove, - .shutdown = seiko_panel_shutdown, }; module_platform_driver(seiko_panel_platform_driver); From patchwork Fri May 3 21:33:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653482 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E20BC10F16 for ; Fri, 3 May 2024 21:37:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B5E31132A4; Fri, 3 May 2024 21:37:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MysnYSKT"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id E06921132A4 for ; Fri, 3 May 2024 21:37:53 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e3c3aa8938so877455ad.1 for ; Fri, 03 May 2024 14:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772273; x=1715377073; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ltVsqzMHcXWQrzEkIaopepMP6yzxK8+ru/cwzj6Xja4=; b=MysnYSKT9KR4XyXC54NrPtFzjDine/PjfdQ8KLMozV9CCrGjMOhsEbBRFo1RlqssfN ADs6f2ngmK8WRV3M4c2bFRh8m+VYKGB8l3IA5tAmf7edEayzW2noHsgkfGZ79nBhZZb0 uC2KGBpjpDmVNV4OmzNdQso/QpSUyHFFqv5qs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772273; x=1715377073; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ltVsqzMHcXWQrzEkIaopepMP6yzxK8+ru/cwzj6Xja4=; b=rppsNmbru+G8W0Od6kBEcQ8dnjJk7pzmeXtAUi1MPAA+TJdlFsonvOCho2e5TgmTFL Jt2A28L/FnBdUwa3FlCxHE5rpEjw4rjOjL7ELDloN5Ykuqe1nq1zeZGR7m8Qz9teVXda pIT/GrAhhnsZzJQDu8eLgzqfMVV9jAia7Key2bH2KBeSTRk91R6RMe2rIM56EHdCdF1X sU6SuKJsWUnoeXjmlivnlNJfUsMe7TBcV2vOFYxbdSN1p2y+1fRw0Suu2kuQXaELjlvl RJphuGXcNzfvg4wOng5E1SLylRnp/6fykN/yjVmYXNtstqAqN+DDgQ4o0Rge3ac2xUe2 LJnQ== X-Gm-Message-State: AOJu0YxcubTtYcTlXaemRxpALyDMDQhDplgMBeGy+FkzsA6vx9VyOZ7S xcXlazs7oEug7D/2tSRpk5WBr9jj5iBpvx1t0fzbYoRvynGWSMWmEp6mWarvKKnrRFSLCuNCHnw cRA== X-Google-Smtp-Source: AGHT+IGYZcCvztVAnqAetSOocHorxHkEiQPDfYYRF0RW3qXwcDIlheeCC9kdMyrxGDD9aFGgBa5DWQ== X-Received: by 2002:a17:903:1111:b0:1e5:3684:617e with SMTP id n17-20020a170903111100b001e53684617emr4153719plh.52.1714772272986; Fri, 03 May 2024 14:37:52 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:52 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Thierry Reding , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 38/48] drm/panel: sharp-lq101r1sx01: Stop tracking prepared/enabled Date: Fri, 3 May 2024 14:33:19 -0700 Message-ID: <20240503143327.RFT.v2.38.Ifd6b12b8a4bca7d492e892ea7455e83f5c0ab5a8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Thierry Reding Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-sharp-lq101r1sx01.c | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c index 14851408a5e1..8f6c21b99522 100644 --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c @@ -24,9 +24,6 @@ struct sharp_panel { struct regulator *supply; - bool prepared; - bool enabled; - const struct drm_display_mode *mode; }; @@ -85,26 +82,11 @@ static __maybe_unused int sharp_panel_read(struct sharp_panel *sharp, return err; } -static int sharp_panel_disable(struct drm_panel *panel) -{ - struct sharp_panel *sharp = to_sharp_panel(panel); - - if (!sharp->enabled) - return 0; - - sharp->enabled = false; - - return 0; -} - static int sharp_panel_unprepare(struct drm_panel *panel) { struct sharp_panel *sharp = to_sharp_panel(panel); int err; - if (!sharp->prepared) - return 0; - sharp_wait_frames(sharp, 4); err = mipi_dsi_dcs_set_display_off(sharp->link1); @@ -119,8 +101,6 @@ static int sharp_panel_unprepare(struct drm_panel *panel) regulator_disable(sharp->supply); - sharp->prepared = false; - return 0; } @@ -164,9 +144,6 @@ static int sharp_panel_prepare(struct drm_panel *panel) u8 format = MIPI_DCS_PIXEL_FMT_24BIT; int err; - if (sharp->prepared) - return 0; - err = regulator_enable(sharp->supply); if (err < 0) return err; @@ -235,8 +212,6 @@ static int sharp_panel_prepare(struct drm_panel *panel) goto poweroff; } - sharp->prepared = true; - /* wait for 6 frames before continuing */ sharp_wait_frames(sharp, 6); @@ -247,18 +222,6 @@ static int sharp_panel_prepare(struct drm_panel *panel) return err; } -static int sharp_panel_enable(struct drm_panel *panel) -{ - struct sharp_panel *sharp = to_sharp_panel(panel); - - if (sharp->enabled) - return 0; - - sharp->enabled = true; - - return 0; -} - static const struct drm_display_mode default_mode = { .clock = 278000, .hdisplay = 2560, @@ -295,10 +258,8 @@ static int sharp_panel_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs sharp_panel_funcs = { - .disable = sharp_panel_disable, .unprepare = sharp_panel_unprepare, .prepare = sharp_panel_prepare, - .enable = sharp_panel_enable, .get_modes = sharp_panel_get_modes, }; From patchwork Fri May 3 21:33:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653483 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E569C4345F for ; Fri, 3 May 2024 21:37:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14C0A1132A5; Fri, 3 May 2024 21:37:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kIm/fjTx"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 201F21132A5 for ; Fri, 3 May 2024 21:37:56 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ed0abbf706so1072815ad.2 for ; Fri, 03 May 2024 14:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772275; x=1715377075; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IZ2bcwxBHMvzwpRFsoGmIetgpC7SnvJGS8R4x5ACAaI=; b=kIm/fjTxUZ2JLcTYjOvXZH/mQOT2UxC/w1kSuy8UIzTcQAfWKRtqf1hUsegEj1PahU +RdjYGvRR2zFv39nrB4oXOX84a8irnb3QHnALHqGlwe0Qj7NV+N/HSkMpLTGezIUqYF1 smkQxfhp3Y0O4C3dC8m0dsCjOaLPDkJJxoQkQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772275; x=1715377075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IZ2bcwxBHMvzwpRFsoGmIetgpC7SnvJGS8R4x5ACAaI=; b=eEZzQ9wK896T232ZnVUMvf60udrXfsKnxA/78onaJhDyIBBYO8AdmfNx+jpLcYtYD3 hvFjiYHKb/sHI1aX6YMQAcMQVvd1hZ/mf7gJVDgn+X44nFbpjG8Verp21VaUDGqcKD2k lpe2wR6t0E6kJvONYhzMGVq9yixhBPS0xUZ2iIfuV7rz4dNEJ8xokkeFW8EaNqyaLCzA PYBZUSU/Af6Mf22SrrJOuNdRoI58eUmknVff34v8rd1PtoiEb8PoEzGw+YXqaW7Air0p sgNXLGd9lLkBQ1+thTMaHavRZMWF9rnyKfY5mfFHhf7mzY+H4xHGVCw3nAH5NYzZZjX4 iVUg== X-Gm-Message-State: AOJu0YzixAuzP2ZBU3jhTlLylTm6SahKGezVC8bBsopae5zieu/HSoK4 a7clbMFnkFAxRbIao9yIyx3O1mWAQb4loruie4tpzhkKOq/0KvZS5b9s3c3nYk8Ah18M7UX3g0P wXg== X-Google-Smtp-Source: AGHT+IF4B6Nfr3ZtrpYHNA9pejG1rE3AiUgc8H89qrn9KVvMkhOXg6EYM81DsPyLvBFCo2ge0DZf3A== X-Received: by 2002:a17:903:2306:b0:1eb:1af8:309f with SMTP id d6-20020a170903230600b001eb1af8309fmr5575949plh.4.1714772274987; Fri, 03 May 2024 14:37:54 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:54 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Thierry Reding , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 39/48] drm/panel: sharp-lq101r1sx01: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:20 -0700 Message-ID: <20240503143327.RFT.v2.39.I6a87fce1ee027c96f71c7adf74248b865f50b336@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Tegra boards. The Tegra driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Thierry Reding Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. .../gpu/drm/panel/panel-sharp-lq101r1sx01.c | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c index 8f6c21b99522..edc9425bb143 100644 --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c @@ -357,32 +357,13 @@ static void sharp_panel_remove(struct mipi_dsi_device *dsi) struct sharp_panel *sharp = mipi_dsi_get_drvdata(dsi); int err; - /* only detach from host for the DSI-LINK2 interface */ - if (!sharp) { - mipi_dsi_detach(dsi); - return; - } - - err = drm_panel_disable(&sharp->base); - if (err < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", err); - err = mipi_dsi_detach(dsi); if (err < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); - sharp_panel_del(sharp); -} - -static void sharp_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct sharp_panel *sharp = mipi_dsi_get_drvdata(dsi); - - /* nothing to do for DSI-LINK2 */ + /* only detach from host for the DSI-LINK2 interface */ if (!sharp) - return; - - drm_panel_disable(&sharp->base); + sharp_panel_del(sharp); } static struct mipi_dsi_driver sharp_panel_driver = { @@ -392,7 +373,6 @@ static struct mipi_dsi_driver sharp_panel_driver = { }, .probe = sharp_panel_probe, .remove = sharp_panel_remove, - .shutdown = sharp_panel_shutdown, }; module_mipi_dsi_driver(sharp_panel_driver); From patchwork Fri May 3 21:33:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653484 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 574BDC10F16 for ; Fri, 3 May 2024 21:38:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F8641132A8; Fri, 3 May 2024 21:37:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OLXj0Trh"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFC741132A6 for ; Fri, 3 May 2024 21:37:57 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ec5387aed9so1022865ad.3 for ; Fri, 03 May 2024 14:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772277; x=1715377077; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cC/7w7cvbMIg1H0tLbovKCpsSruQDzBcns5w6WWFLNE=; b=OLXj0TrhzHL9fWUwemazPDbs85o+Hh3q7SN7zX4qH82cCyO78GpZKJUrjsUZV0d8jI ZleXnamys0UolHjUTdSUDIu6N/xS/Ii4m/En9ZRCesaQtYvgkoDFfMwkum3B9PVaHgAi Tpwh2TxOuBBRv0B/8WDlLevMhhV0b8ULZFGBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772277; x=1715377077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cC/7w7cvbMIg1H0tLbovKCpsSruQDzBcns5w6WWFLNE=; b=oB6HscuMPSNvJQkx94K5cIJZG3/TdmDRuylgbqllW1ZMHWdTz8bI7bUZWquqLF5gY8 0kO6sPWvEt5u81o5JHPegxfTIpbglReCbgR6EJ9tPy2C6Rzak0sRNYopByqF+O+joi8H QbNBIp3X4emlzw4ZEGD/C1gQOyVPun9ZNp09/0QPrHPIQNSG56KbrNO5XRmXohw80wWH Ic2BoJKSNsgBnFpEO0u3oFYDKtc7AEGwfhC/iubToAsazKAnJDfSyTcn/RRxL5Agwl9Z moWHkbxMoi+RR89CH1UWt/4ehYYu4CseRDvE3Zt83/KStrbGoimltMhbgVcU1xAGJQc8 m0uA== X-Gm-Message-State: AOJu0YzgWuBKfG20aaH9aA3J8aFuG5B4n75r45VvpO06Xhg24ElMJU/4 h3Gj4lmIuQJx8ddekN6Wm+DDZKirHY3AzUC9sl7Q292PEfA7sTbg6Y8TRNOABHDTgTTdr9tMUQy Tiw== X-Google-Smtp-Source: AGHT+IG4SIdj15z6GG8hET0eYzMhdd/lRGVRHEH1MacWakPy0nnB+jvXlG5KXqoNJ3o0nqOGfLsZdA== X-Received: by 2002:a17:902:ecc2:b0:1e8:c993:a13c with SMTP id a2-20020a170902ecc200b001e8c993a13cmr4897231plh.25.1714772276873; Fri, 03 May 2024 14:37:56 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:56 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Werner Johansson , Dmitry Baryshkov , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 40/48] drm/panel: sharp-ls043t1le01: Stop tracking prepared Date: Fri, 3 May 2024 14:33:21 -0700 Message-ID: <20240503143327.RFT.v2.40.I56849dbe7c906f0cff076dc5286fd05c7e3e9c18@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. Cc: Werner Johansson Cc: Dmitry Baryshkov Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c index 855e64444daa..c86337954ad7 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -26,8 +26,6 @@ struct sharp_nt_panel { struct regulator *supply; struct gpio_desc *reset_gpio; - - bool prepared; }; static inline struct sharp_nt_panel *to_sharp_nt_panel(struct drm_panel *panel) @@ -99,9 +97,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel) struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel); int ret; - if (!sharp_nt->prepared) - return 0; - ret = sharp_nt_panel_off(sharp_nt); if (ret < 0) { dev_err(panel->dev, "failed to set panel off: %d\n", ret); @@ -112,8 +107,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel) if (sharp_nt->reset_gpio) gpiod_set_value(sharp_nt->reset_gpio, 0); - sharp_nt->prepared = false; - return 0; } @@ -122,9 +115,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel) struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel); int ret; - if (sharp_nt->prepared) - return 0; - ret = regulator_enable(sharp_nt->supply); if (ret < 0) return ret; @@ -152,8 +142,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel) goto poweroff; } - sharp_nt->prepared = true; - return 0; poweroff: From patchwork Fri May 3 21:33:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653485 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A897C4345F for ; Fri, 3 May 2024 21:38:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 620991132A7; Fri, 3 May 2024 21:38:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NXjyxOVq"; dkim-atps=neutral Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DDEB1132A9 for ; Fri, 3 May 2024 21:37:59 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e4266673bbso1051205ad.2 for ; Fri, 03 May 2024 14:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772279; x=1715377079; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/dXwPdbkXokcaTdukxLAHZJBTCR2jkjSjRsL5uHOD/8=; b=NXjyxOVqeFXqaKG5YOHrOioxNZuQCHsXrZSmDz40s+eEMJTG8EcYDCNfeVNxTAWI1F M2x0jHvnpwuSwqV0XK0WoWieB7m0qBIsl3n4uy0wbuyGe3JBF1+xEZUWHoL1L/541jUL 6FJXSWK+ryE9pnrvFQSVfsIe3IfJgm5vDupK4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772279; x=1715377079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/dXwPdbkXokcaTdukxLAHZJBTCR2jkjSjRsL5uHOD/8=; b=o/GQ6TlUJauRw1+ShYGn6h/Cgr2APKgbDHckaswhc2yeyZLdOZGcQsCDAt9a8Yg96e y5rus73xgnjfFnNWCMMxYMIOFHjkCatOA9TuAoLUzKaM3g0QPgbNDJG+dhLH5L6WqhL+ I+KtAV+/w8gB8DLDB2yJRnlHTUU1hXIU9ppG9sUd3Rc+aREf6COBbGAMEZirxHft1bFe JlDbZWfFkkVhBiXhfn7WwJmcvH+nqyzHZLRBAuXm37caMISG0OLm7/lc82J2q3DGkR3J Z7AR5SPSyh2GBUxCVXBSUdoPn5Dqrvtkx+7QVhdjqPEkmsKy8GN4JZxJGs1u9nyl1zba hxxA== X-Gm-Message-State: AOJu0Yw7TU86rvXaHiyB5f+YyJSX1dy0rj/jGJwPqtRxaz40bjr0nj3W SuCu+4Bis3V9lGMnjq54TTgNcVNxDlkQ58AZumuyfzsD0Eiv7ci6RzTqo3tB/EtzOce4JaELBbw 8KQ== X-Google-Smtp-Source: AGHT+IE/1VVEigXJzCYmydTc9NCW51n7kNBmzsc64scd/SOgSmiWWb87c07CAccSkm9G8TiEnbdUIA== X-Received: by 2002:a17:902:8f96:b0:1e2:6d57:c1bb with SMTP id z22-20020a1709028f9600b001e26d57c1bbmr3584215plo.21.1714772279072; Fri, 03 May 2024 14:37:59 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:37:58 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Werner Johansson , Dmitry Baryshkov , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 41/48] drm/panel: sharp-ls043t1le01: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:22 -0700 Message-ID: <20240503143327.RFT.v2.41.I89ee53f7fc2f0806cab318128e5fa927990d830f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by Qualcomm boards. The Qualcomm driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Werner Johansson Cc: Dmitry Baryshkov Signed-off-by: Douglas Anderson --- Changes in v2: - Only handle 1 panel per patch. - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c index c86337954ad7..729cbb0d8403 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -267,10 +267,6 @@ static void sharp_nt_panel_remove(struct mipi_dsi_device *dsi) struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi); int ret; - ret = drm_panel_disable(&sharp_nt->base); - if (ret < 0) - dev_err(&dsi->dev, "failed to disable panel: %d\n", ret); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); @@ -278,13 +274,6 @@ static void sharp_nt_panel_remove(struct mipi_dsi_device *dsi) sharp_nt_panel_del(sharp_nt); } -static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&sharp_nt->base); -} - static const struct of_device_id sharp_nt_of_match[] = { { .compatible = "sharp,ls043t1le01-qhd", }, { } @@ -298,7 +287,6 @@ static struct mipi_dsi_driver sharp_nt_panel_driver = { }, .probe = sharp_nt_panel_probe, .remove = sharp_nt_panel_remove, - .shutdown = sharp_nt_panel_shutdown, }; module_mipi_dsi_driver(sharp_nt_panel_driver); From patchwork Fri May 3 21:33:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653486 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD33BC10F16 for ; Fri, 3 May 2024 21:38:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3758C1132A2; Fri, 3 May 2024 21:38:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Z9MNlIBP"; dkim-atps=neutral Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F4B51132A9 for ; Fri, 3 May 2024 21:38:02 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so1229565ad.0 for ; Fri, 03 May 2024 14:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772281; x=1715377081; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LOvFNgXxe6qEzRRoKPzkEzJ39gwB1A9FbXbUkRknuEw=; b=Z9MNlIBPOKtT7j5m9FaX9FMjecv/gZ67iwsNbQ/Kv3DffKMDNBuq2cBaGt8wM/Jnxy Xlg5O6Lw8rm8WNksV1/Tgq4JV34xOGQ22Jv1uORAY5/ZLJRKX+ZZrTiwMJhwQCc/2TMC Kl8nKEjPeEAIUhR6lvUSB1rj8duOPrpnQ5vIU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772281; x=1715377081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LOvFNgXxe6qEzRRoKPzkEzJ39gwB1A9FbXbUkRknuEw=; b=BZkC66I8D0kWSyft71m0ZDPotECCMOAemic1ujQLV13mxrot9A1MG/WEl0Sxn/kqZv xAcX/SjqAoEatI5DqC+9VTDo02nEKGrR1gTTvfTelXGRfI0uGhGmj1FAjCDlOvUK7yB1 Mqj/18iAWFNgP0INuDcN836Q3OABA6bfYlK1e6HIzTONxcWBYsqUno9n2qWQADrIvg8I DPDA3TZ4ogM80REHUbcg66XQ4Z1YbWnfEUTJZE6AfK0z4GzdcvhcOvAIuwIHx2LQpmpo Uyy6SVEAK0UVKRRleBRlXZmsSLBztDK/lGlB5ULKebOhyPYEnFvLqWV/hYVTzKo8CA1l qDhQ== X-Gm-Message-State: AOJu0YxnIaBD90uH/CogjZGL+WLAK6S8RvE4rJ2SrMVaIge2L/cTHu96 tW+3fhxLFJYlEZdVrckWSBtCwa5B2nBGu6oDugu4PFk9VRjvAe8GVSlALgGNOq1EgQIVwkC9oGK x0g== X-Google-Smtp-Source: AGHT+IHrBPFGeCVyz9PhiRgLD7O2XHD+TE0AOUrKe6M9eH4/MHjdlKw55SmMJ/LL6GSiVhzwWHgbFw== X-Received: by 2002:a17:902:f70b:b0:1ec:ad62:fe87 with SMTP id h11-20020a170902f70b00b001ecad62fe87mr4441606plo.56.1714772281144; Fri, 03 May 2024 14:38:01 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:00 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Guido_G=C3=BCnther?= , =?utf-8?q?Ond=C5=99ej_Jir?= =?utf-8?q?man?= , Frank Oltmanns , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Purism Kernel Team , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 42/48] drm/panel: sitronix-st7703: Stop tracking prepared Date: Fri, 3 May 2024 14:33:23 -0700 Message-ID: <20240503143327.RFT.v2.42.Ifc436b262d72f1a33ddef10adfd7578d4acb60d8@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. One thing to note for st7703 is that it has a special "allpixelson" debugfs file. When this file is written the driver hacks a disable/unprepare and then a prepare/enable to try to reset the panel. Potentially that might have been relying on the old booleans we removed. It'll still "work" because of the checks in the core but it deserves a comment. This debugfs file didn't appear to be particularly safe to use even before this patch since it would cause a disabled/unprepared panel to become prepared/enabled. Cc: "Guido Günther" Cc: "Ondřej Jirman" Cc: Chris Morgan Cc: Frank Oltmanns Signed-off-by: Douglas Anderson --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sitronix-st7703.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 7d8302cca091..6b2d940640ca 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -58,7 +58,6 @@ struct st7703 { struct gpio_desc *reset_gpio; struct regulator *vcc; struct regulator *iovcc; - bool prepared; struct dentry *debugfs; const struct st7703_panel_desc *desc; @@ -752,13 +751,9 @@ static int st7703_unprepare(struct drm_panel *panel) { struct st7703 *ctx = panel_to_st7703(panel); - if (!ctx->prepared) - return 0; - gpiod_set_value_cansleep(ctx->reset_gpio, 1); regulator_disable(ctx->iovcc); regulator_disable(ctx->vcc); - ctx->prepared = false; return 0; } @@ -768,9 +763,6 @@ static int st7703_prepare(struct drm_panel *panel) struct st7703 *ctx = panel_to_st7703(panel); int ret; - if (ctx->prepared) - return 0; - dev_dbg(ctx->dev, "Resetting the panel\n"); gpiod_set_value_cansleep(ctx->reset_gpio, 1); @@ -793,8 +785,6 @@ static int st7703_prepare(struct drm_panel *panel) gpiod_set_value_cansleep(ctx->reset_gpio, 0); usleep_range(15000, 20000); - ctx->prepared = true; - return 0; } @@ -854,7 +844,13 @@ static int allpixelson_set(void *data, u64 val) dev_dbg(ctx->dev, "Setting all pixels on\n"); mipi_dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON); msleep(val * 1000); - /* Reset the panel to get video back */ + + /* + * Reset the panel to get video back. NOTE: This isn't a + * particularly safe thing to do in general because it assumes + * that the screen was on to begin with, but this is just a + * debugfs file so it's not a huge deal. + */ drm_panel_disable(&ctx->panel); drm_panel_unprepare(&ctx->panel); drm_panel_prepare(&ctx->panel); From patchwork Fri May 3 21:33:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653487 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1664FC4345F for ; Fri, 3 May 2024 21:38:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53CD11132A9; Fri, 3 May 2024 21:38:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="i1o0GADl"; dkim-atps=neutral Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BDCA1132A9 for ; Fri, 3 May 2024 21:38:06 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ecddf96313so1029415ad.2 for ; Fri, 03 May 2024 14:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772283; x=1715377083; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2Avvw3HtD9t825/57o/WJV3t+qgm+MjAo1zab7qfrAw=; b=i1o0GADlQ1+krovd3JniHplpmHOHdyQD+arEUm81//sj1UQM834SyHqM9hqkmF19Pp LEaeBjsgGU+KZEjND6vkZRV15iKCNJS+G3Qw4ZIlIyxgmoE8iRU/hBIVy16ZgMyztFKH KmMOz8lkOiWyXZcOM0ktQeWFhb9+P4TE3ZFXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772283; x=1715377083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Avvw3HtD9t825/57o/WJV3t+qgm+MjAo1zab7qfrAw=; b=sxnEwAfJCjZbajI/Ur7i3MnhErArM2DmCrm23LjwwsSclNjZ5dJNUmDX92N39A6LDt cNLi87hA3uE1FMVMyH0N2rW6wD6ikIUqcyjHkJcSw8sgWNWa7pUjqi+dXelESTRK0iU4 Y65WhHKvLt0z1F7d7K3KWjYcgWAJ49xMNXdJXRkpfKjYSICj2kH/gH7VbxHeMvsp088U mzw7+EipyUbpD4qNaTkcw1SwDeDZAPwIy5HXALM0mCA/o61WC5+Ihl8pa6aMODAtCBh9 /nLKYMk7nWnEB67V8npYWAwdHEnWwkXefYBdepGlaI6OGZFlqSdjASHcOBO0QBxB2EaD bqjw== X-Gm-Message-State: AOJu0YzHno+Hkfi8upG4oR0Jx2/qnzCwXyfSTB7arxlY/xfkk6vSzsWb RPcWhG9Md4XHX7UKCX7Yx2+E9Y2TUF0IPld4+kQamdfUaRoqM1e8WFGD2BDduF3MEkR+Gz/ToUL GBQ== X-Google-Smtp-Source: AGHT+IEu82XmRy0lY1T4aUx77LcpN+15wj25rF0IIbfio5kewqFsMtXS5VE3myBBns7XneJTh6xgPw== X-Received: by 2002:a17:902:b784:b0:1e5:a025:12f9 with SMTP id e4-20020a170902b78400b001e5a02512f9mr4001966pls.28.1714772283235; Fri, 03 May 2024 14:38:03 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:02 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , =?utf-8?q?Guido_G=C3=BCnther?= , =?utf-8?q?Ond=C5=99ej_Jir?= =?utf-8?q?man?= , Frank Oltmanns , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Purism Kernel Team , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 43/48] drm/panel: sitronix-st7703: Don't call disable at shutdown/remove Date: Fri, 3 May 2024 14:33:24 -0700 Message-ID: <20240503143327.RFT.v2.43.I08ba0d4e2d534c06ab0ede9c148bb14cc7c1a9d7@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. The compatible strings used by this driver seem to show up across boards using a variety of DRM drivers. It appears that the relevant drivers have been converted, but at least one compatible string doesn't seem to be found in any mainline dts files so we can't be 100% sure. If it is found that the DRM modeset driver hasn't been fixed then this patch could be temporarily reverted until it is. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: "Guido Günther" Cc: "Ondřej Jirman" Cc: Chris Morgan Cc: Frank Oltmanns Signed-off-by: Douglas Anderson --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sitronix-st7703.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 6b2d940640ca..77b30e045a57 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -937,27 +937,11 @@ static int st7703_probe(struct mipi_dsi_device *dsi) return 0; } -static void st7703_shutdown(struct mipi_dsi_device *dsi) -{ - struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = drm_panel_unprepare(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret); - - ret = drm_panel_disable(&ctx->panel); - if (ret < 0) - dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret); -} - static void st7703_remove(struct mipi_dsi_device *dsi) { struct st7703 *ctx = mipi_dsi_get_drvdata(dsi); int ret; - st7703_shutdown(dsi); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); @@ -981,7 +965,6 @@ MODULE_DEVICE_TABLE(of, st7703_of_match); static struct mipi_dsi_driver st7703_driver = { .probe = st7703_probe, .remove = st7703_remove, - .shutdown = st7703_shutdown, .driver = { .name = DRV_NAME, .of_match_table = st7703_of_match, From patchwork Fri May 3 21:33:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653488 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0A59C4345F for ; Fri, 3 May 2024 21:38:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECE7B1132AA; Fri, 3 May 2024 21:38:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aLNY1vX+"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id B7CD71132AA for ; Fri, 3 May 2024 21:38:08 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ec4b2400b6so940625ad.3 for ; Fri, 03 May 2024 14:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772288; x=1715377088; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIFkEzqD+TIhqStDpaYlErlu7+fCFfSMn8LHhnvMED8=; b=aLNY1vX+3Ct1FpYW9zdIT6ElTM6ycRtoXRtX46hiXwi2/2e3sMhv2MTFaazCKgCKoz gdKC2eoRNFbIikN2tIESNwmEWvQyYuP4L05mWD16IvSz1uNxErRrsDoqzqecu2x27Lgj hWOiUy6AXq4AmfRzTU/6BX+T7w9JlOG4h5zKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772288; x=1715377088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIFkEzqD+TIhqStDpaYlErlu7+fCFfSMn8LHhnvMED8=; b=RYzHB7i6i/qVqPIqDms4nNo8/EpSmID7nzJCINrCDyImwEK653WkyeAz6Z2nlqxJ1v 4TDZpYXeULVCdgdPX5kiTcYMbqPUw04ijlHHcHIxeAm/IdgvCHLZ2xolu/8+7/uYiFA0 sHlpgD8N1H0CRjOUthI1/0AzV88IHNZFVfTW9Sx2QXdTIYB4ygWL1hzRYKu/dRQUmvMi 2HwTTuTZ0eLH8Xs9i/8r71174lLMIDr9c2uQw6LCx6iqzTV1QCcSgD2K6+hbhxgqeWia iC20yRljqNz+CNmSLlzx/16kYtOzkmxLCbLZu67u5QGxWVTjnleVgZGZ6oxbfMH6rmi9 bonA== X-Gm-Message-State: AOJu0Yzr81yagVaWlu3Fzc7k/Ds7SC/WHUNFgrI+KYiOblO3qhPoXOSF xrq+mobZ+JFGPzTm5gcX1fAWUsQiCuFuKLgW47892i5tKCKQ9TZJmi2hneGaeSApiS1s2t8IKC2 cEg== X-Google-Smtp-Source: AGHT+IEppDICkxPotojV6v+5Nxi2QTdXAAGWwbdKCVuRTx7nnbpoKjn0h1KLaB5gimMRVhmWkqxAGw== X-Received: by 2002:a17:902:e943:b0:1eb:7aeb:54f3 with SMTP id b3-20020a170902e94300b001eb7aeb54f3mr5417928pll.36.1714772287701; Fri, 03 May 2024 14:38:07 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:07 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Robert Chiras , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 44/48] drm/panel: raydium-rm67191: Stop tracking enabled Date: Fri, 3 May 2024 14:33:25 -0700 Message-ID: <20240503143327.RFT.v2.44.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. The conversion of the rm67191 panel driver follows many of the other panel drivers but has a few differences that need to be called out. Like in commit 1e0465eb16a4 ("drm/panel: otm8009a: Don't double check prepared/enabled"), this panel also uses the "prepared" flag to prevent the backlight functions from running when the panel is powered off. This is probably not the safest thing to do but the old behavior was preserved. See the discussion in the otm8009a patch. Because of this, I've left the driver tracking "prepared" but removed its tracking of "enabled". NOTE: as part of this, transition the panel's direct calls to its disable/unprepare functions in shutdown to call through DRM panel. Cc: Robert Chiras Signed-off-by: Douglas Anderson --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-raydium-rm67191.c | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c index dbb1ed4efbed..fa9bf89d3bb5 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -205,7 +205,6 @@ struct rad_panel { unsigned int num_supplies; bool prepared; - bool enabled; }; static const struct drm_display_mode default_mode = { @@ -267,9 +266,6 @@ static int rad_panel_prepare(struct drm_panel *panel) struct rad_panel *rad = to_rad_panel(panel); int ret; - if (rad->prepared) - return 0; - ret = regulator_bulk_enable(rad->num_supplies, rad->supplies); if (ret) return ret; @@ -291,9 +287,6 @@ static int rad_panel_unprepare(struct drm_panel *panel) struct rad_panel *rad = to_rad_panel(panel); int ret; - if (!rad->prepared) - return 0; - /* * Right after asserting the reset, we need to release it, so that the * touch driver can have an active connection with the touch controller @@ -322,9 +315,6 @@ static int rad_panel_enable(struct drm_panel *panel) int color_format = color_format_from_dsi_format(dsi->format); int ret; - if (rad->enabled) - return 0; - dsi->mode_flags |= MIPI_DSI_MODE_LPM; ret = rad_panel_push_cmd_list(dsi); @@ -389,8 +379,6 @@ static int rad_panel_enable(struct drm_panel *panel) backlight_enable(rad->backlight); - rad->enabled = true; - return 0; fail: @@ -406,9 +394,6 @@ static int rad_panel_disable(struct drm_panel *panel) struct device *dev = &dsi->dev; int ret; - if (!rad->enabled) - return 0; - dsi->mode_flags |= MIPI_DSI_MODE_LPM; backlight_disable(rad->backlight); @@ -429,8 +414,6 @@ static int rad_panel_disable(struct drm_panel *panel) return ret; } - rad->enabled = false; - return 0; } @@ -633,8 +616,8 @@ static void rad_panel_shutdown(struct mipi_dsi_device *dsi) { struct rad_panel *rad = mipi_dsi_get_drvdata(dsi); - rad_panel_disable(&rad->panel); - rad_panel_unprepare(&rad->panel); + drm_panel_disable(&rad->panel); + drm_panel_unprepare(&rad->panel); } static const struct of_device_id rad_of_match[] = { From patchwork Fri May 3 21:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653489 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1701AC4345F for ; Fri, 3 May 2024 21:38:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32C7A1132A6; Fri, 3 May 2024 21:38:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AXbpv7nl"; dkim-atps=neutral Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D346112A4E for ; Fri, 3 May 2024 21:38:11 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ecc23e6c9dso733155ad.2 for ; Fri, 03 May 2024 14:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772290; x=1715377090; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xmnOhTLenfwPbkZ+9fOpNpevbnj0AgHZgHCpxDLbWgM=; b=AXbpv7nlV7Ls92WikX+eURe9nPg/LFWyobndMTgUi+gPTMZZorGrPSBquiWIGTwNcw QwwVx9RLM/JQWJMzI3mswHiBc3t/1bsMZ8i3CU070zZLwe+KUsPxKOPag3K+MtKyZCuE EKiieVgVQ8xiH9b/VxGGQOvKSboQyp2sVDEbw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772290; x=1715377090; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xmnOhTLenfwPbkZ+9fOpNpevbnj0AgHZgHCpxDLbWgM=; b=D35Hpxu25T5t/wKCAfG61X/Pj/iNjWKCnmENniI1WlzyeYwrjYMZowSaMF5Oie9DCA xAwAyRF2QBB8vI1LFHmmhQaA9FlWPQHfLNClg+Bjcj73ppPwHVUp+wpKUoNpa+eCP4MQ RuHHi6z0SZC8WWMt55+MTszvywISicc6bGQpFBdFotOFKfmK/niA15Zkh7e0dhyD99gO NkhOBMZExUpH1CHDvrqo1f+nCH1zSlhUKF0hKhuvK/9UrujPEU1qBJKKLX++v5PFOhYn ICcmkDN5NWzbcqvL7HxQ3Q7qE1GFT6DSS/jBL/gA23kKmDQ0HZzJ2pSg/x+QiRF+sUa6 kFkg== X-Gm-Message-State: AOJu0YyaghuKHoXmtkZQwPj7qlvmk8GgxCmohXSdR4YaVWR4uazs7c5p OkH7AwBBeaE8ONgKTgcgalGu5Mmis2ReTpc/wkwH3/Ao60KIaERLaPoOXek2eO8fSdUDPE85+G/ X9Q== X-Google-Smtp-Source: AGHT+IGBGVcpKQhnQ/va5QMpwiScWawVFF//2NM+v5dTbUM+lAsV+J43k0O4T3CyMAnt3mgiK6JpMQ== X-Received: by 2002:a17:903:234b:b0:1e2:b13f:bd64 with SMTP id c11-20020a170903234b00b001e2b13fbd64mr5192227plh.0.1714772289909; Fri, 03 May 2024 14:38:09 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:09 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Robert Chiras , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 45/48] drm/panel: raydium-rm67191: Don't call unprepare+disable at shutdown Date: Fri, 3 May 2024 14:33:26 -0700 Message-ID: <20240503143327.RFT.v2.45.Id14188f1a8af7d524751c27c343a5b583ff5361f@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by IMX boards. The IMX driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Robert Chiras Signed-off-by: Douglas Anderson --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-raydium-rm67191.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c index fa9bf89d3bb5..b2029e035635 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -612,14 +612,6 @@ static void rad_panel_remove(struct mipi_dsi_device *dsi) drm_panel_remove(&rad->panel); } -static void rad_panel_shutdown(struct mipi_dsi_device *dsi) -{ - struct rad_panel *rad = mipi_dsi_get_drvdata(dsi); - - drm_panel_disable(&rad->panel); - drm_panel_unprepare(&rad->panel); -} - static const struct of_device_id rad_of_match[] = { { .compatible = "raydium,rm67191", }, { /* sentinel */ } @@ -633,7 +625,6 @@ static struct mipi_dsi_driver rad_panel_driver = { }, .probe = rad_panel_probe, .remove = rad_panel_remove, - .shutdown = rad_panel_shutdown, }; module_mipi_dsi_driver(rad_panel_driver); From patchwork Fri May 3 21:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653490 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F370DC4345F for ; Fri, 3 May 2024 21:38:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E891B112A4E; Fri, 3 May 2024 21:38:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="B13p1mqx"; dkim-atps=neutral Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id E29B91132AB for ; Fri, 3 May 2024 21:38:13 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e651a9f3ffso690325ad.1 for ; Fri, 03 May 2024 14:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772292; x=1715377092; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X9J+mwbNCcE7m50P9Dlsv1H2Zyb5eg1SoTrNCCSKKxs=; b=B13p1mqx6X9HsyFVl6VEH+DIjTw3aDo5MnFEmsqDzpYj3vLTJ+aE2JeVdntK/i0/io k39sQyEqZX1nCTwj+sCx//EdcqwXsXYb+BJDFMt+wMo5tXqvnQiPFDdm2uVmYWUmLjCL TZGuQW8+kHQcLpovjwVwuCbBsVsfEQVu9PhsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772292; x=1715377092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X9J+mwbNCcE7m50P9Dlsv1H2Zyb5eg1SoTrNCCSKKxs=; b=DdbHFy6giFeYg16rO4BQY0Jl1n5dNIZYpq14EAKIvQQoXg+Xhu9EqMox/O0HbPzc3V do86zHO79JD96Ifl+tzXSXzcHhr+U/hI7bcKFejFQAorpplp1hCoKDmc/W7yWXV9Gi7I RPbAkBzDnsFBskLchSgqfWb1L+oqbPs5Cv1Uc6xM5Pi7/WKUM4b7jnkGKPpc5sQ8M7Lg IFGFO9NSRuMPZ4o4xjkj1+oFjHcFPg4LcBNNI6Weu+Gm0yLjP0bmihfHoiA0gEGB8nSb IUaHu20EAsQrxtZVWPHFz6UmRXTdJMxrjP2wvGcVKUUOHW7Z0RCGvFXzGKWkHfq898CG YOsw== X-Gm-Message-State: AOJu0YxyxzW28ecIoU8laPKXosmK4467kYhK1QftQNYw146haezBAV71 AUIY1BtIsNzCnjw8FFWv1bQCxQ9Z7J9jXE6PJlro6NhdVIUsW60ySOY05btJ5VWq/ACiytS0Mrx rmA== X-Google-Smtp-Source: AGHT+IEhvNbol5zNlkCIgLPtF12l61bvixPmv0EHaY4itQnvJImVMXDJ99WT0lhGIYbPhxxJaaynFw== X-Received: by 2002:a17:902:da8c:b0:1e3:cfc5:589e with SMTP id j12-20020a170902da8c00b001e3cfc5589emr4661779plx.64.1714772292404; Fri, 03 May 2024 14:38:12 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:11 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Laurent Pinchart , Sebastian Reichel , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 46/48] drm/panel: sony-acx565akm: Don't double-check enabled state in disable Date: Fri, 3 May 2024 14:33:27 -0700 Message-ID: <20240503143327.RFT.v2.46.I6a51b36831a5c7b2b82bccf8c550cf0d076aa541@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As talked about in commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in drm_panel"), we want to remove needless code from panel drivers that was storing and double-checking the prepared/enabled state. Even if someone was relying on the double-check before, that double-check is now in the core and not needed in individual drivers. The acx565akm seems to do some unique stuff with the "enabled" state. Specifically: 1. It seems to detect the enabled state based on how the bootloader left the panel. 2. It uses the enabled state to prevent certain sysfs files from accessing a disabled panel. We'll leave the "enabled" state tracking for this. However, we can at least get rid of the double-check when trying to disable. Cc: Laurent Pinchart Cc: Sebastian Reichel Signed-off-by: Douglas Anderson Reviewed-by: Linus Walleij --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sony-acx565akm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c index 3d6a286056a0..a9a545a56404 100644 --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c @@ -454,9 +454,6 @@ static int acx565akm_power_on(struct acx565akm_panel *lcd) static void acx565akm_power_off(struct acx565akm_panel *lcd) { - if (!lcd->enabled) - return; - acx565akm_set_display_state(lcd, 0); acx565akm_set_sleep_mode(lcd, 1); lcd->enabled = false; From patchwork Fri May 3 21:33:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653491 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDEF8C25B5C for ; Fri, 3 May 2024 21:38:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 687AC1132AB; Fri, 3 May 2024 21:38:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fw/KaX40"; dkim-atps=neutral Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB6A6112A4E for ; Fri, 3 May 2024 21:38:15 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ecff927a45so1157755ad.0 for ; Fri, 03 May 2024 14:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772294; x=1715377094; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ekjI+s+uLAWB4kUzVZhMVrRRrlC73fq00flN601bwaM=; b=fw/KaX40zJK1SCDzoyV7SJH/5BMvy0h2Akbq/4wa5TvL0q0FCi75JMV2eUAz+E4uUu cl2uM6POPZQJ0QV/eKIDAygElABe+Kq6p5l/zZhZ89J67iHyz3172dlrBcY9UgSLO6oQ sx555j01UpOoC2L2aCFuVF36WtkgDqMWJYnxM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772294; x=1715377094; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekjI+s+uLAWB4kUzVZhMVrRRrlC73fq00flN601bwaM=; b=siad5XP40Gz7yZYJm3i002gZH472MQ3ywOdUhugVtdHCXoxrJmEFPrvZ28WLNX4CHQ uslLKm4yxPYyf/OjbxAUj9GbTCkC0ysCIhqx88wWJIn/MmvAvWJ0SCnFr2xJlHmHoMIw pMA/56nCj14/Qwd41injJLyQlYRu3fu6+q+v4A6LE1S8FzeY2SN/VEytYnCYWdSS2IPA oxmEzOChlI4f/Hh97BlnPWcaV7RwdQx04t8RRwZ+KJPFxtmBSRVp+WsWVmil38AT6d2E YoiHcQyI6IB99irCggDYDp7F1aZZm22NiNAvCj+4tM6wUew7282sZcoRBts2zcl3/AJM bcsg== X-Gm-Message-State: AOJu0YxPGB28B2soCEOBmHq+Q42vbzVjT7q5f1fxXR/aXP9Tler9jZTM Zv3iwOS5IiQwVNkfVtDkjkO5MK/kb5Kv1oF+FW+YUPAJ8survkHQ24c2G4F8hXbWWGHbyaCm/yy ygw== X-Google-Smtp-Source: AGHT+IFguT0/xs4KCtngccJNg5AiVarM5W9ebMgGc4GgQxudEnwAFv+ycO9TzXkPPacW4rwdnnJR0g== X-Received: by 2002:a17:902:bb17:b0:1e9:470:87e6 with SMTP id im23-20020a170902bb1700b001e9047087e6mr3553894plb.23.1714772294293; Fri, 03 May 2024 14:38:14 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:13 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Laurent Pinchart , Sebastian Reichel , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Sam Ravnborg , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 47/48] drm/panel: sony-acx565akm: Don't call disable at remove Date: Fri, 3 May 2024 14:33:28 -0700 Message-ID: <20240503143327.RFT.v2.47.I2513fd6824929a17c1ccd18a797b98a1a1063559@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's the responsibility of a correctly written DRM modeset driver to call drm_atomic_helper_shutdown() at shutdown time and that should be disabling / unpreparing the panel if needed. Panel drivers shouldn't be calling these functions themselves. A recent effort was made to fix as many DRM modeset drivers as possible [1] [2] [3] and most drivers are fixed now. A grep through mainline for compatible strings used by this driver indicates that it is used by TI OMAP boards. The TI OMAP driver appears to be correctly calling drm_atomic_helper_shutdown() so we can remove the calls. [1] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org [2] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org [3] https://lore.kernel.org/r/20230921192749.1542462-1-dianders@chromium.org Cc: Laurent Pinchart Cc: Sebastian Reichel Signed-off-by: Douglas Anderson Reviewed-by: Linus Walleij --- Changes in v2: - Split removal of prepared/enabled from handling of remove/shutdown. drivers/gpu/drm/panel/panel-sony-acx565akm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c index a9a545a56404..73ba93ff00fe 100644 --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c @@ -652,9 +652,6 @@ static void acx565akm_remove(struct spi_device *spi) if (lcd->has_bc) acx565akm_backlight_cleanup(lcd); - - drm_panel_disable(&lcd->panel); - drm_panel_unprepare(&lcd->panel); } static const struct of_device_id acx565akm_of_match[] = { From patchwork Fri May 3 21:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13653492 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EADAEC4345F for ; Fri, 3 May 2024 21:38:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F60C1132AC; Fri, 3 May 2024 21:38:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dfwpp6Me"; dkim-atps=neutral Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D9221132AB for ; Fri, 3 May 2024 21:38:18 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2b43490e0e2so126765a91.2 for ; Fri, 03 May 2024 14:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714772297; x=1715377097; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gkS+rg5OKiFoHCGrecPUpnEeRZJMeWyJ+snKafgy5vs=; b=dfwpp6MeprmhZkfIeKi1OQln+w4TGicUX5nDsDwLrm54COUzyjwPBM6QBf8wFE/z+F 0MvjUBo+EoOaza2Ua38YI1Cr8u7hq8oM+iGBCjehcA0uR33QPlme31WiheTEk4SlOQ/s rDY6XIYdbh3bwdbXl3IXFY28woRHPHtNwn7o0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714772297; x=1715377097; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gkS+rg5OKiFoHCGrecPUpnEeRZJMeWyJ+snKafgy5vs=; b=X7S0rudL/r43Ittp2AWBSSVrfbze2HszbE1P1M4wExj/O24wVIv6ro1dt43zY1TXeD 7Uc4ra7Q0Ftmw+4isKlGqW2Wxo0je9lA71xdY1rxIH9N8AO/Xk7rUaOPiGt2qphdpzUc HW7oDQbW0fncAmeW47oQWg2LX1rFezhM9wo40FtmFiWc8lQ6YFeTAmqtKDd+suENxijH amlyWrUbw72yrMI+w3KU86XaEdB6RroKyxdir9jJ0VzeEMziVn9uyJ5XFFplP7E4dOGr kWJfKoOKaxcp/GfxXj5t4s9zJoBOTyMwZAxc3XVsW0Fae5CARRg5C7za2a8ZQeHhRPmq uxCw== X-Gm-Message-State: AOJu0Yw/olqiFBnroMigdCHqL95kzF41xYl2KRMlRPF3tapS81vDlm1/ PrsMJJNAfVP6pjZRpCTRwFTv4aXu42qU+emRB9mLmqabNFMUu9lYGUU5Xhj69kkfaKmowWLZWqG yqg== X-Google-Smtp-Source: AGHT+IHkW28tWyRIV7NmgOtGvUD0tFuJ+wrkeXjluxHwAroLQKxUR2uvyN5Qr5JmQy9q9YdYC6JW1Q== X-Received: by 2002:a17:90a:6081:b0:2a2:8ed7:da34 with SMTP id z1-20020a17090a608100b002a28ed7da34mr3992252pji.1.1714772297001; Fri, 03 May 2024 14:38:17 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:fb6a:b54b:7580:64f3]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001eb51a46f5bsm3729134plh.43.2024.05.03.14.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:38:16 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Linus Walleij , Chris Morgan , Yuran Pereira , Neil Armstrong , Douglas Anderson , Daniel Vetter , David Airlie , Jonathan Corbet , Maarten Lankhorst , Thomas Zimmermann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 48/48] drm/panel: Update TODO list item for cleaning up prepared/enabled tracking Date: Fri, 3 May 2024 14:33:29 -0700 Message-ID: <20240503143327.RFT.v2.48.I104cdece7324b0c365e552a17f9883414ffaea01@changeid> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240503213441.177109-1-dianders@chromium.org> References: <20240503213441.177109-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that most panels have been updated not to track/double-check their prepared/enabled state update the TODO with next steps. Signed-off-by: Douglas Anderson --- (no changes since v1) Documentation/gpu/todo.rst | 47 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index e2a0585915b3..4063bc45bbd3 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -469,30 +469,35 @@ Contact: Thomas Zimmermann Level: Starter -Clean up checks for already prepared/enabled in panels ------------------------------------------------------- - -In a whole pile of panel drivers, we have code to make the -prepare/unprepare/enable/disable callbacks behave as no-ops if they've already -been called. To get some idea of the duplicated code, try:: - - git grep 'if.*>prepared' -- drivers/gpu/drm/panel - git grep 'if.*>enabled' -- drivers/gpu/drm/panel - -In the patch ("drm/panel: Check for already prepared/enabled in drm_panel") -we've moved this check to the core. Now we can most definitely remove the -check from the individual panels and save a pile of code. - -In adition to removing the check from the individual panels, it is believed -that even the core shouldn't need this check and that should be considered -an error if other code ever relies on this check. The check in the core -currently prints a warning whenever something is relying on this check with -dev_warn(). After a little while, we likely want to promote this to a -WARN(1) to help encourage folks not to rely on this behavior. +Remove disable/unprepare in remove/shutdown in panel-simple and panel-edp +------------------------------------------------------------------------- + +As of commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in +drm_panel"), we have a check in the drm_panel core to make sure nobody +double-calls prepare/enable/disable/unprepare. Eventually that should probably +be turned into a WARN_ON() or somehow made louder, but right now we actually +expect it to trigger and so we don't want it to be too loud. + +Specifically, that warning will trigger for panel-edp and panel-simple at +shutdown time because those panels hardcode a call to drm_panel_disable() +and drm_panel_unprepare() at shutdown and remove time that they call regardless +of panel state. On systems with a properly coded DRM modeset driver that +calls drm_atomic_helper_shutdown() this is pretty much guaranteed to cause +the warning to fire. + +Unfortunately we can't safely remove the calls in panel-edp and panel-simple +until we're sure that all DRM modeset drivers that are used with those panels +properly call drm_atomic_helper_shutdown(). This TODO item is to validate +that all DRM modeset drivers used with panel-edp and panel-simple properly +call drm_atomic_helper_shutdown() and then remove the calls to +disable/unprepare from those panels. Alternatively, this TODO item could be +removed by convincing stakeholders that those calls are fine and downgrading +the error message in drm_panel_disable() / drm_panel_unprepare() to a +debug-level message. Contact: Douglas Anderson -Level: Starter/Intermediate +Level: Intermediate Core refactorings