 +
 +	spin_lock_irqsave(&bl_lock, flags);
 +
-+	printk( KERN_DEBUG "backlight last intensity was %d, new intensity is %d", last_intensity, intensity );
++	printk( KERN_DEBUG "backlight last intensity was %d, new intensity is %d\n", last_intensity, intensity );
 +	
 +	if ( !last_intensity && intensity ) {
-+		printk( KERN_DEBUG "backlight power ON" );
-+		/* need to power on backlight */
++		printk( KERN_DEBUG "backlight power ON\n" );
 +		PWM_CTRL0 = 2; /* pre-scaler */
 +		PWM_PWDUTY0 = intensity; /* duty cycle */
 +		PWM_PERVAL0 = 49; /* period */
++		pxa_gpio_mode(GPIO16_PWM0_MD); /* set GPIO16 as alternate function + output */
 +		pxa_set_cken(CKEN0_PWM0, 1); /* clock enable */
-+		GPDR0 |= 0x00010000; /* set GPIO16 as output */
-+		pxa_gpio_mode(GPIO16_PWM0_MD); /* set GPIO16 as output */
 +	}
 +	else if ( last_intensity && !intensity ) {
-+		printk( KERN_DEBUG "backlight power OFF" );
-+		/* need to power off backlight */
++		printk( KERN_DEBUG "backlight power OFF\n" );
 +		PWM_PWDUTY0 = 0;
-+    		GAFR0_U &= 0xFFFFFFFC;
-+    		GPDR0 &= 0xFFFEFFFF; //PWM0 is GPIO16, set PWM0 as input when turn off bklight
++		GAFR0_U &= 0xFFFFFFFC; /* ??? */
 +		pxa_set_cken(CKEN0_PWM0, 0); /* clock disable */
++		pxa_gpio_mode(GPIO16_PWM0); /* set GPIO16 as input */
 +	} else if ( last_intensity && intensity ) {
-+		printk( KERN_DEBUG "backlight adjusting duty cycle" );
-+		/* need to adjust duty cycle */
++		printk( KERN_DEBUG "backlight adjusting duty cycle\n" );
 +		PWM_PWDUTY0 = intensity; /* duty cycle */
 +	}
 +	spin_unlock_irqrestore(&bl_lock, flags);

+	return 0;
+}
+
+static int ezx_get_intensity(struct backlight_device *bd)
+{
+	return last_intensity;
+}
+
+static int ezx_set_intensity(struct backlight_device *bd)
+{
+	return ezx_send_intensity(ezx_backlight_device);
+}
+
+#ifdef CONFIG_PM
+static int ezx_bl_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	//set suspend flag
+	ezx_set_intensity(ezx_backlight_device);
+	return 0;
+}
+
+static int ezx_bl_resume(struct platform_device *pdev)
+{
+	// set resume flag
+	ezx_set_intensity(ezx_backlight_device);
+	return 0;
+}
+#else
+#define ezx_bl_suspend	NULL
+#define ezx_bl_resume	NULL
+#endif
+
+static struct backlight_properties ezx_bl_data = {
+	.owner          = THIS_MODULE,
+	.get_brightness = ezx_get_intensity,
+	.max_brightness = EZX_MAX_INTENSITY,
+	.update_status	= ezx_set_intensity,
+};
+
+static int __init ezx_bl_probe(struct platform_device *pdev)
+{
+	ezx_backlight_device = backlight_device_register ("ezx-bl",
+		NULL, &ezx_bl_data);
+	if (IS_ERR (ezx_backlight_device))
+		return PTR_ERR (ezx_backlight_device);
+
+	//ezx_bl_data.requested_brightness = EZX_DEFAULT_INTENSITY;
+	//ezx_bl_data.requested_power = FB_BLANK_UNBLANK;
+	//ezx_set_intensity(ezx_backlight_device, ezx_bl_data.requested_brightness);
+
+	printk("EZX Backlight Driver Initialized.\n");
+	return 0;
+}
+
+static int ezx_bl_remove(struct platform_device *pdev)
+{
+	backlight_device_unregister(ezx_backlight_device);
+

+	return 0;
+}
+
+static struct platform_driver ezxbl_driver = {
+	.probe		= ezxbl_probe,
+	.remove		= ezxbl_remove,
+	.suspend	= ezxbl_suspend,
+	.resume		= ezxbl_resume,
+	.driver		= {
+		.name		= "ezx-bl",
+	},
+};
+
+static int __init ezxbl_init(void)
+{
+	return platform_driver_register(&ezxbl_driver);
+}
+
+static void __exit ezxbl_exit(void)
+{
+ 	platform_driver_unregister(&ezxbl_driver);
+}
+
+module_init(ezxbl_init);
+module_exit(ezxbl_exit);
+
+MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
+MODULE_DESCRIPTION("Backlight Driver for Motorola A780|E680(i)");
