diff options
Diffstat (limited to 'drivers/power/s3c_adc_battery.c')
-rw-r--r-- | drivers/power/s3c_adc_battery.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/power/s3c_adc_battery.c b/drivers/power/s3c_adc_battery.c index fe16b482e912..7bc5bfe55ce9 100644 --- a/drivers/power/s3c_adc_battery.c +++ b/drivers/power/s3c_adc_battery.c | |||
@@ -112,6 +112,13 @@ static int calc_full_volt(int volt_val, int cur_val, int impedance) | |||
112 | return volt_val + cur_val * impedance / 1000; | 112 | return volt_val + cur_val * impedance / 1000; |
113 | } | 113 | } |
114 | 114 | ||
115 | static int charge_finished(struct s3c_adc_bat *bat) | ||
116 | { | ||
117 | return bat->pdata->gpio_inverted ? | ||
118 | !gpio_get_value(bat->pdata->gpio_charge_finished) : | ||
119 | gpio_get_value(bat->pdata->gpio_charge_finished); | ||
120 | } | ||
121 | |||
115 | static int s3c_adc_bat_get_property(struct power_supply *psy, | 122 | static int s3c_adc_bat_get_property(struct power_supply *psy, |
116 | enum power_supply_property psp, | 123 | enum power_supply_property psp, |
117 | union power_supply_propval *val) | 124 | union power_supply_propval *val) |
@@ -140,7 +147,7 @@ static int s3c_adc_bat_get_property(struct power_supply *psy, | |||
140 | 147 | ||
141 | if (bat->cable_plugged && | 148 | if (bat->cable_plugged && |
142 | ((bat->pdata->gpio_charge_finished < 0) || | 149 | ((bat->pdata->gpio_charge_finished < 0) || |
143 | !gpio_get_value(bat->pdata->gpio_charge_finished))) { | 150 | !charge_finished(bat))) { |
144 | lut = bat->pdata->lut_acin; | 151 | lut = bat->pdata->lut_acin; |
145 | lut_size = bat->pdata->lut_acin_cnt; | 152 | lut_size = bat->pdata->lut_acin_cnt; |
146 | } | 153 | } |
@@ -236,8 +243,7 @@ static void s3c_adc_bat_work(struct work_struct *work) | |||
236 | } | 243 | } |
237 | } else { | 244 | } else { |
238 | if ((bat->pdata->gpio_charge_finished >= 0) && is_plugged) { | 245 | if ((bat->pdata->gpio_charge_finished >= 0) && is_plugged) { |
239 | is_charged = gpio_get_value( | 246 | is_charged = charge_finished(&main_bat); |
240 | main_bat.pdata->gpio_charge_finished); | ||
241 | if (is_charged) { | 247 | if (is_charged) { |
242 | if (bat->pdata->disable_charger) | 248 | if (bat->pdata->disable_charger) |
243 | bat->pdata->disable_charger(); | 249 | bat->pdata->disable_charger(); |