Giter Club home page Giter Club logo

stmicroelectronics / stmems_linux_input_drivers Goto Github PK

View Code? Open in Web Editor NEW
56.0 26.0 49.0 1.4 GB

DISCONTINUED (October 2022): the maintenance for this repository has been discontinued. Please refer to https://github.com/STMicroelectronics/st-mems-android-linux-drivers-input for the up-to-date drivers repository. This repository contains Mainline Linux Kernel (v3.4, v3.10, v4.19) including STMicroelectronics MEMS Input sensor support

License: Other

Makefile 0.26% C 97.94% Assembly 1.35% C++ 0.03% Shell 0.13% Awk 0.01% Python 0.09% Perl 0.13% Yacc 0.02% Lex 0.01% M4 0.01% UnrealScript 0.01% Roff 0.02% XS 0.01% sed 0.01% SmPL 0.02% Raku 0.01% Gherkin 0.01% Clojure 0.01%
driver input-framework linux-kernel mems-sensors stmicroelectronics

stmems_linux_input_drivers's Introduction

Important Notice

DISCONTINUED (October 2022): the maintenance for this repository has been discontinued.

Please refer to:

https://github.com/STMicroelectronics/st-mems-android-linux-drivers-input

for the up-to-date drivers' repository.

Index

* Introduction
* Integration details
* More information
* Copyright

Introduction

This repository contains Linux kernel (v4.19, v3.10, v3.4) with STMicroelectronics MEMS sensor support. STM sensor drivers are located under the directory drivers/input/misc/st organized by sensor type:

Inertial Module Unit (IMU):

LSM330, LSM330DLC, LSM6DS0, LSM6DS3, LSM6DSL, LSM6DSM, LSM9DS0, LSM9DS1, ISM330DLC, ASM330LHH, LSM6DSO, LSM6DSO32, LSM6DSOX, LSM6DSO32X, LSM6DSR, ISM330DHCX

eCompass:

LSM303AGR, LSM303AH, LSM303C, LSM303D, LSM303DLHC, ISM303DAC

Accelerometer:

AIS328DQ, AIS3624DQ, H3LIS100DL, H3LIS331DL, LIS2DE, LIS2DE12, LIS2DH, LIS2DH12, LIS2DS12, LIS2HH12, LIS331DLH, LIS331HH, LIS3DE, LIS3DH, LIS3DSH, LIS2DW12, LIS3DHH, IIS3DHHC, IIS2DH

Gyroscope:

A3G4250D, L3G4200D, L3GD20, L3GD20H

Magnetometer:

LIS3MDL, LIS2MDL, IIS2MDC

Humidity:

HTS221

Pressure:

LPS22CH, LPS22HB, LPS22HD, LPS22HH, LPS22DF, LPS25H, LPS25HB, LPS27HHW, LPS27HHTW, LPS33HW, LPS35HW

Ultraviolet:

UVIS25

Temperature:

STTS751, STTS22H

Data collected by STM sensors are pushed to userland through the Linux kernel Input framework using EV_MSC events. User space applications can get sensor events by reading the related input device created in the /dev directory. Please see Input for more information.

All STM MEMS sensors support I2C/SPI digital interface. Please refer to I2C and SPI for detailed documentation.

Integration details

In order to explain how to integrate STM sensors in a different kernel, please consider the following LSM6DSM IMU example

Source code integration

  • Copy driver source code into the target directory (e.g. drivers/input/misc)
  • Edit related Kconfig (e.g. drivers/input/misc/Kconfig) to include LSM6DSM support:
    source "drivers/input/misc/lsm6dsm/Kconfig"
  • Edit related Makefile (e.g. drivers/input/misc/Makefile) adding the following line:
    obj-y += lsm6dsm/

Device Tree configuration

To enable driver probing, add the lsm6dsm node to the platform device tree as described below.

Required properties:

- compatible: "st,lsm6dsm"

- reg: the I2C address or SPI chip select the device will respond to

- interrupt-parent: phandle to the parent interrupt controller as documented in interrupts

- interrupts: interrupt mapping for IRQ as documented in interrupts

Recommended properties for SPI bus usage:

- spi-max-frequency: maximum SPI bus frequency as documented in SPI

Optional properties:

- st,drdy-int-pin: MEMS sensor interrupt line to use (default 1)

I2C example (based on Raspberry PI 3):

  &i2c0 {
  	status = "ok";
  	#address-cells = <0x1>;
  	#size-cells = <0x0>;
  	lsm6dsm@6b {
  		compatible = "st,lsm6dsm";
  		reg = <0x6b>;
  		interrupt-parent = <&gpio>;
  		interrupts = <26 IRQ_TYPE_EDGE_RISING>;
  };

SPI example (based on Raspberry PI 3):

  &spi0 {
  	status = "ok";
  	#address-cells = <0x1>;
  	#size-cells = <0x0>;
  	lsm6dsm@0 {
  		spi-max-frequency = <500000>;
  		compatible = "st,lsm6dsm";
  		reg = <0>;
  		interrupt-parent = <&gpio>;
  		interrupts = <26 IRQ_TYPE_EDGE_RISING>;
  	};

Kernel configuration

Configure kernel with make menuconfig (alternatively use make xconfig or make qconfig)

  Device Drivers  --->
  	Input device support  --->
  	[*]   Miscellaneous devices  --->
  		<*>   STM MEMs Device Drivers  --->
  			<M>   Inertial motion unit  --->
  				<M>   STMicroelectronics LSM6DSM sensor

More Information

http://st.com

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/input

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/i2c

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/spi

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bings/interrupt-controller/interrupts.txt

Copyright

Copyright (C) 2016 STMicroelectronics

This software is distributed under the GNU General Public License - see the accompanying COPYING file for more details.

stmems_linux_input_drivers's People

Contributors

acmel avatar airlied avatar alexdeucher avatar arndb avatar axellin avatar bigguiness avatar broonie avatar bzolnier avatar danvet avatar davem330 avatar dhowells avatar geertu avatar gregkh avatar htejun avatar ickle avatar jhovold avatar jmberg-intel avatar joeperches avatar jwrdegoede avatar larsclausen avatar linusw avatar mchehab avatar morimoto avatar olofj avatar pmundt avatar rafaeljw avatar ralfbaechle avatar tiwai avatar torvalds avatar vsyrjala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stmems_linux_input_drivers's Issues

lsm6dsl_common_probe build error, and lsm6dsl_ids link error

hi,
my kernel version is 3.4, so i download linux-3.4.y-gh

  1. My kernel config do not define CONFIG_OF.
    next build error message.

drivers/input/misc/st/imu/lsm6dsl/lsm6dsl_core.c

rivers/input/misc/st/imu/lsm6dsl/lsm6dsl_core.c: In function ‘lsm6dsl_common_probe’:
drivers/input/misc/st/imu/lsm6dsl/lsm6dsl_core.c:1474:85: error: dereferencing pointer to incomplete type
make[6]: *** [drivers/input/misc/st/imu/lsm6dsl/lsm6dsl_core.o] Error 1
make[6]: *** Waiting for unfinished jobs....
drivers/input/misc/st/imu/lsm6dsl/lsm6dsl_spi.c:196:14: error: ‘lsm6dsl_ids’ undeclared here (not in a function)
make[6]: *** [drivers/input/misc/st/imu/lsm6dsl/lsm6dsl_spi.o] Error 1
make[5]: *** [drivers/input/misc/st/imu/lsm6dsl] Error 2
make[4]: *** [drivers/input/misc/st/imu] Error 2
make[3]: *** [drivers/input/misc/st] Error 2
make[2]: *** [drivers/input/misc] Error 2
make[1]: *** [drivers/input] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
  1. where is struct lsm6dsl_platform_data ?

if CONFIG_OF is not defined, some build error happens

I think that CONFIG_OF define must be added , for .id_table

171 #ifdef CONFIG_OF
172 static const struct spi_device_id lsm6dsl_ids[] = {
173     { LSM6DSL_DEV_NAME, 0 },
174     { }
175 };
176 MODULE_DEVICE_TABLE(spi, lsm6dsl_ids);
177
178 static const struct of_device_id lsm6dsl_id_table[] = {
179     { .compatible = "st,lsm6dsl", },
180     { },
181 };
182 MODULE_DEVICE_TABLE(of, lsm6dsl_id_table);
183 #endif
184
185 static struct spi_driver lsm6dsl_spi_driver = {
186     .driver = {
187         .owner = THIS_MODULE,
188         .name = LSM6DSL_DEV_NAME,
189         .pm = LSM6DSL_PM_OPS,
190 #ifdef CONFIG_OF
191         .of_match_table = lsm6dsl_id_table,
192 #endif
193     },
194     .probe    = lsm6dsl_spi_probe,
195     .remove   = lsm6dsl_spi_remove,
196 #ifdef CONFIG_OF
197     .id_table = lsm6dsl_ids,
198 #endif
199 };

before

194     .probe    = lsm6dsl_spi_probe,
195     .remove   = lsm6dsl_spi_remove,
197     .id_table = lsm6dsl_ids,
199 };

regarding device tree configuration

I can't understand at which location I'm getting device tree file and where i need to add lsm6dsm node for I2C/SPI digital interface support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.