aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 19:49:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 19:49:34 -0400
commite4dd65496f6d09cbf4372d69b3b079848fe82ce3 (patch)
tree529068eb53653fd2d98c9935a6ce04ff1d7da1a9
parent44234d0c465d996145e9c821fa28a981f2e8309d (diff)
parentd7b4e421a5be88f2f5b3cfe9aec638d90c62bc0f (diff)
Merge branch 'for-2637/s3c24xx-all' of git://git.fluff.org/bjdooks/linux
* 'for-2637/s3c24xx-all' of git://git.fluff.org/bjdooks/linux: ARM: h1940: add UDA1380 to i2c devices list ARM: h1940: Fix backlight and LCD power functions ARM: S3C2440: fix boot failure introduced by recent changes in gpiolib ARM: S3C2440: various fixes in Kconfig file ARM: rx1950: Add UDA1380 to i2c devices list ARM: rx1950: Add LEDs support ARM: rx1950: Add battery device ARM: h1940: Implement mmc_power function ARM: h1940: Use gpiolib for latch access
-rw-r--r--arch/arm/mach-s3c2410/h1940-bluetooth.c13
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h57
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c169
-rw-r--r--arch/arm/mach-s3c2440/Kconfig7
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c218
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig1
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c2
7 files changed, 399 insertions, 68 deletions
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8cdeb14af59..8aa2f1902a9 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -30,7 +30,7 @@ static void h1940bt_enable(int on)
30{ 30{
31 if (on) { 31 if (on) {
32 /* Power on the chip */ 32 /* Power on the chip */
33 h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); 33 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
34 /* Reset the chip */ 34 /* Reset the chip */
35 mdelay(10); 35 mdelay(10);
36 36
@@ -43,7 +43,7 @@ static void h1940bt_enable(int on)
43 mdelay(10); 43 mdelay(10);
44 gpio_set_value(S3C2410_GPH(1), 0); 44 gpio_set_value(S3C2410_GPH(1), 0);
45 mdelay(10); 45 mdelay(10);
46 h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); 46 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
47 } 47 }
48} 48}
49 49
@@ -64,7 +64,14 @@ static int __devinit h1940bt_probe(struct platform_device *pdev)
64 64
65 ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev)); 65 ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev));
66 if (ret) { 66 if (ret) {
67 dev_err(&pdev->dev, "could not get GPH1\n");\ 67 dev_err(&pdev->dev, "could not get GPH1\n");
68 return ret;
69 }
70
71 ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(&pdev->dev));
72 if (ret) {
73 gpio_free(S3C2410_GPH(1));
74 dev_err(&pdev->dev, "could not get BT_POWER\n");
68 return ret; 75 return ret;
69 } 76 }
70 77
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index d8a832729a8..97e42bfce81 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,51 +14,30 @@
14#ifndef __ASM_ARCH_H1940_LATCH_H 14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H 15#define __ASM_ARCH_H1940_LATCH_H
16 16
17#include <mach/gpio.h>
17 18
18#ifndef __ASSEMBLY__ 19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x))
19#define H1940_LATCH ((void __force __iomem *)0xF8000000)
20#else
21#define H1940_LATCH 0xF8000000
22#endif
23
24#define H1940_PA_LATCH (S3C2410_CS2)
25 20
26/* SD layer latch */ 21/* SD layer latch */
27 22
28#define H1940_LATCH_SDQ1 (1<<16) 23#define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0)
29#define H1940_LATCH_LCD_P1 (1<<17) 24#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
30#define H1940_LATCH_LCD_P2 (1<<18) 25#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
31#define H1940_LATCH_LCD_P3 (1<<19) 26#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
32#define H1940_LATCH_MAX1698_nSHUTDOWN (1<<20) /* LCD backlight */ 27#define H1940_LATCH_MAX1698_nSHUTDOWN H1940_LATCH_GPIO(4)
33#define H1940_LATCH_LED_RED (1<<21) 28#define H1940_LATCH_LED_RED H1940_LATCH_GPIO(5)
34#define H1940_LATCH_SDQ7 (1<<22) 29#define H1940_LATCH_SDQ7 H1940_LATCH_GPIO(6)
35#define H1940_LATCH_USB_DP (1<<23) 30#define H1940_LATCH_USB_DP H1940_LATCH_GPIO(7)
36 31
37/* CPU layer latch */ 32/* CPU layer latch */
38 33
39#define H1940_LATCH_UDA_POWER (1<<24) 34#define H1940_LATCH_UDA_POWER H1940_LATCH_GPIO(8)
40#define H1940_LATCH_AUDIO_POWER (1<<25) 35#define H1940_LATCH_AUDIO_POWER H1940_LATCH_GPIO(9)
41#define H1940_LATCH_SM803_ENABLE (1<<26) 36#define H1940_LATCH_SM803_ENABLE H1940_LATCH_GPIO(10)
42#define H1940_LATCH_LCD_P4 (1<<27) 37#define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
43#define H1940_LATCH_CPUQ5 (1<<28) /* untraced */ 38#define H1940_LATCH_SD_POWER H1940_LATCH_GPIO(12)
44#define H1940_LATCH_BLUETOOTH_POWER (1<<29) /* active high */ 39#define H1940_LATCH_BLUETOOTH_POWER H1940_LATCH_GPIO(13)
45#define H1940_LATCH_LED_GREEN (1<<30) 40#define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14)
46#define H1940_LATCH_LED_FLASH (1<<31) 41#define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15)
47
48/* default settings */
49
50#define H1940_LATCH_DEFAULT \
51 H1940_LATCH_LCD_P4 | \
52 H1940_LATCH_SM803_ENABLE | \
53 H1940_LATCH_SDQ1 | \
54 H1940_LATCH_LCD_P1 | \
55 H1940_LATCH_LCD_P2 | \
56 H1940_LATCH_LCD_P3 | \
57 H1940_LATCH_MAX1698_nSHUTDOWN | \
58 H1940_LATCH_CPUQ5
59
60/* control functions */
61
62extern void h1940_latch_control(unsigned int clear, unsigned int set);
63 42
64#endif /* __ASM_ARCH_H1940_LATCH_H */ 43#endif /* __ASM_ARCH_H1940_LATCH_H */
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 98c5c9e81ee..d7ada8c7e41 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
27#include <linux/i2c.h>
27#include <video/platform_lcd.h> 28#include <video/platform_lcd.h>
28 29
29#include <linux/mmc/host.h> 30#include <linux/mmc/host.h>
@@ -59,6 +60,14 @@
59#include <plat/mci.h> 60#include <plat/mci.h>
60#include <plat/ts.h> 61#include <plat/ts.h>
61 62
63#include <sound/uda1380.h>
64
65#define H1940_LATCH ((void __force __iomem *)0xF8000000)
66
67#define H1940_PA_LATCH S3C2410_CS2
68
69#define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END))
70
62static struct map_desc h1940_iodesc[] __initdata = { 71static struct map_desc h1940_iodesc[] __initdata = {
63 [0] = { 72 [0] = {
64 .virtual = (unsigned long)H1940_LATCH, 73 .virtual = (unsigned long)H1940_LATCH,
@@ -100,9 +109,9 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
100 109
101/* Board control latch control */ 110/* Board control latch control */
102 111
103static unsigned int latch_state = H1940_LATCH_DEFAULT; 112static unsigned int latch_state;
104 113
105void h1940_latch_control(unsigned int clear, unsigned int set) 114static void h1940_latch_control(unsigned int clear, unsigned int set)
106{ 115{
107 unsigned long flags; 116 unsigned long flags;
108 117
@@ -116,7 +125,42 @@ void h1940_latch_control(unsigned int clear, unsigned int set)
116 local_irq_restore(flags); 125 local_irq_restore(flags);
117} 126}
118 127
119EXPORT_SYMBOL_GPL(h1940_latch_control); 128static inline int h1940_gpiolib_to_latch(int offset)
129{
130 return 1 << (offset + 16);
131}
132
133static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
134 unsigned offset, int value)
135{
136 int latch_bit = h1940_gpiolib_to_latch(offset);
137
138 h1940_latch_control(value ? 0 : latch_bit,
139 value ? latch_bit : 0);
140}
141
142static int h1940_gpiolib_latch_output(struct gpio_chip *chip,
143 unsigned offset, int value)
144{
145 h1940_gpiolib_latch_set(chip, offset, value);
146 return 0;
147}
148
149static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
150 unsigned offset)
151{
152 return (latch_state >> (offset + 16)) & 1;
153}
154
155struct gpio_chip h1940_latch_gpiochip = {
156 .base = H1940_LATCH_GPIO(0),
157 .owner = THIS_MODULE,
158 .label = "H1940_LATCH",
159 .ngpio = 16,
160 .direction_output = h1940_gpiolib_latch_output,
161 .set = h1940_gpiolib_latch_set,
162 .get = h1940_gpiolib_latch_get,
163};
120 164
121static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd) 165static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
122{ 166{
@@ -125,10 +169,10 @@ static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
125 switch (cmd) 169 switch (cmd)
126 { 170 {
127 case S3C2410_UDC_P_ENABLE : 171 case S3C2410_UDC_P_ENABLE :
128 h1940_latch_control(0, H1940_LATCH_USB_DP); 172 gpio_set_value(H1940_LATCH_USB_DP, 1);
129 break; 173 break;
130 case S3C2410_UDC_P_DISABLE : 174 case S3C2410_UDC_P_DISABLE :
131 h1940_latch_control(H1940_LATCH_USB_DP, 0); 175 gpio_set_value(H1940_LATCH_USB_DP, 0);
132 break; 176 break;
133 case S3C2410_UDC_P_RESET : 177 case S3C2410_UDC_P_RESET :
134 break; 178 break;
@@ -199,10 +243,25 @@ static struct platform_device h1940_device_bluetooth = {
199 .id = -1, 243 .id = -1,
200}; 244};
201 245
246static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
247{
248 switch (power_mode) {
249 case MMC_POWER_OFF:
250 gpio_set_value(H1940_LATCH_SD_POWER, 0);
251 break;
252 case MMC_POWER_UP:
253 case MMC_POWER_ON:
254 gpio_set_value(H1940_LATCH_SD_POWER, 1);
255 break;
256 default:
257 break;
258 };
259}
260
202static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { 261static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
203 .gpio_detect = S3C2410_GPF(5), 262 .gpio_detect = S3C2410_GPF(5),
204 .gpio_wprotect = S3C2410_GPH(8), 263 .gpio_wprotect = S3C2410_GPH(8),
205 .set_power = NULL, 264 .set_power = h1940_set_mmc_power,
206 .ocr_avail = MMC_VDD_32_33, 265 .ocr_avail = MMC_VDD_32_33,
207}; 266};
208 267
@@ -213,15 +272,32 @@ static int h1940_backlight_init(struct device *dev)
213 gpio_direction_output(S3C2410_GPB(0), 0); 272 gpio_direction_output(S3C2410_GPB(0), 0);
214 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); 273 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
215 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); 274 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
275 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
216 276
217 return 0; 277 return 0;
218} 278}
219 279
280static int h1940_backlight_notify(struct device *dev, int brightness)
281{
282 if (!brightness) {
283 gpio_direction_output(S3C2410_GPB(0), 1);
284 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
285 } else {
286 gpio_direction_output(S3C2410_GPB(0), 0);
287 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
288 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
289 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
290 }
291 return brightness;
292}
293
220static void h1940_backlight_exit(struct device *dev) 294static void h1940_backlight_exit(struct device *dev)
221{ 295{
222 gpio_direction_output(S3C2410_GPB(0), 1); 296 gpio_direction_output(S3C2410_GPB(0), 1);
297 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
223} 298}
224 299
300
225static struct platform_pwm_backlight_data backlight_data = { 301static struct platform_pwm_backlight_data backlight_data = {
226 .pwm_id = 0, 302 .pwm_id = 0,
227 .max_brightness = 100, 303 .max_brightness = 100,
@@ -229,6 +305,7 @@ static struct platform_pwm_backlight_data backlight_data = {
229 /* tcnt = 0x31 */ 305 /* tcnt = 0x31 */
230 .pwm_period_ns = 36296, 306 .pwm_period_ns = 36296,
231 .init = h1940_backlight_init, 307 .init = h1940_backlight_init,
308 .notify = h1940_backlight_notify,
232 .exit = h1940_backlight_exit, 309 .exit = h1940_backlight_exit,
233}; 310};
234 311
@@ -247,19 +324,37 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
247 int value; 324 int value;
248 325
249 if (!power) { 326 if (!power) {
250 /* set to 3ec */ 327 gpio_set_value(S3C2410_GPC(0), 0);
251 gpio_direction_output(S3C2410_GPC(0), 0);
252 /* wait for 3ac */ 328 /* wait for 3ac */
253 do { 329 do {
254 value = gpio_get_value(S3C2410_GPC(6)); 330 value = gpio_get_value(S3C2410_GPC(6));
255 } while (value); 331 } while (value);
256 /* set to 38c */ 332
257 gpio_direction_output(S3C2410_GPC(5), 0); 333 gpio_set_value(H1940_LATCH_LCD_P2, 0);
334 gpio_set_value(H1940_LATCH_LCD_P3, 0);
335 gpio_set_value(H1940_LATCH_LCD_P4, 0);
336
337 gpio_direction_output(S3C2410_GPC(1), 0);
338 gpio_direction_output(S3C2410_GPC(4), 0);
339
340 gpio_set_value(H1940_LATCH_LCD_P1, 0);
341 gpio_set_value(H1940_LATCH_LCD_P0, 0);
342
343 gpio_set_value(S3C2410_GPC(5), 0);
344
258 } else { 345 } else {
259 /* Set to 3ac */ 346 gpio_set_value(H1940_LATCH_LCD_P0, 1);
260 gpio_direction_output(S3C2410_GPC(5), 1); 347 gpio_set_value(H1940_LATCH_LCD_P1, 1);
261 /* Set to 3ad */ 348
262 gpio_direction_output(S3C2410_GPC(0), 1); 349 s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
350 s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
351
352 gpio_set_value(S3C2410_GPC(5), 1);
353 gpio_set_value(S3C2410_GPC(0), 1);
354
355 gpio_set_value(H1940_LATCH_LCD_P3, 1);
356 gpio_set_value(H1940_LATCH_LCD_P2, 1);
357 gpio_set_value(H1940_LATCH_LCD_P4, 1);
263 } 358 }
264} 359}
265 360
@@ -273,12 +368,26 @@ static struct platform_device h1940_lcd_powerdev = {
273 .dev.platform_data = &h1940_lcd_power_data, 368 .dev.platform_data = &h1940_lcd_power_data,
274}; 369};
275 370
371static struct uda1380_platform_data uda1380_info = {
372 .gpio_power = H1940_LATCH_UDA_POWER,
373 .gpio_reset = S3C2410_GPA(12),
374 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
375};
376
377static struct i2c_board_info h1940_i2c_devices[] = {
378 {
379 I2C_BOARD_INFO("uda1380", 0x1a),
380 .platform_data = &uda1380_info,
381 },
382};
383
276static struct platform_device *h1940_devices[] __initdata = { 384static struct platform_device *h1940_devices[] __initdata = {
277 &s3c_device_ohci, 385 &s3c_device_ohci,
278 &s3c_device_lcd, 386 &s3c_device_lcd,
279 &s3c_device_wdt, 387 &s3c_device_wdt,
280 &s3c_device_i2c0, 388 &s3c_device_i2c0,
281 &s3c_device_iis, 389 &s3c_device_iis,
390 &s3c_device_pcm,
282 &s3c_device_usbgadget, 391 &s3c_device_usbgadget,
283 &h1940_device_leds, 392 &h1940_device_leds,
284 &h1940_device_bluetooth, 393 &h1940_device_bluetooth,
@@ -303,6 +412,10 @@ static void __init h1940_map_io(void)
303 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 412 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
304#endif 413#endif
305 s3c_pm_init(); 414 s3c_pm_init();
415
416 /* Add latch gpio chip, set latch initial value */
417 h1940_latch_control(0, 0);
418 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
306} 419}
307 420
308/* H1940 and RX3715 need to reserve this for suspend */ 421/* H1940 and RX3715 need to reserve this for suspend */
@@ -340,12 +453,38 @@ static void __init h1940_init(void)
340 writel(tmp, S3C2410_UPLLCON); 453 writel(tmp, S3C2410_UPLLCON);
341 454
342 gpio_request(S3C2410_GPC(0), "LCD power"); 455 gpio_request(S3C2410_GPC(0), "LCD power");
456 gpio_request(S3C2410_GPC(1), "LCD power");
457 gpio_request(S3C2410_GPC(4), "LCD power");
343 gpio_request(S3C2410_GPC(5), "LCD power"); 458 gpio_request(S3C2410_GPC(5), "LCD power");
344 gpio_request(S3C2410_GPC(6), "LCD power"); 459 gpio_request(S3C2410_GPC(6), "LCD power");
345 460 gpio_request(H1940_LATCH_LCD_P0, "LCD power");
461 gpio_request(H1940_LATCH_LCD_P1, "LCD power");
462 gpio_request(H1940_LATCH_LCD_P2, "LCD power");
463 gpio_request(H1940_LATCH_LCD_P3, "LCD power");
464 gpio_request(H1940_LATCH_LCD_P4, "LCD power");
465 gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
466 gpio_direction_output(S3C2410_GPC(0), 0);
467 gpio_direction_output(S3C2410_GPC(1), 0);
468 gpio_direction_output(S3C2410_GPC(4), 0);
469 gpio_direction_output(S3C2410_GPC(5), 0);
346 gpio_direction_input(S3C2410_GPC(6)); 470 gpio_direction_input(S3C2410_GPC(6));
471 gpio_direction_output(H1940_LATCH_LCD_P0, 0);
472 gpio_direction_output(H1940_LATCH_LCD_P1, 0);
473 gpio_direction_output(H1940_LATCH_LCD_P2, 0);
474 gpio_direction_output(H1940_LATCH_LCD_P3, 0);
475 gpio_direction_output(H1940_LATCH_LCD_P4, 0);
476 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
477
478 gpio_request(H1940_LATCH_USB_DP, "USB pullup");
479 gpio_direction_output(H1940_LATCH_USB_DP, 0);
480
481 gpio_request(H1940_LATCH_SD_POWER, "SD power");
482 gpio_direction_output(H1940_LATCH_SD_POWER, 0);
347 483
348 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 484 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
485
486 i2c_register_board_info(0, h1940_i2c_devices,
487 ARRAY_SIZE(h1940_i2c_devices));
349} 488}
350 489
351MACHINE_START(H1940, "IPAQ-H1940") 490MACHINE_START(H1940, "IPAQ-H1940")
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index cd8e7de388f..ff024a6c0f8 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -4,7 +4,6 @@
4 4
5config CPU_S3C2440 5config CPU_S3C2440
6 bool 6 bool
7 depends on ARCH_S3C2410
8 select CPU_ARM920T 7 select CPU_ARM920T
9 select S3C_GPIO_PULL_UP 8 select S3C_GPIO_PULL_UP
10 select S3C2410_CLOCK 9 select S3C2410_CLOCK
@@ -18,7 +17,6 @@ config CPU_S3C2440
18 17
19config CPU_S3C2442 18config CPU_S3C2442
20 bool 19 bool
21 depends on ARCH_S3C2410
22 select CPU_ARM920T 20 select CPU_ARM920T
23 select S3C2410_CLOCK 21 select S3C2410_CLOCK
24 select S3C2410_GPIO 22 select S3C2410_GPIO
@@ -30,7 +28,7 @@ config CPU_S3C2442
30 28
31config CPU_S3C244X 29config CPU_S3C244X
32 bool 30 bool
33 depends on ARCH_S3C2410 && (CPU_S3C2440 || CPU_S3C2442) 31 depends on CPU_S3C2440 || CPU_S3C2442
34 help 32 help
35 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. 33 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
36 34
@@ -72,7 +70,7 @@ config S3C2440_PLL_16934400
72 70
73config S3C2440_DMA 71config S3C2440_DMA
74 bool 72 bool
75 depends on ARCH_S3C2410 && CPU_S3C24405B 73 depends on CPU_S3C2440
76 help 74 help
77 Support for S3C2440 specific DMA code5A 75 Support for S3C2440 specific DMA code5A
78 76
@@ -181,7 +179,6 @@ config MACH_MINI2440
181 select CPU_S3C2440 179 select CPU_S3C2440
182 select EEPROM_AT24 180 select EEPROM_AT24
183 select LEDS_TRIGGER_BACKLIGHT 181 select LEDS_TRIGGER_BACKLIGHT
184 select SND_S3C24XX_SOC_S3C24XX_UDA134X
185 select S3C_DEV_NAND 182 select S3C_DEV_NAND
186 select S3C_DEV_USB_HOST 183 select S3C_DEV_USB_HOST
187 help 184 help
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 32019bd9db3..e0622bbb6df 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -25,8 +25,12 @@
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/gpio_keys.h> 26#include <linux/gpio_keys.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/pda_power.h>
28#include <linux/pwm_backlight.h> 29#include <linux/pwm_backlight.h>
29#include <linux/pwm.h> 30#include <linux/pwm.h>
31#include <linux/s3c_adc_battery.h>
32#include <linux/leds.h>
33#include <linux/i2c.h>
30 34
31#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
32#include <linux/mtd/partitions.h> 36#include <linux/mtd/partitions.h>
@@ -55,6 +59,8 @@
55#include <plat/irq.h> 59#include <plat/irq.h>
56#include <plat/ts.h> 60#include <plat/ts.h>
57 61
62#include <sound/uda1380.h>
63
58#define LCD_PWM_PERIOD 192960 64#define LCD_PWM_PERIOD 192960
59#define LCD_PWM_DUTY 127353 65#define LCD_PWM_DUTY 127353
60 66
@@ -127,6 +133,193 @@ static struct s3c2410fb_display rx1950_display = {
127 133
128}; 134};
129 135
136static int power_supply_init(struct device *dev)
137{
138 return gpio_request(S3C2410_GPF(2), "cable plugged");
139}
140
141static int rx1950_is_ac_online(void)
142{
143 return !gpio_get_value(S3C2410_GPF(2));
144}
145
146static void power_supply_exit(struct device *dev)
147{
148 gpio_free(S3C2410_GPF(2));
149}
150
151static char *rx1950_supplicants[] = {
152 "main-battery"
153};
154
155static struct pda_power_pdata power_supply_info = {
156 .init = power_supply_init,
157 .is_ac_online = rx1950_is_ac_online,
158 .exit = power_supply_exit,
159 .supplied_to = rx1950_supplicants,
160 .num_supplicants = ARRAY_SIZE(rx1950_supplicants),
161};
162
163static struct resource power_supply_resources[] = {
164 [0] = {
165 .name = "ac",
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
167 IORESOURCE_IRQ_HIGHEDGE,
168 .start = IRQ_EINT2,
169 .end = IRQ_EINT2,
170 },
171};
172
173static struct platform_device power_supply = {
174 .name = "pda-power",
175 .id = -1,
176 .dev = {
177 .platform_data =
178 &power_supply_info,
179 },
180 .resource = power_supply_resources,
181 .num_resources = ARRAY_SIZE(power_supply_resources),
182};
183
184static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
185 { .volt = 4100, .cur = 156, .level = 100},
186 { .volt = 4050, .cur = 156, .level = 95},
187 { .volt = 4025, .cur = 141, .level = 90},
188 { .volt = 3995, .cur = 144, .level = 85},
189 { .volt = 3957, .cur = 162, .level = 80},
190 { .volt = 3931, .cur = 147, .level = 75},
191 { .volt = 3902, .cur = 147, .level = 70},
192 { .volt = 3863, .cur = 153, .level = 65},
193 { .volt = 3838, .cur = 150, .level = 60},
194 { .volt = 3800, .cur = 153, .level = 55},
195 { .volt = 3765, .cur = 153, .level = 50},
196 { .volt = 3748, .cur = 172, .level = 45},
197 { .volt = 3740, .cur = 153, .level = 40},
198 { .volt = 3714, .cur = 175, .level = 35},
199 { .volt = 3710, .cur = 156, .level = 30},
200 { .volt = 3963, .cur = 156, .level = 25},
201 { .volt = 3672, .cur = 178, .level = 20},
202 { .volt = 3651, .cur = 178, .level = 15},
203 { .volt = 3629, .cur = 178, .level = 10},
204 { .volt = 3612, .cur = 162, .level = 5},
205 { .volt = 3605, .cur = 162, .level = 0},
206};
207
208static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
209 { .volt = 4200, .cur = 0, .level = 100},
210 { .volt = 4190, .cur = 0, .level = 99},
211 { .volt = 4178, .cur = 0, .level = 95},
212 { .volt = 4110, .cur = 0, .level = 70},
213 { .volt = 4076, .cur = 0, .level = 65},
214 { .volt = 4046, .cur = 0, .level = 60},
215 { .volt = 4021, .cur = 0, .level = 55},
216 { .volt = 3999, .cur = 0, .level = 50},
217 { .volt = 3982, .cur = 0, .level = 45},
218 { .volt = 3965, .cur = 0, .level = 40},
219 { .volt = 3957, .cur = 0, .level = 35},
220 { .volt = 3948, .cur = 0, .level = 30},
221 { .volt = 3936, .cur = 0, .level = 25},
222 { .volt = 3927, .cur = 0, .level = 20},
223 { .volt = 3906, .cur = 0, .level = 15},
224 { .volt = 3880, .cur = 0, .level = 10},
225 { .volt = 3829, .cur = 0, .level = 5},
226 { .volt = 3820, .cur = 0, .level = 0},
227};
228
229int rx1950_bat_init(void)
230{
231 int ret;
232
233 ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
234 if (ret)
235 goto err_gpio1;
236 ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
237 if (ret)
238 goto err_gpio2;
239
240 return 0;
241
242err_gpio2:
243 gpio_free(S3C2410_GPJ(2));
244err_gpio1:
245 return ret;
246}
247
248void rx1950_bat_exit(void)
249{
250 gpio_free(S3C2410_GPJ(2));
251 gpio_free(S3C2410_GPJ(3));
252}
253
254void rx1950_enable_charger(void)
255{
256 gpio_direction_output(S3C2410_GPJ(2), 1);
257 gpio_direction_output(S3C2410_GPJ(3), 1);
258}
259
260void rx1950_disable_charger(void)
261{
262 gpio_direction_output(S3C2410_GPJ(2), 0);
263 gpio_direction_output(S3C2410_GPJ(3), 0);
264}
265
266static struct gpio_led rx1950_leds_desc[] = {
267 {
268 .name = "Green",
269 .default_trigger = "main-battery-charging-or-full",
270 .gpio = S3C2410_GPA(6),
271 },
272 {
273 .name = "Red",
274 .default_trigger = "main-battery-full",
275 .gpio = S3C2410_GPA(7),
276 },
277 {
278 .name = "Blue",
279 .default_trigger = "rx1950-acx-mem",
280 .gpio = S3C2410_GPA(11),
281 },
282};
283
284static struct gpio_led_platform_data rx1950_leds_pdata = {
285 .num_leds = ARRAY_SIZE(rx1950_leds_desc),
286 .leds = rx1950_leds_desc,
287};
288
289static struct platform_device rx1950_leds = {
290 .name = "leds-gpio",
291 .id = -1,
292 .dev = {
293 .platform_data = &rx1950_leds_pdata,
294 },
295};
296
297static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
298 .init = rx1950_bat_init,
299 .exit = rx1950_bat_exit,
300 .enable_charger = rx1950_enable_charger,
301 .disable_charger = rx1950_disable_charger,
302 .gpio_charge_finished = S3C2410_GPF(3),
303 .lut_noac = bat_lut_noac,
304 .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
305 .lut_acin = bat_lut_acin,
306 .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
307 .volt_channel = 0,
308 .current_channel = 1,
309 .volt_mult = 4235,
310 .current_mult = 2900,
311 .internal_impedance = 200,
312};
313
314static struct platform_device rx1950_battery = {
315 .name = "s3c-adc-battery",
316 .id = -1,
317 .dev = {
318 .parent = &s3c_device_adc.dev,
319 .platform_data = &rx1950_bat_cfg,
320 },
321};
322
130static struct s3c2410fb_mach_info rx1950_lcd_cfg = { 323static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
131 .displays = &rx1950_display, 324 .displays = &rx1950_display,
132 .num_displays = 1, 325 .num_displays = 1,
@@ -481,11 +674,17 @@ static struct platform_device rx1950_device_gpiokeys = {
481 .dev.platform_data = &rx1950_gpio_keys_data, 674 .dev.platform_data = &rx1950_gpio_keys_data,
482}; 675};
483 676
484static struct s3c2410_platform_i2c rx1950_i2c_data = { 677static struct uda1380_platform_data uda1380_info = {
485 .flags = 0, 678 .gpio_power = S3C2410_GPJ(0),
486 .slave_addr = 0x42, 679 .gpio_reset = S3C2410_GPD(0),
487 .frequency = 400 * 1000, 680 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
488 .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, 681};
682
683static struct i2c_board_info rx1950_i2c_devices[] = {
684 {
685 I2C_BOARD_INFO("uda1380", 0x1a),
686 .platform_data = &uda1380_info,
687 },
489}; 688};
490 689
491static struct platform_device *rx1950_devices[] __initdata = { 690static struct platform_device *rx1950_devices[] __initdata = {
@@ -493,6 +692,7 @@ static struct platform_device *rx1950_devices[] __initdata = {
493 &s3c_device_wdt, 692 &s3c_device_wdt,
494 &s3c_device_i2c0, 693 &s3c_device_i2c0,
495 &s3c_device_iis, 694 &s3c_device_iis,
695 &s3c_device_pcm,
496 &s3c_device_usbgadget, 696 &s3c_device_usbgadget,
497 &s3c_device_rtc, 697 &s3c_device_rtc,
498 &s3c_device_nand, 698 &s3c_device_nand,
@@ -503,6 +703,9 @@ static struct platform_device *rx1950_devices[] __initdata = {
503 &s3c_device_timer[1], 703 &s3c_device_timer[1],
504 &rx1950_backlight, 704 &rx1950_backlight,
505 &rx1950_device_gpiokeys, 705 &rx1950_device_gpiokeys,
706 &power_supply,
707 &rx1950_battery,
708 &rx1950_leds,
506}; 709};
507 710
508static struct clk *rx1950_clocks[] __initdata = { 711static struct clk *rx1950_clocks[] __initdata = {
@@ -538,7 +741,7 @@ static void __init rx1950_init_machine(void)
538 s3c24xx_udc_set_platdata(&rx1950_udc_cfg); 741 s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
539 s3c24xx_ts_set_platdata(&rx1950_ts_cfg); 742 s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
540 s3c24xx_mci_set_platdata(&rx1950_mmc_cfg); 743 s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
541 s3c_i2c0_set_platdata(&rx1950_i2c_data); 744 s3c_i2c0_set_platdata(NULL);
542 s3c_nand_set_platdata(&rx1950_nand_info); 745 s3c_nand_set_platdata(&rx1950_nand_info);
543 746
544 /* Turn off suspend on both USB ports, and switch the 747 /* Turn off suspend on both USB ports, and switch the
@@ -569,6 +772,9 @@ static void __init rx1950_init_machine(void)
569 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); 772 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
570 773
571 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 774 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
775
776 i2c_register_board_info(0, rx1950_i2c_devices,
777 ARRAY_SIZE(rx1950_i2c_devices));
572} 778}
573 779
574/* H1940 and RX3715 need to reserve this for suspend */ 780/* H1940 and RX3715 need to reserve this for suspend */
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 984bf66826d..5a27b1b538f 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -69,6 +69,7 @@ config S3C24XX_GPIO_EXTRA
69 int 69 int
70 default 128 if S3C24XX_GPIO_EXTRA128 70 default 128 if S3C24XX_GPIO_EXTRA128
71 default 64 if S3C24XX_GPIO_EXTRA64 71 default 64 if S3C24XX_GPIO_EXTRA64
72 default 16 if ARCH_H1940
72 default 0 73 default 0
73 74
74config S3C24XX_GPIO_EXTRA64 75config S3C24XX_GPIO_EXTRA64
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 4c0896f2572..ae9d3c2403f 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -87,6 +87,8 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
87struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { 87struct s3c_gpio_cfg s3c24xx_gpiocfg_default = {
88 .set_config = s3c_gpio_setcfg_s3c24xx, 88 .set_config = s3c_gpio_setcfg_s3c24xx,
89 .get_config = s3c_gpio_getcfg_s3c24xx, 89 .get_config = s3c_gpio_getcfg_s3c24xx,
90 .set_pull = s3c_gpio_setpull_1up,
91 .get_pull = s3c_gpio_getpull_1up,
90}; 92};
91 93
92struct s3c_gpio_chip s3c24xx_gpios[] = { 94struct s3c_gpio_chip s3c24xx_gpios[] = {