Commit f8c37b88 authored by Douglas Anderson's avatar Douglas Anderson

drm/panel: Don't store+check prepared/enabled for simple cases

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.

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: 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.1.Ia54954fd2f7645c1b86597494902973f57feeb71@changeid
parent 8569c315
...@@ -16,7 +16,6 @@ struct tm5p5_nt35596 { ...@@ -16,7 +16,6 @@ struct tm5p5_nt35596 {
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
}; };
static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel) static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel)
...@@ -112,9 +111,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel) ...@@ -112,9 +111,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret); dev_err(dev, "Failed to enable regulators: %d\n", ret);
...@@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel) ...@@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -142,9 +137,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel) ...@@ -142,9 +137,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = tm5p5_nt35596_off(ctx); ret = tm5p5_nt35596_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -153,7 +145,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel) ...@@ -153,7 +145,6 @@ static int tm5p5_nt35596_unprepare(struct drm_panel *panel)
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
ctx->supplies); ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -34,7 +34,6 @@ struct boe_bf060y8m_aj0 { ...@@ -34,7 +34,6 @@ struct boe_bf060y8m_aj0 {
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct regulator_bulk_data vregs[BF060Y8M_VREG_MAX]; struct regulator_bulk_data vregs[BF060Y8M_VREG_MAX];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
}; };
static inline static inline
...@@ -129,9 +128,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) ...@@ -129,9 +128,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
struct device *dev = &boe->dsi->dev; struct device *dev = &boe->dsi->dev;
int ret; int ret;
if (boe->prepared)
return 0;
/* /*
* Enable EL Driving Voltage first - doing that at the beginning * Enable EL Driving Voltage first - doing that at the beginning
* or at the end of the power sequence doesn't matter, so enable * or at the end of the power sequence doesn't matter, so enable
...@@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) ...@@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
return ret; return ret;
} }
boe->prepared = true;
return 0; return 0;
err_vci: err_vci:
...@@ -186,9 +181,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) ...@@ -186,9 +181,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel)
struct device *dev = &boe->dsi->dev; struct device *dev = &boe->dsi->dev;
int ret; int ret;
if (!boe->prepared)
return 0;
ret = boe_bf060y8m_aj0_off(boe); ret = boe_bf060y8m_aj0_off(boe);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -196,7 +188,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) ...@@ -196,7 +188,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel)
gpiod_set_value_cansleep(boe->reset_gpio, 1); gpiod_set_value_cansleep(boe->reset_gpio, 1);
ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs); ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs);
boe->prepared = false;
return 0; return 0;
} }
......
...@@ -21,7 +21,6 @@ struct jdi_fhd_r63452 { ...@@ -21,7 +21,6 @@ struct jdi_fhd_r63452 {
struct drm_panel panel; struct drm_panel panel;
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
}; };
static inline struct jdi_fhd_r63452 *to_jdi_fhd_r63452(struct drm_panel *panel) static inline struct jdi_fhd_r63452 *to_jdi_fhd_r63452(struct drm_panel *panel)
...@@ -157,9 +156,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel) ...@@ -157,9 +156,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
jdi_fhd_r63452_reset(ctx); jdi_fhd_r63452_reset(ctx);
ret = jdi_fhd_r63452_on(ctx); ret = jdi_fhd_r63452_on(ctx);
...@@ -169,7 +165,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel) ...@@ -169,7 +165,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -179,16 +174,12 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel) ...@@ -179,16 +174,12 @@ static int jdi_fhd_r63452_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = jdi_fhd_r63452_off(ctx); ret = jdi_fhd_r63452_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
gpiod_set_value_cansleep(ctx->reset_gpio, 1); gpiod_set_value_cansleep(ctx->reset_gpio, 1);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -59,7 +59,6 @@ struct nt35950 { ...@@ -59,7 +59,6 @@ struct nt35950 {
int cur_mode; int cur_mode;
u8 last_page; u8 last_page;
bool prepared;
}; };
struct nt35950_panel_mode { struct nt35950_panel_mode {
...@@ -431,9 +430,6 @@ static int nt35950_prepare(struct drm_panel *panel) ...@@ -431,9 +430,6 @@ static int nt35950_prepare(struct drm_panel *panel)
struct device *dev = &nt->dsi[0]->dev; struct device *dev = &nt->dsi[0]->dev;
int ret; int ret;
if (nt->prepared)
return 0;
ret = regulator_enable(nt->vregs[0].consumer); ret = regulator_enable(nt->vregs[0].consumer);
if (ret) if (ret)
return ret; return ret;
...@@ -460,7 +456,6 @@ static int nt35950_prepare(struct drm_panel *panel) ...@@ -460,7 +456,6 @@ static int nt35950_prepare(struct drm_panel *panel)
dev_err(dev, "Failed to initialize panel: %d\n", ret); dev_err(dev, "Failed to initialize panel: %d\n", ret);
goto end; goto end;
} }
nt->prepared = true;
end: end:
if (ret < 0) { if (ret < 0) {
...@@ -477,9 +472,6 @@ static int nt35950_unprepare(struct drm_panel *panel) ...@@ -477,9 +472,6 @@ static int nt35950_unprepare(struct drm_panel *panel)
struct device *dev = &nt->dsi[0]->dev; struct device *dev = &nt->dsi[0]->dev;
int ret; int ret;
if (!nt->prepared)
return 0;
ret = nt35950_off(nt); ret = nt35950_off(nt);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to deinitialize panel: %d\n", ret); dev_err(dev, "Failed to deinitialize panel: %d\n", ret);
...@@ -487,7 +479,6 @@ static int nt35950_unprepare(struct drm_panel *panel) ...@@ -487,7 +479,6 @@ static int nt35950_unprepare(struct drm_panel *panel)
gpiod_set_value_cansleep(nt->reset_gpio, 0); gpiod_set_value_cansleep(nt->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs); regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs);
nt->prepared = false;
return 0; return 0;
} }
......
...@@ -38,8 +38,6 @@ struct panel_info { ...@@ -38,8 +38,6 @@ struct panel_info {
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct backlight_device *backlight; struct backlight_device *backlight;
struct regulator *vddio; struct regulator *vddio;
bool prepared;
}; };
struct panel_desc { struct panel_desc {
...@@ -1046,9 +1044,6 @@ static int nt36523_prepare(struct drm_panel *panel) ...@@ -1046,9 +1044,6 @@ static int nt36523_prepare(struct drm_panel *panel)
struct panel_info *pinfo = to_panel_info(panel); struct panel_info *pinfo = to_panel_info(panel);
int ret; int ret;
if (pinfo->prepared)
return 0;
ret = regulator_enable(pinfo->vddio); ret = regulator_enable(pinfo->vddio);
if (ret) { if (ret) {
dev_err(panel->dev, "failed to enable vddio regulator: %d\n", ret); dev_err(panel->dev, "failed to enable vddio regulator: %d\n", ret);
...@@ -1064,8 +1059,6 @@ static int nt36523_prepare(struct drm_panel *panel) ...@@ -1064,8 +1059,6 @@ static int nt36523_prepare(struct drm_panel *panel)
return ret; return ret;
} }
pinfo->prepared = true;
return 0; return 0;
} }
...@@ -1095,14 +1088,9 @@ static int nt36523_unprepare(struct drm_panel *panel) ...@@ -1095,14 +1088,9 @@ static int nt36523_unprepare(struct drm_panel *panel)
{ {
struct panel_info *pinfo = to_panel_info(panel); struct panel_info *pinfo = to_panel_info(panel);
if (!pinfo->prepared)
return 0;
gpiod_set_value_cansleep(pinfo->reset_gpio, 1); gpiod_set_value_cansleep(pinfo->reset_gpio, 1);
regulator_disable(pinfo->vddio); regulator_disable(pinfo->vddio);
pinfo->prepared = false;
return 0; return 0;
} }
......
...@@ -77,8 +77,6 @@ struct rm68200 { ...@@ -77,8 +77,6 @@ struct rm68200 {
struct drm_panel panel; struct drm_panel panel;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct regulator *supply; struct regulator *supply;
bool prepared;
bool enabled;
}; };
static const struct drm_display_mode default_mode = { static const struct drm_display_mode default_mode = {
...@@ -231,27 +229,12 @@ static void rm68200_init_sequence(struct rm68200 *ctx) ...@@ -231,27 +229,12 @@ static void rm68200_init_sequence(struct rm68200 *ctx)
dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD1_UCS); 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) static int rm68200_unprepare(struct drm_panel *panel)
{ {
struct rm68200 *ctx = panel_to_rm68200(panel); struct rm68200 *ctx = panel_to_rm68200(panel);
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = mipi_dsi_dcs_set_display_off(dsi); ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret) if (ret)
dev_warn(panel->dev, "failed to set display off: %d\n", ret); dev_warn(panel->dev, "failed to set display off: %d\n", ret);
...@@ -269,8 +252,6 @@ static int rm68200_unprepare(struct drm_panel *panel) ...@@ -269,8 +252,6 @@ static int rm68200_unprepare(struct drm_panel *panel)
regulator_disable(ctx->supply); regulator_disable(ctx->supply);
ctx->prepared = false;
return 0; return 0;
} }
...@@ -280,9 +261,6 @@ static int rm68200_prepare(struct drm_panel *panel) ...@@ -280,9 +261,6 @@ static int rm68200_prepare(struct drm_panel *panel)
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_enable(ctx->supply); ret = regulator_enable(ctx->supply);
if (ret < 0) { if (ret < 0) {
dev_err(ctx->dev, "failed to enable supply: %d\n", ret); dev_err(ctx->dev, "failed to enable supply: %d\n", ret);
...@@ -310,20 +288,6 @@ static int rm68200_prepare(struct drm_panel *panel) ...@@ -310,20 +288,6 @@ static int rm68200_prepare(struct drm_panel *panel)
msleep(20); 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; return 0;
} }
...@@ -352,10 +316,8 @@ static int rm68200_get_modes(struct drm_panel *panel, ...@@ -352,10 +316,8 @@ static int rm68200_get_modes(struct drm_panel *panel,
} }
static const struct drm_panel_funcs rm68200_drm_funcs = { static const struct drm_panel_funcs rm68200_drm_funcs = {
.disable = rm68200_disable,
.unprepare = rm68200_unprepare, .unprepare = rm68200_unprepare,
.prepare = rm68200_prepare, .prepare = rm68200_prepare,
.enable = rm68200_enable,
.get_modes = rm68200_get_modes, .get_modes = rm68200_get_modes,
}; };
......
...@@ -18,8 +18,6 @@ struct s6e88a0_ams452ef01 { ...@@ -18,8 +18,6 @@ struct s6e88a0_ams452ef01 {
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
}; };
static inline struct static inline struct
...@@ -115,9 +113,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) ...@@ -115,9 +113,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret); dev_err(dev, "Failed to enable regulators: %d\n", ret);
...@@ -135,7 +130,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) ...@@ -135,7 +130,6 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -145,9 +139,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) ...@@ -145,9 +139,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = s6e88a0_ams452ef01_off(ctx); ret = s6e88a0_ams452ef01_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -155,7 +146,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) ...@@ -155,7 +146,6 @@ static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel)
gpiod_set_value_cansleep(ctx->reset_gpio, 0); gpiod_set_value_cansleep(ctx->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -23,7 +23,6 @@ struct sofef00_panel { ...@@ -23,7 +23,6 @@ struct sofef00_panel {
struct regulator *supply; struct regulator *supply;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
const struct drm_display_mode *mode; const struct drm_display_mode *mode;
bool prepared;
}; };
static inline static inline
...@@ -113,9 +112,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel) ...@@ -113,9 +112,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_enable(ctx->supply); ret = regulator_enable(ctx->supply);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to enable regulator: %d\n", ret); dev_err(dev, "Failed to enable regulator: %d\n", ret);
...@@ -131,7 +127,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel) ...@@ -131,7 +127,6 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -141,16 +136,12 @@ static int sofef00_panel_unprepare(struct drm_panel *panel) ...@@ -141,16 +136,12 @@ static int sofef00_panel_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = sofef00_panel_off(ctx); ret = sofef00_panel_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
regulator_disable(ctx->supply); regulator_disable(ctx->supply);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -24,7 +24,6 @@ struct sharp_ls060 { ...@@ -24,7 +24,6 @@ struct sharp_ls060 {
struct regulator *avdd_supply; struct regulator *avdd_supply;
struct regulator *avee_supply; struct regulator *avee_supply;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
bool prepared;
}; };
static inline struct sharp_ls060 *to_sharp_ls060(struct drm_panel *panel) static inline struct sharp_ls060 *to_sharp_ls060(struct drm_panel *panel)
...@@ -101,9 +100,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel) ...@@ -101,9 +100,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_enable(ctx->vddi_supply); ret = regulator_enable(ctx->vddi_supply);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -134,8 +130,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel) ...@@ -134,8 +130,6 @@ static int sharp_ls060_prepare(struct drm_panel *panel)
goto err_on; goto err_on;
} }
ctx->prepared = true;
return 0; return 0;
err_on: err_on:
...@@ -163,9 +157,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel) ...@@ -163,9 +157,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = sharp_ls060_off(ctx); ret = sharp_ls060_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -181,7 +172,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel) ...@@ -181,7 +172,6 @@ static int sharp_ls060_unprepare(struct drm_panel *panel)
regulator_disable(ctx->vddi_supply); regulator_disable(ctx->vddi_supply);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -36,7 +36,6 @@ struct sony_td4353_jdi { ...@@ -36,7 +36,6 @@ struct sony_td4353_jdi {
struct regulator_bulk_data supplies[3]; struct regulator_bulk_data supplies[3];
struct gpio_desc *panel_reset_gpio; struct gpio_desc *panel_reset_gpio;
struct gpio_desc *touch_reset_gpio; struct gpio_desc *touch_reset_gpio;
bool prepared;
int type; int type;
}; };
...@@ -150,9 +149,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel) ...@@ -150,9 +149,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret); dev_err(dev, "Failed to enable regulators: %d\n", ret);
...@@ -171,7 +167,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel) ...@@ -171,7 +167,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -181,9 +176,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel) ...@@ -181,9 +176,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = sony_td4353_jdi_off(ctx); ret = sony_td4353_jdi_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to power off panel: %d\n", ret); dev_err(dev, "Failed to power off panel: %d\n", ret);
...@@ -191,7 +183,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel) ...@@ -191,7 +183,6 @@ static int sony_td4353_jdi_unprepare(struct drm_panel *panel)
sony_td4353_assert_reset_gpios(ctx, 0); sony_td4353_assert_reset_gpios(ctx, 0);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
......
...@@ -23,8 +23,6 @@ struct truly_nt35521 { ...@@ -23,8 +23,6 @@ struct truly_nt35521 {
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct gpio_desc *blen_gpio; struct gpio_desc *blen_gpio;
bool prepared;
bool enabled;
}; };
static inline static inline
...@@ -296,9 +294,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel) ...@@ -296,9 +294,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret); dev_err(dev, "Failed to enable regulators: %d\n", ret);
...@@ -314,7 +309,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel) ...@@ -314,7 +309,6 @@ static int truly_nt35521_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -324,9 +318,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel) ...@@ -324,9 +318,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = truly_nt35521_off(ctx); ret = truly_nt35521_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -335,7 +326,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel) ...@@ -335,7 +326,6 @@ static int truly_nt35521_unprepare(struct drm_panel *panel)
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), regulator_bulk_disable(ARRAY_SIZE(ctx->supplies),
ctx->supplies); ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
...@@ -343,12 +333,8 @@ static int truly_nt35521_enable(struct drm_panel *panel) ...@@ -343,12 +333,8 @@ static int truly_nt35521_enable(struct drm_panel *panel)
{ {
struct truly_nt35521 *ctx = to_truly_nt35521(panel); struct truly_nt35521 *ctx = to_truly_nt35521(panel);
if (ctx->enabled)
return 0;
gpiod_set_value_cansleep(ctx->blen_gpio, 1); gpiod_set_value_cansleep(ctx->blen_gpio, 1);
ctx->enabled = true;
return 0; return 0;
} }
...@@ -356,12 +342,8 @@ static int truly_nt35521_disable(struct drm_panel *panel) ...@@ -356,12 +342,8 @@ static int truly_nt35521_disable(struct drm_panel *panel)
{ {
struct truly_nt35521 *ctx = to_truly_nt35521(panel); struct truly_nt35521 *ctx = to_truly_nt35521(panel);
if (!ctx->enabled)
return 0;
gpiod_set_value_cansleep(ctx->blen_gpio, 0); gpiod_set_value_cansleep(ctx->blen_gpio, 0);
ctx->enabled = false;
return 0; return 0;
} }
......
...@@ -35,7 +35,6 @@ enum { ...@@ -35,7 +35,6 @@ enum {
}; };
struct stk_panel { struct stk_panel {
bool prepared;
const struct drm_display_mode *mode; const struct drm_display_mode *mode;
struct backlight_device *backlight; struct backlight_device *backlight;
struct drm_panel base; struct drm_panel base;
...@@ -145,16 +144,11 @@ static int stk_panel_unprepare(struct drm_panel *panel) ...@@ -145,16 +144,11 @@ static int stk_panel_unprepare(struct drm_panel *panel)
{ {
struct stk_panel *stk = to_stk_panel(panel); struct stk_panel *stk = to_stk_panel(panel);
if (!stk->prepared)
return 0;
stk_panel_off(stk); stk_panel_off(stk);
regulator_bulk_disable(ARRAY_SIZE(stk->supplies), stk->supplies); regulator_bulk_disable(ARRAY_SIZE(stk->supplies), stk->supplies);
gpiod_set_value(stk->reset_gpio, 0); gpiod_set_value(stk->reset_gpio, 0);
gpiod_set_value(stk->enable_gpio, 1); gpiod_set_value(stk->enable_gpio, 1);
stk->prepared = false;
return 0; return 0;
} }
...@@ -164,9 +158,6 @@ static int stk_panel_prepare(struct drm_panel *panel) ...@@ -164,9 +158,6 @@ static int stk_panel_prepare(struct drm_panel *panel)
struct device *dev = &stk->dsi->dev; struct device *dev = &stk->dsi->dev;
int ret; int ret;
if (stk->prepared)
return 0;
gpiod_set_value(stk->reset_gpio, 0); gpiod_set_value(stk->reset_gpio, 0);
gpiod_set_value(stk->enable_gpio, 0); gpiod_set_value(stk->enable_gpio, 0);
ret = regulator_enable(stk->supplies[IOVCC].consumer); ret = regulator_enable(stk->supplies[IOVCC].consumer);
...@@ -195,8 +186,6 @@ static int stk_panel_prepare(struct drm_panel *panel) ...@@ -195,8 +186,6 @@ static int stk_panel_prepare(struct drm_panel *panel)
goto poweroff; goto poweroff;
} }
stk->prepared = true;
return 0; return 0;
poweroff: poweroff:
......
...@@ -64,8 +64,6 @@ struct truly_nt35597 { ...@@ -64,8 +64,6 @@ struct truly_nt35597 {
struct mipi_dsi_device *dsi[2]; struct mipi_dsi_device *dsi[2];
const struct nt35597_config *config; const struct nt35597_config *config;
bool prepared;
bool enabled;
}; };
static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel)
...@@ -313,16 +311,12 @@ static int truly_nt35597_disable(struct drm_panel *panel) ...@@ -313,16 +311,12 @@ static int truly_nt35597_disable(struct drm_panel *panel)
struct truly_nt35597 *ctx = panel_to_ctx(panel); struct truly_nt35597 *ctx = panel_to_ctx(panel);
int ret; int ret;
if (!ctx->enabled)
return 0;
if (ctx->backlight) { if (ctx->backlight) {
ret = backlight_disable(ctx->backlight); ret = backlight_disable(ctx->backlight);
if (ret < 0) if (ret < 0)
dev_err(ctx->dev, "backlight disable failed %d\n", ret); dev_err(ctx->dev, "backlight disable failed %d\n", ret);
} }
ctx->enabled = false;
return 0; return 0;
} }
...@@ -331,9 +325,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel) ...@@ -331,9 +325,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel)
struct truly_nt35597 *ctx = panel_to_ctx(panel); struct truly_nt35597 *ctx = panel_to_ctx(panel);
int ret = 0; int ret = 0;
if (!ctx->prepared)
return 0;
ctx->dsi[0]->mode_flags = 0; ctx->dsi[0]->mode_flags = 0;
ctx->dsi[1]->mode_flags = 0; ctx->dsi[1]->mode_flags = 0;
...@@ -354,7 +345,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel) ...@@ -354,7 +345,6 @@ static int truly_nt35597_unprepare(struct drm_panel *panel)
if (ret < 0) if (ret < 0)
dev_err(ctx->dev, "power_off failed ret = %d\n", ret); dev_err(ctx->dev, "power_off failed ret = %d\n", ret);
ctx->prepared = false;
return ret; return ret;
} }
...@@ -367,9 +357,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel) ...@@ -367,9 +357,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel)
const struct nt35597_config *config; const struct nt35597_config *config;
u32 num_cmds; u32 num_cmds;
if (ctx->prepared)
return 0;
ret = truly_35597_power_on(ctx); ret = truly_35597_power_on(ctx);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -409,8 +396,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel) ...@@ -409,8 +396,6 @@ static int truly_nt35597_prepare(struct drm_panel *panel)
/* Per DSI spec wait 120ms after sending set_display_on DCS command */ /* Per DSI spec wait 120ms after sending set_display_on DCS command */
msleep(120); msleep(120);
ctx->prepared = true;
return 0; return 0;
power_off: power_off:
...@@ -424,17 +409,12 @@ static int truly_nt35597_enable(struct drm_panel *panel) ...@@ -424,17 +409,12 @@ static int truly_nt35597_enable(struct drm_panel *panel)
struct truly_nt35597 *ctx = panel_to_ctx(panel); struct truly_nt35597 *ctx = panel_to_ctx(panel);
int ret; int ret;
if (ctx->enabled)
return 0;
if (ctx->backlight) { if (ctx->backlight) {
ret = backlight_enable(ctx->backlight); ret = backlight_enable(ctx->backlight);
if (ret < 0) if (ret < 0)
dev_err(ctx->dev, "backlight enable failed %d\n", ret); dev_err(ctx->dev, "backlight enable failed %d\n", ret);
} }
ctx->enabled = true;
return 0; return 0;
} }
......
...@@ -22,7 +22,6 @@ struct visionox_r66451 { ...@@ -22,7 +22,6 @@ struct visionox_r66451 {
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
bool prepared, enabled;
}; };
static inline struct visionox_r66451 *to_visionox_r66451(struct drm_panel *panel) static inline struct visionox_r66451 *to_visionox_r66451(struct drm_panel *panel)
...@@ -124,9 +123,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel) ...@@ -124,9 +123,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel)
struct device *dev = &dsi->dev; struct device *dev = &dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies),
ctx->supplies); ctx->supplies);
if (ret < 0) if (ret < 0)
...@@ -144,7 +140,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel) ...@@ -144,7 +140,6 @@ static int visionox_r66451_prepare(struct drm_panel *panel)
mipi_dsi_compression_mode(ctx->dsi, true); mipi_dsi_compression_mode(ctx->dsi, true);
ctx->prepared = true;
return 0; return 0;
} }
...@@ -154,9 +149,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel) ...@@ -154,9 +149,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = visionox_r66451_off(ctx); ret = visionox_r66451_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -164,7 +156,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel) ...@@ -164,7 +156,6 @@ static int visionox_r66451_unprepare(struct drm_panel *panel)
gpiod_set_value_cansleep(ctx->reset_gpio, 1); gpiod_set_value_cansleep(ctx->reset_gpio, 1);
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
...@@ -190,9 +181,6 @@ static int visionox_r66451_enable(struct drm_panel *panel) ...@@ -190,9 +181,6 @@ static int visionox_r66451_enable(struct drm_panel *panel)
struct drm_dsc_picture_parameter_set pps; struct drm_dsc_picture_parameter_set pps;
int ret; int ret;
if (ctx->enabled)
return 0;
if (!dsi->dsc) { if (!dsi->dsc) {
dev_err(&dsi->dev, "DSC not attached to DSI\n"); dev_err(&dsi->dev, "DSC not attached to DSI\n");
return -ENODEV; return -ENODEV;
...@@ -219,8 +207,6 @@ static int visionox_r66451_enable(struct drm_panel *panel) ...@@ -219,8 +207,6 @@ static int visionox_r66451_enable(struct drm_panel *panel)
} }
msleep(20); msleep(20);
ctx->enabled = true;
return 0; return 0;
} }
...@@ -231,8 +217,6 @@ static int visionox_r66451_disable(struct drm_panel *panel) ...@@ -231,8 +217,6 @@ static int visionox_r66451_disable(struct drm_panel *panel)
struct device *dev = &dsi->dev; struct device *dev = &dsi->dev;
int ret; int ret;
ctx->enabled = false;
ret = mipi_dsi_dcs_set_display_off(dsi); ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to set display off: %d\n", ret); dev_err(dev, "Failed to set display off: %d\n", ret);
......
...@@ -20,8 +20,6 @@ struct visionox_rm69299 { ...@@ -20,8 +20,6 @@ struct visionox_rm69299 {
struct regulator_bulk_data supplies[2]; struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
bool prepared;
bool enabled;
}; };
static inline struct visionox_rm69299 *panel_to_ctx(struct drm_panel *panel) static inline struct visionox_rm69299 *panel_to_ctx(struct drm_panel *panel)
...@@ -80,7 +78,6 @@ static int visionox_rm69299_unprepare(struct drm_panel *panel) ...@@ -80,7 +78,6 @@ static int visionox_rm69299_unprepare(struct drm_panel *panel)
ret = visionox_rm69299_power_off(ctx); ret = visionox_rm69299_power_off(ctx);
ctx->prepared = false;
return ret; return ret;
} }
...@@ -89,9 +86,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel) ...@@ -89,9 +86,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel)
struct visionox_rm69299 *ctx = panel_to_ctx(panel); struct visionox_rm69299 *ctx = panel_to_ctx(panel);
int ret; int ret;
if (ctx->prepared)
return 0;
ret = visionox_rm69299_power_on(ctx); ret = visionox_rm69299_power_on(ctx);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -140,8 +134,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel) ...@@ -140,8 +134,6 @@ static int visionox_rm69299_prepare(struct drm_panel *panel)
/* Per DSI spec wait 120ms after sending set_display_on DCS command */ /* Per DSI spec wait 120ms after sending set_display_on DCS command */
msleep(120); msleep(120);
ctx->prepared = true;
return 0; return 0;
power_off: power_off:
......
...@@ -20,7 +20,6 @@ struct visionox_vtdr6130 { ...@@ -20,7 +20,6 @@ struct visionox_vtdr6130 {
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[3]; struct regulator_bulk_data supplies[3];
bool prepared;
}; };
static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel) static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel)
...@@ -157,9 +156,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel) ...@@ -157,9 +156,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (ctx->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies),
ctx->supplies); ctx->supplies);
if (ret < 0) if (ret < 0)
...@@ -175,7 +171,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel) ...@@ -175,7 +171,6 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)
return ret; return ret;
} }
ctx->prepared = true;
return 0; return 0;
} }
...@@ -185,9 +180,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel) ...@@ -185,9 +180,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)
struct device *dev = &ctx->dsi->dev; struct device *dev = &ctx->dsi->dev;
int ret; int ret;
if (!ctx->prepared)
return 0;
ret = visionox_vtdr6130_off(ctx); ret = visionox_vtdr6130_off(ctx);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to un-initialize panel: %d\n", ret); dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
...@@ -196,7 +188,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel) ...@@ -196,7 +188,6 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
ctx->prepared = false;
return 0; return 0;
} }
......
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