aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/sharpsl_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common/sharpsl_pm.c')
-rw-r--r--arch/arm/common/sharpsl_pm.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 5972df2b9af4..3bf3a927ae22 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -153,7 +153,7 @@ static void sharpsl_battery_thread(struct work_struct *private_)
153 sharpsl_pm.battstat.mainbat_percent = percent; 153 sharpsl_pm.battstat.mainbat_percent = percent;
154 } 154 }
155 155
156 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage, 156 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage,
157 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies); 157 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
158 158
159 /* If battery is low. limit backlight intensity to save power. */ 159 /* If battery is low. limit backlight intensity to save power. */
@@ -291,7 +291,7 @@ static void sharpsl_chrg_full_timer(unsigned long data)
291} 291}
292 292
293/* Charging Finished Interrupt (Not present on Corgi) */ 293/* Charging Finished Interrupt (Not present on Corgi) */
294/* Can trigger at the same time as an AC staus change so 294/* Can trigger at the same time as an AC status change so
295 delay until after that has been processed */ 295 delay until after that has been processed */
296irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id) 296irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id)
297{ 297{
@@ -625,7 +625,7 @@ static int sharpsl_fatal_check(void)
625 } 625 }
626 626
627 temp = get_select_val(buff); 627 temp = get_select_val(buff);
628 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); 628 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %ld\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT));
629 629
630 if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) || 630 if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) ||
631 (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt))) 631 (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt)))
@@ -635,7 +635,7 @@ static int sharpsl_fatal_check(void)
635 635
636static int sharpsl_off_charge_error(void) 636static int sharpsl_off_charge_error(void)
637{ 637{
638 dev_err(sharpsl_pm.dev, "Offline Charger: Error occured.\n"); 638 dev_err(sharpsl_pm.dev, "Offline Charger: Error occurred.\n");
639 sharpsl_pm.machinfo->charge(0); 639 sharpsl_pm.machinfo->charge(0);
640 sharpsl_pm_led(SHARPSL_LED_ERROR); 640 sharpsl_pm_led(SHARPSL_LED_ERROR);
641 sharpsl_pm.charge_mode = CHRG_ERROR; 641 sharpsl_pm.charge_mode = CHRG_ERROR;
@@ -691,14 +691,14 @@ static int sharpsl_off_charge_battery(void)
691 691
692 time = RCNR; 692 time = RCNR;
693 while(1) { 693 while(1) {
694 /* Check if any wakeup event had occured */ 694 /* Check if any wakeup event had occurred */
695 if (sharpsl_pm.machinfo->charger_wakeup() != 0) 695 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
696 return 0; 696 return 0;
697 /* Check for timeout */ 697 /* Check for timeout */
698 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME) 698 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
699 return 1; 699 return 1;
700 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) { 700 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) {
701 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n"); 701 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occurred. Retrying to check\n");
702 sharpsl_pm.full_count++; 702 sharpsl_pm.full_count++;
703 sharpsl_pm.machinfo->charge(0); 703 sharpsl_pm.machinfo->charge(0);
704 mdelay(SHARPSL_CHARGE_WAIT_TIME); 704 mdelay(SHARPSL_CHARGE_WAIT_TIME);
@@ -714,7 +714,7 @@ static int sharpsl_off_charge_battery(void)
714 714
715 time = RCNR; 715 time = RCNR;
716 while(1) { 716 while(1) {
717 /* Check if any wakeup event had occured */ 717 /* Check if any wakeup event had occurred */
718 if (sharpsl_pm.machinfo->charger_wakeup() != 0) 718 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
719 return 0; 719 return 0;
720 /* Check for timeout */ 720 /* Check for timeout */
@@ -774,6 +774,8 @@ static struct pm_ops sharpsl_pm_ops = {
774 774
775static int __init sharpsl_pm_probe(struct platform_device *pdev) 775static int __init sharpsl_pm_probe(struct platform_device *pdev)
776{ 776{
777 int ret;
778
777 if (!pdev->dev.platform_data) 779 if (!pdev->dev.platform_data)
778 return -EINVAL; 780 return -EINVAL;
779 781
@@ -792,8 +794,10 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
792 794
793 sharpsl_pm.machinfo->init(); 795 sharpsl_pm.machinfo->init();
794 796
795 device_create_file(&pdev->dev, &dev_attr_battery_percentage); 797 ret = device_create_file(&pdev->dev, &dev_attr_battery_percentage);
796 device_create_file(&pdev->dev, &dev_attr_battery_voltage); 798 ret |= device_create_file(&pdev->dev, &dev_attr_battery_voltage);
799 if (ret != 0)
800 dev_warn(&pdev->dev, "Failed to register attributes (%d)\n", ret);
797 801
798 apm_get_power_status = sharpsl_apm_get_power_status; 802 apm_get_power_status = sharpsl_apm_get_power_status;
799 803