]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/staging/olpc_dcon/olpc_dcon.c
Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle...
[linux-beck.git] / drivers / staging / olpc_dcon / olpc_dcon.c
index 688cf0f6952465b0185a8e9b154068fc7dc1f36b..4ca45ec7fd84ef088e3258450e135fb7ccaacc72 100644 (file)
@@ -17,9 +17,7 @@
 #include <linux/console.h>
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
-#include <linux/i2c-id.h>
 #include <linux/pci.h>
-#include <linux/vt_kern.h>
 #include <linux/pci_ids.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
@@ -201,7 +199,7 @@ power_up:
        if (x < 0) {
                printk(KERN_ERR "olpc-dcon:  unable to stabilize dcon's "
                                "smbus, reasserting power and praying.\n");
-               BUG_ON(olpc_board_at_least(olpc_board(BOARD_XO_1_C2)));
+               BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
                x = 0;
                olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0);
                msleep(100);
@@ -214,12 +212,6 @@ power_up:
        return 0;
 }
 
-
-/* Backlight notes - turning off the backlight enable bit in the DCON
- * doesn't save us any power over just pushing the BL to zero, so we
- * don't use that bit in this code.
- */
-
 static int dcon_get_backlight(void)
 {
        if (dcon_client == NULL)
@@ -295,7 +287,7 @@ static void dcon_sleep(int state)
        if (state == dcon_sleep_val)
                return;
 
-       if (!olpc_board_at_least(olpc_board(BOARD_XO_1_C2)))
+       if (!olpc_board_at_least(olpc_board(0xc2)))
                return;
 
        if (state == DCON_SLEEP) {
@@ -640,25 +632,11 @@ static int dcon_reboot_notify(struct notifier_block *nb, unsigned long foo, void
        return 0;
 }
 
-static int dcon_conswitch_notify(struct notifier_block *nb,
-                                unsigned long mode, void *dummy)
-{
-       if (mode == CONSOLE_EVENT_SWITCH_TEXT)
-               dcon_sleep(DCON_ACTIVE);
-
-       return 0;
-}
-
 static struct notifier_block dcon_nb = {
        .notifier_call = dcon_reboot_notify,
        .priority = -1,
 };
 
-static struct notifier_block dcon_console_nb = {
-       .notifier_call = dcon_conswitch_notify,
-       .priority = -1,
-};
-
 static int unfreeze_on_panic(struct notifier_block *nb, unsigned long e, void *p)
 {
        pdata->set_dconload(1);
@@ -669,13 +647,16 @@ static struct notifier_block dcon_panic_nb = {
        .notifier_call = unfreeze_on_panic,
 };
 
-/* when framebuffer sleeps due to external source (e.g. user idle), power down
- * the DCON. also power up when the framebuffer comes back to life. */
+/*
+ * When the framebuffer sleeps due to external sources (e.g. user idle), power
+ * down the DCON as well.  Power it back up when the fb comes back to life.
+ */
 static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data)
 {
        struct fb_event *evdata = data;
        int *blank = (int *) evdata->data;
-       if (event != FB_EVENT_BLANK || ignore_fb_events)
+       if (((event != FB_EVENT_BLANK) && (event != FB_EVENT_CONBLANK)) ||
+                       ignore_fb_events)
                return 0;
        dcon_sleep((*blank) ? DCON_SLEEP : DCON_ACTIVE);
        return 0;
@@ -743,7 +724,6 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
        }
 
        register_reboot_notifier(&dcon_nb);
-       console_event_register(&dcon_console_nb);
        atomic_notifier_chain_register(&panic_notifier_list, &dcon_panic_nb);
        fb_register_client(&fb_nb);
 
@@ -752,7 +732,6 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
  edev:
        platform_device_unregister(dcon_device);
        dcon_device = NULL;
-       i2c_set_clientdata(client, NULL);
  eirq:
        free_irq(DCON_IRQ, &dcon_driver);
  einit:
@@ -765,7 +744,6 @@ static int dcon_remove(struct i2c_client *client)
 
        fb_unregister_client(&fb_nb);
        unregister_reboot_notifier(&dcon_nb);
-       console_event_unregister(&dcon_console_nb);
        atomic_notifier_chain_unregister(&panic_notifier_list, &dcon_panic_nb);
 
        free_irq(DCON_IRQ, &dcon_driver);
@@ -777,8 +755,6 @@ static int dcon_remove(struct i2c_client *client)
                platform_device_unregister(dcon_device);
        cancel_work_sync(&dcon_work);
 
-       i2c_set_clientdata(client, NULL);
-
        return 0;
 }
 
@@ -869,21 +845,11 @@ static struct i2c_driver dcon_driver = {
 #endif
 };
 
-#if defined(CONFIG_OLPC_XO_1)
 #include "olpc_dcon_xo_1.c"
-#elif defined(CONFIG_OLPC_XO_1_5)
-#include "olpc_dcon_xo_1_5.c"
-#else
-#error "Trying to build OLPC DCON driver but kernel not configured for XO"
-#endif
 
 static int __init olpc_dcon_init(void)
 {
-#ifdef CONFIG_OLPC_XO_1
        pdata = &dcon_pdata_xo_1;
-#else
-       pdata = &dcon_pdata_xo_1_5;
-#endif
 
        i2c_add_driver(&dcon_driver);
        return 0;