From 5c9b0c1d2e0346cca4d617ed018abbd9d1e00036 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 20 Apr 2008 17:15:32 +0100 Subject: [PATCH] --- yaml --- r: 100912 b: refs/heads/master c: 02a8e76979f9b439642e67955edb865c112926f6 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/arm/Kconfig | 3 - trunk/arch/arm/common/sharpsl_pm.c | 2 + trunk/arch/arm/mach-pxa/Kconfig | 25 -- trunk/arch/arm/mach-pxa/Makefile | 1 - trunk/arch/arm/mach-pxa/corgi_pm.c | 2 + trunk/arch/arm/mach-pxa/devices.c | 60 ---- trunk/arch/arm/mach-pxa/devices.h | 5 - trunk/arch/arm/mach-pxa/lpd270.c | 38 +-- trunk/arch/arm/mach-pxa/magician.c | 68 ++--- trunk/arch/arm/mach-pxa/mainstone.c | 63 ++-- trunk/arch/arm/mach-pxa/pcm990-baseboard.c | 99 +------ trunk/arch/arm/mach-pxa/pwm.c | 319 --------------------- trunk/arch/arm/mach-pxa/pxa25x.c | 6 +- trunk/arch/arm/mach-pxa/pxa27x.c | 5 +- trunk/arch/arm/mach-pxa/pxa3xx.c | 4 - trunk/arch/arm/mach-pxa/spitz_pm.c | 2 + trunk/arch/arm/mach-pxa/zylonite.c | 26 +- trunk/arch/arm/mach-pxa/zylonite_pxa300.c | 4 +- trunk/arch/arm/mach-pxa/zylonite_pxa320.c | 2 +- trunk/drivers/video/backlight/Kconfig | 7 - trunk/drivers/video/backlight/Makefile | 1 - trunk/drivers/video/backlight/pwm_bl.c | 185 ------------ trunk/include/asm-arm/arch-pxa/zylonite.h | 1 + trunk/include/linux/pwm.h | 31 -- trunk/include/linux/pwm_backlight.h | 17 -- 26 files changed, 116 insertions(+), 862 deletions(-) delete mode 100644 trunk/arch/arm/mach-pxa/pwm.c delete mode 100644 trunk/drivers/video/backlight/pwm_bl.c delete mode 100644 trunk/include/linux/pwm.h delete mode 100644 trunk/include/linux/pwm_backlight.h diff --git a/[refs] b/[refs] index c97ab8b5263a..56f87d26cb9e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c0f7edb3099d538017c52556aab596b857dc92ee +refs/heads/master: 02a8e76979f9b439642e67955edb865c112926f6 diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index c274dbb89a83..b786e68914d4 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -22,9 +22,6 @@ config ARM Europe. There is an ARM Linux project with a web page at . -config HAVE_PWM - bool - config SYS_SUPPORTS_APM_EMULATION bool diff --git a/trunk/arch/arm/common/sharpsl_pm.c b/trunk/arch/arm/common/sharpsl_pm.c index 5bba5255b119..5736c987c80d 100644 --- a/trunk/arch/arm/common/sharpsl_pm.c +++ b/trunk/arch/arm/common/sharpsl_pm.c @@ -157,6 +157,7 @@ static void sharpsl_battery_thread(struct work_struct *private_) dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage, sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies); +#ifdef CONFIG_BACKLIGHT_CORGI /* If battery is low. limit backlight intensity to save power. */ if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || @@ -169,6 +170,7 @@ static void sharpsl_battery_thread(struct work_struct *private_) sharpsl_pm.machinfo->backlight_limit(0); sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; } +#endif /* Suspend if critical battery level */ if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) diff --git a/trunk/arch/arm/mach-pxa/Kconfig b/trunk/arch/arm/mach-pxa/Kconfig index 03cbd0f7285b..5da7a6820492 100644 --- a/trunk/arch/arm/mach-pxa/Kconfig +++ b/trunk/arch/arm/mach-pxa/Kconfig @@ -37,12 +37,10 @@ config ARCH_LUBBOCK config MACH_LOGICPD_PXA270 bool "LogicPD PXA270 Card Engine Development Platform" select PXA27x - select HAVE_PWM config MACH_MAINSTONE bool "Intel HCDDBBVA0 Development Platform" select PXA27x - select HAVE_PWM config ARCH_PXA_IDP bool "Accelent Xscale IDP" @@ -118,7 +116,6 @@ config MACH_COLIBRI config MACH_ZYLONITE bool "PXA3xx Development Platform" select PXA3xx - select HAVE_PWM config MACH_LITTLETON bool "PXA3xx Form Factor Platform (aka Littleton)" @@ -149,22 +146,6 @@ choice config MACH_PCM990_BASEBOARD bool "PHYTEC PCM-990 development board" - select HAVE_PWM - -endchoice - -choice - prompt "display on pcm990" - depends on MACH_PCM990_BASEBOARD - -config PCM990_DISPLAY_SHARP - bool "sharp lq084v1dg21 stn display" - -config PCM990_DISPLAY_NEC - bool "nec nl6448bc20_18d tft display" - -config PCM990_DISPLAY_NONE - bool "no display" endchoice @@ -292,10 +273,4 @@ config PXA_SSP tristate help Enable support for PXA2xx SSP ports - -config PXA_PWM - tristate - default BACKLIGHT_PWM - help - Enable support for PXA2xx/PXA3xx PWM controllers endif diff --git a/trunk/arch/arm/mach-pxa/Makefile b/trunk/arch/arm/mach-pxa/Makefile index 02cbc3cfbe01..0e6d05bb81aa 100644 --- a/trunk/arch/arm/mach-pxa/Makefile +++ b/trunk/arch/arm/mach-pxa/Makefile @@ -10,7 +10,6 @@ obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o # Generic drivers that other drivers may depend upon obj-$(CONFIG_PXA_SSP) += ssp.o -obj-$(CONFIG_PXA_PWM) += pwm.o # SoC-specific code obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o diff --git a/trunk/arch/arm/mach-pxa/corgi_pm.c b/trunk/arch/arm/mach-pxa/corgi_pm.c index 0a85f706e887..ae91c4b1135c 100644 --- a/trunk/arch/arm/mach-pxa/corgi_pm.c +++ b/trunk/arch/arm/mach-pxa/corgi_pm.c @@ -204,7 +204,9 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = { .read_devdata = corgipm_read_devdata, .charger_wakeup = corgi_charger_wakeup, .should_wakeup = corgi_should_wakeup, +#ifdef CONFIG_BACKLIGHT_CORGI .backlight_limit = corgibl_limit_intensity, +#endif .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, diff --git a/trunk/arch/arm/mach-pxa/devices.c b/trunk/arch/arm/mach-pxa/devices.c index 794a1076db73..d6c05b6eab35 100644 --- a/trunk/arch/arm/mach-pxa/devices.c +++ b/trunk/arch/arm/mach-pxa/devices.c @@ -280,36 +280,6 @@ struct platform_device pxa_device_rtc = { #ifdef CONFIG_PXA25x -static struct resource pxa25x_resource_pwm0[] = { - [0] = { - .start = 0x40b00000, - .end = 0x40b0000f, - .flags = IORESOURCE_MEM, - }, -}; - -struct platform_device pxa25x_device_pwm0 = { - .name = "pxa25x-pwm", - .id = 0, - .resource = pxa25x_resource_pwm0, - .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0), -}; - -static struct resource pxa25x_resource_pwm1[] = { - [0] = { - .start = 0x40c00000, - .end = 0x40c0000f, - .flags = IORESOURCE_MEM, - }, -}; - -struct platform_device pxa25x_device_pwm1 = { - .name = "pxa25x-pwm", - .id = 1, - .resource = pxa25x_resource_pwm1, - .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1), -}; - static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32); static struct resource pxa25x_resource_ssp[] = { @@ -598,36 +568,6 @@ struct platform_device pxa27x_device_ssp3 = { .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), }; -static struct resource pxa27x_resource_pwm0[] = { - [0] = { - .start = 0x40b00000, - .end = 0x40b0001f, - .flags = IORESOURCE_MEM, - }, -}; - -struct platform_device pxa27x_device_pwm0 = { - .name = "pxa27x-pwm", - .id = 0, - .resource = pxa27x_resource_pwm0, - .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0), -}; - -static struct resource pxa27x_resource_pwm1[] = { - [0] = { - .start = 0x40c00000, - .end = 0x40c0001f, - .flags = IORESOURCE_MEM, - }, -}; - -struct platform_device pxa27x_device_pwm1 = { - .name = "pxa27x-pwm", - .id = 1, - .resource = pxa27x_resource_pwm1, - .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1), -}; - static struct resource pxa27x_resource_camera[] = { [0] = { .start = 0x50000000, diff --git a/trunk/arch/arm/mach-pxa/devices.h b/trunk/arch/arm/mach-pxa/devices.h index e620a3373d42..fcab017f27ee 100644 --- a/trunk/arch/arm/mach-pxa/devices.h +++ b/trunk/arch/arm/mach-pxa/devices.h @@ -24,9 +24,4 @@ extern struct platform_device pxa27x_device_ssp2; extern struct platform_device pxa27x_device_ssp3; extern struct platform_device pxa3xx_device_ssp4; -extern struct platform_device pxa25x_device_pwm0; -extern struct platform_device pxa25x_device_pwm1; -extern struct platform_device pxa27x_device_pwm0; -extern struct platform_device pxa27x_device_pwm1; - void __init pxa_register_device(struct platform_device *dev, void *data); diff --git a/trunk/arch/arm/mach-pxa/lpd270.c b/trunk/arch/arm/mach-pxa/lpd270.c index f958403b43e8..a20e4b1649d6 100644 --- a/trunk/arch/arm/mach-pxa/lpd270.c +++ b/trunk/arch/arm/mach-pxa/lpd270.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -234,20 +233,21 @@ static struct platform_device lpd270_flash_device[2] = { }, }; -static struct platform_pwm_backlight_data lpd270_backlight_data = { - .pwm_id = 0, - .max_brightness = 1, - .dft_brightness = 1, - .pwm_period_ns = 78770, -}; - -static struct platform_device lpd270_backlight_device = { - .name = "pwm-backlight", - .dev = { - .parent = &pxa27x_device_pwm0.dev, - .platform_data = &lpd270_backlight_data, - }, -}; +static void lpd270_backlight_power(int on) +{ + if (on) { + pxa_gpio_mode(GPIO16_PWM0_MD); + pxa_set_cken(CKEN_PWM0, 1); + PWM_CTRL0 = 0; + PWM_PWDUTY0 = 0x3ff; + PWM_PERVAL0 = 0x3ff; + } else { + PWM_CTRL0 = 0; + PWM_PWDUTY0 = 0x0; + PWM_PERVAL0 = 0x3FF; + pxa_set_cken(CKEN_PWM0, 0); + } +} /* 5.7" TFT QVGA (LoLo display number 1) */ static struct pxafb_mode_info sharp_lq057q3dc02_mode = { @@ -269,6 +269,7 @@ static struct pxafb_mach_info sharp_lq057q3dc02 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; /* 12.1" TFT SVGA (LoLo display number 2) */ @@ -291,6 +292,7 @@ static struct pxafb_mach_info sharp_lq121s1dg31 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; /* 3.6" TFT QVGA (LoLo display number 3) */ @@ -313,6 +315,7 @@ static struct pxafb_mach_info sharp_lq036q1da01 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; /* 6.4" TFT VGA (LoLo display number 5) */ @@ -335,6 +338,7 @@ static struct pxafb_mach_info sharp_lq64d343 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; /* 10.4" TFT VGA (LoLo display number 7) */ @@ -357,6 +361,7 @@ static struct pxafb_mach_info sharp_lq10d368 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; /* 3.5" TFT QVGA (LoLo display number 8) */ @@ -379,6 +384,7 @@ static struct pxafb_mach_info sharp_lq035q7db02_20 = { .num_modes = 1, .lccr0 = 0x07800080, .lccr3 = 0x00400000, + .pxafb_backlight_power = lpd270_backlight_power, }; static struct pxafb_mach_info *lpd270_lcd_to_use; @@ -408,7 +414,6 @@ __setup("lcd=", lpd270_set_lcd); static struct platform_device *platform_devices[] __initdata = { &smc91x_device, - &lpd270_backlight_device, &lpd270_audio_device, &lpd270_flash_device[0], &lpd270_flash_device[1], @@ -449,7 +454,6 @@ static void __init lpd270_init(void) * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45. */ pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); - pxa_gpio_mode(GPIO16_PWM0_MD); platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); diff --git a/trunk/arch/arm/mach-pxa/magician.c b/trunk/arch/arm/mach-pxa/magician.c index 300caeb21371..badba064dc04 100644 --- a/trunk/arch/arm/mach-pxa/magician.c +++ b/trunk/arch/arm/mach-pxa/magician.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -40,7 +39,6 @@ #include #include -#include "devices.h" #include "generic.h" static unsigned long magician_pin_config[] = { @@ -350,58 +348,40 @@ static struct pxafb_mach_info samsung_info = { * Backlight */ -static int magician_backlight_init(struct device *dev) +static void magician_set_bl_intensity(int intensity) { - int ret; - - ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER"); - if (ret) - goto err; - ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2"); - if (ret) - goto err2; - return 0; - -err2: - gpio_free(EGPIO_MAGICIAN_BL_POWER); -err: - return ret; -} - -static int magician_backlight_notify(int brightness) -{ - gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); - if (brightness >= 200) { - gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); - return brightness - 72; + if (intensity) { + PWM_CTRL0 = 1; + PWM_PERVAL0 = 0xc8; + if (intensity > 0xc7) { + PWM_PWDUTY0 = intensity - 0x48; + gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); + } else { + PWM_PWDUTY0 = intensity; + gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); + } + gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); + pxa_set_cken(CKEN_PWM0, 1); } else { - gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); - return brightness; + /* PWM_PWDUTY0 = intensity; */ + gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); + pxa_set_cken(CKEN_PWM0, 0); } } -static void magician_backlight_exit(struct device *dev) -{ - gpio_free(EGPIO_MAGICIAN_BL_POWER); - gpio_free(EGPIO_MAGICIAN_BL_POWER2); -} - -static struct platform_pwm_backlight_data backlight_data = { - .pwm_id = 0, - .max_brightness = 272, - .dft_brightness = 100, - .pwm_period_ns = 30923, - .init = magician_backlight_init, - .notify = magician_backlight_notify, - .exit = magician_backlight_exit, +static struct generic_bl_info backlight_info = { + .default_intensity = 0x64, + .limit_mask = 0x0b, + .max_intensity = 0xc7+0x48, + .set_bl_intensity = magician_set_bl_intensity, }; static struct platform_device backlight = { - .name = "pwm-backlight", + .name = "generic-bl", .dev = { - .parent = &pxa27x_device_pwm0.dev, - .platform_data = &backlight_data, + .platform_data = &backlight_info, }, + .id = -1, }; /* diff --git a/trunk/arch/arm/mach-pxa/mainstone.c b/trunk/arch/arm/mach-pxa/mainstone.c index 266594426e8b..7399fb34da4e 100644 --- a/trunk/arch/arm/mach-pxa/mainstone.c +++ b/trunk/arch/arm/mach-pxa/mainstone.c @@ -23,9 +23,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -349,27 +349,56 @@ static struct platform_device mst_flash_device[2] = { }, }; -#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) -static struct platform_pwm_backlight_data mainstone_backlight_data = { - .pwm_id = 0, - .max_brightness = 1023, - .dft_brightness = 1023, - .pwm_period_ns = 78770, -}; +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE +static int mainstone_backlight_update_status(struct backlight_device *bl) +{ + int brightness = bl->props.brightness; -static struct platform_device mainstone_backlight_device = { - .name = "pwm-backlight", - .dev = { - .parent = &pxa27x_device_pwm0.dev, - .platform_data = &mainstone_backlight_data, - }, + if (bl->props.power != FB_BLANK_UNBLANK || + bl->props.fb_blank != FB_BLANK_UNBLANK) + brightness = 0; + + if (brightness != 0) + pxa_set_cken(CKEN_PWM0, 1); + + PWM_CTRL0 = 0; + PWM_PWDUTY0 = brightness; + PWM_PERVAL0 = bl->props.max_brightness; + + if (brightness == 0) + pxa_set_cken(CKEN_PWM0, 0); + return 0; /* pointless return value */ +} + +static int mainstone_backlight_get_brightness(struct backlight_device *bl) +{ + return PWM_PWDUTY0; +} + +static /*const*/ struct backlight_ops mainstone_backlight_ops = { + .update_status = mainstone_backlight_update_status, + .get_brightness = mainstone_backlight_get_brightness, }; static void __init mainstone_backlight_register(void) { - int ret = platform_device_register(&mainstone_backlight_device); - if (ret) - printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret); + struct backlight_device *bl; + + bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, + NULL, &mainstone_backlight_ops); + if (IS_ERR(bl)) { + printk(KERN_ERR "mainstone: unable to register backlight: %ld\n", + PTR_ERR(bl)); + return; + } + + /* + * broken design - register-then-setup interfaces are + * utterly broken by definition. + */ + bl->props.max_brightness = 1023; + bl->props.brightness = 1023; + backlight_update_status(bl); } #else #define mainstone_backlight_register() do { } while (0) diff --git a/trunk/arch/arm/mach-pxa/pcm990-baseboard.c b/trunk/arch/arm/mach-pxa/pcm990-baseboard.c index 2564e16e4e2f..49d951db0f3d 100644 --- a/trunk/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/trunk/arch/arm/mach-pxa/pcm990-baseboard.c @@ -24,7 +24,6 @@ #include #include #include -#include #include @@ -37,99 +36,9 @@ #include #include #include -#include - -#include "devices.h" - -/* - * pcm990_lcd_power - control power supply to the LCD - * @on: 0 = switch off, 1 = switch on - * - * Called by the pxafb driver - */ -#ifndef CONFIG_PCM990_DISPLAY_NONE -static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var) -{ - if (on) { - /* enable LCD-Latches - * power on LCD - */ - __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = - PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON; - } else { - /* disable LCD-Latches - * power off LCD - */ - __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00; - } -} -#endif - -#if defined(CONFIG_PCM990_DISPLAY_SHARP) -static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = { - .pixclock = 28000, - .xres = 640, - .yres = 480, - .bpp = 16, - .hsync_len = 20, - .left_margin = 103, - .right_margin = 47, - .vsync_len = 6, - .upper_margin = 28, - .lower_margin = 5, - .sync = 0, - .cmap_greyscale = 0, -}; - -static struct pxafb_mach_info pcm990_fbinfo __initdata = { - .modes = &fb_info_sharp_lq084v1dg21, - .num_modes = 1, - .lccr0 = LCCR0_PAS, - .lccr3 = LCCR3_PCP, - .pxafb_lcd_power = pcm990_lcd_power, -}; -#elif defined(CONFIG_PCM990_DISPLAY_NEC) -struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = { - .pixclock = 39720, - .xres = 640, - .yres = 480, - .bpp = 16, - .hsync_len = 32, - .left_margin = 16, - .right_margin = 48, - .vsync_len = 2, - .upper_margin = 12, - .lower_margin = 17, - .sync = 0, - .cmap_greyscale = 0, -}; - -static struct pxafb_mach_info pcm990_fbinfo __initdata = { - .modes = &fb_info_nec_nl6448bc20_18d, - .num_modes = 1, - .lccr0 = LCCR0_Act, - .lccr3 = LCCR3_PixFlEdg, - .pxafb_lcd_power = pcm990_lcd_power, -}; -#endif - -static struct platform_pwm_backlight_data pcm990_backlight_data = { - .pwm_id = 0, - .max_brightness = 1023, - .dft_brightness = 1023, - .pwm_period_ns = 78770, -}; - -static struct platform_device pcm990_backlight_device = { - .name = "pwm-backlight", - .dev = { - .parent = &pxa27x_device_pwm0.dev, - .platform_data = &pcm990_backlight_data, - }, -}; /* - * The PCM-990 development baseboard uses PCM-027's hardware in the + * The PCM-990 development baseboard uses PCM-027's hardeware in the * following way: * * - LCD support is in use @@ -484,12 +393,6 @@ void __init pcm990_baseboard_init(void) /* register CPLD's IRQ controller */ pcm990_init_irq(); -#ifndef CONFIG_PCM990_DISPLAY_NONE - set_pxa_fb_info(&pcm990_fbinfo); -#endif - pxa_gpio_mode(GPIO16_PWM0_MD); - platform_device_register(&pcm990_backlight_device); - platform_device_register(&pxa27x_device_ac97); /* MMC */ diff --git a/trunk/arch/arm/mach-pxa/pwm.c b/trunk/arch/arm/mach-pxa/pwm.c deleted file mode 100644 index ce28cd9fed16..000000000000 --- a/trunk/arch/arm/mach-pxa/pwm.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * linux/arch/arm/mach-pxa/pwm.c - * - * simple driver for PWM (Pulse Width Modulator) controller - * - * 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. - * - * 2008-02-13 initial version - * eric miao - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* PWM registers and bits definitions */ -#define PWMCR (0x00) -#define PWMDCR (0x04) -#define PWMPCR (0x08) - -#define PWMCR_SD (1 << 6) -#define PWMDCR_FD (1 << 10) - -struct pwm_device { - struct list_head node; - struct platform_device *pdev; - - const char *label; - struct clk *clk; - int clk_enabled; - void __iomem *mmio_base; - - unsigned int use_count; - unsigned int pwm_id; -}; - -/* - * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE - * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE - */ -int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) -{ - unsigned long long c; - unsigned long period_cycles, prescale, pv, dc; - - if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) - return -EINVAL; - - c = clk_get_rate(pwm->clk); - c = c * period_ns; - do_div(c, 1000000000); - period_cycles = c; - - if (period_cycles < 0) - period_cycles = 1; - prescale = (period_cycles - 1) / 1024; - pv = period_cycles / (prescale + 1) - 1; - - if (prescale > 63) - return -EINVAL; - - if (duty_ns == period_ns) - dc = PWMDCR_FD; - else - dc = (pv + 1) * duty_ns / period_ns; - - /* NOTE: the clock to PWM has to be enabled first - * before writing to the registers - */ - clk_enable(pwm->clk); - __raw_writel(prescale, pwm->mmio_base + PWMCR); - __raw_writel(dc, pwm->mmio_base + PWMDCR); - __raw_writel(pv, pwm->mmio_base + PWMPCR); - clk_disable(pwm->clk); - - return 0; -} -EXPORT_SYMBOL(pwm_config); - -int pwm_enable(struct pwm_device *pwm) -{ - int rc = 0; - - if (!pwm->clk_enabled) { - rc = clk_enable(pwm->clk); - if (!rc) - pwm->clk_enabled = 1; - } - return rc; -} -EXPORT_SYMBOL(pwm_enable); - -void pwm_disable(struct pwm_device *pwm) -{ - if (pwm->clk_enabled) { - clk_disable(pwm->clk); - pwm->clk_enabled = 0; - } -} -EXPORT_SYMBOL(pwm_disable); - -static DEFINE_MUTEX(pwm_lock); -static LIST_HEAD(pwm_list); - -struct pwm_device *pwm_request(int pwm_id, const char *label) -{ - struct pwm_device *pwm; - int found = 0; - - mutex_lock(&pwm_lock); - - list_for_each_entry(pwm, &pwm_list, node) { - if (pwm->pwm_id == pwm_id) { - found = 1; - break; - } - } - - if (found) { - if (pwm->use_count == 0) { - pwm->use_count++; - pwm->label = label; - } else - pwm = ERR_PTR(-EBUSY); - } else - pwm = ERR_PTR(-ENOENT); - - mutex_unlock(&pwm_lock); - return pwm; -} -EXPORT_SYMBOL(pwm_request); - -void pwm_free(struct pwm_device *pwm) -{ - mutex_lock(&pwm_lock); - - if (pwm->use_count) { - pwm->use_count--; - pwm->label = NULL; - } else - pr_warning("PWM device already freed\n"); - - mutex_unlock(&pwm_lock); -} -EXPORT_SYMBOL(pwm_free); - -static inline void __add_pwm(struct pwm_device *pwm) -{ - mutex_lock(&pwm_lock); - list_add_tail(&pwm->node, &pwm_list); - mutex_unlock(&pwm_lock); -} - -static struct pwm_device *pwm_probe(struct platform_device *pdev, - unsigned int pwm_id, struct pwm_device *parent_pwm) -{ - struct pwm_device *pwm; - struct resource *r; - int ret = 0; - - pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL); - if (pwm == NULL) { - dev_err(&pdev->dev, "failed to allocate memory\n"); - return ERR_PTR(-ENOMEM); - } - - pwm->clk = clk_get(&pdev->dev, "PWMCLK"); - if (IS_ERR(pwm->clk)) { - ret = PTR_ERR(pwm->clk); - goto err_free; - } - pwm->clk_enabled = 0; - - pwm->use_count = 0; - pwm->pwm_id = pwm_id; - pwm->pdev = pdev; - - if (parent_pwm != NULL) { - /* registers for the second PWM has offset of 0x10 */ - pwm->mmio_base = parent_pwm->mmio_base + 0x10; - __add_pwm(pwm); - return pwm; - } - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (r == NULL) { - dev_err(&pdev->dev, "no memory resource defined\n"); - ret = -ENODEV; - goto err_free_clk; - } - - r = request_mem_region(r->start, r->end - r->start + 1, pdev->name); - if (r == NULL) { - dev_err(&pdev->dev, "failed to request memory resource\n"); - ret = -EBUSY; - goto err_free_clk; - } - - pwm->mmio_base = ioremap(r->start, r->end - r->start + 1); - if (pwm->mmio_base == NULL) { - dev_err(&pdev->dev, "failed to ioremap() registers\n"); - ret = -ENODEV; - goto err_free_mem; - } - - __add_pwm(pwm); - platform_set_drvdata(pdev, pwm); - return pwm; - -err_free_mem: - release_mem_region(r->start, r->end - r->start + 1); -err_free_clk: - clk_put(pwm->clk); -err_free: - kfree(pwm); - return ERR_PTR(ret); -} - -static int __devinit pxa25x_pwm_probe(struct platform_device *pdev) -{ - struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL); - - if (IS_ERR(pwm)) - return PTR_ERR(pwm); - - return 0; -} - -static int __devinit pxa27x_pwm_probe(struct platform_device *pdev) -{ - struct pwm_device *pwm; - - pwm = pwm_probe(pdev, pdev->id, NULL); - if (IS_ERR(pwm)) - return PTR_ERR(pwm); - - pwm = pwm_probe(pdev, pdev->id + 2, pwm); - if (IS_ERR(pwm)) - return PTR_ERR(pwm); - - return 0; -} - -static int __devexit pwm_remove(struct platform_device *pdev) -{ - struct pwm_device *pwm; - struct resource *r; - - pwm = platform_get_drvdata(pdev); - if (pwm == NULL) - return -ENODEV; - - mutex_lock(&pwm_lock); - list_del(&pwm->node); - mutex_unlock(&pwm_lock); - - iounmap(pwm->mmio_base); - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(r->start, r->end - r->start + 1); - - clk_put(pwm->clk); - kfree(pwm); - return 0; -} - -static struct platform_driver pxa25x_pwm_driver = { - .driver = { - .name = "pxa25x-pwm", - }, - .probe = pxa25x_pwm_probe, - .remove = __devexit_p(pwm_remove), -}; - -static struct platform_driver pxa27x_pwm_driver = { - .driver = { - .name = "pxa27x-pwm", - }, - .probe = pxa27x_pwm_probe, - .remove = __devexit_p(pwm_remove), -}; - -static int __init pwm_init(void) -{ - int ret = 0; - - ret = platform_driver_register(&pxa25x_pwm_driver); - if (ret) { - printk(KERN_ERR "failed to register pxa25x_pwm_driver\n"); - return ret; - } - - ret = platform_driver_register(&pxa27x_pwm_driver); - if (ret) { - printk(KERN_ERR "failed to register pxa27x_pwm_driver\n"); - return ret; - } - - return ret; -} -arch_initcall(pwm_init); - -static void __exit pwm_exit(void) -{ - platform_driver_unregister(&pxa25x_pwm_driver); - platform_driver_unregister(&pxa27x_pwm_driver); -} -module_exit(pwm_exit); - -MODULE_LICENSE("GPL v2"); diff --git a/trunk/arch/arm/mach-pxa/pxa25x.c b/trunk/arch/arm/mach-pxa/pxa25x.c index 2bed3f98d41c..e5b417d14bb0 100644 --- a/trunk/arch/arm/mach-pxa/pxa25x.c +++ b/trunk/arch/arm/mach-pxa/pxa25x.c @@ -129,12 +129,12 @@ static struct clk pxa25x_clks[] = { INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), - INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev), - INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev), INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), /* + INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), + INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL), INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), */ INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), @@ -269,8 +269,6 @@ static struct platform_device *pxa25x_devices[] __initdata = { &pxa25x_device_ssp, &pxa25x_device_nssp, &pxa25x_device_assp, - &pxa25x_device_pwm0, - &pxa25x_device_pwm1, }; static struct sys_device pxa25x_sysdev[] = { diff --git a/trunk/arch/arm/mach-pxa/pxa27x.c b/trunk/arch/arm/mach-pxa/pxa27x.c index bc2e80f69673..7e945836e129 100644 --- a/trunk/arch/arm/mach-pxa/pxa27x.c +++ b/trunk/arch/arm/mach-pxa/pxa27x.c @@ -157,13 +157,12 @@ static struct clk pxa27x_clks[] = { INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), - INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev), - INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev), INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), /* + INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL), INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL), INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL), @@ -364,8 +363,6 @@ static struct platform_device *devices[] __initdata = { &pxa27x_device_ssp1, &pxa27x_device_ssp2, &pxa27x_device_ssp3, - &pxa27x_device_pwm0, - &pxa27x_device_pwm1, }; static struct sys_device pxa27x_sysdev[] = { diff --git a/trunk/arch/arm/mach-pxa/pxa3xx.c b/trunk/arch/arm/mach-pxa/pxa3xx.c index 0f717df1fdb2..644550bfa330 100644 --- a/trunk/arch/arm/mach-pxa/pxa3xx.c +++ b/trunk/arch/arm/mach-pxa/pxa3xx.c @@ -239,8 +239,6 @@ static struct clk pxa3xx_clks[] = { PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), - PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev), - PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev), PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), @@ -532,8 +530,6 @@ static struct platform_device *devices[] __initdata = { &pxa27x_device_ssp2, &pxa27x_device_ssp3, &pxa3xx_device_ssp4, - &pxa27x_device_pwm0, - &pxa27x_device_pwm1, }; static struct sys_device pxa3xx_sysdev[] = { diff --git a/trunk/arch/arm/mach-pxa/spitz_pm.c b/trunk/arch/arm/mach-pxa/spitz_pm.c index 23f050feb208..48396f4eb265 100644 --- a/trunk/arch/arm/mach-pxa/spitz_pm.c +++ b/trunk/arch/arm/mach-pxa/spitz_pm.c @@ -207,7 +207,9 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = { .read_devdata = spitzpm_read_devdata, .charger_wakeup = spitz_charger_wakeup, .should_wakeup = spitz_should_wakeup, +#ifdef CONFIG_BACKLIGHT_CORGI .backlight_limit = corgibl_limit_intensity, +#endif .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, diff --git a/trunk/arch/arm/mach-pxa/zylonite.c b/trunk/arch/arm/mach-pxa/zylonite.c index b13bb9385138..4a0028087ea6 100644 --- a/trunk/arch/arm/mach-pxa/zylonite.c +++ b/trunk/arch/arm/mach-pxa/zylonite.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -29,12 +28,12 @@ #include #include -#include "devices.h" #include "generic.h" #define MAX_SLOTS 3 struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; +int gpio_backlight; int gpio_eth_irq; int wm9713_irq; @@ -63,20 +62,10 @@ static struct platform_device smc91x_device = { }; #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) -static struct platform_pwm_backlight_data zylonite_backlight_data = { - .pwm_id = 3, - .max_brightness = 100, - .dft_brightness = 100, - .pwm_period_ns = 10000, -}; - -static struct platform_device zylonite_backlight_device = { - .name = "pwm-backlight", - .dev = { - .parent = &pxa27x_device_pwm1.dev, - .platform_data = &zylonite_backlight_data, - }, -}; +static void zylonite_backlight_power(int on) +{ + gpio_set_value(gpio_backlight, on); +} static struct pxafb_mode_info toshiba_ltm035a776c_mode = { .pixclock = 110000, @@ -109,6 +98,7 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = { static struct pxafb_mach_info zylonite_toshiba_lcd_info = { .num_modes = 1, .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, + .pxafb_backlight_power = zylonite_backlight_power, }; static struct pxafb_mode_info sharp_ls037_modes[] = { @@ -144,11 +134,13 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = { .modes = sharp_ls037_modes, .num_modes = 2, .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, + .pxafb_backlight_power = zylonite_backlight_power, }; static void __init zylonite_init_lcd(void) { - platform_device_register(&zylonite_backlight_device); + /* backlight GPIO: output, default on */ + gpio_direction_output(gpio_backlight, 1); if (lcd_id & 0x20) { set_pxa_fb_info(&zylonite_sharp_lcd_info); diff --git a/trunk/arch/arm/mach-pxa/zylonite_pxa300.c b/trunk/arch/arm/mach-pxa/zylonite_pxa300.c index 6f7ae972b8db..324fb9daae28 100644 --- a/trunk/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/trunk/arch/arm/mach-pxa/zylonite_pxa300.c @@ -50,7 +50,6 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = { GPIO75_LCD_BIAS, GPIO76_LCD_VSYNC, GPIO127_LCD_CS_N, - GPIO20_PWM3_OUT, /* backlight */ /* BTUART */ GPIO111_UART2_RTS, @@ -201,6 +200,9 @@ void __init zylonite_pxa300_init(void) /* detect LCD panel */ zylonite_detect_lcd_panel(); + /* GPIO pin assignment */ + gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20); + /* MMC card detect & write protect for controller 0 */ zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); diff --git a/trunk/arch/arm/mach-pxa/zylonite_pxa320.c b/trunk/arch/arm/mach-pxa/zylonite_pxa320.c index 2b4fc34919ac..193d07903b06 100644 --- a/trunk/arch/arm/mach-pxa/zylonite_pxa320.c +++ b/trunk/arch/arm/mach-pxa/zylonite_pxa320.c @@ -49,7 +49,6 @@ static mfp_cfg_t mfp_cfg[] __initdata = { GPIO15_2_LCD_LCLK, GPIO16_2_LCD_PCLK, GPIO17_2_LCD_BIAS, - GPIO14_PWM3_OUT, /* backlight */ /* FFUART */ GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL, @@ -188,6 +187,7 @@ void __init zylonite_pxa320_init(void) zylonite_detect_lcd_panel(); /* GPIO pin assignment */ + gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14); gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); /* MMC card detect & write protect for controller 0 */ diff --git a/trunk/drivers/video/backlight/Kconfig b/trunk/drivers/video/backlight/Kconfig index 30bf7f2f1635..dcd8073c2369 100644 --- a/trunk/drivers/video/backlight/Kconfig +++ b/trunk/drivers/video/backlight/Kconfig @@ -112,10 +112,3 @@ config BACKLIGHT_CARILLO_RANCH help If you have a Intel LE80578 (Carillo Ranch) say Y to enable the backlight driver. - -config BACKLIGHT_PWM - tristate "Generic PWM based Backlight Driver" - depends on BACKLIGHT_CLASS_DEVICE && HAVE_PWM - help - If you have a LCD backlight adjustable by PWM, say Y to enable - this driver. diff --git a/trunk/drivers/video/backlight/Makefile b/trunk/drivers/video/backlight/Makefile index b51a7cd12500..33f6c7cecc73 100644 --- a/trunk/drivers/video/backlight/Makefile +++ b/trunk/drivers/video/backlight/Makefile @@ -10,4 +10,3 @@ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o -obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o diff --git a/trunk/drivers/video/backlight/pwm_bl.c b/trunk/drivers/video/backlight/pwm_bl.c deleted file mode 100644 index 6338d0e2fe07..000000000000 --- a/trunk/drivers/video/backlight/pwm_bl.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * linux/drivers/video/backlight/pwm_bl.c - * - * simple PWM based backlight control, board code has to setup - * 1) pin configuration so PWM waveforms can output - * 2) platform_data casts to the PWM id (0/1/2/3 on PXA) - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -struct pwm_bl_data { - struct pwm_device *pwm; - unsigned int period; - int (*notify)(int brightness); -}; - -static int pwm_backlight_update_status(struct backlight_device *bl) -{ - struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); - int brightness = bl->props.brightness; - int max = bl->props.max_brightness; - - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (pb->notify) - brightness = pb->notify(brightness); - - if (brightness == 0) { - pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); - } else { - pwm_config(pb->pwm, brightness * pb->period / max, pb->period); - pwm_enable(pb->pwm); - } - return 0; -} - -static int pwm_backlight_get_brightness(struct backlight_device *bl) -{ - return bl->props.brightness; -} - -static struct backlight_ops pwm_backlight_ops = { - .update_status = pwm_backlight_update_status, - .get_brightness = pwm_backlight_get_brightness, -}; - -static int pwm_backlight_probe(struct platform_device *pdev) -{ - struct platform_pwm_backlight_data *data = pdev->dev.platform_data; - struct backlight_device *bl; - struct pwm_bl_data *pb; - int ret; - - if (!data) - return -EINVAL; - - if (data->init) { - ret = data->init(&pdev->dev); - if (ret < 0) - return ret; - } - - pb = kzalloc(sizeof(*pb), GFP_KERNEL); - if (!pb) { - ret = -ENOMEM; - goto err_alloc; - } - - pb->period = data->pwm_period_ns; - pb->notify = data->notify; - - pb->pwm = pwm_request(data->pwm_id, "backlight"); - if (IS_ERR(pb->pwm)) { - dev_err(&pdev->dev, "unable to request PWM for backlight\n"); - ret = PTR_ERR(pb->pwm); - goto err_pwm; - } - - bl = backlight_device_register(pdev->name, &pdev->dev, - pb, &pwm_backlight_ops); - if (IS_ERR(bl)) { - dev_err(&pdev->dev, "failed to register backlight\n"); - ret = PTR_ERR(bl); - goto err_bl; - } - - bl->props.max_brightness = data->max_brightness; - bl->props.brightness = data->dft_brightness; - backlight_update_status(bl); - - platform_set_drvdata(pdev, bl); - return 0; - -err_bl: - pwm_free(pb->pwm); -err_pwm: - kfree(pb); -err_alloc: - if (data->exit) - data->exit(&pdev->dev); - return ret; -} - -static int pwm_backlight_remove(struct platform_device *pdev) -{ - struct platform_pwm_backlight_data *data = pdev->dev.platform_data; - struct backlight_device *bl = platform_get_drvdata(pdev); - struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); - - backlight_device_unregister(bl); - pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); - pwm_free(pb->pwm); - kfree(pb); - if (data->exit) - data->exit(&pdev->dev); - return 0; -} - -#ifdef CONFIG_PM -static int pwm_backlight_suspend(struct platform_device *pdev, - pm_message_t state) -{ - struct backlight_device *bl = platform_get_drvdata(pdev); - struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); - - pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); - return 0; -} - -static int pwm_backlight_resume(struct platform_device *pdev) -{ - struct backlight_device *bl = platform_get_drvdata(pdev); - - backlight_update_status(bl); - return 0; -} -#else -#define pwm_backlight_suspend NULL -#define pwm_backlight_resume NULL -#endif - -static struct platform_driver pwm_backlight_driver = { - .driver = { - .name = "pwm-backlight", - .owner = THIS_MODULE, - }, - .probe = pwm_backlight_probe, - .remove = pwm_backlight_remove, - .suspend = pwm_backlight_suspend, - .resume = pwm_backlight_resume, -}; - -static int __init pwm_backlight_init(void) -{ - return platform_driver_register(&pwm_backlight_driver); -} -module_init(pwm_backlight_init); - -static void __exit pwm_backlight_exit(void) -{ - platform_driver_unregister(&pwm_backlight_driver); -} -module_exit(pwm_backlight_exit); - -MODULE_DESCRIPTION("PWM based Backlight Driver"); -MODULE_LICENSE("GPL"); diff --git a/trunk/include/asm-arm/arch-pxa/zylonite.h b/trunk/include/asm-arm/arch-pxa/zylonite.h index de577de8d18c..4881b80f0f90 100644 --- a/trunk/include/asm-arm/arch-pxa/zylonite.h +++ b/trunk/include/asm-arm/arch-pxa/zylonite.h @@ -15,6 +15,7 @@ struct platform_mmc_slot { extern struct platform_mmc_slot zylonite_mmc_slot[]; +extern int gpio_backlight; extern int gpio_eth_irq; extern int wm9713_irq; diff --git a/trunk/include/linux/pwm.h b/trunk/include/linux/pwm.h deleted file mode 100644 index 3945f803d514..000000000000 --- a/trunk/include/linux/pwm.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __LINUX_PWM_H -#define __LINUX_PWM_H - -struct pwm_device; - -/* - * pwm_request - request a PWM device - */ -struct pwm_device *pwm_request(int pwm_id, const char *label); - -/* - * pwm_free - free a PWM device - */ -void pwm_free(struct pwm_device *pwm); - -/* - * pwm_config - change a PWM device configuration - */ -int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns); - -/* - * pwm_enable - start a PWM output toggling - */ -int pwm_enable(struct pwm_device *pwm); - -/* - * pwm_disable - stop a PWM output toggling - */ -void pwm_disable(struct pwm_device *pwm); - -#endif /* __ASM_ARCH_PWM_H */ diff --git a/trunk/include/linux/pwm_backlight.h b/trunk/include/linux/pwm_backlight.h deleted file mode 100644 index 7a9754c96775..000000000000 --- a/trunk/include/linux/pwm_backlight.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Generic PWM backlight driver data - see drivers/video/backlight/pwm_bl.c - */ -#ifndef __LINUX_PWM_BACKLIGHT_H -#define __LINUX_PWM_BACKLIGHT_H - -struct platform_pwm_backlight_data { - int pwm_id; - unsigned int max_brightness; - unsigned int dft_brightness; - unsigned int pwm_period_ns; - int (*init)(struct device *dev); - int (*notify)(int brightness); - void (*exit)(struct device *dev); -}; - -#endif