Skip to content

Commit b029ffa

Browse files
Hemanth Vdtor
authored andcommitted
Input: add CMA3000 accelerometer driver
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>
1 parent 33e808c commit b029ffa

7 files changed

Lines changed: 781 additions & 0 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
Kernel driver for CMA3000-D0x
2+
============================
3+
4+
Supported chips:
5+
* VTI CMA3000-D0x
6+
Datasheet:
7+
CMA3000-D0X Product Family Specification 8281000A.02.pdf
8+
<http://www.vti.fi/en/>
9+
10+
Author: Hemanth V <hemanthv@ti.com>
11+
12+
13+
Description
14+
-----------
15+
CMA3000 Tri-axis accelerometer supports Motion detect, Measurement and
16+
Free fall modes.
17+
18+
Motion Detect Mode: Its the low power mode where interrupts are generated only
19+
when motion exceeds the defined thresholds.
20+
21+
Measurement Mode: This mode is used to read the acceleration data on X,Y,Z
22+
axis and supports 400, 100, 40 Hz sample frequency.
23+
24+
Free fall Mode: This mode is intended to save system resources.
25+
26+
Threshold values: Chip supports defining threshold values for above modes
27+
which includes time and g value. Refer product specifications for more details.
28+
29+
CMA3000 chip supports mutually exclusive I2C and SPI interfaces for
30+
communication, currently the driver supports I2C based communication only.
31+
Initial configuration for bus mode is set in non volatile memory and can later
32+
be modified through bus interface command.
33+
34+
Driver reports acceleration data through input subsystem. It generates ABS_MISC
35+
event with value 1 when free fall is detected.
36+
37+
Platform data need to be configured for initial default values.
38+
39+
Platform Data
40+
-------------
41+
fuzz_x: Noise on X Axis
42+
43+
fuzz_y: Noise on Y Axis
44+
45+
fuzz_z: Noise on Z Axis
46+
47+
g_range: G range in milli g i.e 2000 or 8000
48+
49+
mode: Default Operating mode
50+
51+
mdthr: Motion detect g range threshold value
52+
53+
mdfftmr: Motion detect and free fall time threshold value
54+
55+
ffthr: Free fall g range threshold value
56+
57+
Input Interface
58+
--------------
59+
Input driver version is 1.0.0
60+
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
61+
Input device name: "cma3000-accelerometer"
62+
Supported events:
63+
Event type 0 (Sync)
64+
Event type 3 (Absolute)
65+
Event code 0 (X)
66+
Value 47
67+
Min -8000
68+
Max 8000
69+
Fuzz 200
70+
Event code 1 (Y)
71+
Value -28
72+
Min -8000
73+
Max 8000
74+
Fuzz 200
75+
Event code 2 (Z)
76+
Value 905
77+
Min -8000
78+
Max 8000
79+
Fuzz 200
80+
Event code 40 (Misc)
81+
Value 0
82+
Min 0
83+
Max 1
84+
Event type 4 (Misc)
85+
86+
87+
Register/Platform parameters Description
88+
----------------------------------------
89+
90+
mode:
91+
0: power down mode
92+
1: 100 Hz Measurement mode
93+
2: 400 Hz Measurement mode
94+
3: 40 Hz Measurement mode
95+
4: Motion Detect mode (default)
96+
5: 100 Hz Free fall mode
97+
6: 40 Hz Free fall mode
98+
7: Power off mode
99+
100+
grange:
101+
2000: 2000 mg or 2G Range
102+
8000: 8000 mg or 8G Range
103+
104+
mdthr:
105+
X: X * 71mg (8G Range)
106+
X: X * 18mg (2G Range)
107+
108+
mdfftmr:
109+
X: (X & 0x70) * 100 ms (MDTMR)
110+
(X & 0x0F) * 2.5 ms (FFTMR 400 Hz)
111+
(X & 0x0F) * 10 ms (FFTMR 100 Hz)
112+
113+
ffthr:
114+
X: (X >> 2) * 18mg (2G Range)
115+
X: (X & 0x0F) * 71 mg (8G Range)

‎drivers/input/misc/Kconfig‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,28 @@ config INPUT_ADXL34X_SPI
448448
To compile this driver as a module, choose M here: the
449449
module will be called adxl34x-spi.
450450

451+
config INPUT_CMA3000
452+
tristate "VTI CMA3000 Tri-axis accelerometer"
453+
help
454+
Say Y here if you want to use VTI CMA3000_D0x Accelerometer
455+
driver
456+
457+
This driver currently only supports I2C interface to the
458+
controller. Also select the I2C method.
459+
460+
If unsure, say N
461+
462+
To compile this driver as a module, choose M here: the
463+
module will be called cma3000_d0x.
464+
465+
config INPUT_CMA3000_I2C
466+
tristate "Support I2C bus connection"
467+
depends on INPUT_CMA3000 && I2C
468+
help
469+
Say Y here if you want to use VTI CMA3000_D0x Accelerometer
470+
through I2C interface.
471+
472+
To compile this driver as a module, choose M here: the
473+
module will be called cma3000_d0x_i2c.
474+
451475
endif

‎drivers/input/misc/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
1818
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
1919
obj-$(CONFIG_INPUT_BFIN_ROTARY) += bfin_rotary.o
2020
obj-$(CONFIG_INPUT_CM109) += cm109.o
21+
obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o
22+
obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o
2123
obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o
2224
obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
2325
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o

0 commit comments

Comments
 (0)