Lines Matching refs:battery
204 struct hidpp_battery battery;
527 usb_set_wireless_status(intf, hidpp->battery.online ?
737 hidpp->battery.level =
740 hidpp->battery.status = status;
742 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING ||
789 hidpp->battery.capacity = response.rap.params[0];
791 hidpp->battery.status = status;
793 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING ||
810 capacity = hidpp->battery.capacity;
816 level = hidpp->battery.level;
823 changed = capacity != hidpp->battery.capacity ||
824 level != hidpp->battery.level ||
825 status != hidpp->battery.status;
828 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING ||
832 hidpp->battery.level = level;
833 hidpp->battery.status = status;
834 if (hidpp->battery.ps)
835 power_supply_changed(hidpp->battery.ps);
1231 /* 5 = invalid battery type
1310 if (hidpp->battery.feature_index == 0xff) {
1313 &hidpp->battery.feature_index,
1320 hidpp->battery.feature_index,
1327 hidpp->battery.feature_index);
1331 hidpp->battery.status = status;
1332 hidpp->battery.capacity = capacity;
1333 hidpp->battery.level = level;
1335 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING ||
1348 if (report->fap.feature_index != hidpp->battery.feature_index ||
1358 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING ||
1361 changed = capacity != hidpp->battery.capacity ||
1362 level != hidpp->battery.level ||
1363 status != hidpp->battery.status;
1366 hidpp->battery.level = level;
1367 hidpp->battery.capacity = capacity;
1368 hidpp->battery.status = status;
1369 if (hidpp->battery.ps)
1370 power_supply_changed(hidpp->battery.ps);
1462 * there are a few devices that use different battery technology.
1499 if (hidpp->battery.voltage_feature_index == 0xff) {
1501 &hidpp->battery.voltage_feature_index,
1508 hidpp->battery.voltage_feature_index,
1514 hidpp->battery.status = status;
1515 hidpp->battery.voltage = voltage;
1516 hidpp->battery.capacity = hidpp20_map_battery_capacity(hidpp->hid_dev,
1518 hidpp->battery.level = level;
1519 hidpp->battery.charge_type = charge_type;
1520 hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING;
1531 if (report->fap.feature_index != hidpp->battery.voltage_feature_index ||
1538 hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING;
1540 if (voltage != hidpp->battery.voltage || status != hidpp->battery.status) {
1541 hidpp->battery.voltage = voltage;
1542 hidpp->battery.capacity = hidpp20_map_battery_capacity(hidpp->hid_dev,
1544 hidpp->battery.status = status;
1545 hidpp->battery.level = level;
1546 hidpp->battery.charge_type = charge_type;
1547 if (hidpp->battery.ps)
1548 power_supply_changed(hidpp->battery.ps);
1554 /* 0x1004: Unified battery */
1600 * If the device supports state of charge (battery percentage) we won't
1601 * export the battery level information. there are 4 possible battery
1603 * not support any of them, we are just better off with the battery
1608 hidpp->battery.supported_levels_1004 = 0;
1611 hidpp->battery.supported_levels_1004 = params[0];
1651 battery_level &= hidpp->battery.supported_levels_1004;
1703 if (hidpp->battery.feature_index == 0xff) {
1706 &hidpp->battery.feature_index,
1713 hidpp->battery.feature_index);
1718 hidpp->battery.feature_index,
1726 hidpp->battery.capacity = state_of_charge;
1727 hidpp->battery.status = status;
1728 hidpp->battery.level = level;
1729 hidpp->battery.online = true;
1742 if (report->fap.feature_index != hidpp->battery.feature_index ||
1750 changed = status != hidpp->battery.status ||
1751 (state_of_charge != hidpp->battery.capacity &&
1753 (level != hidpp->battery.level &&
1757 hidpp->battery.capacity = state_of_charge;
1758 hidpp->battery.status = status;
1759 hidpp->battery.level = level;
1760 if (hidpp->battery.ps)
1761 power_supply_changed(hidpp->battery.ps);
1792 val->intval = hidpp->battery.status;
1795 val->intval = hidpp->battery.capacity;
1798 val->intval = hidpp->battery.level;
1804 val->intval = hidpp->battery.online;
1820 val->intval = hidpp->battery.voltage * 1000;
1823 val->intval = hidpp->battery.charge_type;
1864 * there are a few devices that use different battery technology.
1960 if (hidpp->battery.adc_measurement_feature_index == 0xff) {
1964 &hidpp->battery.adc_measurement_feature_index,
1972 hidpp->battery.online = hidpp20_get_adc_measurement_1f20(hidpp,
1973 hidpp->battery.adc_measurement_feature_index,
1974 &hidpp->battery.status,
1975 &hidpp->battery.voltage);
1976 hidpp->battery.capacity = hidpp20_map_adc_measurement_1f20_capacity(hidpp->hid_dev,
1977 hidpp->battery.voltage);
1989 if (report->fap.feature_index != hidpp->battery.adc_measurement_feature_index ||
1995 hidpp->battery.online = status != POWER_SUPPLY_STATUS_UNKNOWN;
1997 if (voltage != hidpp->battery.voltage || status != hidpp->battery.status) {
1998 hidpp->battery.status = status;
1999 hidpp->battery.voltage = voltage;
2000 hidpp->battery.capacity = hidpp20_map_adc_measurement_1f20_capacity(hidpp->hid_dev, voltage);
2001 if (hidpp->battery.ps)
2002 power_supply_changed(hidpp->battery.ps);
2120 if (hidpp->battery.feature_index == 0xff) {
2123 &hidpp->battery.solar_feature_index,
2130 hidpp->battery.solar_feature_index,
2156 if (report->fap.feature_index != hidpp->battery.solar_feature_index ||
2174 if (capacity < hidpp->battery.capacity)
2184 hidpp->battery.online = true;
2185 if (capacity != hidpp->battery.capacity ||
2186 status != hidpp->battery.status) {
2187 hidpp->battery.capacity = capacity;
2188 hidpp->battery.status = status;
2189 if (hidpp->battery.ps)
2190 power_supply_changed(hidpp->battery.ps);
4039 struct power_supply_desc *desc = &hidpp->battery.desc;
4041 struct hidpp_battery *battery;
4046 if (hidpp->battery.ps)
4049 hidpp->battery.feature_index = 0xff;
4050 hidpp->battery.solar_feature_index = 0xff;
4051 hidpp->battery.voltage_feature_index = 0xff;
4052 hidpp->battery.adc_measurement_feature_index = 0xff;
4058 /* we only support one battery feature right now, so let's
4059 first check the ones that support battery level first
4111 battery = &hidpp->battery;
4117 sprintf(battery->name, "hidpp_battery_%ld", n);
4118 desc->name = battery->name;
4122 battery->ps = devm_power_supply_register(&hidpp->hid_dev->dev,
4123 &battery->desc,
4125 if (IS_ERR(battery->ps))
4126 return PTR_ERR(battery->ps);
4128 power_supply_powers(battery->ps, &hidpp->hid_dev->dev);
4200 if (hidpp->battery.ps) {
4201 hidpp->battery.online = false;
4202 hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN;
4203 hidpp->battery.level = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN;
4204 power_supply_changed(hidpp->battery.ps);
4275 /* forward current battery state */
4292 if (hidpp->battery.ps)
4293 power_supply_changed(hidpp->battery.ps);
4457 /* indicates we are handling the battery properties in the kernel */