summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-09-06 18:35:17 -0600
committerMartin-Éric Racine <q-funk@iki.fi>2010-10-27 10:25:32 +0300
commit9caaf7f8294ef9700e9e20e394fee10cc2b1c9c0 (patch)
tree876fafd142e6c46cd5cb20a4f9e14a3bbcb606b2
parent87512b72d64370e062d209724994a72368c21df6 (diff)
Don't power down DCON when it is frozen
Putting a frozen DCON to sleep (as happens during regular boot of the XO) will cause the frozen image to be corrupted. Change the behaviour to only sleep when the DCON is not frozen. http://dev.laptop.org/ticket/10196
-rw-r--r--src/geode_dcon.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/geode_dcon.c b/src/geode_dcon.c
index 9982671..56f05ed 100644
--- a/src/geode_dcon.c
+++ b/src/geode_dcon.c
@@ -37,6 +37,7 @@
#include <fcntl.h>
#define DCON_SLEEP_FILE "/sys/devices/platform/dcon/sleep"
+#define DCON_FREEZE_FILE "/sys/devices/platform/dcon/freeze"
static Bool
dcon_present(void)
@@ -53,6 +54,7 @@ int
DCONDPMSSet(ScrnInfoPtr pScrni, int mode)
{
static int failed = -1;
+ ssize_t ret;
int fd;
char value[1];
@@ -62,6 +64,25 @@ DCONDPMSSet(ScrnInfoPtr pScrni, int mode)
if (failed)
return 0;
+ /* If the DCON is frozen, don't power it down, it was probably frozen
+ * for a reason and powering it down would corrupt the display.
+ * This is needed to avoid losing OLPC's frozen boot image during X
+ * startup, where DPMS is used to power down and up the display.
+ * When geode uses KMS this will not be needed as the system realises
+ * that no mode change is needed and the display power is untouched. */
+ fd = open(DCON_FREEZE_FILE, O_RDONLY);
+ if (fd < 0) {
+ failed = 1;
+ return 0;
+ }
+
+ ret = read(fd, value, 1);
+ close(fd);
+ if (ret == 1) {
+ if (value[0] == '1')
+ return 0;
+ }
+
fd = open(DCON_SLEEP_FILE, O_WRONLY);
if (fd < 0) {