AnsweredAssumed Answered

LIS2DH on an i.mx7 board running linux

Question asked by m.ed on Aug 29, 2016
We have an LIS2DH accelerometer on our board which is running linux 4.1 kernel connected by I2C and I'm trying to get it to work but have had no luck.

Here is what I did:

I got the linux driver from here: 

http://www.st.com/content/st_com/en/products/embedded-software/mems-and-sensors-software/drivers-for-mems/stsw-mems021.html

Added lis2dh.h to /include/linux/input
Added lis2dh_acc.c to /drivers/input/misc

Added this to /drivers/input/misc/Makefile:
obj-$(CONFIG_INPUT_LIS2DH)    += lis2dh_acc.o

In /drivers/input/misc/Kconfig

+config INPUT_LIS2DH
+    tristate "STMicroelectronics LIS2DH"
+     depends on INPUT
+     help
+       Say Y here to enable STMicroelectronics LIS2DH accelerometer module.

in the kernel .config file:

+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_LIS2DH=m

It compiles fine, but when I load it as a module in the running kernel all it does it print the debug message in the driver init function and nothing more. The probe function is never called....What am I missing?

Outcomes