Home
last modified time | relevance | path

Searched refs:bat (Results 1 – 19 of 19) sorted by relevance

/drivers/power/supply/
Dda9052-battery.c189 static int da9052_read_chgend_current(struct da9052_battery *bat, in da9052_read_chgend_current() argument
194 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) in da9052_read_chgend_current()
197 ret = da9052_reg_read(bat->da9052, DA9052_ICHG_END_REG); in da9052_read_chgend_current()
206 static int da9052_read_chg_current(struct da9052_battery *bat, int *current_mA) in da9052_read_chg_current() argument
210 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) in da9052_read_chg_current()
213 ret = da9052_reg_read(bat->da9052, DA9052_ICHG_AV_REG); in da9052_read_chg_current()
222 static int da9052_bat_check_status(struct da9052_battery *bat, int *status) in da9052_bat_check_status() argument
237 ret = da9052_group_read(bat->da9052, DA9052_STATUS_A_REG, 2, v); in da9052_bat_check_status()
253 bat->charger_type = DA9052_CHARGER; in da9052_bat_check_status()
259 ret = da9052_read_chg_current(bat, &chg_current); in da9052_bat_check_status()
[all …]
Ds3c_adc_battery.c76 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()
[all …]
Dcollie_battery.c37 bool (*is_present)(struct collie_bat *bat);
56 static unsigned long collie_read_bat(struct collie_bat *bat) in collie_read_bat() argument
60 if (bat->gpio_bat < 0 || bat->adc_bat < 0) in collie_read_bat()
63 gpio_set_value(bat->gpio_bat, 1); in collie_read_bat()
66 value = ucb1x00_adc_read(ucb, bat->adc_bat, UCB_SYNC); in collie_read_bat()
68 gpio_set_value(bat->gpio_bat, 0); in collie_read_bat()
70 value = value * 1000000 / bat->adc_bat_divider; in collie_read_bat()
75 static unsigned long collie_read_temp(struct collie_bat *bat) in collie_read_temp() argument
78 if (bat->gpio_temp < 0 || bat->adc_temp < 0) in collie_read_temp()
82 gpio_set_value(bat->gpio_temp, 1); in collie_read_temp()
[all …]
Dtosa_battery.c34 bool (*is_present)(struct tosa_bat *bat);
54 static unsigned long tosa_read_bat(struct tosa_bat *bat) in tosa_read_bat() argument
58 if (bat->gpio_bat < 0 || bat->adc_bat < 0) in tosa_read_bat()
62 gpio_set_value(bat->gpio_bat, 1); in tosa_read_bat()
64 value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy->dev.parent), in tosa_read_bat()
65 bat->adc_bat); in tosa_read_bat()
66 gpio_set_value(bat->gpio_bat, 0); in tosa_read_bat()
69 value = value * 1000000 / bat->adc_bat_divider; in tosa_read_bat()
74 static unsigned long tosa_read_temp(struct tosa_bat *bat) in tosa_read_temp() argument
78 if (bat->gpio_temp < 0 || bat->adc_temp < 0) in tosa_read_temp()
[all …]
Dtwl4030_madc_battery.c75 static int twl4030_madc_bat_voltscale(struct twl4030_madc_battery *bat, in twl4030_madc_bat_voltscale() argument
82 if (twl4030_madc_bat_get_charging_status(bat)) in twl4030_madc_bat_voltscale()
83 calibration = bat->pdata->charging; in twl4030_madc_bat_voltscale()
85 calibration = bat->pdata->discharging; in twl4030_madc_bat_voltscale()
111 struct twl4030_madc_battery *bat = power_supply_get_drvdata(psy); in twl4030_madc_bat_get_property() local
115 if (twl4030_madc_bat_voltscale(bat, in twl4030_madc_bat_get_property()
116 twl4030_madc_bat_get_voltage(bat)) > 95) in twl4030_madc_bat_get_property()
119 if (twl4030_madc_bat_get_charging_status(bat)) in twl4030_madc_bat_get_property()
126 val->intval = twl4030_madc_bat_get_voltage(bat) * 1000; in twl4030_madc_bat_get_property()
132 val->intval = twl4030_madc_bat_get_current(bat); in twl4030_madc_bat_get_property()
[all …]
Dapm_power.c37 struct power_supply *bat; member
49 bp->bat = dev_get_drvdata(dev); in __find_main_battery()
51 if (bp->bat->desc->use_for_apm) { in __find_main_battery()
53 bp->main = bp->bat; in __find_main_battery()
57 if (!PSY_PROP(bp->bat, CHARGE_FULL_DESIGN, &bp->full) || in __find_main_battery()
58 !PSY_PROP(bp->bat, CHARGE_FULL, &bp->full)) { in __find_main_battery()
60 bp->max_charge_bat = bp->bat; in __find_main_battery()
63 } else if (!PSY_PROP(bp->bat, ENERGY_FULL_DESIGN, &bp->full) || in __find_main_battery()
64 !PSY_PROP(bp->bat, ENERGY_FULL, &bp->full)) { in __find_main_battery()
66 bp->max_energy_bat = bp->bat; in __find_main_battery()
[all …]
Dpmu_battery.c20 struct power_supply *bat; member
179 pbat->bat = power_supply_register(&bat_pdev->dev, in pmu_bat_init()
182 if (IS_ERR(pbat->bat)) { in pmu_bat_init()
183 ret = PTR_ERR(pbat->bat); in pmu_bat_init()
196 power_supply_unregister(pbats[i]->bat); in pmu_bat_init()
214 power_supply_unregister(pbats[i]->bat); in pmu_bat_exit()
Dds2781_battery.c38 struct power_supply *bat; member
332 if (power_supply_am_i_supplied(dev_info->bat)) { in ds2781_get_status()
768 dev_info->bat = power_supply_register(&pdev->dev, &dev_info->bat_desc, in ds2781_battery_probe()
770 if (IS_ERR(dev_info->bat)) { in ds2781_battery_probe()
772 ret = PTR_ERR(dev_info->bat); in ds2781_battery_probe()
776 ret = sysfs_create_group(&dev_info->bat->dev.kobj, &ds2781_attr_group); in ds2781_battery_probe()
782 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2781_battery_probe()
790 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2781_battery_probe()
801 sysfs_remove_bin_file(&dev_info->bat->dev.kobj, in ds2781_battery_probe()
804 sysfs_remove_group(&dev_info->bat->dev.kobj, &ds2781_attr_group); in ds2781_battery_probe()
[all …]
Dds2780_battery.c40 struct power_supply *bat; member
767 dev_info->bat = power_supply_register(&pdev->dev, &dev_info->bat_desc, in ds2780_battery_probe()
769 if (IS_ERR(dev_info->bat)) { in ds2780_battery_probe()
771 ret = PTR_ERR(dev_info->bat); in ds2780_battery_probe()
775 ret = sysfs_create_group(&dev_info->bat->dev.kobj, &ds2780_attr_group); in ds2780_battery_probe()
781 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2780_battery_probe()
789 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2780_battery_probe()
800 sysfs_remove_bin_file(&dev_info->bat->dev.kobj, in ds2780_battery_probe()
803 sysfs_remove_group(&dev_info->bat->dev.kobj, &ds2780_attr_group); in ds2780_battery_probe()
805 power_supply_unregister(dev_info->bat); in ds2780_battery_probe()
[all …]
Dds2760_battery.c56 struct power_supply *bat; member
258 if (power_supply_am_i_supplied(di->bat)) { in ds2760_battery_update_status()
291 power_supply_changed(di->bat); in ds2760_battery_update_status()
378 if (!power_supply_am_i_supplied(di->bat)) in ds2760_battery_set_charged_work()
559 di->bat = power_supply_register(&pdev->dev, &di->bat_desc, &psy_cfg); in ds2760_battery_probe()
560 if (IS_ERR(di->bat)) { in ds2760_battery_probe()
562 retval = PTR_ERR(di->bat); in ds2760_battery_probe()
580 power_supply_unregister(di->bat); in ds2760_battery_probe()
594 power_supply_unregister(di->bat); in ds2760_battery_remove()
616 power_supply_changed(di->bat); in ds2760_battery_resume()
Drx51_battery.c32 struct power_supply *bat; member
244 di->bat = power_supply_register(di->dev, &di->bat_desc, &psy_cfg); in rx51_battery_probe()
245 if (IS_ERR(di->bat)) { in rx51_battery_probe()
246 ret = PTR_ERR(di->bat); in rx51_battery_probe()
267 power_supply_unregister(di->bat); in rx51_battery_remove()
Daxp288_fuel_gauge.c128 struct power_supply *bat; member
809 power_supply_changed(info->bat); in fuel_gauge_status_monitor()
855 power_supply_changed(info->bat); in fuel_gauge_thread_handler()
863 power_supply_changed(info->bat); in fuel_gauge_external_power_changed()
1114 info->bat = power_supply_register(&pdev->dev, &fuel_gauge_desc, &psy_cfg); in axp288_fuel_gauge_probe()
1115 if (IS_ERR(info->bat)) { in axp288_fuel_gauge_probe()
1116 ret = PTR_ERR(info->bat); in axp288_fuel_gauge_probe()
1141 power_supply_unregister(info->bat); in axp288_fuel_gauge_remove()
Dbq27xxx_battery.c777 power_supply_changed(di->bat); in bq27xxx_battery_update()
841 else if (power_supply_am_i_supplied(di->bat)) in bq27xxx_battery_status()
1032 di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); in bq27xxx_battery_setup()
1033 if (IS_ERR(di->bat)) { in bq27xxx_battery_setup()
1035 return PTR_ERR(di->bat); in bq27xxx_battery_setup()
1062 power_supply_unregister(di->bat); in bq27xxx_battery_teardown()
Dpm2301_charger.h478 struct pm2xxx_bm_data *bat; member
Dpm2301_charger.c776 if (!pm2->bat->enable_overshoot) { in pm2xxx_charger_ac_en()
1020 pm2->bat = pl_data->battery; in pm2xxx_wall_charger_probe()
/drivers/staging/lustre/lnet/selftest/
Dconsole.c829 struct lstcon_batch *bat; in lstcon_batch_find() local
831 list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) { in lstcon_batch_find()
832 if (!strncmp(bat->bat_name, name, LST_NAME_SIZE)) { in lstcon_batch_find()
833 *batpp = bat; in lstcon_batch_find()
844 struct lstcon_batch *bat; in lstcon_batch_add() local
848 rc = !lstcon_batch_find(name, &bat) ? -EEXIST : 0; in lstcon_batch_add()
854 LIBCFS_ALLOC(bat, sizeof(struct lstcon_batch)); in lstcon_batch_add()
855 if (!bat) { in lstcon_batch_add()
860 LIBCFS_ALLOC(bat->bat_cli_hash, in lstcon_batch_add()
862 if (!bat->bat_cli_hash) { in lstcon_batch_add()
[all …]
Dframework.c321 struct sfw_batch *bat; in sfw_find_batch() local
325 list_for_each_entry(bat, &sn->sn_batches, bat_list) { in sfw_find_batch()
326 if (bat->bat_id.bat_id == bid.bat_id) in sfw_find_batch()
327 return bat; in sfw_find_batch()
337 struct sfw_batch *bat; in sfw_bid2batch() local
341 bat = sfw_find_batch(bid); in sfw_bid2batch()
342 if (bat) in sfw_bid2batch()
343 return bat; in sfw_bid2batch()
345 LIBCFS_ALLOC(bat, sizeof(struct sfw_batch)); in sfw_bid2batch()
346 if (!bat) in sfw_bid2batch()
[all …]
/drivers/acpi/
Dsbs.c73 struct power_supply *bat; member
548 battery->bat = power_supply_register(&sbs->device->dev, in acpi_battery_add()
550 if (IS_ERR(battery->bat)) { in acpi_battery_add()
551 result = PTR_ERR(battery->bat); in acpi_battery_add()
552 battery->bat = NULL; in acpi_battery_add()
556 result = device_create_file(&battery->bat->dev, &alarm_attr); in acpi_battery_add()
571 if (battery->bat) { in acpi_battery_remove()
573 device_remove_file(&battery->bat->dev, &alarm_attr); in acpi_battery_remove()
574 power_supply_unregister(battery->bat); in acpi_battery_remove()
611 struct acpi_battery *bat; in acpi_sbs_callback() local
[all …]
Dbattery.c117 struct power_supply *bat; member
617 battery->bat = power_supply_register_no_ws(&battery->device->dev, in sysfs_add_battery()
620 if (IS_ERR(battery->bat)) { in sysfs_add_battery()
621 int result = PTR_ERR(battery->bat); in sysfs_add_battery()
623 battery->bat = NULL; in sysfs_add_battery()
626 return device_create_file(&battery->bat->dev, &alarm_attr); in sysfs_add_battery()
632 if (!battery->bat) { in sysfs_remove_battery()
637 device_remove_file(&battery->bat->dev, &alarm_attr); in sysfs_remove_battery()
638 power_supply_unregister(battery->bat); in sysfs_remove_battery()
639 battery->bat = NULL; in sysfs_remove_battery()
[all …]