Re: [PATCH v2] drivers: counter: Add Cros EC Sync counter

From: Gwendal Grignou
Date: Mon Apr 20 2020 - 14:54:32 EST


On Tue, Apr 14, 2020 at 1:48 PM William Breathitt Gray
<vilhelm.gray@xxxxxxxxx> wrote:
>
> On Mon, Apr 13, 2020 at 12:55:14PM -0700, Gwendal Grignou wrote:
> > When the camera vsync pin is connected to the embedded controller (EC) of
> > a chromebook, the EC reports a sensor with a counter that increases
> > at each GPIO rising edge.
> >
> > The sensor is presented using the counter subsystem.
> > In addition, it is also presented via the IIO subsystem with a timestamp,
> > allowing synchronisation with sensors connected to the same EC, for
> > image stabilisation or augmented reality applications.
>
> Hi Gwendal,
>
> Sorry for the delay. I have some changes requested below.
>
> > To enable the counter:
> > via counter ABI:
> > echo "rising edge" > counterX/count0/signal_action
> > via iio ABI
> > echo 1 > iio:deviceY/en
> >
> > To disable the counter:
> > via counter ABI:
> > echo "none" > counterX/count0/signal_action
> > via iio ABI
> > echo 0 > iio:deviceY/en
>
> Although in theory a user could manually disable the actions for a
> Signal, this is a very roundabout way of actually disabling the Count.
> It's better to expose an "enable" attribute to allow the users to
> perform this functionality; for example:
>
> echo 0 > counterX/count0/enable
> echo 1 > counterX/count0/enable
>
> >
> > To read the current counter value:
> > via counter ABI:
> > cat counterX/count0/count
> > via iio ABI
> > cat iio:deviceY/in_count_raw
>
> I know we discussed this in the last review but it's still the same as
> before: IIO_COUNT interface is deprecated so new drivers won't be
> allowed to use it. You'll have to remove the IIO_COUNT code in this
> driver and replace it with Counter subsystem equivalents.
I understand the need of a clean separation between counter and IIO subsystems.
I will wait for counter to offer a way to gather timestamp'ed counts.
Do you have a plan/proposed ABI you can share?

Thanks,

Gwendal.