Commit d43f0fe1 authored by Douglas Anderson's avatar Douglas Anderson

drm/panel: s6e63m0: Don't store+check prepared/enabled

As talked about in commit d2aacaf0 ("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.

For the s6e63m0 panel driver, this actually fixes a subtle/minor error
handling bug in s6e63m0_prepare(). In one error case s6e63m0_prepare()
called s6e63m0_unprepare() directly if there was an error. This call
to s6e63m0_unprepare() would have been a no-op since ctx->prepared
wasn't set yet.
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230804140605.RFC.2.Iabafd062e70f6b6b554cf23eeb75f57a80f7e985@changeid
parent f8c37b88
...@@ -270,9 +270,6 @@ struct s6e63m0 { ...@@ -270,9 +270,6 @@ struct s6e63m0 {
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
bool enabled;
/* /*
* This field is tested by functions directly accessing bus before * This field is tested by functions directly accessing bus before
* transfer, transfer is skipped if it is set. In case of transfer * transfer, transfer is skipped if it is set. In case of transfer
...@@ -502,9 +499,6 @@ static int s6e63m0_disable(struct drm_panel *panel) ...@@ -502,9 +499,6 @@ static int s6e63m0_disable(struct drm_panel *panel)
{ {
struct s6e63m0 *ctx = panel_to_s6e63m0(panel); struct s6e63m0 *ctx = panel_to_s6e63m0(panel);
if (!ctx->enabled)
return 0;
backlight_disable(ctx->bl_dev); backlight_disable(ctx->bl_dev);
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_OFF); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_OFF);
...@@ -512,8 +506,6 @@ static int s6e63m0_disable(struct drm_panel *panel) ...@@ -512,8 +506,6 @@ static int s6e63m0_disable(struct drm_panel *panel)
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE);
msleep(120); msleep(120);
ctx->enabled = false;
return 0; return 0;
} }
...@@ -522,17 +514,12 @@ static int s6e63m0_unprepare(struct drm_panel *panel) ...@@ -522,17 +514,12 @@ static int s6e63m0_unprepare(struct drm_panel *panel)
struct s6e63m0 *ctx = panel_to_s6e63m0(panel); struct s6e63m0 *ctx = panel_to_s6e63m0(panel);
int ret; int ret;
if (!ctx->prepared)
return 0;
s6e63m0_clear_error(ctx); s6e63m0_clear_error(ctx);
ret = s6e63m0_power_off(ctx); ret = s6e63m0_power_off(ctx);
if (ret < 0) if (ret < 0)
return ret; return ret;
ctx->prepared = false;
return 0; return 0;
} }
...@@ -541,9 +528,6 @@ static int s6e63m0_prepare(struct drm_panel *panel) ...@@ -541,9 +528,6 @@ static int s6e63m0_prepare(struct drm_panel *panel)
struct s6e63m0 *ctx = panel_to_s6e63m0(panel); struct s6e63m0 *ctx = panel_to_s6e63m0(panel);
int ret; int ret;
if (ctx->prepared)
return 0;
ret = s6e63m0_power_on(ctx); ret = s6e63m0_power_on(ctx);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -564,8 +548,6 @@ static int s6e63m0_prepare(struct drm_panel *panel) ...@@ -564,8 +548,6 @@ static int s6e63m0_prepare(struct drm_panel *panel)
if (ret < 0) if (ret < 0)
s6e63m0_unprepare(panel); s6e63m0_unprepare(panel);
ctx->prepared = true;
return ret; return ret;
} }
...@@ -573,9 +555,6 @@ static int s6e63m0_enable(struct drm_panel *panel) ...@@ -573,9 +555,6 @@ static int s6e63m0_enable(struct drm_panel *panel)
{ {
struct s6e63m0 *ctx = panel_to_s6e63m0(panel); struct s6e63m0 *ctx = panel_to_s6e63m0(panel);
if (ctx->enabled)
return 0;
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE);
msleep(120); msleep(120);
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON);
...@@ -588,8 +567,6 @@ static int s6e63m0_enable(struct drm_panel *panel) ...@@ -588,8 +567,6 @@ static int s6e63m0_enable(struct drm_panel *panel)
backlight_enable(ctx->bl_dev); backlight_enable(ctx->bl_dev);
ctx->enabled = true;
return 0; return 0;
} }
...@@ -709,8 +686,6 @@ int s6e63m0_probe(struct device *dev, void *trsp, ...@@ -709,8 +686,6 @@ int s6e63m0_probe(struct device *dev, void *trsp,
dev_set_drvdata(dev, ctx); dev_set_drvdata(dev, ctx);
ctx->dev = dev; ctx->dev = dev;
ctx->enabled = false;
ctx->prepared = false;
ret = device_property_read_u32(dev, "max-brightness", &max_brightness); ret = device_property_read_u32(dev, "max-brightness", &max_brightness);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment