Lines Matching refs:tmp102

53 struct tmp102 {  struct
82 static struct tmp102 *tmp102_update_device(struct device *dev) in tmp102_update_device() argument
84 struct tmp102 *tmp102 = dev_get_drvdata(dev); in tmp102_update_device() local
85 struct i2c_client *client = tmp102->client; in tmp102_update_device()
87 mutex_lock(&tmp102->lock); in tmp102_update_device()
88 if (time_after(jiffies, tmp102->last_update + HZ / 3)) { in tmp102_update_device()
90 for (i = 0; i < ARRAY_SIZE(tmp102->temp); ++i) { in tmp102_update_device()
94 tmp102->temp[i] = tmp102_reg_to_mC(status); in tmp102_update_device()
96 tmp102->last_update = jiffies; in tmp102_update_device()
97 tmp102->first_time = false; in tmp102_update_device()
99 mutex_unlock(&tmp102->lock); in tmp102_update_device()
100 return tmp102; in tmp102_update_device()
105 struct tmp102 *tmp102 = tmp102_update_device(dev); in tmp102_read_temp() local
108 if (tmp102->first_time) { in tmp102_read_temp()
113 *temp = tmp102->temp[0]; in tmp102_read_temp()
123 struct tmp102 *tmp102 = tmp102_update_device(dev); in tmp102_show_temp() local
126 if (tmp102->first_time) in tmp102_show_temp()
129 return sprintf(buf, "%d\n", tmp102->temp[sda->index]); in tmp102_show_temp()
137 struct tmp102 *tmp102 = dev_get_drvdata(dev); in tmp102_set_temp() local
138 struct i2c_client *client = tmp102->client; in tmp102_set_temp()
146 mutex_lock(&tmp102->lock); in tmp102_set_temp()
147 tmp102->temp[sda->index] = val; in tmp102_set_temp()
150 mutex_unlock(&tmp102->lock); in tmp102_set_temp()
168 ATTRIBUTE_GROUPS(tmp102);
182 struct tmp102 *tmp102; in tmp102_probe() local
192 tmp102 = devm_kzalloc(dev, sizeof(*tmp102), GFP_KERNEL); in tmp102_probe()
193 if (!tmp102) in tmp102_probe()
196 i2c_set_clientdata(client, tmp102); in tmp102_probe()
197 tmp102->client = client; in tmp102_probe()
204 tmp102->config_orig = status; in tmp102_probe()
222 tmp102->last_update = jiffies; in tmp102_probe()
224 tmp102->first_time = true; in tmp102_probe()
225 mutex_init(&tmp102->lock); in tmp102_probe()
228 tmp102, tmp102_groups); in tmp102_probe()
234 tmp102->hwmon_dev = hwmon_dev; in tmp102_probe()
235 tmp102->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, in tmp102_probe()
237 if (IS_ERR(tmp102->tz)) in tmp102_probe()
238 tmp102->tz = NULL; in tmp102_probe()
246 tmp102->config_orig); in tmp102_probe()
252 struct tmp102 *tmp102 = i2c_get_clientdata(client); in tmp102_remove() local
254 thermal_zone_of_sensor_unregister(tmp102->hwmon_dev, tmp102->tz); in tmp102_remove()
255 hwmon_device_unregister(tmp102->hwmon_dev); in tmp102_remove()
258 if (tmp102->config_orig & TMP102_CONF_SD) { in tmp102_remove()