• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/power/

Lines Matching defs:bat

34 	bool (*is_present)(struct tosa_bat *bat);
54 static unsigned long tosa_read_bat(struct tosa_bat *bat)
58 if (bat->gpio_bat < 0 || bat->adc_bat < 0)
62 gpio_set_value(bat->gpio_bat, 1);
64 value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
65 bat->adc_bat);
66 gpio_set_value(bat->gpio_bat, 0);
69 value = value * 1000000 / bat->adc_bat_divider;
74 static unsigned long tosa_read_temp(struct tosa_bat *bat)
78 if (bat->gpio_temp < 0 || bat->adc_temp < 0)
82 gpio_set_value(bat->gpio_temp, 1);
84 value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy.dev->parent),
85 bat->adc_temp);
86 gpio_set_value(bat->gpio_temp, 0);
89 value = value * 10000 / bat->adc_temp_divider;
99 struct tosa_bat *bat = container_of(psy, struct tosa_bat, psy);
101 if (bat->is_present && !bat->is_present(bat)
108 val->intval = bat->status;
111 val->intval = bat->technology;
114 val->intval = tosa_read_bat(bat);
117 if (bat->full_chrg == -1)
118 val->intval = bat->bat_max;
120 val->intval = bat->full_chrg;
123 val->intval = bat->bat_max;
126 val->intval = bat->bat_min;
129 val->intval = tosa_read_temp(bat);
132 val->intval = bat->is_present ? bat->is_present(bat) : 1;
141 static bool tosa_jacket_bat_is_present(struct tosa_bat *bat)
158 static void tosa_bat_update(struct tosa_bat *bat)
161 struct power_supply *psy = &bat->psy;
163 mutex_lock(&bat->work_lock);
165 old = bat->status;
167 if (bat->is_present && !bat->is_present(bat)) {
169 bat->status = POWER_SUPPLY_STATUS_UNKNOWN;
170 bat->full_chrg = -1;
172 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) {
173 gpio_set_value(bat->gpio_charge_off, 0);
177 if (gpio_get_value(bat->gpio_full)) {
179 bat->full_chrg == -1)
180 bat->full_chrg = tosa_read_bat(bat);
182 gpio_set_value(bat->gpio_charge_off, 1);
183 bat->status = POWER_SUPPLY_STATUS_FULL;
185 gpio_set_value(bat->gpio_charge_off, 0);
186 bat->status = POWER_SUPPLY_STATUS_CHARGING;
189 gpio_set_value(bat->gpio_charge_off, 1);
190 bat->status = POWER_SUPPLY_STATUS_DISCHARGING;
193 if (old != bat->status)
196 mutex_unlock(&bat->work_lock);