]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/video/backlight/corgi_bl.c
Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel
[karo-tx-linux.git] / drivers / video / backlight / corgi_bl.c
index a32817678552f61de175cd18302343be45a725a1..6a219b2c77e3d10a18200c5e0c2bca0791a5235a 100644 (file)
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/fb.h>
 #include <linux/backlight.h>
 
-#include <asm/arch-pxa/corgi.h>
-#include <asm/hardware/scoop.h>
+#include <asm/arch/sharpsl.h>
 
-#define CORGI_MAX_INTENSITY            0x3e
 #define CORGI_DEFAULT_INTENSITY                0x1f
-#define CORGI_LIMIT_MASK                       0x0b
+#define CORGI_LIMIT_MASK               0x0b
 
 static int corgibl_powermode = FB_BLANK_UNBLANK;
 static int current_intensity = 0;
 static int corgibl_limit = 0;
+static void (*corgibl_mach_set_intensity)(int intensity);
 static spinlock_t bl_lock = SPIN_LOCK_UNLOCKED;
+static struct backlight_properties corgibl_data;
 
 static void corgibl_send_intensity(int intensity)
 {
@@ -48,6 +48,12 @@ static void corgibl_send_intensity(int intensity)
        corgibl_mach_set_intensity(intensity);
 
        spin_unlock_irqrestore(&bl_lock, flags);
+
+       corgi_kick_batt = symbol_get(sharpsl_battery_kick);
+       if (corgi_kick_batt) {
+               corgi_kick_batt();
+               symbol_put(sharpsl_battery_kick);
+       }
 }
 
 static void corgibl_blank(int blank)
@@ -73,17 +79,15 @@ static void corgibl_blank(int blank)
 }
 
 #ifdef CONFIG_PM
-static int corgibl_suspend(struct device *dev, pm_message_t state, u32 level)
+static int corgibl_suspend(struct platform_device *dev, pm_message_t state)
 {
-       if (level == SUSPEND_POWER_DOWN)
-               corgibl_blank(FB_BLANK_POWERDOWN);
+       corgibl_blank(FB_BLANK_POWERDOWN);
        return 0;
 }
 
-static int corgibl_resume(struct device *dev, u32 level)
+static int corgibl_resume(struct platform_device *dev)
 {
-       if (level == RESUME_POWER_ON)
-               corgibl_blank(FB_BLANK_UNBLANK);
+       corgibl_blank(FB_BLANK_UNBLANK);
        return 0;
 }
 #else
@@ -139,9 +143,9 @@ static struct backlight_properties corgibl_data = {
 
 static struct backlight_device *corgi_backlight_device;
 
-static int __init corgibl_probe(struct device *dev)
+static int __init corgibl_probe(struct platform_device *pdev)
 {
-       struct corgibl_machinfo *machinfo = dev->platform_data;
+       struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
 
        corgibl_data.max_brightness = machinfo->max_intensity;
        corgibl_mach_set_intensity = machinfo->set_bl_intensity;
@@ -158,7 +162,7 @@ static int __init corgibl_probe(struct device *dev)
        return 0;
 }
 
-static int corgibl_remove(struct device *dev)
+static int corgibl_remove(struct platform_device *dev)
 {
        backlight_device_unregister(corgi_backlight_device);
 
@@ -168,23 +172,24 @@ static int corgibl_remove(struct device *dev)
        return 0;
 }
 
-static struct device_driver corgibl_driver = {
-       .name           = "corgi-bl",
-       .bus            = &platform_bus_type,
+static struct platform_driver corgibl_driver = {
        .probe          = corgibl_probe,
        .remove         = corgibl_remove,
        .suspend        = corgibl_suspend,
        .resume         = corgibl_resume,
+       .driver         = {
+               .name   = "corgi-bl",
+       },
 };
 
 static int __init corgibl_init(void)
 {
-       return driver_register(&corgibl_driver);
+       return platform_driver_register(&corgibl_driver);
 }
 
 static void __exit corgibl_exit(void)
 {
-       driver_unregister(&corgibl_driver);
+       platform_driver_unregister(&corgibl_driver);
 }
 
 module_init(corgibl_init);