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