Skip to contentSkip to conversation

iio: accel: adxl345: Split driver into core and I2C then add SPI support

PATCH Superseded Eva Rachel Retuya 5 participants 18 messages Feb 22, 2017 – Feb 25, 2017

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover iio: accel: adxl345: Split driver into core and I2C then add SPI support

This patchset modifies the adxl345 to use regmap. In doing so, we can easily introduce SPI support and let regmap handle the rest.

Recap of basic features: read_raw for x, y and z axes, scale. After applying this series, driver now supports the SPI protocol and enumeration of device via device tree.

Changes from v2:
* Drop PATCH 4 iio: accel: adxl345: Add ACPI support
* Add OF match table on both I2C and SPI files and document them

Changes from v1:
iio: accel: adxl345: Use I2C regmap instead of direct I2C access
* Move other deletions from patch 2 in here -- make it clear what got deleted and/or modified that is hard to see previously
* Introduce the driver header file "adxl345.h" here instead of doing it in the next patch
* Completely omit traces of i2c_client and let this file (adxl345.c) mirror the core file on the next patch.
* Improve debugging print about invalid device ID in probe.
iio: accel: adxl345: Split driver into core and I2C
* Update Kconfig to Jonathan's preferred style
* Improve similarity index from 78% to 100% (rename detection)
iio: accel: adxl345: Add ACPI support
* Correct acpi_device_id: ADX0345 -> ADS0345

Eva Rachel Retuya (4):
Documentation: dt-bindings: Document ADXL345 accelerometer binding
iio: accel: adxl345: Use I2C regmap instead of direct I2C access
iio: accel: adxl345: Split driver into core and I2C
iio: accel: adxl345: Add SPI support

 .../devicetree/bindings/iio/accel/adxl345.txt      |  38 ++++
 drivers/iio/accel/Kconfig                          |  18 +-
 drivers/iio/accel/Makefile                         |   4 +-
 drivers/iio/accel/adxl345.c                        | 194 ---------------------
 drivers/iio/accel/adxl345.h                        |  18 ++
 drivers/iio/accel/adxl345_core.c                   | 182 +++++++++++++++++++
 drivers/iio/accel/adxl345_i2c.c                    |  81 +++++++++
 drivers/iio/accel/adxl345_spi.c                    |  86 +++++++++
 8 files changed, 423 insertions(+), 198 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/adxl345.txt
 delete mode 100644 drivers/iio/accel/adxl345.c
 create mode 100644 drivers/iio/accel/adxl345.h
 create mode 100644 drivers/iio/accel/adxl345_core.c
 create mode 100644 drivers/iio/accel/adxl345_i2c.c
 create mode 100644 drivers/iio/accel/adxl345_spi.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/4 Documentation: dt-bindings: Document ADXL345 accelerometer binding

Add the device tree binding documentation for the ADXL345 3-axis digital accelerometer.

---
Change from v2:
* Add OF match table on both I2C and SPI files and document them

 .../devicetree/bindings/iio/accel/adxl345.txt      | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/adxl345.txt
Documentation/devicetree/bindings/iio/accel/adxl345.txt new file +38 -0
new file mode 100644
index 0000000..e623f4a
@@ -0,0 +1,38 @@
+Analog Devices ADXL345 3-Axis, +/-(2g/4g/8g/16g) Digital Accelerometer
+
+http://www.analog.com/en/products/mems/accelerometers/adxl345.html
+
+Required properties:
+ - compatible : should be "adi,adxl345"
+ - reg : the I2C address or SPI chip select number of the sensor
+
+Required properties for SPI bus usage:
+ - spi-max-frequency : set maximum clock frequency, must be 5000000
+ - spi-cpol and spi-cpha : must be defined for adxl345 to enable SPI mode 3
+
+Optional properties:
+ - interrupt-parent : phandle to the parent interrupt controller as documented
+   in Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+ - interrupts: interrupt mapping for IRQ as documented in
+   Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+
+Example for a I2C device node:
+
+	adxl345@2a {
+		compatible = "adi,adxl345";
+		reg = <0x53>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
+Example for a SPI device node:
+
+	adxl345@0 {
+		compatible = "adi,adxl345";
+		reg = <0>;
+		spi-max-frequency = <5000000>;
+		spi-cpol;
+		spi-cpha;
+		interrupt-parent = <&gpio1>;
+		interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+	};
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/4 iio: accel: adxl345: Use I2C regmap instead of direct I2C access

In reply to Eva Rachel Retuya

Convert the driver to use regmap instead of I2C-specific functions. Also, introduce the header file "adxl345.h" and export the probe and remove functions. This is done in preparation for splitting this driver into core and I2C-specific code as well as introduction of SPI driver.

---
Change from v2:
* None

Changes from v1:
* Move other deletions from patch 2 in here -- make it clear what got deleted and/or modified that is hard to see previously
* Introduce the driver header file "adxl345.h" here instead of doing it in the next patch
* Completely omit traces of i2c_client and let this file (adxl345.c) mirror the core file on the next patch.
* Improve debugging print about invalid device ID in probe.

 drivers/iio/accel/Kconfig   |  1 +
 drivers/iio/accel/adxl345.c | 88 ++++++++++++++++++++-------------------------
 drivers/iio/accel/adxl345.h | 18 ++++++++++
 3 files changed, 57 insertions(+), 50 deletions(-)
 create mode 100644 drivers/iio/accel/adxl345.h
drivers/iio/accel/Kconfig +1 -0
index 2308bac..26b8614 100644
@@ -9,6 +9,7 @@ config ADXL345
 	tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer Driver"
 	depends on !(INPUT_ADXL34X=y || INPUT_ADXL34X=m)
 	depends on I2C
+	select REGMAP_I2C
 	help
 	  Say Y here if you want to build support for the Analog Devices
 	  ADXL345 3-axis digital accelerometer.
drivers/iio/accel/adxl345.c +38 -50

174 lines not on this page · raw message

drivers/iio/accel/adxl345.h new file +18 -0
new file mode 100644
index 0000000..fca3e25
@@ -0,0 +1,18 @@
+/*
+ * ADXL345 3-Axis Digital Accelerometer
+ *
+ * Copyright (c) 2017 Eva Rachel Retuya <[email protected]>
+ *
+ * This file is subject to the terms and conditions of version 2 of
+ * the GNU General Public License. See the file COPYING in the main
+ * directory of this archive for more details.
+ */
+
+#ifndef _ADXL345_H_
+#define _ADXL345_H_
+
+int adxl345_common_probe(struct device *dev, struct regmap *regmap,
+			 const char *name);
+int adxl345_common_remove(struct device *dev);
+
+#endif /* _ADXL345_H_ */
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v3 2/4] iio: accel: adxl345: Use I2C regmap instead of direct I2C access

Quoted 6 lines · Eva Rachel Retuya

Convert the driver to use regmap instead of I2C-specific functions. Also, introduce the header file "adxl345.h" and export the probe and remove functions. This is done in preparation for splitting this driver into core and I2C-specific code as well as introduction of SPI driver.

Is it possible to use device just after this very patch? For me it seems there is bisectability issue.

Quoted 18 lines
drivers/iio/accel/adxl345.c +1 -17
-static const struct i2c_device_id adxl345_i2c_id[] = {
-       { "adxl345", 0 },
-       { }
-};
-
-MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
-
-static struct i2c_driver adxl345_driver = {
-       .driver = {
-               .name   = "adxl345",
-       },
-       .probe          = adxl345_probe,
-       .remove         = adxl345_remove,
-       .id_table       = adxl345_i2c_id,
-};
-
-module_i2c_driver(adxl345_driver);
+EXPORT_SYMBOL_GPL(adxl345_common_remove);
Signature · 6 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

Re: [PATCH v3 2/4] iio: accel: adxl345: Use I2C regmap instead of direct I2C access

Quoted 11 lines · Andy Shevchenko
Quoted 6 lines · Eva Rachel Retuya

Convert the driver to use regmap instead of I2C-specific functions. Also, introduce the header file "adxl345.h" and export the probe and remove functions. This is done in preparation for splitting this driver into core and I2C-specific code as well as introduction of SPI driver.

Is it possible to use device just after this very patch? For me it seems there is bisectability issue.

Hello Andy,

Most likely no because of excessive deletion. Sorry for the mistake, I'll submit another version that hopefully won't cause this issue.

Thanks,
Eva

Quoted 22 lines
Quoted 18 lines
drivers/iio/accel/adxl345.c +1 -17
-static const struct i2c_device_id adxl345_i2c_id[] = {
-       { "adxl345", 0 },
-       { }
-};
-
-MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
-
-static struct i2c_driver adxl345_driver = {
-       .driver = {
-               .name   = "adxl345",
-       },
-       .probe          = adxl345_probe,
-       .remove         = adxl345_remove,
-       .id_table       = adxl345_i2c_id,
-};
-
-module_i2c_driver(adxl345_driver);
+EXPORT_SYMBOL_GPL(adxl345_common_remove);
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

PATCH v3 3/4 iio: accel: adxl345: Split driver into core and I2C

In reply to Eva Rachel Retuya

Move I2C-specific code into its own file and rely on regmap to access registers. The core code provides access to x, y, z and scale readings.

---
Change from v2:
* Add OF match table on both I2C and SPI files and document them

Changes from v1:
* Update Kconfig to Jonathan's preferred style
* Improve similarity index from 78% to 100% (rename detection)

 drivers/iio/accel/Kconfig                       | 13 ++--
 drivers/iio/accel/Makefile                      |  3 +-
 drivers/iio/accel/{adxl345.c => adxl345_core.c} |  0
 drivers/iio/accel/adxl345_i2c.c                 | 81 +++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 5 deletions(-)
 rename drivers/iio/accel/{adxl345.c => adxl345_core.c} (100%)
 create mode 100644 drivers/iio/accel/adxl345_i2c.c
drivers/iio/accel/Kconfig +9 -4
index 26b8614..ffb0a63 100644
@@ -8,14 +8,19 @@ menu "Accelerometers"
 config ADXL345
 	tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer Driver"
 	depends on !(INPUT_ADXL34X=y || INPUT_ADXL34X=m)
-	depends on I2C
-	select REGMAP_I2C
+	select REGMAP
+	select ADXL345_I2C if I2C
 	help
 	  Say Y here if you want to build support for the Analog Devices
 	  ADXL345 3-axis digital accelerometer.
 
-	  To compile this driver as a module, choose M here: the
-	  module will be called adxl345.
+	  To compile this driver as a module, choose M here: the core
+	  module will be called adxl345_core and you will also get
+	  adxl345_i2c for I2C.
+
+config ADXL345_I2C
+	tristate
+	select REGMAP_I2C
 
 config BMA180
 	tristate "Bosch BMA180/BMA250 3-Axis Accelerometer Driver"
drivers/iio/accel/Makefile +2 -1
index 618488d..3f4a6d6 100644
@@ -3,7 +3,8 @@
 #
 
 # When adding new entries keep the list in alphabetical order
-obj-$(CONFIG_ADXL345) += adxl345.o
+obj-$(CONFIG_ADXL345) += adxl345_core.o
+obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o
 obj-$(CONFIG_BMA180) += bma180.o
 obj-$(CONFIG_BMA220) += bma220_spi.o
 obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
drivers/iio/accel/adxl345_core.c renamed from drivers/iio/accel/adxl345.c +0 -0
similarity index 100%
rename from drivers/iio/accel/adxl345.c
rename to drivers/iio/accel/adxl345_core.c
drivers/iio/accel/adxl345_i2c.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH v3 3/4] iio: accel: adxl345: Split driver into core and I2C

Quoted 2 lines · Eva Rachel Retuya

Move I2C-specific code into its own file and rely on regmap to access registers. The core code provides access to x, y, z and scale readings.

Like Lars already pointed to possibility of use of this in ACPI based platforms, I would add a reference to
commit 01427fe7c4b9 ("Input: adxl34x - make it enumerable in ACPI environment").

Please fix your patches accordingly.

Quoted 31 lines
drivers/iio/accel/adxl345_i2c.c new file +31 -0
+static const struct i2c_device_id adxl345_i2c_id[] = {
+       { "adxl345", 0 },
+       { }
+};
+
+MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
+
+#ifdef CONFIG_OF
+static const struct of_device_id adxl345_of_match[] = {
+       { .compatible = "adi,adxl345" },
+       { },
+};
+
+MODULE_DEVICE_TABLE(of, adxl345_of_match);
+#endif
+
+static struct i2c_driver adxl345_i2c_driver = {
+       .driver = {
+               .name   = "adxl345_i2c",
+               .of_match_table = of_match_ptr(adxl345_of_match),
+       },
+       .probe          = adxl345_i2c_probe,
+       .remove         = adxl345_i2c_remove,
+       .id_table       = adxl345_i2c_id,
+};
+
+module_i2c_driver(adxl345_i2c_driver);
+
+MODULE_AUTHOR("Eva Rachel Retuya <[email protected]>");
+MODULE_DESCRIPTION("ADXL345 3-Axis Digital Accelerometer I2C driver");
+MODULE_LICENSE("GPL v2");
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [PATCH v3 3/4] iio: accel: adxl345: Split driver into core and I2C

Quoted 10 lines · Andy Shevchenko
Quoted 2 lines · Eva Rachel Retuya

Move I2C-specific code into its own file and rely on regmap to access registers. The core code provides access to x, y, z and scale readings.

Like Lars already pointed to possibility of use of this in ACPI based platforms, I would add a reference to
commit 01427fe7c4b9 ("Input: adxl34x - make it enumerable in ACPI environment").

Please fix your patches accordingly.

Ack. Thank you for pointing this out. I'm not aware of the said commit.

Eva

Quoted 37 lines
Quoted 32 lines
drivers/iio/accel/adxl345_i2c.c new file +31 -0
+static const struct i2c_device_id adxl345_i2c_id[] = {
+       { "adxl345", 0 },
+       { }
+};
+
+MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
+
+#ifdef CONFIG_OF
+static const struct of_device_id adxl345_of_match[] = {
+       { .compatible = "adi,adxl345" },
+       { },
+};
+
+MODULE_DEVICE_TABLE(of, adxl345_of_match);
+#endif
+
+static struct i2c_driver adxl345_i2c_driver = {
+       .driver = {
+               .name   = "adxl345_i2c",
+               .of_match_table = of_match_ptr(adxl345_of_match),
+       },
+       .probe          = adxl345_i2c_probe,
+       .remove         = adxl345_i2c_remove,
+       .id_table       = adxl345_i2c_id,
+};
+
+module_i2c_driver(adxl345_i2c_driver);
+
+MODULE_AUTHOR("Eva Rachel Retuya <[email protected]>");
+MODULE_DESCRIPTION("ADXL345 3-Axis Digital Accelerometer I2C driver");
+MODULE_LICENSE("GPL v2");
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw

PATCH v3 4/4 iio: accel: adxl345: Add SPI support

In reply to Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

---
Change from v2:
* Add OF match table on both I2C and SPI files and document them

 drivers/iio/accel/Kconfig       |  8 +++-
 drivers/iio/accel/Makefile      |  1 +
 drivers/iio/accel/adxl345_spi.c | 86 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 drivers/iio/accel/adxl345_spi.c
drivers/iio/accel/Kconfig +7 -1
index ffb0a63..454aeff 100644
@@ -8,20 +8,26 @@ menu "Accelerometers"
 config ADXL345
 	tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer Driver"
 	depends on !(INPUT_ADXL34X=y || INPUT_ADXL34X=m)
+	depends on (I2C || SPI)
 	select REGMAP
 	select ADXL345_I2C if I2C
+	select ADXL345_SPI if SPI
 	help
 	  Say Y here if you want to build support for the Analog Devices
 	  ADXL345 3-axis digital accelerometer.
 
 	  To compile this driver as a module, choose M here: the core
 	  module will be called adxl345_core and you will also get
-	  adxl345_i2c for I2C.
+	  adxl345_i2c for I2C and/or adxl345_spi for SPI.
 
 config ADXL345_I2C
 	tristate
 	select REGMAP_I2C
 
+config ADXL345_SPI
+	tristate
+	select REGMAP_SPI
+
 config BMA180
 	tristate "Bosch BMA180/BMA250 3-Axis Accelerometer Driver"
 	depends on I2C
drivers/iio/accel/Makefile +1 -0
index 3f4a6d6..31fba19 100644
@@ -5,6 +5,7 @@
 # When adding new entries keep the list in alphabetical order
 obj-$(CONFIG_ADXL345) += adxl345_core.o
 obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o
+obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o
 obj-$(CONFIG_BMA180) += bma180.o
 obj-$(CONFIG_BMA220) += bma220_spi.o
 obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
drivers/iio/accel/adxl345_spi.c new file +86 -0

86 lines not on this page · raw message

Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 20 lines · Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

drivers/iio/accel/Kconfig +2 -0
@@ -8,20 +8,26 @@ menu "Accelerometers"
 config ADXL345
        tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer Driver"
        depends on !(INPUT_ADXL34X=y || INPUT_ADXL34X=m)
+       depends on (I2C || SPI)
        select REGMAP
        select ADXL345_I2C if I2C
+       select ADXL345_SPI if SPI
        help
          Say Y here if you want to build support for the Analog Devices
          ADXL345 3-axis digital accelerometer.
 
          To compile this driver as a module, choose M here: the core
          module will be called adxl345_core and you will also get

drivers/iio/accel/Kconfig menu "Accelerometers" · line 29

Quoted 10 lines
drivers/iio/accel/Kconfig +4 -1
-         adxl345_i2c for I2C.
+         adxl345_i2c for I2C and/or adxl345_spi for SPI.
 
 config ADXL345_I2C
        tristate
        select REGMAP_I2C
 
+config ADXL345_SPI
+       tristate
+       select REGMAP_SPI

Hmm...
I saw another pattern

Library / core part is non-visible to user, while
SPI and I2C parts are selectable by user.

Why do you use inverted pattern? What did I miss?

Signature · 6 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 35 lines · Andy Shevchenko
Quoted 20 lines · Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

drivers/iio/accel/Kconfig +2 -0
@@ -8,20 +8,26 @@ menu "Accelerometers"
 config ADXL345
        tristate "Analog Devices ADXL345 3-Axis Digital Accelerometer Driver"
        depends on !(INPUT_ADXL34X=y || INPUT_ADXL34X=m)
+       depends on (I2C || SPI)
        select REGMAP
        select ADXL345_I2C if I2C
+       select ADXL345_SPI if SPI
        help
          Say Y here if you want to build support for the Analog Devices
          ADXL345 3-axis digital accelerometer.
 
          To compile this driver as a module, choose M here: the core
          module will be called adxl345_core and you will also get

drivers/iio/accel/Kconfig menu "Accelerometers" · line 29

Quoted 10 lines
drivers/iio/accel/Kconfig +4 -1
-         adxl345_i2c for I2C.
+         adxl345_i2c for I2C and/or adxl345_spi for SPI.
 
 config ADXL345_I2C
        tristate
        select REGMAP_I2C
 
+config ADXL345_SPI
+       tristate
+       select REGMAP_SPI

Hmm...
I saw another pattern

Quoted 4 lines

Library / core part is non-visible to user, while
SPI and I2C parts are selectable by user.

Why do you use inverted pattern? What did I miss?

The first version of the patch used the other pattern SPI/I2C visible. Jonathan suggested this other pattern. I prefer the explicit SPI/I2C visible pattern, but in the end it doesn't really matter as long as both work.

#11 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 17 lines · Lars-Peter Clausen
Quoted 16 lines · Andy Shevchenko

drivers/iio/accel/Kconfig menu "Accelerometers" · line 29

Quoted 11 lines · Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

config ADXL345_I2C
tristate
select REGMAP_I2C

drivers/iio/accel/Kconfig +3 -0
+config ADXL345_SPI
+       tristate
+       select REGMAP_SPI

Hmm...
I saw another pattern

Quoted 8 lines
Quoted 4 lines

Library / core part is non-visible to user, while
SPI and I2C parts are selectable by user.

Why do you use inverted pattern? What did I miss?

The first version of the patch used the other pattern SPI/I2C visible. Jonathan suggested this other pattern. I prefer the explicit SPI/I2C visible pattern, but in the end it doesn't really matter as long as both work.

Yes, but this pattern makes extra footprint of the kernel and basically dead code when I would like, for example, to have SPI bus enabled, I2C module available, but SPI module not compiled.

Other one is when I want to have one compiled in, one as a module by whatever reason.

At the end I have no strong opinion, though rationale for the opposite is above.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#12 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 27 lines · Andy Shevchenko
Quoted 17 lines · Lars-Peter Clausen
Quoted 16 lines · Andy Shevchenko

drivers/iio/accel/Kconfig menu "Accelerometers" · line 29

Quoted 11 lines · Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

config ADXL345_I2C
tristate
select REGMAP_I2C

drivers/iio/accel/Kconfig +3 -0
+config ADXL345_SPI
+       tristate
+       select REGMAP_SPI

Hmm...
I saw another pattern

Quoted 8 lines
Quoted 4 lines

Library / core part is non-visible to user, while
SPI and I2C parts are selectable by user.

Why do you use inverted pattern? What did I miss?

The first version of the patch used the other pattern SPI/I2C visible. Jonathan suggested this other pattern. I prefer the explicit SPI/I2C visible pattern, but in the end it doesn't really matter as long as both work.

Quoted 9 lines

Yes, but this pattern makes extra footprint of the kernel and basically dead code when I would like, for example, to have SPI bus enabled, I2C module available, but SPI module not compiled.

Other one is when I want to have one compiled in, one as a module by whatever reason.

At the end I have no strong opinion, though rationale for the opposite is above.

Hello Lars and Andy,

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Thanks,
Eva

Quoted 3 lines
Signature · 2 lines
With Best Regards,
Andy Shevchenko

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 35 lines · Eva Rachel Retuya
Quoted 34 lines · Andy Shevchenko
Quoted 17 lines · Lars-Peter Clausen
Quoted 16 lines · Andy Shevchenko

drivers/iio/accel/Kconfig menu "Accelerometers" · line 29

Quoted 11 lines · Eva Rachel Retuya

Add SPI driver that initializes SPI regmap for the adxl345 core driver. The driver supports the same functionality as I2C namely the x, y, z and scale readings.

config ADXL345_I2C
tristate
select REGMAP_I2C

drivers/iio/accel/Kconfig +3 -0
+config ADXL345_SPI
+       tristate
+       select REGMAP_SPI

Hmm...
I saw another pattern

Quoted 8 lines
Quoted 4 lines

Library / core part is non-visible to user, while
SPI and I2C parts are selectable by user.

Why do you use inverted pattern? What did I miss?

The first version of the patch used the other pattern SPI/I2C visible. Jonathan suggested this other pattern. I prefer the explicit SPI/I2C visible pattern, but in the end it doesn't really matter as long as both work.

Yes, but this pattern makes extra footprint of the kernel and basically dead code when I would like, for example, to have SPI bus enabled, I2C module available, but SPI module not compiled.

Other one is when I want to have one compiled in, one as a module by whatever reason.

Quoted 7 lines
Quoted 2 lines

At the end I have no strong opinion, though rationale for the opposite is above.

Hello Lars and Andy,

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Please check with Jonathan before you do, in the end he'll have to apply the patch.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 11 lines · Lars-Peter Clausen
Quoted 7 lines · Eva Rachel Retuya
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Lars-Peter Clausen
Quoted 1 line · Andy Shevchenko

On Wed, Feb 22, 2017 at 12:23 PM, Eva Rachel Retuya <[email protected]> wrote:

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Please check with Jonathan before you do, in the end he'll have to apply the patch.

+1. I will be fine with either just need to make sure maintainer understands pros and cons.

Signature · 6 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#15 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Lars-Peter Clausen
Quoted 4 lines · Eva Rachel Retuya
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Lars-Peter Clausen
Quoted 1 line · Andy Shevchenko

On Wed, Feb 22, 2017 at 12:23 PM, Eva Rachel Retuya <[email protected]> wrote:

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Please check with Jonathan before you do, in the end he'll have to apply the patch.

+1. I will be fine with either just need to make sure maintainer understands pros and cons.

OK.

Jonathan, please let me know whether to continue with your preferred configuration or go with the "explicit" pattern that was discussed here.

Thanks,
Eva

Quoted 7 lines
Signature · 6 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 22 lines · Eva Rachel Retuya
Quoted 1 line · Andy Shevchenko

On Fri, Feb 24, 2017 at 11:22 AM, Lars-Peter Clausen

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines · Eva Rachel Retuya
Quoted 2 lines · Andy Shevchenko
Quoted 1 line

On Thu, Feb 23, 2017 at 6:47 PM, Lars-Peter Clausen

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Andy Shevchenko
Quoted 1 line

On Wed, Feb 22, 2017 at 12:23 PM, Eva Rachel Retuya

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 3 lines

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Please check with Jonathan before you do, in the end he'll have to

apply the

Quoted 5 lines
Quoted 1 line

patch.

+1. I will be fine with either just need to make sure maintainer understands pros and cons.

Quoted 6 lines

OK.

Jonathan, please let me know whether to continue with your preferred configuration or go with the "explicit" pattern that was discussed here.

Have lost track. Will catch up with thread tomorrow and get back to you.

J

Quoted 15 lines

Thanks,
Eva

Quoted 5 lines
Signature · 4 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-iio"

in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
maintainer
#17 lore raw

Re: [PATCH v3 4/4] iio: accel: adxl345: Add SPI support

Quoted 25 lines · Jonathan Cameron
Quoted 22 lines · Eva Rachel Retuya
Quoted 1 line · Andy Shevchenko

On Fri, Feb 24, 2017 at 11:22 AM, Lars-Peter Clausen

Quoted 3 lines · <lars-Qo5EllUWu/[email protected]> wrote:
Quoted 3 lines · Eva Rachel Retuya
Quoted 2 lines · Andy Shevchenko
Quoted 1 line

On Thu, Feb 23, 2017 at 6:47 PM, Lars-Peter Clausen

Quoted 2 lines · <lars-Qo5EllUWu/[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Andy Shevchenko
Quoted 1 line

On Wed, Feb 22, 2017 at 12:23 PM, Eva Rachel Retuya

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 3 lines

I'll revert to the explicit SPI/I2C pattern in order to give more freedom in configuring as per the scenarios previously stated.

Please check with Jonathan before you do, in the end he'll have to

apply the

Quoted 5 lines
Quoted 1 line

patch.

+1. I will be fine with either just need to make sure maintainer understands pros and cons.

Quoted 8 lines
Quoted 6 lines

OK.

Jonathan, please let me know whether to continue with your preferred configuration or go with the "explicit" pattern that was discussed here.

Have lost track. Will catch up with thread tomorrow and get back to you.

Ah, now I have caught up, I'll go with the same no strong opinions. Looks like it is 2 to one in favour of the explicit i2c / spi bits so lets go with the original form.

Sorry for wasting your time on this Eva!

Divide is always between simplifying configurability of the kernel vs minimising the extra code built that isn't needed. Never entirely obvious where that boundary falls and it really doesn't make that much difference on either side.

Anyhow, at least you know the options and arguments either way now so not completely wasted time.

Thanks,

Jonathan

Quoted 17 lines

J

Quoted 15 lines

Thanks,
Eva

Quoted 5 lines
Signature · 4 lines
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-iio"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html