From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org> Cc: Neil Armstrong <neil.armstrong@linaro.org>, Sam Ravnborg <sam@ravnborg.org>, Douglas Anderson <dianders@chromium.org>, linux-kernel@vger.kernel.org, Robert Chiras <robert.chiras@nxp.com> Subject: [RFC PATCH 08/10] drm/panel: rm67191: Don't store+check enabled Date: Fri, 4 Aug 2023 14:06:11 -0700 [thread overview] Message-ID: <20230804140605.RFC.8.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid> (raw) In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> 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 is separated out because it has a few differences that need to be called out. Like otm8009a, 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 patch ("drm/panel: otm8009a: Don't double check prepared/enabled"). Because of this, I've left the driver tracking "prepared" but removed its tracking of "enabled". This panel also used to directly call its disable/unprepare functions at shutdown time instead of calling into drm_panel. Now we're calling drm_panel_helper_shutdown() which in turn calls drm_panel_unprepare()/drm_panel_disable(). That paves the way if anyone wants to use a the panel follower APIs with this panel. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- 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..fb378924c0b3 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -20,6 +20,7 @@ #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_panel_helper.h> /* Panel specific color-format bits */ #define COL_FMT_16BPP 0x55 @@ -205,7 +206,6 @@ struct rad_panel { unsigned int num_supplies; bool prepared; - bool enabled; }; static const struct drm_display_mode default_mode = { @@ -267,9 +267,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 +288,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 +316,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 +380,6 @@ static int rad_panel_enable(struct drm_panel *panel) backlight_enable(rad->backlight); - rad->enabled = true; - return 0; fail: @@ -406,9 +395,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 +415,6 @@ static int rad_panel_disable(struct drm_panel *panel) return ret; } - rad->enabled = false; - return 0; } @@ -633,8 +617,7 @@ 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_helper_shutdown(&rad->panel); } static const struct of_device_id rad_of_match[] = { -- 2.41.0.585.gd2178a4bd4-goog
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org> Cc: Linus Walleij <linus.walleij@linaro.org>, Douglas Anderson <dianders@chromium.org>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Chiras <robert.chiras@nxp.com>, Sam Ravnborg <sam@ravnborg.org>, linux-kernel@vger.kernel.org Subject: [RFC PATCH 08/10] drm/panel: rm67191: Don't store+check enabled Date: Fri, 4 Aug 2023 14:06:11 -0700 [thread overview] Message-ID: <20230804140605.RFC.8.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid> (raw) In-Reply-To: <20230804210644.1862287-1-dianders@chromium.org> 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 is separated out because it has a few differences that need to be called out. Like otm8009a, 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 patch ("drm/panel: otm8009a: Don't double check prepared/enabled"). Because of this, I've left the driver tracking "prepared" but removed its tracking of "enabled". This panel also used to directly call its disable/unprepare functions at shutdown time instead of calling into drm_panel. Now we're calling drm_panel_helper_shutdown() which in turn calls drm_panel_unprepare()/drm_panel_disable(). That paves the way if anyone wants to use a the panel follower APIs with this panel. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- 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..fb378924c0b3 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -20,6 +20,7 @@ #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_panel_helper.h> /* Panel specific color-format bits */ #define COL_FMT_16BPP 0x55 @@ -205,7 +206,6 @@ struct rad_panel { unsigned int num_supplies; bool prepared; - bool enabled; }; static const struct drm_display_mode default_mode = { @@ -267,9 +267,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 +288,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 +316,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 +380,6 @@ static int rad_panel_enable(struct drm_panel *panel) backlight_enable(rad->backlight); - rad->enabled = true; - return 0; fail: @@ -406,9 +395,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 +415,6 @@ static int rad_panel_disable(struct drm_panel *panel) return ret; } - rad->enabled = false; - return 0; } @@ -633,8 +617,7 @@ 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_helper_shutdown(&rad->panel); } static const struct of_device_id rad_of_match[] = { -- 2.41.0.585.gd2178a4bd4-goog
next prev parent reply other threads:[~2023-08-04 21:07 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-04 21:06 [RFC PATCH 00/10] drm/panel: Remove most store/double-check of prepared/enabled state Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 01/10] drm/panel: Don't store+check prepared/enabled for simple cases Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 02/10] drm/panel: s6e63m0: Don't store+check prepared/enabled Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 03/10] drm/panel: otm8009a: Don't double check prepared/enabled Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-09-13 18:20 ` Doug Anderson 2023-09-13 18:20 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 04/10] drm/panel_helper: Introduce drm_panel_helper Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-07 6:41 ` Maxime Ripard 2023-08-07 6:41 ` Maxime Ripard 2023-08-25 21:58 ` Doug Anderson 2023-08-25 21:58 ` Doug Anderson 2023-08-28 7:45 ` Maxime Ripard 2023-08-28 7:45 ` Maxime Ripard 2023-08-28 16:06 ` Doug Anderson 2023-08-28 16:06 ` Doug Anderson 2023-08-29 8:38 ` Maxime Ripard 2023-08-29 8:38 ` Maxime Ripard 2023-08-30 23:10 ` Doug Anderson 2023-08-30 23:10 ` Doug Anderson 2023-08-31 7:38 ` Maxime Ripard 2023-08-31 7:38 ` Maxime Ripard 2023-08-31 18:18 ` Doug Anderson 2023-08-31 18:18 ` Doug Anderson 2023-09-01 8:15 ` Maxime Ripard 2023-09-01 8:15 ` Maxime Ripard 2023-09-01 13:42 ` Doug Anderson 2023-09-01 13:42 ` Doug Anderson 2023-09-01 23:44 ` Doug Anderson 2023-09-01 23:44 ` Doug Anderson 2023-09-04 15:33 ` Maxime Ripard 2023-09-04 15:33 ` Maxime Ripard 2023-09-05 16:45 ` Doug Anderson 2023-09-05 16:45 ` Doug Anderson 2023-09-05 19:12 ` Doug Anderson 2023-09-05 19:12 ` Doug Anderson 2023-09-07 14:16 ` Maxime Ripard 2023-09-07 14:16 ` Maxime Ripard 2023-09-07 14:14 ` Maxime Ripard 2023-09-07 14:14 ` Maxime Ripard 2023-09-13 18:28 ` Doug Anderson 2023-09-13 18:28 ` Doug Anderson 2023-08-04 21:06 ` [RFC PATCH 05/10] drm/panel: Don't store+check prepared/enabled for panels needing shutdown Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 06/10] drm/panel: Don't store+check prepared/enabled for panels disabled at shutdown Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 07/10] drm/panel: st7703: Don't store+check prepared Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson [this message] 2023-08-04 21:06 ` [RFC PATCH 08/10] drm/panel: rm67191: Don't store+check enabled Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 09/10] drm/panel: sony-acx565akm: Don't double-check enabled state in disable Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-04 21:06 ` [RFC PATCH 10/10] drm/panel: Update TODO list item for cleaning up prepared/enabled tracking Douglas Anderson 2023-08-04 21:06 ` Douglas Anderson 2023-08-07 6:41 ` Maxime Ripard 2023-08-07 6:41 ` Maxime Ripard 2023-08-10 8:23 ` [RFC PATCH 00/10] drm/panel: Remove most store/double-check of prepared/enabled state Linus Walleij 2023-08-10 8:23 ` Linus Walleij 2023-09-05 19:15 ` Doug Anderson 2023-09-05 19:15 ` Doug Anderson
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230804140605.RFC.8.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid \ --to=dianders@chromium.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mripard@kernel.org \ --cc=neil.armstrong@linaro.org \ --cc=robert.chiras@nxp.com \ --cc=sam@ravnborg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.