Lines Matching +full:thermal +full:- +full:diode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * emc1403.c - SMSC Thermal Driver
17 #include <linux/hwmon-sysfs.h>
43 retval = regmap_read(data->regmap, sda->index, &val); in temp_show()
57 retval = regmap_read(data->regmap, sda->nr, &val); in bit_show()
60 return sprintf(buf, "%d\n", !!(val & sda->index)); in bit_show()
72 return -EINVAL; in temp_store()
73 retval = regmap_write(data->regmap, sda->index, in temp_store()
89 return -EINVAL; in bit_store()
91 retval = regmap_update_bits(data->regmap, sda->nr, sda->index, in bit_store()
92 val ? sda->index : 0); in bit_store()
104 struct regmap *regmap = data->regmap; in show_hyst_common()
109 retval = regmap_read(regmap, sda->index, &limit); in show_hyst_common()
117 return sprintf(buf, "%d000\n", is_min ? limit + hyst : limit - hyst); in show_hyst_common()
137 struct regmap *regmap = data->regmap; in hyst_store()
144 return -EINVAL; in hyst_store()
146 mutex_lock(&data->mutex); in hyst_store()
147 retval = regmap_read(regmap, sda->index, &limit); in hyst_store()
151 hyst = limit * 1000 - val; in hyst_store()
157 mutex_unlock(&data->mutex); in hyst_store()
290 * Since we can not re-use the same attribute names, create a separate attribute
323 /* Check if thermal chip is SMSC and EMC1403 or EMC1423 */ in emc1403_detect()
327 return -ENODEV; in emc1403_detect()
332 strlcpy(info->type, "emc1402", I2C_NAME_SIZE); in emc1403_detect()
335 strlcpy(info->type, "emc1403", I2C_NAME_SIZE); in emc1403_detect()
338 strlcpy(info->type, "emc1422", I2C_NAME_SIZE); in emc1403_detect()
341 strlcpy(info->type, "emc1423", I2C_NAME_SIZE); in emc1403_detect()
344 strlcpy(info->type, "emc1404", I2C_NAME_SIZE); in emc1403_detect()
347 strlcpy(info->type, "emc1424", I2C_NAME_SIZE); in emc1403_detect()
350 return -ENODEV; in emc1403_detect()
355 return -ENODEV; in emc1403_detect()
363 case 0x00: /* internal diode high byte */ in emc1403_regmap_is_volatile()
364 case 0x01: /* external diode 1 high byte */ in emc1403_regmap_is_volatile()
366 case 0x10: /* external diode 1 low byte */ in emc1403_regmap_is_volatile()
367 case 0x1b: /* external diode fault */ in emc1403_regmap_is_volatile()
368 case 0x23: /* external diode 2 high byte */ in emc1403_regmap_is_volatile()
369 case 0x24: /* external diode 2 low byte */ in emc1403_regmap_is_volatile()
370 case 0x29: /* internal diode low byte */ in emc1403_regmap_is_volatile()
371 case 0x2a: /* externl diode 3 high byte */ in emc1403_regmap_is_volatile()
372 case 0x2b: /* external diode 3 low byte */ in emc1403_regmap_is_volatile()
397 data = devm_kzalloc(&client->dev, sizeof(struct thermal_data), in emc1403_probe()
400 return -ENOMEM; in emc1403_probe()
402 data->regmap = devm_regmap_init_i2c(client, &emc1403_regmap_config); in emc1403_probe()
403 if (IS_ERR(data->regmap)) in emc1403_probe()
404 return PTR_ERR(data->regmap); in emc1403_probe()
406 mutex_init(&data->mutex); in emc1403_probe()
408 switch (id->driver_data) { in emc1403_probe()
410 data->groups[2] = &emc1404_group; in emc1403_probe()
413 data->groups[1] = &emc1403_group; in emc1403_probe()
416 data->groups[0] = &emc1402_group; in emc1403_probe()
419 if (id->driver_data == emc1402) in emc1403_probe()
420 data->groups[1] = &emc1402_alarm_group; in emc1403_probe()
422 hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, in emc1403_probe()
423 client->name, data, in emc1403_probe()
424 data->groups); in emc1403_probe()
428 dev_info(&client->dev, "%s Thermal chip found\n", id->name); in emc1403_probe()
465 MODULE_DESCRIPTION("emc1403 Thermal Driver");