Lines Matching +full:regulator +full:- +full:soft +full:- +full:start

1 // SPDX-License-Identifier: GPL-2.0
3 * ADM1177 Hot Swap Controller and Digital Power Monitor with Soft Start Pin
5 * Copyright 2015-2019 Analog Devices Inc.
14 #include <linux/regulator/consumer.h>
27 * struct adm1177_state - driver instance specific data
29 * @reg regulator info for the the power supply of the device
36 struct regulator *reg;
44 return i2c_master_recv(st->client, data, num); in adm1177_read_raw()
49 return i2c_smbus_write_byte(st->client, cmd); in adm1177_write_cmd()
58 val = 0xFFULL * alert_threshold_ua * st->r_sense_uohm; in adm1177_write_alert_thr()
64 ret = i2c_smbus_write_byte_data(st->client, ADM1177_REG_ALERT_TH, in adm1177_write_alert_thr()
69 st->alert_threshold_ua = alert_threshold_ua; in adm1177_write_alert_thr()
94 4096 * st->r_sense_uohm); in adm1177_read()
97 *val = st->alert_threshold_ua; in adm1177_read()
100 return -EOPNOTSUPP; in adm1177_read()
111 if (st->vrange_high) in adm1177_read()
119 return -EOPNOTSUPP; in adm1177_read()
135 return -EOPNOTSUPP; in adm1177_write()
138 return -EOPNOTSUPP; in adm1177_write()
158 if (st->r_sense_uohm) in adm1177_is_visible()
162 if (st->r_sense_uohm) in adm1177_is_visible()
196 regulator_disable(st->reg); in adm1177_remove()
201 struct device *dev = &client->dev; in adm1177_probe()
209 return -ENOMEM; in adm1177_probe()
211 st->client = client; in adm1177_probe()
213 st->reg = devm_regulator_get_optional(&client->dev, "vref"); in adm1177_probe()
214 if (IS_ERR(st->reg)) { in adm1177_probe()
215 if (PTR_ERR(st->reg) == -EPROBE_DEFER) in adm1177_probe()
216 return -EPROBE_DEFER; in adm1177_probe()
218 st->reg = NULL; in adm1177_probe()
220 ret = regulator_enable(st->reg); in adm1177_probe()
223 ret = devm_add_action_or_reset(&client->dev, adm1177_remove, in adm1177_probe()
229 if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", in adm1177_probe()
230 &st->r_sense_uohm)) in adm1177_probe()
231 st->r_sense_uohm = 0; in adm1177_probe()
232 if (device_property_read_u32(dev, "adi,shutdown-threshold-microamp", in adm1177_probe()
234 if (st->r_sense_uohm) in adm1177_probe()
237 * shunt-resistor in adm1177_probe()
240 st->r_sense_uohm); in adm1177_probe()
244 st->vrange_high = device_property_read_bool(dev, in adm1177_probe()
245 "adi,vrange-high-enable"); in adm1177_probe()
246 if (alert_threshold_ua && st->r_sense_uohm) in adm1177_probe()
251 (st->vrange_high ? 0 : ADM1177_CMD_VRANGE)); in adm1177_probe()
256 devm_hwmon_device_register_with_info(dev, client->name, st, in adm1177_probe()