Lines Matching +full:sda +full:- +full:output +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/hwmon-sysfs.h>
34 #define TEMP11_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), -128000, \
46 struct sensor_device_attribute sda; member
91 ret = regmap_read(state->regmap, REG_STATUS, ®val); in max31760_read()
99 ret = regmap_read(state->regmap, REG_STATUS, ®val); in max31760_read()
110 ret = regmap_read(state->regmap, REG_STATUS, ®val); in max31760_read()
130 return -EOPNOTSUPP; in max31760_read()
133 ret = regmap_bulk_read(state->regmap, reg_temp, reg, 2); in max31760_read()
145 ret = regmap_bulk_read(state->regmap, REG_TACH(channel), reg, 2); in max31760_read()
153 ret = regmap_read(state->regmap, REG_STATUS, ®val); in max31760_read()
164 ret = regmap_read(state->regmap, REG_CR3, ®val); in max31760_read()
175 return -EOPNOTSUPP; in max31760_read()
180 ret = regmap_read(state->regmap, REG_PWMV, ®val); in max31760_read()
188 ret = regmap_read(state->regmap, REG_CR1, ®val); in max31760_read()
194 return -EINVAL; in max31760_read()
200 ret = regmap_read(state->regmap, REG_CR2, ®val); in max31760_read()
204 *val = 2 - FIELD_GET(CR2_DFC, regval); in max31760_read()
208 ret = regmap_read(state->regmap, REG_CR1, ®val); in max31760_read()
224 return -EINVAL; in max31760_read()
229 return -EOPNOTSUPP; in max31760_read()
232 return -EOPNOTSUPP; in max31760_read()
255 return -EOPNOTSUPP; in max31760_write()
262 return regmap_bulk_write(state->regmap, reg_temp, reg_val, 2); in max31760_write()
267 return regmap_clear_bits(state->regmap, REG_CR3, BIT(channel)); in max31760_write()
270 return regmap_set_bits(state->regmap, REG_CR3, BIT(channel)); in max31760_write()
272 return -EINVAL; in max31760_write()
274 return -EOPNOTSUPP; in max31760_write()
280 return -EINVAL; in max31760_write()
282 return regmap_write(state->regmap, REG_PWMR, val); in max31760_write()
285 return regmap_set_bits(state->regmap, REG_CR2, CR2_DFC); in max31760_write()
288 return regmap_clear_bits(state->regmap, REG_CR2, CR2_DFC); in max31760_write()
290 return -EINVAL; in max31760_write()
295 return regmap_update_bits(state->regmap, in max31760_write()
309 return -EINVAL; in max31760_write()
312 return regmap_update_bits(state->regmap, REG_CR1, CR1_TEMP_SRC, val); in max31760_write()
314 return -EOPNOTSUPP; in max31760_write()
317 return -EOPNOTSUPP; in max31760_write()
389 return -EOPNOTSUPP; in max31760_read_string()
395 return -EOPNOTSUPP; in max31760_read_string()
414 struct sensor_device_attribute *sda = to_sensor_dev_attr(devattr); in lut_show() local
419 ret = regmap_read(state->regmap, REG_LUT(sda->index), ®val); in lut_show()
430 struct sensor_device_attribute *sda = to_sensor_dev_attr(devattr); in lut_store() local
439 ret = regmap_write(state->regmap, REG_LUT(sda->index), pwm); in lut_store()
454 ret = regmap_read(state->regmap, REG_CR1, ®val); in pwm1_auto_point_temp_hyst_show()
475 ret = regmap_clear_bits(state->regmap, REG_CR1, CR1_HYST); in pwm1_auto_point_temp_hyst_store()
477 ret = regmap_set_bits(state->regmap, REG_CR1, CR1_HYST); in pwm1_auto_point_temp_hyst_store()
490 struct sensor_device_attribute *sda; in max31760_create_lut_nodes() local
494 lut = &state->lut[i]; in max31760_create_lut_nodes()
495 sda = &lut->sda; in max31760_create_lut_nodes()
497 snprintf(lut->name, sizeof(lut->name), in max31760_create_lut_nodes()
500 sda->dev_attr.attr.mode = 0644; in max31760_create_lut_nodes()
501 sda->index = i; in max31760_create_lut_nodes()
502 sda->dev_attr.show = lut_show; in max31760_create_lut_nodes()
503 sda->dev_attr.store = lut_store; in max31760_create_lut_nodes()
504 sda->dev_attr.attr.name = lut->name; in max31760_create_lut_nodes()
506 sysfs_attr_init(&sda->dev_attr.attr); in max31760_create_lut_nodes()
508 state->attrs[i] = &sda->dev_attr.attr; in max31760_create_lut_nodes()
511 state->attrs[i] = &dev_attr_pwm1_auto_point_temp_hyst.attr; in max31760_create_lut_nodes()
513 state->group.attrs = state->attrs; in max31760_create_lut_nodes()
514 state->groups[0] = &state->group; in max31760_create_lut_nodes()
519 struct device *dev = &client->dev; in max31760_probe()
526 return -ENOMEM; in max31760_probe()
528 state->regmap = devm_regmap_init_i2c(client, ®map_config); in max31760_probe()
529 if (IS_ERR(state->regmap)) in max31760_probe()
531 PTR_ERR(state->regmap), in max31760_probe()
536 /* Set alert output to comparator mode */ in max31760_probe()
537 ret = regmap_set_bits(state->regmap, REG_CR2, CR2_ALERTS); in max31760_probe()
543 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, in max31760_probe()
546 state->groups); in max31760_probe()
567 return regmap_set_bits(state->regmap, REG_CR2, CR2_STBY); in max31760_suspend()
574 return regmap_clear_bits(state->regmap, REG_CR2, CR2_STBY); in max31760_resume()