Lines Matching defs:sht21
29 * struct sht21 - SHT21 device specific data
38 struct sht21 {
87 struct sht21 *sht21 = dev_get_drvdata(dev);
88 struct i2c_client *client = sht21->client;
90 mutex_lock(&sht21->lock);
96 if (time_after(jiffies, sht21->last_update + HZ / 2) || !sht21->valid) {
101 sht21->temperature = sht21_temp_ticks_to_millicelsius(ret);
106 sht21->humidity = sht21_rh_ticks_to_per_cent_mille(ret);
107 sht21->last_update = jiffies;
108 sht21->valid = true;
111 mutex_unlock(&sht21->lock);
129 struct sht21 *sht21 = dev_get_drvdata(dev);
135 return sprintf(buf, "%d\n", sht21->temperature);
150 struct sht21 *sht21 = dev_get_drvdata(dev);
156 return sprintf(buf, "%d\n", sht21->humidity);
159 static ssize_t eic_read(struct sht21 *sht21)
161 struct i2c_client *client = sht21->client;
202 ret = snprintf(sht21->eic, sizeof(sht21->eic),
208 sht21->eic[0] = 0;
226 struct sht21 *sht21 = dev_get_drvdata(dev);
229 ret = sizeof(sht21->eic) - 1;
230 mutex_lock(&sht21->lock);
231 if (!sht21->eic[0])
232 ret = eic_read(sht21);
234 memcpy(buf, sht21->eic, ret);
235 mutex_unlock(&sht21->lock);
251 ATTRIBUTE_GROUPS(sht21);
257 struct sht21 *sht21;
266 sht21 = devm_kzalloc(dev, sizeof(*sht21), GFP_KERNEL);
267 if (!sht21)
270 sht21->client = client;
272 mutex_init(&sht21->lock);
275 sht21, sht21_groups);
281 { "sht21", 0 },
287 .driver.name = "sht21",