• Home
  • Raw
  • Download

Lines Matching refs:bat

76 	struct s3c_adc_bat *bat = power_supply_get_drvdata(psy);  in s3c_adc_backup_bat_get_property()  local
78 if (!bat) { in s3c_adc_backup_bat_get_property()
83 if (bat->volt_value < 0 || in s3c_adc_backup_bat_get_property()
84 jiffies_to_msecs(jiffies - bat->timestamp) > in s3c_adc_backup_bat_get_property()
86 bat->volt_value = gather_samples(bat->client, in s3c_adc_backup_bat_get_property()
87 bat->pdata->backup_volt_samples, in s3c_adc_backup_bat_get_property()
88 bat->pdata->backup_volt_channel); in s3c_adc_backup_bat_get_property()
89 bat->volt_value *= bat->pdata->backup_volt_mult; in s3c_adc_backup_bat_get_property()
90 bat->timestamp = jiffies; in s3c_adc_backup_bat_get_property()
95 val->intval = bat->volt_value; in s3c_adc_backup_bat_get_property()
98 val->intval = bat->pdata->backup_volt_min; in s3c_adc_backup_bat_get_property()
101 val->intval = bat->pdata->backup_volt_max; in s3c_adc_backup_bat_get_property()
133 static int charge_finished(struct s3c_adc_bat *bat) in charge_finished() argument
135 return bat->pdata->gpio_inverted ? in charge_finished()
136 !gpio_get_value(bat->pdata->gpio_charge_finished) : in charge_finished()
137 gpio_get_value(bat->pdata->gpio_charge_finished); in charge_finished()
144 struct s3c_adc_bat *bat = power_supply_get_drvdata(psy); in s3c_adc_bat_get_property() local
151 if (!bat) { in s3c_adc_bat_get_property()
156 lut = bat->pdata->lut_noac; in s3c_adc_bat_get_property()
157 lut_size = bat->pdata->lut_noac_cnt; in s3c_adc_bat_get_property()
159 if (bat->volt_value < 0 || bat->cur_value < 0 || in s3c_adc_bat_get_property()
160 jiffies_to_msecs(jiffies - bat->timestamp) > in s3c_adc_bat_get_property()
162 bat->volt_value = gather_samples(bat->client, in s3c_adc_bat_get_property()
163 bat->pdata->volt_samples, in s3c_adc_bat_get_property()
164 bat->pdata->volt_channel) * bat->pdata->volt_mult; in s3c_adc_bat_get_property()
165 bat->cur_value = gather_samples(bat->client, in s3c_adc_bat_get_property()
166 bat->pdata->current_samples, in s3c_adc_bat_get_property()
167 bat->pdata->current_channel) * bat->pdata->current_mult; in s3c_adc_bat_get_property()
168 bat->timestamp = jiffies; in s3c_adc_bat_get_property()
171 if (bat->cable_plugged && in s3c_adc_bat_get_property()
172 ((bat->pdata->gpio_charge_finished < 0) || in s3c_adc_bat_get_property()
173 !charge_finished(bat))) { in s3c_adc_bat_get_property()
174 lut = bat->pdata->lut_acin; in s3c_adc_bat_get_property()
175 lut_size = bat->pdata->lut_acin_cnt; in s3c_adc_bat_get_property()
179 full_volt = calc_full_volt((bat->volt_value / 1000), in s3c_adc_bat_get_property()
180 (bat->cur_value / 1000), bat->pdata->internal_impedance); in s3c_adc_bat_get_property()
183 bat->pdata->internal_impedance)) { in s3c_adc_bat_get_property()
190 bat->pdata->internal_impedance); in s3c_adc_bat_get_property()
192 bat->pdata->internal_impedance); in s3c_adc_bat_get_property()
205 bat->level = new_level; in s3c_adc_bat_get_property()
209 if (bat->pdata->gpio_charge_finished < 0) in s3c_adc_bat_get_property()
210 val->intval = bat->level == 100000 ? in s3c_adc_bat_get_property()
211 POWER_SUPPLY_STATUS_FULL : bat->status; in s3c_adc_bat_get_property()
213 val->intval = bat->status; in s3c_adc_bat_get_property()
222 val->intval = bat->level; in s3c_adc_bat_get_property()
225 val->intval = bat->volt_value; in s3c_adc_bat_get_property()
228 val->intval = bat->cur_value; in s3c_adc_bat_get_property()
249 struct s3c_adc_bat *bat = &main_bat; in s3c_adc_bat_work() local
254 is_plugged = power_supply_am_i_supplied(bat->psy); in s3c_adc_bat_work()
255 bat->cable_plugged = is_plugged; in s3c_adc_bat_work()
259 if (bat->pdata->enable_charger) in s3c_adc_bat_work()
260 bat->pdata->enable_charger(); in s3c_adc_bat_work()
261 bat->status = POWER_SUPPLY_STATUS_CHARGING; in s3c_adc_bat_work()
263 if (bat->pdata->disable_charger) in s3c_adc_bat_work()
264 bat->pdata->disable_charger(); in s3c_adc_bat_work()
265 bat->status = POWER_SUPPLY_STATUS_DISCHARGING; in s3c_adc_bat_work()
268 if ((bat->pdata->gpio_charge_finished >= 0) && is_plugged) { in s3c_adc_bat_work()
271 if (bat->pdata->disable_charger) in s3c_adc_bat_work()
272 bat->pdata->disable_charger(); in s3c_adc_bat_work()
273 bat->status = POWER_SUPPLY_STATUS_FULL; in s3c_adc_bat_work()
275 if (bat->pdata->enable_charger) in s3c_adc_bat_work()
276 bat->pdata->enable_charger(); in s3c_adc_bat_work()
277 bat->status = POWER_SUPPLY_STATUS_CHARGING; in s3c_adc_bat_work()
282 power_supply_changed(bat->psy); in s3c_adc_bat_work()