14 #include <linux/kernel.h>
15 #include <linux/types.h>
17 #include <linux/list.h>
24 #include <linux/serial_core.h>
25 #include <linux/input.h>
27 #include <linux/device.h>
33 #include <linux/i2c.h>
44 #include <mach/regs-gpio.h>
45 #include <mach/regs-lcd.h>
49 #include <plat/clock.h>
66 #define LCD_PWM_PERIOD 192960
67 #define LCD_PWM_DUTY 127353
126 static int power_supply_init(
struct device *
dev)
131 static int rx1950_is_ac_online(
void)
136 static void power_supply_exit(
struct device *dev)
141 static char *rx1950_supplicants[] = {
146 .init = power_supply_init,
147 .is_ac_online = rx1950_is_ac_online,
148 .exit = power_supply_exit,
149 .supplied_to = rx1950_supplicants,
150 .num_supplicants =
ARRAY_SIZE(rx1950_supplicants),
153 static struct resource power_supply_resources[] = {
165 .resource = power_supply_resources,
166 .num_resources =
ARRAY_SIZE(power_supply_resources),
170 { .volt = 4100, .cur = 156, .level = 100},
171 { .volt = 4050, .cur = 156, .level = 95},
172 { .volt = 4025, .cur = 141, .level = 90},
173 { .volt = 3995, .cur = 144, .level = 85},
174 { .volt = 3957, .cur = 162, .level = 80},
175 { .volt = 3931, .cur = 147, .level = 75},
176 { .volt = 3902, .cur = 147, .level = 70},
177 { .volt = 3863, .cur = 153, .level = 65},
178 { .volt = 3838, .cur = 150, .level = 60},
179 { .volt = 3800, .cur = 153, .level = 55},
180 { .volt = 3765, .cur = 153, .level = 50},
181 { .volt = 3748, .cur = 172, .level = 45},
182 { .volt = 3740, .cur = 153, .level = 40},
183 { .volt = 3714, .cur = 175, .level = 35},
184 { .volt = 3710, .cur = 156, .level = 30},
185 { .volt = 3963, .cur = 156, .level = 25},
186 { .volt = 3672, .cur = 178, .level = 20},
187 { .volt = 3651, .cur = 178, .level = 15},
188 { .volt = 3629, .cur = 178, .level = 10},
189 { .volt = 3612, .cur = 162, .level = 5},
190 { .volt = 3605, .cur = 162, .level = 0},
194 { .volt = 4200, .cur = 0, .level = 100},
195 { .volt = 4190, .cur = 0, .level = 99},
196 { .volt = 4178, .cur = 0, .level = 95},
197 { .volt = 4110, .cur = 0, .level = 70},
198 { .volt = 4076, .cur = 0, .level = 65},
199 { .volt = 4046, .cur = 0, .level = 60},
200 { .volt = 4021, .cur = 0, .level = 55},
201 { .volt = 3999, .cur = 0, .level = 50},
202 { .volt = 3982, .cur = 0, .level = 45},
203 { .volt = 3965, .cur = 0, .level = 40},
204 { .volt = 3957, .cur = 0, .level = 35},
205 { .volt = 3948, .cur = 0, .level = 30},
206 { .volt = 3936, .cur = 0, .level = 25},
207 { .volt = 3927, .cur = 0, .level = 20},
208 { .volt = 3906, .cur = 0, .level = 15},
209 { .volt = 3880, .cur = 0, .level = 10},
210 { .volt = 3829, .cur = 0, .level = 5},
211 { .volt = 3820, .cur = 0, .level = 0},
214 static int rx1950_bat_init(
void)
233 static void rx1950_bat_exit(
void)
239 static void rx1950_enable_charger(
void)
245 static void rx1950_disable_charger(
void)
253 static int rx1950_led_blink_set(
unsigned gpio,
int state,
254 unsigned long *delay_on,
unsigned long *delay_off)
272 if (delay_on && delay_off && !*delay_on && !*delay_off)
273 *delay_on = *delay_off = 500;
275 spin_lock(&rx1950_blink_spin);
292 spin_unlock(&rx1950_blink_spin);
297 static struct gpio_led rx1950_leds_desc[] = {
300 .default_trigger =
"main-battery-full",
302 .retain_state_suspended = 1,
307 =
"main-battery-charging-blink-full-solid",
309 .retain_state_suspended = 1,
313 .default_trigger =
"rx1950-acx-mem",
315 .retain_state_suspended = 1,
321 .leds = rx1950_leds_desc,
322 .gpio_blink_set = rx1950_led_blink_set,
329 .platform_data = &rx1950_leds_pdata,
334 .init = rx1950_bat_init,
335 .exit = rx1950_bat_exit,
336 .enable_charger = rx1950_enable_charger,
337 .disable_charger = rx1950_disable_charger,
339 .lut_noac = bat_lut_noac,
341 .lut_acin = bat_lut_acin,
344 .current_channel = 1,
346 .current_mult = 2900,
347 .internal_impedance = 200,
351 .name =
"s3c-adc-battery",
355 .platform_data = &rx1950_bat_cfg,
360 .displays = &rx1950_display,
362 .default_display = 0,
365 .gpccon = 0xaa9556a9,
366 .gpccon_mask = 0xffc003fc,
368 .gpcup_mask = 0xffffffff,
370 .gpdcon = 0xaa90aaa1,
371 .gpdcon_mask = 0xffc0fff0,
373 .gpdup_mask = 0xffffffff,
379 static void rx1950_lcd_power(
int enable)
383 if (enabled == enable)
388 for (i = 11; i < 16; i++)
397 for (i = 2; i < 8; i++)
399 for (i = 11; i < 16; i++)
409 for (i = 1; i < 5; i++)
413 for (i = 11; i < 16; i++)
417 for (i = 11; i < 16; i++)
420 for (i = 2; i < 8; i++)
446 for (i = 1; i < 5; i++)
449 for (i = 11; i < 16; i++)
452 for (i = 2; i < 8; i++)
455 for (i = 11; i < 16; i++)
464 static void rx1950_bl_power(
int enable)
467 if (enabled == enable)
484 static int rx1950_backlight_init(
struct device *dev)
488 if (IS_ERR(lcd_pwm)) {
489 dev_err(dev,
"Unable to request PWM for LCD power!\n");
490 return PTR_ERR(lcd_pwm);
499 static void rx1950_backlight_exit(
struct device *dev)
523 .max_brightness = 24,
525 .pwm_period_ns = 48000,
526 .init = rx1950_backlight_init,
527 .notify = rx1950_backlight_notify,
528 .exit = rx1950_backlight_exit,
532 .name =
"pwm-backlight",
535 .platform_data = &rx1950_backlight_data,
539 static void rx1950_set_mmc_power(
unsigned char power_mode,
unsigned short vdd)
541 switch (power_mode) {
557 .set_power = rx1950_set_mmc_power,
581 .name =
"Filesystem",
592 .nr_partitions =
ARRAY_SIZE(rx1950_nand_part),
593 .partitions = rx1950_nand_part,
602 .sets = rx1950_nand_sets,
607 .vbus_pin_inverted = 1,
614 .oversampling_shift = 3,
622 .desc =
"Power button",
629 .desc =
"Record button",
635 .desc =
"Calendar button",
641 .desc =
"Contacts button",
647 .desc =
"Mail button",
653 .desc =
"WLAN button",
659 .desc =
"Left button",
665 .desc =
"Right button",
677 .desc =
"Down button",
688 .buttons = rx1950_gpio_keys_table,
689 .nbuttons =
ARRAY_SIZE(rx1950_gpio_keys_table),
694 .dev.platform_data = &rx1950_gpio_keys_data,
706 .platform_data = &uda1380_info,
723 &s3c_device_timer[1],
725 &rx1950_device_gpiokeys,
731 static struct clk *rx1950_clocks[] __initdata = {
736 static void __init rx1950_map_io(
void)
749 #ifdef CONFIG_PM_H1940
756 static void __init rx1950_init_machine(
void)
777 for (i = 0; i < 8; i++)
780 for (i = 10; i < 16; i++)
783 for (i = 2; i < 8; i++)
786 for (i = 11; i < 16; i++)
805 static void __init rx1950_reserve(
void)
813 .atag_offset = 0x100,
814 .map_io = rx1950_map_io,
815 .reserve = rx1950_reserve,
817 .init_machine = rx1950_init_machine,