From 4ab1bced97cd8a85cff25de4cbf66bd181408e97 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Wed, 25 Nov 2020 13:38:36 +0100 Subject: linux-renesas: update driver for asm330lhh accel & gyro Enable upstream kernel driver for asm330lhh: st_lsm6dsx, and remove kernel driver st_asm330lhh introduced previously via patch: * update kernel config fragment to select st_lsm6dsx; * update yocto recipe to remove patch adding st_asm330lhh driver. Bug-AGL: SPEC-3658 Signed-off-by: Raquel Medina Change-Id: I05e86130aab729f848ff18178fe74923c290ae00 --- .../linux/files/0002-add-st_asm330lhh-driver.patch | 2112 -------------------- .../recipes-kernel/linux/files/refhw-rcar.cfg | 6 +- .../recipes-kernel/linux/linux-renesas_%.bbappend | 1 - 3 files changed, 3 insertions(+), 2116 deletions(-) delete mode 100644 meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-add-st_asm330lhh-driver.patch diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-add-st_asm330lhh-driver.patch b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-add-st_asm330lhh-driver.patch deleted file mode 100644 index c779b39..0000000 --- a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-add-st_asm330lhh-driver.patch +++ /dev/null @@ -1,2112 +0,0 @@ ---- - drivers/iio/imu/st_asm330lhh/Kconfig | 22 + - drivers/iio/imu/st_asm330lhh/Makefile | 5 + - drivers/iio/imu/st_asm330lhh/README.md | 201 +++++ - drivers/iio/imu/st_asm330lhh/st_asm330lhh.h | 247 ++++++ - drivers/iio/imu/st_asm330lhh/st_asm330lhh_buffer.c | 540 ++++++++++++++ - drivers/iio/imu/st_asm330lhh/st_asm330lhh_core.c | 824 +++++++++++++++++++++ - drivers/iio/imu/st_asm330lhh/st_asm330lhh_i2c.c | 94 +++ - drivers/iio/imu/st_asm330lhh/st_asm330lhh_spi.c | 109 +++ - 8 files changed, 2042 insertions(+) - create mode 100644 drivers/iio/imu/st_asm330lhh/Kconfig - create mode 100644 drivers/iio/imu/st_asm330lhh/Makefile - create mode 100644 drivers/iio/imu/st_asm330lhh/README.md - create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh.h - create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_buffer.c - create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_core.c - create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_i2c.c - create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_spi.c - -diff --git a/drivers/iio/imu/st_asm330lhh/Kconfig b/drivers/iio/imu/st_asm330lhh/Kconfig -new file mode 100644 -index 0000000..0e8920e ---- /dev/null -+++ b/drivers/iio/imu/st_asm330lhh/Kconfig -@@ -0,0 +1,22 @@ -+config IIO_ST_ASM330LHH -+ tristate "STMicroelectronics ASM330LHH sensor" -+ depends on (I2C || SPI) -+ select IIO_BUFFER -+ select IIO_KFIFO_BUF -+ select IIO_ST_ASM330LHH_I2C if (I2C) -+ select IIO_ST_ASM330LHH_SPI if (SPI_MASTER) -+ help -+ Say yes here to build support for STMicroelectronics ASM330LHH imu -+ sensor. -+ -+ To compile this driver as a module, choose M here: the module -+ will be called st_asm330lhh. -+ -+config IIO_ST_ASM330LHH_I2C -+ tristate -+ depends on IIO_ST_ASM330LHH -+ -+config IIO_ST_ASM330LHH_SPI -+ tristate -+ depends on IIO_ST_ASM330LHH -+ -diff --git a/drivers/iio/imu/st_asm330lhh/Makefile b/drivers/iio/imu/st_asm330lhh/Makefile -new file mode 100644 -index 0000000..7af80de ---- /dev/null -+++ b/drivers/iio/imu/st_asm330lhh/Makefile -@@ -0,0 +1,5 @@ -+st_asm330lhh-y := st_asm330lhh_core.o st_asm330lhh_buffer.o -+ -+obj-$(CONFIG_IIO_ST_ASM330LHH) += st_asm330lhh.o -+obj-$(CONFIG_IIO_ST_ASM330LHH_I2C) += st_asm330lhh_i2c.o -+obj-$(CONFIG_IIO_ST_ASM330LHH_SPI) += st_asm330lhh_spi.o -diff --git a/drivers/iio/imu/st_asm330lhh/README.md b/drivers/iio/imu/st_asm330lhh/README.md -new file mode 100644 -index 0000000..d471530 ---- /dev/null -+++ b/drivers/iio/imu/st_asm330lhh/README.md -@@ -0,0 +1,201 @@ -+Index -+======= -+ * Introduction -+ * Driver Integration details -+ * Android SensorHAL integration -+ * Linux SensorHAL integration -+ * More information -+ * Copyright -+ -+ -+Introduction -+============== -+This repository contains asm330lhh IMU STMicroelectronics MEMS sensor linux driver support for kernel version 4.14. -+ -+Data collected by asm330lhh STM sensor are pushed to userland through the kernel buffers of Linux IIO framework. User space applications can get sensor events by reading the related IIO devices created in the /dev directory (*/dev/iio{x}*). Please see [IIO][1] for more information. -+ -+Asm330lhh IMU STM MEMS sensor support *I2C/SPI* digital interface. Please refer to [I2C][2] and [SPI][3] for detailed documentation. -+ -+The STM Hardware Abstraction Layer (*HAL*) defines a standard interface for STM sensors allowing Android to be agnostic about low level driver implementation. The HAL library is packaged into modules (.so) file and loaded by the Android or Linux system at the appropriate time. For more information see [AOSP HAL Interface](https://source.android.com/devices/sensors/hal-interface.html) -+ -+STM Sensor HAL is leaning on [Linux IIO framework](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/iio) to gather data from sensor device drivers and to forward samples to the Android Framework -+ -+Driver Integration details -+===================== -+ -+In order to explain how to integrate Asm330lhh IMU STM sensor into the kernel, please consider the following example -+ -+### Source code integration -+ -+> * Copy driver source code into your linux kernel target directory (e.g. *drivers/iio/imu*) -+> * Edit related Kconfig (e.g. *drivers/iio/imu/Kconfig*) adding *ASM330LHH* support: -+ -+> source "drivers/iio/imu/st_asm330lhh/Kconfig" -+ -+> * Edit related Makefile (e.g. *drivers/iio/imu/Makefile*) adding the following line: -+ -+> obj-y += st_asm330lhh/ -+ -+### Device Tree configuration -+ -+> To enable driver probing, add the asm330lhh node to the platform device tree as described below. -+ -+> **Required properties:** -+ -+> *- compatible*: "st,asm330lhh" -+ -+> *- 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][4] -+ -+> *- interrupts*: interrupt mapping for IRQ as documented in [interrupts][4] -+> -+>**Recommended properties for SPI bus usage:** -+ -+> *- spi-max-frequency*: maximum SPI bus frequency as documented in [SPI][3] -+> -+> **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>; -+> asm330lhh@6b { -+> compatible = "st,asm330lhh"; -+> 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>; -+> asm330lhh@0 { -+> spi-max-frequency = <500000>; -+> compatible = "st,asm330lhh"; -+> 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 ---> -+> Industrial I/O support ---> -+> Inertial measurement units ---> -+> STMicroelectronics ASM330LHH sensor ---> -+ -+ -+Android SensorHAL integration -+============== -+ -+STM Sensor HAL is written in *C++* language using object-oriented design. For each hw sensor there is a custom class file (*Accelerometer.cpp*, *Gyroscope.cpp*) which extends the common base class (*SensorBase.cpp*). -+ -+Copy the HAL source code into */hardware/STMicroelectronics/SensorHAL_IIO* folder. During building process Android will include automatically the SensorHAL Android.mk. -+In */device///device.mk* add package build information: -+ -+ PRODUCT_PACKAGES += sensors.{TARGET_BOARD_PLATFORM} -+ -+ Note: device.mk can not read $(TARGET_BOARD_PLATFORM) variable, read and replace the value from your BoardConfig.mk (e.g. PRODUCT_PACKAGES += sensors.msm8974 for Nexus 5) -+ -+To compile the SensorHAL_IIO just build AOSP source code from *$TOP* folder -+ -+ $ cd -+ $ source build/envsetup.sh -+ $ lunch