Re: zaurus: cleanup sharpsl_pm.c

From: Eric Miao
Date: Tue Oct 20 2009 - 12:00:09 EST


On Sun, Oct 18, 2009 at 12:36 AM, Pavel Machek <pavel@xxxxxx> wrote:
> On Tue 2009-10-06 22:03:39, Pavel Machek wrote:
>> This fixes checkpatch/style problems in sharpsl_pm.c, allowing me to
>> submit real fixes next. Move spitz-specific voltage table to
>> spitz-specific file.
>>
>> Signed-off-by: Pavel Machek <pavel@xxxxxx>
>
> Eric, any news on this one? I have real development going on top of
> this one, so it is quite important for me...

Sorry late on this. Applied.

> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂPavel
>
>> --- linux-rc/arch/arm.ofic/mach-pxa/sharpsl.h 2009-09-10 00:13:59.000000000 +0200
>> +++ linux-rc/arch/arm/mach-pxa/sharpsl.h   Â2009-10-06 21:15:40.000000000 +0200
>> @@ -42,8 +42,6 @@
>> Â#define MAX1111_BATT_TEMP Â 2u
>> Â#define MAX1111_ACIN_VOLT Â 6u
>>
>> -extern struct battery_thresh spitz_battery_levels_acin[];
>> -extern struct battery_thresh spitz_battery_levels_noac[];
>> Âint sharpsl_pm_pxa_read_max1111(int channel);
>>
>>
>> diff -ur linux-rc/arch/arm.ofic/mach-pxa/sharpsl_pm.c linux-rc/arch/arm/mach-pxa/sharpsl_pm.c
>> --- linux-rc/arch/arm.ofic/mach-pxa/sharpsl_pm.c   Â2009-10-06 13:48:07.000000000 +0200
>> +++ linux-rc/arch/arm/mach-pxa/sharpsl_pm.c  2009-10-06 21:15:40.000000000 +0200
>> @@ -78,106 +78,21 @@
>>
>>
>>
>> -struct battery_thresh spitz_battery_levels_acin[] = {
>> - Â Â { 213, 100},
>> - Â Â { 212, Â98},
>> - Â Â { 211, Â95},
>> - Â Â { 210, Â93},
>> - Â Â { 209, Â90},
>> - Â Â { 208, Â88},
>> - Â Â { 207, Â85},
>> - Â Â { 206, Â83},
>> - Â Â { 205, Â80},
>> - Â Â { 204, Â78},
>> - Â Â { 203, Â75},
>> - Â Â { 202, Â73},
>> - Â Â { 201, Â70},
>> - Â Â { 200, Â68},
>> - Â Â { 199, Â65},
>> - Â Â { 198, Â63},
>> - Â Â { 197, Â60},
>> - Â Â { 196, Â58},
>> - Â Â { 195, Â55},
>> - Â Â { 194, Â53},
>> - Â Â { 193, Â50},
>> - Â Â { 192, Â48},
>> - Â Â { 192, Â45},
>> - Â Â { 191, Â43},
>> - Â Â { 191, Â40},
>> - Â Â { 190, Â38},
>> - Â Â { 190, Â35},
>> - Â Â { 189, Â33},
>> - Â Â { 188, Â30},
>> - Â Â { 187, Â28},
>> - Â Â { 186, Â25},
>> - Â Â { 185, Â23},
>> - Â Â { 184, Â20},
>> - Â Â { 183, Â18},
>> - Â Â { 182, Â15},
>> - Â Â { 181, Â13},
>> - Â Â { 180, Â10},
>> - Â Â { 179, Â 8},
>> - Â Â { 178, Â 5},
>> - Â Â { Â 0, Â 0},
>> -};
>> -
>> -struct battery_thresh Âspitz_battery_levels_noac[] = {
>> - Â Â { 213, 100},
>> - Â Â { 212, Â98},
>> - Â Â { 211, Â95},
>> - Â Â { 210, Â93},
>> - Â Â { 209, Â90},
>> - Â Â { 208, Â88},
>> - Â Â { 207, Â85},
>> - Â Â { 206, Â83},
>> - Â Â { 205, Â80},
>> - Â Â { 204, Â78},
>> - Â Â { 203, Â75},
>> - Â Â { 202, Â73},
>> - Â Â { 201, Â70},
>> - Â Â { 200, Â68},
>> - Â Â { 199, Â65},
>> - Â Â { 198, Â63},
>> - Â Â { 197, Â60},
>> - Â Â { 196, Â58},
>> - Â Â { 195, Â55},
>> - Â Â { 194, Â53},
>> - Â Â { 193, Â50},
>> - Â Â { 192, Â48},
>> - Â Â { 191, Â45},
>> - Â Â { 190, Â43},
>> - Â Â { 189, Â40},
>> - Â Â { 188, Â38},
>> - Â Â { 187, Â35},
>> - Â Â { 186, Â33},
>> - Â Â { 185, Â30},
>> - Â Â { 184, Â28},
>> - Â Â { 183, Â25},
>> - Â Â { 182, Â23},
>> - Â Â { 181, Â20},
>> - Â Â { 180, Â18},
>> - Â Â { 179, Â15},
>> - Â Â { 178, Â13},
>> - Â Â { 177, Â10},
>> - Â Â { 176, Â 8},
>> - Â Â { 175, Â 5},
>> - Â Â { Â 0, Â 0},
>> -};
>> -
>> Â/* MAX1111 Commands */
>> -#define MAXCTRL_PD0 Â Â Â1u << 0
>> -#define MAXCTRL_PD1 Â Â Â1u << 1
>> -#define MAXCTRL_SGL Â Â Â1u << 2
>> -#define MAXCTRL_UNI Â Â Â1u << 3
>> +#define MAXCTRL_PD0 Â Â Â(1u << 0)
>> +#define MAXCTRL_PD1 Â Â Â(1u << 1)
>> +#define MAXCTRL_SGL Â Â Â(1u << 2)
>> +#define MAXCTRL_UNI Â Â Â(1u << 3)
>> Â#define MAXCTRL_SEL_SH Â 4
>> -#define MAXCTRL_STR Â Â Â1u << 7
>> +#define MAXCTRL_STR Â Â Â(1u << 7)
>>
>> Â/*
>> Â * Read MAX1111 ADC
>> Â */
>> Âint sharpsl_pm_pxa_read_max1111(int channel)
>> Â{
>> - Â Â if (machine_is_tosa()) // Ugly, better move this function into another module
>> + Â Â /* Ugly, better move this function into another module */
>> + Â Â if (machine_is_tosa())
>> Â Â Â Â Â return 0;
>>
>> Â#ifdef CONFIG_CORGI_SSP_DEPRECATED
>> @@ -238,7 +153,7 @@
>>
>> Âstatic void sharpsl_battery_thread(struct work_struct *private_)
>> Â{
>> - Â Â int voltage, percent, apm_status, i = 0;
>> + Â Â int voltage, percent, apm_status, i;
>>
>> Â Â Â if (!sharpsl_pm.machinfo)
>> Â Â Â Â Â Â Â return;
>> @@ -250,15 +165,14 @@
>> Â Â Â Â Â Â Â Â Â Â Â && time_after(jiffies, sharpsl_pm.charge_start_time + ÂSHARPSL_CHARGE_ON_TIME_INTERVAL))
>> Â Â Â Â Â Â Â schedule_delayed_work(&toggle_charger, 0);
>>
>> - Â Â while(1) {
>> + Â Â for (i = 0; i < 5; i++) {
>> Â Â Â Â Â Â Â voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
>> -
>> - Â Â Â Â Â Â if (voltage > 0) break;
>> - Â Â Â Â Â Â if (i++ > 5) {
>> - Â Â Â Â Â Â Â Â Â Â voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
>> - Â Â Â Â Â Â Â Â Â Â dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
>> + Â Â Â Â Â Â if (voltage > 0)
>> Â Â Â Â Â Â Â Â Â Â Â break;
>> - Â Â Â Â Â Â }
>> + Â Â }
>> + Â Â if (voltage <= 0) {
>> + Â Â Â Â Â Â voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
>> + Â Â Â Â Â Â dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
>> Â Â Â }
>>
>> Â Â Â voltage = sharpsl_average_value(voltage);
>> @@ -266,8 +180,10 @@
>> Â Â Â percent = get_percentage(voltage);
>>
>> Â Â Â /* At low battery voltages, the voltage has a tendency to start
>> - Â Â Â Â Â creeping back up so we try to avoid this here */
>> - Â Â if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || Âpercent <= sharpsl_pm.battstat.mainbat_percent) {
>> + Â Â Â Âcreeping back up so we try to avoid this here */
>> + Â Â if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE)
>> + Â Â Â Â || (apm_status == APM_BATTERY_STATUS_HIGH)
>> + Â Â Â Â || percent <= sharpsl_pm.battstat.mainbat_percent) {
>> Â Â Â Â Â Â Â sharpsl_pm.battstat.mainbat_voltage = voltage;
>> Â Â Â Â Â Â Â sharpsl_pm.battstat.mainbat_status = apm_status;
>> Â Â Â Â Â Â Â sharpsl_pm.battstat.mainbat_percent = percent;
>> @@ -279,8 +195,8 @@
>> Â#ifdef CONFIG_BACKLIGHT_CORGI
>> Â Â Â /* If battery is low. limit backlight intensity to save power. */
>> Â Â Â if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
>> - Â Â Â Â Â Â Â Â Â Â && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
>> - Â Â Â Â Â Â Â Â Â Â (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
>> + Â Â Â Â && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW)
>> + Â Â Â Â || (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
>> Â Â Â Â Â Â Â if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
>> Â Â Â Â Â Â Â Â Â Â Â sharpsl_pm.machinfo->backlight_limit(1);
>> Â Â Â Â Â Â Â Â Â Â Â sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
>> @@ -293,8 +209,8 @@
>>
>> Â Â Â /* Suspend if critical battery level */
>> Â Â Â if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
>> - Â Â Â Â Â Â Â Â Â Â && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
>> - Â Â Â Â Â Â Â Â Â Â && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
>> + Â Â Â Â Â&& (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
>> + Â Â Â Â Â&& !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
>> Â Â Â Â Â Â Â sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
>> Â Â Â Â Â Â Â dev_err(sharpsl_pm.dev, "Fatal Off\n");
>> Â Â Â Â Â Â Â apm_queue_event(APM_CRITICAL_SUSPEND);
>> @@ -346,7 +264,7 @@
>>
>> Âstatic void sharpsl_charge_toggle(struct work_struct *private_)
>> Â{
>> - Â Â dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
>> + Â Â dev_dbg(sharpsl_pm.dev, "Toggling Charger at time: %lx\n", jiffies);
>>
>> Â Â Â if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
>> Â Â Â Â Â Â Â sharpsl_charge_off();
>> @@ -368,7 +286,7 @@
>> Â{
>> Â Â Â int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
>>
>> - Â Â dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
>> + Â Â dev_dbg(sharpsl_pm.dev, "AC Status: %d\n", acin);
>>
>> Â Â Â sharpsl_average_clear();
>> Â Â Â if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
>> @@ -472,14 +390,14 @@
>> Â Â Â sharpsl_ad[sharpsl_ad_index] = ad;
>> Â Â Â sharpsl_ad_index++;
>> Â Â Â if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
>> - Â Â Â Â Â Â for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
>> + Â Â Â Â Â Â for (i = 0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
>> Â Â Â Â Â Â Â Â Â Â Â sharpsl_ad[i] = sharpsl_ad[i+1];
>> Â Â Â Â Â Â Â sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
>> Â Â Â }
>> - Â Â for (i=0; i < sharpsl_ad_index; i++)
>> + Â Â for (i = 0; i < sharpsl_ad_index; i++)
>> Â Â Â Â Â Â Â ad_val += sharpsl_ad[i];
>>
>> - Â Â return (ad_val / sharpsl_ad_index);
>> + Â Â return ad_val / sharpsl_ad_index;
>> Â}
>>
>> Â/*
>> @@ -492,8 +410,8 @@
>>
>> Â Â Â /* Find MAX val */
>> Â Â Â temp = val[0];
>> - Â Â j=0;
>> - Â Â for (i=1; i<5; i++) {
>> + Â Â j = 0;
>> + Â Â for (i = 1; i < 5; i++) {
>> Â Â Â Â Â Â Â if (temp < val[i]) {
>> Â Â Â Â Â Â Â Â Â Â Â temp = val[i];
>> Â Â Â Â Â Â Â Â Â Â Â j = i;
>> @@ -502,21 +420,21 @@
>>
>> Â Â Â /* Find MIN val */
>> Â Â Â temp = val[4];
>> - Â Â k=4;
>> - Â Â for (i=3; i>=0; i--) {
>> + Â Â k = 4;
>> + Â Â for (i = 3; i >= 0; i--) {
>> Â Â Â Â Â Â Â if (temp > val[i]) {
>> Â Â Â Â Â Â Â Â Â Â Â temp = val[i];
>> Â Â Â Â Â Â Â Â Â Â Â k = i;
>> Â Â Â Â Â Â Â }
>> Â Â Â }
>>
>> - Â Â for (i=0; i<5; i++)
>> - Â Â Â Â Â Â if (i != j && i != k )
>> + Â Â for (i = 0; i < 5; i++)
>> + Â Â Â Â Â Â if (i != j && i != k)
>> Â Â Â Â Â Â Â Â Â Â Â sum += val[i];
>>
>> Â Â Â 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]);
>>
>> - Â Â return (sum/3);
>> + Â Â return sum/3;
>> Â}
>>
>> Âstatic int sharpsl_check_battery_temp(void)
>> @@ -524,7 +442,7 @@
>> Â Â Â int val, i, buff[5];
>>
>> Â Â Â /* Check battery temperature */
>> - Â Â for (i=0; i<5; i++) {
>> + Â Â for (i = 0; i < 5; i++) {
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
>> Â Â Â Â Â Â Â sharpsl_pm.machinfo->measure_temp(1);
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
>> @@ -557,7 +477,7 @@
>> Â Â Â Â Â Â Â sharpsl_pm.machinfo->discharge1(1);
>>
>> Â Â Â /* Check battery voltage */
>> - Â Â for (i=0; i<5; i++) {
>> + Â Â for (i = 0; i < 5; i++) {
>> Â Â Â Â Â Â Â buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
>> Â Â Â }
>> @@ -581,16 +501,16 @@
>> Â{
>> Â Â Â int temp, i, buff[5];
>>
>> - Â Â for (i=0; i<5; i++) {
>> + Â Â for (i = 0; i < 5; i++) {
>> Â Â Â Â Â Â Â buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT);
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
>> Â Â Â }
>>
>> Â Â Â temp = get_select_val(buff);
>> - Â Â dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
>> + Â Â dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n", temp);
>>
>> Â Â Â if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) {
>> - Â Â Â Â Â Â dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
>> + Â Â Â Â Â Â dev_err(sharpsl_pm.dev, "Error: AC check failed: voltage %d.\n", temp);
>> Â Â Â Â Â Â Â return -1;
>> Â Â Â }
>>
>> @@ -624,9 +544,9 @@
>>
>> Âstatic void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
>> Â{
>> - Â Â dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR);
>> + Â Â dev_dbg(sharpsl_pm.dev, "Time is: %08x\n", RCNR);
>>
>> - Â Â dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
>> + Â Â dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n", sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
>> Â Â Â /* not charging and AC-IN! */
>>
>> Â Â Â if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) {
>> @@ -644,12 +564,12 @@
>> Â Â Â if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
>> Â Â Â Â Â Â Â RTSR &= RTSR_ALE;
>> Â Â Â Â Â Â Â RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
>> - Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR);
>> + Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
>> Â Â Â Â Â Â Â sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
>> Â Â Â } else if (alarm_enable) {
>> Â Â Â Â Â Â Â RTSR &= RTSR_ALE;
>> Â Â Â Â Â Â Â RTAR = alarm_time;
>> - Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR);
>> + Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n", RTAR);
>> Â Â Â } else {
>> Â Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
>> Â Â Â }
>> @@ -658,19 +578,18 @@
>>
>> Â Â Â sharpsl_pm.machinfo->postsuspend();
>>
>> - Â Â dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
>> + Â Â dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n", PEDR);
>> Â}
>>
>> Âstatic int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
>> Â{
>> - Â Â if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) )
>> - Â Â {
>> + Â Â if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable)) {
>> Â Â Â Â Â Â Â if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
>> Â Â Â Â Â Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
>> Â Â Â Â Â Â Â Â Â Â Â corgi_goto_sleep(alarm_time, alarm_enable, state);
>> Â Â Â Â Â Â Â Â Â Â Â return 1;
>> Â Â Â Â Â Â Â }
>> - Â Â Â Â Â Â if(sharpsl_off_charge_battery()) {
>> + Â Â Â Â Â Â if (sharpsl_off_charge_battery()) {
>> Â Â Â Â Â Â Â Â Â Â Â dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
>> Â Â Â Â Â Â Â Â Â Â Â corgi_goto_sleep(alarm_time, alarm_enable, state);
>> Â Â Â Â Â Â Â Â Â Â Â return 1;
>> @@ -697,7 +616,7 @@
>>
>> Â Â Â corgi_goto_sleep(alarm_time, alarm_status, state);
>>
>> - Â Â while (corgi_enter_suspend(alarm_time,alarm_status,state))
>> + Â Â while (corgi_enter_suspend(alarm_time, alarm_status, state))
>> Â Â Â Â Â Â Â {}
>>
>> Â Â Â if (sharpsl_pm.machinfo->earlyresume)
>> @@ -732,7 +651,7 @@
>> Â Â Â Â Â Â Â sharpsl_pm.machinfo->discharge1(1);
>>
>> Â Â Â /* Check battery : check inserting battery ? */
>> - Â Â for (i=0; i<5; i++) {
>> + Â Â for (i = 0; i < 5; i++) {
>> Â Â Â Â Â Â Â buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
>> Â Â Â }
>> @@ -812,7 +731,7 @@
>> Â Â Â Â Â Â Â mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
>>
>> Â Â Â Â Â Â Â time = RCNR;
>> - Â Â Â Â Â Â while(1) {
>> + Â Â Â Â Â Â while (1) {
>> Â Â Â Â Â Â Â Â Â Â Â /* Check if any wakeup event had occurred */
>> Â Â Â Â Â Â Â Â Â Â Â if (sharpsl_pm.machinfo->charger_wakeup() != 0)
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return 0;
>> @@ -835,9 +754,9 @@
>> Â Â Â mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
>>
>> Â Â Â time = RCNR;
>> - Â Â while(1) {
>> + Â Â while (1) {
>> Â Â Â Â Â Â Â /* Check if any wakeup event had occurred */
>> - Â Â Â Â Â Â if (sharpsl_pm.machinfo->charger_wakeup() != 0)
>> + Â Â Â Â Â Â if (sharpsl_pm.machinfo->charger_wakeup())
>> Â Â Â Â Â Â Â Â Â Â Â return 0;
>> Â Â Â Â Â Â Â /* Check for timeout */
>> Â Â Â Â Â Â Â if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
>> @@ -864,12 +783,12 @@
>>
>> Âstatic ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
>> Â{
>> - Â Â return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent);
>> + Â Â return sprintf(buf, "%d\n", sharpsl_pm.battstat.mainbat_percent);
>> Â}
>>
>> Âstatic ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
>> Â{
>> - Â Â return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage);
>> + Â Â return sprintf(buf, "%d\n", sharpsl_pm.battstat.mainbat_voltage);
>> Â}
>>
>> Âstatic DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
>> @@ -943,8 +862,7 @@
>> Â Â Â Â Â Â Â }
>> Â Â Â }
>>
>> - Â Â if (sharpsl_pm.machinfo->batfull_irq)
>> - Â Â {
>> + Â Â if (sharpsl_pm.machinfo->batfull_irq) {
>> Â Â Â Â Â Â Â /* Register interrupt handler. */
>> Â Â Â Â Â Â Â if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
>> Â Â Â Â Â Â Â Â Â Â Â dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull));
>> --- linux-rc/arch/arm.ofic/mach-pxa/spitz_pm.c    Â2009-09-10 00:13:59.000000000 +0200
>> +++ linux-rc/arch/arm/mach-pxa/spitz_pm.c   2009-10-06 21:15:40.000000000 +0200
>> @@ -37,6 +37,93 @@
>>
>> Âstatic int spitz_last_ac_status;
>>
>> +static const struct battery_thresh spitz_battery_levels_acin[] = {
>> + Â Â { 213, 100},
>> + Â Â { 212, Â98},
>> + Â Â { 211, Â95},
>> + Â Â { 210, Â93},
>> + Â Â { 209, Â90},
>> + Â Â { 208, Â88},
>> + Â Â { 207, Â85},
>> + Â Â { 206, Â83},
>> + Â Â { 205, Â80},
>> + Â Â { 204, Â78},
>> + Â Â { 203, Â75},
>> + Â Â { 202, Â73},
>> + Â Â { 201, Â70},
>> + Â Â { 200, Â68},
>> + Â Â { 199, Â65},
>> + Â Â { 198, Â63},
>> + Â Â { 197, Â60},
>> + Â Â { 196, Â58},
>> + Â Â { 195, Â55},
>> + Â Â { 194, Â53},
>> + Â Â { 193, Â50},
>> + Â Â { 192, Â48},
>> + Â Â { 192, Â45},
>> + Â Â { 191, Â43},
>> + Â Â { 191, Â40},
>> + Â Â { 190, Â38},
>> + Â Â { 190, Â35},
>> + Â Â { 189, Â33},
>> + Â Â { 188, Â30},
>> + Â Â { 187, Â28},
>> + Â Â { 186, Â25},
>> + Â Â { 185, Â23},
>> + Â Â { 184, Â20},
>> + Â Â { 183, Â18},
>> + Â Â { 182, Â15},
>> + Â Â { 181, Â13},
>> + Â Â { 180, Â10},
>> + Â Â { 179, Â 8},
>> + Â Â { 178, Â 5},
>> + Â Â { Â 0, Â 0},
>> +};
>> +
>> +static const struct battery_thresh Âspitz_battery_levels_noac[] = {
>> + Â Â { 213, 100},
>> + Â Â { 212, Â98},
>> + Â Â { 211, Â95},
>> + Â Â { 210, Â93},
>> + Â Â { 209, Â90},
>> + Â Â { 208, Â88},
>> + Â Â { 207, Â85},
>> + Â Â { 206, Â83},
>> + Â Â { 205, Â80},
>> + Â Â { 204, Â78},
>> + Â Â { 203, Â75},
>> + Â Â { 202, Â73},
>> + Â Â { 201, Â70},
>> + Â Â { 200, Â68},
>> + Â Â { 199, Â65},
>> + Â Â { 198, Â63},
>> + Â Â { 197, Â60},
>> + Â Â { 196, Â58},
>> + Â Â { 195, Â55},
>> + Â Â { 194, Â53},
>> + Â Â { 193, Â50},
>> + Â Â { 192, Â48},
>> + Â Â { 191, Â45},
>> + Â Â { 190, Â43},
>> + Â Â { 189, Â40},
>> + Â Â { 188, Â38},
>> + Â Â { 187, Â35},
>> + Â Â { 186, Â33},
>> + Â Â { 185, Â30},
>> + Â Â { 184, Â28},
>> + Â Â { 183, Â25},
>> + Â Â { 182, Â23},
>> + Â Â { 181, Â20},
>> + Â Â { 180, Â18},
>> + Â Â { 179, Â15},
>> + Â Â { 178, Â13},
>> + Â Â { 177, Â10},
>> + Â Â { 176, Â 8},
>> + Â Â { 175, Â 5},
>> + Â Â { Â 0, Â 0},
>> +};
>> +
>> +
>> Âstatic void spitz_charger_init(void)
>> Â{
>> Â Â Â pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
>> @@ -103,7 +190,7 @@
>> Â Â Â PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
>> Â Â Â PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC;
>> Â Â Â PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
>> - Â Â PKSR = 0xffffffff; // clear
>> + Â Â PKSR = 0xffffffff; /* clear */
>>
>> Â Â Â /* nRESET_OUT Disable */
>> Â Â Â PSLR |= PSLR_SL_ROD;
>> @@ -149,7 +236,7 @@
>> Â Â Â if (resume_on_alarm && (PEDR & PWER_RTC))
>> Â Â Â Â Â Â Â is_resume |= PWER_RTC;
>>
>> - Â Â dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
>> + Â Â dev_dbg(sharpsl_pm.dev, "is_resume: %x\n", is_resume);
>> Â Â Â return is_resume;
>> Â}
>>
>> @@ -160,7 +247,7 @@
>>
>> Âunsigned long spitzpm_read_devdata(int type)
>> Â{
>> - Â Â switch(type) {
>> + Â Â switch (type) {
>> Â Â Â case SHARPSL_STATUS_ACIN:
>> Â Â Â Â Â Â Â return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
>> Â Â Â case SHARPSL_STATUS_LOCK:
>> @@ -199,7 +286,7 @@
>> Â#if defined(CONFIG_LCD_CORGI)
>> Â Â Â .backlight_limit = corgi_lcd_limit_intensity,
>> Â#elif defined(CONFIG_BACKLIGHT_CORGI)
>> - Â Â Â Â.backlight_limit Â= corgibl_limit_intensity,
>> + Â Â .backlight_limit Â= corgibl_limit_intensity,
>> Â#endif
>>    .charge_on_volt  = SHARPSL_CHARGE_ON_VOLT,
>>    .charge_on_temp  = SHARPSL_CHARGE_ON_TEMP,
>> @@ -241,7 +328,7 @@
>>
>> Âstatic void spitzpm_exit(void)
>> Â{
>> - Â Â platform_device_unregister(spitzpm_device);
>> + Â Â platform_device_unregister(spitzpm_device);
>> Â}
>>
>> Âmodule_init(spitzpm_init);
>>
>>
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/