Skip to contentSkip to conversation

Replace bmp085 with bmp18x

PATCH In review Eric Andersson 5 participants 13 messages Feb 29, 2012 – Mar 2, 2012 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

cover Replace bmp085 with bmp18x

Hi,

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

The driver is based on bmp085.c by Christoph Mair.

--
Best regards,
Eric

http://www.unixphere.com

Eric Andersson (3):
drivers/misc: add support for BMP18x pressure sensors
Documentation: add sysfs ABI documentation for bmp18x drivers/misc: remove bmp085 driver

 Documentation/ABI/testing/sysfs-i2c-bmp085 |   31 --
 Documentation/ABI/testing/sysfs-i2c-bmp18x |   31 ++
 Documentation/ABI/testing/sysfs-spi-bmp18x |   31 ++
 drivers/misc/Kconfig                       |   40 ++-
 drivers/misc/Makefile                      |    4 +-
 drivers/misc/bmp085.c                      |  483 ---------------------------
 drivers/misc/bmp18x-core.c                 |  500 ++++++++++++++++++++++++++++
 drivers/misc/bmp18x-i2c.c                  |  121 +++++++
 drivers/misc/bmp18x-spi.c                  |  143 ++++++++
 include/linux/i2c/bmp18x.h                 |   65 ++++
 10 files changed, 924 insertions(+), 525 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-i2c-bmp085
 create mode 100644 Documentation/ABI/testing/sysfs-i2c-bmp18x
 create mode 100644 Documentation/ABI/testing/sysfs-spi-bmp18x
 delete mode 100644 drivers/misc/bmp085.c
 create mode 100644 drivers/misc/bmp18x-core.c
 create mode 100644 drivers/misc/bmp18x-i2c.c
 create mode 100644 drivers/misc/bmp18x-spi.c
 create mode 100644 include/linux/i2c/bmp18x.h
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/3 drivers/misc: add support for BMP18x pressure sensors

This driver adds support for Bosch Sensortec's pressure sensors BMP085 and BMP18x.

The driver is based on the bmp085 driver by Christoph Mair and uses the same sysfs interface.

---
 drivers/misc/Kconfig       |   30 +++
 drivers/misc/Makefile      |    3 +
 drivers/misc/bmp18x-core.c |  502 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/bmp18x-i2c.c  |  121 +++++++++++
 drivers/misc/bmp18x-spi.c  |  143 +++++++++++++
 include/linux/i2c/bmp18x.h |   65 ++++++
 6 files changed, 864 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/bmp18x-core.c
 create mode 100644 drivers/misc/bmp18x-i2c.c
 create mode 100644 drivers/misc/bmp18x-spi.c
 create mode 100644 include/linux/i2c/bmp18x.h
drivers/misc/Kconfig +30 -0
index c779509..2e894fd 100644
@@ -498,6 +498,36 @@ config MAX8997_MUIC
 	  Maxim MAX8997 PMIC.
 	  The MAX8997 MUIC is a USB port accessory detector and switch.
 
+config BMP18X
+        tristate "BMP18X digital pressure sensor"
+        depends on (I2C || SPI_MASTER) && SYSFS
+        help
+          Say Y here if you want support for Bosch Sensortec's digital
+	  pressure sensors BMP085 and BMP18x.
+
+          To compile this driver as a module, choose M here: the
+          module will be called bmp18x-core.
+
+config BMP18X_I2C
+        tristate "support I2C bus connection"
+        depends on BMP18X && I2C
+        help
+          Say Y here if you want to support Bosch Sensortec's digital pressure
+          sensor hooked to an I2C bus.
+
+          To compile this driver as a module, choose M here: the
+          module will be called bmp18x-i2c.
+
+config BMP18X_SPI
+        tristate "support SPI bus connection"
+        depends on BMP18X && SPI_MASTER
+        help
+          Say Y here if you want to support Bosch Sensortec's digital pressure
+          sensor hooked to a SPI bus.
+
+          To compile this driver as a module, choose M here: the
+          module will be called bmp18x-spi.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +3 -0
index 3e1d801..a1aa04a 100644
@@ -11,6 +11,9 @@ obj-$(CONFIG_ATMEL_PWM)		+= atmel_pwm.o
 obj-$(CONFIG_ATMEL_SSC)		+= atmel-ssc.o
 obj-$(CONFIG_ATMEL_TCLIB)	+= atmel_tclib.o
 obj-$(CONFIG_BMP085)		+= bmp085.o
+obj-$(CONFIG_BMP18X)		+= bmp18x-core.o
+obj-$(CONFIG_BMP18X_I2C)	+= bmp18x-i2c.o
+obj-$(CONFIG_BMP18X_SPI)	+= bmp18x-spi.o
 obj-$(CONFIG_ICS932S401)	+= ics932s401.o
 obj-$(CONFIG_LKDTM)		+= lkdtm.o
 obj-$(CONFIG_TIFM_CORE)       	+= tifm_core.o
drivers/misc/bmp18x-core.c new file +502 -0

502 lines not on this page · raw message

drivers/misc/bmp18x-i2c.c new file +121 -0

121 lines not on this page · raw message

drivers/misc/bmp18x-spi.c new file +143 -0

143 lines not on this page · raw message

include/linux/i2c/bmp18x.h new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH 1/3] drivers/misc: add support for BMP18x pressure sensors

Quoted 5 lines · On Wed, 29 Feb 2012 20:58:07 +0100 Eric Andersson…

This driver adds support for Bosch Sensortec's pressure sensors BMP085 and BMP18x.

The driver is based on the bmp085 driver by Christoph Mair and uses the same sysfs interface.

This is really extending bmp085 to cover the 18x chips. We don't normally rename everything for that, and you risk breaking existing setups assuming the module name is bmp085.

So please just "update" the existing driver - ie the code looks fine but it should still end up being bmp085.

Alan

#3 lore raw

PATCH 2/3 Documentation: add sysfs ABI documentation for bmp18x

In reply to Eric Andersson

This patch adds sysfs documentation for Bosch Sensortec's BMP18x pressure sensors.

---
 Documentation/ABI/testing/sysfs-i2c-bmp18x |   31 ++++++++++++++++++++++++++++
 Documentation/ABI/testing/sysfs-spi-bmp18x |   31 ++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-i2c-bmp18x
 create mode 100644 Documentation/ABI/testing/sysfs-spi-bmp18x
Documentation/ABI/testing/sysfs-i2c-bmp18x new file +31 -0
new file mode 100644
index 0000000..f6c5799
@@ -0,0 +1,31 @@
+What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/pressure0_input
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Start a pressure measurement and read the result. Values
+		represent the ambient air pressure in pascal (0.01 millibar).
+
+		Reading: returns the current air pressure.
+
+
+What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/temp0_input
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Measure the ambient temperature. The returned value represents
+		the ambient temperature in units of 0.1 degree celsius.
+
+		Reading: returns the current temperature.
+
+
+What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/oversampling
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Tell the bmp18x to use more samples to calculate a pressure
+		value. When writing to this file the chip will use 2^x samples
+		to calculate the next pressure value with x being the value
+		written. Using this feature will decrease RMS noise and
+		increase the measurement time.
+
+		Reading: returns the current oversampling setting.
+
+		Writing: sets a new oversampling setting.
+		Accepted values: 0..3.
Documentation/ABI/testing/sysfs-spi-bmp18x new file +31 -0
new file mode 100644
index 0000000..e3a9be3
@@ -0,0 +1,31 @@
+What:		/sys/bus/spi/devices/spi<busnum>.<chipselect>/pressure0_input
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Start a pressure measurement and read the result. Values
+		represent the ambient air pressure in pascal (0.01 millibar).
+
+		Reading: returns the current air pressure.
+
+
+What:		/sys/bus/spi/devices/spi<busnum>.<chipselect>/temp0_input
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Measure the ambient temperature. The returned value represents
+		the ambient temperature in units of 0.1 degree celsius.
+
+		Reading: returns the current temperature.
+
+
+What:		/sys/bus/spi/devices/spi<busnum>.<chipselect>/oversampling
+Date:		February 2012
+Contact:	Eric Andersson <[email protected]>
+Description:	Tell the bmp18x to use more samples to calculate a pressure
+		value. When writing to this file the chip will use 2^x samples
+		to calculate the next pressure value with x being the value
+		written. Using this feature will decrease RMS noise and
+		increase the measurement time.
+
+		Reading: returns the current oversampling setting.
+
+		Writing: sets a new oversampling setting.
+		Accepted values: 0..3.
Signature · 1 line
1.7.3.4
#4 lore raw

PATCH 3/3 drivers/misc: remove bmp085 driver

In reply to Eric Andersson

Removed the bmp085 driver since it is obsoleted by the bmp18x driver.

---
 Documentation/ABI/testing/sysfs-i2c-bmp085 |   31 --
 drivers/misc/Kconfig                       |   10 -
 drivers/misc/Makefile                      |    1 -
 drivers/misc/bmp085.c                      |  483 ----------------------------
 4 files changed, 0 insertions(+), 525 deletions(-)
 delete mode 100644 Documentation/ABI/testing/sysfs-i2c-bmp085
 delete mode 100644 drivers/misc/bmp085.c
Documentation/ABI/testing/sysfs-i2c-bmp085 deleted +0 -31
deleted file mode 100644
index 585962a..0000000
@@ -1,31 +0,0 @@
-What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/pressure0_input
-Date:		June 2010
-Contact:	Christoph Mair <[email protected]>
-Description:	Start a pressure measurement and read the result. Values
-		represent the ambient air pressure in pascal (0.01 millibar).
-
-		Reading: returns the current air pressure.
-
-
-What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/temp0_input
-Date:		June 2010
-Contact:	Christoph Mair <[email protected]>
-Description:	Measure the ambient temperature. The returned value represents
-		the ambient temperature in units of 0.1 degree celsius.
-
-		Reading: returns the current temperature.
-
-
-What:		/sys/bus/i2c/devices/<busnum>-<devaddr>/oversampling
-Date:		June 2010
-Contact:	Christoph Mair <[email protected]>
-Description:	Tell the bmp085 to use more samples to calculate a pressure
-		value. When writing to this file the chip will use 2^x samples
-		to calculate the next pressure value with x being the value
-		written. Using this feature will decrease RMS noise and
-		increase the measurement time.
-
-		Reading: returns the current oversampling setting.
-
-		Writing: sets a new oversampling setting.
-		Accepted values: 0..3.
drivers/misc/Kconfig +0 -10
index 2e894fd..601094f 100644
@@ -451,16 +451,6 @@ config ARM_CHARLCD
 	  line and the Linux version on the second line, but that's
 	  still useful.
 
-config BMP085
-	tristate "BMP085 digital pressure sensor"
-	depends on I2C && SYSFS
-	help
-	  If you say yes here you get support for the Bosch Sensortec
-	  BMP085 digital pressure sensor.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called bmp085.
-
 config PCH_PHUB
 	tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
 	depends on PCI
drivers/misc/Makefile +0 -1
index a1aa04a..57473a1 100644
@@ -10,7 +10,6 @@ obj-$(CONFIG_INTEL_MID_PTI)	+= pti.o
 obj-$(CONFIG_ATMEL_PWM)		+= atmel_pwm.o
 obj-$(CONFIG_ATMEL_SSC)		+= atmel-ssc.o
 obj-$(CONFIG_ATMEL_TCLIB)	+= atmel_tclib.o
-obj-$(CONFIG_BMP085)		+= bmp085.o
 obj-$(CONFIG_BMP18X)		+= bmp18x-core.o
 obj-$(CONFIG_BMP18X_I2C)	+= bmp18x-i2c.o
 obj-$(CONFIG_BMP18X_SPI)	+= bmp18x-spi.o
drivers/misc/bmp085.c deleted +0 -483

483 lines not on this page · raw message

Signature · 1 line
1.7.3.4
maintainer
#5 lore raw
In reply to Eric Andersson
Quoted 7 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Why is this not using IIO for its user interface?

Arnd

#6 lore raw
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 5 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Notwithstanding the value of using newer generic interfaces, from what I can tell, there are no new sysfs attributes added by this driver over the one it replaces. If this driver is going to supersede the old one, it has to retain the existing interface. Otherwise, we must keep both drivers in the tree to avoid regressions.

Quoted 1 line

Why is this not using IIO for its user interface?

Because IIO is currently in staging, and this driver is not?

Cheers,

Signature · 1 line
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
maintainer
#7 lore raw
Quoted 14 lines · Nick Bowler
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 5 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Quoted 5 lines

Notwithstanding the value of using newer generic interfaces, from what I can tell, there are no new sysfs attributes added by this driver over the one it replaces. If this driver is going to supersede the old one, it has to retain the existing interface. Otherwise, we must keep both drivers in the tree to avoid regressions.

Well, the driver is presented as a new one ;-)

I also think it would be nicer generally speaking to do this as incremental updates, which could be as simple as

1. code cleanups in bmp085 without functional changes
2. add support for bmp18x
3. rename bmp085 to bmp18x, with no other changes

That would take care of the argument of adding a new driver with the "wrong" interface as well as make the history of that driver cleaner, e.g. for purposes of walking through the patches using 'git log --follow'.

Quoted 3 lines
Quoted 1 line

Why is this not using IIO for its user interface?

Because IIO is currently in staging, and this driver is not?

Yes, this is of course a big limitation still and I agree that we cannot hold up progress on drivers that don't use it yet.

Arnd

#8 lore raw
Quoted 21 lines · Arnd Bergmann
Quoted 14 lines · Nick Bowler
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 5 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Quoted 5 lines

Notwithstanding the value of using newer generic interfaces, from what I can tell, there are no new sysfs attributes added by this driver over the one it replaces. If this driver is going to supersede the old one, it has to retain the existing interface. Otherwise, we must keep both drivers in the tree to avoid regressions.

Quoted 8 lines

Well, the driver is presented as a new one ;-)

I also think it would be nicer generally speaking to do this as incremental updates, which could be as simple as

1. code cleanups in bmp085 without functional changes
2. add support for bmp18x
3. rename bmp085 to bmp18x, with no other changes

Fair enough! I will create a new patch-set that is more incremental.

Signature · 4 lines
Best regards,
 Eric

 http://www.unixphere.com
#9 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Thanks for reviewing!

Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 7 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Why is this not using IIO for its user interface?

I was unsure about the state of iio since it recides in staging. When can one expect it to move out of there? Has it been accepted as the replacement for input/misc and drivers/misc sensors?

I agree that this is maybe not a long-term solution, but this is what we have right now. Maybe not the best argument, but this can be seen as an improvement to the bmp085 driver so "the damage has already been done".

Signature · 4 lines
Best regards,
 Eric

http://www.unixphere.com
#10 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · On Wed, 29 Feb 2012 20:18:45 +0000 Arnd Bergmann <[email protected]> wrote:
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 7 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Why is this not using IIO for its user interface?

This is become a repeating problem

Either get the IIO layer out of staging (where it appears to have congealed) or stop asking people to use it. IIO stuck in staging is becoming a problem not a cure. It's creating uncertainty blocking lots of stuff that needs to get upstream and that current stream is going to become a tide post Android merging.

It needs resolving one way or the other and soon.

Alan

maintainer
#11 lore raw
Quoted 20 lines · Alan Cox
Quoted 7 lines · On Wed, 29 Feb 2012 20:18:45 +0000 Arnd Bergmann <[email protected]> wrote:
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 7 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Why is this not using IIO for its user interface?

This is become a repeating problem

Quoted 7 lines

Either get the IIO layer out of staging (where it appears to have congealed) or stop asking people to use it. IIO stuck in staging is becoming a problem not a cure. It's creating uncertainty blocking lots of stuff that needs to get upstream and that current stream is going to become a tide post Android merging.

It needs resolving one way or the other and soon.

Yes, that is probably true. It has been looking like we are closing in on merging IIO for some time now, but I'm not sure how well it's going recently. In November, Jonathan mentioned that he is busy with other things and that he would welcome other people to help out. There were patches to move parts of IIO out of staging, but I'm not completely sure how far they have come.

In case of bmp085 I don't see much of a problem and I was probably overreacting as this is an existing driver.

Unfortunately, I'm not sure if there is any reasonable alternative to iio for new device drivers: If we get a flood of new drivers for all sorts of sensors that each have their own user interface, someone still needs to review all those interfaces and come up with infrastucture to reduce the amount of code duplication and interface differences between the drivers. IIO was promising to do just that, and it has come a long way since it was initially included into staging.

Arnd

maintainer
#12 lore raw
Quoted 39 lines · Arnd Bergmann
Quoted 20 lines · Alan Cox
Quoted 7 lines · On Wed, 29 Feb 2012 20:18:45 +0000 Arnd Bergmann <[email protected]> wrote:
Quoted 6 lines · Eric Andersson

This patch-set replaces the BMP085 driver with a driver for Bosch Sensortec's new generation of pressure sensors called BMP18x. These pressure sensors can be connected on I2C but also on SPI as a variant, so the driver implements both. Register-wise they are fully compatible with the older BMP085, so the driver will support those chips as well.

Quoted 7 lines
Quoted 1 line

The driver is based on bmp085.c by Christoph Mair.

Hmm, the implementation looks fine, but I don't think we should add support for new devices with a one-off interface that we know is getting replaced by something generic.

Why is this not using IIO for its user interface?

This is become a repeating problem

Quoted 7 lines

Either get the IIO layer out of staging (where it appears to have congealed) or stop asking people to use it. IIO stuck in staging is becoming a problem not a cure. It's creating uncertainty blocking lots of stuff that needs to get upstream and that current stream is going to become a tide post Android merging.

It needs resolving one way or the other and soon.

Yes, that is probably true. It has been looking like we are closing in on merging IIO for some time now, but I'm not sure how well it's going recently. In November, Jonathan mentioned that he is busy with other things and that he would welcome other people to help out. There were patches to move parts of IIO out of staging, but I'm not completely sure how far they have come.

In case of bmp085 I don't see much of a problem and I was probably overreacting as this is an existing driver.

Quoted 8 lines

Unfortunately, I'm not sure if there is any reasonable alternative to iio for new device drivers: If we get a flood of new drivers for all sorts of sensors that each have their own user interface, someone still needs to review all those interfaces and come up with infrastucture to reduce the amount of code duplication and interface differences between the drivers. IIO was promising to do just that, and it has come a long way since it was initially included into staging.

I merged a bunch of patches cleaning up some of the core changes that iio needed to make in order for it to be able to move out of staging, and those will show up in 3.4. So, maybe, if all goes well, and people do the work, 3.5 might have it moving out.

Hopefully :)

greg k-h