Lines Matching +full:ilim +full:- +full:ma
1 // SPDX-License-Identifier: GPL-2.0-only
82 #define ADP5061_ICHG_MAX 1300 // mA
154 return i-1; in adp5061_get_array_index()
164 ret = regmap_bulk_read(st->regmap, ADP5061_CHG_STATUS_1, in adp5061_get_status()
181 ret = regmap_read(st->regmap, ADP5061_VINX_SET, ®val); in adp5061_get_input_current_limit()
186 val->intval = adp5061_in_current_lim[mode] * 1000; in adp5061_get_input_current_limit()
195 /* Convert from uA to mA */ in adp5061_set_input_current_limit()
203 return regmap_update_bits(st->regmap, ADP5061_VINX_SET, in adp5061_set_input_current_limit()
220 return regmap_update_bits(st->regmap, ADP5061_VOLTAGE_TH, in adp5061_set_min_voltage()
231 ret = regmap_read(st->regmap, ADP5061_VOLTAGE_TH, ®val); in adp5061_get_min_voltage()
236 val->intval = adp5061_vmin[regval] * 1000; in adp5061_get_min_voltage()
247 ret = regmap_read(st->regmap, ADP5061_TERM_SET, ®val); in adp5061_get_chg_volt_lim()
252 val->intval = adp5061_const_chg_vmax[mode] * 1000; in adp5061_get_chg_volt_lim()
263 ret = regmap_read(st->regmap, ADP5061_TERM_SET, ®val); in adp5061_get_max_voltage()
267 regval = ((regval & ADP5061_TERM_SET_VTRM_MSK) >> 2) - 0x0F; in adp5061_get_max_voltage()
269 regval = ARRAY_SIZE(adp5061_vmax) - 1; in adp5061_get_max_voltage()
271 val->intval = adp5061_vmax[regval] * 1000; in adp5061_get_max_voltage()
292 return regmap_update_bits(st->regmap, ADP5061_TERM_SET, in adp5061_set_max_voltage()
309 return regmap_update_bits(st->regmap, ADP5061_TERM_SET, in adp5061_set_const_chg_vmax()
319 /* Convert from uA to mA */ in adp5061_set_const_chg_current()
330 return regmap_update_bits(st->regmap, ADP5061_CHG_CURR, in adp5061_set_const_chg_current()
341 ret = regmap_read(st->regmap, ADP5061_CHG_CURR, ®val); in adp5061_get_const_chg_current()
347 regval = ARRAY_SIZE(adp5061_const_ichg) - 1; in adp5061_get_const_chg_current()
349 val->intval = adp5061_const_ichg[regval] * 1000; in adp5061_get_const_chg_current()
360 ret = regmap_read(st->regmap, ADP5061_CHG_CURR, ®val); in adp5061_get_prechg_current()
365 val->intval = adp5061_prechg_current[regval] * 1000; in adp5061_get_prechg_current()
374 /* Convert from uA to mA */ in adp5061_set_prechg_current()
382 return regmap_update_bits(st->regmap, ADP5061_CHG_CURR, in adp5061_set_prechg_current()
393 ret = regmap_read(st->regmap, ADP5061_VOLTAGE_TH, ®val); in adp5061_get_vweak_th()
398 val->intval = adp5061_vweak_th[regval] * 1000; in adp5061_get_vweak_th()
415 return regmap_update_bits(st->regmap, ADP5061_VOLTAGE_TH, in adp5061_set_vweak_th()
432 val->intval = POWER_SUPPLY_STATUS_UNKNOWN; in adp5061_get_chg_type()
434 val->intval = adp5061_chg_type[chg_type]; in adp5061_get_chg_type()
451 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; in adp5061_get_charger_status()
456 val->intval = POWER_SUPPLY_STATUS_CHARGING; in adp5061_get_charger_status()
459 val->intval = POWER_SUPPLY_STATUS_FULL; in adp5061_get_charger_status()
463 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; in adp5061_get_charger_status()
466 val->intval = POWER_SUPPLY_STATUS_UNKNOWN; in adp5061_get_charger_status()
485 val->intval = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; in adp5061_get_battery_status()
488 val->intval = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; in adp5061_get_battery_status()
491 val->intval = POWER_SUPPLY_CAPACITY_LEVEL_LOW; in adp5061_get_battery_status()
494 val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; in adp5061_get_battery_status()
497 val->intval = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; in adp5061_get_battery_status()
510 ret = regmap_read(st->regmap, ADP5061_IEND, ®val); in adp5061_get_termination_current()
515 val->intval = adp5061_iend[regval]; in adp5061_get_termination_current()
530 return regmap_update_bits(st->regmap, ADP5061_IEND, in adp5061_set_termination_current()
551 val->intval = 0; in adp5061_get_property()
553 val->intval = 1; in adp5061_get_property()
559 * limit into VINx (ILIM) in adp5061_get_property()
613 return -EINVAL; in adp5061_get_property()
627 return adp5061_set_input_current_limit(st, val->intval); in adp5061_set_property()
629 return adp5061_set_max_voltage(st, val->intval); in adp5061_set_property()
631 return adp5061_set_min_voltage(st, val->intval); in adp5061_set_property()
633 return adp5061_set_const_chg_vmax(st, val->intval); in adp5061_set_property()
635 return adp5061_set_const_chg_current(st, val->intval); in adp5061_set_property()
637 return adp5061_set_prechg_current(st, val->intval); in adp5061_set_property()
639 return adp5061_set_vweak_th(st, val->intval); in adp5061_set_property()
641 return adp5061_set_termination_current(st, val->intval); in adp5061_set_property()
643 return -EINVAL; in adp5061_set_property()
702 st = devm_kzalloc(&client->dev, sizeof(*st), GFP_KERNEL); in adp5061_probe()
704 return -ENOMEM; in adp5061_probe()
706 st->client = client; in adp5061_probe()
707 st->regmap = devm_regmap_init_i2c(client, in adp5061_probe()
709 if (IS_ERR(st->regmap)) { in adp5061_probe()
710 dev_err(&client->dev, "Failed to initialize register map\n"); in adp5061_probe()
711 return -EINVAL; in adp5061_probe()
717 st->psy = devm_power_supply_register(&client->dev, in adp5061_probe()
721 if (IS_ERR(st->psy)) { in adp5061_probe()
722 dev_err(&client->dev, "Failed to register power supply\n"); in adp5061_probe()
723 return PTR_ERR(st->psy); in adp5061_probe()