Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: accel: Change adxl345 depend to negate adxl35x
@ 2025-10-31 10:05 Jorge Marques
  2025-10-31 10:13 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Jorge Marques @ 2025-10-31 10:05 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: linux-iio, linux-kernel, gastmaier, Jorge Marques

Change 'depends on INPUT_ADXL34X=n' to '!(INPUT_ADXL34X)' to allow both
drivers to be compiled as modules. The user then can use the blacklist
to block loading one.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
There are two drivers for the compatible:

- adi,adxl345

* IIO: 
  drivers/iio/accel/adxl345_core.c
  drivers/iio/accel/adxl345_spi.c
  drivers/iio/accel/adxl345_i2c.c
* Inputs:
  drivers/input/misc/adxl34x-spi.c
  drivers/input/misc/adxl34x-i2c.c

To disallows both being complied, the depends INPUT_ADXL34X=n
was added to ADXL345 symbols. However, it should be possible to compile
both as modules, then blacklist one of them in the /etc/modprobe.d/blacklist.conf
file. This patch changes the rule to !(INPUT_ADXL34X) to allow both as
modules, but still disallow INPUT_ADXL34X to be built-in and ADXL345 as
module.

The following compatibles are not shared between both drivers:

* IIO:
  adi,adxl375 spi/i2c
* Inputs:
  adi,adxl34x i2c
---
 drivers/iio/accel/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 76911278fb217..f657acba5ab7d 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -64,7 +64,7 @@ config ADXL345
 
 config ADXL345_I2C
 	tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer I2C Driver"
-	depends on INPUT_ADXL34X=n
+	depends on !INPUT_ADXL34X
 	depends on I2C
 	select ADXL345
 	select REGMAP_I2C
@@ -78,7 +78,7 @@ config ADXL345_I2C
 
 config ADXL345_SPI
 	tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer SPI Driver"
-	depends on INPUT_ADXL34X=n
+	depends on !INPUT_ADXL34X
 	depends on SPI
 	select ADXL345
 	select REGMAP_SPI

---
base-commit: 70437bbd7529e9860fb7f0c92a89e0e6abaa994e
change-id: 20251031-adxl345-allow-adxl34x-mod-8c3b11cb54c6

Best regards,
-- 
Jorge Marques <jorge.marques@analog.com>


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

* Re: [PATCH] iio: accel: Change adxl345 depend to negate adxl35x
  2025-10-31 10:05 [PATCH] iio: accel: Change adxl345 depend to negate adxl35x Jorge Marques
@ 2025-10-31 10:13 ` Andy Shevchenko
  2025-11-12 21:37   ` Jorge Marques
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-10-31 10:13 UTC (permalink / raw)
  To: Jorge Marques
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-kernel, gastmaier

On Fri, Oct 31, 2025 at 11:05:08AM +0100, Jorge Marques wrote:
> Change 'depends on INPUT_ADXL34X=n' to '!(INPUT_ADXL34X)' to allow both
> drivers to be compiled as modules. The user then can use the blacklist
> to block loading one.

> ---
> There are two drivers for the compatible:
> 
> - adi,adxl345
> 
> * IIO: 
>   drivers/iio/accel/adxl345_core.c
>   drivers/iio/accel/adxl345_spi.c
>   drivers/iio/accel/adxl345_i2c.c
> * Inputs:
>   drivers/input/misc/adxl34x-spi.c
>   drivers/input/misc/adxl34x-i2c.c
> 
> To disallows both being complied, the depends INPUT_ADXL34X=n
> was added to ADXL345 symbols. However, it should be possible to compile
> both as modules, then blacklist one of them in the /etc/modprobe.d/blacklist.conf
> file. This patch changes the rule to !(INPUT_ADXL34X) to allow both as
> modules, but still disallow INPUT_ADXL34X to be built-in and ADXL345 as
> module.
> 
> The following compatibles are not shared between both drivers:
> 
> * IIO:
>   adi,adxl375 spi/i2c
> * Inputs:
>   adi,adxl34x i2c

I like the idea, but I think this needs to be clearly stated in the Kconfig
help for both symbols. So user will _know_ that in such a case it's their
responsibility of properly made choice. On top of that you might want to
investigate existing DTS in the kernel and see if some of the choices may be
made at the platform / CPU level.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] iio: accel: Change adxl345 depend to negate adxl35x
  2025-10-31 10:13 ` Andy Shevchenko
@ 2025-11-12 21:37   ` Jorge Marques
  0 siblings, 0 replies; 3+ messages in thread
From: Jorge Marques @ 2025-11-12 21:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jorge Marques, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

On Fri, Oct 31, 2025 at 12:13:39PM +0200, Andy Shevchenko wrote:
> On Fri, Oct 31, 2025 at 11:05:08AM +0100, Jorge Marques wrote:
> > Change 'depends on INPUT_ADXL34X=n' to '!(INPUT_ADXL34X)' to allow both
> > drivers to be compiled as modules. The user then can use the blacklist
> > to block loading one.
> 
> > ---
> > There are two drivers for the compatible:
> > 
> > - adi,adxl345
> > 
> > * IIO: 
> >   drivers/iio/accel/adxl345_core.c
> >   drivers/iio/accel/adxl345_spi.c
> >   drivers/iio/accel/adxl345_i2c.c
> > * Inputs:
> >   drivers/input/misc/adxl34x-spi.c
> >   drivers/input/misc/adxl34x-i2c.c
> > 
> > To disallows both being complied, the depends INPUT_ADXL34X=n
> > was added to ADXL345 symbols. However, it should be possible to compile
> > both as modules, then blacklist one of them in the /etc/modprobe.d/blacklist.conf
> > file. This patch changes the rule to !(INPUT_ADXL34X) to allow both as
> > modules, but still disallow INPUT_ADXL34X to be built-in and ADXL345 as
> > module.
> > 
> > The following compatibles are not shared between both drivers:
> > 
> > * IIO:
> >   adi,adxl375 spi/i2c
> > * Inputs:
> >   adi,adxl34x i2c
> 
> I like the idea, but I think this needs to be clearly stated in the Kconfig
> help for both symbols. So user will _know_ that in such a case it's their
> responsibility of properly made choice. On top of that you might want to
> investigate existing DTS in the kernel and see if some of the choices may be
> made at the platform / CPU level.

Sure, I will add a info for the user in the symbols. I think the choice
is on the defconfig that the user uses, the driver is a accelerometer,
but one exposes as an IIO device while the other as input (e.g., for
screen rotation).

Best regards,
Jorge
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

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

end of thread, other threads:[~2025-11-12 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 10:05 [PATCH] iio: accel: Change adxl345 depend to negate adxl35x Jorge Marques
2025-10-31 10:13 ` Andy Shevchenko
2025-11-12 21:37   ` Jorge Marques

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