Commit 5a847750 authored by Douglas Anderson's avatar Douglas Anderson
Browse files

drm/panel: samsung-atna33xc20: 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.

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>
Link: https://patchwork.freedesktop.org/patch/msgid/20240503143327.RFT.v2.24.Ibb4f923363a27167c480a432e52884b117221974@changeid
parent 2a9487b5
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@

struct atana33xc20_panel {
	struct drm_panel base;
	bool prepared;
	bool enabled;
	bool el3_was_on;

	bool no_hpd;
@@ -143,13 +141,8 @@ static int atana33xc20_disable(struct drm_panel *panel)
{
	struct atana33xc20_panel *p = to_atana33xc20(panel);

	/* Disabling when already disabled is a no-op */
	if (!p->enabled)
		return 0;

	gpiod_set_value_cansleep(p->el_on3_gpio, 0);
	p->el_on3_off_time = ktime_get_boottime();
	p->enabled = false;

	/*
	 * Keep track of the fact that EL_ON3 was on but we haven't power
@@ -173,10 +166,6 @@ static int atana33xc20_enable(struct drm_panel *panel)
{
	struct atana33xc20_panel *p = to_atana33xc20(panel);

	/* Enabling when already enabled is a no-op */
	if (p->enabled)
		return 0;

	/*
	 * Once EL_ON3 drops we absolutely need a power cycle before the next
	 * enable or the backlight will never come on again. The code ensures
@@ -195,20 +184,14 @@ static int atana33xc20_enable(struct drm_panel *panel)
	atana33xc20_wait(p->powered_on_time, 400);

	gpiod_set_value_cansleep(p->el_on3_gpio, 1);
	p->enabled = true;

	return 0;
}

static int atana33xc20_unprepare(struct drm_panel *panel)
{
	struct atana33xc20_panel *p = to_atana33xc20(panel);
	int ret;

	/* Unpreparing when already unprepared is a no-op */
	if (!p->prepared)
		return 0;

	/*
	 * Purposely do a put_sync, don't use autosuspend. The panel's tcon
	 * seems to sometimes crash when you stop giving it data and this is
@@ -220,26 +203,19 @@ static int atana33xc20_unprepare(struct drm_panel *panel)
	ret = pm_runtime_put_sync_suspend(panel->dev);
	if (ret < 0)
		return ret;
	p->prepared = false;

	return 0;
}

static int atana33xc20_prepare(struct drm_panel *panel)
{
	struct atana33xc20_panel *p = to_atana33xc20(panel);
	int ret;

	/* Preparing when already prepared is a no-op */
	if (p->prepared)
		return 0;

	ret = pm_runtime_get_sync(panel->dev);
	if (ret < 0) {
		pm_runtime_put_autosuspend(panel->dev);
		return ret;
	}
	p->prepared = true;

	return 0;
}