[DCON] Switch panel off cleanly to sleep mode on reboot.
David Woodhouse
dwmw2 at infradead.org
Sat Nov 4 11:43:01 EST 2006
Commit: 9d2bae412006aaf955e1a9056662fbbc47fc177a
Parent: 38a240ed6679c756244147104f019587a676a3b6
commit 9d2bae412006aaf955e1a9056662fbbc47fc177a
Author: David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Sun Nov 5 00:42:49 2006 +0800
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sun Nov 5 00:42:49 2006 +0800
[DCON] Switch panel off cleanly to sleep mode on reboot.
Without this, we shut down extremely uncleanly and appear to put DC on
the panel. This is a bad thing.
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
drivers/video/geode/gxfb_dcon.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/drivers/video/geode/gxfb_dcon.c b/drivers/video/geode/gxfb_dcon.c
index c7e7425..b269a88 100644
--- a/drivers/video/geode/gxfb_dcon.c
+++ b/drivers/video/geode/gxfb_dcon.c
@@ -23,6 +23,7 @@ #include <linux/delay.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#include <linux/reboot.h>
#include <asm/tsc.h>
#include "gxfb_dcon.h"
@@ -89,6 +90,7 @@ I2C_CLIENT_INSMOD;
#define dcon_write(reg,val) i2c_smbus_write_word_data(dcon_client,reg,val)
#define dcon_read(reg) i2c_smbus_read_word_data(dcon_client,reg)
+
/* ===== API functions - these are called by a variety of users ==== */
/* The current backlight value - this saves us some smbus traffic */
@@ -599,10 +601,24 @@ #endif
dcon_switched = 1;
wake_up(&dcon_wait_queue);
}
-
return IRQ_HANDLED;
}
+int dcon_reboot_notify(struct notifier_block *nb, unsigned long foo, void *bar)
+{
+ if (dcon_client == NULL)
+ return 0;
+
+ /* Turn off the DCON. Entirely. */
+ dcon_write(DCON_REG_MODE, 0x12);
+ return 0;
+}
+
+struct notifier_block dcon_nb = {
+ .notifier_call = dcon_reboot_notify,
+ .priority = -1,
+};
+
/* List of GPIOs that we care about:
(in) GPIO12 -- DCONBLNK
(in) GPIO[56] -- DCONSTAT[01]
@@ -708,11 +724,13 @@ int __init gxfb_dcon_init(void)
/* Attach the I2C driver */
i2c_add_driver(&dcon_driver);
+ register_reboot_notifier(&dcon_nb);
return 0;
}
void __exit gxfb_dcon_exit(void)
{
+ unregister_reboot_notifier(&dcon_nb);
free_irq(DCON_IRQ, &dcon_driver);
i2c_del_driver(&dcon_driver);
}
More information about the Commits-kernel
mailing list