Re: [PATCH v5] iio: hrtimer: Allow sub Hz granularity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 12, 2021 at 6:09 AM Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote:
>
> Allow setting frequency below 1Hz or sub 1Hz precision.
> Useful for slow sensors like ALS.
>
> Test frequency is set properly:
> modprobe iio-trig-hrtimer && \
> mkdir /sys/kernel/config/iio/triggers/hrtimer/t1 && \

This && seems strange...

> cd /sys/bus/iio/devices/triggerX ;

...because if the above fails, the below becomes a total train wreck.

> for i in 1 .1 .01 .001 ; do
>   echo $i > sampling_frequency
>   cat sampling_frequency
> done

Something like this perhaps (note {} and also I dropped unneeded ; and
whitespace)
  modprobe iio-trig-hrtimer && \
  mkdir /sys/kernel/config/iio/triggers/hrtimer/t1 && { \
    cd /sys/bus/iio/devices/triggerX
    for i in 1 .1 .01 .001; do
      echo $i > sampling_frequency
      cat sampling_frequency
    done
  }

...

> +       if (!val || val > NSEC_PER_SEC * 1000)
>                 return -EINVAL;

> +       info->period = NSEC_PER_SEC * 1000;

I didn't get these * 1000 parts, why not define and use PSEC_PER_SEC?

I'll send a patch soon. You may include it in your series as prerequisite.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux