[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191106064005.8016-1-jitao.shi@mediatek.com>
Date: Wed, 6 Nov 2019 14:40:05 +0800
From: Jitao Shi <jitao.shi@...iatek.com>
To: Thierry Reding <thierry.reding@...il.com>,
Sam Ravnborg <sam@...nborg.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
CK Hu <ck.hu@...iatek.com>
CC: <linux-mediatek@...ts.infradead.org>, <sj.huang@...iatek.com>,
Jitao Shi <jitao.shi@...iatek.com>
Subject: [PATCH] drm/panel: seperate panel power control from panel prepare/unprepare
Some dsi panels require the dsi lanes keeping low before panel power
on. So seperate the panel power control and the communication with panel.
And put the power control in drm_panel_prepare_power and
drm_panel_unprepare_power. Put the communication with panel in
drm_panel_prepare and drm_panel_unprepare.
Signed-off-by: Jitao Shi <jitao.shi@...iatek.com>
---
drivers/gpu/drm/drm_panel.c | 38 +++++++++++++++++++++++++++++++++++++
include/drm/drm_panel.h | 17 +++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 6b0bf42039cf..e57f6385d2cc 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -131,6 +131,24 @@ void drm_panel_detach(struct drm_panel *panel)
}
EXPORT_SYMBOL(drm_panel_detach);
+/**
+ * drm_panel_prepare_power - power on a panel's power
+ * @panel: DRM panel
+ *
+ * Calling this function will enable power and deassert any reset signals to
+ * the panel.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int drm_panel_prepare_power(struct drm_panel *panel)
+{
+ if (panel && panel->funcs && panel->funcs->prepare_power)
+ return panel->funcs->prepare_power(panel);
+
+ return panel ? -ENOSYS : -EINVAL;
+}
+EXPORT_SYMBOL(drm_panel_prepare_power);
+
/**
* drm_panel_prepare - power on a panel
* @panel: DRM panel
@@ -170,6 +188,26 @@ int drm_panel_unprepare(struct drm_panel *panel)
}
EXPORT_SYMBOL(drm_panel_unprepare);
+/**
+ * drm_panel_unprepare_power - power off a panel
+ * @panel: DRM panel
+ *
+ * Calling this function will completely power off a panel (assert the panel's
+ * reset, turn off power supplies, ...). After this function has completed, it
+ * is usually no longer possible to communicate with the panel until another
+ * call to drm_panel_prepare_power and drm_panel_prepare().
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int drm_panel_unprepare_power(struct drm_panel *panel)
+{
+ if (panel && panel->funcs && panel->funcs->unprepare_power)
+ return panel->funcs->unprepare_power(panel);
+
+ return panel ? -ENOSYS : -EINVAL;
+}
+EXPORT_SYMBOL(drm_panel_unprepare_power);
+
/**
* drm_panel_enable - enable a panel
* @panel: DRM panel
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 624bd15ecfab..0d8c4855405c 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -61,6 +61,13 @@ struct display_timing;
* the panel. This is the job of the .unprepare() function.
*/
struct drm_panel_funcs {
+ /**
+ * @prepare_power:
+ *
+ * Turn on panel power.
+ */
+ int (*prepare_power)(struct drm_panel *panel);
+
/**
* @prepare:
*
@@ -89,6 +96,13 @@ struct drm_panel_funcs {
*/
int (*unprepare)(struct drm_panel *panel);
+ /**
+ * @unprepare_power:
+ *
+ * Turn off panel_power.
+ */
+ int (*unprepare_power)(struct drm_panel *panel);
+
/**
* @get_modes:
*
@@ -155,6 +169,9 @@ void drm_panel_remove(struct drm_panel *panel);
int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
void drm_panel_detach(struct drm_panel *panel);
+int drm_panel_prepare_power(struct drm_panel *panel);
+int drm_panel_unprepare_power(struct drm_panel *panel);
+
int drm_panel_prepare(struct drm_panel *panel);
int drm_panel_unprepare(struct drm_panel *panel);
--
2.21.0
Powered by blists - more mailing lists