Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-16 Thread Jyoti Bhayana
Hi Christian,

Thanks for porting the driver to the new interface. I have commented
on changes in v7-0025-iio-scmi-port-driver-to-the-new-scmi_sensor_proto.patch.

Thanks,
Jyoti

On Tue, Mar 16, 2021 at 6:13 AM Cristian Marussi
 wrote:
>
> Hi
>
> I reposted my series on top of the take3 immutable branch from Jonathan
> at:
>
> https://lore.kernel.org/lkml/20210316124903.35011-1-cristian.maru...@arm.com/T/#t
>
> You should have received an email regarding the relevant IIO SCMI patch
>
> v7-0025-iio-scmi-port-driver-to-the-new-scmi_sensor_proto.patch
>
> which includes the port of your v7 IIO SCMI driver to the new API, and moved
> also the notification registration to the probe phase to simplify it
> further.
>
> On my side I tested with some fake emulated sensors emitting periodic
> 100ms SENSOR_UPDATE notifs...and verifying that notifications are still
> dispatched and received fine. (values are just fakes)
>
> If you can have a look, comment and possibly Ack.
>
> Thanks
>
> Cristian
>
> ---
>
> (debian-arm64)root@debarm64:~# /root/iio_generic_buffer -a -c -1 -g -l 100 -N > 0
> iio device number being used is 0
> trigger-less mode selected
> Enabling all channels
> Enabling: in_accel_x_en
> Enabling: in_accel_z_en
> Enabling: in_timestamp_en
> Enabling: in_accel_y_en
> -9465 -9457 -9449 6169807244683640832.00
> -9464 -9456 -9448 6169807244683640832.00
> -9463 -9455 -9447 6169807244683640832.00
> -9462 -9454 -9446 6169807244683640832.00
> -9461 -9453 -9445 6169807244683640832.00
> -9460 -9452 -9444 6169807244683640832.00
> -9459 -9451 -9443 7169807022831960064.00
> -9458 -9450 -9442 7169807022831960064.00
> -9457 -9449 -9441 7169807022831960064.00
> -9456 -9448 -9440 7169807022831960064.00
> -9455 -9447 -9439 7169807022831960064.00
> -9454 -9446 -9438 7169807022831960064.00
> -9453 -9445 -9437 7169807022831960064.00
> -9452 -9444 -9436 7169807022831960064.00
> -9451 -9443 -9435 7169807022831960064.00
> -9450 -9442 -9434 7169807022831960064.00
> -9449 -9441 -9433 8169806800980279296.00
> -9448 -9440 -9432 8169806800980279296.00
> -9447 -9439 -9431 8169806800980279296.00
> -9446 -9438 -9430 8169806800980279296.00
> -9445 -9437 -9429 8169806800980279296.00
> -9444 -9436 -9428 8169806800980279296.00
> -9443 -9435 -9427 8169806800980279296.00
> -9442 -9434 -9426 8169806800980279296.00
> -9441 -9433 -9425 8169806800980279296.00
> -9440 -9432 -9424 8169806800980279296.00
> -9439 -9431 -9423 9169807128884412416.00
> -9438 -9430 -9422 9169807128884412416.00
> -9437 -9429 -9421 9169807128884412416.00
> -9436 -9428 -9420 9169807128884412416.00
> -9435 -9427 -9419 9169807128884412416.00
> ^CCaught signal 2
> Disabling: in_accel_x_en
> Disabling: in_accel_z_en
> Disabling: in_timestamp_en
> Disabling: in_accel_y_en
>
>
> On Sun, Mar 14, 2021 at 11:47:25AM -0700, Jyoti Bhayana wrote:
> > Hi Jonathan,
> >
> > No worries. Thanks for the update. It looks good now.
> >
> > Thanks,
> > Jyoti
> >
> > On Sun, Mar 14, 2021 at 8:40 AM Jonathan Cameron  wrote:
> > >
> > > On Sat, 13 Mar 2021 11:55:39 -0800
> > > Jyoti Bhayana  wrote:
> > >
> > > > Hi Jonathan,
> > > >
> > > > I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.
> > >
> > > OK. I'm completely confused as to what is going with my local tree.
> > > I have the right patch in the history but it didn't end up in the final
> > > pushed out version.  Fat finger mess-up I guess and too many similarly 
> > > named
> > > branches and the fact I didn't check the final result closely enough.
> > >
> > > There is now an ib-iio-scmi-5.12-rc2-take3 branch
> > >
> > > This time it definitely has your patch from the 9th of March with no
> > > instances of long long in it.
> > >
> > > Sorry I messed this one up (again!)
> > >
> > > Jonathan
> > >
> > > >
> > > > Thanks,
> > > > Jyoti
> > >


Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-16 Thread Cristian Marussi
Hi

I reposted my series on top of the take3 immutable branch from Jonathan
at:

https://lore.kernel.org/lkml/20210316124903.35011-1-cristian.maru...@arm.com/T/#t

You should have received an email regarding the relevant IIO SCMI patch

v7-0025-iio-scmi-port-driver-to-the-new-scmi_sensor_proto.patch

which includes the port of your v7 IIO SCMI driver to the new API, and moved
also the notification registration to the probe phase to simplify it
further.

On my side I tested with some fake emulated sensors emitting periodic
100ms SENSOR_UPDATE notifs...and verifying that notifications are still
dispatched and received fine. (values are just fakes)

If you can have a look, comment and possibly Ack.

Thanks

Cristian

---

(debian-arm64)root@debarm64:~# /root/iio_generic_buffer -a -c -1 -g -l 100 -N 0
iio device number being used is 0
trigger-less mode selected
Enabling all channels
Enabling: in_accel_x_en
Enabling: in_accel_z_en
Enabling: in_timestamp_en
Enabling: in_accel_y_en
-9465 -9457 -9449 6169807244683640832.00
-9464 -9456 -9448 6169807244683640832.00
-9463 -9455 -9447 6169807244683640832.00
-9462 -9454 -9446 6169807244683640832.00
-9461 -9453 -9445 6169807244683640832.00
-9460 -9452 -9444 6169807244683640832.00
-9459 -9451 -9443 7169807022831960064.00
-9458 -9450 -9442 7169807022831960064.00
-9457 -9449 -9441 7169807022831960064.00
-9456 -9448 -9440 7169807022831960064.00
-9455 -9447 -9439 7169807022831960064.00
-9454 -9446 -9438 7169807022831960064.00
-9453 -9445 -9437 7169807022831960064.00
-9452 -9444 -9436 7169807022831960064.00
-9451 -9443 -9435 7169807022831960064.00
-9450 -9442 -9434 7169807022831960064.00
-9449 -9441 -9433 8169806800980279296.00
-9448 -9440 -9432 8169806800980279296.00
-9447 -9439 -9431 8169806800980279296.00
-9446 -9438 -9430 8169806800980279296.00
-9445 -9437 -9429 8169806800980279296.00
-9444 -9436 -9428 8169806800980279296.00
-9443 -9435 -9427 8169806800980279296.00
-9442 -9434 -9426 8169806800980279296.00
-9441 -9433 -9425 8169806800980279296.00
-9440 -9432 -9424 8169806800980279296.00
-9439 -9431 -9423 9169807128884412416.00
-9438 -9430 -9422 9169807128884412416.00
-9437 -9429 -9421 9169807128884412416.00
-9436 -9428 -9420 9169807128884412416.00
-9435 -9427 -9419 9169807128884412416.00
^CCaught signal 2
Disabling: in_accel_x_en
Disabling: in_accel_z_en
Disabling: in_timestamp_en
Disabling: in_accel_y_en


On Sun, Mar 14, 2021 at 11:47:25AM -0700, Jyoti Bhayana wrote:
> Hi Jonathan,
> 
> No worries. Thanks for the update. It looks good now.
> 
> Thanks,
> Jyoti
> 
> On Sun, Mar 14, 2021 at 8:40 AM Jonathan Cameron  wrote:
> >
> > On Sat, 13 Mar 2021 11:55:39 -0800
> > Jyoti Bhayana  wrote:
> >
> > > Hi Jonathan,
> > >
> > > I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.
> >
> > OK. I'm completely confused as to what is going with my local tree.
> > I have the right patch in the history but it didn't end up in the final
> > pushed out version.  Fat finger mess-up I guess and too many similarly named
> > branches and the fact I didn't check the final result closely enough.
> >
> > There is now an ib-iio-scmi-5.12-rc2-take3 branch
> >
> > This time it definitely has your patch from the 9th of March with no
> > instances of long long in it.
> >
> > Sorry I messed this one up (again!)
> >
> > Jonathan
> >
> > >
> > > Thanks,
> > > Jyoti
> >


Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-15 Thread Sudeep Holla
Hi Jonathan,

On Sun, Mar 14, 2021 at 03:40:33PM +, Jonathan Cameron wrote:
> On Sat, 13 Mar 2021 11:55:39 -0800
> Jyoti Bhayana  wrote:
>
> > Hi Jonathan,
> >
> > I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.
>
> OK. I'm completely confused as to what is going with my local tree.
> I have the right patch in the history but it didn't end up in the final
> pushed out version.  Fat finger mess-up I guess and too many similarly named
> branches and the fact I didn't check the final result closely enough.
>
> There is now an ib-iio-scmi-5.12-rc2-take3 branch
>

I have now used this for my for-next/scmi branch. It is not final yet,
just pushed out for bots to build test and get into -next. Let me know
if you have plans to change/rework this branch, I can update it anytime
till end of this week to avoid multiple hashes.

--
Regards,
Sudeep


Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-14 Thread Jyoti Bhayana
Hi Jonathan,

No worries. Thanks for the update. It looks good now.

Thanks,
Jyoti

On Sun, Mar 14, 2021 at 8:40 AM Jonathan Cameron  wrote:
>
> On Sat, 13 Mar 2021 11:55:39 -0800
> Jyoti Bhayana  wrote:
>
> > Hi Jonathan,
> >
> > I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.
>
> OK. I'm completely confused as to what is going with my local tree.
> I have the right patch in the history but it didn't end up in the final
> pushed out version.  Fat finger mess-up I guess and too many similarly named
> branches and the fact I didn't check the final result closely enough.
>
> There is now an ib-iio-scmi-5.12-rc2-take3 branch
>
> This time it definitely has your patch from the 9th of March with no
> instances of long long in it.
>
> Sorry I messed this one up (again!)
>
> Jonathan
>
> >
> > Thanks,
> > Jyoti
>


Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-14 Thread Jonathan Cameron
On Sat, 13 Mar 2021 11:55:39 -0800
Jyoti Bhayana  wrote:

> Hi Jonathan,
> 
> I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.

OK. I'm completely confused as to what is going with my local tree.
I have the right patch in the history but it didn't end up in the final
pushed out version.  Fat finger mess-up I guess and too many similarly named
branches and the fact I didn't check the final result closely enough.

There is now an ib-iio-scmi-5.12-rc2-take3 branch

This time it definitely has your patch from the 9th of March with no
instances of long long in it.

Sorry I messed this one up (again!)

Jonathan

> 
> Thanks,
> Jyoti



Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-13 Thread Jyoti Bhayana
Hi Jonathan,

I still see the old version 6 in ib-iio-scmi-5.12-rc2-take2 as well.

Thanks,
Jyoti

On Sat, Mar 13, 2021 at 9:11 AM Jonathan Cameron  wrote:
>
> On Fri, 12 Mar 2021 09:54:12 -0800
> Jyoti Bhayana  wrote:
>
> > Hi Jonathan,
> >
> > I also see what Cristian has observed that rc2 is still pointing to v6
> > of the SCMI IIO driver patch and it also doesn't have the changes
> > which you did in rc1 for changing long long to s64.
> >
> > Thanks,
> > Jyoti
>
> Gah!  I must have grabbed wrong one somehow.
>
> Anyhow, there is now a
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2-take2
>
> version which should looks to have the right dates an all.  Merge into
> my togreg still the same as it was previously.
>
> Thanks,
>
> Jonathan
>
> >
> >
> > On Fri, Mar 12, 2021 at 5:31 AM Cristian Marussi
> >  wrote:
> > >
> > > Hi Jonathan,
> > >
> > > thanks for this, I was starting working on top of this new immutable
> > > branch BUT I spotted a thing that I wanted to check.
> > >
> > > You latest immutable:
> > >  
> > > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> > >
> > > looking at the code in the SCMI IIO Jyoti driver
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=ib-iio-scmi-5.12-rc2=f937d8c1ef246d99d2174ed88c629f6e24823918
> > >
> > > this seems to me that still includes v6 of IIO Jyoti patch:
> > >
> > > https://lore.kernel.org/linux-iio/20210212172235.507028-2-jbhay...@google.com/
> > >
> > > (the offending one on the bot report related to div symbols on MIPS if I 
> > > got it right),
> > > in fact it has 710 insertions and still uses div64_u64 (and the Link tag 
> > > leads to the v6)
> > >
> > > while the lastest v7
> > >
> > > https://lore.kernel.org/lkml/20210309231259.78050-2-jbhay...@google.com/
> > >
> > > has 715 insetions and uses do_div instead, but in fact this v7 has a Link:
> > > tag still pointing to v6 (maybe this is the issue...?)
> > >
> > > Sorry for the noise if I missed something and everything is fine please
> > > ignore me and I'll go ahead with this branch if you say so.
> > >
> > > Thanks
> > >
> > > Cristian
> > >
> > >
> > >
> > > On Fri, Mar 12, 2021 at 12:16:39PM +, Jonathan Cameron wrote:
> > > > On Thu, 11 Mar 2021 21:08:44 +
> > > > Jonathan Cameron  wrote:
> > > >
> > > > > On Tue,  9 Mar 2021 23:12:59 +
> > > > > Jyoti Bhayana  wrote:
> > > > >
> > > > > > This change provides ARM SCMI Protocol based IIO device.
> > > > > > This driver provides support for Accelerometer and Gyroscope using
> > > > > > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM 
> > > > > > specification
> > > > > >
> > > > > > Reported-by: kernel test robot 
> > > > > > Signed-off-by: Jyoti Bhayana 
> > > > > > Link: 
> > > > > > https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> > > > > > Signed-off-by: Jonathan Cameron 
> > > > >
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> > > > >
> > > > > New immutable branch.  I move to rc2 as the base as the rc1 tag
> > > > > has been removed for well publicized reasons.
> > > > >
> > > > > Should have the 0-day results in tomorrow morning. I'll shout
> > > > > if anything else shows up.
> > > > 0-day is happy, so this is now immutable and suitable for pulling in 
> > > > through
> > > > whatever trees need it.
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan
> > > >
> > > > >
> > > > > Also rebased the togreg branch for the same reason (hadn't pushed it
> > > > > out as anything other than testing, so hopefully no one was basing
> > > > > anything significant on top)
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Jonathan
> > > > >
> > > > > > ---
> > > > > >  MAINTAINERS|   6 +
> > > > > >  drivers/firmware/arm_scmi/driver.c |   2 +-
> > > > > >  drivers/iio/common/Kconfig |   1 +
> > > > > >  drivers/iio/common/Makefile|   1 +
> > > > > >  drivers/iio/common/scmi_sensors/Kconfig|  18 +
> > > > > >  drivers/iio/common/scmi_sensors/Makefile   |   5 +
> > > > > >  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 
> > > > > > +
> > > > > >  7 files changed, 715 insertions(+), 1 deletion(-)
> > > > > >  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
> > > > > >  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
> > > > > >  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> > > > > >
> > > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > > index d92f85ca831d..14227980f3d2 100644
> > > > > > --- a/MAINTAINERS
> > > > > > +++ b/MAINTAINERS
> > > > > > @@ -8692,6 +8692,12 @@ S: Maintained
> > > > > >  F:   
> > > > > > Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> > > > > >  F:   drivers/iio/multiplexer/iio-mux.c
> > > > > >
> > > > > > +IIO SCMI BASED DRIVER
> > > 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-13 Thread Jonathan Cameron
On Fri, 12 Mar 2021 09:54:12 -0800
Jyoti Bhayana  wrote:

> Hi Jonathan,
> 
> I also see what Cristian has observed that rc2 is still pointing to v6
> of the SCMI IIO driver patch and it also doesn't have the changes
> which you did in rc1 for changing long long to s64.
> 
> Thanks,
> Jyoti

Gah!  I must have grabbed wrong one somehow.

Anyhow, there is now a 
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2-take2

version which should looks to have the right dates an all.  Merge into
my togreg still the same as it was previously.

Thanks,

Jonathan

> 
> 
> On Fri, Mar 12, 2021 at 5:31 AM Cristian Marussi
>  wrote:
> >
> > Hi Jonathan,
> >
> > thanks for this, I was starting working on top of this new immutable
> > branch BUT I spotted a thing that I wanted to check.
> >
> > You latest immutable:
> >  
> > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> >
> > looking at the code in the SCMI IIO Jyoti driver
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=ib-iio-scmi-5.12-rc2=f937d8c1ef246d99d2174ed88c629f6e24823918
> >
> > this seems to me that still includes v6 of IIO Jyoti patch:
> >
> > https://lore.kernel.org/linux-iio/20210212172235.507028-2-jbhay...@google.com/
> >
> > (the offending one on the bot report related to div symbols on MIPS if I 
> > got it right),
> > in fact it has 710 insertions and still uses div64_u64 (and the Link tag 
> > leads to the v6)
> >
> > while the lastest v7
> >
> > https://lore.kernel.org/lkml/20210309231259.78050-2-jbhay...@google.com/
> >
> > has 715 insetions and uses do_div instead, but in fact this v7 has a Link:
> > tag still pointing to v6 (maybe this is the issue...?)
> >
> > Sorry for the noise if I missed something and everything is fine please
> > ignore me and I'll go ahead with this branch if you say so.
> >
> > Thanks
> >
> > Cristian
> >
> >
> >
> > On Fri, Mar 12, 2021 at 12:16:39PM +, Jonathan Cameron wrote:  
> > > On Thu, 11 Mar 2021 21:08:44 +
> > > Jonathan Cameron  wrote:
> > >  
> > > > On Tue,  9 Mar 2021 23:12:59 +
> > > > Jyoti Bhayana  wrote:
> > > >  
> > > > > This change provides ARM SCMI Protocol based IIO device.
> > > > > This driver provides support for Accelerometer and Gyroscope using
> > > > > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM 
> > > > > specification
> > > > >
> > > > > Reported-by: kernel test robot 
> > > > > Signed-off-by: Jyoti Bhayana 
> > > > > Link: 
> > > > > https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> > > > > Signed-off-by: Jonathan Cameron   
> > > >
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> > > >
> > > > New immutable branch.  I move to rc2 as the base as the rc1 tag
> > > > has been removed for well publicized reasons.
> > > >
> > > > Should have the 0-day results in tomorrow morning. I'll shout
> > > > if anything else shows up.  
> > > 0-day is happy, so this is now immutable and suitable for pulling in 
> > > through
> > > whatever trees need it.
> > >
> > > Thanks,
> > >
> > > Jonathan
> > >  
> > > >
> > > > Also rebased the togreg branch for the same reason (hadn't pushed it
> > > > out as anything other than testing, so hopefully no one was basing
> > > > anything significant on top)
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan
> > > >  
> > > > > ---
> > > > >  MAINTAINERS|   6 +
> > > > >  drivers/firmware/arm_scmi/driver.c |   2 +-
> > > > >  drivers/iio/common/Kconfig |   1 +
> > > > >  drivers/iio/common/Makefile|   1 +
> > > > >  drivers/iio/common/scmi_sensors/Kconfig|  18 +
> > > > >  drivers/iio/common/scmi_sensors/Makefile   |   5 +
> > > > >  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 
> > > > > +
> > > > >  7 files changed, 715 insertions(+), 1 deletion(-)
> > > > >  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
> > > > >  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
> > > > >  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> > > > >
> > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > index d92f85ca831d..14227980f3d2 100644
> > > > > --- a/MAINTAINERS
> > > > > +++ b/MAINTAINERS
> > > > > @@ -8692,6 +8692,12 @@ S: Maintained
> > > > >  F:   
> > > > > Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> > > > >  F:   drivers/iio/multiplexer/iio-mux.c
> > > > >
> > > > > +IIO SCMI BASED DRIVER
> > > > > +M:   Jyoti Bhayana 
> > > > > +L:   linux-...@vger.kernel.org
> > > > > +S:   Maintained
> > > > > +F:   drivers/iio/common/scmi_sensors/scmi_iio.c
> > > > > +
> > > > >  IIO SUBSYSTEM AND DRIVERS
> > > > >  M:   Jonathan Cameron 
> > > > >  R:   Lars-Peter Clausen 
> > > > > diff --git a/drivers/firmware/arm_scmi/driver.c 
> > > > > 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-12 Thread Jyoti Bhayana
Hi Jonathan,

I also see what Cristian has observed that rc2 is still pointing to v6
of the SCMI IIO driver patch and it also doesn't have the changes
which you did in rc1 for changing long long to s64.

Thanks,
Jyoti


On Fri, Mar 12, 2021 at 5:31 AM Cristian Marussi
 wrote:
>
> Hi Jonathan,
>
> thanks for this, I was starting working on top of this new immutable
> branch BUT I spotted a thing that I wanted to check.
>
> You latest immutable:
>  
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
>
> looking at the code in the SCMI IIO Jyoti driver
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=ib-iio-scmi-5.12-rc2=f937d8c1ef246d99d2174ed88c629f6e24823918
>
> this seems to me that still includes v6 of IIO Jyoti patch:
>
> https://lore.kernel.org/linux-iio/20210212172235.507028-2-jbhay...@google.com/
>
> (the offending one on the bot report related to div symbols on MIPS if I got 
> it right),
> in fact it has 710 insertions and still uses div64_u64 (and the Link tag 
> leads to the v6)
>
> while the lastest v7
>
> https://lore.kernel.org/lkml/20210309231259.78050-2-jbhay...@google.com/
>
> has 715 insetions and uses do_div instead, but in fact this v7 has a Link:
> tag still pointing to v6 (maybe this is the issue...?)
>
> Sorry for the noise if I missed something and everything is fine please
> ignore me and I'll go ahead with this branch if you say so.
>
> Thanks
>
> Cristian
>
>
>
> On Fri, Mar 12, 2021 at 12:16:39PM +, Jonathan Cameron wrote:
> > On Thu, 11 Mar 2021 21:08:44 +
> > Jonathan Cameron  wrote:
> >
> > > On Tue,  9 Mar 2021 23:12:59 +
> > > Jyoti Bhayana  wrote:
> > >
> > > > This change provides ARM SCMI Protocol based IIO device.
> > > > This driver provides support for Accelerometer and Gyroscope using
> > > > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> > > >
> > > > Reported-by: kernel test robot 
> > > > Signed-off-by: Jyoti Bhayana 
> > > > Link: 
> > > > https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> > > > Signed-off-by: Jonathan Cameron 
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> > >
> > > New immutable branch.  I move to rc2 as the base as the rc1 tag
> > > has been removed for well publicized reasons.
> > >
> > > Should have the 0-day results in tomorrow morning. I'll shout
> > > if anything else shows up.
> > 0-day is happy, so this is now immutable and suitable for pulling in through
> > whatever trees need it.
> >
> > Thanks,
> >
> > Jonathan
> >
> > >
> > > Also rebased the togreg branch for the same reason (hadn't pushed it
> > > out as anything other than testing, so hopefully no one was basing
> > > anything significant on top)
> > >
> > > Thanks,
> > >
> > > Jonathan
> > >
> > > > ---
> > > >  MAINTAINERS|   6 +
> > > >  drivers/firmware/arm_scmi/driver.c |   2 +-
> > > >  drivers/iio/common/Kconfig |   1 +
> > > >  drivers/iio/common/Makefile|   1 +
> > > >  drivers/iio/common/scmi_sensors/Kconfig|  18 +
> > > >  drivers/iio/common/scmi_sensors/Makefile   |   5 +
> > > >  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 +
> > > >  7 files changed, 715 insertions(+), 1 deletion(-)
> > > >  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
> > > >  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
> > > >  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> > > >
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index d92f85ca831d..14227980f3d2 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -8692,6 +8692,12 @@ S: Maintained
> > > >  F:   
> > > > Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> > > >  F:   drivers/iio/multiplexer/iio-mux.c
> > > >
> > > > +IIO SCMI BASED DRIVER
> > > > +M:   Jyoti Bhayana 
> > > > +L:   linux-...@vger.kernel.org
> > > > +S:   Maintained
> > > > +F:   drivers/iio/common/scmi_sensors/scmi_iio.c
> > > > +
> > > >  IIO SUBSYSTEM AND DRIVERS
> > > >  M:   Jonathan Cameron 
> > > >  R:   Lars-Peter Clausen 
> > > > diff --git a/drivers/firmware/arm_scmi/driver.c 
> > > > b/drivers/firmware/arm_scmi/driver.c
> > > > index cacdf1589b10..3e748e57deab 100644
> > > > --- a/drivers/firmware/arm_scmi/driver.c
> > > > +++ b/drivers/firmware/arm_scmi/driver.c
> > > > @@ -741,7 +741,7 @@ static struct scmi_prot_devnames devnames[] = {
> > > >   { SCMI_PROTOCOL_SYSTEM, { "syspower" },},
> > > >   { SCMI_PROTOCOL_PERF,   { "cpufreq" },},
> > > >   { SCMI_PROTOCOL_CLOCK,  { "clocks" },},
> > > > - { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
> > > > + { SCMI_PROTOCOL_SENSOR, { "hwmon", "iiodev" },},
> > > >   { SCMI_PROTOCOL_RESET,  { "reset" },},
> > > >   { SCMI_PROTOCOL_VOLTAGE,  { "regulator" },},
> > > >  };
> > > > diff --git a/drivers/iio/common/Kconfig 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-12 Thread Cristian Marussi
Hi Jonathan,

thanks for this, I was starting working on top of this new immutable
branch BUT I spotted a thing that I wanted to check.

You latest immutable:
 
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2

looking at the code in the SCMI IIO Jyoti driver

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=ib-iio-scmi-5.12-rc2=f937d8c1ef246d99d2174ed88c629f6e24823918

this seems to me that still includes v6 of IIO Jyoti patch:

https://lore.kernel.org/linux-iio/20210212172235.507028-2-jbhay...@google.com/

(the offending one on the bot report related to div symbols on MIPS if I got it 
right),
in fact it has 710 insertions and still uses div64_u64 (and the Link tag leads 
to the v6)

while the lastest v7

https://lore.kernel.org/lkml/20210309231259.78050-2-jbhay...@google.com/

has 715 insetions and uses do_div instead, but in fact this v7 has a Link:
tag still pointing to v6 (maybe this is the issue...?)

Sorry for the noise if I missed something and everything is fine please
ignore me and I'll go ahead with this branch if you say so.

Thanks

Cristian



On Fri, Mar 12, 2021 at 12:16:39PM +, Jonathan Cameron wrote:
> On Thu, 11 Mar 2021 21:08:44 +
> Jonathan Cameron  wrote:
> 
> > On Tue,  9 Mar 2021 23:12:59 +
> > Jyoti Bhayana  wrote:
> > 
> > > This change provides ARM SCMI Protocol based IIO device.
> > > This driver provides support for Accelerometer and Gyroscope using
> > > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> > > 
> > > Reported-by: kernel test robot 
> > > Signed-off-by: Jyoti Bhayana 
> > > Link: 
> > > https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> > > Signed-off-by: Jonathan Cameron   
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> > 
> > New immutable branch.  I move to rc2 as the base as the rc1 tag
> > has been removed for well publicized reasons.
> > 
> > Should have the 0-day results in tomorrow morning. I'll shout
> > if anything else shows up.
> 0-day is happy, so this is now immutable and suitable for pulling in through
> whatever trees need it.
> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Also rebased the togreg branch for the same reason (hadn't pushed it
> > out as anything other than testing, so hopefully no one was basing
> > anything significant on top)
> > 
> > Thanks,
> > 
> > Jonathan
> > 
> > > ---
> > >  MAINTAINERS|   6 +
> > >  drivers/firmware/arm_scmi/driver.c |   2 +-
> > >  drivers/iio/common/Kconfig |   1 +
> > >  drivers/iio/common/Makefile|   1 +
> > >  drivers/iio/common/scmi_sensors/Kconfig|  18 +
> > >  drivers/iio/common/scmi_sensors/Makefile   |   5 +
> > >  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 +
> > >  7 files changed, 715 insertions(+), 1 deletion(-)
> > >  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
> > >  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
> > >  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> > > 
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index d92f85ca831d..14227980f3d2 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -8692,6 +8692,12 @@ S: Maintained
> > >  F:   
> > > Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> > >  F:   drivers/iio/multiplexer/iio-mux.c
> > >  
> > > +IIO SCMI BASED DRIVER
> > > +M:   Jyoti Bhayana 
> > > +L:   linux-...@vger.kernel.org
> > > +S:   Maintained
> > > +F:   drivers/iio/common/scmi_sensors/scmi_iio.c
> > > +
> > >  IIO SUBSYSTEM AND DRIVERS
> > >  M:   Jonathan Cameron 
> > >  R:   Lars-Peter Clausen 
> > > diff --git a/drivers/firmware/arm_scmi/driver.c 
> > > b/drivers/firmware/arm_scmi/driver.c
> > > index cacdf1589b10..3e748e57deab 100644
> > > --- a/drivers/firmware/arm_scmi/driver.c
> > > +++ b/drivers/firmware/arm_scmi/driver.c
> > > @@ -741,7 +741,7 @@ static struct scmi_prot_devnames devnames[] = {
> > >   { SCMI_PROTOCOL_SYSTEM, { "syspower" },},
> > >   { SCMI_PROTOCOL_PERF,   { "cpufreq" },},
> > >   { SCMI_PROTOCOL_CLOCK,  { "clocks" },},
> > > - { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
> > > + { SCMI_PROTOCOL_SENSOR, { "hwmon", "iiodev" },},
> > >   { SCMI_PROTOCOL_RESET,  { "reset" },},
> > >   { SCMI_PROTOCOL_VOLTAGE,  { "regulator" },},
> > >  };
> > > diff --git a/drivers/iio/common/Kconfig b/drivers/iio/common/Kconfig
> > > index 2b9ee9161abd..0334b4954773 100644
> > > --- a/drivers/iio/common/Kconfig
> > > +++ b/drivers/iio/common/Kconfig
> > > @@ -6,5 +6,6 @@
> > >  source "drivers/iio/common/cros_ec_sensors/Kconfig"
> > >  source "drivers/iio/common/hid-sensors/Kconfig"
> > >  source "drivers/iio/common/ms_sensors/Kconfig"
> > > +source "drivers/iio/common/scmi_sensors/Kconfig"
> > >  source "drivers/iio/common/ssp_sensors/Kconfig"
> > >  source 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-12 Thread Jonathan Cameron
On Thu, 11 Mar 2021 21:08:44 +
Jonathan Cameron  wrote:

> On Tue,  9 Mar 2021 23:12:59 +
> Jyoti Bhayana  wrote:
> 
> > This change provides ARM SCMI Protocol based IIO device.
> > This driver provides support for Accelerometer and Gyroscope using
> > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> > 
> > Reported-by: kernel test robot 
> > Signed-off-by: Jyoti Bhayana 
> > Link: https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> > Signed-off-by: Jonathan Cameron   
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2
> 
> New immutable branch.  I move to rc2 as the base as the rc1 tag
> has been removed for well publicized reasons.
> 
> Should have the 0-day results in tomorrow morning. I'll shout
> if anything else shows up.
0-day is happy, so this is now immutable and suitable for pulling in through
whatever trees need it.

Thanks,

Jonathan

> 
> Also rebased the togreg branch for the same reason (hadn't pushed it
> out as anything other than testing, so hopefully no one was basing
> anything significant on top)
> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  MAINTAINERS|   6 +
> >  drivers/firmware/arm_scmi/driver.c |   2 +-
> >  drivers/iio/common/Kconfig |   1 +
> >  drivers/iio/common/Makefile|   1 +
> >  drivers/iio/common/scmi_sensors/Kconfig|  18 +
> >  drivers/iio/common/scmi_sensors/Makefile   |   5 +
> >  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 +
> >  7 files changed, 715 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
> >  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
> >  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index d92f85ca831d..14227980f3d2 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -8692,6 +8692,12 @@ S:   Maintained
> >  F: Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
> >  F: drivers/iio/multiplexer/iio-mux.c
> >  
> > +IIO SCMI BASED DRIVER
> > +M: Jyoti Bhayana 
> > +L: linux-...@vger.kernel.org
> > +S: Maintained
> > +F: drivers/iio/common/scmi_sensors/scmi_iio.c
> > +
> >  IIO SUBSYSTEM AND DRIVERS
> >  M: Jonathan Cameron 
> >  R: Lars-Peter Clausen 
> > diff --git a/drivers/firmware/arm_scmi/driver.c 
> > b/drivers/firmware/arm_scmi/driver.c
> > index cacdf1589b10..3e748e57deab 100644
> > --- a/drivers/firmware/arm_scmi/driver.c
> > +++ b/drivers/firmware/arm_scmi/driver.c
> > @@ -741,7 +741,7 @@ static struct scmi_prot_devnames devnames[] = {
> > { SCMI_PROTOCOL_SYSTEM, { "syspower" },},
> > { SCMI_PROTOCOL_PERF,   { "cpufreq" },},
> > { SCMI_PROTOCOL_CLOCK,  { "clocks" },},
> > -   { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
> > +   { SCMI_PROTOCOL_SENSOR, { "hwmon", "iiodev" },},
> > { SCMI_PROTOCOL_RESET,  { "reset" },},
> > { SCMI_PROTOCOL_VOLTAGE,  { "regulator" },},
> >  };
> > diff --git a/drivers/iio/common/Kconfig b/drivers/iio/common/Kconfig
> > index 2b9ee9161abd..0334b4954773 100644
> > --- a/drivers/iio/common/Kconfig
> > +++ b/drivers/iio/common/Kconfig
> > @@ -6,5 +6,6 @@
> >  source "drivers/iio/common/cros_ec_sensors/Kconfig"
> >  source "drivers/iio/common/hid-sensors/Kconfig"
> >  source "drivers/iio/common/ms_sensors/Kconfig"
> > +source "drivers/iio/common/scmi_sensors/Kconfig"
> >  source "drivers/iio/common/ssp_sensors/Kconfig"
> >  source "drivers/iio/common/st_sensors/Kconfig"
> > diff --git a/drivers/iio/common/Makefile b/drivers/iio/common/Makefile
> > index 4bc30bb548e2..fad40e1e1718 100644
> > --- a/drivers/iio/common/Makefile
> > +++ b/drivers/iio/common/Makefile
> > @@ -11,5 +11,6 @@
> >  obj-y += cros_ec_sensors/
> >  obj-y += hid-sensors/
> >  obj-y += ms_sensors/
> > +obj-y += scmi_sensors/
> >  obj-y += ssp_sensors/
> >  obj-y += st_sensors/
> > diff --git a/drivers/iio/common/scmi_sensors/Kconfig 
> > b/drivers/iio/common/scmi_sensors/Kconfig
> > new file mode 100644
> > index ..67e084cbb1ab
> > --- /dev/null
> > +++ b/drivers/iio/common/scmi_sensors/Kconfig
> > @@ -0,0 +1,18 @@
> > +#
> > +# IIO over SCMI
> > +#
> > +# When adding new entries keep the list in alphabetical order
> > +
> > +menu "IIO SCMI Sensors"
> > +
> > +config IIO_SCMI
> > +   tristate "IIO SCMI"
> > +depends on ARM_SCMI_PROTOCOL
> > +select IIO_BUFFER
> > +select IIO_KFIFO_BUF
> > +   help
> > +  Say yes here to build support for IIO SCMI Driver.
> > +  This provides ARM SCMI Protocol based IIO device.
> > +  This driver provides support for accelerometer and gyroscope
> > +  sensors available on SCMI based platforms.
> > +endmenu
> > diff --git a/drivers/iio/common/scmi_sensors/Makefile 
> > b/drivers/iio/common/scmi_sensors/Makefile
> > new file mode 100644
> > index ..f13140a2575a
> > --- /dev/null
> > +++ 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-11 Thread Jonathan Cameron
On Tue,  9 Mar 2021 23:12:59 +
Jyoti Bhayana  wrote:

> This change provides ARM SCMI Protocol based IIO device.
> This driver provides support for Accelerometer and Gyroscope using
> SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> 
> Reported-by: kernel test robot 
> Signed-off-by: Jyoti Bhayana 
> Link: https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
> Signed-off-by: Jonathan Cameron 

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/log/?h=ib-iio-scmi-5.12-rc2

New immutable branch.  I move to rc2 as the base as the rc1 tag
has been removed for well publicized reasons.

Should have the 0-day results in tomorrow morning. I'll shout
if anything else shows up.

Also rebased the togreg branch for the same reason (hadn't pushed it
out as anything other than testing, so hopefully no one was basing
anything significant on top)

Thanks,

Jonathan

> ---
>  MAINTAINERS|   6 +
>  drivers/firmware/arm_scmi/driver.c |   2 +-
>  drivers/iio/common/Kconfig |   1 +
>  drivers/iio/common/Makefile|   1 +
>  drivers/iio/common/scmi_sensors/Kconfig|  18 +
>  drivers/iio/common/scmi_sensors/Makefile   |   5 +
>  drivers/iio/common/scmi_sensors/scmi_iio.c | 683 +
>  7 files changed, 715 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
>  create mode 100644 drivers/iio/common/scmi_sensors/Makefile
>  create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d92f85ca831d..14227980f3d2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8692,6 +8692,12 @@ S: Maintained
>  F:   Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
>  F:   drivers/iio/multiplexer/iio-mux.c
>  
> +IIO SCMI BASED DRIVER
> +M:   Jyoti Bhayana 
> +L:   linux-...@vger.kernel.org
> +S:   Maintained
> +F:   drivers/iio/common/scmi_sensors/scmi_iio.c
> +
>  IIO SUBSYSTEM AND DRIVERS
>  M:   Jonathan Cameron 
>  R:   Lars-Peter Clausen 
> diff --git a/drivers/firmware/arm_scmi/driver.c 
> b/drivers/firmware/arm_scmi/driver.c
> index cacdf1589b10..3e748e57deab 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -741,7 +741,7 @@ static struct scmi_prot_devnames devnames[] = {
>   { SCMI_PROTOCOL_SYSTEM, { "syspower" },},
>   { SCMI_PROTOCOL_PERF,   { "cpufreq" },},
>   { SCMI_PROTOCOL_CLOCK,  { "clocks" },},
> - { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
> + { SCMI_PROTOCOL_SENSOR, { "hwmon", "iiodev" },},
>   { SCMI_PROTOCOL_RESET,  { "reset" },},
>   { SCMI_PROTOCOL_VOLTAGE,  { "regulator" },},
>  };
> diff --git a/drivers/iio/common/Kconfig b/drivers/iio/common/Kconfig
> index 2b9ee9161abd..0334b4954773 100644
> --- a/drivers/iio/common/Kconfig
> +++ b/drivers/iio/common/Kconfig
> @@ -6,5 +6,6 @@
>  source "drivers/iio/common/cros_ec_sensors/Kconfig"
>  source "drivers/iio/common/hid-sensors/Kconfig"
>  source "drivers/iio/common/ms_sensors/Kconfig"
> +source "drivers/iio/common/scmi_sensors/Kconfig"
>  source "drivers/iio/common/ssp_sensors/Kconfig"
>  source "drivers/iio/common/st_sensors/Kconfig"
> diff --git a/drivers/iio/common/Makefile b/drivers/iio/common/Makefile
> index 4bc30bb548e2..fad40e1e1718 100644
> --- a/drivers/iio/common/Makefile
> +++ b/drivers/iio/common/Makefile
> @@ -11,5 +11,6 @@
>  obj-y += cros_ec_sensors/
>  obj-y += hid-sensors/
>  obj-y += ms_sensors/
> +obj-y += scmi_sensors/
>  obj-y += ssp_sensors/
>  obj-y += st_sensors/
> diff --git a/drivers/iio/common/scmi_sensors/Kconfig 
> b/drivers/iio/common/scmi_sensors/Kconfig
> new file mode 100644
> index ..67e084cbb1ab
> --- /dev/null
> +++ b/drivers/iio/common/scmi_sensors/Kconfig
> @@ -0,0 +1,18 @@
> +#
> +# IIO over SCMI
> +#
> +# When adding new entries keep the list in alphabetical order
> +
> +menu "IIO SCMI Sensors"
> +
> +config IIO_SCMI
> + tristate "IIO SCMI"
> +depends on ARM_SCMI_PROTOCOL
> +select IIO_BUFFER
> +select IIO_KFIFO_BUF
> + help
> +  Say yes here to build support for IIO SCMI Driver.
> +  This provides ARM SCMI Protocol based IIO device.
> +  This driver provides support for accelerometer and gyroscope
> +  sensors available on SCMI based platforms.
> +endmenu
> diff --git a/drivers/iio/common/scmi_sensors/Makefile 
> b/drivers/iio/common/scmi_sensors/Makefile
> new file mode 100644
> index ..f13140a2575a
> --- /dev/null
> +++ b/drivers/iio/common/scmi_sensors/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX - License - Identifier : GPL - 2.0 - only
> +#
> +# Makefile for the IIO over SCMI
> +#
> +obj-$(CONFIG_IIO_SCMI) += scmi_iio.o
> diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c 
> b/drivers/iio/common/scmi_sensors/scmi_iio.c
> new file mode 100644
> index ..872d87ca6256
> --- /dev/null
> +++ 

Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-11 Thread Peter Hilber
On 10.03.21 18:19, Jyoti Bhayana wrote:
> Hi Peter,
> 
> As already discussed with ARM, the spec clearly mentions that it has
> to be uppercase and not case insensitive. So this patch is consistent
> with the specs and changing it with means that the spec would need to
> change as well. Therefore, there is no need for another version of the
> patch
> 
> "A NULL terminated UTF-8 format string with the sensor axis name, of
> up to 16 bytes. It is recommended that the name ends with ‘_’ followed
> by the axis of the sensor in uppercase.
> For example, the name for the x-axis of a triaxial accelerometer could
> be “acc_X” or “_X"
> 

My understanding of the part of the spec quoted above is different: The
spec only makes a recommendation and does allow additional or even
contradictory sensor axis naming schemes. So the change to the
implementation only would in principle be possible (disregarding
integration timeline constraints).

Best regards,

Peter

> Thanks,
> Jyoti
> 
> On Wed, Mar 10, 2021 at 3:16 AM Peter Hilber
>  wrote:
>>
>> On 10.03.21 00:12, Jyoti Bhayana wrote:
>>> This change provides ARM SCMI Protocol based IIO device.
>>> This driver provides support for Accelerometer and Gyroscope using
>>> SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
>>>
>>
>> [snip]
>>
>>> +
>>> +static int scmi_iio_get_chan_modifier(const char *name,
>>> +   enum iio_modifier *modifier)
>>> +{
>>> + char *pch, mod;
>>> +
>>> + if (!name)
>>> + return -EINVAL;
>>> +
>>> + pch = strrchr(name, '_');
>>> + if (!pch)
>>> + return -EINVAL;
>>> +
>>> + mod = *(pch + 1);
>>> + switch (mod) {
>>> + case 'X':
>>> + *modifier = IIO_MOD_X;
>>> + return 0;
>>> + case 'Y':
>>> + *modifier = IIO_MOD_Y;
>>> + return 0;
>>> + case 'Z':
>>> + *modifier = IIO_MOD_Z;
>>> + return 0;
>>> + default:
>>> + return -EINVAL;
>>> + }
>>> +}
>>> +
>>
>> Hi Jyoti,
>>
>> could you still change the above code to also accept lower case 'x',
>> 'y', 'z'?
>>
>> Supporting lower case as well would establish compatibility with the
>> lower case naming conventions used for IIO channels. By this change,
>> channels could be forwarded without name changes (as long as they fit
>> into the name field). I'm sorry to notice this only now.
>>
>> Best regards,
>>
>> Peter
>>
> 




Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-10 Thread Jyoti Bhayana
Hi Peter,

As already discussed with ARM, the spec clearly mentions that it has
to be uppercase and not case insensitive. So this patch is consistent
with the specs and changing it with means that the spec would need to
change as well. Therefore, there is no need for another version of the
patch

"A NULL terminated UTF-8 format string with the sensor axis name, of
up to 16 bytes. It is recommended that the name ends with ‘_’ followed
by the axis of the sensor in uppercase.
For example, the name for the x-axis of a triaxial accelerometer could
be “acc_X” or “_X"

Thanks,
Jyoti

On Wed, Mar 10, 2021 at 3:16 AM Peter Hilber
 wrote:
>
> On 10.03.21 00:12, Jyoti Bhayana wrote:
> > This change provides ARM SCMI Protocol based IIO device.
> > This driver provides support for Accelerometer and Gyroscope using
> > SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> >
>
> [snip]
>
> > +
> > +static int scmi_iio_get_chan_modifier(const char *name,
> > +   enum iio_modifier *modifier)
> > +{
> > + char *pch, mod;
> > +
> > + if (!name)
> > + return -EINVAL;
> > +
> > + pch = strrchr(name, '_');
> > + if (!pch)
> > + return -EINVAL;
> > +
> > + mod = *(pch + 1);
> > + switch (mod) {
> > + case 'X':
> > + *modifier = IIO_MOD_X;
> > + return 0;
> > + case 'Y':
> > + *modifier = IIO_MOD_Y;
> > + return 0;
> > + case 'Z':
> > + *modifier = IIO_MOD_Z;
> > + return 0;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
>
> Hi Jyoti,
>
> could you still change the above code to also accept lower case 'x',
> 'y', 'z'?
>
> Supporting lower case as well would establish compatibility with the
> lower case naming conventions used for IIO channels. By this change,
> channels could be forwarded without name changes (as long as they fit
> into the name field). I'm sorry to notice this only now.
>
> Best regards,
>
> Peter
>


Re: [PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-10 Thread Peter Hilber
On 10.03.21 00:12, Jyoti Bhayana wrote:
> This change provides ARM SCMI Protocol based IIO device.
> This driver provides support for Accelerometer and Gyroscope using
> SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification
> 

[snip]

> +
> +static int scmi_iio_get_chan_modifier(const char *name,
> +   enum iio_modifier *modifier)
> +{
> + char *pch, mod;
> +
> + if (!name)
> + return -EINVAL;
> +
> + pch = strrchr(name, '_');
> + if (!pch)
> + return -EINVAL;
> +
> + mod = *(pch + 1);
> + switch (mod) {
> + case 'X':
> + *modifier = IIO_MOD_X;
> + return 0;
> + case 'Y':
> + *modifier = IIO_MOD_Y;
> + return 0;
> + case 'Z':
> + *modifier = IIO_MOD_Z;
> + return 0;
> + default:
> + return -EINVAL;
> + }
> +}
> +

Hi Jyoti,

could you still change the above code to also accept lower case 'x',
'y', 'z'?

Supporting lower case as well would establish compatibility with the
lower case naming conventions used for IIO channels. By this change,
channels could be forwarded without name changes (as long as they fit
into the name field). I'm sorry to notice this only now.

Best regards,

Peter



[PATCH v7 1/1] iio/scmi: Adding support for IIO SCMI Based Sensors

2021-03-09 Thread Jyoti Bhayana
This change provides ARM SCMI Protocol based IIO device.
This driver provides support for Accelerometer and Gyroscope using
SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification

Reported-by: kernel test robot 
Signed-off-by: Jyoti Bhayana 
Link: https://lore.kernel.org/r/20210212172235.507028-2-jbhay...@google.com
Signed-off-by: Jonathan Cameron 
---
 MAINTAINERS|   6 +
 drivers/firmware/arm_scmi/driver.c |   2 +-
 drivers/iio/common/Kconfig |   1 +
 drivers/iio/common/Makefile|   1 +
 drivers/iio/common/scmi_sensors/Kconfig|  18 +
 drivers/iio/common/scmi_sensors/Makefile   |   5 +
 drivers/iio/common/scmi_sensors/scmi_iio.c | 683 +
 7 files changed, 715 insertions(+), 1 deletion(-)
 create mode 100644 drivers/iio/common/scmi_sensors/Kconfig
 create mode 100644 drivers/iio/common/scmi_sensors/Makefile
 create mode 100644 drivers/iio/common/scmi_sensors/scmi_iio.c

diff --git a/MAINTAINERS b/MAINTAINERS
index d92f85ca831d..14227980f3d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8692,6 +8692,12 @@ S:   Maintained
 F: Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt
 F: drivers/iio/multiplexer/iio-mux.c
 
+IIO SCMI BASED DRIVER
+M: Jyoti Bhayana 
+L: linux-...@vger.kernel.org
+S: Maintained
+F: drivers/iio/common/scmi_sensors/scmi_iio.c
+
 IIO SUBSYSTEM AND DRIVERS
 M: Jonathan Cameron 
 R: Lars-Peter Clausen 
diff --git a/drivers/firmware/arm_scmi/driver.c 
b/drivers/firmware/arm_scmi/driver.c
index cacdf1589b10..3e748e57deab 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -741,7 +741,7 @@ static struct scmi_prot_devnames devnames[] = {
{ SCMI_PROTOCOL_SYSTEM, { "syspower" },},
{ SCMI_PROTOCOL_PERF,   { "cpufreq" },},
{ SCMI_PROTOCOL_CLOCK,  { "clocks" },},
-   { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
+   { SCMI_PROTOCOL_SENSOR, { "hwmon", "iiodev" },},
{ SCMI_PROTOCOL_RESET,  { "reset" },},
{ SCMI_PROTOCOL_VOLTAGE,  { "regulator" },},
 };
diff --git a/drivers/iio/common/Kconfig b/drivers/iio/common/Kconfig
index 2b9ee9161abd..0334b4954773 100644
--- a/drivers/iio/common/Kconfig
+++ b/drivers/iio/common/Kconfig
@@ -6,5 +6,6 @@
 source "drivers/iio/common/cros_ec_sensors/Kconfig"
 source "drivers/iio/common/hid-sensors/Kconfig"
 source "drivers/iio/common/ms_sensors/Kconfig"
+source "drivers/iio/common/scmi_sensors/Kconfig"
 source "drivers/iio/common/ssp_sensors/Kconfig"
 source "drivers/iio/common/st_sensors/Kconfig"
diff --git a/drivers/iio/common/Makefile b/drivers/iio/common/Makefile
index 4bc30bb548e2..fad40e1e1718 100644
--- a/drivers/iio/common/Makefile
+++ b/drivers/iio/common/Makefile
@@ -11,5 +11,6 @@
 obj-y += cros_ec_sensors/
 obj-y += hid-sensors/
 obj-y += ms_sensors/
+obj-y += scmi_sensors/
 obj-y += ssp_sensors/
 obj-y += st_sensors/
diff --git a/drivers/iio/common/scmi_sensors/Kconfig 
b/drivers/iio/common/scmi_sensors/Kconfig
new file mode 100644
index ..67e084cbb1ab
--- /dev/null
+++ b/drivers/iio/common/scmi_sensors/Kconfig
@@ -0,0 +1,18 @@
+#
+# IIO over SCMI
+#
+# When adding new entries keep the list in alphabetical order
+
+menu "IIO SCMI Sensors"
+
+config IIO_SCMI
+   tristate "IIO SCMI"
+depends on ARM_SCMI_PROTOCOL
+select IIO_BUFFER
+select IIO_KFIFO_BUF
+   help
+  Say yes here to build support for IIO SCMI Driver.
+  This provides ARM SCMI Protocol based IIO device.
+  This driver provides support for accelerometer and gyroscope
+  sensors available on SCMI based platforms.
+endmenu
diff --git a/drivers/iio/common/scmi_sensors/Makefile 
b/drivers/iio/common/scmi_sensors/Makefile
new file mode 100644
index ..f13140a2575a
--- /dev/null
+++ b/drivers/iio/common/scmi_sensors/Makefile
@@ -0,0 +1,5 @@
+# SPDX - License - Identifier : GPL - 2.0 - only
+#
+# Makefile for the IIO over SCMI
+#
+obj-$(CONFIG_IIO_SCMI) += scmi_iio.o
diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c 
b/drivers/iio/common/scmi_sensors/scmi_iio.c
new file mode 100644
index ..872d87ca6256
--- /dev/null
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -0,0 +1,683 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * System Control and Management Interface(SCMI) based IIO sensor driver
+ *
+ * Copyright (C) 2021 Google LLC
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SCMI_IIO_NUM_OF_AXIS 3
+
+struct scmi_iio_priv {
+   struct scmi_handle *handle;
+   const struct scmi_sensor_info *sensor_info;
+   struct iio_dev *indio_dev;
+   /* adding one additional channel for timestamp */
+   s64 iio_buf[SCMI_IIO_NUM_OF_AXIS + 1];
+   struct notifier_block sensor_update_nb;
+   u32 *freq_avail;
+};
+
+static int