Home
last modified time | relevance | path

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

12

/linux-6.12.1/drivers/power/supply/
Dsurface_battery.c155 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 …]
Dpm8916_bms_vm.c62 struct pm8916_bms_vm_battery *bat = power_supply_get_drvdata(psy); in pm8916_bms_vm_battery_get_property() local
63 struct power_supply_battery_info *info = bat->info; in pm8916_bms_vm_battery_get_property()
79 if (bat->vbat_now < info->voltage_min_design_uv) in pm8916_bms_vm_battery_get_property()
81 else if (bat->vbat_now > info->voltage_max_design_uv) in pm8916_bms_vm_battery_get_property()
88 val->intval = bat->vbat_now; in pm8916_bms_vm_battery_get_property()
96 if (ktime_get_seconds() - bat->last_ocv_time > 180) in pm8916_bms_vm_battery_get_property()
99 val->intval = bat->last_ocv; in pm8916_bms_vm_battery_get_property()
116 struct pm8916_bms_vm_battery *bat = data; in pm8916_bms_vm_fifo_update_done_irq() local
120 ret = regmap_bulk_read(bat->regmap, bat->reg + PM8916_BMS_VM_BMS_FIFO_REG_0_LSB, in pm8916_bms_vm_fifo_update_done_irq()
133 bat->vbat_now = vbat_data[PM8916_BMS_VM_FIFO_COUNT - 1] * 300; in pm8916_bms_vm_fifo_update_done_irq()
[all …]
Dda9052-battery.c185 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 …]
Dcollie_battery.c35 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 …]
Dacer_a500_battery.c63 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 …]
Dingenic-battery.c28 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_scale(bat->channel, in ingenic_battery_get_property()
45 ret = iio_read_channel_processed_scale(bat->channel, in ingenic_battery_get_property()
63 static int ingenic_battery_set_scale(struct ingenic_battery *bat) in ingenic_battery_set_scale() argument
69 ret = iio_read_max_channel_raw(bat->channel, &max_raw); in ingenic_battery_set_scale()
71 dev_err(bat->dev, "Unable to read max raw channel value\n"); in ingenic_battery_set_scale()
75 ret = iio_read_avail_channel_attribute(bat->channel, &scale_raw, in ingenic_battery_set_scale()
79 dev_err(bat->dev, "Unable to read channel avail scale\n"); in ingenic_battery_set_scale()
85 max_mV = bat->info->voltage_max_design_uv / 1000; in ingenic_battery_set_scale()
[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.c17 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()
Drx51_battery.c18 struct power_supply *bat; member
221 di->bat = devm_power_supply_register(di->dev, &di->bat_desc, &psy_cfg); in rx51_battery_probe()
222 if (IS_ERR(di->bat)) in rx51_battery_probe()
223 return PTR_ERR(di->bat); in rx51_battery_probe()
Dds2760_battery.c111 struct power_supply *bat; member
390 if (power_supply_am_i_supplied(di->bat)) { in ds2760_battery_update_status()
423 power_supply_changed(di->bat); in ds2760_battery_update_status()
510 if (!power_supply_am_i_supplied(di->bat)) in ds2760_battery_set_charged_work()
656 power_supply_changed(di->bat); in ds2760_pm_notifier()
742 di->bat = devm_power_supply_register(dev, &di->bat_desc, &psy_cfg); in w1_ds2760_add_slave()
743 if (IS_ERR(di->bat)) { in w1_ds2760_add_slave()
745 retval = PTR_ERR(di->bat); in w1_ds2760_add_slave()
Dmax1721x_battery.c60 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()
Daxp288_fuel_gauge.c120 struct power_supply *bat; member
499 power_supply_changed(info->bat); in fuel_gauge_thread_handler()
782 info->bat = devm_power_supply_register(dev, &fuel_gauge_desc, &psy_cfg); in axp288_fuel_gauge_probe()
783 if (IS_ERR(info->bat)) { in axp288_fuel_gauge_probe()
784 ret = PTR_ERR(info->bat); in axp288_fuel_gauge_probe()
Dcpcap-battery.c97 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()
Dds2781_battery.c34 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()
Dmax1720x_battery.c476 struct power_supply *bat; in max1720x_probe() local
495 bat = devm_power_supply_register(dev, &max1720x_bat_desc, &psy_cfg); in max1720x_probe()
496 if (IS_ERR(bat)) in max1720x_probe()
497 return dev_err_probe(dev, PTR_ERR(bat), in max1720x_probe()
/linux-6.12.1/arch/powerpc/mm/book3s32/
Dmmu.c84 struct ppc_bat *bat = BATS[b]; in find_free_bat() local
86 if (!(bat[1].batu & 3)) in find_free_bat()
121 struct ppc_bat *bat = BATS[index]; in setibat() local
128 bat[0].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ in setibat()
129 bat[0].batl = BAT_PHYS_ADDR(phys) | wimgxpp; in setibat()
131 bat[0].batu |= 1; /* Vp = 1 */ in setibat()
136 struct ppc_bat *bat = BATS[index]; in clearibat() local
138 bat[0].batu = 0; in clearibat()
139 bat[0].batl = 0; in clearibat()
244 struct ppc_bat *bat = BATS[i]; in mmu_mark_rodata_ro() local
[all …]
/linux-6.12.1/arch/powerpc/kvm/
Dbook3s_32_mmu.c132 struct kvmppc_bat *bat; in kvmppc_mmu_book3s_32_xlate_bat() local
137 bat = &vcpu_book3s->dbat[i]; in kvmppc_mmu_book3s_32_xlate_bat()
139 bat = &vcpu_book3s->ibat[i]; in kvmppc_mmu_book3s_32_xlate_bat()
142 if (!bat->vp) in kvmppc_mmu_book3s_32_xlate_bat()
145 if (!bat->vs) in kvmppc_mmu_book3s_32_xlate_bat()
152 data ? 'd' : 'i', i, eaddr, bat->bepi, in kvmppc_mmu_book3s_32_xlate_bat()
153 bat->bepi_mask); in kvmppc_mmu_book3s_32_xlate_bat()
155 if ((eaddr & bat->bepi_mask) == bat->bepi) { in kvmppc_mmu_book3s_32_xlate_bat()
162 pte->raddr = bat->brpn | (eaddr & ~bat->bepi_mask); in kvmppc_mmu_book3s_32_xlate_bat()
163 pte->may_read = bat->pp; in kvmppc_mmu_book3s_32_xlate_bat()
[all …]
Dbook3s_emulate.c633 void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat, bool upper, in kvmppc_set_bat() argument
639 bat->bepi_mask = (~bl << 17); in kvmppc_set_bat()
640 bat->bepi = val & 0xfffe0000; in kvmppc_set_bat()
641 bat->vs = (val & 2) ? 1 : 0; in kvmppc_set_bat()
642 bat->vp = (val & 1) ? 1 : 0; in kvmppc_set_bat()
643 bat->raw = (bat->raw & 0xffffffff00000000ULL) | val; in kvmppc_set_bat()
646 bat->brpn = val & 0xfffe0000; in kvmppc_set_bat()
647 bat->wimg = (val >> 3) & 0xf; in kvmppc_set_bat()
648 bat->pp = val & 3; in kvmppc_set_bat()
649 bat->raw = (bat->raw & 0x00000000ffffffffULL) | ((u64)val << 32); in kvmppc_set_bat()
[all …]
/linux-6.12.1/drivers/acpi/
Dsbs.c55 struct power_supply *bat; member
551 battery->bat = power_supply_register(&sbs->device->dev, in acpi_battery_add()
553 if (IS_ERR(battery->bat)) { in acpi_battery_add()
554 result = PTR_ERR(battery->bat); in acpi_battery_add()
555 battery->bat = NULL; in acpi_battery_add()
570 if (battery->bat) in acpi_battery_remove()
571 power_supply_unregister(battery->bat); in acpi_battery_remove()
607 struct acpi_battery *bat; in acpi_sbs_callback() local
621 bat = &sbs->battery[id]; in acpi_sbs_callback()
622 saved_battery_state = bat->present; in acpi_sbs_callback()
[all …]
Dbattery.c96 struct power_supply *bat; member
715 if (!hook->remove_battery(battery->bat, hook)) in battery_hook_unregister_unlocked()
716 power_supply_changed(battery->bat); in battery_hook_unregister_unlocked()
751 if (hook->add_battery(battery->bat, hook)) { in battery_hook_register()
763 power_supply_changed(battery->bat); in battery_hook_register()
806 if (hook_node->add_battery(battery->bat, hook_node)) { in battery_hook_add_battery()
829 hook->remove_battery(battery->bat, hook); in battery_hook_remove_battery()
891 battery->bat = power_supply_register_no_ws(&battery->device->dev, in sysfs_add_battery()
894 if (IS_ERR(battery->bat)) { in sysfs_add_battery()
895 int result = PTR_ERR(battery->bat); in sysfs_add_battery()
[all …]
/linux-6.12.1/drivers/net/wwan/t7xx/
Dt7xx_hif_dpmaif_rx.c505 struct dpmaif_bat_request *bat; in t7xx_dpmaif_release_bat_entry() local
512 bat = rxq->bat_frag; in t7xx_dpmaif_release_bat_entry()
515 bat = rxq->bat_req; in t7xx_dpmaif_release_bat_entry()
519 if (rel_entry_num >= bat->bat_size_cnt) in t7xx_dpmaif_release_bat_entry()
522 old_rel_idx = bat->bat_release_rd_idx; in t7xx_dpmaif_release_bat_entry()
526 if (bat->bat_wr_idx == old_rel_idx) in t7xx_dpmaif_release_bat_entry()
534 if (new_rel_idx >= bat->bat_size_cnt) { in t7xx_dpmaif_release_bat_entry()
535 new_rel_idx -= bat->bat_size_cnt; in t7xx_dpmaif_release_bat_entry()
540 spin_lock_irqsave(&bat->mask_lock, flags); in t7xx_dpmaif_release_bat_entry()
542 unsigned int index = bat->bat_release_rd_idx + i; in t7xx_dpmaif_release_bat_entry()
[all …]
/linux-6.12.1/arch/arm64/boot/dts/sprd/
Dsc2731.dtsi22 monitored-battery = <&bat>;
100 bat-detect-gpio = <&pmic_eic 9 GPIO_ACTIVE_HIGH>;
102 io-channel-names = "bat-temp", "charge-vol";
103 monitored-battery = <&bat>;
/linux-6.12.1/Documentation/devicetree/bindings/pinctrl/
Dmarvell,armada-xp-pinctrl.txt42 mpp21 21 gpio, ge0(rxd5), ge1(rxd3), lcd(d21), dram(bat)
54 mpp33 33 gpio, tdm(int4), sd0(d1), dram(bat), dram(vttctrl)
69 dram(bat), spi1(cs4)
/linux-6.12.1/arch/arm64/boot/dts/freescale/
Dimx8mq-librem5-r4.dts13 &bat {

12