Lines Matching +full:fuel +full:- +full:gauge

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Fuel gauge driver for Richtek RT5033
14 #include <linux/mfd/rt5033-private.h>
28 ret = power_supply_get_property_from_supplier(battery->psy, in rt5033_battery_get_status()
42 regmap_read(battery->regmap, RT5033_FUEL_REG_SOC_H, &msb); in rt5033_battery_get_capacity()
52 regmap_read(battery->regmap, RT5033_FUEL_REG_CONFIG_L, &val); in rt5033_battery_get_present()
79 return -EINVAL; in rt5033_battery_get_watt_prop()
82 regmap_read(battery->regmap, regh, &msb); in rt5033_battery_get_watt_prop()
83 regmap_read(battery->regmap, regl, &lsb); in rt5033_battery_get_watt_prop()
100 val->intval = rt5033_battery_get_watt_prop(battery->client, in rt5033_battery_get_property()
104 val->intval = rt5033_battery_get_present(battery->client); in rt5033_battery_get_property()
107 val->intval = rt5033_battery_get_capacity(battery->client); in rt5033_battery_get_property()
110 val->intval = rt5033_battery_get_status(battery->client); in rt5033_battery_get_property()
113 return -EINVAL; in rt5033_battery_get_property()
134 .name = "rt5033-battery",
143 struct i2c_adapter *adapter = client->adapter; in rt5033_battery_probe()
148 return -EIO; in rt5033_battery_probe()
150 battery = devm_kzalloc(&client->dev, sizeof(*battery), GFP_KERNEL); in rt5033_battery_probe()
152 return -ENOMEM; in rt5033_battery_probe()
154 battery->client = client; in rt5033_battery_probe()
155 battery->regmap = devm_regmap_init_i2c(client, in rt5033_battery_probe()
157 if (IS_ERR(battery->regmap)) { in rt5033_battery_probe()
158 dev_err(&client->dev, "Failed to initialize regmap\n"); in rt5033_battery_probe()
159 return -EINVAL; in rt5033_battery_probe()
163 psy_cfg.of_node = client->dev.of_node; in rt5033_battery_probe()
166 battery->psy = devm_power_supply_register(&client->dev, in rt5033_battery_probe()
169 if (IS_ERR(battery->psy)) in rt5033_battery_probe()
170 return dev_err_probe(&client->dev, PTR_ERR(battery->psy), in rt5033_battery_probe()
177 { "rt5033-battery", },
183 { .compatible = "richtek,rt5033-battery", },
190 .name = "rt5033-battery",
198 MODULE_DESCRIPTION("Richtek RT5033 fuel gauge driver");