Skip to contentSkip to conversation

STMicroelectronics drivers bugfix

PATCH New Denis CIOCCA 2 participants 6 messages Jan 18, 2013 IIO

lore
Share & tools
lore
#1 lore raw

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

In reply to Denis CIOCCA

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             |   9 +
 drivers/iio/common/st_sensors/st_sensors_buffer.c  | 115 +++++++
 drivers/iio/common/st_sensors/st_sensors_core.c    | 334 +++++++++++++++++++++
 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              | 275 +++++++++++++++++
 10 files changed, 1027 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 +9 -0
new file mode 100644
index 0000000..7a8363a
@@ -0,0 +1,9 @@
+#
+# Makefile for the STMicroelectronics sensor common modules.
+#
+
+obj-$(CONFIG_IIO_ST_SENSORS_CORE) += st_sensors_core.o
+obj-$(CONFIG_I2C) += st_sensors_i2c.o
+obj-$(CONFIG_SPI) += st_sensors_spi.o
+obj-$(CONFIG_IIO_BUFFER) += st_sensors_triggered_buffer.o
+st_sensors_triggered_buffer-y := st_sensors_trigger.o st_sensors_buffer.o
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 +334 -0

334 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 +275 -0

275 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           |  19 ++
 drivers/iio/accel/Makefile          |  14 +
 drivers/iio/accel/st_accel_buffer.c | 119 +++++++
 drivers/iio/accel/st_accel_core.c   | 641 ++++++++++++++++++++++++++++++++++++
 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, 1018 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 +19 -0
index 05e996f..1fbc490 100644
@@ -14,4 +14,23 @@ 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_TRIGGERED_BUFFER if (IIO_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.
+
 endmenu
drivers/iio/accel/Makefile +14 -0
index 5bc6855..0b1ecf5 100644
@@ -3,3 +3,17 @@
 #
 
 obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o
+
+ifneq ($(CONFIG_IIO_BUFFER),)
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS)	+= st_accel_buffer.o
+endif
+
+ifneq ($(CONFIG_I2C),)
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS)	+= st_accel_i2c.o
+endif
+
+ifneq ($(CONFIG_SPI_MASTER),)
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS)	+= st_accel_spi.o
+endif
+
+obj-$(CONFIG_IIO_ST_ACCEL_3AXIS) += st_accel_core.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 +641 -0

641 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          |  18 ++
 drivers/iio/gyro/Makefile         |  14 ++
 drivers/iio/gyro/st_gyro_buffer.c | 119 +++++++++
 drivers/iio/gyro/st_gyro_core.c   | 506 ++++++++++++++++++++++++++++++++++++++
 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, 873 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 +18 -0
index 96b68f6..42d4986 100644
@@ -23,4 +23,22 @@ 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_TRIGGERED_BUFFER if (IIO_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.
+
 endmenu
drivers/iio/gyro/Makefile +14 -0
index 702a058..6729a81 100644
@@ -4,3 +4,17 @@
 
 obj-$(CONFIG_ADIS16136) += adis16136.o
 obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o
+
+ifneq ($(CONFIG_IIO_BUFFER),)
+obj-$(CONFIG_IIO_ST_GYRO_3AXIS)	+= st_gyro_buffer.o
+endif
+
+ifneq ($(CONFIG_I2C),)
+obj-$(CONFIG_IIO_ST_GYRO_3AXIS)	+= st_gyro_i2c.o
+endif
+
+ifneq ($(CONFIG_SPI_MASTER),)
+obj-$(CONFIG_IIO_ST_GYRO_3AXIS)	+= st_gyro_spi.o
+endif
+
+obj-$(CONFIG_IIO_ST_GYRO_3AXIS) += st_gyro_core.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 +506 -0

506 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          |  18 ++
 drivers/iio/magnetometer/Makefile         |  14 +
 drivers/iio/magnetometer/st_magn_buffer.c | 102 ++++++
 drivers/iio/magnetometer/st_magn_core.c   | 514 ++++++++++++++++++++++++++++++
 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, 856 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 +18 -0
index ff11d68..e170dd2 100644
@@ -14,4 +14,22 @@ 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_TRIGGERED_BUFFER if (IIO_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.
+
 endmenu
drivers/iio/magnetometer/Makefile +14 -0
index 60dc4f2..62e1b15 100644
@@ -3,3 +3,17 @@
 #
 
 obj-$(CONFIG_HID_SENSOR_MAGNETOMETER_3D) += hid-sensor-magn-3d.o
+
+ifneq ($(CONFIG_IIO_BUFFER),)
+obj-$(CONFIG_IIO_ST_MAGN_3AXIS)	+= st_magn_buffer.o
+endif
+
+ifneq ($(CONFIG_I2C),)
+obj-$(CONFIG_IIO_ST_MAGN_3AXIS)	+= st_magn_i2c.o
+endif
+
+ifneq ($(CONFIG_SPI_MASTER),)
+obj-$(CONFIG_IIO_ST_MAGN_3AXIS)	+= st_magn_spi.o
+endif
+
+obj-$(CONFIG_IIO_ST_MAGN_3AXIS) += st_magn_core.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 +514 -0

514 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
#0 lore raw

Hi Lars, Jonathan,

I review the driver code in accordance with Lars's review. What do you think about kconfig? I have yet to share some part of driver code in the library!

Denis

#5 lore raw
Quoted 3 lines · Denis CIOCCA

Hi Lars, Jonathan,

I review the driver code in accordance with Lars's review. What do you think about kconfig?

Looking quickly at the library code, the kconfig is fine, but I'd expect
the i2c and spi bits to be built into the main module if they are present. Right now unless I am reading it wrong they'll get built even if the main module isn't.

For the drivers, the make file can be a simpler and easy to follow if we
put back some the Kconfig symbols you had before but just have them hidden. Basically it moves all the logic into Kconfig and means the resulting .config is easy to follow.

To my mind that would be a little simpler.

Quoted 10 lines

I have yet to share some part of driver code in the library!

Denis

--
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