mbox series

[v2,0/3] Add ST lsm6dso i3c support

Message ID cover.1559831663.git.vitor.soares@synopsys.com (mailing list archive)
Headers show
Series Add ST lsm6dso i3c support | expand

Message

Vitor Soares June 6, 2019, 3:12 p.m. UTC
This patch series add i3c support for STM LSM6DSO and LSM6DSR sensors.

It is also introduced i3c support on regmap api. Due the lack of
i3c devices HDR capables on the market the support for now is only for
i3c sdr mode by using i3c_device_do_priv_xfers() method.

Changes in v2:
  Change i3c_get_device_id() to drivers/i3c/device.c
  Add support for LSM6DSR

Vitor Soares (3):
  regmap: add i3c bus support
  i3c: Add i3c_get_device_id helper
  iio: imu: st_lsm6dsx: add i3c basic support for LSM6DSO and LSM6DSR

 drivers/base/regmap/Kconfig                 |  6 ++-
 drivers/base/regmap/Makefile                |  1 +
 drivers/base/regmap/regmap-i3c.c            | 60 +++++++++++++++++++++++
 drivers/i3c/device.c                        |  8 +++
 drivers/iio/imu/st_lsm6dsx/Kconfig          |  8 ++-
 drivers/iio/imu/st_lsm6dsx/Makefile         |  1 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c | 76 +++++++++++++++++++++++++++++
 include/linux/i3c/device.h                  |  1 +
 include/linux/regmap.h                      | 20 ++++++++
 9 files changed, 179 insertions(+), 2 deletions(-)
 create mode 100644 drivers/base/regmap/regmap-i3c.c
 create mode 100644 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c

Comments

Boris Brezillon June 6, 2019, 3:17 p.m. UTC | #1
On Thu,  6 Jun 2019 17:12:03 +0200
Vitor Soares <Vitor.Soares@synopsys.com> wrote:

> This helper return the i3c_device_id structure in order the client
> have access to the driver data.
> 
> Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
> ---
> Changes in v2:
>   move this function to drivers/i3c/device.c
> 
>  drivers/i3c/device.c       | 8 ++++++++
>  include/linux/i3c/device.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c
> index 69cc040..a6d0796 100644
> --- a/drivers/i3c/device.c
> +++ b/drivers/i3c/device.c
> @@ -200,6 +200,14 @@ struct i3c_device *dev_to_i3cdev(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(dev_to_i3cdev);
>  
> +const struct i3c_device_id *i3c_get_device_id(struct i3c_device *i3cdev)
> +{
> +	const struct i3c_driver *i3cdrv = drv_to_i3cdrv(i3cdev->dev.driver);
> +
> +	return i3cdrv->id_table;
> +}
> +EXPORT_SYMBOL_GPL(i3c_get_device_id);

That's not what I asked. I told you to expose i3c_device_match_id()
which already exists and is in master.c. What you really want is to get
the device_id entry that matches your device, not the first entry in
the table...

> +
>  /**
>   * i3c_driver_register_with_owner() - register an I3C device driver
>   *
> diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h
> index 5ecb055..e0415e1 100644
> --- a/include/linux/i3c/device.h
> +++ b/include/linux/i3c/device.h
> @@ -187,6 +187,7 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct device_driver *drv)
>  
>  struct device *i3cdev_to_dev(struct i3c_device *i3cdev);
>  struct i3c_device *dev_to_i3cdev(struct device *dev);
> +const struct i3c_device_id *i3c_get_device_id(struct i3c_device *i3cdev);
>  
>  static inline void i3cdev_set_drvdata(struct i3c_device *i3cdev,
>  				      void *data)
Wolfram Sang June 6, 2019, 4:25 p.m. UTC | #2
On Thu, Jun 06, 2019 at 05:12:01PM +0200, Vitor Soares wrote:
> This patch series add i3c support for STM LSM6DSO and LSM6DSR sensors.

Why is the I2C list on CC? Is there something relevant I missed?
Vitor Soares June 6, 2019, 4:42 p.m. UTC | #3
Hi Wolfram,

I think I2C ecosystem is also part interested in I3C due the 
compatibility and maybe they can provide some feedback.
If you think differently, sorry I will remove I2C list next time.

Regards,
Vitor Soares

From: Wolfram Sang <wsa@the-dreams.de>
Date: Thu, Jun 06, 2019 at 17:25:23

> On Thu, Jun 06, 2019 at 05:12:01PM +0200, Vitor Soares wrote:
> > This patch series add i3c support for STM LSM6DSO and LSM6DSR sensors.
> 
> Why is the I2C list on CC? Is there something relevant I missed?
Vitor Soares June 6, 2019, 4:58 p.m. UTC | #4
Hi Boris,

From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Thu, Jun 06, 2019 at 16:17:55

> On Thu,  6 Jun 2019 17:12:03 +0200
> Vitor Soares <Vitor.Soares@synopsys.com> wrote:
> 
> > This helper return the i3c_device_id structure in order the client
> > have access to the driver data.
> > 
> > Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
> > ---
> > Changes in v2:
> >   move this function to drivers/i3c/device.c
> > 
> >  drivers/i3c/device.c       | 8 ++++++++
> >  include/linux/i3c/device.h | 1 +
> >  2 files changed, 9 insertions(+)
> > 
> > diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c
> > index 69cc040..a6d0796 100644
> > --- a/drivers/i3c/device.c
> > +++ b/drivers/i3c/device.c
> > @@ -200,6 +200,14 @@ struct i3c_device *dev_to_i3cdev(struct device *dev)
> >  }
> >  EXPORT_SYMBOL_GPL(dev_to_i3cdev);
> >  
> > +const struct i3c_device_id *i3c_get_device_id(struct i3c_device *i3cdev)
> > +{
> > +	const struct i3c_driver *i3cdrv = drv_to_i3cdrv(i3cdev->dev.driver);
> > +
> > +	return i3cdrv->id_table;
> > +}
> > +EXPORT_SYMBOL_GPL(i3c_get_device_id);
> 
> That's not what I asked. I told you to expose i3c_device_match_id()
> which already exists and is in master.c. What you really want is to get
> the device_id entry that matches your device, not the first entry in
> the table...
> 

I didn't see it has the full table.
I will change it.

> > +
> >  /**
> >   * i3c_driver_register_with_owner() - register an I3C device driver
> >   *
> > diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h
> > index 5ecb055..e0415e1 100644
> > --- a/include/linux/i3c/device.h
> > +++ b/include/linux/i3c/device.h
> > @@ -187,6 +187,7 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct device_driver *drv)
> >  
> >  struct device *i3cdev_to_dev(struct i3c_device *i3cdev);
> >  struct i3c_device *dev_to_i3cdev(struct device *dev);
> > +const struct i3c_device_id *i3c_get_device_id(struct i3c_device *i3cdev);
> >  
> >  static inline void i3cdev_set_drvdata(struct i3c_device *i3cdev,
> >  				      void *data)
Wolfram Sang June 6, 2019, 6:01 p.m. UTC | #5
Hi,

> I think I2C ecosystem is also part interested in I3C due the 
> compatibility and maybe they can provide some feedback.
> If you think differently, sorry I will remove I2C list next time.

No worries, but please do remove next time, for two reasons:

a) even for I2C clients, the i2c-list is usually not added if the client
   only uses standard I2C communication. If there is something which
   needw special attention, OK. But most of the time, the list is for the
   I2C core and bus master drivers, and not clients.

  (That might be different for I3C, though...)

b) if the patch in question is "self-contained" in the I3C world and not
   affecting I2C, I think there is no need to add I2C. Interested
   parties can subscribe to the I3C list.

Yes, that was a good occasion to write this publicly.

Thanks,

   Wolfram
Vitor Soares June 11, 2019, 11:42 a.m. UTC | #6
Hi,

Since the regmap-i3c.c was already applied in:
  https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 
tags/regmap-i3c

I wonder what is clean way to submit this patch set?

And since the i3c-regmap was merge in 
From: Vitor Soares <vitor.soares@synopsys.com>
Date: Thu, Jun 06, 2019 at 16:12:01

> This patch series add i3c support for STM LSM6DSO and LSM6DSR sensors.
> 
> It is also introduced i3c support on regmap api. Due the lack of
> i3c devices HDR capables on the market the support for now is only for
> i3c sdr mode by using i3c_device_do_priv_xfers() method.
> 
> Changes in v2:
>   Change i3c_get_device_id() to drivers/i3c/device.c
>   Add support for LSM6DSR
> 
> Vitor Soares (3):
>   regmap: add i3c bus support
>   i3c: Add i3c_get_device_id helper
>   iio: imu: st_lsm6dsx: add i3c basic support for LSM6DSO and LSM6DSR
> 
>  drivers/base/regmap/Kconfig                 |  6 ++-
>  drivers/base/regmap/Makefile                |  1 +
>  drivers/base/regmap/regmap-i3c.c            | 60 +++++++++++++++++++++++
>  drivers/i3c/device.c                        |  8 +++
>  drivers/iio/imu/st_lsm6dsx/Kconfig          |  8 ++-
>  drivers/iio/imu/st_lsm6dsx/Makefile         |  1 +
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c | 76 +++++++++++++++++++++++++++++
>  include/linux/i3c/device.h                  |  1 +
>  include/linux/regmap.h                      | 20 ++++++++
>  9 files changed, 179 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/base/regmap/regmap-i3c.c
>  create mode 100644 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c
> 
> -- 
> 2.7.4

Best regards,
Vitor Soares
Mark Brown June 13, 2019, 6:38 p.m. UTC | #7
On Tue, Jun 11, 2019 at 11:42:50AM +0000, Vitor Soares wrote:

> Since the regmap-i3c.c was already applied in:
>   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 
> tags/regmap-i3c

> I wonder what is clean way to submit this patch set?

Just mention in the cover letter that it depends on that tag, the point
with the tag is to allow other trees to pull it in if they need it.