Commit 2469cb5c authored by Douglas Anderson's avatar Douglas Anderson Committed by Neil Armstrong
Browse files

drm/panel: khadas-ts050: Stop tracking 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.

Cc: Jacobe Zang <jacobe.zang@wesion.com>
Cc: Nicolas Belin <nbelin@baylibre.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240604172305.v3.3.Ibed1026f20cab08c90fa376e68c2f23a343e826b@changeid


Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240604172305.v3.3.Ibed1026f20cab08c90fa376e68c2f23a343e826b@changeid
parent 2ccc698c
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -26,9 +26,6 @@ struct khadas_ts050_panel {
	struct gpio_desc *reset_gpio;
	struct gpio_desc *enable_gpio;
	struct khadas_ts050_panel_data *panel_data;

	bool prepared;
	bool enabled;
};

struct khadas_ts050_panel_cmd {
@@ -642,9 +639,6 @@ static int khadas_ts050_panel_prepare(struct drm_panel *panel)
	unsigned int i;
	int err;

	if (khadas_ts050->prepared)
		return 0;

	gpiod_set_value_cansleep(khadas_ts050->enable_gpio, 0);

	err = regulator_enable(khadas_ts050->supply);
@@ -708,8 +702,6 @@ static int khadas_ts050_panel_prepare(struct drm_panel *panel)

	usleep_range(10000, 11000);

	khadas_ts050->prepared = true;

	return 0;

poweroff:
@@ -726,11 +718,6 @@ static int khadas_ts050_panel_unprepare(struct drm_panel *panel)
	struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel);
	int err;

	if (!khadas_ts050->prepared)
		return 0;

	khadas_ts050->prepared = false;

	err = mipi_dsi_dcs_enter_sleep_mode(khadas_ts050->link);
	if (err < 0)
		dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
@@ -747,31 +734,17 @@ static int khadas_ts050_panel_unprepare(struct drm_panel *panel)
	return 0;
}

static int khadas_ts050_panel_enable(struct drm_panel *panel)
{
	struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel);

	khadas_ts050->enabled = true;

	return 0;
}

static int khadas_ts050_panel_disable(struct drm_panel *panel)
{
	struct khadas_ts050_panel *khadas_ts050 = to_khadas_ts050_panel(panel);
	int err;

	if (!khadas_ts050->enabled)
		return 0;

	err = mipi_dsi_dcs_set_display_off(khadas_ts050->link);
	if (err < 0)
		dev_err(panel->dev, "failed to set display off: %d\n", err);

	usleep_range(10000, 11000);

	khadas_ts050->enabled = false;

	return 0;
}

@@ -815,7 +788,6 @@ static int khadas_ts050_panel_get_modes(struct drm_panel *panel,
static const struct drm_panel_funcs khadas_ts050_panel_funcs = {
	.prepare = khadas_ts050_panel_prepare,
	.unprepare = khadas_ts050_panel_unprepare,
	.enable = khadas_ts050_panel_enable,
	.disable = khadas_ts050_panel_disable,
	.get_modes = khadas_ts050_panel_get_modes,
};