Lines Matching +full:operating +full:- +full:range +full:- +full:celsius
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/hwmon-sysfs.h>
105 #define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */
131 err = regmap_read(data->regmap, TEMPERATURE, ®val); in tps23861_read_temp()
135 *val = (regval * TEMPERATURE_LSB) - 20000; in tps23861_read_temp()
148 err = regmap_bulk_read(data->regmap, in tps23861_read_voltage()
152 err = regmap_bulk_read(data->regmap, in tps23861_read_voltage()
173 if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT) in tps23861_read_current()
178 err = regmap_bulk_read(data->regmap, in tps23861_read_current()
196 err = regmap_write(data->regmap, POWER_ENABLE, regval); in tps23861_port_disable()
208 err = regmap_write(data->regmap, DETECT_CLASS_RESTART, regval); in tps23861_port_enable()
263 err = -EINVAL; in tps23861_write()
266 return -EOPNOTSUPP; in tps23861_write()
270 return -EOPNOTSUPP; in tps23861_write()
289 return -EOPNOTSUPP; in tps23861_read()
298 return -EOPNOTSUPP; in tps23861_read()
307 return -EOPNOTSUPP; in tps23861_read()
311 return -EOPNOTSUPP; in tps23861_read()
338 return -EOPNOTSUPP; in tps23861_read_string()
388 return "Semi-Auto"; in port_operating_mode_string()
420 return "Valid capacitance, outside of legacy range"; in port_detect_status_string()
463 regmap_bulk_read(data->regmap, in tps23861_port_resistance()
483 struct tps23861_data *priv = s->private; in tps23861_port_status_show()
486 regmap_read(priv->regmap, OPERATING_MODE, &mode); in tps23861_port_status_show()
487 regmap_read(priv->regmap, POE_PLUS, &poe_plus); in tps23861_port_status_show()
490 regmap_read(priv->regmap, PORT_1_STATUS + i, &status); in tps23861_port_status_show()
493 seq_printf(s, "Operating mode: %s\n", port_operating_mode_string(mode, i)); in tps23861_port_status_show()
511 debugfs_name = devm_kasprintf(&data->client->dev, GFP_KERNEL, "%s-%s", in tps23861_init_debugfs()
512 data->client->name, dev_name(hwmon_dev)); in tps23861_init_debugfs()
516 data->debugfs_dir = debugfs_create_dir(debugfs_name, NULL); in tps23861_init_debugfs()
520 data->debugfs_dir, in tps23861_init_debugfs()
527 struct device *dev = &client->dev; in tps23861_probe()
534 return -ENOMEM; in tps23861_probe()
536 data->client = client; in tps23861_probe()
539 data->regmap = devm_regmap_init_i2c(client, &tps23861_regmap_config); in tps23861_probe()
540 if (IS_ERR(data->regmap)) { in tps23861_probe()
542 return PTR_ERR(data->regmap); in tps23861_probe()
545 if (!of_property_read_u32(dev->of_node, "shunt-resistor-micro-ohms", &shunt_resistor)) in tps23861_probe()
546 data->shunt_resistor = shunt_resistor; in tps23861_probe()
548 data->shunt_resistor = SHUNT_RESISTOR_DEFAULT; in tps23861_probe()
550 if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT) in tps23861_probe()
551 regmap_clear_bits(data->regmap, in tps23861_probe()
555 regmap_set_bits(data->regmap, in tps23861_probe()
559 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, in tps23861_probe()
574 debugfs_remove_recursive(data->debugfs_dir); in tps23861_remove()