On Mon, 25 Jul 2022 at 23:27, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > > On Mon, Jul 25, 2022 at 10:48 AM Crt Mori <cmo@xxxxxxxxxxx> wrote: > > > > Hi, > > I am implementing the power saving modes for mlx90632 device driver > > and while I have implemented routines for SET_RUNTIME_PM_OPS > > (runtime_pm_suspend and runtime_pm_resume) I am not able to find out > > how to trigger them from the terminal. > > > > It could be that my driver code for power management implementation is > > incomplete and I need to initialize something more. > > > > Maybe it is helpful, but the power submodule of the device contains below files: > > > > $ ls -al /sys/bus/iio/devices/iio\:device0/power > > total 0 > > drwxrwxr-x 2 root gpio 0 Apr 6 14:17 . > > drwxrwxr-x 3 root gpio 0 Apr 6 14:17 .. > > -rw-rw-r-- 1 root gpio 4096 Apr 6 14:17 async > > -rw-rw-r-- 1 root gpio 4096 Apr 6 14:17 autosuspend_delay_ms > > -rw-rw-r-- 1 root gpio 4096 Apr 6 14:18 control > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_active_kids > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_active_time > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_enabled > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_status > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_suspended_time > > -r--r--r-- 1 root gpio 4096 Apr 6 14:17 runtime_usage > > > > And control is already set to "auto" which according to documentation > > should allow the PM. > > 'auto' should enable it. So, whenever the driver thinks it's a time to > power off/on the device it will call the methods. > > You may hack a bit to enable autosuspend (which often is not a good > idea for IIO sensors) and see it done automatically after some time. So the idea is to wait? How would I enable autosuspend - by lowering the autosusped_delay_ms? How does the driver decide that it is time to power off/on? Do I need something else enabled to have this done automatically? Autosuspend is 5000 in my case which would mean 5 seconds, so I am quite sure I waited that long and I did not see printk's from the driver. > > -- > With Best Regards, > Andy Shevchenko