/drivers/power/supply/ |
D | surface_battery.c | 155 static bool spwr_battery_present(struct spwr_battery_device *bat) in spwr_battery_present() argument 157 lockdep_assert_held(&bat->lock); in spwr_battery_present() 159 return le32_to_cpu(bat->sta) & SAM_BATTERY_STA_PRESENT; in spwr_battery_present() 162 static int spwr_battery_load_sta(struct spwr_battery_device *bat) in spwr_battery_load_sta() argument 164 lockdep_assert_held(&bat->lock); in spwr_battery_load_sta() 166 return ssam_retry(ssam_bat_get_sta, bat->sdev, &bat->sta); in spwr_battery_load_sta() 169 static int spwr_battery_load_bix(struct spwr_battery_device *bat) in spwr_battery_load_bix() argument 173 lockdep_assert_held(&bat->lock); in spwr_battery_load_bix() 175 if (!spwr_battery_present(bat)) in spwr_battery_load_bix() 178 status = ssam_retry(ssam_bat_get_bix, bat->sdev, &bat->bix); in spwr_battery_load_bix() [all …]
|
D | da9052-battery.c | 185 static int da9052_read_chgend_current(struct da9052_battery *bat, in da9052_read_chgend_current() argument 190 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) in da9052_read_chgend_current() 193 ret = da9052_reg_read(bat->da9052, DA9052_ICHG_END_REG); in da9052_read_chgend_current() 202 static int da9052_read_chg_current(struct da9052_battery *bat, int *current_mA) in da9052_read_chg_current() argument 206 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) in da9052_read_chg_current() 209 ret = da9052_reg_read(bat->da9052, DA9052_ICHG_AV_REG); in da9052_read_chg_current() 218 static int da9052_bat_check_status(struct da9052_battery *bat, int *status) in da9052_bat_check_status() argument 233 ret = da9052_group_read(bat->da9052, DA9052_STATUS_A_REG, 2, v); in da9052_bat_check_status() 249 bat->charger_type = DA9052_CHARGER; in da9052_bat_check_status() 255 ret = da9052_read_chg_current(bat, &chg_current); in da9052_bat_check_status() [all …]
|
D | s3c_adc_battery.c | 72 struct s3c_adc_bat *bat = power_supply_get_drvdata(psy); in s3c_adc_backup_bat_get_property() local 74 if (!bat) { in s3c_adc_backup_bat_get_property() 79 if (bat->volt_value < 0 || in s3c_adc_backup_bat_get_property() 80 jiffies_to_msecs(jiffies - bat->timestamp) > in s3c_adc_backup_bat_get_property() 82 bat->volt_value = gather_samples(bat->client, in s3c_adc_backup_bat_get_property() 83 bat->pdata->backup_volt_samples, in s3c_adc_backup_bat_get_property() 84 bat->pdata->backup_volt_channel); in s3c_adc_backup_bat_get_property() 85 bat->volt_value *= bat->pdata->backup_volt_mult; in s3c_adc_backup_bat_get_property() 86 bat->timestamp = jiffies; in s3c_adc_backup_bat_get_property() 91 val->intval = bat->volt_value; in s3c_adc_backup_bat_get_property() [all …]
|
D | collie_battery.c | 35 bool (*is_present)(struct collie_bat *bat); 54 static unsigned long collie_read_bat(struct collie_bat *bat) in collie_read_bat() argument 58 if (!bat->gpio_bat || bat->adc_bat < 0) in collie_read_bat() 61 gpiod_set_value(bat->gpio_bat, 1); in collie_read_bat() 64 value = ucb1x00_adc_read(ucb, bat->adc_bat, UCB_SYNC); in collie_read_bat() 66 gpiod_set_value(bat->gpio_bat, 0); in collie_read_bat() 68 value = value * 1000000 / bat->adc_bat_divider; in collie_read_bat() 73 static unsigned long collie_read_temp(struct collie_bat *bat) in collie_read_temp() argument 76 if (!bat->gpio_temp || bat->adc_temp < 0) in collie_read_temp() 80 gpiod_set_value(bat->gpio_temp, 1); in collie_read_temp() [all …]
|
D | acer_a500_battery.c | 63 static bool a500_battery_update_capacity(struct a500_battery *bat) in a500_battery_update_capacity() argument 68 err = regmap_read(bat->regmap, ec_data[REG_CAPACITY].reg, &capacity); in a500_battery_update_capacity() 75 if (bat->capacity != capacity) { in a500_battery_update_capacity() 76 bat->capacity = capacity; in a500_battery_update_capacity() 83 static int a500_battery_get_status(struct a500_battery *bat) in a500_battery_get_status() argument 85 if (bat->capacity < 100) { in a500_battery_get_status() 86 if (power_supply_am_i_supplied(bat->psy)) in a500_battery_get_status() 149 struct a500_battery *bat = power_supply_get_drvdata(psy); in a500_battery_get_property() local 155 val->intval = a500_battery_get_status(bat); in a500_battery_get_property() 163 a500_battery_update_capacity(bat); in a500_battery_get_property() [all …]
|
D | tosa_battery.c | 29 bool (*is_present)(struct tosa_bat *bat); 50 static unsigned long tosa_read_bat(struct tosa_bat *bat) in tosa_read_bat() argument 54 if (!bat->gpiod_bat || bat->adc_bat < 0) in tosa_read_bat() 58 gpiod_set_value(bat->gpiod_bat, 1); in tosa_read_bat() 60 value = wm97xx_read_aux_adc(dev_get_drvdata(bat->psy->dev.parent), in tosa_read_bat() 61 bat->adc_bat); in tosa_read_bat() 62 gpiod_set_value(bat->gpiod_bat, 0); in tosa_read_bat() 65 value = value * 1000000 / bat->adc_bat_divider; in tosa_read_bat() 70 static unsigned long tosa_read_temp(struct tosa_bat *bat) in tosa_read_temp() argument 74 if (!bat->gpiod_temp || bat->adc_temp < 0) in tosa_read_temp() [all …]
|
D | ingenic-battery.c | 28 struct ingenic_battery *bat = power_supply_get_drvdata(psy); in ingenic_battery_get_property() local 29 struct power_supply_battery_info *info = bat->info; in ingenic_battery_get_property() 34 ret = iio_read_channel_processed(bat->channel, &val->intval); in ingenic_battery_get_property() 44 ret = iio_read_channel_processed(bat->channel, &val->intval); in ingenic_battery_get_property() 61 static int ingenic_battery_set_scale(struct ingenic_battery *bat) in ingenic_battery_set_scale() argument 67 ret = iio_read_max_channel_raw(bat->channel, &max_raw); in ingenic_battery_set_scale() 69 dev_err(bat->dev, "Unable to read max raw channel value\n"); in ingenic_battery_set_scale() 73 ret = iio_read_avail_channel_attribute(bat->channel, &scale_raw, in ingenic_battery_set_scale() 77 dev_err(bat->dev, "Unable to read channel avail scale\n"); in ingenic_battery_set_scale() 83 max_mV = bat->info->voltage_max_design_uv / 1000; in ingenic_battery_set_scale() [all …]
|
D | twl4030_madc_battery.c | 75 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 …]
|
D | apm_power.c | 37 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 …]
|
D | pmu_battery.c | 17 struct power_supply *bat; member 176 pbat->bat = power_supply_register(&bat_pdev->dev, in pmu_bat_init() 179 if (IS_ERR(pbat->bat)) { in pmu_bat_init() 180 ret = PTR_ERR(pbat->bat); in pmu_bat_init() 193 power_supply_unregister(pbats[i]->bat); in pmu_bat_init() 211 power_supply_unregister(pbats[i]->bat); in pmu_bat_exit()
|
D | rx51_battery.c | 18 struct power_supply *bat; member 230 di->bat = power_supply_register(di->dev, &di->bat_desc, &psy_cfg); in rx51_battery_probe() 231 if (IS_ERR(di->bat)) { in rx51_battery_probe() 232 ret = PTR_ERR(di->bat); in rx51_battery_probe() 253 power_supply_unregister(di->bat); in rx51_battery_remove()
|
D | ds2760_battery.c | 111 struct power_supply *bat; member 398 if (power_supply_am_i_supplied(di->bat)) { in ds2760_battery_update_status() 431 power_supply_changed(di->bat); in ds2760_battery_update_status() 518 if (!power_supply_am_i_supplied(di->bat)) in ds2760_battery_set_charged_work() 664 power_supply_changed(di->bat); in ds2760_pm_notifier() 750 di->bat = power_supply_register(dev, &di->bat_desc, &psy_cfg); in w1_ds2760_add_slave() 751 if (IS_ERR(di->bat)) { in w1_ds2760_add_slave() 753 retval = PTR_ERR(di->bat); in w1_ds2760_add_slave() 773 power_supply_unregister(di->bat); in w1_ds2760_add_slave() 788 power_supply_unregister(di->bat); in w1_ds2760_remove_slave()
|
D | max1721x_battery.c | 60 struct power_supply *bat; member 424 info->bat = devm_power_supply_register(&sl->dev, &info->bat_desc, in devm_w1_max1721x_add_device() 426 if (IS_ERR(info->bat)) { in devm_w1_max1721x_add_device() 428 return PTR_ERR(info->bat); in devm_w1_max1721x_add_device()
|
D | axp288_fuel_gauge.c | 120 struct power_supply *bat; member 499 power_supply_changed(info->bat); in fuel_gauge_thread_handler() 772 info->bat = devm_power_supply_register(dev, &fuel_gauge_desc, &psy_cfg); in axp288_fuel_gauge_probe() 773 if (IS_ERR(info->bat)) { in axp288_fuel_gauge_probe() 774 ret = PTR_ERR(info->bat); in axp288_fuel_gauge_probe()
|
D | cpcap-battery.c | 97 struct power_supply_battery_info bat; member 373 .bat.constant_charge_voltage_max_uv = 4200000, 383 .bat.constant_charge_voltage_max_uv = 4200000, 396 .bat.constant_charge_voltage_max_uv = 4200000, 519 vfull = ddata->config.bat.constant_charge_voltage_max_uv - 120000; in cpcap_battery_full() 686 val->intval = ddata->config.bat.constant_charge_voltage_max_uv; in cpcap_battery_get_property() 839 ddata->config.bat.constant_charge_voltage_max_uv = val->intval; in cpcap_battery_set_property()
|
D | ds2781_battery.c | 34 struct power_supply *bat; member 323 if (power_supply_am_i_supplied(dev_info->bat)) { in ds2781_get_status() 771 dev_info->bat = devm_power_supply_register(&pdev->dev, in ds2781_battery_probe() 774 if (IS_ERR(dev_info->bat)) { in ds2781_battery_probe() 776 return PTR_ERR(dev_info->bat); in ds2781_battery_probe()
|
D | ds2780_battery.c | 36 struct power_supply *bat; member 767 dev_info->bat = devm_power_supply_register(&pdev->dev, in ds2780_battery_probe() 770 if (IS_ERR(dev_info->bat)) { in ds2780_battery_probe() 772 return PTR_ERR(dev_info->bat); in ds2780_battery_probe()
|
D | bq27xxx_battery.c | 1478 if (power_supply_get_battery_info(di->bat, &info) < 0) 1878 power_supply_changed(di->bat); 2131 di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); 2132 if (IS_ERR(di->bat)) 2133 return dev_err_probe(di->dev, PTR_ERR(di->bat), 2160 power_supply_unregister(di->bat);
|
/drivers/acpi/ |
D | sbs.c | 55 struct power_supply *bat; member 534 battery->bat = power_supply_register(&sbs->device->dev, in acpi_battery_add() 536 if (IS_ERR(battery->bat)) { in acpi_battery_add() 537 result = PTR_ERR(battery->bat); in acpi_battery_add() 538 battery->bat = NULL; in acpi_battery_add() 542 result = device_create_file(&battery->bat->dev, &alarm_attr); in acpi_battery_add() 557 if (battery->bat) { in acpi_battery_remove() 559 device_remove_file(&battery->bat->dev, &alarm_attr); in acpi_battery_remove() 560 power_supply_unregister(battery->bat); in acpi_battery_remove() 597 struct acpi_battery *bat; in acpi_sbs_callback() local [all …]
|
D | battery.c | 96 struct power_supply *bat; member 699 hook->remove_battery(battery->bat); in __battery_hook_unregister() 727 if (hook->add_battery(battery->bat)) { in battery_hook_register() 765 if (hook_node->add_battery(battery->bat)) { in battery_hook_add_battery() 788 hook->remove_battery(battery->bat); in battery_hook_remove_battery() 847 battery->bat = power_supply_register_no_ws(&battery->device->dev, in sysfs_add_battery() 850 if (IS_ERR(battery->bat)) { in sysfs_add_battery() 851 int result = PTR_ERR(battery->bat); in sysfs_add_battery() 853 battery->bat = NULL; in sysfs_add_battery() 857 return device_create_file(&battery->bat->dev, &alarm_attr); in sysfs_add_battery() [all …]
|
/drivers/net/wwan/t7xx/ |
D | t7xx_hif_dpmaif_rx.c | 541 struct dpmaif_bat_request *bat; in t7xx_dpmaif_release_bat_entry() local 548 bat = rxq->bat_frag; in t7xx_dpmaif_release_bat_entry() 551 bat = rxq->bat_req; in t7xx_dpmaif_release_bat_entry() 555 if (rel_entry_num >= bat->bat_size_cnt) in t7xx_dpmaif_release_bat_entry() 558 old_rel_idx = bat->bat_release_rd_idx; in t7xx_dpmaif_release_bat_entry() 562 if (bat->bat_wr_idx == old_rel_idx) in t7xx_dpmaif_release_bat_entry() 570 if (new_rel_idx >= bat->bat_size_cnt) { in t7xx_dpmaif_release_bat_entry() 571 new_rel_idx -= bat->bat_size_cnt; in t7xx_dpmaif_release_bat_entry() 576 spin_lock_irqsave(&bat->mask_lock, flags); in t7xx_dpmaif_release_bat_entry() 578 unsigned int index = bat->bat_release_rd_idx + i; in t7xx_dpmaif_release_bat_entry() [all …]
|