Lines Matching refs:desc
102 switch (cm->desc->battery_present) { in is_batt_present()
109 psy = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in is_batt_present()
120 for (i = 0; cm->desc->psy_charger_stat[i]; i++) { in is_batt_present()
122 cm->desc->psy_charger_stat[i]); in is_batt_present()
125 cm->desc->psy_charger_stat[i]); in is_batt_present()
159 for (i = 0; cm->desc->psy_charger_stat[i]; i++) { in is_ext_pwr_online()
160 psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); in is_ext_pwr_online()
163 cm->desc->psy_charger_stat[i]); in is_ext_pwr_online()
193 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in get_batt_uV()
223 for (i = 0; cm->desc->psy_charger_stat[i]; i++) { in is_charging()
230 psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); in is_charging()
233 cm->desc->psy_charger_stat[i]); in is_charging()
242 cm->desc->psy_charger_stat[i]); in is_charging()
260 cm->desc->psy_charger_stat[i]); in is_charging()
282 struct charger_desc *desc = cm->desc; in is_full_charged() local
293 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in is_full_charged()
298 if (desc->fullbatt_uV > 0) { in is_full_charged()
303 && desc->fullbatt_vchkdrop_uV) in is_full_charged()
304 uV += desc->fullbatt_vchkdrop_uV; in is_full_charged()
305 if (uV >= desc->fullbatt_uV) in is_full_charged()
310 if (desc->fullbatt_full_capacity > 0) { in is_full_charged()
316 if (!ret && val.intval > desc->fullbatt_full_capacity) { in is_full_charged()
323 if (desc->fullbatt_soc > 0) { in is_full_charged()
328 if (!ret && val.intval >= desc->fullbatt_soc) { in is_full_charged()
345 switch (cm->desc->polling_mode) { in is_polling_required()
356 cm->desc->polling_mode); in is_polling_required()
375 struct charger_desc *desc = cm->desc; in try_charger_enable() local
392 for (i = 0 ; i < desc->num_charger_regulators ; i++) { in try_charger_enable()
393 if (desc->charger_regulators[i].externally_control) in try_charger_enable()
396 err = regulator_enable(desc->charger_regulators[i].consumer); in try_charger_enable()
399 desc->charger_regulators[i].regulator_name); in try_charger_enable()
410 for (i = 0 ; i < desc->num_charger_regulators ; i++) { in try_charger_enable()
411 if (desc->charger_regulators[i].externally_control) in try_charger_enable()
414 err = regulator_disable(desc->charger_regulators[i].consumer); in try_charger_enable()
417 desc->charger_regulators[i].regulator_name); in try_charger_enable()
425 for (i = 0; i < desc->num_charger_regulators; i++) { in try_charger_enable()
427 desc->charger_regulators[i].consumer)) { in try_charger_enable()
429 desc->charger_regulators[i].consumer); in try_charger_enable()
431 desc->charger_regulators[i].regulator_name); in try_charger_enable()
454 struct charger_desc *desc = cm->desc; in check_charging_duration() local
459 if (!desc->charging_max_duration_ms && in check_charging_duration()
460 !desc->discharging_max_duration_ms) in check_charging_duration()
466 if (duration > desc->charging_max_duration_ms) { in check_charging_duration()
468 desc->charging_max_duration_ms); in check_charging_duration()
474 if (duration > desc->discharging_max_duration_ms) { in check_charging_duration()
476 desc->discharging_max_duration_ms); in check_charging_duration()
490 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in cm_get_battery_temperature_by_psy()
507 if (!cm->desc->measure_battery_temp) in cm_get_battery_temperature()
528 struct charger_desc *desc = cm->desc; in cm_check_thermal_status() local
543 upper_limit = desc->temp_max; in cm_check_thermal_status()
544 lower_limit = desc->temp_min; in cm_check_thermal_status()
547 upper_limit -= desc->temp_diff; in cm_check_thermal_status()
548 lower_limit += desc->temp_diff; in cm_check_thermal_status()
658 if (is_polling_required(cm) && cm->desc->polling_interval_ms) { in _setup_polling()
661 if (min > cm->desc->polling_interval_ms) in _setup_polling()
662 min = cm->desc->polling_interval_ms; in _setup_polling()
716 struct charger_desc *desc = cm->desc; in charger_get_property() local
743 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in charger_get_property()
760 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in charger_get_property()
793 if (desc->fullbatt_uV > 0 && uV >= desc->fullbatt_uV && in charger_get_property()
808 fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); in charger_get_property()
876 if (cm->desc->polling_interval_ms == 0) in cm_setup_timer()
878 CM_MIN_VALID(wakeup_ms, cm->desc->polling_interval_ms); in cm_setup_timer()
1030 struct charger_desc *desc = cm->desc; in charger_manager_register_extcon() local
1037 for (i = 0; i < desc->num_charger_regulators; i++) { in charger_manager_register_extcon()
1038 charger = &desc->charger_regulators[i]; in charger_manager_register_extcon()
1111 struct charger_desc *desc = cm->desc; in charger_externally_control_store() local
1128 for (i = 0; i < desc->num_charger_regulators; i++) { in charger_externally_control_store()
1129 if (&desc->charger_regulators[i] != charger && in charger_externally_control_store()
1130 !desc->charger_regulators[i].externally_control) { in charger_externally_control_store()
1172 struct charger_desc *desc = cm->desc; in charger_manager_prepare_sysfs() local
1179 for (i = 0; i < desc->num_charger_regulators; i++) { in charger_manager_prepare_sysfs()
1180 charger = &desc->charger_regulators[i]; in charger_manager_prepare_sysfs()
1193 desc->sysfs_groups[i] = &charger->attr_grp; in charger_manager_prepare_sysfs()
1214 if (!desc->charger_regulators[i].externally_control || in charger_manager_prepare_sysfs()
1235 struct charger_desc *desc = cm->desc; in cm_init_thermal_data() local
1246 cm->desc->measure_battery_temp = true; in cm_init_thermal_data()
1249 if (ret && desc->thermal_zone) { in cm_init_thermal_data()
1251 thermal_zone_get_zone_by_name(desc->thermal_zone); in cm_init_thermal_data()
1258 cm->desc->measure_battery_temp = true; in cm_init_thermal_data()
1262 if (cm->desc->measure_battery_temp) { in cm_init_thermal_data()
1264 if (!desc->temp_max) in cm_init_thermal_data()
1265 desc->temp_max = CM_DEFAULT_CHARGE_TEMP_MAX; in cm_init_thermal_data()
1266 if (!desc->temp_diff) in cm_init_thermal_data()
1267 desc->temp_diff = CM_DEFAULT_RECHARGE_TEMP_DIFF; in cm_init_thermal_data()
1283 struct charger_desc *desc; in of_cm_parse_desc() local
1289 desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); in of_cm_parse_desc()
1290 if (!desc) in of_cm_parse_desc()
1293 of_property_read_string(np, "cm-name", &desc->psy_name); in of_cm_parse_desc()
1296 desc->polling_mode = poll_mode; in of_cm_parse_desc()
1299 &desc->polling_interval_ms); in of_cm_parse_desc()
1302 &desc->fullbatt_vchkdrop_uV); in of_cm_parse_desc()
1303 of_property_read_u32(np, "cm-fullbatt-voltage", &desc->fullbatt_uV); in of_cm_parse_desc()
1304 of_property_read_u32(np, "cm-fullbatt-soc", &desc->fullbatt_soc); in of_cm_parse_desc()
1306 &desc->fullbatt_full_capacity); in of_cm_parse_desc()
1309 desc->battery_present = battery_stat; in of_cm_parse_desc()
1317 desc->psy_charger_stat = devm_kcalloc(dev, in of_cm_parse_desc()
1321 if (!desc->psy_charger_stat) in of_cm_parse_desc()
1326 i, &desc->psy_charger_stat[i]); in of_cm_parse_desc()
1329 of_property_read_string(np, "cm-fuel-gauge", &desc->psy_fuel_gauge); in of_cm_parse_desc()
1331 of_property_read_string(np, "cm-thermal-zone", &desc->thermal_zone); in of_cm_parse_desc()
1333 of_property_read_u32(np, "cm-battery-cold", &desc->temp_min); in of_cm_parse_desc()
1335 desc->temp_min *= -1; in of_cm_parse_desc()
1336 of_property_read_u32(np, "cm-battery-hot", &desc->temp_max); in of_cm_parse_desc()
1337 of_property_read_u32(np, "cm-battery-temp-diff", &desc->temp_diff); in of_cm_parse_desc()
1340 &desc->charging_max_duration_ms); in of_cm_parse_desc()
1342 &desc->discharging_max_duration_ms); in of_cm_parse_desc()
1345 desc->num_charger_regulators = of_get_child_count(np); in of_cm_parse_desc()
1346 if (desc->num_charger_regulators) { in of_cm_parse_desc()
1351 desc->num_charger_regulators, in of_cm_parse_desc()
1357 desc->charger_regulators = chg_regs; in of_cm_parse_desc()
1359 desc->sysfs_groups = devm_kcalloc(dev, in of_cm_parse_desc()
1360 desc->num_charger_regulators + 1, in of_cm_parse_desc()
1361 sizeof(*desc->sysfs_groups), in of_cm_parse_desc()
1363 if (!desc->sysfs_groups) in of_cm_parse_desc()
1405 return desc; in of_cm_parse_desc()
1423 struct charger_desc *desc = cm_get_drv_data(pdev); in charger_manager_probe() local
1432 if (IS_ERR(desc)) { in charger_manager_probe()
1434 return PTR_ERR(desc); in charger_manager_probe()
1443 cm->desc = desc; in charger_manager_probe()
1458 if (desc->fullbatt_uV == 0) { in charger_manager_probe()
1461 if (!desc->fullbatt_vchkdrop_uV) { in charger_manager_probe()
1463 desc->fullbatt_vchkdrop_uV = 0; in charger_manager_probe()
1465 if (desc->fullbatt_soc == 0) { in charger_manager_probe()
1468 if (desc->fullbatt_full_capacity == 0) { in charger_manager_probe()
1472 if (!desc->charger_regulators || desc->num_charger_regulators < 1) { in charger_manager_probe()
1477 if (!desc->psy_charger_stat || !desc->psy_charger_stat[0]) { in charger_manager_probe()
1482 if (!desc->psy_fuel_gauge) { in charger_manager_probe()
1488 for (i = 0; desc->psy_charger_stat[i]; i++) { in charger_manager_probe()
1491 psy = power_supply_get_by_name(desc->psy_charger_stat[i]); in charger_manager_probe()
1494 desc->psy_charger_stat[i]); in charger_manager_probe()
1500 if (cm->desc->polling_mode != CM_POLL_DISABLE && in charger_manager_probe()
1501 (desc->polling_interval_ms == 0 || in charger_manager_probe()
1502 msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL)) { in charger_manager_probe()
1507 if (!desc->charging_max_duration_ms || in charger_manager_probe()
1508 !desc->discharging_max_duration_ms) { in charger_manager_probe()
1510 desc->charging_max_duration_ms = 0; in charger_manager_probe()
1511 desc->discharging_max_duration_ms = 0; in charger_manager_probe()
1518 if (!desc->psy_name) in charger_manager_probe()
1521 strncpy(cm->psy_name_buf, desc->psy_name, PSY_NAME_MAX); in charger_manager_probe()
1538 fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); in charger_manager_probe()
1541 desc->psy_fuel_gauge); in charger_manager_probe()
1567 cm->desc->measure_battery_temp = false; in charger_manager_probe()
1581 psy_cfg.attr_grp = desc->sysfs_groups; in charger_manager_probe()
1623 for (i = 0; i < desc->num_charger_regulators; i++) in charger_manager_probe()
1624 regulator_put(desc->charger_regulators[i].consumer); in charger_manager_probe()
1634 struct charger_desc *desc = cm->desc; in charger_manager_remove() local
1645 for (i = 0 ; i < desc->num_charger_regulators ; i++) in charger_manager_remove()
1646 regulator_put(desc->charger_regulators[i].consumer); in charger_manager_remove()