diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-03-11 01:48:52 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-03-11 01:48:52 -0500 |
commit | 6d2f42cc275ba72a47ce6933b18480163ecf2740 (patch) | |
tree | b986e612edd1d44fa64874601712060970308290 | |
parent | a9518cde232960875a1f03ba00c112f56872cf60 (diff) | |
parent | 5cd435b4ab881280fb0b8ce6686cfceb005d98c8 (diff) |
Merge branch 'dev/pwm-backlight' into for-next
Conflicts:
arch/arm/mach-s3c64xx/mach-smdk6410.c
-rw-r--r-- | arch/arm/mach-s3c64xx/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-smdk6410.c | 46 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6440.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6450.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/mach-smdkc100.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/mach-smdkv210.c | 43 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 13 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-pwm.c | 53 | ||||
-rw-r--r-- | arch/arm/plat-samsung/pwm.c | 33 |
14 files changed, 290 insertions, 49 deletions
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 579d2f0f4dd0..e4177e22557b 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -143,6 +143,7 @@ config MACH_SMDK6410 | |||
143 | select S3C_DEV_USB_HSOTG | 143 | select S3C_DEV_USB_HSOTG |
144 | select S3C_DEV_WDT | 144 | select S3C_DEV_WDT |
145 | select SAMSUNG_DEV_KEYPAD | 145 | select SAMSUNG_DEV_KEYPAD |
146 | select SAMSUNG_DEV_PWM | ||
146 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 147 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
147 | select S3C64XX_SETUP_SDHCI | 148 | select S3C64XX_SETUP_SDHCI |
148 | select S3C64XX_SETUP_I2C1 | 149 | select S3C64XX_SETUP_I2C1 |
@@ -231,7 +232,7 @@ config MACH_HMT | |||
231 | select S3C_DEV_NAND | 232 | select S3C_DEV_NAND |
232 | select S3C_DEV_USB_HOST | 233 | select S3C_DEV_USB_HOST |
233 | select S3C64XX_SETUP_FB_24BPP | 234 | select S3C64XX_SETUP_FB_24BPP |
234 | select HAVE_PWM | 235 | select SAMSUNG_DEV_PWM |
235 | help | 236 | help |
236 | Machine support for the Airgoo HMT | 237 | Machine support for the Airgoo HMT |
237 | 238 | ||
@@ -249,8 +250,8 @@ config MACH_SMARTQ | |||
249 | select S3C64XX_SETUP_SDHCI | 250 | select S3C64XX_SETUP_SDHCI |
250 | select S3C64XX_SETUP_FB_24BPP | 251 | select S3C64XX_SETUP_FB_24BPP |
251 | select SAMSUNG_DEV_ADC | 252 | select SAMSUNG_DEV_ADC |
253 | select SAMSUNG_DEV_PWM | ||
252 | select SAMSUNG_DEV_TS | 254 | select SAMSUNG_DEV_TS |
253 | select HAVE_PWM | ||
254 | help | 255 | help |
255 | Shared machine support for SmartQ 5/7 | 256 | Shared machine support for SmartQ 5/7 |
256 | 257 | ||
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index a80a3163dd30..686a4f270b12 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/smsc911x.h> | 29 | #include <linux/smsc911x.h> |
30 | #include <linux/regulator/fixed.h> | 30 | #include <linux/regulator/fixed.h> |
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/pwm_backlight.h> | ||
32 | 33 | ||
33 | #ifdef CONFIG_SMDK6410_WM1190_EV1 | 34 | #ifdef CONFIG_SMDK6410_WM1190_EV1 |
34 | #include <linux/mfd/wm8350/core.h> | 35 | #include <linux/mfd/wm8350/core.h> |
@@ -49,6 +50,7 @@ | |||
49 | #include <mach/hardware.h> | 50 | #include <mach/hardware.h> |
50 | #include <mach/regs-fb.h> | 51 | #include <mach/regs-fb.h> |
51 | #include <mach/map.h> | 52 | #include <mach/map.h> |
53 | #include <mach/gpio-bank-f.h> | ||
52 | 54 | ||
53 | #include <asm/irq.h> | 55 | #include <asm/irq.h> |
54 | #include <asm/mach-types.h> | 56 | #include <asm/mach-types.h> |
@@ -119,7 +121,6 @@ static void smdk6410_lcd_power_set(struct plat_lcd_data *pd, | |||
119 | { | 121 | { |
120 | if (power) { | 122 | if (power) { |
121 | gpio_direction_output(S3C64XX_GPF(13), 1); | 123 | gpio_direction_output(S3C64XX_GPF(13), 1); |
122 | gpio_direction_output(S3C64XX_GPF(15), 1); | ||
123 | 124 | ||
124 | /* fire nRESET on power up */ | 125 | /* fire nRESET on power up */ |
125 | gpio_direction_output(S3C64XX_GPN(5), 0); | 126 | gpio_direction_output(S3C64XX_GPN(5), 0); |
@@ -127,7 +128,6 @@ static void smdk6410_lcd_power_set(struct plat_lcd_data *pd, | |||
127 | gpio_direction_output(S3C64XX_GPN(5), 1); | 128 | gpio_direction_output(S3C64XX_GPN(5), 1); |
128 | msleep(1); | 129 | msleep(1); |
129 | } else { | 130 | } else { |
130 | gpio_direction_output(S3C64XX_GPF(15), 0); | ||
131 | gpio_direction_output(S3C64XX_GPF(13), 0); | 131 | gpio_direction_output(S3C64XX_GPF(13), 0); |
132 | } | 132 | } |
133 | } | 133 | } |
@@ -270,6 +270,45 @@ static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = { | |||
270 | .cols = 8, | 270 | .cols = 8, |
271 | }; | 271 | }; |
272 | 272 | ||
273 | static int smdk6410_backlight_init(struct device *dev) | ||
274 | { | ||
275 | int ret; | ||
276 | |||
277 | ret = gpio_request(S3C64XX_GPF(15), "Backlight"); | ||
278 | if (ret) { | ||
279 | printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); | ||
280 | return ret; | ||
281 | } | ||
282 | |||
283 | /* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */ | ||
284 | s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2)); | ||
285 | |||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | static void smdk6410_backlight_exit(struct device *dev) | ||
290 | { | ||
291 | s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT); | ||
292 | gpio_free(S3C64XX_GPF(15)); | ||
293 | } | ||
294 | |||
295 | static struct platform_pwm_backlight_data smdk6410_backlight_data = { | ||
296 | .pwm_id = 1, | ||
297 | .max_brightness = 255, | ||
298 | .dft_brightness = 255, | ||
299 | .pwm_period_ns = 78770, | ||
300 | .init = smdk6410_backlight_init, | ||
301 | .exit = smdk6410_backlight_exit, | ||
302 | }; | ||
303 | |||
304 | static struct platform_device smdk6410_backlight_device = { | ||
305 | .name = "pwm-backlight", | ||
306 | .dev = { | ||
307 | .parent = &s3c_device_timer[1].dev, | ||
308 | .platform_data = &smdk6410_backlight_data, | ||
309 | }, | ||
310 | }; | ||
311 | |||
273 | static struct map_desc smdk6410_iodesc[] = {}; | 312 | static struct map_desc smdk6410_iodesc[] = {}; |
274 | 313 | ||
275 | static struct platform_device *smdk6410_devices[] __initdata = { | 314 | static struct platform_device *smdk6410_devices[] __initdata = { |
@@ -299,6 +338,8 @@ static struct platform_device *smdk6410_devices[] __initdata = { | |||
299 | &s3c_device_rtc, | 338 | &s3c_device_rtc, |
300 | &s3c_device_ts, | 339 | &s3c_device_ts, |
301 | &s3c_device_wdt, | 340 | &s3c_device_wdt, |
341 | &s3c_device_timer[1], | ||
342 | &smdk6410_backlight_device, | ||
302 | }; | 343 | }; |
303 | 344 | ||
304 | #ifdef CONFIG_REGULATOR | 345 | #ifdef CONFIG_REGULATOR |
@@ -694,7 +735,6 @@ static void __init smdk6410_machine_init(void) | |||
694 | 735 | ||
695 | gpio_request(S3C64XX_GPN(5), "LCD power"); | 736 | gpio_request(S3C64XX_GPN(5), "LCD power"); |
696 | gpio_request(S3C64XX_GPF(13), "LCD power"); | 737 | gpio_request(S3C64XX_GPF(13), "LCD power"); |
697 | gpio_request(S3C64XX_GPF(15), "LCD power"); | ||
698 | 738 | ||
699 | i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); | 739 | i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); |
700 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | 740 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); |
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index 164d2783d381..08b0a5bf1d60 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -34,6 +34,7 @@ config MACH_SMDK6440 | |||
34 | select S3C_DEV_WDT | 34 | select S3C_DEV_WDT |
35 | select S3C64XX_DEV_SPI | 35 | select S3C64XX_DEV_SPI |
36 | select SAMSUNG_DEV_ADC | 36 | select SAMSUNG_DEV_ADC |
37 | select SAMSUNG_DEV_PWM | ||
37 | select SAMSUNG_DEV_TS | 38 | select SAMSUNG_DEV_TS |
38 | select S5P64X0_SETUP_I2C1 | 39 | select S5P64X0_SETUP_I2C1 |
39 | help | 40 | help |
@@ -47,6 +48,7 @@ config MACH_SMDK6450 | |||
47 | select S3C_DEV_WDT | 48 | select S3C_DEV_WDT |
48 | select S3C64XX_DEV_SPI | 49 | select S3C64XX_DEV_SPI |
49 | select SAMSUNG_DEV_ADC | 50 | select SAMSUNG_DEV_ADC |
51 | select SAMSUNG_DEV_PWM | ||
50 | select SAMSUNG_DEV_TS | 52 | select SAMSUNG_DEV_TS |
51 | select S5P64X0_SETUP_I2C1 | 53 | select S5P64X0_SETUP_I2C1 |
52 | help | 54 | help |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index e5beb84e2393..366dca4ec794 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/pwm_backlight.h> | ||
25 | 26 | ||
26 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
27 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <mach/map.h> | 33 | #include <mach/map.h> |
33 | #include <mach/regs-clock.h> | 34 | #include <mach/regs-clock.h> |
34 | #include <mach/i2c.h> | 35 | #include <mach/i2c.h> |
36 | #include <mach/regs-gpio.h> | ||
35 | 37 | ||
36 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
37 | #include <plat/gpio-cfg.h> | 39 | #include <plat/gpio-cfg.h> |
@@ -88,6 +90,45 @@ static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = { | |||
88 | }, | 90 | }, |
89 | }; | 91 | }; |
90 | 92 | ||
93 | static int smdk6440_backlight_init(struct device *dev) | ||
94 | { | ||
95 | int ret; | ||
96 | |||
97 | ret = gpio_request(S5P6440_GPF(15), "Backlight"); | ||
98 | if (ret) { | ||
99 | printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); | ||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | /* Configure GPIO pin with S5P6440_GPF15_PWM_TOUT1 */ | ||
104 | s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_SFN(2)); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static void smdk6440_backlight_exit(struct device *dev) | ||
110 | { | ||
111 | s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_OUTPUT); | ||
112 | gpio_free(S5P6440_GPF(15)); | ||
113 | } | ||
114 | |||
115 | static struct platform_pwm_backlight_data smdk6440_backlight_data = { | ||
116 | .pwm_id = 1, | ||
117 | .max_brightness = 255, | ||
118 | .dft_brightness = 255, | ||
119 | .pwm_period_ns = 78770, | ||
120 | .init = smdk6440_backlight_init, | ||
121 | .exit = smdk6440_backlight_exit, | ||
122 | }; | ||
123 | |||
124 | static struct platform_device smdk6440_backlight_device = { | ||
125 | .name = "pwm-backlight", | ||
126 | .dev = { | ||
127 | .parent = &s3c_device_timer[1].dev, | ||
128 | .platform_data = &smdk6440_backlight_data, | ||
129 | }, | ||
130 | }; | ||
131 | |||
91 | static struct platform_device *smdk6440_devices[] __initdata = { | 132 | static struct platform_device *smdk6440_devices[] __initdata = { |
92 | &s3c_device_adc, | 133 | &s3c_device_adc, |
93 | &s3c_device_rtc, | 134 | &s3c_device_rtc, |
@@ -97,6 +138,8 @@ static struct platform_device *smdk6440_devices[] __initdata = { | |||
97 | &s3c_device_wdt, | 138 | &s3c_device_wdt, |
98 | &samsung_asoc_dma, | 139 | &samsung_asoc_dma, |
99 | &s5p6440_device_iis, | 140 | &s5p6440_device_iis, |
141 | &s3c_device_timer[1], | ||
142 | &smdk6440_backlight_device, | ||
100 | }; | 143 | }; |
101 | 144 | ||
102 | static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { | 145 | static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 3a20de0a9264..1d8f9fd5af3a 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/pwm_backlight.h> | ||
25 | 26 | ||
26 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
27 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <mach/map.h> | 33 | #include <mach/map.h> |
33 | #include <mach/regs-clock.h> | 34 | #include <mach/regs-clock.h> |
34 | #include <mach/i2c.h> | 35 | #include <mach/i2c.h> |
36 | #include <mach/regs-gpio.h> | ||
35 | 37 | ||
36 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
37 | #include <plat/gpio-cfg.h> | 39 | #include <plat/gpio-cfg.h> |
@@ -106,6 +108,45 @@ static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = { | |||
106 | #endif | 108 | #endif |
107 | }; | 109 | }; |
108 | 110 | ||
111 | static int smdk6450_backlight_init(struct device *dev) | ||
112 | { | ||
113 | int ret; | ||
114 | |||
115 | ret = gpio_request(S5P6450_GPF(15), "Backlight"); | ||
116 | if (ret) { | ||
117 | printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); | ||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | /* Configure GPIO pin with S5P6450_GPF15_PWM_TOUT1 */ | ||
122 | s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_SFN(2)); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void smdk6450_backlight_exit(struct device *dev) | ||
128 | { | ||
129 | s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_OUTPUT); | ||
130 | gpio_free(S5P6450_GPF(15)); | ||
131 | } | ||
132 | |||
133 | static struct platform_pwm_backlight_data smdk6450_backlight_data = { | ||
134 | .pwm_id = 1, | ||
135 | .max_brightness = 255, | ||
136 | .dft_brightness = 255, | ||
137 | .pwm_period_ns = 78770, | ||
138 | .init = smdk6450_backlight_init, | ||
139 | .exit = smdk6450_backlight_exit, | ||
140 | }; | ||
141 | |||
142 | static struct platform_device smdk6450_backlight_device = { | ||
143 | .name = "pwm-backlight", | ||
144 | .dev = { | ||
145 | .parent = &s3c_device_timer[1].dev, | ||
146 | .platform_data = &smdk6450_backlight_data, | ||
147 | }, | ||
148 | }; | ||
149 | |||
109 | static struct platform_device *smdk6450_devices[] __initdata = { | 150 | static struct platform_device *smdk6450_devices[] __initdata = { |
110 | &s3c_device_adc, | 151 | &s3c_device_adc, |
111 | &s3c_device_rtc, | 152 | &s3c_device_rtc, |
@@ -115,6 +156,8 @@ static struct platform_device *smdk6450_devices[] __initdata = { | |||
115 | &s3c_device_wdt, | 156 | &s3c_device_wdt, |
116 | &samsung_asoc_dma, | 157 | &samsung_asoc_dma, |
117 | &s5p6450_device_iis0, | 158 | &s5p6450_device_iis0, |
159 | &s3c_device_timer[1], | ||
160 | &smdk6450_backlight_device, | ||
118 | /* s5p6450_device_spi0 will be added */ | 161 | /* s5p6450_device_spi0 will be added */ |
119 | }; | 162 | }; |
120 | 163 | ||
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index b8fbf2fcba6f..608722ff4f28 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -58,6 +58,7 @@ config MACH_SMDKC100 | |||
58 | select SAMSUNG_DEV_ADC | 58 | select SAMSUNG_DEV_ADC |
59 | select SAMSUNG_DEV_IDE | 59 | select SAMSUNG_DEV_IDE |
60 | select SAMSUNG_DEV_KEYPAD | 60 | select SAMSUNG_DEV_KEYPAD |
61 | select SAMSUNG_DEV_PWM | ||
61 | select SAMSUNG_DEV_TS | 62 | select SAMSUNG_DEV_TS |
62 | select S5PC100_SETUP_FB_24BPP | 63 | select S5PC100_SETUP_FB_24BPP |
63 | select S5PC100_SETUP_I2C1 | 64 | select S5PC100_SETUP_I2C1 |
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c index dd192a27524d..0525cb3ef406 100644 --- a/arch/arm/mach-s5pc100/mach-smdkc100.c +++ b/arch/arm/mach-s5pc100/mach-smdkc100.c | |||
@@ -23,12 +23,15 @@ | |||
23 | #include <linux/fb.h> | 23 | #include <linux/fb.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/pwm_backlight.h> | ||
26 | 27 | ||
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
29 | 30 | ||
30 | #include <mach/map.h> | 31 | #include <mach/map.h> |
31 | #include <mach/regs-fb.h> | 32 | #include <mach/regs-fb.h> |
33 | #include <mach/regs-gpio.h> | ||
34 | |||
32 | #include <video/platform_lcd.h> | 35 | #include <video/platform_lcd.h> |
33 | 36 | ||
34 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
@@ -107,9 +110,6 @@ static struct i2c_board_info i2c_devs1[] __initdata = { | |||
107 | static void smdkc100_lcd_power_set(struct plat_lcd_data *pd, | 110 | static void smdkc100_lcd_power_set(struct plat_lcd_data *pd, |
108 | unsigned int power) | 111 | unsigned int power) |
109 | { | 112 | { |
110 | /* backlight */ | ||
111 | gpio_direction_output(S5PC100_GPD(0), power); | ||
112 | |||
113 | if (power) { | 113 | if (power) { |
114 | /* module reset */ | 114 | /* module reset */ |
115 | gpio_direction_output(S5PC100_GPH0(6), 1); | 115 | gpio_direction_output(S5PC100_GPH0(6), 1); |
@@ -179,6 +179,45 @@ static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = { | |||
179 | .cols = 8, | 179 | .cols = 8, |
180 | }; | 180 | }; |
181 | 181 | ||
182 | static int smdkc100_backlight_init(struct device *dev) | ||
183 | { | ||
184 | int ret; | ||
185 | |||
186 | ret = gpio_request(S5PC100_GPD(0), "Backlight"); | ||
187 | if (ret) { | ||
188 | printk(KERN_ERR "failed to request GPF for PWM-OUT0\n"); | ||
189 | return ret; | ||
190 | } | ||
191 | |||
192 | /* Configure GPIO pin with S5PC100_GPD_TOUT_0 */ | ||
193 | s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_SFN(2)); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static void smdkc100_backlight_exit(struct device *dev) | ||
199 | { | ||
200 | s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_OUTPUT); | ||
201 | gpio_free(S5PC100_GPD(0)); | ||
202 | } | ||
203 | |||
204 | static struct platform_pwm_backlight_data smdkc100_backlight_data = { | ||
205 | .pwm_id = 0, | ||
206 | .max_brightness = 255, | ||
207 | .dft_brightness = 255, | ||
208 | .pwm_period_ns = 78770, | ||
209 | .init = smdkc100_backlight_init, | ||
210 | .exit = smdkc100_backlight_exit, | ||
211 | }; | ||
212 | |||
213 | static struct platform_device smdkc100_backlight_device = { | ||
214 | .name = "pwm-backlight", | ||
215 | .dev = { | ||
216 | .parent = &s3c_device_timer[0].dev, | ||
217 | .platform_data = &smdkc100_backlight_data, | ||
218 | }, | ||
219 | }; | ||
220 | |||
182 | static struct platform_device *smdkc100_devices[] __initdata = { | 221 | static struct platform_device *smdkc100_devices[] __initdata = { |
183 | &s3c_device_adc, | 222 | &s3c_device_adc, |
184 | &s3c_device_cfcon, | 223 | &s3c_device_cfcon, |
@@ -200,6 +239,8 @@ static struct platform_device *smdkc100_devices[] __initdata = { | |||
200 | &s5p_device_fimc1, | 239 | &s5p_device_fimc1, |
201 | &s5p_device_fimc2, | 240 | &s5p_device_fimc2, |
202 | &s5pc100_device_spdif, | 241 | &s5pc100_device_spdif, |
242 | &s3c_device_timer[0], | ||
243 | &smdkc100_backlight_device, | ||
203 | }; | 244 | }; |
204 | 245 | ||
205 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { | 246 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { |
@@ -233,7 +274,6 @@ static void __init smdkc100_machine_init(void) | |||
233 | s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD); | 274 | s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD); |
234 | 275 | ||
235 | /* LCD init */ | 276 | /* LCD init */ |
236 | gpio_request(S5PC100_GPD(0), "GPD"); | ||
237 | gpio_request(S5PC100_GPH0(6), "GPH0"); | 277 | gpio_request(S5PC100_GPH0(6), "GPH0"); |
238 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); | 278 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); |
239 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); | 279 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); |
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 53aabef1e9ce..d7fd031f6015 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig | |||
@@ -130,6 +130,7 @@ config MACH_SMDKV210 | |||
130 | select SAMSUNG_DEV_ADC | 130 | select SAMSUNG_DEV_ADC |
131 | select SAMSUNG_DEV_IDE | 131 | select SAMSUNG_DEV_IDE |
132 | select SAMSUNG_DEV_KEYPAD | 132 | select SAMSUNG_DEV_KEYPAD |
133 | select SAMSUNG_DEV_PWM | ||
133 | select SAMSUNG_DEV_TS | 134 | select SAMSUNG_DEV_TS |
134 | select S5PV210_SETUP_FB_24BPP | 135 | select S5PV210_SETUP_FB_24BPP |
135 | select S5PV210_SETUP_I2C1 | 136 | select S5PV210_SETUP_I2C1 |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index bc9fdb52a020..2b5f48806c57 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/pwm_backlight.h> | ||
21 | 22 | ||
22 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
@@ -43,6 +44,7 @@ | |||
43 | #include <plat/keypad.h> | 44 | #include <plat/keypad.h> |
44 | #include <plat/pm.h> | 45 | #include <plat/pm.h> |
45 | #include <plat/fb.h> | 46 | #include <plat/fb.h> |
47 | #include <plat/gpio-cfg.h> | ||
46 | 48 | ||
47 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | 49 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
48 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 50 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
@@ -208,6 +210,45 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = { | |||
208 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, | 210 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, |
209 | }; | 211 | }; |
210 | 212 | ||
213 | static int smdkv210_backlight_init(struct device *dev) | ||
214 | { | ||
215 | int ret; | ||
216 | |||
217 | ret = gpio_request(S5PV210_GPD0(3), "Backlight"); | ||
218 | if (ret) { | ||
219 | printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n"); | ||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */ | ||
224 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_SFN(2)); | ||
225 | |||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static void smdkv210_backlight_exit(struct device *dev) | ||
230 | { | ||
231 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT); | ||
232 | gpio_free(S5PV210_GPD0(3)); | ||
233 | } | ||
234 | |||
235 | static struct platform_pwm_backlight_data smdkv210_backlight_data = { | ||
236 | .pwm_id = 3, | ||
237 | .max_brightness = 255, | ||
238 | .dft_brightness = 255, | ||
239 | .pwm_period_ns = 78770, | ||
240 | .init = smdkv210_backlight_init, | ||
241 | .exit = smdkv210_backlight_exit, | ||
242 | }; | ||
243 | |||
244 | static struct platform_device smdkv210_backlight_device = { | ||
245 | .name = "pwm-backlight", | ||
246 | .dev = { | ||
247 | .parent = &s3c_device_timer[3].dev, | ||
248 | .platform_data = &smdkv210_backlight_data, | ||
249 | }, | ||
250 | }; | ||
251 | |||
211 | static struct platform_device *smdkv210_devices[] __initdata = { | 252 | static struct platform_device *smdkv210_devices[] __initdata = { |
212 | &s3c_device_adc, | 253 | &s3c_device_adc, |
213 | &s3c_device_cfcon, | 254 | &s3c_device_cfcon, |
@@ -229,6 +270,8 @@ static struct platform_device *smdkv210_devices[] __initdata = { | |||
229 | &samsung_device_keypad, | 270 | &samsung_device_keypad, |
230 | &smdkv210_dm9000, | 271 | &smdkv210_dm9000, |
231 | &smdkv210_lcd_lte480wv, | 272 | &smdkv210_lcd_lte480wv, |
273 | &s3c_device_timer[3], | ||
274 | &smdkv210_backlight_device, | ||
232 | }; | 275 | }; |
233 | 276 | ||
234 | static void __init smdkv210_dm9000_init(void) | 277 | static void __init smdkv210_dm9000_init(void) |
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index eb105e61c746..d9c4096ebf45 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig | |||
@@ -56,13 +56,6 @@ config S3C24XX_DCLK | |||
56 | help | 56 | help |
57 | Clock code for supporting DCLK/CLKOUT on S3C24XX architectures | 57 | Clock code for supporting DCLK/CLKOUT on S3C24XX architectures |
58 | 58 | ||
59 | config S3C24XX_PWM | ||
60 | bool "PWM device support" | ||
61 | select HAVE_PWM | ||
62 | help | ||
63 | Support for exporting the PWM timer blocks via the pwm device | ||
64 | system. | ||
65 | |||
66 | # gpio configurations | 59 | # gpio configurations |
67 | 60 | ||
68 | config S3C24XX_GPIO_EXTRA | 61 | config S3C24XX_GPIO_EXTRA |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 32be05cf82a3..be72100b81b4 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -273,6 +273,19 @@ config SAMSUNG_DEV_KEYPAD | |||
273 | help | 273 | help |
274 | Compile in platform device definitions for keypad | 274 | Compile in platform device definitions for keypad |
275 | 275 | ||
276 | config SAMSUNG_DEV_PWM | ||
277 | bool | ||
278 | default y if ARCH_S3C2410 | ||
279 | help | ||
280 | Compile in platform device definition for PWM Timer | ||
281 | |||
282 | config S3C24XX_PWM | ||
283 | bool "PWM device support" | ||
284 | select HAVE_PWM | ||
285 | help | ||
286 | Support for exporting the PWM timer blocks via the pwm device | ||
287 | system | ||
288 | |||
276 | # DMA | 289 | # DMA |
277 | 290 | ||
278 | config S3C_DMA | 291 | config S3C_DMA |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 29932f88a8d6..e9de58a2e294 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o | |||
59 | obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o | 59 | obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o |
60 | obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o | 60 | obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o |
61 | obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o | 61 | obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o |
62 | obj-$(CONFIG_SAMSUNG_DEV_PWM) += dev-pwm.o | ||
62 | 63 | ||
63 | # DMA support | 64 | # DMA support |
64 | 65 | ||
diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c new file mode 100644 index 000000000000..dab47b0e1900 --- /dev/null +++ b/arch/arm/plat-samsung/dev-pwm.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-pwm.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2007 Ben Dooks | ||
7 | * Copyright (c) 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org> | ||
9 | * | ||
10 | * S3C series device definition for the PWM timer | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | #include <mach/irqs.h> | ||
21 | |||
22 | #include <plat/devs.h> | ||
23 | |||
24 | #define TIMER_RESOURCE_SIZE (1) | ||
25 | |||
26 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
27 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
28 | [0] = { \ | ||
29 | .start = _irq, \ | ||
30 | .end = _irq, \ | ||
31 | .flags = IORESOURCE_IRQ \ | ||
32 | } \ | ||
33 | } | ||
34 | |||
35 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
36 | .name = "s3c24xx-pwm", \ | ||
37 | .id = _tmr_no, \ | ||
38 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
39 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
40 | |||
41 | /* | ||
42 | * since we already have an static mapping for the timer, | ||
43 | * we do not bother setting any IO resource for the base. | ||
44 | */ | ||
45 | |||
46 | struct platform_device s3c_device_timer[] = { | ||
47 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
48 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
49 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
50 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
51 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
52 | }; | ||
53 | EXPORT_SYMBOL(s3c_device_timer); | ||
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c index 2eeb49fa056d..f37457c52064 100644 --- a/arch/arm/plat-samsung/pwm.c +++ b/arch/arm/plat-samsung/pwm.c | |||
@@ -20,10 +20,8 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/pwm.h> | 21 | #include <linux/pwm.h> |
22 | 22 | ||
23 | #include <mach/irqs.h> | ||
24 | #include <mach/map.h> | 23 | #include <mach/map.h> |
25 | 24 | ||
26 | #include <plat/devs.h> | ||
27 | #include <plat/regs-timer.h> | 25 | #include <plat/regs-timer.h> |
28 | 26 | ||
29 | struct pwm_device { | 27 | struct pwm_device { |
@@ -47,37 +45,6 @@ struct pwm_device { | |||
47 | 45 | ||
48 | static struct clk *clk_scaler[2]; | 46 | static struct clk *clk_scaler[2]; |
49 | 47 | ||
50 | /* Standard setup for a timer block. */ | ||
51 | |||
52 | #define TIMER_RESOURCE_SIZE (1) | ||
53 | |||
54 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
55 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
56 | [0] = { \ | ||
57 | .start = _irq, \ | ||
58 | .end = _irq, \ | ||
59 | .flags = IORESOURCE_IRQ \ | ||
60 | } \ | ||
61 | } | ||
62 | |||
63 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
64 | .name = "s3c24xx-pwm", \ | ||
65 | .id = _tmr_no, \ | ||
66 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
67 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
68 | |||
69 | /* since we already have an static mapping for the timer, we do not | ||
70 | * bother setting any IO resource for the base. | ||
71 | */ | ||
72 | |||
73 | struct platform_device s3c_device_timer[] = { | ||
74 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
75 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
76 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
77 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
78 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
79 | }; | ||
80 | |||
81 | static inline int pwm_is_tdiv(struct pwm_device *pwm) | 48 | static inline int pwm_is_tdiv(struct pwm_device *pwm) |
82 | { | 49 | { |
83 | return clk_get_parent(pwm->clk) == pwm->clk_div; | 50 | return clk_get_parent(pwm->clk) == pwm->clk_div; |