Lines Matching +full:gain +full:- +full:milli

1 // SPDX-License-Identifier: GPL-2.0-only
3 * 1-wire client/driver for the Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC
7 * Author: Clifton Barnes <cabarnes@indesign-llc.com>
23 /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
25 /* Charge unit measurement in uAh for a 1 milli-ohm sense resistor */
28 #define DS2780_USER_EEPROM_SIZE (DS2780_EEPROM_BLOCK0_END - \
31 #define DS2780_PARAM_EEPROM_SIZE (DS2780_EEPROM_BLOCK1_END - \
58 return w1_ds2780_io(dev_info->w1_dev, buf, addr, count, io); in ds2780_battery_io()
108 ret = ds2780_store_eeprom(dev_info->w1_dev, reg); in ds2780_save_eeprom()
112 ret = ds2780_recall_eeprom(dev_info->w1_dev, reg); in ds2780_save_eeprom()
165 * Bits 9 - 3 of the voltage value are in bits 6 - 0 of the in ds2780_get_voltage()
167 * Bits 2 - 0 of the voltage value are in bits 7 - 5 of the in ds2780_get_voltage()
194 * Bits 9 - 3 of the temperature value are in bits 6 - 0 of the in ds2780_get_temperature()
196 * Bits 2 - 0 of the temperature value are in bits 7 - 5 of the in ds2780_get_temperature()
230 dev_err(dev_info->dev, "sense resistor value is 0\n"); in ds2780_get_current()
231 return -EINVAL; in ds2780_get_current()
240 return -EINVAL; in ds2780_get_current()
246 * Bits 14 - 8 of the current value are in bits 6 - 0 of the current in ds2780_get_current()
248 * Bits 7 - 0 of the current value are in bits 7 - 0 of the current in ds2780_get_current()
275 dev_err(dev_info->dev, "sense resistor value is 0\n"); in ds2780_get_accumulated_current()
276 return -ENXIO; in ds2780_get_accumulated_current()
283 * Bits 15 - 8 of the ACR value are in bits 7 - 0 of the ACR in ds2780_get_accumulated_current()
285 * Bits 7 - 0 of the ACR value are in bits 7 - 0 of the ACR in ds2780_get_accumulated_current()
343 * Bits 15 - 8 of the RAAC value are in bits 7 - 0 of the RAAC in ds2780_get_charge_now()
345 * Bits 7 - 0 of the RAAC value are in bits 7 - 0 of the RAAC in ds2780_get_charge_now()
384 ret = ds2780_get_voltage(dev_info, &val->intval); in ds2780_battery_get_property()
388 ret = ds2780_get_temperature(dev_info, &val->intval); in ds2780_battery_get_property()
392 val->strval = model; in ds2780_battery_get_property()
396 val->strval = manufacturer; in ds2780_battery_get_property()
400 ret = ds2780_get_current(dev_info, CURRENT_NOW, &val->intval); in ds2780_battery_get_property()
404 ret = ds2780_get_current(dev_info, CURRENT_AVG, &val->intval); in ds2780_battery_get_property()
408 ret = ds2780_get_status(dev_info, &val->intval); in ds2780_battery_get_property()
412 ret = ds2780_get_capacity(dev_info, &val->intval); in ds2780_battery_get_property()
416 ret = ds2780_get_accumulated_current(dev_info, &val->intval); in ds2780_battery_get_property()
420 ret = ds2780_get_charge_now(dev_info, &val->intval); in ds2780_battery_get_property()
424 ret = -EINVAL; in ds2780_battery_get_property()
481 dev_err(dev_info->dev, "Invalid pmod setting (0 or 1)\n"); in ds2780_set_pmod_enabled()
482 return -EINVAL; in ds2780_set_pmod_enabled()
565 /* Gain can only be from 0 to 1.999 in steps of .001 */ in ds2780_set_rsgain_setting()
567 dev_err(dev_info->dev, "Invalid rsgain setting (0 - 1999)\n"); in ds2780_set_rsgain_setting()
568 return -EINVAL; in ds2780_set_rsgain_setting()
610 dev_err(dev_info->dev, "Invalid pio_pin setting (0 or 1)\n"); in ds2780_set_pio_pin()
611 return -EINVAL; in ds2780_set_pio_pin()
750 dev_info = devm_kzalloc(&pdev->dev, sizeof(*dev_info), GFP_KERNEL); in ds2780_battery_probe()
752 return -ENOMEM; in ds2780_battery_probe()
756 dev_info->dev = &pdev->dev; in ds2780_battery_probe()
757 dev_info->w1_dev = pdev->dev.parent; in ds2780_battery_probe()
758 dev_info->bat_desc.name = dev_name(&pdev->dev); in ds2780_battery_probe()
759 dev_info->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY; in ds2780_battery_probe()
760 dev_info->bat_desc.properties = ds2780_battery_props; in ds2780_battery_probe()
761 dev_info->bat_desc.num_properties = ARRAY_SIZE(ds2780_battery_props); in ds2780_battery_probe()
762 dev_info->bat_desc.get_property = ds2780_battery_get_property; in ds2780_battery_probe()
767 dev_info->bat = devm_power_supply_register(&pdev->dev, in ds2780_battery_probe()
768 &dev_info->bat_desc, in ds2780_battery_probe()
770 if (IS_ERR(dev_info->bat)) { in ds2780_battery_probe()
771 dev_err(dev_info->dev, "failed to register battery\n"); in ds2780_battery_probe()
772 return PTR_ERR(dev_info->bat); in ds2780_battery_probe()
780 .name = "ds2780-battery",
788 MODULE_AUTHOR("Clifton Barnes <cabarnes@indesign-llc.com>");
789 MODULE_DESCRIPTION("Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC driver");
790 MODULE_ALIAS("platform:ds2780-battery");