Skip to content

Commit

Permalink
drm/panel: raydium-rm67191: Stop tracking enabled
Browse files Browse the repository at this point in the history
As talked about in commit d2aacaf ("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 1e0465e ("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 <robert.chiras@nxp.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240604172305.v3.21.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240604172305.v3.21.I20f82e9dd1597a14ae37a64c6b8275add60fbdb1@changeid
  • Loading branch information
Douglas Anderson authored and Neil Armstrong committed Jun 11, 2024
1 parent b3494cc commit b7c906d
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions drivers/gpu/drm/panel/panel-raydium-rm67191.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ struct rad_panel {
unsigned int num_supplies;

bool prepared;
bool enabled;
};

static const struct drm_display_mode default_mode = {
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -389,8 +379,6 @@ static int rad_panel_enable(struct drm_panel *panel)

backlight_enable(rad->backlight);

rad->enabled = true;

return 0;

fail:
Expand All @@ -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);
Expand All @@ -429,8 +414,6 @@ static int rad_panel_disable(struct drm_panel *panel)
return ret;
}

rad->enabled = false;

return 0;
}

Expand Down Expand Up @@ -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[] = {
Expand Down

0 comments on commit b7c906d

Please sign in to comment.