Skip to content

Commit

Permalink
drm/panel: Don't store+check prepared/enabled for simple cases
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.

This pile of panel drivers appears to be simple to handle. Based on
code inspection they seemed to be using the prepared/enabled state
simply for double-checking that nothing else in the kernel called them
inconsistently. Now that the core drm_panel is doing the double
checking (and warning) it should be very clear that these devices
don't need their own double-check.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230804140605.RFC.1.Ia54954fd2f7645c1b86597494902973f57feeb71@changeid
  • Loading branch information
Douglas Anderson committed Sep 13, 2023
1 parent 8569c31 commit f8c37b8
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 206 deletions.
9 changes: 0 additions & 9 deletions drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct tm5p5_nt35596 {
struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio;
bool prepared;
};

static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel)
Expand Down Expand Up @@ -112,9 +111,6 @@ static int tm5p5_nt35596_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);
Expand All @@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
return ret;
}

ctx->prepared = true;
return 0;
}

Expand All @@ -142,9 +137,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (!ctx->prepared)
return 0;

ret = tm5p5_nt35596_off(ctx);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
Expand All @@ -153,7 +145,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
ctx->supplies);

ctx->prepared = false;
return 0;
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct boe_bf060y8m_aj0 {
struct mipi_dsi_device *dsi;
struct regulator_bulk_data vregs[BF060Y8M_VREG_MAX];
struct gpio_desc *reset_gpio;
bool prepared;
};

static inline
Expand Down Expand Up @@ -129,9 +128,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
struct device *dev = &boe->dsi->dev;
int ret;

if (boe->prepared)
return 0;

/*
* Enable EL Driving Voltage first - doing that at the beginning
* or at the end of the power sequence doesn't matter, so enable
Expand Down Expand Up @@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
return ret;
}

boe->prepared = true;
return 0;

err_vci:
Expand All @@ -186,17 +181,13 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel)
struct device *dev = &boe->dsi->dev;
int ret;

if (!boe->prepared)
return 0;

ret = boe_bf060y8m_aj0_off(boe);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);

gpiod_set_value_cansleep(boe->reset_gpio, 1);
ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs);

boe->prepared = false;
return 0;
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct jdi_fhd_r63452 {
struct drm_panel panel;
struct mipi_dsi_device *dsi;
struct gpio_desc *reset_gpio;
bool prepared;
};

static inline struct jdi_fhd_r63452 *to_jdi_fhd_r63452(struct drm_panel *panel)
Expand Down Expand Up @@ -157,9 +156,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (ctx->prepared)
return 0;

jdi_fhd_r63452_reset(ctx);

ret = jdi_fhd_r63452_on(ctx);
Expand All @@ -169,7 +165,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
return ret;
}

ctx->prepared = true;
return 0;
}

Expand All @@ -179,16 +174,12 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (!ctx->prepared)
return 0;

ret = jdi_fhd_r63452_off(ctx);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);

gpiod_set_value_cansleep(ctx->reset_gpio, 1);

ctx->prepared = false;
return 0;
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/gpu/drm/panel/panel-novatek-nt35950.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct nt35950 {

int cur_mode;
u8 last_page;
bool prepared;
};

struct nt35950_panel_mode {
Expand Down Expand Up @@ -431,9 +430,6 @@ static int nt35950_prepare(struct drm_panel *panel)
struct device *dev = &nt->dsi[0]->dev;
int ret;

if (nt->prepared)
return 0;

ret = regulator_enable(nt->vregs[0].consumer);
if (ret)
return ret;
Expand All @@ -460,7 +456,6 @@ static int nt35950_prepare(struct drm_panel *panel)
dev_err(dev, "Failed to initialize panel: %d\n", ret);
goto end;
}
nt->prepared = true;

end:
if (ret < 0) {
Expand All @@ -477,17 +472,13 @@ static int nt35950_unprepare(struct drm_panel *panel)
struct device *dev = &nt->dsi[0]->dev;
int ret;

if (!nt->prepared)
return 0;

ret = nt35950_off(nt);
if (ret < 0)
dev_err(dev, "Failed to deinitialize panel: %d\n", ret);

gpiod_set_value_cansleep(nt->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs);

nt->prepared = false;
return 0;
}

Expand Down
12 changes: 0 additions & 12 deletions drivers/gpu/drm/panel/panel-novatek-nt36523.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ struct panel_info {
struct gpio_desc *reset_gpio;
struct backlight_device *backlight;
struct regulator *vddio;

bool prepared;
};

struct panel_desc {
Expand Down Expand Up @@ -1046,9 +1044,6 @@ static int nt36523_prepare(struct drm_panel *panel)
struct panel_info *pinfo = to_panel_info(panel);
int ret;

if (pinfo->prepared)
return 0;

ret = regulator_enable(pinfo->vddio);
if (ret) {
dev_err(panel->dev, "failed to enable vddio regulator: %d\n", ret);
Expand All @@ -1064,8 +1059,6 @@ static int nt36523_prepare(struct drm_panel *panel)
return ret;
}

pinfo->prepared = true;

return 0;
}

Expand Down Expand Up @@ -1095,14 +1088,9 @@ static int nt36523_unprepare(struct drm_panel *panel)
{
struct panel_info *pinfo = to_panel_info(panel);

if (!pinfo->prepared)
return 0;

gpiod_set_value_cansleep(pinfo->reset_gpio, 1);
regulator_disable(pinfo->vddio);

pinfo->prepared = false;

return 0;
}

Expand Down
38 changes: 0 additions & 38 deletions drivers/gpu/drm/panel/panel-raydium-rm68200.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ struct rm68200 {
struct drm_panel panel;
struct gpio_desc *reset_gpio;
struct regulator *supply;
bool prepared;
bool enabled;
};

static const struct drm_display_mode default_mode = {
Expand Down Expand Up @@ -231,27 +229,12 @@ static void rm68200_init_sequence(struct rm68200 *ctx)
dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD1_UCS);
}

static int rm68200_disable(struct drm_panel *panel)
{
struct rm68200 *ctx = panel_to_rm68200(panel);

if (!ctx->enabled)
return 0;

ctx->enabled = false;

return 0;
}

static int rm68200_unprepare(struct drm_panel *panel)
{
struct rm68200 *ctx = panel_to_rm68200(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)
dev_warn(panel->dev, "failed to set display off: %d\n", ret);
Expand All @@ -269,8 +252,6 @@ static int rm68200_unprepare(struct drm_panel *panel)

regulator_disable(ctx->supply);

ctx->prepared = false;

return 0;
}

Expand All @@ -280,9 +261,6 @@ static int rm68200_prepare(struct drm_panel *panel)
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret;

if (ctx->prepared)
return 0;

ret = regulator_enable(ctx->supply);
if (ret < 0) {
dev_err(ctx->dev, "failed to enable supply: %d\n", ret);
Expand Down Expand Up @@ -310,20 +288,6 @@ static int rm68200_prepare(struct drm_panel *panel)

msleep(20);

ctx->prepared = true;

return 0;
}

static int rm68200_enable(struct drm_panel *panel)
{
struct rm68200 *ctx = panel_to_rm68200(panel);

if (ctx->enabled)
return 0;

ctx->enabled = true;

return 0;
}

Expand Down Expand Up @@ -352,10 +316,8 @@ static int rm68200_get_modes(struct drm_panel *panel,
}

static const struct drm_panel_funcs rm68200_drm_funcs = {
.disable = rm68200_disable,
.unprepare = rm68200_unprepare,
.prepare = rm68200_prepare,
.enable = rm68200_enable,
.get_modes = rm68200_get_modes,
};

Expand Down
10 changes: 0 additions & 10 deletions drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ struct s6e88a0_ams452ef01 {
struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio;

bool prepared;
};

static inline struct
Expand Down Expand Up @@ -115,9 +113,6 @@ static int s6e88a0_ams452ef01_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);
Expand All @@ -135,7 +130,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel)
return ret;
}

ctx->prepared = true;
return 0;
}

Expand All @@ -145,17 +139,13 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (!ctx->prepared)
return 0;

ret = s6e88a0_ams452ef01_off(ctx);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);

gpiod_set_value_cansleep(ctx->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);

ctx->prepared = false;
return 0;
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/gpu/drm/panel/panel-samsung-sofef00.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct sofef00_panel {
struct regulator *supply;
struct gpio_desc *reset_gpio;
const struct drm_display_mode *mode;
bool prepared;
};

static inline
Expand Down Expand Up @@ -113,9 +112,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (ctx->prepared)
return 0;

ret = regulator_enable(ctx->supply);
if (ret < 0) {
dev_err(dev, "Failed to enable regulator: %d\n", ret);
Expand All @@ -131,7 +127,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
return ret;
}

ctx->prepared = true;
return 0;
}

Expand All @@ -141,16 +136,12 @@ static int sofef00_panel_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev;
int ret;

if (!ctx->prepared)
return 0;

ret = sofef00_panel_off(ctx);
if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);

regulator_disable(ctx->supply);

ctx->prepared = false;
return 0;
}

Expand Down
Loading

0 comments on commit f8c37b8

Please sign in to comment.