Skip to content

Commit 5bf1d29

Browse files
cmairtorvalds
authored andcommitted
drivers/misc: support for the pressure sensor BMP085 from Bosch Sensortec
This driver adds support for the BMP085 digital pressure sensor from Bosch Sensortec. It exposes a sysfs api to userspace where pressure and temperature measurement results can be read from the pressure0_input and temp0_input file. The chip is able to calculate the average of up to eight samples to increase the accuracy. This feature can be controlled by writing to the oversampling file. The BMP085 digital pressure sensor can measure ambient air pressure and temperature. Both values can be obtained from sysfs files. The pressure is measured by reading from pressure0_input. Valid values range from 30000 to 110000 pascal with a resolution of 1 pascal (=0.01 millibar). temp0_input holds the current temperature in degree celsius, multiplied by 10. This results in a resolution of a tenth degree celsius. Values range from -400 to 850. To increase the accuracy, this chip can calculate the average of 1, 2, 4 or 8 samples. This behavior is controlled through the oversampling sysfs file. Two to the power of the value written to that file specifies how many samples will be used. Valid values: 0..3. [akpm@linux-foundation.org: fix typo] [shubhrajyoti@ti.com: optimize the wait time for the pressure sensor, definition of long is arch dependent so make it u32] [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Christoph Mair <christoph.mair@gmail.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Cc: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent cdf8afc commit 5bf1d29

4 files changed

Lines changed: 524 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
What: /sys/bus/i2c/devices/<busnum>-<devaddr>/pressure0_input
2+
Date: June 2010
3+
Contact: Christoph Mair <christoph.mair@gmail.com>
4+
Description: Start a pressure measurement and read the result. Values
5+
represent the ambient air pressure in pascal (0.01 millibar).
6+
7+
Reading: returns the current air pressure.
8+
9+
10+
What: /sys/bus/i2c/devices/<busnum>-<devaddr>/temp0_input
11+
Date: June 2010
12+
Contact: Christoph Mair <christoph.mair@gmail.com>
13+
Description: Measure the ambient temperature. The returned value represents
14+
the ambient temperature in units of 0.1 degree celsius.
15+
16+
Reading: returns the current temperature.
17+
18+
19+
What: /sys/bus/i2c/devices/<busnum>-<devaddr>/oversampling
20+
Date: June 2010
21+
Contact: Christoph Mair <christoph.mair@gmail.com>
22+
Description: Tell the bmp085 to use more samples to calculate a pressure
23+
value. When writing to this file the chip will use 2^x samples
24+
to calculate the next pressure value with x being the value
25+
written. Using this feature will decrease RMS noise and
26+
increase the measurement time.
27+
28+
Reading: returns the current oversampling setting.
29+
30+
Writing: sets a new oversampling setting.
31+
Accepted values: 0..3.

‎drivers/misc/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@ config ARM_CHARLCD
373373
line and the Linux version on the second line, but that's
374374
still useful.
375375

376+
config BMP085
377+
tristate "BMP085 digital pressure sensor"
378+
depends on I2C && SYSFS
379+
help
380+
If you say yes here you get support for the Bosch Sensortec
381+
BMP086 digital pressure sensor.
382+
383+
To compile this driver as a module, choose M here: the
384+
module will be called bmp085.
385+
376386
source "drivers/misc/c2port/Kconfig"
377387
source "drivers/misc/eeprom/Kconfig"
378388
source "drivers/misc/cb710/Kconfig"

‎drivers/misc/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
99
obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
1010
obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
1111
obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
12+
obj-$(CONFIG_BMP085) += bmp085.o
1213
obj-$(CONFIG_ICS932S401) += ics932s401.o
1314
obj-$(CONFIG_LKDTM) += lkdtm.o
1415
obj-$(CONFIG_TIFM_CORE) += tifm_core.o

0 commit comments

Comments
 (0)