Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6810a6ce authored by Puneet yatnala's avatar Puneet yatnala
Browse files

Merge remote-tracking branch 'origin/caf/invensense/master' into msm-3.18



* origin/caf/invensense/master:
  MA Lite 8.1.5
  MA Lite 8.1.4a

Change-Id: I275e63b727c7b906496017b3dc3f8981abd20d1b
Signed-off-by: default avatarPuneet yatnala <puneet@codeaurora.org>
parents 31994032 b1c8f25f
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
#
# inv-mpu-iio driver for Invensense MPU devices
#

config INV_MPU_IIO
	tristate
	select IIO_BUFFER
	select IIO_KFIFO_BUF
	select IIO_TRIGGER
	select CRC32

choice
	prompt "Chip name"
	depends on INV_MPU_IIO

config INV_MPU_IIO_ICM20648
	bool "ICM20648/ICM20948"
	help
	  Select this if you are using a ICM20648/ICM20948 chip.

config INV_MPU_IIO_ICM20608D
	bool "ICM20608D/ICM20609/ICM20689"
	help
	  Select this if you are using a ICM20608D/ICM20609/ICM20689 chip.

config INV_MPU_IIO_ICM20602
	bool "ICM20602"
	help
	  Select this if you are using a ICM20602 chip.

config INV_MPU_IIO_ICM20690
	bool "ICM20690"
	help
	  Select this if you are using a ICM20690 chip.

config INV_MPU_IIO_IAM20680
	bool "IAM20680"
	help
	  Select this if you are using a IAM20680 chip.

endchoice

config INV_MPU_IIO_I2C
	tristate "Invensense ICM20xxx devices (I2C)"
	depends on I2C && !INV_MPU6050_IIO
	select INV_MPU_IIO
	default n
	help
	  This driver supports Invensense ICM20xxx devices over I2C.
	  This driver can be built as a module. The module will be called
	  inv-mpu-iio-i2c.

config INV_MPU_IIO_SPI
	tristate "Invensense ICM20xxx devices (SPI)"
	depends on SPI_MASTER && !INV_MPU6050_IIO
	select INV_MPU_IIO
	default n
	help
	  This driver supports Invensense ICM20xxx devices over SPI.
	  This driver can be built as a module. The module will be called
	  inv-mpu-iio-spi.

source "drivers/iio/imu/inv_mpu/inv_test/Kconfig"
+61 −0
Original line number Diff line number Diff line
#
# Makefile for Invensense inv-mpu-iio device.
#

obj-$(CONFIG_INV_MPU_IIO) += inv-mpu-iio.o

inv-mpu-iio-objs += inv_mpu_common.o
inv-mpu-iio-objs += inv_mpu_ring.o
inv-mpu-iio-objs += inv_mpu_timestamp.o
inv-mpu-iio-objs += inv_mpu_dts.o

# chip support
ifeq ($(CONFIG_INV_MPU_IIO_ICM20648), y)
inv-mpu-iio-objs += icm20648/inv_mpu_init.o
inv-mpu-iio-objs += icm20648/inv_mpu_core.o
inv-mpu-iio-objs += icm20648/inv_mpu_parsing.o
inv-mpu-iio-objs += icm20648/inv_mpu_setup.o
inv-mpu-iio-objs += icm20648/inv_mpu_dmp_fifo.o
inv-mpu-iio-objs += icm20648/inv_slave_compass.o
inv-mpu-iio-objs += icm20648/inv_slave_pressure.o
inv-mpu-iio-objs += icm20648/inv_slave_als.o
inv-mpu-iio-objs += icm20648/inv_mpu_load_dmp.o
inv-mpu-iio-objs += icm20648/inv_mpu_selftest.o
inv-mpu-iio-objs += dmp_support/inv_mpu_misc.o
else ifeq ($(CONFIG_INV_MPU_IIO_ICM20690), y)
inv-mpu-iio-objs += icm20690/inv_mpu_init_20690.o
inv-mpu-iio-objs += icm20690/inv_mpu_core_20690.o
inv-mpu-iio-objs += icm20690/inv_mpu_parsing_20690.o
inv-mpu-iio-objs += icm20690/inv_mpu_setup_20690.o
inv-mpu-iio-objs += icm20690/inv_mpu_selftest_20690.o
inv-mpu-iio-objs += icm20690/inv_slave_compass.o
else ifeq ($(CONFIG_INV_MPU_IIO_ICM20602), y)
inv-mpu-iio-objs += icm20602/inv_mpu_init_20602.o
inv-mpu-iio-objs += icm20602/inv_mpu_core_20602.o
inv-mpu-iio-objs += icm20602/inv_mpu_parsing_20602.o
inv-mpu-iio-objs += icm20602/inv_mpu_setup_20602.o
inv-mpu-iio-objs += icm20602/inv_mpu_selftest_20602.o
else ifeq ($(CONFIG_INV_MPU_IIO_ICM20608D), y)
inv-mpu-iio-objs += icm20608d/inv_mpu_init_20608.o
inv-mpu-iio-objs += icm20608d/inv_mpu_core_20608.o
inv-mpu-iio-objs += icm20608d/inv_mpu_parsing_20608.o
inv-mpu-iio-objs += icm20608d/inv_mpu_setup_20608D.o
inv-mpu-iio-objs += icm20608d/inv_mpu_dmp_fifo.o
inv-mpu-iio-objs += icm20608d/inv_mpu_load_dmp.o
inv-mpu-iio-objs += icm20608d/inv_mpu_selftest_20608.o
inv-mpu-iio-objs += dmp_support/inv_mpu_misc.o
else ifeq ($(CONFIG_INV_MPU_IIO_IAM20680), y)
inv-mpu-iio-objs += iam20680/inv_mpu_init_20680.o
inv-mpu-iio-objs += iam20680/inv_mpu_core_20680.o
inv-mpu-iio-objs += iam20680/inv_mpu_parsing_20680.o
inv-mpu-iio-objs += iam20680/inv_mpu_setup_20680.o
inv-mpu-iio-objs += iam20680/inv_mpu_selftest_20680.o
endif

# Bus support
obj-$(CONFIG_INV_MPU_IIO_I2C) += inv-mpu-iio-i2c.o
inv-mpu-iio-i2c-objs := inv_mpu_i2c.o
obj-$(CONFIG_INV_MPU_IIO_SPI) += inv-mpu-iio-spi.o
inv-mpu-iio-spi-objs := inv_mpu_spi.o

obj-y += inv_test/
+117 −0
Original line number Diff line number Diff line
Kernel driver inv-mpu-iio
Author: InvenSense, Inc.


Table of Contents
=================
- Description
- Integrating the Driver in the Linux Kernel
- Dts file
- Communicating with the Driver in Userspace


Description
===========
This document describes how to install the Invensense device driver into a
Linux kernel. The supported chips are listed in Kconfig and user selects an
appropriate one from .e.g. menuconfig.


Integrating the Driver in the Linux Kernel
==========================================
Please add the files as follows (kernel 3.10):
- Copy mpu.h to <kernel_root>/include/linux/iio/imu/
- Copy inv_mpu folder under <kernel_root>/drivers/iio/imu/

In order to see the driver in menuconfig when building the kernel, please
make modifications as shown below:

    add "source "drivers/iio/imu/inv_mpu/Kconfig""
      in <kernel_root>/drivers/iio/imu/Kconfig

    add "obj-y += inv_mpu/"
      in <kernel_root>/drivers/iio/imu/Makefile



Dts file
========
In order to recognize the Invensense device on the I2C/SPI bus, dts(or dtsi)
file must be modified.

Example)
ICM20648 + AK09911/BMP280/APDS9930 on AUX I2C

    i2c@f9968000 {
        /* Invensense */
        mpu6515_acc@68 {
            compatible = "inven,icm20648";
            reg = <0x68>;
            interrupt-parent = <&msmgpio>;
            interrupts = <73 0x2>;
            inven,vdd_ana-supply = <&pm8941_l17>;
            inven,vcc_i2c-supply = <&pm8941_lvs1>;
            inven,gpio_int1 = <&msmgpio 73 0x00>;
            fs_range = <0x00>;
            /* mount matrix */
            axis_map_x = <1>;
            axis_map_y = <0>;
            axis_map_z = <2>;
            negate_x = <0>;
            negate_y = <0>;
            negate_z = <1>;
            poll_interval = <200>;
            min_interval = <5>;
            inven,secondary_reg = <0x0c>;
            /* If no compass sensor,
             * replace "compass" with "none"
             */
            inven,secondary_type = "compass";
            inven,secondary_name = "ak09911";
            inven,secondary_axis_map_x = <1>;
            inven,secondary_axis_map_y = <0>;
            inven,secondary_axis_map_z = <2>;
            inven,secondary_negate_x = <1>;
            inven,secondary_negate_y = <1>;
            inven,secondary_negate_z = <1>;
            /* If no pressure sensor,
             * replace "pressure" with "none"
             */
            inven,aux_type = "pressure";
            inven,aux_name = "bmp280";
            inven,aux_reg = <0x76>;
            /* If no ALS sensor
             * replace "als" with "none"
             */
            inven,read_only_slave_type = "als";
            inven,read_only_slave_name = "apds9930";
            inven,read_only_slave_reg = <0x39>;
        };
    };


Communicating with the Driver in Userspace
==========================================
The driver generates several files in sysfs upon installation.
These files are used to communicate with the driver. The files can be found at:

(I2C) /sys/devices/*.i2c/i2c-*/*-*/iio:device*
(SPI) /sys/devices/*.spi/spi_master/spi*/spi*.*/iio:device*

Group and Owner for all entries should be updated to system/system at
boot time to allow userspace to access properly.


License
=======
Copyright (C) 2018 InvenSense, Inc.

This software is licensed under the terms of the GNU General Public
License version 2, as published by the Free Software Foundation, and
may be copied, distributed, and modified under those terms.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
Loading