Lines Matching +full:no +full:- +full:temp +full:- +full:support

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ds620.c - Support for temperature sensor and thermostat DS620
16 #include <linux/hwmon-sysfs.h>
52 #define DS620_COM_START 0x51 /* no data */
53 #define DS620_COM_STOP 0x22 /* no data */
62 s16 temp[3]; /* Register values, word */ member
67 struct ds620_platform_data *ds620_info = dev_get_platdata(&client->dev); in ds620_init_client()
75 /* already high at power-on, but don't trust the BIOS! */ in ds620_init_client()
78 if (ds620_info && ds620_info->pomode == 1) in ds620_init_client()
80 else if (ds620_info && ds620_info->pomode == 2) in ds620_init_client()
97 struct i2c_client *client = data->client; in ds620_update_client()
100 mutex_lock(&data->update_lock); in ds620_update_client()
102 if (time_after(jiffies, data->last_updated + HZ + HZ / 2) in ds620_update_client()
103 || !data->valid) { in ds620_update_client()
107 dev_dbg(&client->dev, "Starting ds620 update\n"); in ds620_update_client()
109 for (i = 0; i < ARRAY_SIZE(data->temp); i++) { in ds620_update_client()
117 data->temp[i] = res; in ds620_update_client()
120 data->last_updated = jiffies; in ds620_update_client()
121 data->valid = true; in ds620_update_client()
124 mutex_unlock(&data->update_lock); in ds620_update_client()
138 return sprintf(buf, "%d\n", ((data->temp[attr->index] / 8) * 625) / 10); in temp_show()
149 struct i2c_client *client = data->client; in temp_store()
156 val = (clamp_val(val, -128000, 128000) * 10 / 625) * 8; in temp_store()
158 mutex_lock(&data->update_lock); in temp_store()
159 data->temp[attr->index] = val; in temp_store()
160 i2c_smbus_write_word_swapped(client, DS620_REG_TEMP[attr->index], in temp_store()
161 data->temp[attr->index]); in temp_store()
162 mutex_unlock(&data->update_lock); in temp_store()
178 client = data->client; in alarm_show()
186 new_conf &= ~attr->index; in alarm_show()
194 return sprintf(buf, "%d\n", !!(conf & attr->index)); in alarm_show()
197 static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
198 static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1);
199 static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
216 struct device *dev = &client->dev; in ds620_probe()
222 return -ENOMEM; in ds620_probe()
224 data->client = client; in ds620_probe()
225 mutex_init(&data->update_lock); in ds620_probe()
230 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, in ds620_probe()