aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2009-10-22 15:35:33 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-11-30 20:03:00 -0500
commitb64b0b76cd90406f5411dc29308b9bb83180bfd6 (patch)
tree38ee75f3caf9893503b003f96742ab12b480167d /arch
parent61333c63005e5708977e309da32c952057ee445b (diff)
[ARM] pxa/zaurus: cleanup sharpsl_pm.c
This fixes checkpatch/style problems in sharpsl_pm.c, allowing me to submit real fixes next. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c108
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c10
2 files changed, 59 insertions, 59 deletions
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 629e05d1196e..dc3907f7986c 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -165,19 +165,20 @@ struct battery_thresh spitz_battery_levels_noac[] = {
165}; 165};
166 166
167/* MAX1111 Commands */ 167/* MAX1111 Commands */
168#define MAXCTRL_PD0 1u << 0 168#define MAXCTRL_PD0 (1u << 0)
169#define MAXCTRL_PD1 1u << 1 169#define MAXCTRL_PD1 (1u << 1)
170#define MAXCTRL_SGL 1u << 2 170#define MAXCTRL_SGL (1u << 2)
171#define MAXCTRL_UNI 1u << 3 171#define MAXCTRL_UNI (1u << 3)
172#define MAXCTRL_SEL_SH 4 172#define MAXCTRL_SEL_SH 4
173#define MAXCTRL_STR 1u << 7 173#define MAXCTRL_STR (1u << 7)
174 174
175/* 175/*
176 * Read MAX1111 ADC 176 * Read MAX1111 ADC
177 */ 177 */
178int sharpsl_pm_pxa_read_max1111(int channel) 178int sharpsl_pm_pxa_read_max1111(int channel)
179{ 179{
180 if (machine_is_tosa()) // Ugly, better move this function into another module 180 /* Ugly, better move this function into another module */
181 if (machine_is_tosa())
181 return 0; 182 return 0;
182 183
183#ifdef CONFIG_CORGI_SSP_DEPRECATED 184#ifdef CONFIG_CORGI_SSP_DEPRECATED
@@ -238,7 +239,7 @@ EXPORT_SYMBOL(sharpsl_battery_kick);
238 239
239static void sharpsl_battery_thread(struct work_struct *private_) 240static void sharpsl_battery_thread(struct work_struct *private_)
240{ 241{
241 int voltage, percent, apm_status, i = 0; 242 int voltage, percent, apm_status, i;
242 243
243 if (!sharpsl_pm.machinfo) 244 if (!sharpsl_pm.machinfo)
244 return; 245 return;
@@ -250,15 +251,14 @@ static void sharpsl_battery_thread(struct work_struct *private_)
250 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) 251 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL))
251 schedule_delayed_work(&toggle_charger, 0); 252 schedule_delayed_work(&toggle_charger, 0);
252 253
253 while(1) { 254 for (i = 0; i < 5; i++) {
254 voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); 255 voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
255 256 if (voltage > 0)
256 if (voltage > 0) break;
257 if (i++ > 5) {
258 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
259 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
260 break; 257 break;
261 } 258 }
259 if (voltage <= 0) {
260 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
261 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
262 } 262 }
263 263
264 voltage = sharpsl_average_value(voltage); 264 voltage = sharpsl_average_value(voltage);
@@ -266,8 +266,10 @@ static void sharpsl_battery_thread(struct work_struct *private_)
266 percent = get_percentage(voltage); 266 percent = get_percentage(voltage);
267 267
268 /* At low battery voltages, the voltage has a tendency to start 268 /* At low battery voltages, the voltage has a tendency to start
269 creeping back up so we try to avoid this here */ 269 creeping back up so we try to avoid this here */
270 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) { 270 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE)
271 || (apm_status == APM_BATTERY_STATUS_HIGH)
272 || percent <= sharpsl_pm.battstat.mainbat_percent) {
271 sharpsl_pm.battstat.mainbat_voltage = voltage; 273 sharpsl_pm.battstat.mainbat_voltage = voltage;
272 sharpsl_pm.battstat.mainbat_status = apm_status; 274 sharpsl_pm.battstat.mainbat_status = apm_status;
273 sharpsl_pm.battstat.mainbat_percent = percent; 275 sharpsl_pm.battstat.mainbat_percent = percent;
@@ -279,8 +281,8 @@ static void sharpsl_battery_thread(struct work_struct *private_)
279#ifdef CONFIG_BACKLIGHT_CORGI 281#ifdef CONFIG_BACKLIGHT_CORGI
280 /* If battery is low. limit backlight intensity to save power. */ 282 /* If battery is low. limit backlight intensity to save power. */
281 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) 283 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
282 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || 284 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW)
283 (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { 285 || (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
284 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { 286 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
285 sharpsl_pm.machinfo->backlight_limit(1); 287 sharpsl_pm.machinfo->backlight_limit(1);
286 sharpsl_pm.flags |= SHARPSL_BL_LIMIT; 288 sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
@@ -293,8 +295,8 @@ static void sharpsl_battery_thread(struct work_struct *private_)
293 295
294 /* Suspend if critical battery level */ 296 /* Suspend if critical battery level */
295 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) 297 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
296 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL) 298 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
297 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) { 299 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
298 sharpsl_pm.flags |= SHARPSL_APM_QUEUED; 300 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
299 dev_err(sharpsl_pm.dev, "Fatal Off\n"); 301 dev_err(sharpsl_pm.dev, "Fatal Off\n");
300 apm_queue_event(APM_CRITICAL_SUSPEND); 302 apm_queue_event(APM_CRITICAL_SUSPEND);
@@ -346,7 +348,7 @@ static void sharpsl_charge_error(void)
346 348
347static void sharpsl_charge_toggle(struct work_struct *private_) 349static void sharpsl_charge_toggle(struct work_struct *private_)
348{ 350{
349 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies); 351 dev_dbg(sharpsl_pm.dev, "Toggling Charger at time: %lx\n", jiffies);
350 352
351 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) { 353 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
352 sharpsl_charge_off(); 354 sharpsl_charge_off();
@@ -368,7 +370,7 @@ static void sharpsl_ac_timer(unsigned long data)
368{ 370{
369 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); 371 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
370 372
371 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin); 373 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n", acin);
372 374
373 sharpsl_average_clear(); 375 sharpsl_average_clear();
374 if (acin && (sharpsl_pm.charge_mode != CHRG_ON)) 376 if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
@@ -472,14 +474,14 @@ static int sharpsl_average_value(int ad)
472 sharpsl_ad[sharpsl_ad_index] = ad; 474 sharpsl_ad[sharpsl_ad_index] = ad;
473 sharpsl_ad_index++; 475 sharpsl_ad_index++;
474 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) { 476 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
475 for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++) 477 for (i = 0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
476 sharpsl_ad[i] = sharpsl_ad[i+1]; 478 sharpsl_ad[i] = sharpsl_ad[i+1];
477 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1; 479 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
478 } 480 }
479 for (i=0; i < sharpsl_ad_index; i++) 481 for (i = 0; i < sharpsl_ad_index; i++)
480 ad_val += sharpsl_ad[i]; 482 ad_val += sharpsl_ad[i];
481 483
482 return (ad_val / sharpsl_ad_index); 484 return ad_val / sharpsl_ad_index;
483} 485}
484 486
485/* 487/*
@@ -492,8 +494,8 @@ static int get_select_val(int *val)
492 494
493 /* Find MAX val */ 495 /* Find MAX val */
494 temp = val[0]; 496 temp = val[0];
495 j=0; 497 j = 0;
496 for (i=1; i<5; i++) { 498 for (i = 1; i < 5; i++) {
497 if (temp < val[i]) { 499 if (temp < val[i]) {
498 temp = val[i]; 500 temp = val[i];
499 j = i; 501 j = i;
@@ -502,21 +504,21 @@ static int get_select_val(int *val)
502 504
503 /* Find MIN val */ 505 /* Find MIN val */
504 temp = val[4]; 506 temp = val[4];
505 k=4; 507 k = 4;
506 for (i=3; i>=0; i--) { 508 for (i = 3; i >= 0; i--) {
507 if (temp > val[i]) { 509 if (temp > val[i]) {
508 temp = val[i]; 510 temp = val[i];
509 k = i; 511 k = i;
510 } 512 }
511 } 513 }
512 514
513 for (i=0; i<5; i++) 515 for (i = 0; i < 5; i++)
514 if (i != j && i != k ) 516 if (i != j && i != k)
515 sum += val[i]; 517 sum += val[i];
516 518
517 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]); 519 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
518 520
519 return (sum/3); 521 return sum/3;
520} 522}
521 523
522static int sharpsl_check_battery_temp(void) 524static int sharpsl_check_battery_temp(void)
@@ -524,7 +526,7 @@ static int sharpsl_check_battery_temp(void)
524 int val, i, buff[5]; 526 int val, i, buff[5];
525 527
526 /* Check battery temperature */ 528 /* Check battery temperature */
527 for (i=0; i<5; i++) { 529 for (i = 0; i < 5; i++) {
528 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP); 530 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
529 sharpsl_pm.machinfo->measure_temp(1); 531 sharpsl_pm.machinfo->measure_temp(1);
530 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP); 532 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
@@ -557,7 +559,7 @@ static int sharpsl_check_battery_voltage(void)
557 sharpsl_pm.machinfo->discharge1(1); 559 sharpsl_pm.machinfo->discharge1(1);
558 560
559 /* Check battery voltage */ 561 /* Check battery voltage */
560 for (i=0; i<5; i++) { 562 for (i = 0; i < 5; i++) {
561 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); 563 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
562 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); 564 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
563 } 565 }
@@ -581,16 +583,16 @@ static int sharpsl_ac_check(void)
581{ 583{
582 int temp, i, buff[5]; 584 int temp, i, buff[5];
583 585
584 for (i=0; i<5; i++) { 586 for (i = 0; i < 5; i++) {
585 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT); 587 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT);
586 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN); 588 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
587 } 589 }
588 590
589 temp = get_select_val(buff); 591 temp = get_select_val(buff);
590 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); 592 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n", temp);
591 593
592 if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) { 594 if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) {
593 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); 595 dev_err(sharpsl_pm.dev, "Error: AC check failed: voltage %d.\n", temp);
594 return -1; 596 return -1;
595 } 597 }
596 598
@@ -624,9 +626,9 @@ static int sharpsl_pm_resume(struct platform_device *pdev)
624 626
625static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state) 627static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
626{ 628{
627 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR); 629 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n", RCNR);
628 630
629 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG); 631 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n", sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
630 /* not charging and AC-IN! */ 632 /* not charging and AC-IN! */
631 633
632 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) { 634 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) {
@@ -644,12 +646,12 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
644 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) { 646 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
645 RTSR &= RTSR_ALE; 647 RTSR &= RTSR_ALE;
646 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND; 648 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
647 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR); 649 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
648 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE; 650 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
649 } else if (alarm_enable) { 651 } else if (alarm_enable) {
650 RTSR &= RTSR_ALE; 652 RTSR &= RTSR_ALE;
651 RTAR = alarm_time; 653 RTAR = alarm_time;
652 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR); 654 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n", RTAR);
653 } else { 655 } else {
654 dev_dbg(sharpsl_pm.dev, "No alarms set.\n"); 656 dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
655 } 657 }
@@ -658,19 +660,18 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
658 660
659 sharpsl_pm.machinfo->postsuspend(); 661 sharpsl_pm.machinfo->postsuspend();
660 662
661 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR); 663 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n", PEDR);
662} 664}
663 665
664static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state) 666static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
665{ 667{
666 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) ) 668 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable)) {
667 {
668 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) { 669 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
669 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n"); 670 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
670 corgi_goto_sleep(alarm_time, alarm_enable, state); 671 corgi_goto_sleep(alarm_time, alarm_enable, state);
671 return 1; 672 return 1;
672 } 673 }
673 if(sharpsl_off_charge_battery()) { 674 if (sharpsl_off_charge_battery()) {
674 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n"); 675 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
675 corgi_goto_sleep(alarm_time, alarm_enable, state); 676 corgi_goto_sleep(alarm_time, alarm_enable, state);
676 return 1; 677 return 1;
@@ -697,7 +698,7 @@ static int corgi_pxa_pm_enter(suspend_state_t state)
697 698
698 corgi_goto_sleep(alarm_time, alarm_status, state); 699 corgi_goto_sleep(alarm_time, alarm_status, state);
699 700
700 while (corgi_enter_suspend(alarm_time,alarm_status,state)) 701 while (corgi_enter_suspend(alarm_time, alarm_status, state))
701 {} 702 {}
702 703
703 if (sharpsl_pm.machinfo->earlyresume) 704 if (sharpsl_pm.machinfo->earlyresume)
@@ -732,7 +733,7 @@ static int sharpsl_fatal_check(void)
732 sharpsl_pm.machinfo->discharge1(1); 733 sharpsl_pm.machinfo->discharge1(1);
733 734
734 /* Check battery : check inserting battery ? */ 735 /* Check battery : check inserting battery ? */
735 for (i=0; i<5; i++) { 736 for (i = 0; i < 5; i++) {
736 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT); 737 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
737 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); 738 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
738 } 739 }
@@ -812,7 +813,7 @@ static int sharpsl_off_charge_battery(void)
812 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME); 813 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
813 814
814 time = RCNR; 815 time = RCNR;
815 while(1) { 816 while (1) {
816 /* Check if any wakeup event had occurred */ 817 /* Check if any wakeup event had occurred */
817 if (sharpsl_pm.machinfo->charger_wakeup() != 0) 818 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
818 return 0; 819 return 0;
@@ -835,9 +836,9 @@ static int sharpsl_off_charge_battery(void)
835 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME); 836 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
836 837
837 time = RCNR; 838 time = RCNR;
838 while(1) { 839 while (1) {
839 /* Check if any wakeup event had occurred */ 840 /* Check if any wakeup event had occurred */
840 if (sharpsl_pm.machinfo->charger_wakeup() != 0) 841 if (sharpsl_pm.machinfo->charger_wakeup())
841 return 0; 842 return 0;
842 /* Check for timeout */ 843 /* Check for timeout */
843 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) { 844 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
@@ -864,12 +865,12 @@ static int sharpsl_off_charge_battery(void)
864 865
865static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf) 866static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
866{ 867{
867 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent); 868 return sprintf(buf, "%d\n", sharpsl_pm.battstat.mainbat_percent);
868} 869}
869 870
870static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf) 871static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
871{ 872{
872 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage); 873 return sprintf(buf, "%d\n", sharpsl_pm.battstat.mainbat_voltage);
873} 874}
874 875
875static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL); 876static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
@@ -943,8 +944,7 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
943 } 944 }
944 } 945 }
945 946
946 if (sharpsl_pm.machinfo->batfull_irq) 947 if (sharpsl_pm.machinfo->batfull_irq) {
947 {
948 /* Register interrupt handler. */ 948 /* Register interrupt handler. */
949 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { 949 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
950 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull)); 950 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull));
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 724ffb030317..60bfaff172c3 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -103,7 +103,7 @@ static void spitz_presuspend(void)
103 PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); 103 PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
104 PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC; 104 PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC;
105 PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); 105 PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
106 PKSR = 0xffffffff; // clear 106 PKSR = 0xffffffff; /* clear */
107 107
108 /* nRESET_OUT Disable */ 108 /* nRESET_OUT Disable */
109 PSLR |= PSLR_SL_ROD; 109 PSLR |= PSLR_SL_ROD;
@@ -149,7 +149,7 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
149 if (resume_on_alarm && (PEDR & PWER_RTC)) 149 if (resume_on_alarm && (PEDR & PWER_RTC))
150 is_resume |= PWER_RTC; 150 is_resume |= PWER_RTC;
151 151
152 dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume); 152 dev_dbg(sharpsl_pm.dev, "is_resume: %x\n", is_resume);
153 return is_resume; 153 return is_resume;
154} 154}
155 155
@@ -160,7 +160,7 @@ static unsigned long spitz_charger_wakeup(void)
160 160
161unsigned long spitzpm_read_devdata(int type) 161unsigned long spitzpm_read_devdata(int type)
162{ 162{
163 switch(type) { 163 switch (type) {
164 case SHARPSL_STATUS_ACIN: 164 case SHARPSL_STATUS_ACIN:
165 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0); 165 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
166 case SHARPSL_STATUS_LOCK: 166 case SHARPSL_STATUS_LOCK:
@@ -199,7 +199,7 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
199#if defined(CONFIG_LCD_CORGI) 199#if defined(CONFIG_LCD_CORGI)
200 .backlight_limit = corgi_lcd_limit_intensity, 200 .backlight_limit = corgi_lcd_limit_intensity,
201#elif defined(CONFIG_BACKLIGHT_CORGI) 201#elif defined(CONFIG_BACKLIGHT_CORGI)
202 .backlight_limit = corgibl_limit_intensity, 202 .backlight_limit = corgibl_limit_intensity,
203#endif 203#endif
204 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 204 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
205 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, 205 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
@@ -241,7 +241,7 @@ static int __devinit spitzpm_init(void)
241 241
242static void spitzpm_exit(void) 242static void spitzpm_exit(void)
243{ 243{
244 platform_device_unregister(spitzpm_device); 244 platform_device_unregister(spitzpm_device);
245} 245}
246 246
247module_init(spitzpm_init); 247module_init(spitzpm_init);