Lines Matching +full:- +full:eu
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (C) 2009, Bollore telecom (www.bolloretelecom.eu).
10 * Adrien Demarez <adrien.demarez@bolloretelecom.eu>
11 * Jeremy Laine <jeremy.laine@bolloretelecom.eu>
19 #include <linux/hwmon-sysfs.h>
35 #define LM73_ID 0x9001 /* 0x0190, byte-swapped */
37 #define LM73_TEMP_MIN (-256000 / 250)
48 14, /* 11-bits (0.25000 C/LSB): RES1 Bit = 0, RES0 Bit = 0 */
49 28, /* 12-bits (0.12500 C/LSB): RES1 Bit = 0, RES0 Bit = 1 */
50 56, /* 13-bits (0.06250 C/LSB): RES1 Bit = 1, RES0 Bit = 0 */
51 112, /* 14-bits (0.03125 C/LSB): RES1 Bit = 1, RES0 Bit = 1 */
60 /*-----------------------------------------------------------------------*/
77 err = i2c_smbus_write_word_swapped(data->client, attr->index, value); in temp_store()
88 s32 err = i2c_smbus_read_word_swapped(data->client, attr->index); in temp_show()
112 * res is already initialized, and everything past the second-to-last in convrate_store()
116 while (res < (ARRAY_SIZE(lm73_convrates) - 1) && in convrate_store()
120 mutex_lock(&data->lock); in convrate_store()
121 data->ctrl &= LM73_CTRL_TO_MASK; in convrate_store()
122 data->ctrl |= res << LM73_CTRL_RES_SHIFT; in convrate_store()
123 err = i2c_smbus_write_byte_data(data->client, LM73_REG_CTRL, in convrate_store()
124 data->ctrl); in convrate_store()
125 mutex_unlock(&data->lock); in convrate_store()
139 res = (data->ctrl & LM73_CTRL_RES_MASK) >> LM73_CTRL_RES_SHIFT; in convrate_show()
150 mutex_lock(&data->lock); in maxmin_alarm_show()
151 ctrl = i2c_smbus_read_byte_data(data->client, LM73_REG_CTRL); in maxmin_alarm_show()
154 data->ctrl = ctrl; in maxmin_alarm_show()
155 mutex_unlock(&data->lock); in maxmin_alarm_show()
157 return sysfs_emit(buf, "%d\n", (ctrl >> attr->index) & 1); in maxmin_alarm_show()
160 mutex_unlock(&data->lock); in maxmin_alarm_show()
164 /*-----------------------------------------------------------------------*/
188 /*-----------------------------------------------------------------------*/
195 struct device *dev = &client->dev; in lm73_probe()
202 return -ENOMEM; in lm73_probe()
204 data->client = client; in lm73_probe()
205 mutex_init(&data->lock); in lm73_probe()
210 data->ctrl = ctrl; in lm73_probe()
212 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, in lm73_probe()
217 dev_info(dev, "sensor '%s'\n", client->name); in lm73_probe()
228 /* Return 0 if detection is successful, -ENODEV otherwise */
232 struct i2c_adapter *adapter = new_client->adapter; in lm73_detect()
237 return -ENODEV; in lm73_detect()
245 return -ENODEV; in lm73_detect()
249 return -ENODEV; in lm73_detect()
253 return -ENODEV; in lm73_detect()
258 return -ENODEV; in lm73_detect()
260 strscpy(info->type, "lm73", I2C_NAME_SIZE); in lm73_detect()