Lines Matching +full:milli +full:- +full:ohm
1 // SPDX-License-Identifier: GPL-2.0-only
3 * 1-wire client/driver for the Maxim/Dallas DS2781 Stand-Alone Fuel Gauge IC
21 /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
23 /* Charge unit measurement in uAh for a 1 milli-ohm sense resistor */
26 #define DS2781_USER_EEPROM_SIZE (DS2781_EEPROM_BLOCK0_END - \
29 #define DS2781_PARAM_EEPROM_SIZE (DS2781_EEPROM_BLOCK1_END - \
56 return w1_ds2781_io(dev_info->w1_dev, buf, addr, count, io); in ds2781_battery_io()
112 ret = ds2781_store_eeprom(dev_info->w1_dev, reg); in ds2781_save_eeprom()
116 ret = ds2781_recall_eeprom(dev_info->w1_dev, reg); in ds2781_save_eeprom()
173 * Bits 9 - 3 of the voltage value are in bits 6 - 0 of the in ds2781_get_voltage()
175 * Bits 2 - 0 of the voltage value are in bits 7 - 5 of the in ds2781_get_voltage()
203 * Bits 9 - 3 of the temperature value are in bits 6 - 0 of the in ds2781_get_temperature()
205 * Bits 2 - 0 of the temperature value are in bits 7 - 5 of the in ds2781_get_temperature()
231 dev_err(dev_info->dev, "sense resistor value is 0\n"); in ds2781_get_current()
232 return -EINVAL; in ds2781_get_current()
241 return -EINVAL; in ds2781_get_current()
247 * Bits 14 - 8 of the current value are in bits 6 - 0 of the current in ds2781_get_current()
249 * Bits 7 - 0 of the current value are in bits 7 - 0 of the current in ds2781_get_current()
276 dev_err(dev_info->dev, "sense resistor value is 0\n"); in ds2781_get_accumulated_current()
277 return -EINVAL; in ds2781_get_accumulated_current()
284 * Bits 15 - 8 of the ACR value are in bits 7 - 0 of the ACR in ds2781_get_accumulated_current()
286 * Bits 7 - 0 of the ACR value are in bits 7 - 0 of the ACR in ds2781_get_accumulated_current()
323 if (power_supply_am_i_supplied(dev_info->bat)) { in ds2781_get_status()
345 * Bits 15 - 8 of the RAAC value are in bits 7 - 0 of the RAAC in ds2781_get_charge_now()
347 * Bits 7 - 0 of the RAAC value are in bits 7 - 0 of the RAAC in ds2781_get_charge_now()
386 ret = ds2781_get_voltage(dev_info, &val->intval); in ds2781_battery_get_property()
390 ret = ds2781_get_temperature(dev_info, &val->intval); in ds2781_battery_get_property()
394 val->strval = model; in ds2781_battery_get_property()
398 val->strval = manufacturer; in ds2781_battery_get_property()
402 ret = ds2781_get_current(dev_info, CURRENT_NOW, &val->intval); in ds2781_battery_get_property()
406 ret = ds2781_get_current(dev_info, CURRENT_AVG, &val->intval); in ds2781_battery_get_property()
410 ret = ds2781_get_status(dev_info, &val->intval); in ds2781_battery_get_property()
414 ret = ds2781_get_capacity(dev_info, &val->intval); in ds2781_battery_get_property()
418 ret = ds2781_get_accumulated_current(dev_info, &val->intval); in ds2781_battery_get_property()
422 ret = ds2781_get_charge_now(dev_info, &val->intval); in ds2781_battery_get_property()
426 ret = -EINVAL; in ds2781_battery_get_property()
483 dev_err(dev_info->dev, "Invalid pmod setting (0 or 1)\n"); in ds2781_set_pmod_enabled()
484 return -EINVAL; in ds2781_set_pmod_enabled()
569 dev_err(dev_info->dev, "Invalid rsgain setting (0 - 1999)\n"); in ds2781_set_rsgain_setting()
570 return -EINVAL; in ds2781_set_rsgain_setting()
612 dev_err(dev_info->dev, "Invalid pio_pin setting (0 or 1)\n"); in ds2781_set_pio_pin()
613 return -EINVAL; in ds2781_set_pio_pin()
754 dev_info = devm_kzalloc(&pdev->dev, sizeof(*dev_info), GFP_KERNEL); in ds2781_battery_probe()
756 return -ENOMEM; in ds2781_battery_probe()
760 dev_info->dev = &pdev->dev; in ds2781_battery_probe()
761 dev_info->w1_dev = pdev->dev.parent; in ds2781_battery_probe()
762 dev_info->bat_desc.name = dev_name(&pdev->dev); in ds2781_battery_probe()
763 dev_info->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY; in ds2781_battery_probe()
764 dev_info->bat_desc.properties = ds2781_battery_props; in ds2781_battery_probe()
765 dev_info->bat_desc.num_properties = ARRAY_SIZE(ds2781_battery_props); in ds2781_battery_probe()
766 dev_info->bat_desc.get_property = ds2781_battery_get_property; in ds2781_battery_probe()
771 dev_info->bat = devm_power_supply_register(&pdev->dev, in ds2781_battery_probe()
772 &dev_info->bat_desc, in ds2781_battery_probe()
774 if (IS_ERR(dev_info->bat)) { in ds2781_battery_probe()
775 dev_err(dev_info->dev, "failed to register battery\n"); in ds2781_battery_probe()
776 return PTR_ERR(dev_info->bat); in ds2781_battery_probe()
784 .name = "ds2781-battery",
792 MODULE_DESCRIPTION("Maxim/Dallas DS2781 Stand-Alone Fuel Gauge IC driver");
793 MODULE_ALIAS("platform:ds2781-battery");