aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/display-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/dss/display-sysfs.c')
-rw-r--r--drivers/video/omap2/dss/display-sysfs.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/omap2/dss/display-sysfs.c
index 18211a9ab354..81d5dc6e509f 100644
--- a/drivers/video/omap2/dss/display-sysfs.c
+++ b/drivers/video/omap2/dss/display-sysfs.c
@@ -33,9 +33,9 @@ static ssize_t display_enabled_show(struct device *dev,
33 struct device_attribute *attr, char *buf) 33 struct device_attribute *attr, char *buf)
34{ 34{
35 struct omap_dss_device *dssdev = to_dss_device(dev); 35 struct omap_dss_device *dssdev = to_dss_device(dev);
36 bool enabled = dssdev->state != OMAP_DSS_DISPLAY_DISABLED;
37 36
38 return snprintf(buf, PAGE_SIZE, "%d\n", enabled); 37 return snprintf(buf, PAGE_SIZE, "%d\n",
38 omapdss_device_is_enabled(dssdev));
39} 39}
40 40
41static ssize_t display_enabled_store(struct device *dev, 41static ssize_t display_enabled_store(struct device *dev,
@@ -44,20 +44,24 @@ static ssize_t display_enabled_store(struct device *dev,
44{ 44{
45 struct omap_dss_device *dssdev = to_dss_device(dev); 45 struct omap_dss_device *dssdev = to_dss_device(dev);
46 int r; 46 int r;
47 bool enabled; 47 bool enable;
48 48
49 r = strtobool(buf, &enabled); 49 r = strtobool(buf, &enable);
50 if (r) 50 if (r)
51 return r; 51 return r;
52 52
53 if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { 53 if (enable == omapdss_device_is_enabled(dssdev))
54 if (enabled) { 54 return size;
55 r = dssdev->driver->enable(dssdev); 55
56 if (r) 56 if (omapdss_device_is_connected(dssdev) == false)
57 return r; 57 return -ENODEV;
58 } else { 58
59 dssdev->driver->disable(dssdev); 59 if (enable) {
60 } 60 r = dssdev->driver->enable(dssdev);
61 if (r)
62 return r;
63 } else {
64 dssdev->driver->disable(dssdev);
61 } 65 }
62 66
63 return size; 67 return size;