From patchwork Tue Mar 26 10:16:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161169 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024257jan; Tue, 26 Mar 2019 03:17:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqVlhhLY5sWH4/TIjpISzDKglPi8U7Dq2ELCSj+9my6TjAHXSCai15gz1jxRL+mYqMKgT9 X-Received: by 2002:a65:6109:: with SMTP id z9mr2534634pgu.419.1553595429583; Tue, 26 Mar 2019 03:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595429; cv=none; d=google.com; s=arc-20160816; b=GoYT7C7F819BPS6xa0ztr/yrxU/K06UQYKnmGPVBik6WWFCMy/9rTqHCS+VTWigL6V 2pxH571C60EywsrOkSgOmt5ItuG30IYgRR4FQjo+otHdW4g65w3gefJJUXdK8sgTnTHd sSSF3A7zaDj0BdZx5gDRAZ8q3yRI9LwVtkdNHZZhSpnVwgmQwy89XZPZhpCPaZVbu30A 3GOSmaiFRaRBLhCZgtOLu+HCpmz51dvd37o/7rTqkxF51PYLHaOPFIrbcbuXJitM6H/D XmFqjlXWx92lCIdpTaSNYRlM67yhNPI4Xujg4kEao6lqVMtHpZdkKCb1GLzFr+g3+Wzy wFlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hsHbm6H4k3Rr7SoTD7ilcig3tjV30GukFS8w5W/eA04=; b=xrVufhXSFiXIbdPlfgOE9p6SPvRMY4la/WFAAFu7blR+aDBl2UyQATXrehhivINAAH xQ4MH2jqJTbli1okf8rvRXaetAZx4ZORttLyaNJUykDaa0uoq7WOdTMP5FM3mlM75rjd IVlZLXZUE2P/y4raFdXC7NcF+YOavQIwYcbZHh2/G5uV6z6q/eOm+pPdF5YHOAxomRLX eGZDK6QebwinM+u3qVX8rBR0KtcwZRVehLiH1eqwuftuzEoQEaUatx/ZsMcetspVjWuG SeMvbv1ZPA6tbPGjeCJshstrggHiofX/41gJRVyRDhSnz8LRInJ+OuJQyHkCKFZ/bEUk rb9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RxTr9WOK; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si16358589plp.406.2019.03.26.03.17.09; Tue, 26 Mar 2019 03:17:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RxTr9WOK; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbfCZKRI (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:08 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40156 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbfCZKRI (ORCPT ); Tue, 26 Mar 2019 06:17:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id t5so13550111wri.7 for ; Tue, 26 Mar 2019 03:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hsHbm6H4k3Rr7SoTD7ilcig3tjV30GukFS8w5W/eA04=; b=RxTr9WOKVgMkQ3FDYS93MYDdmi+tJcmYCYQTh4+WLSxbjvCB4m8A1W8Hd0N+S+E248 D35ZpcK5Aoo7ti5lXyioRxtzfV8OkEsim+3yDkEqXu+1EdR/Y6J6J1SHXCh8BES6hS4I Qh3pojeEhvOyLRiq9GvPtdCQR1F1H2F/cpHSFuJjf99gPN/uBS08uZ16LkDEiKjL5DUl UlqJSl3HdhRHjv4rVkq0rAlvLVSexIutuHVqG3w/q/+Ia3OVOAh9PhJ2vVMQQUrKIDN6 T/WArG4uoQtXyzCF8kEz4zL6J76tNIde9y5iTSaR7wp7+EBtjzZIYlY7IRYU3yjcLIZq yP1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hsHbm6H4k3Rr7SoTD7ilcig3tjV30GukFS8w5W/eA04=; b=hGJ4tZ2pQpIjjWbDvIrp8mURfGl/wLUgVXHiDhH8Ga1cGJa8gp0X2DvGL8swXMdSTY 0GXq0qqkjYL2hNewa0gT5wuoT3QoLkz8/w5dbvIEe1JUAgh1L3qFgFJ0aycEA063o4AM a6ltYVIc+nYyq2QPOQzoXHk2Nr1siXk+KyT1FcXOq8VT4ylNDOIuSFaHn+ZR+nRCbj5A k4mi+lfMM8e/swwNVJuuHk996ArnL5YozvaMGU4DBlfj5v0Gji8vb6Y/QG51v1bRhR7i WeADzpaGq7ZJzOy3ZOckU7zXBnWS6IdaBjlyO8CjrTwpG9t3MIsKMu+jbYRH3jqeImAN S4YA== X-Gm-Message-State: APjAAAWYVNu5Khl5srh5lyIh9erQAV/jgqsdKjhIPuFO55YbLb9Ev6kY JE4/KhLm2qgtXyMa4lxwVeakHA== X-Received: by 2002:adf:ee91:: with SMTP id b17mr19127096wro.234.1553595426821; Tue, 26 Mar 2019 03:17:06 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:06 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 1/6] iio: gyro: add DT bindings to fxas21002c Date: Tue, 26 Mar 2019 10:16:46 +0000 Message-Id: <20190326101651.25056-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add device tree bindings for the FXAS21002C gyroscope. Signed-off-by: Rui Miguel Silva --- .../bindings/iio/gyroscope/nxp,fxas21002c.txt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt -- 2.21.0 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt b/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt new file mode 100644 index 000000000000..465e104bbf14 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt @@ -0,0 +1,31 @@ +* NXP FXAS21002C Gyroscope device tree bindings + +http://www.nxp.com/products/sensors/gyroscopes/3-axis-digital-gyroscope:FXAS21002C + +Required properties: + - compatible : should be "nxp,fxas21002c" + - reg : the I2C address of the sensor or SPI chip select number for the + device. + - vdd-supply: phandle to the regulator that provides power to the sensor. + - vddio-supply: phandle to the regulator that provides power to the bus. + +Optional properties: + - reset-gpios : gpio used to reset the device, see gpio/gpio.txt + - interrupts : device support 2 interrupts, INT1 and INT2, + the interrupts can be triggered on rising or falling edges. + See interrupt-controller/interrupts.txt + - interrupt-names: should contain "INT1" or "INT2", the gyroscope interrupt + line in use. + - drive-open-drain: the interrupt/data ready line will be configured + as open drain, which is useful if several sensors share + the same interrupt line. This is a boolean property. + (This binding is taken from pinctrl/pinctrl-bindings.txt) + +Example: + +gyroscope@20 { + compatible = "nxp,fxas21002c"; + reg = <0x20>; + vdd-supply = <®_peri_3p15v>; + vddio-supply = <®_peri_3p15v>; +}; From patchwork Tue Mar 26 10:16:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161171 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024362jan; Tue, 26 Mar 2019 03:17:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf4mThXMuAQMBZQGiHiDI7LYsPX+ir+yH+CQn9FG4SRqRSFmmMzvEh/MP6FC9CIQKlosFv X-Received: by 2002:aa7:8a95:: with SMTP id a21mr28828576pfc.14.1553595435990; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595435; cv=none; d=google.com; s=arc-20160816; b=Efb/4HVxVPg4p5y79ajshda4/Q7ZIZ3PauwCorlRNXd0RDgtcsHjX8h0LdPvFy6WiK vPns4Tba73XnMRHGHNVJH9DYHA/Ag/sWytBEMqmnzj0f1N48Bfy+octZoio0XhJ/zIH3 gk0Z6kGnEzRMw3EO49tEE0L+kk0KvvzN/nV+ZJUQTG40St0+Znk7lJ6FV1oeiSDRmIEx GpkpeuwbH69ZsaJ3uZdreEkh5jADFYTGyNBsCL+adTcjr8wSqdIMx02j04uz42O0N1Rx En57jIfJVjNi2MwCthe9LL6U4ONqBKhY9ryV2HCPF/SWjjPwFBJQSWFWhaRs1xXo5Mwq FMrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8skEszEYECAfs7s2h749fL7kh72dQljsXAs6rcgLKdk=; b=GT0N5XhUVQBDSB+BNGT9hpNgxfe5l+gQnJ88VUQeB0xTzlB4MGvSJX+POTe1aSQ5U4 iIVaoyMP+eeRDa0Aw0WZzdBYEfuJb/5GWB492KuBQHKVra9FjWTqFXIf6tf7PAT/r1BI yguXSBe7TkDZyCOVp1oaChfom15pMzOIDg0YIPYL4e1GpyhkBaPVeMzYSq6zbXnWmIhg 7qS4XBj5enniFb8E0DRRuCG/Jf33mIYNk4o0n2AB+JaFYMZVqlMMHoDkGif0+0z+SqAj 3quKRbSQ8YcyiJS0pQfkc7ssQDKpM7srJ6/8OjgRbh6s+j1aECDhiU6m8PY1yxUGVjdS vAKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uF1+G5/X"; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g127si15687742pgc.313.2019.03.26.03.17.15; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uF1+G5/X"; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbfCZKRN (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:13 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41920 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbfCZKRN (ORCPT ); Tue, 26 Mar 2019 06:17:13 -0400 Received: by mail-wr1-f65.google.com with SMTP id r4so5916343wrq.8 for ; Tue, 26 Mar 2019 03:17:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8skEszEYECAfs7s2h749fL7kh72dQljsXAs6rcgLKdk=; b=uF1+G5/XwoURlqduPK8L3R051C1KeFg7XTCYGTh8Fu7UQoOMm70NwMK893pxYQf9aS m2gTMBVTzYYhejS/Rlbl/ZBuFTbwDfgwi679blwfNklPfmRnxF9Q31ZH4ifme8ywKvJ6 TAQ36EO4h9vjhULYSkZvl2q37ZC0Sax41A6o3iiNttH3tevajHso3BeOyDaOEQRl3AQH OBXe4BH7Ctl3p5fRimtDlUazuyZn2gxjQg1XPlxGRfoo+/BbYEXcr+iZtbVYC5KRlxHa BOK8eg3eYE5MVnkc4OoQ+UbIKqhZhXorhgYMkub8gkPXeO1LV5FBrEPrSJ0c2T+b74Wt U2og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8skEszEYECAfs7s2h749fL7kh72dQljsXAs6rcgLKdk=; b=DViv2gHx0tYmRUCmDUxGjeX5cRobedKXrjRmHCMrysZD7CdK/15rj8adle0//oXDsI 1nUilNJgRrHh5pP97n+xyq60b7qH7EPbGerKcdW28N0j6BsckDQnAX7F+2hyvP4YizJb Fmh1cCvnQ0FwSgv5r5rBge2z3pCOFqtp4YDf5FWhOh0vbPmOgUwfKBJKpAfchHFAf5gx dbrW26EJOU6ZEJIXZPqpOQBgZUwAwZemlW0rCZFl+nsMsTDpcMNPd7JKjzFjKjIgJGoh Bw7bdmHkKzfoKvpq7CDH9TOWRuUkAvaPPl1ueZ1BgjYETFhw0yQQJ4WaHI/r/PdYbL0p 6wHg== X-Gm-Message-State: APjAAAU0L6BBh4JEA9HoooKtM8nzg5++4liH/Sx8P2RqELZzqa9EArZr IAqPNUj8rFbSBSIgWLzX0ZaYKQ== X-Received: by 2002:adf:e6c6:: with SMTP id y6mr18957893wrm.225.1553595430032; Tue, 26 Mar 2019 03:17:10 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:08 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 2/6] iio: gyro: add core driver for fxas21002c Date: Tue, 26 Mar 2019 10:16:47 +0000 Message-Id: <20190326101651.25056-3-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add core support for the NXP fxas21002c Tri-axis gyroscope, using the iio subsystem. It supports PM operations, axis reading, temperature, scale factor of the axis, high pass and low pass filtering, and sampling frequency selection. It will have extras modules to support the communication over i2c and spi. Signed-off-by: Rui Miguel Silva --- drivers/iio/gyro/Kconfig | 11 + drivers/iio/gyro/Makefile | 1 + drivers/iio/gyro/fxas21002c.h | 151 +++++ drivers/iio/gyro/fxas21002c_core.c | 1006 ++++++++++++++++++++++++++++ 4 files changed, 1169 insertions(+) create mode 100644 drivers/iio/gyro/fxas21002c.h create mode 100644 drivers/iio/gyro/fxas21002c_core.c -- 2.21.0 diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index 3126cf05e6b9..cfd2cf44bac8 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig @@ -73,6 +73,17 @@ config BMG160_SPI tristate select REGMAP_SPI +config FXAS21002C + tristate "NXP FXAS21002C Gyro Sensor" + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for NXP FXAS21002C Tri-axis Gyro + Sensor driver connected via I2C or SPI. + + This driver can also be built as a module. If so, the module + will be called fxas21002c_i2c or fxas21002c_spi. + config HID_SENSOR_GYRO_3D depends on HID_SENSOR_HUB select IIO_BUFFER diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile index 295ec780c4eb..247dc600a602 100644 --- a/drivers/iio/gyro/Makefile +++ b/drivers/iio/gyro/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_ADXRS450) += adxrs450.o obj-$(CONFIG_BMG160) += bmg160_core.o obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o obj-$(CONFIG_BMG160_SPI) += bmg160_spi.o +obj-$(CONFIG_FXAS21002C) += fxas21002c_core.o obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o diff --git a/drivers/iio/gyro/fxas21002c.h b/drivers/iio/gyro/fxas21002c.h new file mode 100644 index 000000000000..e21fd410950c --- /dev/null +++ b/drivers/iio/gyro/fxas21002c.h @@ -0,0 +1,151 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Driver for NXP FXAS21002C Gyroscope - Header + * + * Copyright (C) 2019 Linaro Ltd. + * + */ + +#ifndef FXAS21002C_H_ +#define FXAS21002C_H_ + +#include + +#define FXAS21002C_REG_STATUS 0x00 +#define FXAS21002C_REG_OUT_X_MSB 0x01 +#define FXAS21002C_REG_OUT_X_LSB 0x02 +#define FXAS21002C_REG_OUT_Y_MSB 0x03 +#define FXAS21002C_REG_OUT_Y_LSB 0x04 +#define FXAS21002C_REG_OUT_Z_MSB 0x05 +#define FXAS21002C_REG_OUT_Z_LSB 0x06 +#define FXAS21002C_REG_DR_STATUS 0x07 +#define FXAS21002C_REG_F_STATUS 0x08 +#define FXAS21002C_REG_F_SETUP 0x09 +#define FXAS21002C_REG_F_EVENT 0x0A +#define FXAS21002C_REG_INT_SRC_FLAG 0x0B +#define FXAS21002C_REG_WHO_AM_I 0x0C +#define FXAS21002C_REG_CTRL0 0x0D +#define FXAS21002C_REG_RT_CFG 0x0E +#define FXAS21002C_REG_RT_SRC 0x0F +#define FXAS21002C_REG_RT_THS 0x10 +#define FXAS21002C_REG_RT_COUNT 0x11 +#define FXAS21002C_REG_TEMP 0x12 +#define FXAS21002C_REG_CTRL1 0x13 +#define FXAS21002C_REG_CTRL2 0x14 +#define FXAS21002C_REG_CTRL3 0x15 + +enum fxas21002c_fields { + F_DR_STATUS, + F_OUT_X_MSB, + F_OUT_X_LSB, + F_OUT_Y_MSB, + F_OUT_Y_LSB, + F_OUT_Z_MSB, + F_OUT_Z_LSB, + /* DR_STATUS */ + F_ZYX_OW, F_Z_OW, F_Y_OW, F_X_OW, F_ZYX_DR, F_Z_DR, F_Y_DR, F_X_DR, + /* F_STATUS */ + F_OVF, F_WMKF, F_CNT, + /* F_SETUP */ + F_MODE, F_WMRK, + /* F_EVENT */ + F_EVENT, FE_TIME, + /* INT_SOURCE_FLAG */ + F_BOOTEND, F_SRC_FIFO, F_SRC_RT, F_SRC_DRDY, + /* WHO_AM_I */ + F_WHO_AM_I, + /* CTRL_REG0 */ + F_BW, F_SPIW, F_SEL, F_HPF_EN, F_FS, + /* RT_CFG */ + F_ELE, F_ZTEFE, F_YTEFE, F_XTEFE, + /* RT_SRC */ + F_EA, F_ZRT, F_ZRT_POL, F_YRT, F_YRT_POL, F_XRT, F_XRT_POL, + /* RT_THS */ + F_DBCNTM, F_THS, + /* RT_COUNT */ + F_RT_COUNT, + /* TEMP */ + F_TEMP, + /* CTRL_REG1 */ + F_RST, F_ST, F_DR, F_ACTIVE, F_READY, + /* CTRL_REG2 */ + F_INT_CFG_FIFO, F_INT_EN_FIFO, F_INT_CFG_RT, F_INT_EN_RT, + F_INT_CFG_DRDY, F_INT_EN_DRDY, F_IPOL, F_PP_OD, + /* CTRL_REG3 */ + F_WRAPTOONE, F_EXTCTRLEN, F_FS_DOUBLE, + /* MAX FIELDS */ + F_MAX_FIELDS, +}; + +static const struct reg_field fxas21002c_reg_fields[] = { + [F_DR_STATUS] = REG_FIELD(FXAS21002C_REG_STATUS, 0, 7), + [F_OUT_X_MSB] = REG_FIELD(FXAS21002C_REG_OUT_X_MSB, 0, 7), + [F_OUT_X_LSB] = REG_FIELD(FXAS21002C_REG_OUT_X_LSB, 0, 7), + [F_OUT_Y_MSB] = REG_FIELD(FXAS21002C_REG_OUT_Y_MSB, 0, 7), + [F_OUT_Y_LSB] = REG_FIELD(FXAS21002C_REG_OUT_Y_LSB, 0, 7), + [F_OUT_Z_MSB] = REG_FIELD(FXAS21002C_REG_OUT_Z_MSB, 0, 7), + [F_OUT_Z_LSB] = REG_FIELD(FXAS21002C_REG_OUT_Z_LSB, 0, 7), + [F_ZYX_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 7, 7), + [F_Z_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 6, 6), + [F_Y_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 5, 5), + [F_X_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 4, 4), + [F_ZYX_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 3, 3), + [F_Z_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 2, 2), + [F_Y_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 1, 1), + [F_X_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 0, 0), + [F_OVF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 7, 7), + [F_WMKF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 6, 6), + [F_CNT] = REG_FIELD(FXAS21002C_REG_F_STATUS, 0, 5), + [F_MODE] = REG_FIELD(FXAS21002C_REG_F_SETUP, 6, 7), + [F_WMRK] = REG_FIELD(FXAS21002C_REG_F_SETUP, 0, 5), + [F_EVENT] = REG_FIELD(FXAS21002C_REG_F_EVENT, 5, 5), + [FE_TIME] = REG_FIELD(FXAS21002C_REG_F_EVENT, 0, 4), + [F_BOOTEND] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 3, 3), + [F_SRC_FIFO] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 2, 2), + [F_SRC_RT] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 1, 1), + [F_SRC_DRDY] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 0, 0), + [F_WHO_AM_I] = REG_FIELD(FXAS21002C_REG_WHO_AM_I, 0, 7), + [F_BW] = REG_FIELD(FXAS21002C_REG_CTRL0, 6, 7), + [F_SPIW] = REG_FIELD(FXAS21002C_REG_CTRL0, 5, 5), + [F_SEL] = REG_FIELD(FXAS21002C_REG_CTRL0, 3, 4), + [F_HPF_EN] = REG_FIELD(FXAS21002C_REG_CTRL0, 2, 2), + [F_FS] = REG_FIELD(FXAS21002C_REG_CTRL0, 0, 1), + [F_ELE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 3, 3), + [F_ZTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 2, 2), + [F_YTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 1, 1), + [F_XTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 0, 0), + [F_EA] = REG_FIELD(FXAS21002C_REG_RT_SRC, 6, 6), + [F_ZRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 5, 5), + [F_ZRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 4, 4), + [F_YRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 3, 3), + [F_YRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 2, 2), + [F_XRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 1, 1), + [F_XRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 0), + [F_DBCNTM] = REG_FIELD(FXAS21002C_REG_RT_THS, 7, 7), + [F_THS] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 6), + [F_RT_COUNT] = REG_FIELD(FXAS21002C_REG_RT_COUNT, 0, 7), + [F_TEMP] = REG_FIELD(FXAS21002C_REG_TEMP, 0, 7), + [F_RST] = REG_FIELD(FXAS21002C_REG_CTRL1, 6, 6), + [F_ST] = REG_FIELD(FXAS21002C_REG_CTRL1, 5, 5), + [F_DR] = REG_FIELD(FXAS21002C_REG_CTRL1, 2, 4), + [F_ACTIVE] = REG_FIELD(FXAS21002C_REG_CTRL1, 1, 1), + [F_READY] = REG_FIELD(FXAS21002C_REG_CTRL1, 0, 0), + [F_INT_CFG_FIFO] = REG_FIELD(FXAS21002C_REG_CTRL2, 7, 7), + [F_INT_EN_FIFO] = REG_FIELD(FXAS21002C_REG_CTRL2, 6, 6), + [F_INT_CFG_RT] = REG_FIELD(FXAS21002C_REG_CTRL2, 5, 5), + [F_INT_EN_RT] = REG_FIELD(FXAS21002C_REG_CTRL2, 4, 4), + [F_INT_CFG_DRDY] = REG_FIELD(FXAS21002C_REG_CTRL2, 3, 3), + [F_INT_EN_DRDY] = REG_FIELD(FXAS21002C_REG_CTRL2, 2, 2), + [F_IPOL] = REG_FIELD(FXAS21002C_REG_CTRL2, 1, 1), + [F_PP_OD] = REG_FIELD(FXAS21002C_REG_CTRL2, 0, 0), + [F_WRAPTOONE] = REG_FIELD(FXAS21002C_REG_CTRL3, 3, 3), + [F_EXTCTRLEN] = REG_FIELD(FXAS21002C_REG_CTRL3, 2, 2), + [F_FS_DOUBLE] = REG_FIELD(FXAS21002C_REG_CTRL3, 0, 0), +}; + +extern const struct dev_pm_ops fxas21002c_pm_ops; + +int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, + const char *name); +void fxas21002c_core_remove(struct device *dev); +#endif diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c new file mode 100644 index 000000000000..1f41e450ecb7 --- /dev/null +++ b/drivers/iio/gyro/fxas21002c_core.c @@ -0,0 +1,1006 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for NXP FXAS21002C Gyroscope - Core + * + * Copyright (C) 2019 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "fxas21002c.h" + +#define FXAS21002C_CHIP_ID_1 0xD6 +#define FXAS21002C_CHIP_ID_2 0xD7 + +enum fxas21002c_mode_state { + FXAS21002C_MODE_STANDBY, + FXAS21002C_MODE_READY, + FXAS21002C_MODE_ACTIVE, +}; + +#define FXAS21002C_STANDBY_ACTIVE_TIME_MS 62 +#define FXAS21002C_READY_ACTIVE_TIME_MS 7 + +#define FXAS21002C_ODR_LIST_MAX 10 + +#define FXAS21002C_SCALE_FRACTIONAL 32 +#define FXAS21002C_RANGE_LIMIT_DOUBLE 2000 + +#define FXAS21002C_AXIS_TO_REG(axis) (FXAS21002C_REG_OUT_X_MSB + ((axis) * 2)) + +static const int fxas21002c_odr_values[] = { + 800, 400, 200, 100, 50, 25, 12, 12 +}; + +/* + * These values are taken from the low-pass filter cutoff frequency calculated + * ODR * 0.lpf_values. So, for ODR = 800Hz with a lpf value = 0.32 + * => LPF cutoff frequency = 800 * 0.32 = 256 Hz + */ +static const int fxas21002c_lpf_values[] = { + 32, 16, 8 +}; + +/* + * These values are taken from the high-pass filter cutoff frequency calculated + * ODR * 0.0hpf_values. So, for ODR = 800Hz with a hpf value = 0.018750 + * => HPF cutoff frequency = 800 * 0.018750 = 15 Hz + */ +static const int fxas21002c_hpf_values[] = { + 18750, 9625, 4875, 2475 +}; + +static const int fxas21002c_range_values[] = { + 4000, 2000, 1000, 500, 250 +}; + +struct fxas21002c_data { + u8 chip_id; + enum fxas21002c_mode_state mode; + enum fxas21002c_mode_state prev_mode; + + struct mutex lock; /* serialize data access */ + struct regmap *regmap; + struct regmap_field *regmap_fields[F_MAX_FIELDS]; + struct iio_trigger *dready_trig; + int irq; + + struct regulator *vdd; + struct regulator *vddio; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + s16 buffer[8] ____cacheline_aligned; +}; + +enum fxas21002c_channel_index { + CHANNEL_SCAN_INDEX_X, + CHANNEL_SCAN_INDEX_Y, + CHANNEL_SCAN_INDEX_Z, + CHANNEL_SCAN_MAX, +}; + +static int fxas21002c_odr_hz_from_value(struct fxas21002c_data *data, u8 value) +{ + int odr_value_max = ARRAY_SIZE(fxas21002c_odr_values) - 1; + + value = min_t(u8, value, odr_value_max); + + return fxas21002c_odr_values[value]; +} + +static int fxas21002c_odr_value_from_hz(struct fxas21002c_data *data, + unsigned int hz) +{ + int odr_table_size = ARRAY_SIZE(fxas21002c_odr_values); + int i; + + for (i = 0; i < odr_table_size; i++) + if (fxas21002c_odr_values[i] == hz) + return i; + + return -EINVAL; +} + +static int fxas21002c_lpf_bw_from_value(struct fxas21002c_data *data, u8 value) +{ + int lpf_value_max = ARRAY_SIZE(fxas21002c_lpf_values) - 1; + + value = min_t(u8, value, lpf_value_max); + + return fxas21002c_lpf_values[value]; +} + +static int fxas21002c_lpf_value_from_bw(struct fxas21002c_data *data, + unsigned int hz) +{ + int lpf_table_size = ARRAY_SIZE(fxas21002c_lpf_values); + int i; + + for (i = 0; i < lpf_table_size; i++) + if (fxas21002c_lpf_values[i] == hz) + return i; + + return -EINVAL; +} + +static int fxas21002c_hpf_sel_from_value(struct fxas21002c_data *data, u8 value) +{ + int hpf_value_max = ARRAY_SIZE(fxas21002c_hpf_values) - 1; + + value = min_t(u8, value, hpf_value_max); + + return fxas21002c_hpf_values[value]; +} + +static int fxas21002c_hpf_value_from_sel(struct fxas21002c_data *data, + unsigned int hz) +{ + int hpf_table_size = ARRAY_SIZE(fxas21002c_hpf_values); + int i; + + for (i = 0; i < hpf_table_size; i++) + if (fxas21002c_hpf_values[i] == hz) + return i; + + return -EINVAL; +} + +static int fxas21002c_range_fs_from_value(struct fxas21002c_data *data, + u8 value) +{ + int range_value_max = ARRAY_SIZE(fxas21002c_range_values) - 1; + unsigned int fs_double; + int ret; + + /* We need to check if FS_DOUBLE is enabled to offset the value */ + ret = regmap_field_read(data->regmap_fields[F_FS_DOUBLE], &fs_double); + if (ret < 0) + return ret; + + if (!fs_double) + value += 1; + + value = min_t(u8, value, range_value_max); + + return fxas21002c_range_values[value]; +} + +static int fxas21002c_range_value_from_fs(struct fxas21002c_data *data, + unsigned int range) +{ + int range_table_size = ARRAY_SIZE(fxas21002c_range_values); + bool found = false; + int fs_double = 0; + int ret; + int i; + + for (i = 0; i < range_table_size; i++) + if (fxas21002c_range_values[i] == range) { + found = true; + break; + } + + if (!found) + return -EINVAL; + + if (range > FXAS21002C_RANGE_LIMIT_DOUBLE) + fs_double = 1; + + ret = regmap_field_write(data->regmap_fields[F_FS_DOUBLE], fs_double); + if (ret < 0) + return ret; + + return i; +} + +static int fxas21002c_mode_get(struct fxas21002c_data *data) +{ + unsigned int active; + unsigned int ready; + int ret; + + ret = regmap_field_read(data->regmap_fields[F_ACTIVE], &active); + if (ret < 0) + return ret; + if (active) + return FXAS21002C_MODE_ACTIVE; + + ret = regmap_field_read(data->regmap_fields[F_READY], &ready); + if (ret < 0) + return ret; + if (ready) + return FXAS21002C_MODE_READY; + + return FXAS21002C_MODE_STANDBY; +} + +static int fxas21002c_mode_set(struct fxas21002c_data *data, + enum fxas21002c_mode_state mode) +{ + int ret; + + if (mode == data->mode) + return 0; + + if (mode == FXAS21002C_MODE_READY) + ret = regmap_field_write(data->regmap_fields[F_READY], 1); + else + ret = regmap_field_write(data->regmap_fields[F_READY], 0); + if (ret < 0) + return ret; + + if (mode == FXAS21002C_MODE_ACTIVE) + ret = regmap_field_write(data->regmap_fields[F_ACTIVE], 1); + else + ret = regmap_field_write(data->regmap_fields[F_ACTIVE], 0); + if (ret < 0) + return ret; + + /* if going to active wait the setup times */ + if (mode == FXAS21002C_MODE_ACTIVE && + data->mode == FXAS21002C_MODE_STANDBY) + msleep_interruptible(FXAS21002C_STANDBY_ACTIVE_TIME_MS); + + if (data->mode == FXAS21002C_MODE_READY) + msleep_interruptible(FXAS21002C_READY_ACTIVE_TIME_MS); + + data->prev_mode = data->mode; + data->mode = mode; + + return ret; +} + +static int fxas21002c_write(struct fxas21002c_data *data, + enum fxas21002c_fields field, int bits) +{ + int actual_mode; + int ret; + + mutex_lock(&data->lock); + + actual_mode = fxas21002c_mode_get(data); + if (actual_mode < 0) { + ret = actual_mode; + goto out_unlock; + } + + ret = fxas21002c_mode_set(data, FXAS21002C_MODE_READY); + if (ret < 0) + goto out_unlock; + + ret = regmap_field_write(data->regmap_fields[field], bits); + if (ret < 0) + goto out_unlock; + + ret = fxas21002c_mode_set(data, data->prev_mode); + +out_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_pm_get(struct fxas21002c_data *data) +{ + struct device *dev = regmap_get_device(data->regmap); + int ret; + + ret = pm_runtime_get_sync(dev); + if (ret < 0) + pm_runtime_put_noidle(dev); + + return ret; +} + +static int fxas21002c_pm_put(struct fxas21002c_data *data) +{ + struct device *dev = regmap_get_device(data->regmap); + + pm_runtime_mark_last_busy(dev); + + return pm_runtime_put_autosuspend(dev); +} + +static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val) +{ + struct device *dev = regmap_get_device(data->regmap); + unsigned int temp; + int ret; + + mutex_lock(&data->lock); + ret = fxas21002c_pm_get(data); + if (ret < 0) + goto data_unlock; + + ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp); + if (ret < 0) { + dev_err(dev, "failed to read temp: %d\n", ret); + goto data_unlock; + } + + *val = sign_extend32(temp, 7); + + ret = fxas21002c_pm_put(data); + if (ret < 0) + goto data_unlock; + + ret = IIO_VAL_INT; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_axis_get(struct fxas21002c_data *data, + int index, int *val) +{ + struct device *dev = regmap_get_device(data->regmap); + __be16 axis_be; + int ret; + + mutex_lock(&data->lock); + ret = fxas21002c_pm_get(data); + if (ret < 0) + goto data_unlock; + + ret = regmap_bulk_read(data->regmap, FXAS21002C_AXIS_TO_REG(index), + &axis_be, sizeof(axis_be)); + if (ret < 0) { + dev_err(dev, "failed to read axis: %d: %d\n", index, ret); + goto data_unlock; + } + + *val = sign_extend32(be16_to_cpu(axis_be), 15); + + ret = fxas21002c_pm_put(data); + if (ret < 0) + goto data_unlock; + + ret = IIO_VAL_INT; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_odr_get(struct fxas21002c_data *data, int *odr) +{ + unsigned int odr_bits; + int ret; + + mutex_lock(&data->lock); + ret = regmap_field_read(data->regmap_fields[F_DR], &odr_bits); + if (ret < 0) + goto data_unlock; + + *odr = fxas21002c_odr_hz_from_value(data, odr_bits); + + ret = IIO_VAL_INT; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_odr_set(struct fxas21002c_data *data, int odr) +{ + int odr_bits; + + odr_bits = fxas21002c_odr_value_from_hz(data, odr); + if (odr_bits < 0) + return odr_bits; + + return fxas21002c_write(data, F_DR, odr_bits); +} + +static int fxas21002c_lpf_get(struct fxas21002c_data *data, int *val2) +{ + unsigned int bw_bits; + int ret; + + mutex_lock(&data->lock); + ret = regmap_field_read(data->regmap_fields[F_BW], &bw_bits); + if (ret < 0) + goto data_unlock; + + *val2 = fxas21002c_lpf_bw_from_value(data, bw_bits) * 10000; + + ret = IIO_VAL_INT_PLUS_MICRO; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_lpf_set(struct fxas21002c_data *data, int bw) +{ + int bw_bits; + int odr; + int ret; + + bw_bits = fxas21002c_lpf_value_from_bw(data, bw); + if (bw_bits < 0) + return bw_bits; + + /* + * From table 33 of the device spec, for ODR = 25Hz and 12.5 value 0.08 + * is not allowed and for ODR = 12.5 value 0.16 is also not allowed + */ + ret = fxas21002c_odr_get(data, &odr); + if (ret < 0) + return -EINVAL; + + if ((odr == 25 && bw_bits > 0x01) || (odr == 12 && bw_bits > 0)) + return -EINVAL; + + return fxas21002c_write(data, F_BW, bw_bits); +} + +static int fxas21002c_hpf_get(struct fxas21002c_data *data, int *val2) +{ + unsigned int sel_bits; + int ret; + + mutex_lock(&data->lock); + ret = regmap_field_read(data->regmap_fields[F_SEL], &sel_bits); + if (ret < 0) + goto data_unlock; + + *val2 = fxas21002c_hpf_sel_from_value(data, sel_bits); + + ret = IIO_VAL_INT_PLUS_MICRO; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_hpf_set(struct fxas21002c_data *data, int sel) +{ + int sel_bits; + + sel_bits = fxas21002c_hpf_value_from_sel(data, sel); + if (sel_bits < 0) + return sel_bits; + + return fxas21002c_write(data, F_SEL, sel_bits); +} + +static int fxas21002c_scale_get(struct fxas21002c_data *data, int *val) +{ + int fs_bits; + int scale; + int ret; + + mutex_lock(&data->lock); + ret = regmap_field_read(data->regmap_fields[F_FS], &fs_bits); + if (ret < 0) + goto data_unlock; + + scale = fxas21002c_range_fs_from_value(data, fs_bits); + if (scale < 0) { + ret = scale; + goto data_unlock; + } + + *val = scale; + +data_unlock: + mutex_unlock(&data->lock); + + return ret; +} + +static int fxas21002c_scale_set(struct fxas21002c_data *data, int range) +{ + int fs_bits; + + fs_bits = fxas21002c_range_value_from_fs(data, range); + if (fs_bits < 0) + return fs_bits; + + return fxas21002c_write(data, F_FS, fs_bits); +} + +static int fxas21002c_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct fxas21002c_data *data = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + switch (chan->type) { + case IIO_TEMP: + return fxas21002c_temp_get(data, val); + case IIO_ANGL_VEL: + return fxas21002c_axis_get(data, chan->scan_index, val); + default: + return -EINVAL; + } + case IIO_CHAN_INFO_SCALE: + switch (chan->type) { + case IIO_ANGL_VEL: + *val2 = FXAS21002C_SCALE_FRACTIONAL; + ret = fxas21002c_scale_get(data, val); + if (ret < 0) + return ret; + + return IIO_VAL_FRACTIONAL; + default: + return -EINVAL; + } + case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: + *val = 0; + return fxas21002c_lpf_get(data, val2); + case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: + *val = 0; + return fxas21002c_hpf_get(data, val2); + case IIO_CHAN_INFO_SAMP_FREQ: + *val2 = 0; + return fxas21002c_odr_get(data, val); + default: + return -EINVAL; + } +} + +static int fxas21002c_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int val, + int val2, long mask) +{ + struct fxas21002c_data *data = iio_priv(indio_dev); + int range; + + switch (mask) { + case IIO_CHAN_INFO_SAMP_FREQ: + if (val2) + return -EINVAL; + + return fxas21002c_odr_set(data, val); + case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: + if (val) + return -EINVAL; + + val2 = val2 / 10000; + return fxas21002c_lpf_set(data, val2); + case IIO_CHAN_INFO_SCALE: + switch (chan->type) { + case IIO_ANGL_VEL: + range = (((val * 1000 + val2 / 1000) * + FXAS21002C_SCALE_FRACTIONAL) / 1000); + return fxas21002c_scale_set(data, range); + default: + return -EINVAL; + } + case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: + return fxas21002c_hpf_set(data, val2); + default: + return -EINVAL; + } +} + +static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("12.5 25 50 100 200 400 800"); + +static IIO_CONST_ATTR(in_anglvel_filter_low_pass_3db_frequency_available, + "0.32 0.16 0.08"); + +static IIO_CONST_ATTR(in_anglvel_filter_high_pass_3db_frequency_available, + "0.018750 0.009625 0.004875 0.002475"); + +static IIO_CONST_ATTR(in_anglvel_scale_available, + "125.0 62.5 31.25 15.625 7.8125"); + +static struct attribute *fxas21002c_attributes[] = { + &iio_const_attr_sampling_frequency_available.dev_attr.attr, + &iio_const_attr_in_anglvel_filter_low_pass_3db_frequency_available.dev_attr.attr, + &iio_const_attr_in_anglvel_filter_high_pass_3db_frequency_available.dev_attr.attr, + &iio_const_attr_in_anglvel_scale_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group fxas21002c_attrs_group = { + .attrs = fxas21002c_attributes, +}; + +#define FXAS21002C_CHANNEL(_axis) { \ + .type = IIO_ANGL_VEL, \ + .modified = 1, \ + .channel2 = IIO_MOD_##_axis, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) | \ + BIT(IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY) | \ + BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .scan_index = CHANNEL_SCAN_INDEX_##_axis, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_BE, \ + }, \ +} + +static const struct iio_chan_spec fxas21002c_channels[] = { + { + .type = IIO_TEMP, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .scan_index = -1, + }, + FXAS21002C_CHANNEL(X), + FXAS21002C_CHANNEL(Y), + FXAS21002C_CHANNEL(Z), +}; + +static const struct iio_info fxas21002c_info = { + .attrs = &fxas21002c_attrs_group, + .read_raw = &fxas21002c_read_raw, + .write_raw = &fxas21002c_write_raw, +}; + +static irqreturn_t fxas21002c_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct fxas21002c_data *data = iio_priv(indio_dev); + int ret; + + mutex_lock(&data->lock); + ret = regmap_bulk_read(data->regmap, FXAS21002C_REG_OUT_X_MSB, + data->buffer, CHANNEL_SCAN_MAX * sizeof(s16)); + mutex_unlock(&data->lock); + if (ret < 0) + goto notify_done; + + iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + pf->timestamp); + +notify_done: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static int fxas21002c_chip_init(struct fxas21002c_data *data) +{ + struct device *dev = regmap_get_device(data->regmap); + unsigned int chip_id; + int ret; + + ret = regmap_field_read(data->regmap_fields[F_WHO_AM_I], &chip_id); + if (ret < 0) + return ret; + + if (chip_id != FXAS21002C_CHIP_ID_1 && + chip_id != FXAS21002C_CHIP_ID_2) { + dev_err(dev, "chip id 0x%02x is not supported\n", chip_id); + return -EINVAL; + } + + data->chip_id = chip_id; + + ret = fxas21002c_mode_set(data, FXAS21002C_MODE_STANDBY); + if (ret < 0) + return ret; + + /* Set ODR to 200HZ as default */ + ret = fxas21002c_odr_set(data, 200); + if (ret < 0) + dev_err(dev, "failed to set ODR: %d\n", ret); + + return ret; +} + +static int fxas21002c_data_rdy_trigger_set_state(struct iio_trigger *trig, + bool state) +{ + struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); + struct fxas21002c_data *data = iio_priv(indio_dev); + + return regmap_field_write(data->regmap_fields[F_INT_EN_DRDY], state); +} + +static const struct iio_trigger_ops fxas21002c_trigger_ops = { + .set_trigger_state = &fxas21002c_data_rdy_trigger_set_state, +}; + +static irqreturn_t fxas21002c_data_rdy_trig_poll(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct fxas21002c_data *data = iio_priv(indio_dev); + unsigned int data_ready; + int ret; + + ret = regmap_field_read(data->regmap_fields[F_SRC_DRDY], &data_ready); + if (ret < 0) + return IRQ_NONE; + + if (!data_ready) + return IRQ_NONE; + + iio_trigger_poll(data->dready_trig); + + return IRQ_HANDLED; +} + +static int fxas21002c_trigger_probe(struct fxas21002c_data *data) +{ + struct device *dev = regmap_get_device(data->regmap); + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct device_node *np = indio_dev->dev.of_node; + unsigned long irq_trig; + bool irq_open_drain; + int irq1; + int ret; + + if (!data->irq) + return 0; + + irq1 = of_irq_get_byname(np, "INT1"); + + if (irq1 == data->irq) { + dev_info(dev, "using interrupt line INT1\n"); + ret = regmap_field_write(data->regmap_fields[F_INT_CFG_DRDY], + 1); + if (ret < 0) + return ret; + } + + dev_info(dev, "using interrupt line INT2\n"); + + irq_open_drain = of_property_read_bool(np, "drive-open-drain"); + + data->dready_trig = devm_iio_trigger_alloc(dev, "%s-dev%d", + indio_dev->name, + indio_dev->id); + if (!data->dready_trig) + return -ENOMEM; + + irq_trig = irqd_get_trigger_type(irq_get_irq_data(data->irq)); + + if (irq_trig == IRQF_TRIGGER_RISING) { + ret = regmap_field_write(data->regmap_fields[F_IPOL], 1); + if (ret < 0) + return ret; + } + + if (irq_open_drain) + irq_trig |= IRQF_SHARED; + + ret = devm_request_irq(dev, data->irq, fxas21002c_data_rdy_trig_poll, + irq_trig, "fxas21002c_data_ready", + data->dready_trig); + if (ret < 0) + return ret; + + data->dready_trig->dev.parent = dev; + data->dready_trig->ops = &fxas21002c_trigger_ops; + iio_trigger_set_drvdata(data->dready_trig, indio_dev); + + return iio_trigger_register(data->dready_trig); +} + +static int fxas21002c_power_enable(struct fxas21002c_data *data) +{ + int ret; + + ret = regulator_enable(data->vdd); + if (ret < 0) + return ret; + + ret = regulator_enable(data->vddio); + if (ret < 0) { + regulator_disable(data->vdd); + return ret; + } + + return 0; +} + +static void fxas21002c_power_disable(struct fxas21002c_data *data) +{ + regulator_disable(data->vdd); + regulator_disable(data->vddio); +} + +static void fxas21002c_power_disable_action(void *_data) +{ + struct fxas21002c_data *data = _data; + + fxas21002c_power_disable(data); +} + +static int fxas21002c_regulators_get(struct fxas21002c_data *data) +{ + struct device *dev = regmap_get_device(data->regmap); + + data->vdd = devm_regulator_get(dev->parent, "vdd"); + if (IS_ERR(data->vdd)) + return PTR_ERR(data->vdd); + + data->vddio = devm_regulator_get(dev->parent, "vddio"); + if (IS_ERR(data->vddio)) + return PTR_ERR(data->vddio); + + return 0; +} + +int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, + const char *name) +{ + struct fxas21002c_data *data; + struct iio_dev *indio_dev; + struct regmap_field *f; + int i; + int ret; + + indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + data = iio_priv(indio_dev); + dev_set_drvdata(dev, indio_dev); + data->irq = irq; + data->regmap = regmap; + + for (i = 0; i < F_MAX_FIELDS; i++) { + f = devm_regmap_field_alloc(dev, data->regmap, + fxas21002c_reg_fields[i]); + if (IS_ERR(f)) + return PTR_ERR(f); + + data->regmap_fields[i] = f; + } + + mutex_init(&data->lock); + + ret = fxas21002c_regulators_get(data); + if (ret < 0) + return ret; + + ret = fxas21002c_power_enable(data); + if (ret < 0) + return ret; + + ret = devm_add_action_or_reset(dev, fxas21002c_power_disable_action, + data); + if (ret < 0) + return ret; + + ret = fxas21002c_chip_init(data); + if (ret < 0) + return ret; + + indio_dev->dev.parent = dev; + indio_dev->channels = fxas21002c_channels; + indio_dev->num_channels = ARRAY_SIZE(fxas21002c_channels); + indio_dev->name = name; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &fxas21002c_info; + + ret = fxas21002c_trigger_probe(data); + if (ret < 0) + return ret; + + ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, + fxas21002c_trigger_handler, NULL); + if (ret < 0) + goto trigger_unregister; + + ret = pm_runtime_set_active(dev); + if (ret) + goto buffer_cleanup; + + pm_runtime_enable(dev); + pm_runtime_set_autosuspend_delay(dev, 2000); + pm_runtime_use_autosuspend(dev); + + ret = iio_device_register(indio_dev); + if (ret < 0) + goto pm_disable; + + return 0; + +pm_disable: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + +buffer_cleanup: + iio_triggered_buffer_cleanup(indio_dev); + +trigger_unregister: + if (data->irq) + iio_trigger_unregister(data->dready_trig); + + return ret; +} +EXPORT_SYMBOL_GPL(fxas21002c_core_probe); + +void fxas21002c_core_remove(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct fxas21002c_data *data = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + + iio_triggered_buffer_cleanup(indio_dev); + + if (data->irq) + iio_trigger_unregister(data->dready_trig); + fxas21002c_power_disable(data); +} +EXPORT_SYMBOL_GPL(fxas21002c_core_remove); + +static int __maybe_unused fxas21002c_suspend(struct device *dev) +{ + struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); + + fxas21002c_mode_set(data, FXAS21002C_MODE_STANDBY); + fxas21002c_power_disable(data); + + return 0; +} + +static int __maybe_unused fxas21002c_resume(struct device *dev) +{ + struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); + int ret; + + ret = fxas21002c_power_enable(data); + if (ret < 0) + return ret; + + return fxas21002c_mode_set(data, data->prev_mode); +} + +static int __maybe_unused fxas21002c_runtime_suspend(struct device *dev) +{ + struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); + + return fxas21002c_mode_set(data, FXAS21002C_MODE_READY); +} + +static int __maybe_unused fxas21002c_runtime_resume(struct device *dev) +{ + struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); + + return fxas21002c_mode_set(data, FXAS21002C_MODE_ACTIVE); +} + +const struct dev_pm_ops fxas21002c_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(fxas21002c_suspend, fxas21002c_resume) + SET_RUNTIME_PM_OPS(fxas21002c_runtime_suspend, + fxas21002c_runtime_resume, NULL) +}; +EXPORT_SYMBOL_GPL(fxas21002c_pm_ops); + +MODULE_AUTHOR("Rui Miguel Silva "); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("FXAS21002C Gyro driver"); From patchwork Tue Mar 26 10:16:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161170 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024352jan; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEhfmLUoeFs7CTCpGm7Bu+Lr4UuQSZdswopPJJoEmbnZJFEnyhZPqz45iTQsXCGyzlCftx X-Received: by 2002:a17:902:a512:: with SMTP id s18mr21822198plq.185.1553595435693; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595435; cv=none; d=google.com; s=arc-20160816; b=IlG0kwux9sf43SSiKh/xHfDhsqGoirbuxIXZeJmPvi1CvCrvaWdbJcha23cZZRz6u8 vnWaZvjNgIMkg4W8WXYYqz0xTp26j/E7lnL+VEUNCj8xd4YhKW52x1M0MyICzrZKNd28 eP/MMaIV2syX/gCN7ikS9Iy6KCdSxpMCSk2CUMqbxSadQhSU0VtI6Js9tsHChZcLpCYE 2A6wybE91Tva+p2EBCWFz8HpOcJxH1eKHWZmgTtBgIxpmVgLEJJ8B54Ydvmw3X8CGOzE h1A+YDR9zLyKYbK8MSZmKIgYDA1hd/nsVMss52UsjUgC1rxP3qvDlL8n9qM1TPZQxoOo yw6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3FuoTdxdgrSIz8LEOIAnwc6QDsOzlUpwDf9yyB40/K0=; b=A8sc+IjeZUfsielMRCZ7+y6w3nPCbBxloE37BgM9YWpBPGS4f8LjE07DASID1Q8r5O VbvhXiZ51BlLtrkLopT3pIHFMPkQSAhxTSP4dk9Z9AyiUUpPtXJvoILyOdU67HK+rjOK fTQQBVed5i+5HrD77gpecaqn54Cq3wp5kNg6ozw9ZUbj+uWASqjloU6ij4Qhdshb1Hml H2uSsfevPx3I5ZA5wbX3Pg1cOh4SuG5Rkar979UOJRbBK3fVQBvTdZdyZVYnWt76xsk1 7OjjD0mctXv9m3h0YuHx1gfE8X0STezdIDDFONELs9ZyPjwNiGQXE9eXsaltYMDWUSLx pRuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cnQ3koZt; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g127si15687742pgc.313.2019.03.26.03.17.15; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cnQ3koZt; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730996AbfCZKRO (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:14 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33661 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731148AbfCZKRO (ORCPT ); Tue, 26 Mar 2019 06:17:14 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so2020244wmi.0 for ; Tue, 26 Mar 2019 03:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3FuoTdxdgrSIz8LEOIAnwc6QDsOzlUpwDf9yyB40/K0=; b=cnQ3koZtzi+LMqR0gmraF/aTYn0Hz1iHaSZ3fY4FtnDMtc9ovi6mMIshctAXwxcOnH HX7Fyk+bVw+r4BfSqczjKSfON6gzaU9H466JlsjBU/xb24LOg4bcpyzimVeaNCGswU7N Sy+LPF70ZLUwtHKsJzY/VYDrV0J5IoyIlJLTWAlBe4vjqX+ju81h0nw+TctWqxM9cyNG 7MPm5Ep0yhziLNgLdBSKC0YrnwSd4ZGcE+WTB2+VIn/NB9iFD7ZJG9iAW/yT4mkyGNfI ouwDw8A/Le+gX236R+8tdappQhfSvz3l11uzIUDcAQdtHag7uidiiMFTIJ3NX8MtU0Bt s4uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3FuoTdxdgrSIz8LEOIAnwc6QDsOzlUpwDf9yyB40/K0=; b=STE6IfaU2+nvUTlIv3wUT3ChxHrYWn++oAo7KqlHJcOkl2wGyiOrO8aC461g+fepjl kka5FGyN8qL5stUkRn64QttLHnOKu25NPln2kWxDOihcA8AADCcrJMrCS5qsbE4u1nvr QEI7Wv+7IYqHhPFraibAbW6ian6lCD/GarXPfR2DsCBpKtcUnvTSfSqZtixmkH/ALlrz L+iEfPhQEAVp275jNBekRKu6SombpDqkW3DfVRoX8C1PEMaqML4Ni4Z9VmGgPkfOzjr7 NESYcuW7ZuIZ5zVzs6KSA3SApYPktfl3J6t5g3OIoZz/jiB6Tf3WIzVfWyYcD5Vo5nt4 xD9g== X-Gm-Message-State: APjAAAV5rj2/ddke4x2qPVdOrirTXHwc7flNp6aCl7LLrWEPrdUO+JFc B8evMAsN8J11fJli5tUHaG0NbA== X-Received: by 2002:a1c:c707:: with SMTP id x7mr12421316wmf.149.1553595432226; Tue, 26 Mar 2019 03:17:12 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:11 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 3/6] iio: gyro: fxas21002c: add i2c driver Date: Tue, 26 Mar 2019 10:16:48 +0000 Message-Id: <20190326101651.25056-4-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add the real driver to talk over i2c and use the fxas21002c core for the main tasks. Signed-off-by: Rui Miguel Silva --- drivers/iio/gyro/Kconfig | 6 +++ drivers/iio/gyro/Makefile | 1 + drivers/iio/gyro/fxas21002c_i2c.c | 69 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 drivers/iio/gyro/fxas21002c_i2c.c -- 2.21.0 diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index cfd2cf44bac8..71b6552ee06b 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig @@ -77,6 +77,8 @@ config FXAS21002C tristate "NXP FXAS21002C Gyro Sensor" select IIO_BUFFER select IIO_TRIGGERED_BUFFER + select FXAS21002C_I2C if (I2C) + depends on I2C help Say yes here to build support for NXP FXAS21002C Tri-axis Gyro Sensor driver connected via I2C or SPI. @@ -84,6 +86,10 @@ config FXAS21002C This driver can also be built as a module. If so, the module will be called fxas21002c_i2c or fxas21002c_spi. +config FXAS21002C_I2C + tristate + select REGMAP_I2C + config HID_SENSOR_GYRO_3D depends on HID_SENSOR_HUB select IIO_BUFFER diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile index 247dc600a602..adc18a5eb283 100644 --- a/drivers/iio/gyro/Makefile +++ b/drivers/iio/gyro/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_BMG160) += bmg160_core.o obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o obj-$(CONFIG_BMG160_SPI) += bmg160_spi.o obj-$(CONFIG_FXAS21002C) += fxas21002c_core.o +obj-$(CONFIG_FXAS21002C_I2C) += fxas21002c_i2c.o obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o diff --git a/drivers/iio/gyro/fxas21002c_i2c.c b/drivers/iio/gyro/fxas21002c_i2c.c new file mode 100644 index 000000000000..a7807fd97483 --- /dev/null +++ b/drivers/iio/gyro/fxas21002c_i2c.c @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for NXP FXAS21002C Gyroscope - I2C + * + * Copyright (C) 2018 Linaro Ltd. + */ + +#include +#include +#include +#include +#include + +#include "fxas21002c.h" + +static const struct regmap_config fxas21002c_regmap_i2c_conf = { + .reg_bits = 8, + .val_bits = 8, + .max_register = FXAS21002C_REG_CTRL3, +}; + +static int fxas21002c_i2c_probe(struct i2c_client *i2c) +{ + struct regmap *regmap; + + regmap = devm_regmap_init_i2c(i2c, &fxas21002c_regmap_i2c_conf); + if (IS_ERR(regmap)) { + dev_err(&i2c->dev, "Failed to register i2c regmap: %ld\n", + PTR_ERR(regmap)); + return PTR_ERR(regmap); + } + + return fxas21002c_core_probe(&i2c->dev, regmap, i2c->irq, i2c->name); +} + +static int fxas21002c_i2c_remove(struct i2c_client *i2c) +{ + fxas21002c_core_remove(&i2c->dev); + + return 0; +} + +static const struct i2c_device_id fxas21002c_i2c_id[] = { + { "fxas21002c", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, fxas21002c_i2c_id); + +static const struct of_device_id fxas21002c_i2c_of_match[] = { + { .compatible = "nxp,fxas21002c", }, + { } +}; +MODULE_DEVICE_TABLE(of, fxas21002c_i2c_of_match); + +static struct i2c_driver fxas21002c_i2c_driver = { + .driver = { + .name = "fxas21002c_i2c", + .pm = &fxas21002c_pm_ops, + .of_match_table = fxas21002c_i2c_of_match, + }, + .probe_new = fxas21002c_i2c_probe, + .remove = fxas21002c_i2c_remove, + .id_table = fxas21002c_i2c_id, +}; +module_i2c_driver(fxas21002c_i2c_driver); + +MODULE_AUTHOR("Rui Miguel Silva "); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("FXAS21002C I2C Gyro driver"); From patchwork Tue Mar 26 10:16:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161172 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024403jan; Tue, 26 Mar 2019 03:17:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1Vg24lPDnXPdHj/cZGGW13aqJRd7MXgO89k7er1AYzsuUsvI5uTVJoBm6h+vDl8sqRy9f X-Received: by 2002:a65:5b47:: with SMTP id y7mr28096893pgr.449.1553595438530; Tue, 26 Mar 2019 03:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595438; cv=none; d=google.com; s=arc-20160816; b=xRXO78RZsWU0M2BE+MZeB5EXf2j2A6yboHjUC9zhOZM3pPtTp7ULwC5xvGO6swlRYj nB2oxLZ00YS/xSmr5ksWjktmjFQvmsGRGsws1hpgM8iaMWWjDC2jjeOQqVteDRwpybCN O/S3tVirG3cyMzwGagCMdf0rQ+93wcimC9vSlhAN8mT0xOCCJS2xUnZVkID203tZZduB 6C4rfq0gSDaAgk0LHBDeLsCT9Br1F25BfPaNQiDTE0HNrYlG6ubMiq0vCTk7PgNYd/Ex +z6/tJ/shrUtpoKDAHQt3btoYiiAhlvanmVkvW4kWBB4JgunK1mBdafjxYrbJVifmOoO eQxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WAPVaWgzUO2VZ+rDT4jNyOi+EGyhB4RKVLvR+cRCnoQ=; b=UDvTc7J4D/O+HHJi3tQEXr/9U5MhMdHPWDCX/0e8jh9LM0xFRp8QKQ7F/dNIgvCK0U dMAkpG5efXbUNPnOA+W9zSYFQiaNblF6j+fvKqyQsfYHREyj822hbKBY8rOY/nrfOpAc Yq3ooLu8SZ2EzUek5Z8TCGkWjyRUwxSPku5ERCLTvtnDM1q8LZH75o2fAGIFBQKIoTlL Fv4Q48q9OGGf9cHccgZrnSuz8LM9Y0p5Lfsf7BBKeIuKBR2F+a5qznHX5R4amctPsSFm Yq63jypVWqK0C5HeK6ZVCfjcmzhtjRt/WzqotVJPV/1OyH3XM8Dz2osZv4WVPNMiM0+6 Hesg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sF9kTDFB; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g127si15687742pgc.313.2019.03.26.03.17.18; Tue, 26 Mar 2019 03:17:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sF9kTDFB; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731279AbfCZKRR (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:17 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40303 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731003AbfCZKRR (ORCPT ); Tue, 26 Mar 2019 06:17:17 -0400 Received: by mail-wm1-f67.google.com with SMTP id z24so8966841wmi.5 for ; Tue, 26 Mar 2019 03:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WAPVaWgzUO2VZ+rDT4jNyOi+EGyhB4RKVLvR+cRCnoQ=; b=sF9kTDFBOU5triRX9gnmJImaf4I2X6GIJZRoqq0LNT5PXPcUIzL6I/Va/4WYYAtpDf CfNO4F35pHj2GMRn8Os2/VsXxDkpPEc/EtyE5R9QCtRQfZcdi25N24WlZEgHMx8sdyH8 gRChR9o/xEBK5q1lr5phJsDSGXnGtqCvTM+HZqa4RoGzUpgXgPyPUCzT7iB7RjZ4ExWs 5h8a/t4vLFZwiZo/yGgP0JyBJfGSYgQmiuVVK7fD3FjnAEwu9EQGAsHltJcdgpNDow63 rqPyeQLJ6jQ5yIqRlhh4XnPrUPfBzf09IAVNCAXzRzbxDy2ZRF/yrYBu2wLrEEdzTmBi 90kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WAPVaWgzUO2VZ+rDT4jNyOi+EGyhB4RKVLvR+cRCnoQ=; b=aLGr2Ki8xR+lulqwVjOAYL+vioqKJ27DnSvEl5uFco+9vnPgkH2e2s+nDN3ghdkeP9 hKe31H+SHLaiRHOKZnC2wzVElS2JSYY5ElAFwbYW6ueDKQWyBARCwlyLjkYjCYaDoYlA P8enGPY9uBRqVgzJRxb9xKo1tpeF2aWTOcpDBM+Bl81W+N+Eh0f+tucYZRhM0GIjQB3g TKz3lHIh71pxw9E82TACMn+QN4fVL8Fx9AQAQy0hTriINLtCipnlI+mQ6YPHK53KUfZy RgZVrY364H1M/dwTJOE8NBBL8C17W1QIc15fj+gV4dgmhTix2BcycbPpui9OOsOC+pZz ZAzA== X-Gm-Message-State: APjAAAUf3OIxzv4z1NDeZmFycwjgXeq5clT4hdGonB6lrP79b4oBDIzY Oqe5is68nnzS4RlRWP2qBIfmyQ== X-Received: by 2002:a7b:c257:: with SMTP id b23mr14094290wmj.83.1553595434577; Tue, 26 Mar 2019 03:17:14 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:14 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 4/6] iio: gyro: fxas21002c: add spi driver Date: Tue, 26 Mar 2019 10:16:49 +0000 Message-Id: <20190326101651.25056-5-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add driver to talk over spi to a fxas21002c gyroscope device and use the core as main controller. Signed-off-by: Rui Miguel Silva --- drivers/iio/gyro/Kconfig | 7 +++- drivers/iio/gyro/Makefile | 1 + drivers/iio/gyro/fxas21002c_spi.c | 70 +++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/gyro/fxas21002c_spi.c -- 2.21.0 diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index 71b6552ee06b..61c00cee037d 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig @@ -78,7 +78,8 @@ config FXAS21002C select IIO_BUFFER select IIO_TRIGGERED_BUFFER select FXAS21002C_I2C if (I2C) - depends on I2C + select FXAS21002C_SPI if (SPI) + depends on (I2C || SPI_MASTER) help Say yes here to build support for NXP FXAS21002C Tri-axis Gyro Sensor driver connected via I2C or SPI. @@ -90,6 +91,10 @@ config FXAS21002C_I2C tristate select REGMAP_I2C +config FXAS21002C_SPI + tristate + select REGMAP_SPI + config HID_SENSOR_GYRO_3D depends on HID_SENSOR_HUB select IIO_BUFFER diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile index adc18a5eb283..45cbd5dc644e 100644 --- a/drivers/iio/gyro/Makefile +++ b/drivers/iio/gyro/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o obj-$(CONFIG_BMG160_SPI) += bmg160_spi.o obj-$(CONFIG_FXAS21002C) += fxas21002c_core.o obj-$(CONFIG_FXAS21002C_I2C) += fxas21002c_i2c.o +obj-$(CONFIG_FXAS21002C_SPI) += fxas21002c_spi.o obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o diff --git a/drivers/iio/gyro/fxas21002c_spi.c b/drivers/iio/gyro/fxas21002c_spi.c new file mode 100644 index 000000000000..77ceebef4e34 --- /dev/null +++ b/drivers/iio/gyro/fxas21002c_spi.c @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for NXP Fxas21002c Gyroscope - SPI + * + * Copyright (C) 2019 Linaro Ltd. + */ + +#include +#include +#include +#include +#include + +#include "fxas21002c.h" + +static const struct regmap_config fxas21002c_regmap_spi_conf = { + .reg_bits = 8, + .val_bits = 8, + .max_register = FXAS21002C_REG_CTRL3, +}; + +static int fxas21002c_spi_probe(struct spi_device *spi) +{ + const struct spi_device_id *id = spi_get_device_id(spi); + struct regmap *regmap; + + regmap = devm_regmap_init_spi(spi, &fxas21002c_regmap_spi_conf); + if (IS_ERR(regmap)) { + dev_err(&spi->dev, "Failed to register spi regmap: %ld\n", + PTR_ERR(regmap)); + return PTR_ERR(regmap); + } + + return fxas21002c_core_probe(&spi->dev, regmap, spi->irq, id->name); +} + +static int fxas21002c_spi_remove(struct spi_device *spi) +{ + fxas21002c_core_remove(&spi->dev); + + return 0; +} + +static const struct spi_device_id fxas21002c_spi_id[] = { + { "fxas21002c", 0 }, + { } +}; +MODULE_DEVICE_TABLE(spi, fxas21002c_spi_id); + +static const struct of_device_id fxas21002c_spi_of_match[] = { + { .compatible = "nxp,fxas21002c", }, + { } +}; +MODULE_DEVICE_TABLE(of, fxas21002c_spi_of_match); + +static struct spi_driver fxas21002c_spi_driver = { + .driver = { + .name = "fxas21002c_spi", + .pm = &fxas21002c_pm_ops, + .of_match_table = fxas21002c_spi_of_match, + }, + .probe = fxas21002c_spi_probe, + .remove = fxas21002c_spi_remove, + .id_table = fxas21002c_spi_id, +}; +module_spi_driver(fxas21002c_spi_driver); + +MODULE_AUTHOR("Rui Miguel Silva "); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("FXAS21002C SPI Gyro driver"); From patchwork Tue Mar 26 10:16:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161173 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024452jan; Tue, 26 Mar 2019 03:17:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdYqpFidxnNX3jgPCWOgihRKMtJFtJ9Dq2Y2NAssR6LRnNoVI2U1pwo8ykdAdXZnySVNem X-Received: by 2002:a17:902:2a29:: with SMTP id i38mr31031346plb.22.1553595440815; Tue, 26 Mar 2019 03:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595440; cv=none; d=google.com; s=arc-20160816; b=TDG7bcfQ3JxBUdxVuz98Il6xbIHHKSR/2f+xPQgXYWhgeqqF3e+ksfHtrnA+cUZOsZ u86hEzxKlrEwkXtefd2oLtrdirxmOc0BzaiNZBI29EBssgZWMZFUv8719cmdAj7by5kW +4qWC8+Lidm5zFkTCJZJj3VsYVIdl2rrdf1u5yzDKpbXzolt597/Xqo+E8IHq64xlTbG WZjrT9aNzah2X50ZM81uyqCTrhQt0DIMHrITVbx69/Sh173KkKnKz9ZFqar6hIPVeuHc d3k+ki65EVG/qXV4AqTX8doVSr3RGQ+okXWDIyMd9s1Jmz5NMxWBylD+6OUe9ctd0wH7 wd2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4UAQGf80mGcL4LT+JY+W46Q4J+EAzJLCXffApvYs8RU=; b=h+5BGP6mIXeKoIGVat+lKefFEsF4WmjtnsinSLjPGOFPEYEO4clgZQ/jpdlbJX8VM1 1bc3VyLbZtOtZ7X+MS8u8/Dwvelfq2zxf1FwzfmD2+lB3/JVBH/xD58bDHdUJ4SYS8BV MeoNsi6sSEME929+hljmWre06sm4Ds3rBD7vWNTMUnW5RnLtB6FTQYepYT/kv3aaJDv1 6fGzvIUP5nhBMlopxPsxDfi08N7MK1OqHA/XTVES2zGhQnAZpIB+sYakZeRHDRI7CZGf LBm2kUfuWqPdy1XY44pJHzXvpgKZweIknGC8RPzv6gZo/2X3u9DvCoqCgTgDFYmKPL1L /+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRfXS+a7; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g127si15687742pgc.313.2019.03.26.03.17.20; Tue, 26 Mar 2019 03:17:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRfXS+a7; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726175AbfCZKRT (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:19 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37671 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfCZKRT (ORCPT ); Tue, 26 Mar 2019 06:17:19 -0400 Received: by mail-wm1-f68.google.com with SMTP id v14so12230096wmf.2 for ; Tue, 26 Mar 2019 03:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4UAQGf80mGcL4LT+JY+W46Q4J+EAzJLCXffApvYs8RU=; b=WRfXS+a779Fb1SdYP5VW2TOEFzNcu0b422wa9GrLXVSLfuljoSujF3ZqBL8qXuqIrp TiHqYBuIF9dg2TDhHFOmXoPNRQjVibnGvh41I1Rx9XUTO7cgod+ewdJmsqW6kUSW8TDc 5+ixAM0YRXzezqsIy0xXwlRJ9g9gIm1x8bsrwTU59WovAEY+XP21/hTWisV9zWWSvBL/ Y2yDH/RXhZVr8ZzrjXGSprdKqVhLjmcb7BnE15Y8Ht3d/KrV9fOUUsYfU6jFg7IA7xjD fS/oe5P3ovtRkkcu0VfrQpOQTBoMs/BeHoBw6CCql70DLD3+7pbE/nNU2r9KKCKhYSnn /A5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4UAQGf80mGcL4LT+JY+W46Q4J+EAzJLCXffApvYs8RU=; b=niZ70KutfWcr/nEHzUxoeZCcsojzmYMLE2HVZlOzoYMLrOlUsSz0hBinbjQHgdH+Ew P7HymArRtdvoI+gazC/I0OYyYcVk/H8iaYYHXE0kEAd1OikieYVW/CoeTNJikF+Gv+De o7s68Brplm6Wc7lpEQX5Hkx7rY/tqPgL9E5zScE/JDVxXUTqzAkUGbcqotIp8uUUk+ik r1FiJSQnMJCyJsXi5JeOIe+CQbHht61C7/rlxTML6H7grhHZalGkXJR+DDFQYD+HTFXx /MO4meVjlYGKOllsulQJymiR+IIGV9VS0SZhATrzNeSaNRLCTwIeA6FI8SRQXU2wtbhF 3mwA== X-Gm-Message-State: APjAAAV8rpt0/R9vqnKiNiFm5oaCDojjGhjWIre4TbDhEkS4+64Fndad EJFZZzPyPI8CDBlMiY57BQ0dVA== X-Received: by 2002:a1c:bac2:: with SMTP id k185mr8136761wmf.5.1553595437651; Tue, 26 Mar 2019 03:17:17 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:17 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 5/6] ARM: dts: imx7s-warp: add fxas21002c gyroscope Date: Tue, 26 Mar 2019 10:16:50 +0000 Message-Id: <20190326101651.25056-6-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add entry to enable the fxas21002c gyroscope in the warp7 board. Signed-off-by: Rui Miguel Silva --- arch/arm/boot/dts/imx7s-warp.dts | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.21.0 diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts index 23431faecaf4..c7dd66828a90 100644 --- a/arch/arm/boot/dts/imx7s-warp.dts +++ b/arch/arm/boot/dts/imx7s-warp.dts @@ -209,6 +209,13 @@ compatible = "fsl,mpl3115"; reg = <0x60>; }; + + gyroscope@20 { + compatible = "nxp,fxas21002c"; + reg = <0x20>; + vdd-supply = <®_peri_3p15v>; + vddio-supply = <®_peri_3p15v>; + }; }; &sai1 { From patchwork Tue Mar 26 10:16:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 161174 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5024497jan; Tue, 26 Mar 2019 03:17:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6MMe3cwpqXifNEh9+CtCc5+pLv+UniOo9QOpOQMKZYVnDNFMW4hM+/HtidCWflqGb7mwa X-Received: by 2002:a17:902:a706:: with SMTP id w6mr5790020plq.91.1553595443011; Tue, 26 Mar 2019 03:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553595443; cv=none; d=google.com; s=arc-20160816; b=DjumVZROYYh4UchYRk1VDAXVHHgzbRnR+MmNC6TqBnag/IW0O9XB4LyCUUs3lYF31N tegsAYealNiDsnBWVObkcCcB/89p9QOLmKSAPq/LAg7sqSGjpczjBb4+5zirk1HJaNcQ g2jDAVS44AhrSBIts0y9uz7f9uqkZEltXfzCd8Apub1moJU/4kUjN9brSYooqALRoYwN RkOH/P+2jRu4tvZ8VBh5TVjHWqbGhtx4TGQFnwzMPS7yizALFjCe5mfuY/BpK91VkQfM r1BDJk97Ao/11GeyWkh+IiwHgjiwgMqMcXwREob1RPc4x8UseiE/gDGOpBz0qUdTRg7D p3Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fylf7pTOJC8ppYoSWOQNUlj74ePm38xqTj3FfXozA2w=; b=PtFbWEI72vrpHKCmDIhrBZulKOTZLlbrT/i8KCHveFtpqSq3K3l9jA6xbz2w89TmVK jZQotGimvrntXFNY/PfmqXtcPKkguH0/k2sR+7+8H2s7uSjumOW7AOQBCYYr23DlMdr6 v4eWoEN8+OsWVNy5Rn9bw8yficwr3RdYOXGQJqEALEwBNaYLOPjmmejVmXTKmmi2HMwS XG2ZG3cAYO+z93K/wwq4MRg3mVcv95UBKWSb6nlSTjhAY4kxdX6edF31Q4f6twjI3dfL Sa93iOcfQKasFm+fMddoxEsHNZhMr7FgSmdnTEVWapF6dHS+5toGTCupjdY0gVPXR0er KFuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9ZAveC3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g127si15687742pgc.313.2019.03.26.03.17.22; Tue, 26 Mar 2019 03:17:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9ZAveC3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730751AbfCZKRW (ORCPT + 7 others); Tue, 26 Mar 2019 06:17:22 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50568 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731267AbfCZKRW (ORCPT ); Tue, 26 Mar 2019 06:17:22 -0400 Received: by mail-wm1-f65.google.com with SMTP id z11so12050814wmi.0 for ; Tue, 26 Mar 2019 03:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fylf7pTOJC8ppYoSWOQNUlj74ePm38xqTj3FfXozA2w=; b=P9ZAveC3HcU+GRwveIhtJfwnaNrvMsjAEX0iSbNmrsepR3IlZa1a26ofUEAAmIuuY5 NfP3b5w4GNbxXULggMHem9GBJTuqtE4tHuo+7whWBHIBZDRHteyKiYDXDTfUvtF7SdpX NCIwKUiLwK1BVsxFQEM8Io9ZvJRolVJ+nRHZ3wchvVODM1hqCQZUTDj+9ZEslKEhogxb vcL8Ub+HYuvqobIalyYRAxWhbMO+H+OQTVjZVanZ94sdBmoNNvPd9RzA2ATRYF2T2Nzr toSmlQUD25d7FOLLNnLmT4/ftOZAkBcd+ydkVf9rTQkN8pFUGB+pVEBBNWltt9vC2tsh 5RJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fylf7pTOJC8ppYoSWOQNUlj74ePm38xqTj3FfXozA2w=; b=Jy7gCubK7UqYw4XbrTt0i23XYzgmGpC4iZrKjRFeF+8a7l6YU39+yWWMuYoCC5jTZ5 pLYoJ//5itWZDpuZ0p851hSa/LHeMm1o/KL9sepGECFQWEbkhXxU39XXcx5fThYSr3Nx TxCLay5M4/pMYmhOE6nBvaYNLC+4zArEm5kqHdUyn1mBQgTanhfkSVIs0V1MDwVtDvEi KhOAXI1HpVbvBagD/niNy9rwumRoNswSzmxxQWsewtO8jVs85zGcD9Fi49LBEr2/KraH rHa0mI2ahJh880TGE6Gu18qmmH9I/MXILFEQPgkAeys/opFZLgosl47KOVIbo8Y2ugl0 UtqA== X-Gm-Message-State: APjAAAXvjNsT08nHZVgRXFgX3RZMgYmTM06JusVpczHr4bbL5Q6UqsME s05vhi7NV92d7JzXzgSErT3vag== X-Received: by 2002:a1c:2d0e:: with SMTP id t14mr7227725wmt.33.1553595440833; Tue, 26 Mar 2019 03:17:20 -0700 (PDT) Received: from arch-late.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id j1sm22281024wme.4.2019.03.26.03.17.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 03:17:20 -0700 (PDT) From: Rui Miguel Silva To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Rob Herring , Fabio Estevam Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Rui Miguel Silva Subject: [PATCH v5 6/6] MAINTAINERS: add entry for fxas21002c gyro driver Date: Tue, 26 Mar 2019 10:16:51 +0000 Message-Id: <20190326101651.25056-7-rui.silva@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326101651.25056-1-rui.silva@linaro.org> References: <20190326101651.25056-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add me as maintainer of the nxp fxas21002c gyroscope driver. Signed-off-by: Rui Miguel Silva --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.21.0 diff --git a/MAINTAINERS b/MAINTAINERS index e17ebf70b548..2748e406889c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11107,6 +11107,16 @@ F: Documentation/ABI/stable/sysfs-bus-nvmem F: include/linux/nvmem-consumer.h F: include/linux/nvmem-provider.h +NXP FXAS21002C DRIVER +M: Rui Miguel Silva +L: linux-iio@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/iio/gyroscope/fxas21002c.txt +F: drivers/iio/gyro/fxas21002c_core.c +F: drivers/iio/gyro/fxas21002c.h +F: drivers/iio/gyro/fxas21002c_i2c.c +F: drivers/iio/gyro/fxas21002c_spi.c + NXP SGTL5000 DRIVER M: Fabio Estevam L: alsa-devel@alsa-project.org (moderated for non-subscribers)