aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorVasily Khoruzhick <anarsoul@gmail.com>2010-12-13 05:26:21 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2010-12-21 18:39:57 -0500
commitc66ae9bb4dcaac78cc5e30d0ce7ff2bf3dcb48d9 (patch)
tree3d771944bdade9bfa9743680bbfaf7c49b52e836 /drivers/power
parentbc51e7ff521f28a7f14dc2f25307ad9101d1305a (diff)
s3c_adc_battery: Add gpio_inverted field to pdata
Add support for inverted gpio_charge_finished values. This change is necessary for H1940 support. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/s3c_adc_battery.c12
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
115static 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
115static int s3c_adc_bat_get_property(struct power_supply *psy, 122static 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();