diff options
author | Olof Johansson <olof@lixom.net> | 2015-10-23 13:15:03 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2015-10-23 13:15:03 -0400 |
commit | 7b6e28c38f7cded35b8ca7e9d65bd01b45a0e8fa (patch) | |
tree | 33e97b6c5c513fd02c9e7d740fdd98d9cee31299 | |
parent | 7b192fb7b4b7c672b6fd257402adaf335bd046fd (diff) | |
parent | 54c09889bff6d99c8733eed4a26c9391b177c88b (diff) |
Merge tag 'pxa-for-4.4' of https://github.com/rjarzmik/linux into next/cleanup
This is the pxa changes for v4.4 cycle.
This cycle is bigger than usual :
- magician was greatly enhanced (new IPs discovered, ...)
- almost all legacy board files have been updated to the
new PWM API (mostly for backlight control)
- some minor fixes in raumfeld, z2 and mioa701
* tag 'pxa-for-4.4' of https://github.com/rjarzmik/linux: (44 commits)
ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
ARM: pxa: raumfeld: make some variables static
ARM: pxa: magician: Remove pdata for pasic3-leds
ARM: pxa: magician: Add support for PXA27x UDC
ARM: pxa: magician: Add support for MAX1587A Vcore regulator
ARM: pxa: magician: Change comments to be more informative
ARM: pxa: magician: Move platform_add_devices() to the end of magician_init()
ARM: pxa: magician: Add missing regulator for PWM backlight
ARM: pxa: magician: Add debug message for backlight brightness function
ARM: pxa: magician: Remove definition of the STUART port
ARM: pxa: magician: Fix wrongly enabled USB host ports
ARM: pxa: magician: Fix support for Intel Strata NOR Flash
ARM: pxa: magician: Fix redundant GPIO request for pxaficp_ir
ARM: pxa: magician: Fix platform data for both PXA27x I2C controllers
ARM: pxa: magician: Fix and add charging detection functions
ARM: pxa: magician: Optimize Samsung LCD refresh to 50Hz
ARM: pxa: magician: Rename charger cable detection EGPIOs
ARM: pxa: magician: Optimize powerup delays for Samsung LCD
ARM: pxa: magician: Rename abstract LCD GPIOs
ARM: pxa: magician: Add new discovered EGPIO pins
...
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | Documentation/spi/pxa2xx | 6 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x300.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa270-income.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/devices.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-pxa/ezx.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/hx4700.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/icontrol.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/magician.h | 70 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/pxa27x.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/lpd270.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 680 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mioa701.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palm27x.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtc.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmte2.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pcm990-baseboard.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/raumfeld.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-pxa/tavorevb.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-pxa/viper.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/z2.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite.c | 9 | ||||
-rw-r--r-- | include/linux/spi/pxa2xx_spi.h | 1 |
24 files changed, 608 insertions, 347 deletions
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx index 3352f97430e4..13a0b7fb192f 100644 --- a/Documentation/spi/pxa2xx +++ b/Documentation/spi/pxa2xx | |||
@@ -22,15 +22,10 @@ Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a | |||
22 | found in include/linux/spi/pxa2xx_spi.h: | 22 | found in include/linux/spi/pxa2xx_spi.h: |
23 | 23 | ||
24 | struct pxa2xx_spi_master { | 24 | struct pxa2xx_spi_master { |
25 | u32 clock_enable; | ||
26 | u16 num_chipselect; | 25 | u16 num_chipselect; |
27 | u8 enable_dma; | 26 | u8 enable_dma; |
28 | }; | 27 | }; |
29 | 28 | ||
30 | The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the | ||
31 | corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See | ||
32 | the "PXA2xx Developer Manual" section "Clocks and Power Management". | ||
33 | |||
34 | The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of | 29 | The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of |
35 | slave device (chips) attached to this SPI master. | 30 | slave device (chips) attached to this SPI master. |
36 | 31 | ||
@@ -57,7 +52,6 @@ static struct resource pxa_spi_nssp_resources[] = { | |||
57 | }; | 52 | }; |
58 | 53 | ||
59 | static struct pxa2xx_spi_master pxa_nssp_master_info = { | 54 | static struct pxa2xx_spi_master pxa_nssp_master_info = { |
60 | .clock_enable = CKEN_NSSP, /* NSSP Peripheral clock */ | ||
61 | .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ | 55 | .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ |
62 | .enable_dma = 1, /* Enables NSSP DMA */ | 56 | .enable_dma = 1, /* Enables NSSP DMA */ |
63 | }; | 57 | }; |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 5851f4c254c1..a7dae60810e8 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/dm9000.h> | 26 | #include <linux/dm9000.h> |
27 | #include <linux/leds.h> | 27 | #include <linux/leds.h> |
28 | #include <linux/rtc-v3020.h> | 28 | #include <linux/rtc-v3020.h> |
29 | #include <linux/pwm.h> | ||
29 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
30 | 31 | ||
31 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
@@ -305,11 +306,14 @@ static inline void cm_x300_init_lcd(void) {} | |||
305 | #endif | 306 | #endif |
306 | 307 | ||
307 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | 308 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
309 | static struct pwm_lookup cm_x300_pwm_lookup[] = { | ||
310 | PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL, 10000, | ||
311 | PWM_POLARITY_NORMAL), | ||
312 | }; | ||
313 | |||
308 | static struct platform_pwm_backlight_data cm_x300_backlight_data = { | 314 | static struct platform_pwm_backlight_data cm_x300_backlight_data = { |
309 | .pwm_id = 2, | ||
310 | .max_brightness = 100, | 315 | .max_brightness = 100, |
311 | .dft_brightness = 100, | 316 | .dft_brightness = 100, |
312 | .pwm_period_ns = 10000, | ||
313 | .enable_gpio = -1, | 317 | .enable_gpio = -1, |
314 | }; | 318 | }; |
315 | 319 | ||
@@ -323,6 +327,7 @@ static struct platform_device cm_x300_backlight_device = { | |||
323 | 327 | ||
324 | static void cm_x300_init_bl(void) | 328 | static void cm_x300_init_bl(void) |
325 | { | 329 | { |
330 | pwm_add_table(cm_x300_pwm_lookup, ARRAY_SIZE(cm_x300_pwm_lookup)); | ||
326 | platform_device_register(&cm_x300_backlight_device); | 331 | platform_device_register(&cm_x300_backlight_device); |
327 | } | 332 | } |
328 | #else | 333 | #else |
diff --git a/arch/arm/mach-pxa/colibri-pxa270-income.c b/arch/arm/mach-pxa/colibri-pxa270-income.c index 3aa264640c9d..db20d25daaab 100644 --- a/arch/arm/mach-pxa/colibri-pxa270-income.c +++ b/arch/arm/mach-pxa/colibri-pxa270-income.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/pwm.h> | ||
23 | #include <linux/pwm_backlight.h> | 24 | #include <linux/pwm_backlight.h> |
24 | #include <linux/i2c/pxa-i2c.h> | 25 | #include <linux/i2c/pxa-i2c.h> |
25 | 26 | ||
@@ -184,11 +185,14 @@ static inline void income_lcd_init(void) {} | |||
184 | * Backlight | 185 | * Backlight |
185 | ******************************************************************************/ | 186 | ******************************************************************************/ |
186 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | 187 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
188 | static struct pwm_lookup income_pwm_lookup[] = { | ||
189 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 1000000, | ||
190 | PWM_POLARITY_NORMAL), | ||
191 | }; | ||
192 | |||
187 | static struct platform_pwm_backlight_data income_backlight_data = { | 193 | static struct platform_pwm_backlight_data income_backlight_data = { |
188 | .pwm_id = 0, | ||
189 | .max_brightness = 0x3ff, | 194 | .max_brightness = 0x3ff, |
190 | .dft_brightness = 0x1ff, | 195 | .dft_brightness = 0x1ff, |
191 | .pwm_period_ns = 1000000, | ||
192 | .enable_gpio = -1, | 196 | .enable_gpio = -1, |
193 | }; | 197 | }; |
194 | 198 | ||
@@ -202,6 +206,7 @@ static struct platform_device income_backlight = { | |||
202 | 206 | ||
203 | static void __init income_pwm_init(void) | 207 | static void __init income_pwm_init(void) |
204 | { | 208 | { |
209 | pwm_add_table(income_pwm_lookup, ARRAY_SIZE(income_pwm_lookup)); | ||
205 | platform_device_register(&income_backlight); | 210 | platform_device_register(&income_backlight); |
206 | } | 211 | } |
207 | #else | 212 | #else |
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index c62473235a13..2a6e0ae2b920 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -395,6 +395,26 @@ static struct resource pxa_ir_resources[] = { | |||
395 | .end = IRQ_ICP, | 395 | .end = IRQ_ICP, |
396 | .flags = IORESOURCE_IRQ, | 396 | .flags = IORESOURCE_IRQ, |
397 | }, | 397 | }, |
398 | [3] = { | ||
399 | .start = 0x40800000, | ||
400 | .end = 0x4080001b, | ||
401 | .flags = IORESOURCE_MEM, | ||
402 | }, | ||
403 | [4] = { | ||
404 | .start = 0x40700000, | ||
405 | .end = 0x40700023, | ||
406 | .flags = IORESOURCE_MEM, | ||
407 | }, | ||
408 | [5] = { | ||
409 | .start = 17, | ||
410 | .end = 17, | ||
411 | .flags = IORESOURCE_DMA, | ||
412 | }, | ||
413 | [6] = { | ||
414 | .start = 18, | ||
415 | .end = 18, | ||
416 | .flags = IORESOURCE_DMA, | ||
417 | }, | ||
398 | }; | 418 | }; |
399 | 419 | ||
400 | struct platform_device pxa_device_ficp = { | 420 | struct platform_device pxa_device_ficp = { |
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index ab93441e596e..9a9c15bfcd34 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/pwm.h> | ||
18 | #include <linux/pwm_backlight.h> | 19 | #include <linux/pwm_backlight.h> |
19 | #include <linux/input.h> | 20 | #include <linux/input.h> |
20 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
@@ -49,11 +50,14 @@ | |||
49 | #define GPIO19_GEN1_CAM_RST 19 | 50 | #define GPIO19_GEN1_CAM_RST 19 |
50 | #define GPIO28_GEN2_CAM_RST 28 | 51 | #define GPIO28_GEN2_CAM_RST 28 |
51 | 52 | ||
53 | static struct pwm_lookup ezx_pwm_lookup[] = { | ||
54 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700, | ||
55 | PWM_POLARITY_NORMAL), | ||
56 | }; | ||
57 | |||
52 | static struct platform_pwm_backlight_data ezx_backlight_data = { | 58 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
53 | .pwm_id = 0, | ||
54 | .max_brightness = 1023, | 59 | .max_brightness = 1023, |
55 | .dft_brightness = 1023, | 60 | .dft_brightness = 1023, |
56 | .pwm_period_ns = 78770, | ||
57 | .enable_gpio = -1, | 61 | .enable_gpio = -1, |
58 | }; | 62 | }; |
59 | 63 | ||
@@ -817,6 +821,7 @@ static void __init a780_init(void) | |||
817 | platform_device_register(&a780_camera); | 821 | platform_device_register(&a780_camera); |
818 | } | 822 | } |
819 | 823 | ||
824 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
820 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 825 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
821 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); | 826 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); |
822 | } | 827 | } |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 5fb41ad6e3bc..b076a835eb21 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -557,10 +557,8 @@ static struct platform_device hx4700_lcd = { | |||
557 | */ | 557 | */ |
558 | 558 | ||
559 | static struct platform_pwm_backlight_data backlight_data = { | 559 | static struct platform_pwm_backlight_data backlight_data = { |
560 | .pwm_id = -1, /* Superseded by pwm_lookup */ | ||
561 | .max_brightness = 200, | 560 | .max_brightness = 200, |
562 | .dft_brightness = 100, | 561 | .dft_brightness = 100, |
563 | .pwm_period_ns = 30923, | ||
564 | .enable_gpio = -1, | 562 | .enable_gpio = -1, |
565 | }; | 563 | }; |
566 | 564 | ||
@@ -630,7 +628,6 @@ static struct spi_board_info tsc2046_board_info[] __initdata = { | |||
630 | 628 | ||
631 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { | 629 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { |
632 | .num_chipselect = 1, | 630 | .num_chipselect = 1, |
633 | .clock_enable = CKEN_SSP2, | ||
634 | .enable_dma = 1, | 631 | .enable_dma = 1, |
635 | }; | 632 | }; |
636 | 633 | ||
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c index 9b0eb0252af6..a1869f9b6219 100644 --- a/arch/arm/mach-pxa/icontrol.c +++ b/arch/arm/mach-pxa/icontrol.c | |||
@@ -116,13 +116,11 @@ static struct spi_board_info mcp251x_board_info[] = { | |||
116 | }; | 116 | }; |
117 | 117 | ||
118 | static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = { | 118 | static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = { |
119 | .clock_enable = CKEN_SSP3, | ||
120 | .num_chipselect = 2, | 119 | .num_chipselect = 2, |
121 | .enable_dma = 1 | 120 | .enable_dma = 1 |
122 | }; | 121 | }; |
123 | 122 | ||
124 | static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = { | 123 | static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = { |
125 | .clock_enable = CKEN_SSP4, | ||
126 | .num_chipselect = 2, | 124 | .num_chipselect = 2, |
127 | .enable_dma = 1 | 125 | .enable_dma = 1 |
128 | }; | 126 | }; |
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h index ba6a6e1d29e9..5f6b850ebe33 100644 --- a/arch/arm/mach-pxa/include/mach/magician.h +++ b/arch/arm/mach-pxa/include/mach/magician.h | |||
@@ -52,9 +52,9 @@ | |||
52 | #define GPIO101_MAGICIAN_KEY_VOL_DOWN 101 | 52 | #define GPIO101_MAGICIAN_KEY_VOL_DOWN 101 |
53 | #define GPIO102_MAGICIAN_KEY_PHONE 102 | 53 | #define GPIO102_MAGICIAN_KEY_PHONE 102 |
54 | #define GPIO103_MAGICIAN_LED_KP 103 | 54 | #define GPIO103_MAGICIAN_LED_KP 103 |
55 | #define GPIO104_MAGICIAN_LCD_POWER_1 104 | 55 | #define GPIO104_MAGICIAN_LCD_VOFF_EN 104 |
56 | #define GPIO105_MAGICIAN_LCD_POWER_2 105 | 56 | #define GPIO105_MAGICIAN_LCD_VON_EN 105 |
57 | #define GPIO106_MAGICIAN_LCD_POWER_3 106 | 57 | #define GPIO106_MAGICIAN_LCD_DCDC_NRESET 106 |
58 | #define GPIO107_MAGICIAN_DS1WM_IRQ 107 | 58 | #define GPIO107_MAGICIAN_DS1WM_IRQ 107 |
59 | #define GPIO108_MAGICIAN_GSM_READY 108 | 59 | #define GPIO108_MAGICIAN_GSM_READY 108 |
60 | #define GPIO114_MAGICIAN_UNKNOWN 114 | 60 | #define GPIO114_MAGICIAN_UNKNOWN 114 |
@@ -78,43 +78,51 @@ | |||
78 | * CPLD EGPIOs | 78 | * CPLD EGPIOs |
79 | */ | 79 | */ |
80 | 80 | ||
81 | #define MAGICIAN_EGPIO_BASE PXA_NR_BUILTIN_GPIO | 81 | #define MAGICIAN_EGPIO_BASE PXA_NR_BUILTIN_GPIO |
82 | #define MAGICIAN_EGPIO(reg,bit) \ | 82 | #define MAGICIAN_EGPIO(reg,bit) \ |
83 | (MAGICIAN_EGPIO_BASE + 8*reg + bit) | 83 | (MAGICIAN_EGPIO_BASE + 8*reg + bit) |
84 | 84 | ||
85 | /* output */ | 85 | /* output */ |
86 | 86 | ||
87 | #define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2) | 87 | #define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2) |
88 | #define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5) | 88 | #define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5) |
89 | #define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6) | 89 | #define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6) |
90 | #define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7) | 90 | #define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7) |
91 | #define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0) | 91 | #define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0) |
92 | #define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1) | 92 | #define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1) |
93 | #define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2) | 93 | #define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2) |
94 | #define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3) | 94 | #define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3) |
95 | #define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4) | 95 | #define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4) |
96 | #define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5) | 96 | #define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5) |
97 | #define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6) | 97 | #define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6) |
98 | #define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7) | 98 | #define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7) |
99 | #define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0) | 99 | #define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0) |
100 | #define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1) | 100 | #define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1) |
101 | #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2) | 101 | #define EGPIO_MAGICIAN_IR_RX_SHUTDOWN MAGICIAN_EGPIO(2, 2) |
102 | #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) | 102 | #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) |
103 | #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) | 103 | #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) |
104 | #define EGPIO_MAGICIAN_BQ24022_ISET2 MAGICIAN_EGPIO(2, 5) | 104 | #define EGPIO_MAGICIAN_BQ24022_ISET2 MAGICIAN_EGPIO(2, 5) |
105 | #define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) | 105 | #define EGPIO_MAGICIAN_NICD_CHARGE MAGICIAN_EGPIO(2, 6) |
106 | #define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) | ||
106 | 107 | ||
107 | /* input */ | 108 | /* input */ |
108 | 109 | ||
109 | #define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0) | 110 | /* USB or AC charger type */ |
110 | #define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1) | 111 | #define EGPIO_MAGICIAN_CABLE_TYPE MAGICIAN_EGPIO(4, 0) |
112 | /* | ||
113 | * Vbus is detected | ||
114 | * FIXME behaves like (6,3), may differ for host/device | ||
115 | */ | ||
116 | #define EGPIO_MAGICIAN_CABLE_VBUS MAGICIAN_EGPIO(4, 1) | ||
111 | 117 | ||
112 | #define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0) | 118 | #define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0) |
113 | #define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1) | 119 | #define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1) |
114 | #define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2) | 120 | #define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2) |
115 | #define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3) | 121 | #define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3) |
116 | #define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4) | 122 | #define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4) |
117 | 123 | ||
118 | #define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1) | 124 | #define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1) |
125 | /* FIXME behaves like (4,1), may differ for host/device */ | ||
126 | #define EGPIO_MAGICIAN_CABLE_INSERTED MAGICIAN_EGPIO(6, 3) | ||
119 | 127 | ||
120 | #endif /* _MAGICIAN_H_ */ | 128 | #endif /* _MAGICIAN_H_ */ |
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h index 599b925a657c..1a4291936c58 100644 --- a/arch/arm/mach-pxa/include/mach/pxa27x.h +++ b/arch/arm/mach-pxa/include/mach/pxa27x.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ | 19 | #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ |
20 | #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ | 20 | #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ |
21 | 21 | ||
22 | extern int __init pxa27x_set_pwrmode(unsigned int mode); | 22 | extern int pxa27x_set_pwrmode(unsigned int mode); |
23 | extern void pxa27x_cpu_pm_enter(suspend_state_t state); | 23 | extern void pxa27x_cpu_pm_enter(suspend_state_t state); |
24 | 24 | ||
25 | #endif /* __MACH_PXA27x_H */ | 25 | #endif /* __MACH_PXA27x_H */ |
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index 4823d972e647..5fcd4f094900 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.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/pwm.h> | ||
26 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
27 | #include <linux/smc91x.h> | 28 | #include <linux/smc91x.h> |
28 | 29 | ||
@@ -271,11 +272,14 @@ static struct platform_device lpd270_flash_device[2] = { | |||
271 | }, | 272 | }, |
272 | }; | 273 | }; |
273 | 274 | ||
275 | static struct pwm_lookup lpd270_pwm_lookup[] = { | ||
276 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770, | ||
277 | PWM_POLARITY_NORMAL), | ||
278 | }; | ||
279 | |||
274 | static struct platform_pwm_backlight_data lpd270_backlight_data = { | 280 | static struct platform_pwm_backlight_data lpd270_backlight_data = { |
275 | .pwm_id = 0, | ||
276 | .max_brightness = 1, | 281 | .max_brightness = 1, |
277 | .dft_brightness = 1, | 282 | .dft_brightness = 1, |
278 | .pwm_period_ns = 78770, | ||
279 | .enable_gpio = -1, | 283 | .enable_gpio = -1, |
280 | }; | 284 | }; |
281 | 285 | ||
@@ -474,6 +478,7 @@ static void __init lpd270_init(void) | |||
474 | */ | 478 | */ |
475 | ARB_CNTRL = ARB_CORE_PARK | 0x234; | 479 | ARB_CNTRL = ARB_CORE_PARK | 0x234; |
476 | 480 | ||
481 | pwm_add_table(lpd270_pwm_lookup, ARRAY_SIZE(lpd270_pwm_lookup)); | ||
477 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 482 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
478 | 483 | ||
479 | pxa_set_ac97_info(NULL); | 484 | pxa_set_ac97_info(NULL); |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index a9761c293028..896b268c3ab7 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -24,8 +24,10 @@ | |||
24 | #include <linux/mfd/htc-pasic3.h> | 24 | #include <linux/mfd/htc-pasic3.h> |
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
27 | #include <linux/pwm.h> | ||
27 | #include <linux/pwm_backlight.h> | 28 | #include <linux/pwm_backlight.h> |
28 | #include <linux/regulator/driver.h> | 29 | #include <linux/regulator/driver.h> |
30 | #include <linux/regulator/fixed.h> | ||
29 | #include <linux/regulator/gpio-regulator.h> | 31 | #include <linux/regulator/gpio-regulator.h> |
30 | #include <linux/regulator/machine.h> | 32 | #include <linux/regulator/machine.h> |
31 | #include <linux/usb/gpio_vbus.h> | 33 | #include <linux/usb/gpio_vbus.h> |
@@ -43,6 +45,12 @@ | |||
43 | #include <linux/platform_data/irda-pxaficp.h> | 45 | #include <linux/platform_data/irda-pxaficp.h> |
44 | #include <linux/platform_data/usb-ohci-pxa27x.h> | 46 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
45 | 47 | ||
48 | #include <linux/regulator/max1586.h> | ||
49 | |||
50 | #include <linux/platform_data/pxa2xx_udc.h> | ||
51 | #include <mach/udc.h> | ||
52 | #include <mach/pxa27x-udc.h> | ||
53 | |||
46 | #include "devices.h" | 54 | #include "devices.h" |
47 | #include "generic.h" | 55 | #include "generic.h" |
48 | 56 | ||
@@ -52,36 +60,36 @@ static unsigned long magician_pin_config[] __initdata = { | |||
52 | GPIO20_nSDCS_2, | 60 | GPIO20_nSDCS_2, |
53 | GPIO21_nSDCS_3, | 61 | GPIO21_nSDCS_3, |
54 | GPIO15_nCS_1, | 62 | GPIO15_nCS_1, |
55 | GPIO78_nCS_2, /* PASIC3 */ | 63 | GPIO78_nCS_2, /* PASIC3 */ |
56 | GPIO79_nCS_3, /* EGPIO CPLD */ | 64 | GPIO79_nCS_3, /* EGPIO CPLD */ |
57 | GPIO80_nCS_4, | 65 | GPIO80_nCS_4, |
58 | GPIO33_nCS_5, | 66 | GPIO33_nCS_5, |
59 | 67 | ||
60 | /* I2C */ | 68 | /* I2C UDA1380 + OV9640 */ |
61 | GPIO117_I2C_SCL, | 69 | GPIO117_I2C_SCL, |
62 | GPIO118_I2C_SDA, | 70 | GPIO118_I2C_SDA, |
63 | 71 | ||
64 | /* PWM 0 */ | 72 | /* PWM 0 - LCD backlight */ |
65 | GPIO16_PWM0_OUT, | 73 | GPIO16_PWM0_OUT, |
66 | 74 | ||
67 | /* I2S */ | 75 | /* I2S UDA1380 capture */ |
68 | GPIO28_I2S_BITCLK_OUT, | 76 | GPIO28_I2S_BITCLK_OUT, |
69 | GPIO29_I2S_SDATA_IN, | 77 | GPIO29_I2S_SDATA_IN, |
70 | GPIO31_I2S_SYNC, | 78 | GPIO31_I2S_SYNC, |
71 | GPIO113_I2S_SYSCLK, | 79 | GPIO113_I2S_SYSCLK, |
72 | 80 | ||
73 | /* SSP 1 */ | 81 | /* SSP 1 UDA1380 playback */ |
74 | GPIO23_SSP1_SCLK, | 82 | GPIO23_SSP1_SCLK, |
75 | GPIO24_SSP1_SFRM, | 83 | GPIO24_SSP1_SFRM, |
76 | GPIO25_SSP1_TXD, | 84 | GPIO25_SSP1_TXD, |
77 | 85 | ||
78 | /* SSP 2 */ | 86 | /* SSP 2 TSC2046 touchscreen */ |
79 | GPIO19_SSP2_SCLK, | 87 | GPIO19_SSP2_SCLK, |
80 | GPIO14_SSP2_SFRM, | 88 | GPIO14_SSP2_SFRM, |
81 | GPIO89_SSP2_TXD, | 89 | GPIO89_SSP2_TXD, |
82 | GPIO88_SSP2_RXD, | 90 | GPIO88_SSP2_RXD, |
83 | 91 | ||
84 | /* MMC */ | 92 | /* MMC/SD/SDHC slot */ |
85 | GPIO32_MMC_CLK, | 93 | GPIO32_MMC_CLK, |
86 | GPIO92_MMC_DAT_0, | 94 | GPIO92_MMC_DAT_0, |
87 | GPIO109_MMC_DAT_1, | 95 | GPIO109_MMC_DAT_1, |
@@ -92,7 +100,7 @@ static unsigned long magician_pin_config[] __initdata = { | |||
92 | /* LCD */ | 100 | /* LCD */ |
93 | GPIOxx_LCD_TFT_16BPP, | 101 | GPIOxx_LCD_TFT_16BPP, |
94 | 102 | ||
95 | /* QCI */ | 103 | /* QCI camera interface */ |
96 | GPIO12_CIF_DD_7, | 104 | GPIO12_CIF_DD_7, |
97 | GPIO17_CIF_DD_6, | 105 | GPIO17_CIF_DD_6, |
98 | GPIO50_CIF_DD_3, | 106 | GPIO50_CIF_DD_3, |
@@ -120,12 +128,13 @@ static unsigned long magician_pin_config[] __initdata = { | |||
120 | }; | 128 | }; |
121 | 129 | ||
122 | /* | 130 | /* |
123 | * IRDA | 131 | * IrDA |
124 | */ | 132 | */ |
125 | 133 | ||
126 | static struct pxaficp_platform_data magician_ficp_info = { | 134 | static struct pxaficp_platform_data magician_ficp_info = { |
127 | .gpio_pwdown = GPIO83_MAGICIAN_nIR_EN, | 135 | .gpio_pwdown = GPIO83_MAGICIAN_nIR_EN, |
128 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 136 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
137 | .gpio_pwdown_inverted = 0, | ||
129 | }; | 138 | }; |
130 | 139 | ||
131 | /* | 140 | /* |
@@ -134,11 +143,11 @@ static struct pxaficp_platform_data magician_ficp_info = { | |||
134 | 143 | ||
135 | #define INIT_KEY(_code, _gpio, _desc) \ | 144 | #define INIT_KEY(_code, _gpio, _desc) \ |
136 | { \ | 145 | { \ |
137 | .code = KEY_##_code, \ | 146 | .code = KEY_##_code, \ |
138 | .gpio = _gpio, \ | 147 | .gpio = _gpio, \ |
139 | .desc = _desc, \ | 148 | .desc = _desc, \ |
140 | .type = EV_KEY, \ | 149 | .type = EV_KEY, \ |
141 | .wakeup = 1, \ | 150 | .wakeup = 1, \ |
142 | } | 151 | } |
143 | 152 | ||
144 | static struct gpio_keys_button magician_button_table[] = { | 153 | static struct gpio_keys_button magician_button_table[] = { |
@@ -160,164 +169,162 @@ static struct gpio_keys_button magician_button_table[] = { | |||
160 | }; | 169 | }; |
161 | 170 | ||
162 | static struct gpio_keys_platform_data gpio_keys_data = { | 171 | static struct gpio_keys_platform_data gpio_keys_data = { |
163 | .buttons = magician_button_table, | 172 | .buttons = magician_button_table, |
164 | .nbuttons = ARRAY_SIZE(magician_button_table), | 173 | .nbuttons = ARRAY_SIZE(magician_button_table), |
165 | }; | 174 | }; |
166 | 175 | ||
167 | static struct platform_device gpio_keys = { | 176 | static struct platform_device gpio_keys = { |
168 | .name = "gpio-keys", | 177 | .name = "gpio-keys", |
169 | .dev = { | 178 | .dev = { |
170 | .platform_data = &gpio_keys_data, | 179 | .platform_data = &gpio_keys_data, |
171 | }, | 180 | }, |
172 | .id = -1, | 181 | .id = -1, |
173 | }; | 182 | }; |
174 | 183 | ||
175 | |||
176 | /* | 184 | /* |
177 | * EGPIO (Xilinx CPLD) | 185 | * EGPIO (Xilinx CPLD) |
178 | * | 186 | * |
179 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input | 187 | * 32-bit aligned 8-bit registers |
188 | * 16 possible registers (reg windows size), only 7 used: | ||
189 | * 3x output, 1x irq, 3x input | ||
180 | */ | 190 | */ |
181 | 191 | ||
182 | static struct resource egpio_resources[] = { | 192 | static struct resource egpio_resources[] = { |
183 | [0] = { | 193 | [0] = { |
184 | .start = PXA_CS3_PHYS, | 194 | .start = PXA_CS3_PHYS, |
185 | .end = PXA_CS3_PHYS + 0x20 - 1, | 195 | .end = PXA_CS3_PHYS + 0x20 - 1, |
186 | .flags = IORESOURCE_MEM, | 196 | .flags = IORESOURCE_MEM, |
187 | }, | 197 | }, |
188 | [1] = { | 198 | [1] = { |
189 | .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), | 199 | .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), |
190 | .end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), | 200 | .end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ), |
191 | .flags = IORESOURCE_IRQ, | 201 | .flags = IORESOURCE_IRQ, |
192 | }, | 202 | }, |
193 | }; | 203 | }; |
194 | 204 | ||
195 | static struct htc_egpio_chip egpio_chips[] = { | 205 | static struct htc_egpio_chip egpio_chips[] = { |
196 | [0] = { | 206 | [0] = { |
197 | .reg_start = 0, | 207 | .reg_start = 0, |
198 | .gpio_base = MAGICIAN_EGPIO(0, 0), | 208 | .gpio_base = MAGICIAN_EGPIO(0, 0), |
199 | .num_gpios = 24, | 209 | .num_gpios = 24, |
200 | .direction = HTC_EGPIO_OUTPUT, | 210 | .direction = HTC_EGPIO_OUTPUT, |
201 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ | 211 | /* |
212 | * Depends on modules configuration | ||
213 | */ | ||
214 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ | ||
202 | }, | 215 | }, |
203 | [1] = { | 216 | [1] = { |
204 | .reg_start = 4, | 217 | .reg_start = 4, |
205 | .gpio_base = MAGICIAN_EGPIO(4, 0), | 218 | .gpio_base = MAGICIAN_EGPIO(4, 0), |
206 | .num_gpios = 24, | 219 | .num_gpios = 24, |
207 | .direction = HTC_EGPIO_INPUT, | 220 | .direction = HTC_EGPIO_INPUT, |
208 | }, | 221 | }, |
209 | }; | 222 | }; |
210 | 223 | ||
211 | static struct htc_egpio_platform_data egpio_info = { | 224 | static struct htc_egpio_platform_data egpio_info = { |
212 | .reg_width = 8, | 225 | .reg_width = 8, |
213 | .bus_width = 32, | 226 | .bus_width = 32, |
214 | .irq_base = IRQ_BOARD_START, | 227 | .irq_base = IRQ_BOARD_START, |
215 | .num_irqs = 4, | 228 | .num_irqs = 4, |
216 | .ack_register = 3, | 229 | .ack_register = 3, |
217 | .chip = egpio_chips, | 230 | .chip = egpio_chips, |
218 | .num_chips = ARRAY_SIZE(egpio_chips), | 231 | .num_chips = ARRAY_SIZE(egpio_chips), |
219 | }; | 232 | }; |
220 | 233 | ||
221 | static struct platform_device egpio = { | 234 | static struct platform_device egpio = { |
222 | .name = "htc-egpio", | 235 | .name = "htc-egpio", |
223 | .id = -1, | 236 | .id = -1, |
224 | .resource = egpio_resources, | 237 | .resource = egpio_resources, |
225 | .num_resources = ARRAY_SIZE(egpio_resources), | 238 | .num_resources = ARRAY_SIZE(egpio_resources), |
226 | .dev = { | 239 | .dev = { |
227 | .platform_data = &egpio_info, | 240 | .platform_data = &egpio_info, |
228 | }, | 241 | }, |
229 | }; | 242 | }; |
230 | 243 | ||
231 | /* | 244 | /* |
232 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV | 245 | * PXAFB LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
233 | */ | 246 | */ |
234 | 247 | ||
235 | static struct pxafb_mode_info toppoly_modes[] = { | 248 | static struct pxafb_mode_info toppoly_modes[] = { |
236 | { | 249 | { |
237 | .pixclock = 96153, | 250 | .pixclock = 96153, |
238 | .bpp = 16, | 251 | .bpp = 16, |
239 | .xres = 240, | 252 | .xres = 240, |
240 | .yres = 320, | 253 | .yres = 320, |
241 | .hsync_len = 11, | 254 | .hsync_len = 11, |
242 | .vsync_len = 3, | 255 | .vsync_len = 3, |
243 | .left_margin = 19, | 256 | .left_margin = 19, |
244 | .upper_margin = 2, | 257 | .upper_margin = 2, |
245 | .right_margin = 10, | 258 | .right_margin = 10, |
246 | .lower_margin = 2, | 259 | .lower_margin = 2, |
247 | .sync = 0, | 260 | .sync = 0, |
248 | }, | 261 | }, |
249 | }; | 262 | }; |
250 | 263 | ||
251 | static struct pxafb_mode_info samsung_modes[] = { | 264 | static struct pxafb_mode_info samsung_modes[] = { |
252 | { | 265 | { |
253 | .pixclock = 96153, | 266 | .pixclock = 226469, |
254 | .bpp = 16, | 267 | .bpp = 16, |
255 | .xres = 240, | 268 | .xres = 240, |
256 | .yres = 320, | 269 | .yres = 320, |
257 | .hsync_len = 8, | 270 | .hsync_len = 8, |
258 | .vsync_len = 4, | 271 | .vsync_len = 4, |
259 | .left_margin = 9, | 272 | .left_margin = 9, |
260 | .upper_margin = 4, | 273 | .upper_margin = 4, |
261 | .right_margin = 9, | 274 | .right_margin = 9, |
262 | .lower_margin = 4, | 275 | .lower_margin = 4, |
263 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | 276 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
264 | }, | 277 | }, |
265 | }; | 278 | }; |
266 | 279 | ||
267 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) | 280 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) |
268 | { | 281 | { |
269 | pr_debug("Toppoly LCD power\n"); | 282 | pr_debug("Toppoly LCD power: %s\n", on ? "on" : "off"); |
270 | 283 | ||
271 | if (on) { | 284 | if (on) { |
272 | pr_debug("on\n"); | ||
273 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); | 285 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); |
274 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | 286 | gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1); |
275 | udelay(2000); | 287 | udelay(2000); |
276 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | 288 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
277 | udelay(2000); | 289 | udelay(2000); |
278 | /* FIXME: enable LCDC here */ | 290 | /* FIXME: enable LCDC here */ |
279 | udelay(2000); | 291 | udelay(2000); |
280 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | 292 | gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1); |
281 | udelay(2000); | 293 | udelay(2000); |
282 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | 294 | gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1); |
283 | } else { | 295 | } else { |
284 | pr_debug("off\n"); | ||
285 | msleep(15); | 296 | msleep(15); |
286 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | 297 | gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0); |
287 | udelay(500); | 298 | udelay(500); |
288 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | 299 | gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0); |
289 | udelay(1000); | 300 | udelay(1000); |
290 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | 301 | gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0); |
291 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | 302 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
292 | } | 303 | } |
293 | } | 304 | } |
294 | 305 | ||
295 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) | 306 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) |
296 | { | 307 | { |
297 | pr_debug("Samsung LCD power\n"); | 308 | pr_debug("Samsung LCD power: %s\n", on ? "on" : "off"); |
298 | 309 | ||
299 | if (on) { | 310 | if (on) { |
300 | pr_debug("on\n"); | ||
301 | if (system_rev < 3) | 311 | if (system_rev < 3) |
302 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); | 312 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); |
303 | else | 313 | else |
304 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | 314 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
305 | mdelay(10); | 315 | mdelay(6); |
306 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | 316 | gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1); |
307 | mdelay(10); | 317 | mdelay(6); /* Avdd -> Voff >5ms */ |
308 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | 318 | gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1); |
309 | mdelay(30); | 319 | mdelay(16); /* Voff -> Von >(5+10)ms */ |
310 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | 320 | gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1); |
311 | mdelay(10); | ||
312 | } else { | 321 | } else { |
313 | pr_debug("off\n"); | 322 | gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0); |
314 | mdelay(10); | 323 | mdelay(16); |
315 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | 324 | gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0); |
316 | mdelay(30); | 325 | mdelay(6); |
317 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | 326 | gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0); |
318 | mdelay(10); | 327 | mdelay(6); |
319 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
320 | mdelay(10); | ||
321 | if (system_rev < 3) | 328 | if (system_rev < 3) |
322 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); | 329 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
323 | else | 330 | else |
@@ -326,29 +333,43 @@ static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) | |||
326 | } | 333 | } |
327 | 334 | ||
328 | static struct pxafb_mach_info toppoly_info = { | 335 | static struct pxafb_mach_info toppoly_info = { |
329 | .modes = toppoly_modes, | 336 | .modes = toppoly_modes, |
330 | .num_modes = 1, | 337 | .num_modes = 1, |
331 | .fixed_modes = 1, | 338 | .fixed_modes = 1, |
332 | .lcd_conn = LCD_COLOR_TFT_16BPP, | 339 | .lcd_conn = LCD_COLOR_TFT_16BPP, |
333 | .pxafb_lcd_power = toppoly_lcd_power, | 340 | .pxafb_lcd_power = toppoly_lcd_power, |
334 | }; | 341 | }; |
335 | 342 | ||
336 | static struct pxafb_mach_info samsung_info = { | 343 | static struct pxafb_mach_info samsung_info = { |
337 | .modes = samsung_modes, | 344 | .modes = samsung_modes, |
338 | .num_modes = 1, | 345 | .num_modes = 1, |
339 | .fixed_modes = 1, | 346 | .fixed_modes = 1, |
340 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\ | 347 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL | |
341 | LCD_ALTERNATE_MAPPING, | 348 | LCD_ALTERNATE_MAPPING, |
342 | .pxafb_lcd_power = samsung_lcd_power, | 349 | .pxafb_lcd_power = samsung_lcd_power, |
343 | }; | 350 | }; |
344 | 351 | ||
345 | /* | 352 | /* |
346 | * Backlight | 353 | * Backlight |
347 | */ | 354 | */ |
348 | 355 | ||
356 | static struct pwm_lookup magician_pwm_lookup[] = { | ||
357 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 30923, | ||
358 | PWM_POLARITY_NORMAL), | ||
359 | }; | ||
360 | |||
361 | /* | ||
362 | * fixed regulator for pwm_backlight | ||
363 | */ | ||
364 | |||
365 | static struct regulator_consumer_supply pwm_backlight_supply[] = { | ||
366 | REGULATOR_SUPPLY("power", "pwm_backlight"), | ||
367 | }; | ||
368 | |||
369 | |||
349 | static struct gpio magician_bl_gpios[] = { | 370 | static struct gpio magician_bl_gpios[] = { |
350 | { EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" }, | 371 | { EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" }, |
351 | { EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" }, | 372 | { EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" }, |
352 | }; | 373 | }; |
353 | 374 | ||
354 | static int magician_backlight_init(struct device *dev) | 375 | static int magician_backlight_init(struct device *dev) |
@@ -358,6 +379,7 @@ static int magician_backlight_init(struct device *dev) | |||
358 | 379 | ||
359 | static int magician_backlight_notify(struct device *dev, int brightness) | 380 | static int magician_backlight_notify(struct device *dev, int brightness) |
360 | { | 381 | { |
382 | pr_debug("Brightness = %i\n", brightness); | ||
361 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); | 383 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); |
362 | if (brightness >= 200) { | 384 | if (brightness >= 200) { |
363 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); | 385 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); |
@@ -373,28 +395,33 @@ static void magician_backlight_exit(struct device *dev) | |||
373 | gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios)); | 395 | gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios)); |
374 | } | 396 | } |
375 | 397 | ||
398 | /* | ||
399 | * LCD PWM backlight (main) | ||
400 | * | ||
401 | * MP1521 frequency should be: | ||
402 | * 100-400 Hz = 2 .5*10^6 - 10 *10^6 ns | ||
403 | */ | ||
404 | |||
376 | static struct platform_pwm_backlight_data backlight_data = { | 405 | static struct platform_pwm_backlight_data backlight_data = { |
377 | .pwm_id = 0, | 406 | .max_brightness = 272, |
378 | .max_brightness = 272, | 407 | .dft_brightness = 100, |
379 | .dft_brightness = 100, | 408 | .enable_gpio = -1, |
380 | .pwm_period_ns = 30923, | 409 | .init = magician_backlight_init, |
381 | .enable_gpio = -1, | 410 | .notify = magician_backlight_notify, |
382 | .init = magician_backlight_init, | 411 | .exit = magician_backlight_exit, |
383 | .notify = magician_backlight_notify, | ||
384 | .exit = magician_backlight_exit, | ||
385 | }; | 412 | }; |
386 | 413 | ||
387 | static struct platform_device backlight = { | 414 | static struct platform_device backlight = { |
388 | .name = "pwm-backlight", | 415 | .name = "pwm-backlight", |
389 | .id = -1, | 416 | .id = -1, |
390 | .dev = { | 417 | .dev = { |
391 | .parent = &pxa27x_device_pwm0.dev, | 418 | .parent = &pxa27x_device_pwm0.dev, |
392 | .platform_data = &backlight_data, | 419 | .platform_data = &backlight_data, |
393 | }, | 420 | }, |
394 | }; | 421 | }; |
395 | 422 | ||
396 | /* | 423 | /* |
397 | * LEDs | 424 | * GPIO LEDs, Phone keys backlight, vibra |
398 | */ | 425 | */ |
399 | 426 | ||
400 | static struct gpio_led gpio_leds[] = { | 427 | static struct gpio_led gpio_leds[] = { |
@@ -416,69 +443,32 @@ static struct gpio_led_platform_data gpio_led_info = { | |||
416 | }; | 443 | }; |
417 | 444 | ||
418 | static struct platform_device leds_gpio = { | 445 | static struct platform_device leds_gpio = { |
419 | .name = "leds-gpio", | 446 | .name = "leds-gpio", |
420 | .id = -1, | 447 | .id = -1, |
421 | .dev = { | 448 | .dev = { |
422 | .platform_data = &gpio_led_info, | 449 | .platform_data = &gpio_led_info, |
423 | }, | 450 | }, |
424 | }; | 451 | }; |
425 | 452 | ||
426 | static struct pasic3_led pasic3_leds[] = { | ||
427 | { | ||
428 | .led = { | ||
429 | .name = "magician:red", | ||
430 | .default_trigger = "ds2760-battery.0-charging", | ||
431 | }, | ||
432 | .hw_num = 0, | ||
433 | .bit2 = PASIC3_BIT2_LED0, | ||
434 | .mask = PASIC3_MASK_LED0, | ||
435 | }, | ||
436 | { | ||
437 | .led = { | ||
438 | .name = "magician:green", | ||
439 | .default_trigger = "ds2760-battery.0-charging-or-full", | ||
440 | }, | ||
441 | .hw_num = 1, | ||
442 | .bit2 = PASIC3_BIT2_LED1, | ||
443 | .mask = PASIC3_MASK_LED1, | ||
444 | }, | ||
445 | { | ||
446 | .led = { | ||
447 | .name = "magician:blue", | ||
448 | .default_trigger = "bluetooth", | ||
449 | }, | ||
450 | .hw_num = 2, | ||
451 | .bit2 = PASIC3_BIT2_LED2, | ||
452 | .mask = PASIC3_MASK_LED2, | ||
453 | }, | ||
454 | }; | ||
455 | |||
456 | static struct pasic3_leds_machinfo pasic3_leds_info = { | ||
457 | .num_leds = ARRAY_SIZE(pasic3_leds), | ||
458 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, | ||
459 | .leds = pasic3_leds, | ||
460 | }; | ||
461 | |||
462 | /* | 453 | /* |
463 | * PASIC3 with DS1WM | 454 | * PASIC3 with DS1WM |
464 | */ | 455 | */ |
465 | 456 | ||
466 | static struct resource pasic3_resources[] = { | 457 | static struct resource pasic3_resources[] = { |
467 | [0] = { | 458 | [0] = { |
468 | .start = PXA_CS2_PHYS, | 459 | .start = PXA_CS2_PHYS, |
469 | .end = PXA_CS2_PHYS + 0x1b, | 460 | .end = PXA_CS2_PHYS + 0x1b, |
470 | .flags = IORESOURCE_MEM, | 461 | .flags = IORESOURCE_MEM, |
471 | }, | 462 | }, |
472 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ | 463 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ |
473 | [1] = { | 464 | [1] = { |
474 | .start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), | 465 | .start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), |
475 | .end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), | 466 | .end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ), |
476 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | 467 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
477 | } | 468 | } |
478 | }; | 469 | }; |
479 | 470 | ||
480 | static struct pasic3_platform_data pasic3_platform_data = { | 471 | static struct pasic3_platform_data pasic3_platform_data = { |
481 | .led_pdata = &pasic3_leds_info, | ||
482 | .clock_rate = 4000000, | 472 | .clock_rate = 4000000, |
483 | }; | 473 | }; |
484 | 474 | ||
@@ -493,25 +483,42 @@ static struct platform_device pasic3 = { | |||
493 | }; | 483 | }; |
494 | 484 | ||
495 | /* | 485 | /* |
496 | * USB "Transceiver" | 486 | * PXA UDC |
487 | */ | ||
488 | |||
489 | static void magician_udc_command(int cmd) | ||
490 | { | ||
491 | if (cmd == PXA2XX_UDC_CMD_CONNECT) | ||
492 | UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE; | ||
493 | else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) | ||
494 | UP2OCR &= ~(UP2OCR_DPPUE | UP2OCR_DPPUBE); | ||
495 | } | ||
496 | |||
497 | static struct pxa2xx_udc_mach_info magician_udc_info __initdata = { | ||
498 | .udc_command = magician_udc_command, | ||
499 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, | ||
500 | }; | ||
501 | |||
502 | /* | ||
503 | * USB device VBus detection | ||
497 | */ | 504 | */ |
498 | 505 | ||
499 | static struct resource gpio_vbus_resource = { | 506 | static struct resource gpio_vbus_resource = { |
500 | .flags = IORESOURCE_IRQ, | 507 | .flags = IORESOURCE_IRQ, |
501 | .start = IRQ_MAGICIAN_VBUS, | 508 | .start = IRQ_MAGICIAN_VBUS, |
502 | .end = IRQ_MAGICIAN_VBUS, | 509 | .end = IRQ_MAGICIAN_VBUS, |
503 | }; | 510 | }; |
504 | 511 | ||
505 | static struct gpio_vbus_mach_info gpio_vbus_info = { | 512 | static struct gpio_vbus_mach_info gpio_vbus_info = { |
506 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, | 513 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, |
507 | .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, | 514 | .gpio_vbus = EGPIO_MAGICIAN_CABLE_VBUS, |
508 | }; | 515 | }; |
509 | 516 | ||
510 | static struct platform_device gpio_vbus = { | 517 | static struct platform_device gpio_vbus = { |
511 | .name = "gpio-vbus", | 518 | .name = "gpio-vbus", |
512 | .id = -1, | 519 | .id = -1, |
513 | .num_resources = 1, | 520 | .num_resources = 1, |
514 | .resource = &gpio_vbus_resource, | 521 | .resource = &gpio_vbus_resource, |
515 | .dev = { | 522 | .dev = { |
516 | .platform_data = &gpio_vbus_info, | 523 | .platform_data = &gpio_vbus_info, |
517 | }, | 524 | }, |
@@ -521,19 +528,60 @@ static struct platform_device gpio_vbus = { | |||
521 | * External power | 528 | * External power |
522 | */ | 529 | */ |
523 | 530 | ||
524 | static int power_supply_init(struct device *dev) | 531 | static int magician_supply_init(struct device *dev) |
532 | { | ||
533 | int ret = -1; | ||
534 | |||
535 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable is AC charger"); | ||
536 | if (ret) { | ||
537 | pr_err("Cannot request AC/USB charger GPIO (%i)\n", ret); | ||
538 | goto err_ac; | ||
539 | } | ||
540 | |||
541 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_INSERTED, "Cable inserted"); | ||
542 | if (ret) { | ||
543 | pr_err("Cannot request cable detection GPIO (%i)\n", ret); | ||
544 | goto err_usb; | ||
545 | } | ||
546 | |||
547 | return 0; | ||
548 | |||
549 | err_usb: | ||
550 | gpio_free(EGPIO_MAGICIAN_CABLE_TYPE); | ||
551 | err_ac: | ||
552 | return ret; | ||
553 | } | ||
554 | |||
555 | static void magician_set_charge(int flags) | ||
525 | { | 556 | { |
526 | return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); | 557 | if (flags & PDA_POWER_CHARGE_AC) { |
558 | pr_debug("Charging from AC\n"); | ||
559 | gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1); | ||
560 | } else if (flags & PDA_POWER_CHARGE_USB) { | ||
561 | pr_debug("Charging from USB\n"); | ||
562 | gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1); | ||
563 | } else { | ||
564 | pr_debug("Charging disabled\n"); | ||
565 | gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 0); | ||
566 | } | ||
527 | } | 567 | } |
528 | 568 | ||
529 | static int magician_is_ac_online(void) | 569 | static int magician_is_ac_online(void) |
530 | { | 570 | { |
531 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | 571 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) && |
572 | gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* AC=1 */ | ||
532 | } | 573 | } |
533 | 574 | ||
534 | static void power_supply_exit(struct device *dev) | 575 | static int magician_is_usb_online(void) |
535 | { | 576 | { |
536 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); | 577 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) && |
578 | (!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */ | ||
579 | } | ||
580 | |||
581 | static void magician_supply_exit(struct device *dev) | ||
582 | { | ||
583 | gpio_free(EGPIO_MAGICIAN_CABLE_INSERTED); | ||
584 | gpio_free(EGPIO_MAGICIAN_CABLE_TYPE); | ||
537 | } | 585 | } |
538 | 586 | ||
539 | static char *magician_supplicants[] = { | 587 | static char *magician_supplicants[] = { |
@@ -541,38 +589,40 @@ static char *magician_supplicants[] = { | |||
541 | }; | 589 | }; |
542 | 590 | ||
543 | static struct pda_power_pdata power_supply_info = { | 591 | static struct pda_power_pdata power_supply_info = { |
544 | .init = power_supply_init, | 592 | .init = magician_supply_init, |
545 | .is_ac_online = magician_is_ac_online, | 593 | .exit = magician_supply_exit, |
546 | .exit = power_supply_exit, | 594 | .is_ac_online = magician_is_ac_online, |
547 | .supplied_to = magician_supplicants, | 595 | .is_usb_online = magician_is_usb_online, |
548 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | 596 | .set_charge = magician_set_charge, |
597 | .supplied_to = magician_supplicants, | ||
598 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | ||
549 | }; | 599 | }; |
550 | 600 | ||
551 | static struct resource power_supply_resources[] = { | 601 | static struct resource power_supply_resources[] = { |
552 | [0] = { | 602 | [0] = { |
553 | .name = "ac", | 603 | .name = "ac", |
554 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | | 604 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
555 | IORESOURCE_IRQ_LOWEDGE, | 605 | IORESOURCE_IRQ_LOWEDGE, |
556 | .start = IRQ_MAGICIAN_VBUS, | 606 | .start = IRQ_MAGICIAN_VBUS, |
557 | .end = IRQ_MAGICIAN_VBUS, | 607 | .end = IRQ_MAGICIAN_VBUS, |
558 | }, | 608 | }, |
559 | [1] = { | 609 | [1] = { |
560 | .name = "usb", | 610 | .name = "usb", |
561 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | | 611 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
562 | IORESOURCE_IRQ_LOWEDGE, | 612 | IORESOURCE_IRQ_LOWEDGE, |
563 | .start = IRQ_MAGICIAN_VBUS, | 613 | .start = IRQ_MAGICIAN_VBUS, |
564 | .end = IRQ_MAGICIAN_VBUS, | 614 | .end = IRQ_MAGICIAN_VBUS, |
565 | }, | 615 | }, |
566 | }; | 616 | }; |
567 | 617 | ||
568 | static struct platform_device power_supply = { | 618 | static struct platform_device power_supply = { |
569 | .name = "pda-power", | 619 | .name = "pda-power", |
570 | .id = -1, | 620 | .id = -1, |
571 | .dev = { | 621 | .dev = { |
572 | .platform_data = &power_supply_info, | 622 | .platform_data = &power_supply_info, |
573 | }, | 623 | }, |
574 | .resource = power_supply_resources, | 624 | .resource = power_supply_resources, |
575 | .num_resources = ARRAY_SIZE(power_supply_resources), | 625 | .num_resources = ARRAY_SIZE(power_supply_resources), |
576 | }; | 626 | }; |
577 | 627 | ||
578 | /* | 628 | /* |
@@ -586,11 +636,12 @@ static struct regulator_consumer_supply bq24022_consumers[] = { | |||
586 | 636 | ||
587 | static struct regulator_init_data bq24022_init_data = { | 637 | static struct regulator_init_data bq24022_init_data = { |
588 | .constraints = { | 638 | .constraints = { |
589 | .max_uA = 500000, | 639 | .max_uA = 500000, |
590 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS, | 640 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT | |
641 | REGULATOR_CHANGE_STATUS, | ||
591 | }, | 642 | }, |
592 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), | 643 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), |
593 | .consumer_supplies = bq24022_consumers, | 644 | .consumer_supplies = bq24022_consumers, |
594 | }; | 645 | }; |
595 | 646 | ||
596 | static struct gpio bq24022_gpios[] = { | 647 | static struct gpio bq24022_gpios[] = { |
@@ -603,39 +654,85 @@ static struct gpio_regulator_state bq24022_states[] = { | |||
603 | }; | 654 | }; |
604 | 655 | ||
605 | static struct gpio_regulator_config bq24022_info = { | 656 | static struct gpio_regulator_config bq24022_info = { |
606 | .supply_name = "bq24022", | 657 | .supply_name = "bq24022", |
607 | 658 | ||
608 | .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | 659 | .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, |
609 | .enable_high = 0, | 660 | .enable_high = 0, |
610 | .enabled_at_boot = 0, | 661 | .enabled_at_boot = 1, |
611 | 662 | ||
612 | .gpios = bq24022_gpios, | 663 | .gpios = bq24022_gpios, |
613 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | 664 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), |
614 | 665 | ||
615 | .states = bq24022_states, | 666 | .states = bq24022_states, |
616 | .nr_states = ARRAY_SIZE(bq24022_states), | 667 | .nr_states = ARRAY_SIZE(bq24022_states), |
617 | 668 | ||
618 | .type = REGULATOR_CURRENT, | 669 | .type = REGULATOR_CURRENT, |
619 | .init_data = &bq24022_init_data, | 670 | .init_data = &bq24022_init_data, |
620 | }; | 671 | }; |
621 | 672 | ||
622 | static struct platform_device bq24022 = { | 673 | static struct platform_device bq24022 = { |
623 | .name = "gpio-regulator", | 674 | .name = "gpio-regulator", |
624 | .id = -1, | 675 | .id = -1, |
625 | .dev = { | 676 | .dev = { |
626 | .platform_data = &bq24022_info, | 677 | .platform_data = &bq24022_info, |
627 | }, | 678 | }, |
628 | }; | 679 | }; |
629 | 680 | ||
630 | /* | 681 | /* |
682 | * Vcore regulator MAX1587A | ||
683 | */ | ||
684 | |||
685 | static struct regulator_consumer_supply magician_max1587a_consumers[] = { | ||
686 | REGULATOR_SUPPLY("vcc_core", NULL), | ||
687 | }; | ||
688 | |||
689 | static struct regulator_init_data magician_max1587a_v3_info = { | ||
690 | .constraints = { | ||
691 | .name = "vcc_core range", | ||
692 | .min_uV = 700000, | ||
693 | .max_uV = 1475000, | ||
694 | .always_on = 1, | ||
695 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
696 | }, | ||
697 | .consumer_supplies = magician_max1587a_consumers, | ||
698 | .num_consumer_supplies = ARRAY_SIZE(magician_max1587a_consumers), | ||
699 | }; | ||
700 | |||
701 | static struct max1586_subdev_data magician_max1587a_subdevs[] = { | ||
702 | { | ||
703 | .name = "vcc_core", | ||
704 | .id = MAX1586_V3, | ||
705 | .platform_data = &magician_max1587a_v3_info, | ||
706 | } | ||
707 | }; | ||
708 | |||
709 | static struct max1586_platform_data magician_max1587a_info = { | ||
710 | .subdevs = magician_max1587a_subdevs, | ||
711 | .num_subdevs = ARRAY_SIZE(magician_max1587a_subdevs), | ||
712 | /* | ||
713 | * NOTICE measured directly on the PCB (board_id == 0x3a), but | ||
714 | * if R24 is present, it will boost the voltage | ||
715 | * (write 1.475V, get 1.645V and smoke) | ||
716 | */ | ||
717 | .v3_gain = MAX1586_GAIN_NO_R24, | ||
718 | }; | ||
719 | |||
720 | static struct i2c_board_info magician_pwr_i2c_board_info[] __initdata = { | ||
721 | { | ||
722 | I2C_BOARD_INFO("max1586", 0x14), | ||
723 | .platform_data = &magician_max1587a_info, | ||
724 | }, | ||
725 | }; | ||
726 | |||
727 | /* | ||
631 | * MMC/SD | 728 | * MMC/SD |
632 | */ | 729 | */ |
633 | 730 | ||
634 | static int magician_mci_init(struct device *dev, | 731 | static int magician_mci_init(struct device *dev, |
635 | irq_handler_t detect_irq, void *data) | 732 | irq_handler_t detect_irq, void *data) |
636 | { | 733 | { |
637 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0, | 734 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0, |
638 | "mmc card detect", data); | 735 | "mmc card detect", data); |
639 | } | 736 | } |
640 | 737 | ||
641 | static void magician_mci_exit(struct device *dev, void *data) | 738 | static void magician_mci_exit(struct device *dev, void *data) |
@@ -644,9 +741,9 @@ static void magician_mci_exit(struct device *dev, void *data) | |||
644 | } | 741 | } |
645 | 742 | ||
646 | static struct pxamci_platform_data magician_mci_info = { | 743 | static struct pxamci_platform_data magician_mci_info = { |
647 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 744 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
648 | .init = magician_mci_init, | 745 | .init = magician_mci_init, |
649 | .exit = magician_mci_exit, | 746 | .exit = magician_mci_exit, |
650 | .gpio_card_detect = -1, | 747 | .gpio_card_detect = -1, |
651 | .gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY, | 748 | .gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY, |
652 | .gpio_card_ro_invert = 1, | 749 | .gpio_card_ro_invert = 1, |
@@ -660,47 +757,102 @@ static struct pxamci_platform_data magician_mci_info = { | |||
660 | 757 | ||
661 | static struct pxaohci_platform_data magician_ohci_info = { | 758 | static struct pxaohci_platform_data magician_ohci_info = { |
662 | .port_mode = PMM_PERPORT_MODE, | 759 | .port_mode = PMM_PERPORT_MODE, |
663 | .flags = ENABLE_PORT1 | ENABLE_PORT3 | POWER_CONTROL_LOW, | 760 | /* port1: CSR Bluetooth, port2: OTG with UDC */ |
761 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, | ||
664 | .power_budget = 0, | 762 | .power_budget = 0, |
763 | .power_on_delay = 100, | ||
665 | }; | 764 | }; |
666 | 765 | ||
667 | |||
668 | /* | 766 | /* |
669 | * StrataFlash | 767 | * StrataFlash |
670 | */ | 768 | */ |
671 | 769 | ||
770 | static int magician_flash_init(struct platform_device *pdev) | ||
771 | { | ||
772 | int ret = gpio_request(EGPIO_MAGICIAN_FLASH_VPP, "flash Vpp enable"); | ||
773 | |||
774 | if (ret) { | ||
775 | pr_err("Cannot request flash enable GPIO (%i)\n", ret); | ||
776 | return ret; | ||
777 | } | ||
778 | |||
779 | ret = gpio_direction_output(EGPIO_MAGICIAN_FLASH_VPP, 1); | ||
780 | if (ret) { | ||
781 | pr_err("Cannot set direction for flash enable (%i)\n", ret); | ||
782 | gpio_free(EGPIO_MAGICIAN_FLASH_VPP); | ||
783 | } | ||
784 | |||
785 | return ret; | ||
786 | } | ||
787 | |||
672 | static void magician_set_vpp(struct platform_device *pdev, int vpp) | 788 | static void magician_set_vpp(struct platform_device *pdev, int vpp) |
673 | { | 789 | { |
674 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); | 790 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
675 | } | 791 | } |
676 | 792 | ||
793 | static void magician_flash_exit(struct platform_device *pdev) | ||
794 | { | ||
795 | gpio_free(EGPIO_MAGICIAN_FLASH_VPP); | ||
796 | } | ||
797 | |||
677 | static struct resource strataflash_resource = { | 798 | static struct resource strataflash_resource = { |
678 | .start = PXA_CS0_PHYS, | 799 | .start = PXA_CS0_PHYS, |
679 | .end = PXA_CS0_PHYS + SZ_64M - 1, | 800 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
680 | .flags = IORESOURCE_MEM, | 801 | .flags = IORESOURCE_MEM, |
681 | }; | 802 | }; |
682 | 803 | ||
804 | static struct mtd_partition magician_flash_parts[] = { | ||
805 | { | ||
806 | .name = "Bootloader", | ||
807 | .offset = 0x0, | ||
808 | .size = 0x40000, | ||
809 | .mask_flags = MTD_WRITEABLE, /* EXPERIMENTAL */ | ||
810 | }, | ||
811 | { | ||
812 | .name = "Linux Kernel", | ||
813 | .offset = 0x40000, | ||
814 | .size = MTDPART_SIZ_FULL, | ||
815 | }, | ||
816 | }; | ||
817 | |||
818 | /* | ||
819 | * physmap-flash driver | ||
820 | */ | ||
821 | |||
683 | static struct physmap_flash_data strataflash_data = { | 822 | static struct physmap_flash_data strataflash_data = { |
684 | .width = 4, | 823 | .width = 4, |
685 | .set_vpp = magician_set_vpp, | 824 | .init = magician_flash_init, |
825 | .set_vpp = magician_set_vpp, | ||
826 | .exit = magician_flash_exit, | ||
827 | .parts = magician_flash_parts, | ||
828 | .nr_parts = ARRAY_SIZE(magician_flash_parts), | ||
686 | }; | 829 | }; |
687 | 830 | ||
688 | static struct platform_device strataflash = { | 831 | static struct platform_device strataflash = { |
689 | .name = "physmap-flash", | 832 | .name = "physmap-flash", |
690 | .id = -1, | 833 | .id = -1, |
691 | .resource = &strataflash_resource, | 834 | .resource = &strataflash_resource, |
692 | .num_resources = 1, | 835 | .num_resources = 1, |
693 | .dev = { | 836 | .dev = { |
694 | .platform_data = &strataflash_data, | 837 | .platform_data = &strataflash_data, |
695 | }, | 838 | }, |
696 | }; | 839 | }; |
697 | 840 | ||
698 | /* | 841 | /* |
699 | * I2C | 842 | * PXA I2C main controller |
700 | */ | 843 | */ |
701 | 844 | ||
702 | static struct i2c_pxa_platform_data i2c_info = { | 845 | static struct i2c_pxa_platform_data i2c_info = { |
703 | .fast_mode = 1, | 846 | /* OV9640 I2C device doesn't support fast mode */ |
847 | .fast_mode = 0, | ||
848 | }; | ||
849 | |||
850 | /* | ||
851 | * PXA I2C power controller | ||
852 | */ | ||
853 | |||
854 | static struct i2c_pxa_platform_data magician_i2c_power_info = { | ||
855 | .fast_mode = 1, | ||
704 | }; | 856 | }; |
705 | 857 | ||
706 | /* | 858 | /* |
@@ -720,12 +872,13 @@ static struct platform_device *devices[] __initdata = { | |||
720 | }; | 872 | }; |
721 | 873 | ||
722 | static struct gpio magician_global_gpios[] = { | 874 | static struct gpio magician_global_gpios[] = { |
723 | { GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" }, | 875 | { GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" }, |
724 | { GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" }, | 876 | { GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" }, |
725 | { GPIO104_MAGICIAN_LCD_POWER_1, GPIOF_OUT_INIT_LOW, "LCD power 1" }, | 877 | |
726 | { GPIO105_MAGICIAN_LCD_POWER_2, GPIOF_OUT_INIT_LOW, "LCD power 2" }, | 878 | /* NOTICE valid LCD init sequence */ |
727 | { GPIO106_MAGICIAN_LCD_POWER_3, GPIOF_OUT_INIT_LOW, "LCD power 3" }, | 879 | { GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" }, |
728 | { GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" }, | 880 | { GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" }, |
881 | { GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" }, | ||
729 | }; | 882 | }; |
730 | 883 | ||
731 | static void __init magician_init(void) | 884 | static void __init magician_init(void) |
@@ -737,44 +890,55 @@ static void __init magician_init(void) | |||
737 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); | 890 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); |
738 | err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios)); | 891 | err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios)); |
739 | if (err) | 892 | if (err) |
740 | pr_err("magician: Failed to request GPIOs: %d\n", err); | 893 | pr_err("magician: Failed to request global GPIOs: %d\n", err); |
741 | 894 | ||
742 | pxa_set_ffuart_info(NULL); | 895 | pxa_set_ffuart_info(NULL); |
743 | pxa_set_btuart_info(NULL); | 896 | pxa_set_btuart_info(NULL); |
744 | pxa_set_stuart_info(NULL); | ||
745 | 897 | ||
746 | platform_add_devices(ARRAY_AND_SIZE(devices)); | 898 | pwm_add_table(magician_pwm_lookup, ARRAY_SIZE(magician_pwm_lookup)); |
747 | 899 | ||
748 | pxa_set_ficp_info(&magician_ficp_info); | 900 | pxa_set_ficp_info(&magician_ficp_info); |
749 | pxa27x_set_i2c_power_info(NULL); | 901 | pxa27x_set_i2c_power_info(&magician_i2c_power_info); |
750 | pxa_set_i2c_info(&i2c_info); | 902 | pxa_set_i2c_info(&i2c_info); |
903 | |||
904 | i2c_register_board_info(1, | ||
905 | ARRAY_AND_SIZE(magician_pwr_i2c_board_info)); | ||
906 | |||
751 | pxa_set_mci_info(&magician_mci_info); | 907 | pxa_set_mci_info(&magician_mci_info); |
752 | pxa_set_ohci_info(&magician_ohci_info); | 908 | pxa_set_ohci_info(&magician_ohci_info); |
909 | pxa_set_udc_info(&magician_udc_info); | ||
753 | 910 | ||
754 | /* Check LCD type we have */ | 911 | /* Check LCD type we have */ |
755 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); | 912 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); |
756 | if (cpld) { | 913 | if (cpld) { |
757 | u8 board_id = __raw_readb(cpld+0x14); | 914 | u8 board_id = __raw_readb(cpld + 0x14); |
915 | |||
758 | iounmap(cpld); | 916 | iounmap(cpld); |
759 | system_rev = board_id & 0x7; | 917 | system_rev = board_id & 0x7; |
760 | lcd_select = board_id & 0x8; | 918 | lcd_select = board_id & 0x8; |
761 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); | 919 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); |
762 | if (lcd_select && (system_rev < 3)) | 920 | if (lcd_select && (system_rev < 3)) |
921 | /* NOTICE valid LCD init sequence */ | ||
763 | gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER, | 922 | gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER, |
764 | GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER"); | 923 | GPIOF_OUT_INIT_LOW, "Samsung LCD Power"); |
765 | pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); | 924 | pxa_set_fb_info(NULL, |
925 | lcd_select ? &samsung_info : &toppoly_info); | ||
766 | } else | 926 | } else |
767 | pr_err("LCD detection: CPLD mapping failed\n"); | 927 | pr_err("LCD detection: CPLD mapping failed\n"); |
768 | } | ||
769 | 928 | ||
929 | regulator_register_always_on(0, "power", pwm_backlight_supply, | ||
930 | ARRAY_SIZE(pwm_backlight_supply), 5000000); | ||
931 | |||
932 | platform_add_devices(ARRAY_AND_SIZE(devices)); | ||
933 | } | ||
770 | 934 | ||
771 | MACHINE_START(MAGICIAN, "HTC Magician") | 935 | MACHINE_START(MAGICIAN, "HTC Magician") |
772 | .atag_offset = 0x100, | 936 | .atag_offset = 0x100, |
773 | .map_io = pxa27x_map_io, | 937 | .map_io = pxa27x_map_io, |
774 | .nr_irqs = MAGICIAN_NR_IRQS, | 938 | .nr_irqs = MAGICIAN_NR_IRQS, |
775 | .init_irq = pxa27x_init_irq, | 939 | .init_irq = pxa27x_init_irq, |
776 | .handle_irq = pxa27x_handle_irq, | 940 | .handle_irq = pxa27x_handle_irq, |
777 | .init_machine = magician_init, | 941 | .init_machine = magician_init, |
778 | .init_time = pxa_timer_init, | 942 | .init_time = pxa_timer_init, |
779 | .restart = pxa_restart, | 943 | .restart = pxa_restart, |
780 | MACHINE_END | 944 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 2c0658cf6be2..c3a87c176d72 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/mtd/partitions.h> | 26 | #include <linux/mtd/partitions.h> |
27 | #include <linux/input.h> | 27 | #include <linux/input.h> |
28 | #include <linux/gpio_keys.h> | 28 | #include <linux/gpio_keys.h> |
29 | #include <linux/pwm.h> | ||
29 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
30 | #include <linux/smc91x.h> | 31 | #include <linux/smc91x.h> |
31 | #include <linux/i2c/pxa-i2c.h> | 32 | #include <linux/i2c/pxa-i2c.h> |
@@ -248,11 +249,14 @@ static struct platform_device mst_flash_device[2] = { | |||
248 | }; | 249 | }; |
249 | 250 | ||
250 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | 251 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
252 | static struct pwm_lookup mainstone_pwm_lookup[] = { | ||
253 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770, | ||
254 | PWM_POLARITY_NORMAL), | ||
255 | }; | ||
256 | |||
251 | static struct platform_pwm_backlight_data mainstone_backlight_data = { | 257 | static struct platform_pwm_backlight_data mainstone_backlight_data = { |
252 | .pwm_id = 0, | ||
253 | .max_brightness = 1023, | 258 | .max_brightness = 1023, |
254 | .dft_brightness = 1023, | 259 | .dft_brightness = 1023, |
255 | .pwm_period_ns = 78770, | ||
256 | .enable_gpio = -1, | 260 | .enable_gpio = -1, |
257 | }; | 261 | }; |
258 | 262 | ||
@@ -266,9 +270,16 @@ static struct platform_device mainstone_backlight_device = { | |||
266 | 270 | ||
267 | static void __init mainstone_backlight_register(void) | 271 | static void __init mainstone_backlight_register(void) |
268 | { | 272 | { |
269 | int ret = platform_device_register(&mainstone_backlight_device); | 273 | int ret; |
270 | if (ret) | 274 | |
275 | pwm_add_table(mainstone_pwm_lookup, ARRAY_SIZE(mainstone_pwm_lookup)); | ||
276 | |||
277 | ret = platform_device_register(&mainstone_backlight_device); | ||
278 | if (ret) { | ||
271 | printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret); | 279 | printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret); |
280 | pwm_remove_table(mainstone_pwm_lookup, | ||
281 | ARRAY_SIZE(mainstone_pwm_lookup)); | ||
282 | } | ||
272 | } | 283 | } |
273 | #else | 284 | #else |
274 | #define mainstone_backlight_register() do { } while (0) | 285 | #define mainstone_backlight_register() do { } while (0) |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 29997bde277d..3b52b1aa0659 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/gpio_keys.h> | 28 | #include <linux/gpio_keys.h> |
29 | #include <linux/pwm.h> | ||
29 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
30 | #include <linux/rtc.h> | 31 | #include <linux/rtc.h> |
31 | #include <linux/leds.h> | 32 | #include <linux/leds.h> |
@@ -181,12 +182,15 @@ static unsigned long mioa701_pin_config[] = { | |||
181 | MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH), | 182 | MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH), |
182 | }; | 183 | }; |
183 | 184 | ||
185 | static struct pwm_lookup mioa701_pwm_lookup[] = { | ||
186 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 4000 * 1024, | ||
187 | PWM_POLARITY_NORMAL), | ||
188 | }; | ||
189 | |||
184 | /* LCD Screen and Backlight */ | 190 | /* LCD Screen and Backlight */ |
185 | static struct platform_pwm_backlight_data mioa701_backlight_data = { | 191 | static struct platform_pwm_backlight_data mioa701_backlight_data = { |
186 | .pwm_id = 0, | ||
187 | .max_brightness = 100, | 192 | .max_brightness = 100, |
188 | .dft_brightness = 50, | 193 | .dft_brightness = 50, |
189 | .pwm_period_ns = 4000 * 1024, /* Fl = 250kHz */ | ||
190 | .enable_gpio = -1, | 194 | .enable_gpio = -1, |
191 | }; | 195 | }; |
192 | 196 | ||
@@ -678,6 +682,7 @@ MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info) | |||
678 | MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) | 682 | MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) |
679 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) | 683 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) |
680 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) | 684 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) |
685 | MIO_SIMPLE_DEV(wm9713_acodec, "wm9713-codec", NULL); | ||
681 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); | 686 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); |
682 | MIO_SIMPLE_DEV(mioa701_camera, "soc-camera-pdrv",&iclink); | 687 | MIO_SIMPLE_DEV(mioa701_camera, "soc-camera-pdrv",&iclink); |
683 | 688 | ||
@@ -685,6 +690,7 @@ static struct platform_device *devices[] __initdata = { | |||
685 | &mioa701_gpio_keys, | 690 | &mioa701_gpio_keys, |
686 | &mioa701_backlight, | 691 | &mioa701_backlight, |
687 | &mioa701_led, | 692 | &mioa701_led, |
693 | &wm9713_acodec, | ||
688 | &pxa2xx_pcm, | 694 | &pxa2xx_pcm, |
689 | &mioa701_sound, | 695 | &mioa701_sound, |
690 | &power_dev, | 696 | &power_dev, |
@@ -751,6 +757,7 @@ static void __init mioa701_machine_init(void) | |||
751 | pxa_set_udc_info(&mioa701_udc_info); | 757 | pxa_set_udc_info(&mioa701_udc_info); |
752 | pxa_set_ac97_info(&mioa701_ac97_info); | 758 | pxa_set_ac97_info(&mioa701_ac97_info); |
753 | pm_power_off = mioa701_poweroff; | 759 | pm_power_off = mioa701_poweroff; |
760 | pwm_add_table(mioa701_pwm_lookup, ARRAY_SIZE(mioa701_pwm_lookup)); | ||
754 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 761 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
755 | gsm_init(); | 762 | gsm_init(); |
756 | 763 | ||
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index e54a296fb81f..13eba2b26e0a 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/gpio_keys.h> | 15 | #include <linux/gpio_keys.h> |
16 | #include <linux/input.h> | 16 | #include <linux/input.h> |
17 | #include <linux/pda_power.h> | 17 | #include <linux/pda_power.h> |
18 | #include <linux/pwm.h> | ||
18 | #include <linux/pwm_backlight.h> | 19 | #include <linux/pwm_backlight.h> |
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/wm97xx.h> | 21 | #include <linux/wm97xx.h> |
@@ -270,6 +271,11 @@ void __init palm27x_ac97_init(int minv, int maxv, int jack, int reset) | |||
270 | * Backlight | 271 | * Backlight |
271 | ******************************************************************************/ | 272 | ******************************************************************************/ |
272 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | 273 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
274 | static struct pwm_lookup palm27x_pwm_lookup[] = { | ||
275 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 3500 * 1024, | ||
276 | PWM_POLARITY_NORMAL), | ||
277 | }; | ||
278 | |||
273 | static int palm_bl_power; | 279 | static int palm_bl_power; |
274 | static int palm_lcd_power; | 280 | static int palm_lcd_power; |
275 | 281 | ||
@@ -318,10 +324,8 @@ static void palm27x_backlight_exit(struct device *dev) | |||
318 | } | 324 | } |
319 | 325 | ||
320 | static struct platform_pwm_backlight_data palm27x_backlight_data = { | 326 | static struct platform_pwm_backlight_data palm27x_backlight_data = { |
321 | .pwm_id = 0, | ||
322 | .max_brightness = 0xfe, | 327 | .max_brightness = 0xfe, |
323 | .dft_brightness = 0x7e, | 328 | .dft_brightness = 0x7e, |
324 | .pwm_period_ns = 3500 * 1024, | ||
325 | .enable_gpio = -1, | 329 | .enable_gpio = -1, |
326 | .init = palm27x_backlight_init, | 330 | .init = palm27x_backlight_init, |
327 | .notify = palm27x_backlight_notify, | 331 | .notify = palm27x_backlight_notify, |
@@ -340,6 +344,7 @@ void __init palm27x_pwm_init(int bl, int lcd) | |||
340 | { | 344 | { |
341 | palm_bl_power = bl; | 345 | palm_bl_power = bl; |
342 | palm_lcd_power = lcd; | 346 | palm_lcd_power = lcd; |
347 | pwm_add_lookup(palm27x_pwm_lookup, ARRAY_SIZE(palm27x_pwm_lookup)); | ||
343 | platform_device_register(&palm27x_backlight); | 348 | platform_device_register(&palm27x_backlight); |
344 | } | 349 | } |
345 | #endif | 350 | #endif |
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 7691c974ca4b..aebf6de62468 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
20 | #include <linux/input.h> | 20 | #include <linux/input.h> |
21 | #include <linux/pwm.h> | ||
21 | #include <linux/pwm_backlight.h> | 22 | #include <linux/pwm_backlight.h> |
22 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
23 | #include <linux/input/matrix_keypad.h> | 24 | #include <linux/input/matrix_keypad.h> |
@@ -166,11 +167,14 @@ static inline void palmtc_keys_init(void) {} | |||
166 | * Backlight | 167 | * Backlight |
167 | ******************************************************************************/ | 168 | ******************************************************************************/ |
168 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | 169 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
170 | static struct pwm_lookup palmtc_pwm_lookup[] = { | ||
171 | PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS, | ||
172 | PWM_PERIOD_NORMAL), | ||
173 | }; | ||
174 | |||
169 | static struct platform_pwm_backlight_data palmtc_backlight_data = { | 175 | static struct platform_pwm_backlight_data palmtc_backlight_data = { |
170 | .pwm_id = 1, | ||
171 | .max_brightness = PALMTC_MAX_INTENSITY, | 176 | .max_brightness = PALMTC_MAX_INTENSITY, |
172 | .dft_brightness = PALMTC_MAX_INTENSITY, | 177 | .dft_brightness = PALMTC_MAX_INTENSITY, |
173 | .pwm_period_ns = PALMTC_PERIOD_NS, | ||
174 | .enable_gpio = GPIO_NR_PALMTC_BL_POWER, | 178 | .enable_gpio = GPIO_NR_PALMTC_BL_POWER, |
175 | }; | 179 | }; |
176 | 180 | ||
@@ -184,6 +188,7 @@ static struct platform_device palmtc_backlight = { | |||
184 | 188 | ||
185 | static void __init palmtc_pwm_init(void) | 189 | static void __init palmtc_pwm_init(void) |
186 | { | 190 | { |
191 | pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup)); | ||
187 | platform_device_register(&palmtc_backlight); | 192 | platform_device_register(&palmtc_backlight); |
188 | } | 193 | } |
189 | #else | 194 | #else |
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index 956fd24ee6fd..e64bb4326e69 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/gpio_keys.h> | 21 | #include <linux/gpio_keys.h> |
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/pda_power.h> | 23 | #include <linux/pda_power.h> |
24 | #include <linux/pwm.h> | ||
24 | #include <linux/pwm_backlight.h> | 25 | #include <linux/pwm_backlight.h> |
25 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
26 | #include <linux/wm97xx.h> | 27 | #include <linux/wm97xx.h> |
@@ -138,6 +139,11 @@ static struct platform_device palmte2_pxa_keys = { | |||
138 | /****************************************************************************** | 139 | /****************************************************************************** |
139 | * Backlight | 140 | * Backlight |
140 | ******************************************************************************/ | 141 | ******************************************************************************/ |
142 | static struct pwm_lookup palmte2_pwm_lookup[] = { | ||
143 | PWM_LOOKUP("pxa25x-pwm.0", 0, "pwm-backlight.0", NULL, | ||
144 | PALMTE2_PERIOD_NS, PWM_POLARITY_NORMAL), | ||
145 | }; | ||
146 | |||
141 | static struct gpio palmte_bl_gpios[] = { | 147 | static struct gpio palmte_bl_gpios[] = { |
142 | { GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" }, | 148 | { GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" }, |
143 | { GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" }, | 149 | { GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" }, |
@@ -161,10 +167,8 @@ static void palmte2_backlight_exit(struct device *dev) | |||
161 | } | 167 | } |
162 | 168 | ||
163 | static struct platform_pwm_backlight_data palmte2_backlight_data = { | 169 | static struct platform_pwm_backlight_data palmte2_backlight_data = { |
164 | .pwm_id = 0, | ||
165 | .max_brightness = PALMTE2_MAX_INTENSITY, | 170 | .max_brightness = PALMTE2_MAX_INTENSITY, |
166 | .dft_brightness = PALMTE2_MAX_INTENSITY, | 171 | .dft_brightness = PALMTE2_MAX_INTENSITY, |
167 | .pwm_period_ns = PALMTE2_PERIOD_NS, | ||
168 | .enable_gpio = -1, | 172 | .enable_gpio = -1, |
169 | .init = palmte2_backlight_init, | 173 | .init = palmte2_backlight_init, |
170 | .notify = palmte2_backlight_notify, | 174 | .notify = palmte2_backlight_notify, |
@@ -355,6 +359,7 @@ static void __init palmte2_init(void) | |||
355 | pxa_set_ac97_info(&palmte2_ac97_pdata); | 359 | pxa_set_ac97_info(&palmte2_ac97_pdata); |
356 | pxa_set_ficp_info(&palmte2_ficp_platform_data); | 360 | pxa_set_ficp_info(&palmte2_ficp_platform_data); |
357 | 361 | ||
362 | pwm_add_table(palmte2_pwm_lookup, ARRAY_SIZE(palmte2_pwm_lookup)); | ||
358 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 363 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
359 | } | 364 | } |
360 | 365 | ||
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index d8319b54299a..b71c96f614f9 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/i2c/pxa-i2c.h> | 26 | #include <linux/i2c/pxa-i2c.h> |
27 | #include <linux/pwm.h> | ||
27 | #include <linux/pwm_backlight.h> | 28 | #include <linux/pwm_backlight.h> |
28 | 29 | ||
29 | #include <media/mt9v022.h> | 30 | #include <media/mt9v022.h> |
@@ -148,11 +149,14 @@ static struct pxafb_mach_info pcm990_fbinfo __initdata = { | |||
148 | }; | 149 | }; |
149 | #endif | 150 | #endif |
150 | 151 | ||
152 | static struct pwm_lookup pcm990_pwm_lookup[] = { | ||
153 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770, | ||
154 | PWM_POLARITY_NORMAL), | ||
155 | }; | ||
156 | |||
151 | static struct platform_pwm_backlight_data pcm990_backlight_data = { | 157 | static struct platform_pwm_backlight_data pcm990_backlight_data = { |
152 | .pwm_id = 0, | ||
153 | .max_brightness = 1023, | 158 | .max_brightness = 1023, |
154 | .dft_brightness = 1023, | 159 | .dft_brightness = 1023, |
155 | .pwm_period_ns = 78770, | ||
156 | .enable_gpio = -1, | 160 | .enable_gpio = -1, |
157 | }; | 161 | }; |
158 | 162 | ||
@@ -542,6 +546,7 @@ void __init pcm990_baseboard_init(void) | |||
542 | #ifndef CONFIG_PCM990_DISPLAY_NONE | 546 | #ifndef CONFIG_PCM990_DISPLAY_NONE |
543 | pxa_set_fb_info(NULL, &pcm990_fbinfo); | 547 | pxa_set_fb_info(NULL, &pcm990_fbinfo); |
544 | #endif | 548 | #endif |
549 | pwm_add_table(pcm990_pwm_lookup, ARRAY_SIZE(pcm990_pwm_lookup)); | ||
545 | platform_device_register(&pcm990_backlight_device); | 550 | platform_device_register(&pcm990_backlight_device); |
546 | 551 | ||
547 | /* MMC */ | 552 | /* MMC */ |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 221260d5d109..ffc424028557 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(pxa27x_configure_ac97reset); | |||
84 | */ | 84 | */ |
85 | static unsigned int pwrmode = PWRMODE_SLEEP; | 85 | static unsigned int pwrmode = PWRMODE_SLEEP; |
86 | 86 | ||
87 | int __init pxa27x_set_pwrmode(unsigned int mode) | 87 | int pxa27x_set_pwrmode(unsigned int mode) |
88 | { | 88 | { |
89 | switch (mode) { | 89 | switch (mode) { |
90 | case PWRMODE_SLEEP: | 90 | case PWRMODE_SLEEP: |
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index 88f70c37ad0d..36571a9a44fe 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/leds.h> | 29 | #include <linux/leds.h> |
30 | #include <linux/w1-gpio.h> | 30 | #include <linux/w1-gpio.h> |
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/pwm.h> | ||
32 | #include <linux/pwm_backlight.h> | 33 | #include <linux/pwm_backlight.h> |
33 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
34 | #include <linux/i2c/pxa-i2c.h> | 35 | #include <linux/i2c/pxa-i2c.h> |
@@ -507,7 +508,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = { | |||
507 | .ext_pullup_enable_pin = -EINVAL, | 508 | .ext_pullup_enable_pin = -EINVAL, |
508 | }; | 509 | }; |
509 | 510 | ||
510 | struct platform_device raumfeld_w1_gpio_device = { | 511 | static struct platform_device raumfeld_w1_gpio_device = { |
511 | .name = "w1-gpio", | 512 | .name = "w1-gpio", |
512 | .dev = { | 513 | .dev = { |
513 | .platform_data = &w1_gpio_platform_data | 514 | .platform_data = &w1_gpio_platform_data |
@@ -531,13 +532,15 @@ static void __init raumfeld_w1_init(void) | |||
531 | * Framebuffer device | 532 | * Framebuffer device |
532 | */ | 533 | */ |
533 | 534 | ||
535 | static struct pwm_lookup raumfeld_pwm_lookup[] = { | ||
536 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 10000, | ||
537 | PWM_POLARITY_NORMAL), | ||
538 | }; | ||
539 | |||
534 | /* PWM controlled backlight */ | 540 | /* PWM controlled backlight */ |
535 | static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = { | 541 | static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = { |
536 | .pwm_id = 0, | ||
537 | .max_brightness = 100, | 542 | .max_brightness = 100, |
538 | .dft_brightness = 100, | 543 | .dft_brightness = 100, |
539 | /* 10000 ns = 10 ms ^= 100 kHz */ | ||
540 | .pwm_period_ns = 10000, | ||
541 | .enable_gpio = -1, | 544 | .enable_gpio = -1, |
542 | }; | 545 | }; |
543 | 546 | ||
@@ -618,6 +621,8 @@ static void __init raumfeld_lcd_init(void) | |||
618 | } else { | 621 | } else { |
619 | mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT; | 622 | mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT; |
620 | pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1); | 623 | pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1); |
624 | pwm_add_table(raumfeld_pwm_lookup, | ||
625 | ARRAY_SIZE(raumfeld_pwm_lookup)); | ||
621 | platform_device_register(&raumfeld_pwm_backlight_device); | 626 | platform_device_register(&raumfeld_pwm_backlight_device); |
622 | } | 627 | } |
623 | 628 | ||
@@ -629,7 +634,7 @@ static void __init raumfeld_lcd_init(void) | |||
629 | * SPI devices | 634 | * SPI devices |
630 | */ | 635 | */ |
631 | 636 | ||
632 | struct spi_gpio_platform_data raumfeld_spi_platform_data = { | 637 | static struct spi_gpio_platform_data raumfeld_spi_platform_data = { |
633 | .sck = GPIO_SPI_CLK, | 638 | .sck = GPIO_SPI_CLK, |
634 | .mosi = GPIO_SPI_MOSI, | 639 | .mosi = GPIO_SPI_MOSI, |
635 | .miso = GPIO_SPI_MISO, | 640 | .miso = GPIO_SPI_MISO, |
@@ -848,7 +853,7 @@ static void __init raumfeld_power_init(void) | |||
848 | static struct regulator_consumer_supply audio_va_consumer_supply = | 853 | static struct regulator_consumer_supply audio_va_consumer_supply = |
849 | REGULATOR_SUPPLY("va", "0-0048"); | 854 | REGULATOR_SUPPLY("va", "0-0048"); |
850 | 855 | ||
851 | struct regulator_init_data audio_va_initdata = { | 856 | static struct regulator_init_data audio_va_initdata = { |
852 | .consumer_supplies = &audio_va_consumer_supply, | 857 | .consumer_supplies = &audio_va_consumer_supply, |
853 | .num_consumer_supplies = 1, | 858 | .num_consumer_supplies = 1, |
854 | .constraints = { | 859 | .constraints = { |
@@ -880,7 +885,7 @@ static struct regulator_consumer_supply audio_dummy_supplies[] = { | |||
880 | REGULATOR_SUPPLY("vlc", "0-0048"), | 885 | REGULATOR_SUPPLY("vlc", "0-0048"), |
881 | }; | 886 | }; |
882 | 887 | ||
883 | struct regulator_init_data audio_dummy_initdata = { | 888 | static struct regulator_init_data audio_dummy_initdata = { |
884 | .consumer_supplies = audio_dummy_supplies, | 889 | .consumer_supplies = audio_dummy_supplies, |
885 | .num_consumer_supplies = ARRAY_SIZE(audio_dummy_supplies), | 890 | .num_consumer_supplies = ARRAY_SIZE(audio_dummy_supplies), |
886 | .constraints = { | 891 | .constraints = { |
@@ -928,7 +933,7 @@ static struct regulator_init_data vcc_mmc_init_data = { | |||
928 | .num_consumer_supplies = 1, | 933 | .num_consumer_supplies = 1, |
929 | }; | 934 | }; |
930 | 935 | ||
931 | struct max8660_subdev_data max8660_v6_subdev_data = { | 936 | static struct max8660_subdev_data max8660_v6_subdev_data = { |
932 | .id = MAX8660_V6, | 937 | .id = MAX8660_V6, |
933 | .name = "vmmc", | 938 | .name = "vmmc", |
934 | .platform_data = &vcc_mmc_init_data, | 939 | .platform_data = &vcc_mmc_init_data, |
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index a71da84e784b..349a13a76215 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/smc91x.h> | 20 | #include <linux/smc91x.h> |
21 | #include <linux/pwm.h> | ||
21 | #include <linux/pwm_backlight.h> | 22 | #include <linux/pwm_backlight.h> |
22 | 23 | ||
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
@@ -168,21 +169,24 @@ static inline void tavorevb_init_keypad(void) {} | |||
168 | #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */ | 169 | #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */ |
169 | 170 | ||
170 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | 171 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
172 | static struct pwm_lookup tavorevb_pwm_lookup[] = { | ||
173 | PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL, 100000, | ||
174 | PWM_POLARITY_NORMAL), | ||
175 | PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.1", NULL, 100000, | ||
176 | PWM_POLARITY_NORMAL), | ||
177 | }; | ||
178 | |||
171 | static struct platform_pwm_backlight_data tavorevb_backlight_data[] = { | 179 | static struct platform_pwm_backlight_data tavorevb_backlight_data[] = { |
172 | [0] = { | 180 | [0] = { |
173 | /* primary backlight */ | 181 | /* primary backlight */ |
174 | .pwm_id = 2, | ||
175 | .max_brightness = 100, | 182 | .max_brightness = 100, |
176 | .dft_brightness = 100, | 183 | .dft_brightness = 100, |
177 | .pwm_period_ns = 100000, | ||
178 | .enable_gpio = -1, | 184 | .enable_gpio = -1, |
179 | }, | 185 | }, |
180 | [1] = { | 186 | [1] = { |
181 | /* secondary backlight */ | 187 | /* secondary backlight */ |
182 | .pwm_id = 0, | ||
183 | .max_brightness = 100, | 188 | .max_brightness = 100, |
184 | .dft_brightness = 100, | 189 | .dft_brightness = 100, |
185 | .pwm_period_ns = 100000, | ||
186 | .enable_gpio = -1, | 190 | .enable_gpio = -1, |
187 | }, | 191 | }, |
188 | }; | 192 | }; |
@@ -470,6 +474,7 @@ static struct pxafb_mach_info tavorevb_lcd_info = { | |||
470 | 474 | ||
471 | static void __init tavorevb_init_lcd(void) | 475 | static void __init tavorevb_init_lcd(void) |
472 | { | 476 | { |
477 | pwm_add_table(tavorevb_pwm_lookup, ARRAY_SIZE(tavorevb_pwm_lookup)); | ||
473 | platform_device_register(&tavorevb_backlight_devices[0]); | 478 | platform_device_register(&tavorevb_backlight_devices[0]); |
474 | platform_device_register(&tavorevb_backlight_devices[1]); | 479 | platform_device_register(&tavorevb_backlight_devices[1]); |
475 | pxa_set_fb_info(NULL, &tavorevb_lcd_info); | 480 | pxa_set_fb_info(NULL, &tavorevb_lcd_info); |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 8ab26370107e..7ecc61ad2bed 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/i2c/pxa-i2c.h> | 39 | #include <linux/i2c/pxa-i2c.h> |
40 | #include <linux/serial_8250.h> | 40 | #include <linux/serial_8250.h> |
41 | #include <linux/smc91x.h> | 41 | #include <linux/smc91x.h> |
42 | #include <linux/pwm.h> | ||
42 | #include <linux/pwm_backlight.h> | 43 | #include <linux/pwm_backlight.h> |
43 | #include <linux/usb/isp116x.h> | 44 | #include <linux/usb/isp116x.h> |
44 | #include <linux/mtd/mtd.h> | 45 | #include <linux/mtd/mtd.h> |
@@ -350,6 +351,11 @@ static struct pxafb_mach_info fb_info = { | |||
350 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | 351 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
351 | }; | 352 | }; |
352 | 353 | ||
354 | static struct pwm_lookup viper_pwm_lookup[] = { | ||
355 | PWM_LOOKUP("pxa25x-pwm.0", 0, "pwm-backlight.0", NULL, 1000000, | ||
356 | PWM_POLARITY_NORMAL), | ||
357 | }; | ||
358 | |||
353 | static int viper_backlight_init(struct device *dev) | 359 | static int viper_backlight_init(struct device *dev) |
354 | { | 360 | { |
355 | int ret; | 361 | int ret; |
@@ -398,10 +404,8 @@ static void viper_backlight_exit(struct device *dev) | |||
398 | } | 404 | } |
399 | 405 | ||
400 | static struct platform_pwm_backlight_data viper_backlight_data = { | 406 | static struct platform_pwm_backlight_data viper_backlight_data = { |
401 | .pwm_id = 0, | ||
402 | .max_brightness = 100, | 407 | .max_brightness = 100, |
403 | .dft_brightness = 100, | 408 | .dft_brightness = 100, |
404 | .pwm_period_ns = 1000000, | ||
405 | .enable_gpio = -1, | 409 | .enable_gpio = -1, |
406 | .init = viper_backlight_init, | 410 | .init = viper_backlight_init, |
407 | .notify = viper_backlight_notify, | 411 | .notify = viper_backlight_notify, |
@@ -939,6 +943,7 @@ static void __init viper_init(void) | |||
939 | smc91x_device.num_resources--; | 943 | smc91x_device.num_resources--; |
940 | 944 | ||
941 | pxa_set_i2c_info(NULL); | 945 | pxa_set_i2c_info(NULL); |
946 | pwm_add_table(viper_pwm_lookup, ARRAY_SIZE(viper_pwm_lookup)); | ||
942 | platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs)); | 947 | platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs)); |
943 | 948 | ||
944 | viper_init_vcore_gpios(); | 949 | viper_init_vcore_gpios(); |
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index e1a121b36cfa..d9899d73e46b 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/mtd/mtd.h> | 17 | #include <linux/mtd/mtd.h> |
18 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
19 | #include <linux/pwm.h> | ||
19 | #include <linux/pwm_backlight.h> | 20 | #include <linux/pwm_backlight.h> |
20 | #include <linux/z2_battery.h> | 21 | #include <linux/z2_battery.h> |
21 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
@@ -199,21 +200,24 @@ static inline void z2_nor_init(void) {} | |||
199 | * Backlight | 200 | * Backlight |
200 | ******************************************************************************/ | 201 | ******************************************************************************/ |
201 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | 202 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
203 | static struct pwm_lookup z2_pwm_lookup[] = { | ||
204 | PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight.0", NULL, 1260320, | ||
205 | PWM_POLARITY_NORMAL), | ||
206 | PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.1", NULL, 1260320, | ||
207 | PWM_POLARITY_NORMAL), | ||
208 | }; | ||
209 | |||
202 | static struct platform_pwm_backlight_data z2_backlight_data[] = { | 210 | static struct platform_pwm_backlight_data z2_backlight_data[] = { |
203 | [0] = { | 211 | [0] = { |
204 | /* Keypad Backlight */ | 212 | /* Keypad Backlight */ |
205 | .pwm_id = 1, | ||
206 | .max_brightness = 1023, | 213 | .max_brightness = 1023, |
207 | .dft_brightness = 0, | 214 | .dft_brightness = 0, |
208 | .pwm_period_ns = 1260320, | ||
209 | .enable_gpio = -1, | 215 | .enable_gpio = -1, |
210 | }, | 216 | }, |
211 | [1] = { | 217 | [1] = { |
212 | /* LCD Backlight */ | 218 | /* LCD Backlight */ |
213 | .pwm_id = 2, | ||
214 | .max_brightness = 1023, | 219 | .max_brightness = 1023, |
215 | .dft_brightness = 512, | 220 | .dft_brightness = 512, |
216 | .pwm_period_ns = 1260320, | ||
217 | .enable_gpio = -1, | 221 | .enable_gpio = -1, |
218 | }, | 222 | }, |
219 | }; | 223 | }; |
@@ -236,6 +240,7 @@ static struct platform_device z2_backlight_devices[2] = { | |||
236 | }; | 240 | }; |
237 | static void __init z2_pwm_init(void) | 241 | static void __init z2_pwm_init(void) |
238 | { | 242 | { |
243 | pwm_add_table(z2_pwm_lookup, ARRAY_SIZE(z2_pwm_lookup)); | ||
239 | platform_device_register(&z2_backlight_devices[0]); | 244 | platform_device_register(&z2_backlight_devices[0]); |
240 | platform_device_register(&z2_backlight_devices[1]); | 245 | platform_device_register(&z2_backlight_devices[1]); |
241 | } | 246 | } |
@@ -595,13 +600,11 @@ static struct spi_board_info spi_board_info[] __initdata = { | |||
595 | }; | 600 | }; |
596 | 601 | ||
597 | static struct pxa2xx_spi_master pxa_ssp1_master_info = { | 602 | static struct pxa2xx_spi_master pxa_ssp1_master_info = { |
598 | .clock_enable = CKEN_SSP, | ||
599 | .num_chipselect = 1, | 603 | .num_chipselect = 1, |
600 | .enable_dma = 1, | 604 | .enable_dma = 1, |
601 | }; | 605 | }; |
602 | 606 | ||
603 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { | 607 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { |
604 | .clock_enable = CKEN_SSP2, | ||
605 | .num_chipselect = 1, | 608 | .num_chipselect = 1, |
606 | }; | 609 | }; |
607 | 610 | ||
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 77daea478e88..e20359a7433c 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/pwm.h> | ||
22 | #include <linux/pwm_backlight.h> | 23 | #include <linux/pwm_backlight.h> |
23 | #include <linux/smc91x.h> | 24 | #include <linux/smc91x.h> |
24 | 25 | ||
@@ -120,11 +121,14 @@ static inline void zylonite_init_leds(void) {} | |||
120 | #endif | 121 | #endif |
121 | 122 | ||
122 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | 123 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
124 | static struct pwm_lookup zylonite_pwm_lookup[] = { | ||
125 | PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000, | ||
126 | PWM_POLARITY_NORMAL), | ||
127 | }; | ||
128 | |||
123 | static struct platform_pwm_backlight_data zylonite_backlight_data = { | 129 | static struct platform_pwm_backlight_data zylonite_backlight_data = { |
124 | .pwm_id = 3, | ||
125 | .max_brightness = 100, | 130 | .max_brightness = 100, |
126 | .dft_brightness = 100, | 131 | .dft_brightness = 100, |
127 | .pwm_period_ns = 10000, | ||
128 | .enable_gpio = -1, | 132 | .enable_gpio = -1, |
129 | }; | 133 | }; |
130 | 134 | ||
@@ -206,6 +210,7 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = { | |||
206 | 210 | ||
207 | static void __init zylonite_init_lcd(void) | 211 | static void __init zylonite_init_lcd(void) |
208 | { | 212 | { |
213 | pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup)); | ||
209 | platform_device_register(&zylonite_backlight_device); | 214 | platform_device_register(&zylonite_backlight_device); |
210 | 215 | ||
211 | if (lcd_id & 0x20) { | 216 | if (lcd_id & 0x20) { |
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index 6d36dacec4ba..9ec4c147abbc 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h | |||
@@ -23,7 +23,6 @@ struct dma_chan; | |||
23 | 23 | ||
24 | /* device.platform_data for SSP controller devices */ | 24 | /* device.platform_data for SSP controller devices */ |
25 | struct pxa2xx_spi_master { | 25 | struct pxa2xx_spi_master { |
26 | u32 clock_enable; | ||
27 | u16 num_chipselect; | 26 | u16 num_chipselect; |
28 | u8 enable_dma; | 27 | u8 enable_dma; |
29 | 28 | ||