Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] iio: gyro: bmg160: Improve BMG160 driver with of_match_table support
@ 2025-02-20 16:49 Jun Yan
  2025-02-20 16:50 ` [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table Jun Yan
  2025-02-20 16:50 ` [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table Jun Yan
  0 siblings, 2 replies; 6+ messages in thread
From: Jun Yan @ 2025-02-20 16:49 UTC (permalink / raw)
  To: jic23; +Cc: lars, linux-iio, linux-kernel, Jun Yan

This patch set enhances BMG160 gyro driver and improve device-tree compatibility.

--- 
Changes in v2
- Fix a syntax error (a missing comma after the .of_match_table = bmg160_of_match).
- Fix the style issues found by checkpatch.pl.
- Link to v1: https://lore.kernel.org/linux-iio/20250219150254.24664-1-jerrysteve1101@gmail.com/
---

Jun Yan (2):
  iio: gyro: bmg160_spi: add of_match_table
  iio: gyro: bmg160_i2c: add BMI088 to of_match_table

 drivers/iio/gyro/bmg160_i2c.c |  1 +
 drivers/iio/gyro/bmg160_spi.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table
  2025-02-20 16:49 [PATCH v2 0/2] iio: gyro: bmg160: Improve BMG160 driver with of_match_table support Jun Yan
@ 2025-02-20 16:50 ` Jun Yan
  2025-02-22 16:37   ` Jonathan Cameron
  2025-02-20 16:50 ` [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table Jun Yan
  1 sibling, 1 reply; 6+ messages in thread
From: Jun Yan @ 2025-02-20 16:50 UTC (permalink / raw)
  To: jic23; +Cc: lars, linux-iio, linux-kernel, Jun Yan

Add of_match_table to bmg160_spi driver.

This fixes automatic driver loading by userspace
When using the device tree and the driver is built
as a module, devices can be probed.

Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
---
 drivers/iio/gyro/bmg160_spi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/iio/gyro/bmg160_spi.c b/drivers/iio/gyro/bmg160_spi.c
index fc2e453527b9..ac04b3b1b554 100644
--- a/drivers/iio/gyro/bmg160_spi.c
+++ b/drivers/iio/gyro/bmg160_spi.c
@@ -41,9 +41,19 @@ static const struct spi_device_id bmg160_spi_id[] = {
 
 MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
 
+static const struct of_device_id bmg160_of_match[] = {
+	{ .compatible = "bosch,bmg160" },
+	{ .compatible = "bosch,bmi055_gyro" },
+	{ .compatible = "bosch,bmi088_gyro" },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, bmg160_of_match);
+
 static struct spi_driver bmg160_spi_driver = {
 	.driver = {
 		.name	= "bmg160_spi",
+		.of_match_table = bmg160_of_match,
 		.pm	= &bmg160_pm_ops,
 	},
 	.probe		= bmg160_spi_probe,
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table
  2025-02-20 16:49 [PATCH v2 0/2] iio: gyro: bmg160: Improve BMG160 driver with of_match_table support Jun Yan
  2025-02-20 16:50 ` [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table Jun Yan
@ 2025-02-20 16:50 ` Jun Yan
  2025-02-22 16:40   ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Jun Yan @ 2025-02-20 16:50 UTC (permalink / raw)
  To: jic23; +Cc: lars, linux-iio, linux-kernel, Jun Yan

BMI088 is missing from the of_match_table. Let's complete it.

Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
---
 drivers/iio/gyro/bmg160_i2c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/gyro/bmg160_i2c.c b/drivers/iio/gyro/bmg160_i2c.c
index 9c5d7e8ee99c..e6caab49f98a 100644
--- a/drivers/iio/gyro/bmg160_i2c.c
+++ b/drivers/iio/gyro/bmg160_i2c.c
@@ -58,6 +58,7 @@ MODULE_DEVICE_TABLE(i2c, bmg160_i2c_id);
 static const struct of_device_id bmg160_of_match[] = {
 	{ .compatible = "bosch,bmg160" },
 	{ .compatible = "bosch,bmi055_gyro" },
+	{ .compatible = "bosch,bmi088_gyro" },
 	{ }
 };
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table
  2025-02-20 16:50 ` [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table Jun Yan
@ 2025-02-22 16:37   ` Jonathan Cameron
  2025-03-06 14:18     ` yjun
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2025-02-22 16:37 UTC (permalink / raw)
  To: Jun Yan; +Cc: lars, linux-iio, linux-kernel

On Fri, 21 Feb 2025 00:50:00 +0800
Jun Yan <jerrysteve1101@gmail.com> wrote:

> Add of_match_table to bmg160_spi driver.
> 
> This fixes automatic driver loading by userspace
> When using the device tree and the driver is built
> as a module, devices can be probed.
Wrap patch descriptions at 75 chars as mentioned in submitting-patches.rst

> 
> Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Hi.

The patch content is fine, but I'm doubtful about the autoloading.
Did you actually try this and see a failure without this patch?

For SPI autoloading even with device tree compatibles should work without
the of_match_table though it will match against the compatible without
the bosch, part.  Maybe I missed a change that means that no longer
works.

I in general don't mind the actual change because it does ensure
we have the manufacturer in the match as well so makes future
problems less likely.

Jonathan



> ---
>  drivers/iio/gyro/bmg160_spi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/iio/gyro/bmg160_spi.c b/drivers/iio/gyro/bmg160_spi.c
> index fc2e453527b9..ac04b3b1b554 100644
> --- a/drivers/iio/gyro/bmg160_spi.c
> +++ b/drivers/iio/gyro/bmg160_spi.c
> @@ -41,9 +41,19 @@ static const struct spi_device_id bmg160_spi_id[] = {
>  
>  MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
>  
> +static const struct of_device_id bmg160_of_match[] = {
> +	{ .compatible = "bosch,bmg160" },
> +	{ .compatible = "bosch,bmi055_gyro" },
> +	{ .compatible = "bosch,bmi088_gyro" },
> +	{ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, bmg160_of_match);
> +
>  static struct spi_driver bmg160_spi_driver = {
>  	.driver = {
>  		.name	= "bmg160_spi",
> +		.of_match_table = bmg160_of_match,
>  		.pm	= &bmg160_pm_ops,
>  	},
>  	.probe		= bmg160_spi_probe,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table
  2025-02-20 16:50 ` [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table Jun Yan
@ 2025-02-22 16:40   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-02-22 16:40 UTC (permalink / raw)
  To: Jun Yan; +Cc: lars, linux-iio, linux-kernel

On Fri, 21 Feb 2025 00:50:01 +0800
Jun Yan <jerrysteve1101@gmail.com> wrote:

> BMI088 is missing from the of_match_table. Let's complete it.
> 
> Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Applied this patch. I'll initially push out as testing for 0-day to
see if it can find any problems.

Thanks,

Jonathan
> ---
>  drivers/iio/gyro/bmg160_i2c.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/gyro/bmg160_i2c.c b/drivers/iio/gyro/bmg160_i2c.c
> index 9c5d7e8ee99c..e6caab49f98a 100644
> --- a/drivers/iio/gyro/bmg160_i2c.c
> +++ b/drivers/iio/gyro/bmg160_i2c.c
> @@ -58,6 +58,7 @@ MODULE_DEVICE_TABLE(i2c, bmg160_i2c_id);
>  static const struct of_device_id bmg160_of_match[] = {
>  	{ .compatible = "bosch,bmg160" },
>  	{ .compatible = "bosch,bmi055_gyro" },
> +	{ .compatible = "bosch,bmi088_gyro" },
>  	{ }
>  };
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table
  2025-02-22 16:37   ` Jonathan Cameron
@ 2025-03-06 14:18     ` yjun
  0 siblings, 0 replies; 6+ messages in thread
From: yjun @ 2025-03-06 14:18 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: lars, linux-iio, linux-kernel

I'm sorry. The commit message was referenced from other similar
submissions and hasn't been actually verified. I will resubmit the
patch in V3.

On Sun, Feb 23, 2025 at 12:37 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Fri, 21 Feb 2025 00:50:00 +0800
> Jun Yan <jerrysteve1101@gmail.com> wrote:
>
> > Add of_match_table to bmg160_spi driver.
> >
> > This fixes automatic driver loading by userspace
> > When using the device tree and the driver is built
> > as a module, devices can be probed.
> Wrap patch descriptions at 75 chars as mentioned in submitting-patches.rst
>
> >
> > Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
> Hi.
>
> The patch content is fine, but I'm doubtful about the autoloading.
> Did you actually try this and see a failure without this patch?
>
> For SPI autoloading even with device tree compatibles should work without
> the of_match_table though it will match against the compatible without
> the bosch, part.  Maybe I missed a change that means that no longer
> works.
>
> I in general don't mind the actual change because it does ensure
> we have the manufacturer in the match as well so makes future
> problems less likely.
>
> Jonathan
>
>
>
> > ---
> >  drivers/iio/gyro/bmg160_spi.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/iio/gyro/bmg160_spi.c b/drivers/iio/gyro/bmg160_spi.c
> > index fc2e453527b9..ac04b3b1b554 100644
> > --- a/drivers/iio/gyro/bmg160_spi.c
> > +++ b/drivers/iio/gyro/bmg160_spi.c
> > @@ -41,9 +41,19 @@ static const struct spi_device_id bmg160_spi_id[] = {
> >
> >  MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
> >
> > +static const struct of_device_id bmg160_of_match[] = {
> > +     { .compatible = "bosch,bmg160" },
> > +     { .compatible = "bosch,bmi055_gyro" },
> > +     { .compatible = "bosch,bmi088_gyro" },
> > +     { }
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, bmg160_of_match);
> > +
> >  static struct spi_driver bmg160_spi_driver = {
> >       .driver = {
> >               .name   = "bmg160_spi",
> > +             .of_match_table = bmg160_of_match,
> >               .pm     = &bmg160_pm_ops,
> >       },
> >       .probe          = bmg160_spi_probe,
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-06 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 16:49 [PATCH v2 0/2] iio: gyro: bmg160: Improve BMG160 driver with of_match_table support Jun Yan
2025-02-20 16:50 ` [PATCH v2 1/2] iio: gyro: bmg160_spi: add of_match_table Jun Yan
2025-02-22 16:37   ` Jonathan Cameron
2025-03-06 14:18     ` yjun
2025-02-20 16:50 ` [PATCH v2 2/2] iio: gyro: bmg160_i2c: add BMI088 to of_match_table Jun Yan
2025-02-22 16:40   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox