diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-01-28 08:21:38 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-28 08:21:38 -0500 |
commit | 0ff66f0c7a5f1f4f5a0d91341b6f71fd2a49f0fa (patch) | |
tree | 7c4d74a76bf4f49e87d769c236fdd2db77fb241d /arch/arm/mach-pxa/mainstone.c | |
parent | c00d4ffdbace1bdc9fdd888e4ba6d207ffa3b679 (diff) | |
parent | 4e4fc05a2b6e7bd2e0facd96e0c18dceb34d9349 (diff) |
Merge branch 'pxa-plat' into devel
* pxa-plat: (53 commits)
[ARM] 4762/1: Basic support for Toradex Colibri module
[ARM] pxa: fix mci_init functions returning -1
[ARM] 4737/1: Refactor corgi_lcd to improve readability + bugfix
[ARM] 4747/1: pcm027: support for pcm990 baseboard for phyCORE-PXA270
[ARM] 4746/1: pcm027: network support for phyCORE-PXA270
[ARM] 4745/1: pcm027: default configuration
[ARM] 4744/1: pcm027: add support for phyCORE-PXA270 CPU module
[NET] smc91x: Make smc91x use IRQ resource trigger flags
[ARM] pxa: add default config for littleton
[ARM] pxa: add basic support for Littleton (PXA3xx Form Factor Platform)
[ARM] 4664/1: Add basic support for HTC Magician PDA phones
[ARM] 4649/1: Base support for pxa-based Toshiba e-series PDAs.
[ARM] pxa: skip registers saving/restoring if entering standby mode
[ARM] pxa: fix PXA27x resume
[ARM] pxa: Avoid fiddling with CKEN register on suspend
[ARM] pxa: Add PXA3 standby code hooked into the IRQ wake scheme
[ARM] pxa: Add zylonite MFP wakeup configurations
[ARM] pxa: program MFPs for low power mode when suspending
[ARM] pxa: make MFP configuration processor independent
[ARM] pxa: remove un-used pxa3xx_mfp_set_xxx() functions
...
Conflicts:
arch/arm/mach-pxa/ssp.c
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/mainstone.c')
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 79 |
1 files changed, 61 insertions, 18 deletions
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 41d8c6cea62b..345c3deeb02e 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
24 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/backlight.h> | ||
26 | 27 | ||
27 | #include <asm/types.h> | 28 | #include <asm/types.h> |
28 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
@@ -38,6 +39,7 @@ | |||
38 | #include <asm/mach/flash.h> | 39 | #include <asm/mach/flash.h> |
39 | 40 | ||
40 | #include <asm/arch/pxa-regs.h> | 41 | #include <asm/arch/pxa-regs.h> |
42 | #include <asm/arch/pxa2xx-regs.h> | ||
41 | #include <asm/arch/mainstone.h> | 43 | #include <asm/arch/mainstone.h> |
42 | #include <asm/arch/audio.h> | 44 | #include <asm/arch/audio.h> |
43 | #include <asm/arch/pxafb.h> | 45 | #include <asm/arch/pxafb.h> |
@@ -130,9 +132,13 @@ static struct sys_device mainstone_irq_device = { | |||
130 | 132 | ||
131 | static int __init mainstone_irq_device_init(void) | 133 | static int __init mainstone_irq_device_init(void) |
132 | { | 134 | { |
133 | int ret = sysdev_class_register(&mainstone_irq_sysclass); | 135 | int ret = -ENODEV; |
134 | if (ret == 0) | 136 | |
135 | ret = sysdev_register(&mainstone_irq_device); | 137 | if (machine_is_mainstone()) { |
138 | ret = sysdev_class_register(&mainstone_irq_sysclass); | ||
139 | if (ret == 0) | ||
140 | ret = sysdev_register(&mainstone_irq_device); | ||
141 | } | ||
136 | return ret; | 142 | return ret; |
137 | } | 143 | } |
138 | 144 | ||
@@ -150,7 +156,7 @@ static struct resource smc91x_resources[] = { | |||
150 | [1] = { | 156 | [1] = { |
151 | .start = MAINSTONE_IRQ(3), | 157 | .start = MAINSTONE_IRQ(3), |
152 | .end = MAINSTONE_IRQ(3), | 158 | .end = MAINSTONE_IRQ(3), |
153 | .flags = IORESOURCE_IRQ, | 159 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
154 | } | 160 | } |
155 | }; | 161 | }; |
156 | 162 | ||
@@ -263,21 +269,60 @@ static struct platform_device mst_flash_device[2] = { | |||
263 | }, | 269 | }, |
264 | }; | 270 | }; |
265 | 271 | ||
266 | static void mainstone_backlight_power(int on) | 272 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE |
273 | static int mainstone_backlight_update_status(struct backlight_device *bl) | ||
267 | { | 274 | { |
268 | if (on) { | 275 | int brightness = bl->props.brightness; |
276 | |||
277 | if (bl->props.power != FB_BLANK_UNBLANK || | ||
278 | bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
279 | brightness = 0; | ||
280 | |||
281 | if (brightness != 0) { | ||
269 | pxa_gpio_mode(GPIO16_PWM0_MD); | 282 | pxa_gpio_mode(GPIO16_PWM0_MD); |
270 | pxa_set_cken(CKEN_PWM0, 1); | 283 | pxa_set_cken(CKEN_PWM0, 1); |
271 | PWM_CTRL0 = 0; | 284 | } |
272 | PWM_PWDUTY0 = 0x3ff; | 285 | PWM_CTRL0 = 0; |
273 | PWM_PERVAL0 = 0x3ff; | 286 | PWM_PWDUTY0 = brightness; |
274 | } else { | 287 | PWM_PERVAL0 = bl->props.max_brightness; |
275 | PWM_CTRL0 = 0; | 288 | if (brightness == 0) |
276 | PWM_PWDUTY0 = 0x0; | ||
277 | PWM_PERVAL0 = 0x3FF; | ||
278 | pxa_set_cken(CKEN_PWM0, 0); | 289 | pxa_set_cken(CKEN_PWM0, 0); |
290 | return 0; /* pointless return value */ | ||
291 | } | ||
292 | |||
293 | static int mainstone_backlight_get_brightness(struct backlight_device *bl) | ||
294 | { | ||
295 | return PWM_PWDUTY0; | ||
296 | } | ||
297 | |||
298 | static /*const*/ struct backlight_ops mainstone_backlight_ops = { | ||
299 | .update_status = mainstone_backlight_update_status, | ||
300 | .get_brightness = mainstone_backlight_get_brightness, | ||
301 | }; | ||
302 | |||
303 | static void __init mainstone_backlight_register(void) | ||
304 | { | ||
305 | struct backlight_device *bl; | ||
306 | |||
307 | bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, | ||
308 | NULL, &mainstone_backlight_ops); | ||
309 | if (IS_ERR(bl)) { | ||
310 | printk(KERN_ERR "mainstone: unable to register backlight: %ld\n", | ||
311 | PTR_ERR(bl)); | ||
312 | return; | ||
279 | } | 313 | } |
314 | |||
315 | /* | ||
316 | * broken design - register-then-setup interfaces are | ||
317 | * utterly broken by definition. | ||
318 | */ | ||
319 | bl->props.max_brightness = 1023; | ||
320 | bl->props.brightness = 1023; | ||
321 | backlight_update_status(bl); | ||
280 | } | 322 | } |
323 | #else | ||
324 | #define mainstone_backlight_register() do { } while (0) | ||
325 | #endif | ||
281 | 326 | ||
282 | static struct pxafb_mode_info toshiba_ltm04c380k_mode = { | 327 | static struct pxafb_mode_info toshiba_ltm04c380k_mode = { |
283 | .pixclock = 50000, | 328 | .pixclock = 50000, |
@@ -311,7 +356,6 @@ static struct pxafb_mach_info mainstone_pxafb_info = { | |||
311 | .num_modes = 1, | 356 | .num_modes = 1, |
312 | .lccr0 = LCCR0_Act, | 357 | .lccr0 = LCCR0_Act, |
313 | .lccr3 = LCCR3_PCP, | 358 | .lccr3 = LCCR3_PCP, |
314 | .pxafb_backlight_power = mainstone_backlight_power, | ||
315 | }; | 359 | }; |
316 | 360 | ||
317 | static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data) | 361 | static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data) |
@@ -335,12 +379,10 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in | |||
335 | 379 | ||
336 | err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED, | 380 | err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED, |
337 | "MMC card detect", data); | 381 | "MMC card detect", data); |
338 | if (err) { | 382 | if (err) |
339 | printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 383 | printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
340 | return -1; | ||
341 | } | ||
342 | 384 | ||
343 | return 0; | 385 | return err; |
344 | } | 386 | } |
345 | 387 | ||
346 | static void mainstone_mci_setpower(struct device *dev, unsigned int vdd) | 388 | static void mainstone_mci_setpower(struct device *dev, unsigned int vdd) |
@@ -473,6 +515,7 @@ static void __init mainstone_init(void) | |||
473 | mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode; | 515 | mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode; |
474 | 516 | ||
475 | set_pxa_fb_info(&mainstone_pxafb_info); | 517 | set_pxa_fb_info(&mainstone_pxafb_info); |
518 | mainstone_backlight_register(); | ||
476 | 519 | ||
477 | pxa_set_mci_info(&mainstone_mci_platform_data); | 520 | pxa_set_mci_info(&mainstone_mci_platform_data); |
478 | pxa_set_ficp_info(&mainstone_ficp_platform_data); | 521 | pxa_set_ficp_info(&mainstone_ficp_platform_data); |