Skip to content

Commit

Permalink
Input: add CMA3000 accelerometer driver
Browse files Browse the repository at this point in the history
Add support for CMA3000 Tri-axis accelerometer, which supports Motion
detect, Measurement and Free fall modes. CMA3000 supports both I2C/SPI
bus for communication, currently the driver supports I2C based
communication.

Signed-off-by: Hemanth V <hemanthv@ti.com>
Reviewed-by: Jonathan Cameron <jic23@cam.ac.uk>
Reviewed-by: Sergio Aguirre <saaguirre@ti.com>
Reviewed-by: Shubhrajyoti <Shubhrajyoti@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Hemanth V authored and Dmitry Torokhov committed Dec 1, 2010
1 parent 33e808c commit b029ffa
Show file tree
Hide file tree
Showing 7 changed files with 781 additions and 0 deletions.
115 changes: 115 additions & 0 deletions Documentation/input/cma3000_d0x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Kernel driver for CMA3000-D0x
============================

Supported chips:
* VTI CMA3000-D0x
Datasheet:
CMA3000-D0X Product Family Specification 8281000A.02.pdf
<http://www.vti.fi/en/>

Author: Hemanth V <hemanthv@ti.com>


Description
-----------
CMA3000 Tri-axis accelerometer supports Motion detect, Measurement and
Free fall modes.

Motion Detect Mode: Its the low power mode where interrupts are generated only
when motion exceeds the defined thresholds.

Measurement Mode: This mode is used to read the acceleration data on X,Y,Z
axis and supports 400, 100, 40 Hz sample frequency.

Free fall Mode: This mode is intended to save system resources.

Threshold values: Chip supports defining threshold values for above modes
which includes time and g value. Refer product specifications for more details.

CMA3000 chip supports mutually exclusive I2C and SPI interfaces for
communication, currently the driver supports I2C based communication only.
Initial configuration for bus mode is set in non volatile memory and can later
be modified through bus interface command.

Driver reports acceleration data through input subsystem. It generates ABS_MISC
event with value 1 when free fall is detected.

Platform data need to be configured for initial default values.

Platform Data
-------------
fuzz_x: Noise on X Axis

fuzz_y: Noise on Y Axis

fuzz_z: Noise on Z Axis

g_range: G range in milli g i.e 2000 or 8000

mode: Default Operating mode

mdthr: Motion detect g range threshold value

mdfftmr: Motion detect and free fall time threshold value

ffthr: Free fall g range threshold value

Input Interface
--------------
Input driver version is 1.0.0
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "cma3000-accelerometer"
Supported events:
Event type 0 (Sync)
Event type 3 (Absolute)
Event code 0 (X)
Value 47
Min -8000
Max 8000
Fuzz 200
Event code 1 (Y)
Value -28
Min -8000
Max 8000
Fuzz 200
Event code 2 (Z)
Value 905
Min -8000
Max 8000
Fuzz 200
Event code 40 (Misc)
Value 0
Min 0
Max 1
Event type 4 (Misc)


Register/Platform parameters Description
----------------------------------------

mode:
0: power down mode
1: 100 Hz Measurement mode
2: 400 Hz Measurement mode
3: 40 Hz Measurement mode
4: Motion Detect mode (default)
5: 100 Hz Free fall mode
6: 40 Hz Free fall mode
7: Power off mode

grange:
2000: 2000 mg or 2G Range
8000: 8000 mg or 8G Range

mdthr:
X: X * 71mg (8G Range)
X: X * 18mg (2G Range)

mdfftmr:
X: (X & 0x70) * 100 ms (MDTMR)
(X & 0x0F) * 2.5 ms (FFTMR 400 Hz)
(X & 0x0F) * 10 ms (FFTMR 100 Hz)

ffthr:
X: (X >> 2) * 18mg (2G Range)
X: (X & 0x0F) * 71 mg (8G Range)
24 changes: 24 additions & 0 deletions drivers/input/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,28 @@ config INPUT_ADXL34X_SPI
To compile this driver as a module, choose M here: the
module will be called adxl34x-spi.

config INPUT_CMA3000
tristate "VTI CMA3000 Tri-axis accelerometer"
help
Say Y here if you want to use VTI CMA3000_D0x Accelerometer
driver

This driver currently only supports I2C interface to the
controller. Also select the I2C method.

If unsure, say N

To compile this driver as a module, choose M here: the
module will be called cma3000_d0x.

config INPUT_CMA3000_I2C
tristate "Support I2C bus connection"
depends on INPUT_CMA3000 && I2C
help
Say Y here if you want to use VTI CMA3000_D0x Accelerometer
through I2C interface.

To compile this driver as a module, choose M here: the
module will be called cma3000_d0x_i2c.

endif
2 changes: 2 additions & 0 deletions drivers/input/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
obj-$(CONFIG_INPUT_BFIN_ROTARY) += bfin_rotary.o
obj-$(CONFIG_INPUT_CM109) += cm109.o
obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o
obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o
obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o
obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
Expand Down
Loading

0 comments on commit b029ffa

Please sign in to comment.