diff options
Diffstat (limited to 'packages/linux/linux-ezx-2.6.21/ezx-backlight.patch')
-rw-r--r-- | packages/linux/linux-ezx-2.6.21/ezx-backlight.patch | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/packages/linux/linux-ezx-2.6.21/ezx-backlight.patch b/packages/linux/linux-ezx-2.6.21/ezx-backlight.patch new file mode 100644 index 0000000000..ec48d46746 --- /dev/null +++ b/packages/linux/linux-ezx-2.6.21/ezx-backlight.patch @@ -0,0 +1,203 @@ + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# + +Index: linux-2.6.21/drivers/video/backlight/Kconfig +=================================================================== +--- linux-2.6.21.orig/drivers/video/backlight/Kconfig 2007-05-08 14:19:18.000000000 -0300 ++++ linux-2.6.21/drivers/video/backlight/Kconfig 2007-05-08 14:22:22.000000000 -0300 +@@ -63,3 +63,12 @@ + help + If you have a Frontpath ProGear say Y to enable the + backlight driver. ++ ++config BACKLIGHT_EZX ++ tristate "Motorola EXZ Backlight Driver (A780/E680/E680i)" ++ depends on BACKLIGHT_CLASS_DEVICE && PXA_EZX ++ default y ++ help ++ If you have a Motorola A780 or E680(i), say y to enable the ++ backlight driver. ++ +Index: linux-2.6.21/drivers/video/backlight/Makefile +=================================================================== +--- linux-2.6.21.orig/drivers/video/backlight/Makefile 2007-05-08 14:19:18.000000000 -0300 ++++ linux-2.6.21/drivers/video/backlight/Makefile 2007-05-08 14:22:22.000000000 -0300 +@@ -6,3 +6,4 @@ + obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o + obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o + obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o ++obj-$(CONFIG_BACKLIGHT_EZX) += ezx_bl.o +Index: linux-2.6.21/drivers/video/backlight/ezx_bl.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21/drivers/video/backlight/ezx_bl.c 2007-05-08 14:24:16.000000000 -0300 +@@ -0,0 +1,142 @@ ++/* ++ * Backlight Driver for Motorola A780 and E680(i) GSM Phones. ++ * ++ * Copyright 2006 Vanille Media ++ * ++ * Author: Michael Lauer <mickey@Vanille.de> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/platform_device.h> ++#include <linux/fb.h> ++#include <linux/backlight.h> ++ ++#include <asm/arch/pxa-regs.h> ++#include <asm/arch/ezx.h> ++ ++#define EZX_MIN_INTENSITY 0 ++#define EZX_MAX_INTENSITY 50 ++#define EZX_DEFAULT_INTENSITY 30 ++ ++static struct backlight_device *ezx_backlight_device; ++static int last_intensity; ++static int suspended; ++ ++static int ezxbl_send_intensity(struct backlight_device *bd) ++{ ++ int intensity = bd->props.brightness; ++ ++ if (suspended || bd->props.power != FB_BLANK_UNBLANK || ++ bd->props.fb_blank != FB_BLANK_UNBLANK) ++ intensity = 0; ++ ++ if ( !last_intensity && intensity ) { ++ 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 */ ++ } ++ else if ( last_intensity && !intensity ) { ++ PWM_PWDUTY0 = 0; ++ 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 ) { ++ PWM_PWDUTY0 = intensity; /* duty cycle */ ++ } ++ last_intensity = intensity; ++ return 0; ++} ++ ++static int ezxbl_get_intensity(struct backlight_device *bd) ++{ ++ return last_intensity; ++} ++ ++static int ezxbl_set_intensity(struct backlight_device *bd) ++{ ++ return ezxbl_send_intensity(ezx_backlight_device); ++} ++ ++#ifdef CONFIG_PM ++static int ezxbl_suspend(struct platform_device *pdev, pm_message_t state) ++{ ++ suspended = 1; ++ ezxbl_set_intensity(ezx_backlight_device); ++ return 0; ++} ++ ++static int ezxbl_resume(struct platform_device *pdev) ++{ ++ suspended = 0; ++ ezxbl_set_intensity(ezx_backlight_device); ++ return 0; ++} ++#else ++#define ezxbl_suspend NULL ++#define ezxbl_resume NULL ++#endif ++ ++static struct backlight_ops ezxbl_ops = { ++ .get_brightness = ezxbl_get_intensity, ++ .update_status = ezxbl_set_intensity, ++}; ++ ++static int __init ezxbl_probe(struct platform_device *pdev) ++{ ++ ezx_backlight_device = backlight_device_register ("ezx-bl", ++ &pdev->dev, NULL, &ezxbl_ops); ++ if (IS_ERR (ezx_backlight_device)) ++ return PTR_ERR (ezx_backlight_device); ++ ++ platform_set_drvdata(pdev, ezx_backlight_device); ++ ++ ezx_backlight_device->props.power = FB_BLANK_UNBLANK; ++ ezx_backlight_device->props.max_brightness = EZX_MAX_INTENSITY; ++ ezx_backlight_device->props.brightness = EZX_DEFAULT_INTENSITY; ++ ezxbl_set_intensity(ezx_backlight_device); ++ backlight_update_status(ezx_backlight_device); ++ ++ return 0; ++} ++ ++static int ezxbl_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)"); ++MODULE_LICENSE("GPL"); +Index: linux-2.6.21/arch/arm/mach-pxa/ezx.c +=================================================================== +--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx.c 2007-05-08 14:22:21.000000000 -0300 ++++ linux-2.6.21/arch/arm/mach-pxa/ezx.c 2007-05-08 14:22:22.000000000 -0300 +@@ -67,6 +67,12 @@ + #endif + EXPORT_SYMBOL(ezx_backlight_power); + ++/* EZX LCD Backlight */ ++static struct platform_device ezxbacklight_device = { ++ .name = "ezx-bl", ++ .id = -1, ++}; ++ + /* SSP */ + struct platform_device ezxssp_device = { + .name = "ezx-ssp", +@@ -204,6 +210,7 @@ + &ezxpcap_device, + &ezxemu_device, + &pcap_ts_device, ++ &ezxbacklight_device, + }; + + /* PM */ |