On 28/02/2020 02:12, Anson Huang wrote: > Hi, Daniel [ ... ] >>> +static int tmu_get_temp(void *data, int *temp) { >>> + struct imx8mm_tmu *tmu = data; >>> + u32 val; >>> + >>> + /* the temp sensor need about 1ms to finish the measurement */ >>> + usleep_range(1000, 2000); >> >> Why do yo need to force a delay here? If the sensor can not be read more >> than one time every 1ms, then specify that in the DT switching the polling to >> the right value, no? > > The polling time(2 seconds) is OK for this case, adding this sleep is to prevent user from reading > temperature from sysfs interface very frequently like less than 1ms, does it make sense? Not really, well except if the user is able to press the keys in less than 1ms :) If the userspace writes a polling script reading the temperature in a busy loop, there is nothing we can do against silly programming :/ However, it could interesting to add a <min polling interval> in the thermal structure and handle that from the core framework by caching the last value and return it in case get_temp is called too fast. -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog