summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/panel
diff options
context:
space:
mode:
authorAjay Kumar <ajaykumar.rs@samsung.com>2014-07-31 23:12:10 +0530
committerThierry Reding <treding@nvidia.com>2014-08-06 16:44:14 +0200
commit613a633e7a567593efc03dc2357b6d25cd365c10 (patch)
tree09d536ed509b78e1a4bc152ccafbbeb0bf8fba99 /drivers/gpu/drm/panel
parent1a670e7b8c4227bcff5119802ef04bbf5916cabb (diff)
downloadtalos-obmc-linux-613a633e7a567593efc03dc2357b6d25cd365c10.tar.gz
talos-obmc-linux-613a633e7a567593efc03dc2357b6d25cd365c10.zip
drm/panel: simple: Add proper definition for prepare and unprepare
Move out code from enable and disable routines to prepare and unprepare routines, so that functionality is properly distributed across all the panel functions. Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/panel')
-rw-r--r--drivers/gpu/drm/panel/panel-simple.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4bf33c6b42f0..806beae77938 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -47,6 +47,7 @@ struct panel_desc {
struct panel_simple {
struct drm_panel base;
+ bool prepared;
bool enabled;
const struct panel_desc *desc;
@@ -108,10 +109,6 @@ static int panel_simple_disable(struct drm_panel *panel)
backlight_update_status(p->backlight);
}
- if (p->enable_gpio)
- gpiod_set_value_cansleep(p->enable_gpio, 0);
-
- regulator_disable(p->supply);
p->enabled = false;
return 0;
@@ -119,20 +116,27 @@ static int panel_simple_disable(struct drm_panel *panel)
static int panel_simple_unprepare(struct drm_panel *panel)
{
- return 0;
-}
+ struct panel_simple *p = to_panel_simple(panel);
+
+ if (!p->prepared)
+ return 0;
+
+ if (p->enable_gpio)
+ gpiod_set_value_cansleep(p->enable_gpio, 0);
+
+ regulator_disable(p->supply);
+
+ p->prepared = false;
-static int panel_simple_prepare(struct drm_panel *panel)
-{
return 0;
}
-static int panel_simple_enable(struct drm_panel *panel)
+static int panel_simple_prepare(struct drm_panel *panel)
{
struct panel_simple *p = to_panel_simple(panel);
int err;
- if (p->enabled)
+ if (p->prepared)
return 0;
err = regulator_enable(p->supply);
@@ -144,6 +148,18 @@ static int panel_simple_enable(struct drm_panel *panel)
if (p->enable_gpio)
gpiod_set_value_cansleep(p->enable_gpio, 1);
+ p->prepared = true;
+
+ return 0;
+}
+
+static int panel_simple_enable(struct drm_panel *panel)
+{
+ struct panel_simple *p = to_panel_simple(panel);
+
+ if (p->enabled)
+ return 0;
+
if (p->backlight) {
p->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(p->backlight);
@@ -194,6 +210,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
return -ENOMEM;
panel->enabled = false;
+ panel->prepared = false;
panel->desc = desc;
panel->supply = devm_regulator_get(dev, "power");
OpenPOWER on IntegriCloud