Lines Matching +full:fuel +full:- +full:gauge
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Fuel gauge driver for Richtek RT5033
12 #include <linux/mfd/rt5033-private.h>
20 regmap_read(battery->regmap, RT5033_FUEL_REG_SOC_H, &msb); in rt5033_battery_get_capacity()
30 regmap_read(battery->regmap, RT5033_FUEL_REG_CONFIG_L, &val); in rt5033_battery_get_present()
57 return -EINVAL; in rt5033_battery_get_watt_prop()
60 regmap_read(battery->regmap, regh, &msb); in rt5033_battery_get_watt_prop()
61 regmap_read(battery->regmap, regl, &lsb); in rt5033_battery_get_watt_prop()
78 val->intval = rt5033_battery_get_watt_prop(battery->client, in rt5033_battery_get_property()
82 val->intval = rt5033_battery_get_present(battery->client); in rt5033_battery_get_property()
85 val->intval = rt5033_battery_get_capacity(battery->client); in rt5033_battery_get_property()
88 return -EINVAL; in rt5033_battery_get_property()
108 .name = "rt5033-battery",
118 struct i2c_adapter *adapter = client->adapter; in rt5033_battery_probe()
124 return -EIO; in rt5033_battery_probe()
126 battery = devm_kzalloc(&client->dev, sizeof(*battery), GFP_KERNEL); in rt5033_battery_probe()
128 return -ENOMEM; in rt5033_battery_probe()
130 battery->client = client; in rt5033_battery_probe()
131 battery->regmap = devm_regmap_init_i2c(client, in rt5033_battery_probe()
133 if (IS_ERR(battery->regmap)) { in rt5033_battery_probe()
134 dev_err(&client->dev, "Failed to initialize regmap\n"); in rt5033_battery_probe()
135 return -EINVAL; in rt5033_battery_probe()
141 battery->psy = power_supply_register(&client->dev, in rt5033_battery_probe()
143 if (IS_ERR(battery->psy)) { in rt5033_battery_probe()
144 dev_err(&client->dev, "Failed to register power supply\n"); in rt5033_battery_probe()
145 ret = PTR_ERR(battery->psy); in rt5033_battery_probe()
156 power_supply_unregister(battery->psy); in rt5033_battery_remove()
162 { "rt5033-battery", },
169 .name = "rt5033-battery",
177 MODULE_DESCRIPTION("Richtek RT5033 fuel gauge driver");