Lines Matching +full:current +full:- +full:sense +full:- +full:shunt
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright 2015-2019 Analog Devices Inc.
27 * struct adm1177_state - driver instance specific data
29 * @r_sense_uohm: current sense resistor value
30 * @alert_threshold_ua: current limit for shutdown
42 return i2c_master_recv(st->client, data, num); in adm1177_read_raw()
47 return i2c_smbus_write_byte(st->client, cmd); in adm1177_write_cmd()
56 val = 0xFFULL * alert_threshold_ua * st->r_sense_uohm; in adm1177_write_alert_thr()
62 ret = i2c_smbus_write_byte_data(st->client, ADM1177_REG_ALERT_TH, in adm1177_write_alert_thr()
67 st->alert_threshold_ua = alert_threshold_ua; in adm1177_write_alert_thr()
92 4096 * st->r_sense_uohm); in adm1177_read()
95 *val = st->alert_threshold_ua; in adm1177_read()
98 return -EOPNOTSUPP; in adm1177_read()
109 if (st->vrange_high) in adm1177_read()
117 return -EOPNOTSUPP; in adm1177_read()
133 return -EOPNOTSUPP; in adm1177_write()
136 return -EOPNOTSUPP; in adm1177_write()
156 if (st->r_sense_uohm) in adm1177_is_visible()
160 if (st->r_sense_uohm) in adm1177_is_visible()
192 struct device *dev = &client->dev; in adm1177_probe()
200 return -ENOMEM; in adm1177_probe()
202 st->client = client; in adm1177_probe()
204 ret = devm_regulator_get_enable_optional(&client->dev, "vref"); in adm1177_probe()
205 if (ret == -EPROBE_DEFER) in adm1177_probe()
206 return -EPROBE_DEFER; in adm1177_probe()
208 if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", in adm1177_probe()
209 &st->r_sense_uohm)) in adm1177_probe()
210 st->r_sense_uohm = 0; in adm1177_probe()
211 if (device_property_read_u32(dev, "adi,shutdown-threshold-microamp", in adm1177_probe()
213 if (st->r_sense_uohm) in adm1177_probe()
216 * shunt-resistor in adm1177_probe()
219 st->r_sense_uohm); in adm1177_probe()
223 st->vrange_high = device_property_read_bool(dev, in adm1177_probe()
224 "adi,vrange-high-enable"); in adm1177_probe()
225 if (alert_threshold_ua && st->r_sense_uohm) in adm1177_probe()
230 (st->vrange_high ? 0 : ADM1177_CMD_VRANGE)); in adm1177_probe()
235 devm_hwmon_device_register_with_info(dev, client->name, st, in adm1177_probe()