Skip to contentSkip to conversation

STMicroelectronics drivers

PATCH New Denis CIOCCA 2 participants 8 messages Jan 18, 2013 – Jan 20, 2013 IIO

lore
Share & tools
lore
#0 lore raw

Hi Jonathan, Lars,

I have modified some part of code and added it to common library, the remainder I think can not be moved. I have also modified the kconfig and makefile.

Thanks!

Denis

#1 lore raw

PATCH 1/4 iio:common: Add STMicroelectronics common library

This patch add a generic library for STMicroelectronics 3-axis sensors.

---
 drivers/iio/common/Kconfig                         |   1 +
 drivers/iio/common/Makefile                        |   1 +
 drivers/iio/common/st_sensors/Kconfig              |   6 +
 drivers/iio/common/st_sensors/Makefile             |  21 ++
 drivers/iio/common/st_sensors/st_sensors_buffer.c  | 115 ++++++
 drivers/iio/common/st_sensors/st_sensors_core.c    | 411 +++++++++++++++++++++
 drivers/iio/common/st_sensors/st_sensors_i2c.c     |  81 ++++
 drivers/iio/common/st_sensors/st_sensors_spi.c     | 128 +++++++
 drivers/iio/common/st_sensors/st_sensors_trigger.c |  77 ++++
 include/linux/iio/common/st_sensors.h              | 280 ++++++++++++++
 10 files changed, 1121 insertions(+)
 create mode 100644 drivers/iio/common/st_sensors/Kconfig
 create mode 100644 drivers/iio/common/st_sensors/Makefile
 create mode 100644 drivers/iio/common/st_sensors/st_sensors_buffer.c
 create mode 100644 drivers/iio/common/st_sensors/st_sensors_core.c
 create mode 100644 drivers/iio/common/st_sensors/st_sensors_i2c.c
 create mode 100644 drivers/iio/common/st_sensors/st_sensors_spi.c
 create mode 100644 drivers/iio/common/st_sensors/st_sensors_trigger.c
 create mode 100644 include/linux/iio/common/st_sensors.h
drivers/iio/common/Kconfig +1 -0
index ed45ee5..0b6e97d 100644
@@ -3,3 +3,4 @@
 #
 
 source "drivers/iio/common/hid-sensors/Kconfig"
+source "drivers/iio/common/st_sensors/Kconfig"
drivers/iio/common/Makefile +1 -0
index 8158400..c2352be 100644
@@ -7,3 +7,4 @@
 #
 
 obj-y += hid-sensors/
+obj-y += st_sensors/
drivers/iio/common/st_sensors/Kconfig new file +6 -0
new file mode 100644
index 0000000..0749f5c
@@ -0,0 +1,6 @@
+#
+# Hid Sensor common modules
+#
+
+config IIO_ST_SENSORS_CORE
+	bool
drivers/iio/common/st_sensors/Makefile new file +21 -0
new file mode 100644
index 0000000..8c9a57a
@@ -0,0 +1,21 @@
+#
+# Makefile for the STMicroelectronics sensor common modules.
+#
+
+ifneq ($(CONFIG_I2C),)
+st_accel_i2c			= st_sensors_i2c.o
+endif
+
+ifneq ($(CONFIG_SPI_MASTER),)
+st_accel_spi			= st_sensors_spi.o
+endif
+
+ifneq ($(CONFIG_IIO_BUFFER),)
+st_sensors_triggered_buffer	= st_sensors_trigger.o st_sensors_buffer.o
+endif
+
+obj-$(CONFIG_IIO_ST_SENSORS_CORE) += 	st_sensors_library.o
+st_sensors_library-y := st_sensors_core.o \
+			$(st_accel_i2c) \
+			$(st_accel_spi) \
+			$(st_sensors_triggered_buffer)
drivers/iio/common/st_sensors/st_sensors_buffer.c new file +115 -0

115 lines not on this page · raw message

drivers/iio/common/st_sensors/st_sensors_core.c new file +411 -0

411 lines not on this page · raw message

drivers/iio/common/st_sensors/st_sensors_i2c.c new file +81 -0

81 lines not on this page · raw message

drivers/iio/common/st_sensors/st_sensors_spi.c new file +128 -0

128 lines not on this page · raw message

drivers/iio/common/st_sensors/st_sensors_trigger.c new file +77 -0

77 lines not on this page · raw message

include/linux/iio/common/st_sensors.h new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
1.8.0.3
#2 lore raw

PATCH 2/4 iio:accel: Add STMicroelectronics accelerometers driver

In reply to Denis CIOCCA

This patch adds a generic accelerometer driver for STMicroelectronics accelerometers, currently it supports:
LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC, LIS331DLH, LSM303DL, LSM303DLM, LSM330.

---
 drivers/iio/accel/Kconfig           |  35 +++
 drivers/iio/accel/Makefile          |   5 +
 drivers/iio/accel/st_accel_buffer.c | 119 ++++++++
 drivers/iio/accel/st_accel_core.c   | 582 ++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c    |  87 ++++++
 drivers/iio/accel/st_accel_spi.c    |  86 ++++++
 include/linux/iio/accel/st_accel.h  |  52 ++++
 7 files changed, 966 insertions(+)
 create mode 100644 drivers/iio/accel/st_accel_buffer.c
 create mode 100644 drivers/iio/accel/st_accel_core.c
 create mode 100644 drivers/iio/accel/st_accel_i2c.c
 create mode 100644 drivers/iio/accel/st_accel_spi.c
 create mode 100644 include/linux/iio/accel/st_accel.h
drivers/iio/accel/Kconfig +35 -0
index 05e996f..ba0a7a4 100644
@@ -14,4 +14,39 @@ config HID_SENSOR_ACCEL_3D
 	  Say yes here to build support for the HID SENSOR
 	  accelerometers 3D.
 
+config IIO_ST_ACCEL_3AXIS
+	tristate "STMicroelectronics accelerometers 3-Axis Driver"
+	depends on (I2C || SPI_MASTER) && SYSFS
+	select IIO_ST_SENSORS_CORE
+	select IIO_ST_ACCEL_I2C_3AXIS if (I2C)
+	select IIO_ST_ACCEL_SPI_3AXIS if (SPI_MASTER)
+	select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
+	select IIO_ST_ACCEL_BUFFER if (IIO_TRIGGERED_BUFFER)
+	help
+	  Say yes here to build support for STMicroelectronics accelerometers:
+	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
+	  LIS331DLH, LSM303DL, LSM303DLM, LSM330.
+
+	  This driver can also be built as a module. If so, will be created
+	  these modules:
+	  - st_accel_core (core functions for the driver [it is mandatory]);
+	  - st_accel_i2c (necessary for the I2C devices [optional*]);
+	  - st_accel_spi (necessary for the SPI devices [optional*]);
+	  - st_accel_buffer (necessary for triggered buffer [optional]);
+	  
+	  (*) one of these is necessary to do something.
+
+config IIO_ST_ACCEL_I2C_3AXIS
+	tristate
+	depends on IIO_ST_ACCEL_3AXIS
+
+config IIO_ST_ACCEL_SPI_3AXIS
+	tristate
+	depends on IIO_ST_ACCEL_3AXIS
+
+config IIO_ST_ACCEL_BUFFER
+	tristate
+	depends on IIO_ST_ACCEL_3AXIS
+	depends on (IIO_ST_ACCEL_I2C_3AXIS || IIO_ST_ACCEL_SPI_3AXIS)
+
 endmenu
drivers/iio/accel/Makefile +5 -0
index 5bc6855..cb139f1 100644
@@ -3,3 +3,8 @@
 #
 
 obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o
+
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS) += st_accel_core.o
+obj-$(CONFIG_IIO_ST_ACCEL_I2C_3AXIS) += st_accel_i2c.o
+obj-$(CONFIG_IIO_ST_ACCEL_SPI_3AXIS) += st_accel_spi.o
+obj-$(CONFIG_IIO_ST_ACCEL_BUFFER) += st_accel_buffer.o
drivers/iio/accel/st_accel_buffer.c new file +119 -0

119 lines not on this page · raw message

drivers/iio/accel/st_accel_core.c new file +582 -0

582 lines not on this page · raw message

drivers/iio/accel/st_accel_i2c.c new file +87 -0

87 lines not on this page · raw message

drivers/iio/accel/st_accel_spi.c new file +86 -0

86 lines not on this page · raw message

include/linux/iio/accel/st_accel.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.8.0.3
#3 lore raw

PATCH 3/4 iio:gyro: Add STMicroelectronics gyroscopes driver

In reply to Denis CIOCCA

This patch adds a generic gyroscope driver for STMicroelectronics gyroscopes, currently it supports:
L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330.

---
 drivers/iio/gyro/Kconfig          |  34 +++
 drivers/iio/gyro/Makefile         |   5 +
 drivers/iio/gyro/st_gyro_buffer.c | 119 ++++++++++
 drivers/iio/gyro/st_gyro_core.c   | 448 ++++++++++++++++++++++++++++++++++++++
 drivers/iio/gyro/st_gyro_i2c.c    |  84 +++++++
 drivers/iio/gyro/st_gyro_spi.c    |  83 +++++++
 include/linux/iio/gyro/st_gyro.h  |  49 +++++
 7 files changed, 822 insertions(+)
 create mode 100644 drivers/iio/gyro/st_gyro_buffer.c
 create mode 100644 drivers/iio/gyro/st_gyro_core.c
 create mode 100644 drivers/iio/gyro/st_gyro_i2c.c
 create mode 100644 drivers/iio/gyro/st_gyro_spi.c
 create mode 100644 include/linux/iio/gyro/st_gyro.h
drivers/iio/gyro/Kconfig +34 -0
index 96b68f6..6fb4225 100644
@@ -23,4 +23,38 @@ config HID_SENSOR_GYRO_3D
 	  Say yes here to build support for the HID SENSOR
 	  Gyroscope 3D.
 
+config IIO_ST_GYRO_3AXIS
+	tristate "STMicroelectronics gyroscopes 3-Axis Driver"
+	depends on (I2C || SPI_MASTER) && SYSFS
+	select IIO_ST_SENSORS_CORE
+	select IIO_ST_GYRO_I2C_3AXIS if (I2C)
+	select IIO_ST_GYRO_SPI_3AXIS if (SPI_MASTER)
+	select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
+	select IIO_ST_GYRO_BUFFER if (IIO_TRIGGERED_BUFFER)
+	help
+	  Say yes here to build support for STMicroelectronics gyroscopes:
+	  L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330.
+
+	  This driver can also be built as a module. If so, will be created
+	  these modules:
+	  - st_gyro_core (core functions for the driver [it is mandatory]);
+	  - st_gyro_i2c (necessary for the I2C devices [optional*]);
+	  - st_gyro_spi (necessary for the SPI devices [optional*]);
+	  - st_gyro_buffer (necessary for triggered buffer [optional]);
+	  
+	  (*) one of these is necessary to do something.
+
+config IIO_ST_GYRO_I2C_3AXIS
+	tristate
+	depends on IIO_ST_GYRO_3AXIS
+
+config IIO_ST_GYRO_SPI_3AXIS
+	tristate
+	depends on IIO_ST_GYRO_3AXIS
+
+config IIO_ST_GYRO_BUFFER
+	tristate
+	depends on IIO_ST_GYRO_3AXIS
+	depends on (IIO_ST_GYRO_I2C_3AXIS || IIO_ST_GYRO_SPI_3AXIS)
+
 endmenu
drivers/iio/gyro/Makefile +5 -0
index 702a058..e800cd6 100644
@@ -4,3 +4,8 @@
 
 obj-$(CONFIG_ADIS16136) += adis16136.o
 obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o
+
+obj-$(CONFIG_IIO_ST_GYRO_3AXIS) += st_gyro_core.o
+obj-$(CONFIG_IIO_ST_GYRO_I2C_3AXIS) += st_gyro_i2c.o
+obj-$(CONFIG_IIO_ST_GYRO_SPI_3AXIS) += st_gyro_spi.o
+obj-$(CONFIG_IIO_ST_GYRO_BUFFER) += st_gyro_buffer.o
drivers/iio/gyro/st_gyro_buffer.c new file +119 -0

119 lines not on this page · raw message

drivers/iio/gyro/st_gyro_core.c new file +448 -0

448 lines not on this page · raw message

drivers/iio/gyro/st_gyro_i2c.c new file +84 -0

84 lines not on this page · raw message

drivers/iio/gyro/st_gyro_spi.c new file +83 -0

83 lines not on this page · raw message

include/linux/iio/gyro/st_gyro.h new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.8.0.3
#4 lore raw

PATCH 4/4 iio:magnetometer: Add STMicroelectronics magnetometers driver

In reply to Denis CIOCCA

This patch adds a generic magnetometer driver for STMicroelectronics magnetometers, currently it supports:
LSM303DLHC, LSM303DLM, LIS3MDL.

---
 drivers/iio/magnetometer/Kconfig          |  34 +++
 drivers/iio/magnetometer/Makefile         |   5 +
 drivers/iio/magnetometer/st_magn_buffer.c | 102 +++++++
 drivers/iio/magnetometer/st_magn_core.c   | 468 ++++++++++++++++++++++++++++++
 drivers/iio/magnetometer/st_magn_i2c.c    |  81 ++++++
 drivers/iio/magnetometer/st_magn_spi.c    |  80 +++++
 include/linux/iio/magnetometer/st_magn.h  |  47 +++
 7 files changed, 817 insertions(+)
 create mode 100644 drivers/iio/magnetometer/st_magn_buffer.c
 create mode 100644 drivers/iio/magnetometer/st_magn_core.c
 create mode 100644 drivers/iio/magnetometer/st_magn_i2c.c
 create mode 100644 drivers/iio/magnetometer/st_magn_spi.c
 create mode 100644 include/linux/iio/magnetometer/st_magn.h
drivers/iio/magnetometer/Kconfig +34 -0
index ff11d68..89e2727 100644
@@ -14,4 +14,38 @@ config HID_SENSOR_MAGNETOMETER_3D
 	  Say yes here to build support for the HID SENSOR
 	  Magnetometer 3D.
 
+config IIO_ST_MAGN_3AXIS
+	tristate "STMicroelectronics magnetometers 3-Axis Driver"
+	depends on (I2C || SPI_MASTER) && SYSFS
+	select IIO_ST_SENSORS_CORE
+	select IIO_ST_MAGN_I2C_3AXIS if (I2C)
+	select IIO_ST_MAGN_SPI_3AXIS if (SPI_MASTER)
+	select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
+	select IIO_ST_MAGN_BUFFER if (IIO_TRIGGERED_BUFFER)
+	help
+	  Say yes here to build support for STMicroelectronics magnetometers:
+	  LSM303DLHC, LSM303DLM, LIS3MDL.
+
+	  This driver can also be built as a module. If so, will be created
+	  these modules:
+	  - st_magn_core (core functions for the driver [it is mandatory]);
+	  - st_magn_i2c (necessary for the I2C devices [optional*]);
+	  - st_magn_spi (necessary for the SPI devices [optional*]);
+	  - st_magn_buffer (necessary for triggered buffer [optional]);
+	  
+	  (*) one of these is necessary to do something.
+
+config IIO_ST_MAGN_I2C_3AXIS
+	tristate
+	depends on IIO_ST_MAGN_3AXIS
+
+config IIO_ST_MAGN_SPI_3AXIS
+	tristate
+	depends on IIO_ST_MAGN_3AXIS
+
+config IIO_ST_MAGN_BUFFER
+	tristate
+	depends on IIO_ST_MAGN_3AXIS
+	depends on (IIO_ST_MAGN_I2C_3AXIS || IIO_ST_MAGN_SPI_3AXIS)
+
 endmenu
drivers/iio/magnetometer/Makefile +5 -0
index 60dc4f2..215b99e 100644
@@ -3,3 +3,8 @@
 #
 
 obj-$(CONFIG_HID_SENSOR_MAGNETOMETER_3D) += hid-sensor-magn-3d.o
+
+obj-$(CONFIG_IIO_ST_MAGN_3AXIS) += st_magn_core.o
+obj-$(CONFIG_IIO_ST_MAGN_I2C_3AXIS) += st_magn_i2c.o
+obj-$(CONFIG_IIO_ST_MAGN_SPI_3AXIS) += st_magn_spi.o
+obj-$(CONFIG_IIO_ST_MAGN_BUFFER) += st_magn_buffer.o
drivers/iio/magnetometer/st_magn_buffer.c new file +102 -0

102 lines not on this page · raw message

drivers/iio/magnetometer/st_magn_core.c new file +468 -0

468 lines not on this page · raw message

drivers/iio/magnetometer/st_magn_i2c.c new file +81 -0

81 lines not on this page · raw message

drivers/iio/magnetometer/st_magn_spi.c new file +80 -0

80 lines not on this page · raw message

include/linux/iio/magnetometer/st_magn.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.8.0.3
maintainer
#5 lore raw
In reply to Denis CIOCCA
Quoted 9 lines · Denis CIOCCA

Hi Jonathan, Lars,

I have modified some part of code and added it to common library, the remainder I think can not be moved. I have also modified the kconfig and makefile.

Thanks!

Denis

Denis this still doesn't work.

I'll send you a patch to make it actually do so.

With what you sent out in this series, simply building the lot as modules fails.

Anyhow, patches to follow. They are not clean but the do work, please merge them into yours or argue why the approach used does not work...

Jonathan

maintainer
#6 lore raw

PATCH 1/2 Make the st_sensors core library stuff build in all combinations.

---
 drivers/iio/common/st_sensors/Kconfig          | 11 ++++++++++-
 drivers/iio/common/st_sensors/Makefile         | 24 ++++++------------------
 drivers/iio/common/st_sensors/st_sensors_i2c.c |  3 ++-
 drivers/iio/common/st_sensors/st_sensors_spi.c |  4 ++--
 include/linux/iio/common/st_i2c.h              |  7 +++++++
 include/linux/iio/common/st_sensors.h          | 14 --------------
 include/linux/iio/common/st_spi.h              |  9 +++++++++
 7 files changed, 36 insertions(+), 36 deletions(-)
 create mode 100644 include/linux/iio/common/st_i2c.h
 create mode 100644 include/linux/iio/common/st_spi.h
drivers/iio/common/st_sensors/Kconfig +10 -1
index 0749f5c..58e06eb 100644
@@ -2,5 +2,14 @@
 # Hid Sensor common modules
 #
 
+config IIO_ST_SENSORS_I2C
+       tristate
+
+config IIO_ST_SENSORS_SPI
+       tristate
+
 config IIO_ST_SENSORS_CORE
-	bool
+       tristate
+       select IIO_ST_SENSORS_I2C if I2C
+       select IIO_ST_SENSORS_SPI if SPI_MASTER
+
drivers/iio/common/st_sensors/Makefile +6 -18
index 8c9a57a..2075ad4 100644
@@ -1,21 +1,9 @@
 #
 # Makefile for the STMicroelectronics sensor common modules.
 #
-
-ifneq ($(CONFIG_I2C),)
-st_accel_i2c			= st_sensors_i2c.o
-endif
-
-ifneq ($(CONFIG_SPI_MASTER),)
-st_accel_spi			= st_sensors_spi.o
-endif
-
-ifneq ($(CONFIG_IIO_BUFFER),)
-st_sensors_triggered_buffer	= st_sensors_trigger.o st_sensors_buffer.o
-endif
-
-obj-$(CONFIG_IIO_ST_SENSORS_CORE) += 	st_sensors_library.o
-st_sensors_library-y := st_sensors_core.o \
-			$(st_accel_i2c) \
-			$(st_accel_spi) \
-			$(st_sensors_triggered_buffer)
+obj-$(CONFIG_IIO_ST_SENSORS_I2C) += st_sensors_i2c.o
+obj-$(CONFIG_IIO_ST_SENSORS_SPI) += st_sensors_spi.o
+obj-$(CONFIG_IIO_ST_SENSORS_CORE) += st_sensors.o
+st_sensors-y := st_sensors_core.o
+st_sensors-$(CONFIG_IIO_BUFFER) += st_sensors_buffer.o
+st_sensors-$(CONFIG_IIO_TRIGGER) += st_sensors_trigger.o
drivers/iio/common/st_sensors/st_sensors_i2c.c +2 -1
index b2d2fdf..43169ce 100644
@@ -13,12 +13,13 @@
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
 
+#include <linux/iio/common/st_i2c.h>
 #include <linux/iio/common/st_sensors.h>
 
 
 #define ST_SENSORS_I2C_MULTIREAD	0x80
 
-unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev)
+static unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
drivers/iio/common/st_sensors/st_sensors_spi.c +2 -2
index 5030766..f89726f 100644
@@ -12,14 +12,14 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
-
+#include <linux/iio/common/st_spi.h>
 #include <linux/iio/common/st_sensors.h>
 
 
 #define ST_SENSORS_SPI_MULTIREAD	0xc0
 #define ST_SENSORS_SPI_READ		0x80
 
-unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev)
+static unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
include/linux/iio/common/st_i2c.h new file +7 -0
new file mode 100644
index 0000000..c4ff039
@@ -0,0 +1,7 @@
+
+struct iio_dev;
+struct i2c_client;
+struct st_sensor_data;
+
+void st_sensors_i2c_configure(struct iio_dev *indio_dev,
+		struct i2c_client *client, struct st_sensor_data *sdata);
include/linux/iio/common/st_sensors.h +0 -14
index a8a0c40..f27b1e0 100644
@@ -215,20 +215,6 @@ struct st_sensors {
 	unsigned int bootime;
 };
 
-#ifdef CONFIG_SPI_MASTER
-void st_sensors_spi_configure(struct iio_dev *indio_dev,
-			struct spi_device *spi, struct st_sensor_data *sdata);
-
-unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev);
-#endif
-
-#ifdef CONFIG_I2C
-void st_sensors_i2c_configure(struct iio_dev *indio_dev,
-		struct i2c_client *client, struct st_sensor_data *sdata);
-
-unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev);
-#endif
-
 #ifdef CONFIG_IIO_BUFFER
 int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 					struct iio_trigger_ops *trigger_ops);
include/linux/iio/common/st_spi.h new file +9 -0
new file mode 100644
index 0000000..d1dddc6
@@ -0,0 +1,9 @@
+
+
+struct iio_dev;
+struct st_sensor_data;
+struct spi_device;
+
+void st_sensors_spi_configure(struct iio_dev *indio_dev,
+			struct spi_device *spi, struct st_sensor_data *sdata);
+
Signature · 1 line
1.8.1
maintainer
#7 lore raw

PATCH 2/2 Rework the Makefile / Kconfig for the st accel driver so that all options work.

---
 drivers/iio/accel/Kconfig        | 42 ++--------------------------------------
 drivers/iio/accel/Makefile       |  7 +++++--
 drivers/iio/accel/st_accel_i2c.c |  2 +-
 drivers/iio/accel/st_accel_spi.c |  2 +-
 4 files changed, 9 insertions(+), 44 deletions(-)
drivers/iio/accel/Kconfig +2 -40
index dbc1af0..c396ae1 100644
@@ -40,55 +40,17 @@ config IIO_ST_ACCEL_3AXIS
 	  - st_accel_i2c (necessary for the I2C devices [optional*]);
 	  - st_accel_spi (necessary for the SPI devices [optional*]);
 	  - st_accel_buffer (necessary for triggered buffer [optional]);
-	  
-	  (*) one of these is necessary to do something.
-
-config IIO_ST_ACCEL_I2C_3AXIS
-	tristate
-	depends on IIO_ST_ACCEL_3AXIS
-
-config IIO_ST_ACCEL_SPI_3AXIS
-	tristate
-	depends on IIO_ST_ACCEL_3AXIS
-
-config IIO_ST_ACCEL_BUFFER
-	tristate
-	depends on IIO_ST_ACCEL_3AXIS
-	depends on (IIO_ST_ACCEL_I2C_3AXIS || IIO_ST_ACCEL_SPI_3AXIS)
-
-config IIO_ST_ACCEL_3AXIS
-	tristate "STMicroelectronics accelerometers 3-Axis Driver"
-	depends on (I2C || SPI_MASTER) && SYSFS
-	select IIO_ST_SENSORS_CORE
-	select IIO_ST_ACCEL_I2C_3AXIS if (I2C)
-	select IIO_ST_ACCEL_SPI_3AXIS if (SPI_MASTER)
-	select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
-	select IIO_ST_ACCEL_BUFFER if (IIO_TRIGGERED_BUFFER)
-	help
-	  Say yes here to build support for STMicroelectronics accelerometers:
-	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
-	  LIS331DLH, LSM303DL, LSM303DLM, LSM330.
 
-	  This driver can also be built as a module. If so, will be created
-	  these modules:
-	  - st_accel_core (core functions for the driver [it is mandatory]);
-	  - st_accel_i2c (necessary for the I2C devices [optional*]);
-	  - st_accel_spi (necessary for the SPI devices [optional*]);
-	  - st_accel_buffer (necessary for triggered buffer [optional]);
-	  
 	  (*) one of these is necessary to do something.
 
 config IIO_ST_ACCEL_I2C_3AXIS
 	tristate
 	depends on IIO_ST_ACCEL_3AXIS
+	depends on IIO_ST_SENSORS_I2C
 
 config IIO_ST_ACCEL_SPI_3AXIS
 	tristate
 	depends on IIO_ST_ACCEL_3AXIS
-
-config IIO_ST_ACCEL_BUFFER
-	tristate
-	depends on IIO_ST_ACCEL_3AXIS
-	depends on (IIO_ST_ACCEL_I2C_3AXIS || IIO_ST_ACCEL_SPI_3AXIS)
+	depends on IIO_ST_SENSORS_SPI
 
 endmenu
drivers/iio/accel/Makefile +5 -2
index 820c17a..8d7a1c6 100644
@@ -5,7 +5,10 @@
 obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o
 obj-$(CONFIG_KXSD9)	+= kxsd9.o
 
-obj-$(CONFIG_IIO_ST_ACCEL_3AXIS) += st_accel_core.o
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS) += st_accel.o
+st_accel-y := st_accel_core.o
+st_accel-$(CONFIG_IIO_BUFFER) += st_accel_buffer.o
+
 obj-$(CONFIG_IIO_ST_ACCEL_I2C_3AXIS) += st_accel_i2c.o
 obj-$(CONFIG_IIO_ST_ACCEL_SPI_3AXIS) += st_accel_spi.o
-obj-$(CONFIG_IIO_ST_ACCEL_BUFFER) += st_accel_buffer.o
+
drivers/iio/accel/st_accel_i2c.c +1 -1
index e782717..066a9fb 100644
@@ -17,7 +17,7 @@
 
 #include <linux/iio/accel/st_accel.h>
 #include <linux/iio/common/st_sensors.h>
-
+#include <linux/iio/common/st_i2c.h>
 
 static int st_accel_i2c_probe(struct i2c_client *client,
 						const struct i2c_device_id *id)
drivers/iio/accel/st_accel_spi.c +1 -1
index 92e78ba..67532eb 100644
@@ -17,7 +17,7 @@
 
 #include <linux/iio/accel/st_accel.h>
 #include <linux/iio/common/st_sensors.h>
-
+#include <linux/iio/common/st_spi.h>
 
 static int st_accel_spi_probe(struct spi_device *spi)
 {
Signature · 1 line
1.8.1