Commit f8c37b88 authored by Douglas Anderson's avatar Douglas Anderson
Browse files

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
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -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)
@@ -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);
@@ -132,7 +128,6 @@ static int tm5p5_nt35596_prepare(struct drm_panel *panel)
		return ret;
	}

	ctx->prepared = true;
	return 0;
}

@@ -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);
@@ -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;
}

+0 −9
Original line number Diff line number Diff line
@@ -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
@@ -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
@@ -166,7 +162,6 @@ static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel)
		return ret;
	}

	boe->prepared = true;
	return 0;

err_vci:
@@ -186,9 +181,6 @@ 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);
@@ -196,7 +188,6 @@ static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel)
	gpiod_set_value_cansleep(boe->reset_gpio, 1);
	ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs);

	boe->prepared = false;
	return 0;
}

+0 −9
Original line number Diff line number Diff line
@@ -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)
@@ -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);
@@ -169,7 +165,6 @@ static int jdi_fhd_r63452_prepare(struct drm_panel *panel)
		return ret;
	}

	ctx->prepared = true;
	return 0;
}

@@ -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;
}

+0 −9
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ struct nt35950 {

	int cur_mode;
	u8 last_page;
	bool prepared;
};

struct nt35950_panel_mode {
@@ -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;
@@ -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) {
@@ -477,9 +472,6 @@ 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);
@@ -487,7 +479,6 @@ static int nt35950_unprepare(struct drm_panel *panel)
	gpiod_set_value_cansleep(nt->reset_gpio, 0);
	regulator_bulk_disable(ARRAY_SIZE(nt->vregs), nt->vregs);

	nt->prepared = false;
	return 0;
}

+0 −12
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ struct panel_info {
	struct gpio_desc *reset_gpio;
	struct backlight_device *backlight;
	struct regulator *vddio;

	bool prepared;
};

struct panel_desc {
@@ -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);
@@ -1064,8 +1059,6 @@ static int nt36523_prepare(struct drm_panel *panel)
		return ret;
	}

	pinfo->prepared = true;

	return 0;
}

@@ -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;
}

Loading