Lines Matching +full:poll +full:- +full:interval
1 // SPDX-License-Identifier: GPL-2.0-only
4 * aht10.c - Linux hwmon driver for AHT10 Temperature and Humidity sensor
17 * Poll intervals (in milliseconds)
48 * struct aht10_data - All the data required to operate an AHT10 chip
52 * @min_poll_interval: the minimum poll interval
53 * While the poll rate limit is not 100% necessary,
81 * aht10_init() - Initialize an AHT10 chip
92 struct i2c_client *client = data->client; in aht10_init()
103 return -ENODATA; in aht10_init()
106 return -EBUSY; in aht10_init()
112 * aht10_polltime_expired() - check if the minimum poll interval has
115 * Return: 1 if the minimum poll interval has expired, 0 if not
120 ktime_t difference = ktime_sub(current_time, data->previous_poll_time); in aht10_polltime_expired()
122 return ktime_after(difference, data->min_poll_interval); in aht10_polltime_expired()
126 * aht10_read_values() - read and parse the raw data from the AHT10
136 struct i2c_client *client = data->client; in aht10_read_values()
138 mutex_lock(&data->lock); in aht10_read_values()
142 mutex_unlock(&data->lock); in aht10_read_values()
151 mutex_unlock(&data->lock); in aht10_read_values()
153 return -ENODATA; in aht10_read_values()
169 data->temperature = (int)temp - 50000; in aht10_read_values()
170 data->humidity = hum; in aht10_read_values()
171 data->previous_poll_time = ktime_get_boottime(); in aht10_read_values()
173 mutex_unlock(&data->lock); in aht10_read_values()
178 * aht10_interval_write() - store the given minimum poll interval.
179 * Return: 0 on success, -EINVAL if a value lower than the
185 data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, LONG_MAX)); in aht10_interval_write()
190 * aht10_interval_read() - read the minimum poll interval
196 *val = ktime_to_ms(data->min_poll_interval); in aht10_interval_read()
201 * aht10_temperature1_read() - read the temperature in millidegrees
211 *val = data->temperature; in aht10_temperature1_read()
216 * aht10_humidity1_read() - read the relative humidity in millipercent
226 *val = data->humidity; in aht10_humidity1_read()
257 return -EOPNOTSUPP; in aht10_hwmon_read()
270 return -EOPNOTSUPP; in aht10_hwmon_write()
295 struct device *device = &client->dev; in aht10_probe()
300 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) in aht10_probe()
301 return -ENOENT; in aht10_probe()
305 return -ENOMEM; in aht10_probe()
307 data->min_poll_interval = ms_to_ktime(AHT10_DEFAULT_MIN_POLL_INTERVAL); in aht10_probe()
308 data->client = client; in aht10_probe()
310 mutex_init(&data->lock); in aht10_probe()
321 client->name, in aht10_probe()