Lines Matching +full:shunt +full:- +full:resistor +full:- +full:micro +full:- +full:ohms
39 #include <linux/hwmon-sysfs.h>
56 unsigned int shunt; /* in micro ohms */ member
65 struct i2c_client *client = data->client; in ltc4151_update_device()
68 mutex_lock(&data->update_lock); in ltc4151_update_device()
72 * (Conversion Rate 6 - 9 Hz) in ltc4151_update_device()
74 if (time_after(jiffies, data->last_updated + HZ / 6) || !data->valid) { in ltc4151_update_device()
77 dev_dbg(&client->dev, "Starting ltc4151 update\n"); in ltc4151_update_device()
80 for (i = 0; i < ARRAY_SIZE(data->regs); i++) { in ltc4151_update_device()
91 data->regs[i] = val; in ltc4151_update_device()
93 data->last_updated = jiffies; in ltc4151_update_device()
94 data->valid = 1; in ltc4151_update_device()
97 mutex_unlock(&data->update_lock); in ltc4151_update_device()
106 val = (data->regs[reg] << 4) + (data->regs[reg + 1] >> 4); in ltc4151_get_value()
116 * a given sense resistor, in mA. in ltc4151_get_value()
118 val = val * 20 * 1000 / data->shunt; in ltc4151_get_value()
144 value = ltc4151_get_value(data, attr->index); in ltc4151_show_value()
156 /* Currents (via sense resistor) */
177 struct i2c_adapter *adapter = client->adapter; in ltc4151_probe()
178 struct device *dev = &client->dev; in ltc4151_probe()
181 u32 shunt; in ltc4151_probe() local
184 return -ENODEV; in ltc4151_probe()
188 return -ENOMEM; in ltc4151_probe()
190 if (of_property_read_u32(client->dev.of_node, in ltc4151_probe()
191 "shunt-resistor-micro-ohms", &shunt)) in ltc4151_probe()
192 shunt = 1000; /* 1 mOhm if not set via DT */ in ltc4151_probe()
194 if (shunt == 0) in ltc4151_probe()
195 return -EINVAL; in ltc4151_probe()
197 data->shunt = shunt; in ltc4151_probe()
199 data->client = client; in ltc4151_probe()
200 mutex_init(&data->update_lock); in ltc4151_probe()
202 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, in ltc4151_probe()