From patchwork Wed Jul 17 11:51:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11047753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25D2017E0 for ; Wed, 17 Jul 2019 11:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14CEE28635 for ; Wed, 17 Jul 2019 11:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0923C28707; Wed, 17 Jul 2019 11:51:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A206828635 for ; Wed, 17 Jul 2019 11:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732285AbfGQLvp (ORCPT ); Wed, 17 Jul 2019 07:51:45 -0400 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]:41226 "EHLO mx0b-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732069AbfGQLvo (ORCPT ); Wed, 17 Jul 2019 07:51:44 -0400 Received: from pps.filterd (m0167091.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6HBltG5017441; Wed, 17 Jul 2019 07:51:40 -0400 Received: from nam01-bn3-obe.outbound.protection.outlook.com (mail-bn3nam01lp2051.outbound.protection.outlook.com [104.47.33.51]) by mx0b-00128a01.pphosted.com with ESMTP id 2tseucbkm8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 07:51:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S7rsgUffCHonLARLLGKlqLwfQq0rtU5msVQFvgSX7rUTveL364nFDqUXPKvR4HgRqy5E6F65e85pBDjfBPpk3rw5MM9QxcrsDi7X5yGwD6VgsPtHdu9VS7/XiIUqwBL1ruy0861ClO23sLSOzt9tL6zpiaktRJ+W9WH0TLg/+r5oMkxu18jEu+WkG88dQDh2nks6IVEotaTdYutlpdsdKWkbcyk1Jvsyn5pXD2IML1XhWIIaxUH2Gc1vz/tFwVgY5TQq7/1M+XSNy+l+OE0XGbqcapulpIHMH9JW4j+yJtYxdifWNk1rvGpV2Un+d7WcrwREjmlop2d1H7+089EGUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1IW4/S+Z58ajiJ8VrWqHdQHBIbMMvua9x5tt1atnyR8=; b=SMUpbDe8C5p6tiezTMdKvOXfLCATJRyddPZmPzsSqN08fLI4GAbt/Waw32MreXv4aAlEpItVYj1rF8VIrHQ7kqAgxyYign1VAlgQsOYPAhbMQXyUd/fUPpCUJ7wSo8njVDgSsj7ui5MhM6lK9GPaXXxi+R3aQgeDWCDTzAcJvnGv4IQzNf8nxkZqkA6QVWf9mVV7/aMdbaHkpW3a98lmii11wLp/7AiGO8cs2jqwgXKgqly3R4E50M3FsRERCnMzOAswFyMWkGS4UvDuQTnrEl4fg4S9i3+UFEkop0Op1lcKL+kEihl2JCblQDFHNfqMkydXTwXPeekQRdUnHoO/yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com;dmarc=bestguesspass action=none header.from=analog.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1IW4/S+Z58ajiJ8VrWqHdQHBIbMMvua9x5tt1atnyR8=; b=fqXu3x/3TteBNbTiCCdGF8TOks2Be+Hk3ACyNm1ohSS9c0QumUpwDQ+4cfwB2hK8LhJGTgJImG49lcK2XL65Uk1Q42kt5TjV0vIGlKeARptiGRcmEWqYyZI9D0Qem31W68WtNtTiHn+bmsyhFlF32961QDxY6kZazV+SD1gyi74= Received: from DM6PR03CA0008.namprd03.prod.outlook.com (20.176.118.149) by MN2PR03MB4720.namprd03.prod.outlook.com (20.179.81.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.11; Wed, 17 Jul 2019 11:51:38 +0000 Received: from SN1NAM02FT042.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by DM6PR03CA0008.outlook.office365.com (2603:10b6:5:40::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.10 via Frontend Transport; Wed, 17 Jul 2019 11:51:37 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT042.mail.protection.outlook.com (10.152.73.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2032.15 via Frontend Transport; Wed, 17 Jul 2019 11:51:37 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x6HBpXt0003269 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Wed, 17 Jul 2019 04:51:33 -0700 Received: from saturn.ad.analog.com (10.48.65.145) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Wed, 17 Jul 2019 07:51:32 -0400 From: Alexandru Ardelean To: , , , CC: , , , , Alexandru Ardelean , Michael Hennerich Subject: [PATCH 1/4][V2] drivers: spi: core: Add optional delay between cs_change transfers Date: Wed, 17 Jul 2019 14:51:06 +0300 Message-ID: <20190717115109.15168-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717115109.15168-1-alexandru.ardelean@analog.com> References: <20190717115109.15168-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(2980300002)(199004)(189003)(70586007)(2201001)(305945005)(5660300002)(2906002)(11346002)(476003)(2616005)(336012)(446003)(70206006)(246002)(110136005)(126002)(7636002)(54906003)(86362001)(4326008)(486006)(14444005)(106002)(426003)(8676002)(1076003)(48376002)(47776003)(186003)(44832011)(6666004)(356004)(50226002)(50466002)(76176011)(2870700001)(8936002)(7696005)(51416003)(498600001)(26005)(107886003)(36756003);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR03MB4720;H:nwd2mta2.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail11.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1405b5a3-7239-4ed1-e6c1-08d70aad1fcb X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:MN2PR03MB4720; X-MS-TrafficTypeDiagnostic: MN2PR03MB4720: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 01018CB5B3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: m4MLuob3EGFJvehUPdvucyM7Umn+m4PtdZzZaVRoIN/rrxvJXggCh4Gp+tX0HdybCRAn+wjNsn+ZCfKm9cD5BkU1fD3w3j3xq0XKOJBQcI0OA77+ItP+DYV9bDOQ0VjuYq71zRQs0KnVCXsCigevKAuRDmpejAbYz2CiD5i87A1nH5NJgJ1ROiaPeaqFoWxoqF6dNO5mfs1Bhhn/z0uMWsReYLTwvXQm84yPcsFyxSUdYLHPkk/b+mnL72olZThOy5UjcJGBDYQMNMNlWJsUVqKAklZEUW36oOzQA52TAASiBWe7U5F4k+OHxKbfKdzb7klkixnXtVi1T30ktuXZfgBBMeUgkVp6uYtbBzs+KceNA7eGXUiI6AxLHR8ZNhNaBcEdBa7urBsRBJU2fUqXqFfNpqdYprVJmLdbXkHquJM= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2019 11:51:37.1387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1405b5a3-7239-4ed1-e6c1-08d70aad1fcb X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.57];Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4720 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170145 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some devices like the ADIS16460 IMU require a stall period between transfers, i.e. between when the CS is de-asserted and re-asserted. The default value of 10us is not enough. This change makes the delay configurable for when the next CS change goes active. Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 3 ++- include/linux/spi/spi.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5e75944ad5d1..02fd00bcaace 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1163,7 +1163,8 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, keep_cs = true; } else { spi_set_cs(msg->spi, false); - udelay(10); + udelay(xfer->cs_change_delay_usecs ? + xfer->cs_change_delay_usecs : 10); spi_set_cs(msg->spi, true); } } diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 053abd22ad31..c884b3b94841 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -734,6 +734,8 @@ extern void spi_res_release(struct spi_controller *ctlr, * transfer. If 0 the default (from @spi_device) is used. * @bits_per_word: select a bits_per_word other than the device default * for this transfer. If 0 the default (from @spi_device) is used. + * @cs_change_delay_usecs: microseconds to delay between cs_change + * transfers. * @cs_change: affects chipselect after this transfer completes * @delay_usecs: microseconds to delay after this transfer before * (optionally) changing the chipselect status, then starting @@ -823,6 +825,7 @@ struct spi_transfer { #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ u8 bits_per_word; u8 word_delay_usecs; + u8 cs_change_delay_usecs; u16 delay_usecs; u32 speed_hz; u16 word_delay; From patchwork Wed Jul 17 11:51:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11047759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DB4F1398 for ; Wed, 17 Jul 2019 11:52:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F238286FD for ; Wed, 17 Jul 2019 11:52:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 233D4286E2; Wed, 17 Jul 2019 11:52:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3CAF2873F for ; Wed, 17 Jul 2019 11:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731637AbfGQLvn (ORCPT ); Wed, 17 Jul 2019 07:51:43 -0400 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]:39836 "EHLO mx0b-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfGQLvm (ORCPT ); Wed, 17 Jul 2019 07:51:42 -0400 Received: from pps.filterd (m0167090.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6HBlwUq024285; Wed, 17 Jul 2019 07:51:37 -0400 Received: from nam02-cy1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2057.outbound.protection.outlook.com [104.47.37.57]) by mx0b-00128a01.pphosted.com with ESMTP id 2ts491myv5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 07:51:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DM2F/SGhhBRLxaLsWkyr5MTq0lSrcnKnPTmnoojl25GtHwfoDZv08NIsx/zBvFDoHzoyZDCtxskJhXmwuNkpUV1szOto3tcuB8/tJdG9T2jjwtP0NKIcFZOO3KSG3J2JBQNC/rbAQXVnM0GoYUEz5kzRTVSmKHxxFb275WEqVs3Zqrw8Da78hTg8uxv5mtuumO5gYbj7mYwt6agbA9ujPTbikySTS1Q95qYGFlE/JbIsOtTcWcJwlOtmUGk349casctvK2w3zQe1cdGj2WBDnAAFb3LcTWyaBHPwaMmuUblVYyB4JpMzKYsFWqxqLP/ojFMnaOkNKhEuoypM5vbkXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yE+BnInK8aoK7ZmKElVQFCx9SV4eUVXn2ynkPMPbvD4=; b=amZ+oNvFXmZlGgJZKe8Aa2FSaPPKJvMzmnEsHnLZf1cU64GfEcL8O5fuv093am3v1SH+IWIk8Tw1mDwFCdjy5coZtg5dGG9AZcgDBoQtg1PKcToo8d0i2eD7QxtGLBq+UsyAR4RRD+dcB+lEUe/noSEHtLYJo0LzvuQsAqHrBibOo63WksWnU22Zl9B6lQTiYMf8hdIS9z768lgjrvBE5l3eiPNhjf7sOP1E9c4kDT/xklAE4gdnT811V9aVq7vQ6SohPJP6LVY4WCmRAXRcbQqF72H8QaSs79R6LLt+MsZGhZ8CPDEYxK6cKtcr1HCz9EuNRO1NZlUZIiLpKF8wWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com;dmarc=bestguesspass action=none header.from=analog.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yE+BnInK8aoK7ZmKElVQFCx9SV4eUVXn2ynkPMPbvD4=; b=M1VtI3cN3nothq8zAUWP+TOYYX9s13fCOqVRT7mbqiL3XcGoU/gY1DBoQZysQS6TcAt82XD+DTIk1tddNIbaZmpYqu0Cy83dc45AXIWuBRSbU0/gwnQWZ0HRjKaiQZCXK90U/K7tyTE8JfVEuGxJg1g6gYz8PVazQ7OCI4aMFio= Received: from BN3PR03CA0075.namprd03.prod.outlook.com (2a01:111:e400:7a4d::35) by MN2PR03MB4718.namprd03.prod.outlook.com (2603:10b6:208:ae::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.10; Wed, 17 Jul 2019 11:51:36 +0000 Received: from SN1NAM02FT022.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::202) by BN3PR03CA0075.outlook.office365.com (2a01:111:e400:7a4d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14 via Frontend Transport; Wed, 17 Jul 2019 11:51:36 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT022.mail.protection.outlook.com (10.152.72.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2052.25 via Frontend Transport; Wed, 17 Jul 2019 11:51:35 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x6HBpZGe003296 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Wed, 17 Jul 2019 04:51:35 -0700 Received: from saturn.ad.analog.com (10.48.65.145) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Wed, 17 Jul 2019 07:51:34 -0400 From: Alexandru Ardelean To: , , , CC: , , , , Alexandru Ardelean , Michael Hennerich Subject: [PATCH 2/4][V2] iio: imu: adis: Add support for SPI transfer cs_change_delay_usecs Date: Wed, 17 Jul 2019 14:51:07 +0300 Message-ID: <20190717115109.15168-3-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717115109.15168-1-alexandru.ardelean@analog.com> References: <20190717115109.15168-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(136003)(346002)(376002)(2980300002)(199004)(189003)(2616005)(7636002)(426003)(356004)(70206006)(476003)(106002)(8676002)(1076003)(126002)(107886003)(305945005)(446003)(36756003)(70586007)(2201001)(6666004)(336012)(48376002)(486006)(11346002)(246002)(8936002)(478600001)(316002)(44832011)(47776003)(186003)(26005)(86362001)(50226002)(2906002)(110136005)(2870700001)(7696005)(5660300002)(54906003)(51416003)(76176011)(4326008)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR03MB4718;H:nwd2mta2.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail11.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f152b794-df41-4a76-4f24-08d70aad1ee6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:MN2PR03MB4718; X-MS-TrafficTypeDiagnostic: MN2PR03MB4718: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 01018CB5B3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: hBxW+RJwUS4QYKlBT6uOH0FSp1uG0fHa/WlWaB9aScBmyN87sDAflzPs4bmbk515Bdua/L69ZOtB4Fu7f1MZf2Ml/AZAPbUThtAhoN1/S+ik1FxRyui7XEBOmqailWwatDj3aEnEqf0sDzZp3STRIg5pcRTJ4RfAW52Ln7Dv5QGlfyBQZLD7HQXLJe5TBkWCVobPOWYYC7jA2m//CBIthEzqt8V02t98QlTdAi0BFZNK4dGRtvl3KmH6c3sb5UzGjOh3ZRrRydF1jVDtmxXGaClX8EHZrxs+Z9Jkrm6FalXHIK0PhuTJdWm3TiaZRJ0/g6GZV4kaw2IjSCiwkP6cAXIE32pLy8kqEnK/5uTyCIhUxnw1/yi6rEecftGSDm+jdeDj8MoZY/0y6LDRusIR+/KzaxuVyJY9IUq6rIoh1Zk= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2019 11:51:35.6461 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f152b794-df41-4a76-4f24-08d70aad1ee6 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.57];Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4718 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170145 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADIS16460 requires a higher delay before the next transfer. Since the SPI framework supports configuring the delay before the next transfer, this driver will become the first user of it. The support for this functionality in ADIS16460 requires an addition to the ADIS lib to support the `cs_change_stall_delay_us` functionality in SPI. Not all transfers set `cs_change` to 1. Only those that do, have the `cs_change_delay` assigned. Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean --- drivers/iio/imu/adis.c | 6 ++++++ include/linux/iio/imu/adis.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index c771ae6803a9..6fdb6f4cebd4 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -40,18 +40,21 @@ int adis_write_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .tx_buf = adis->tx + 4, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .tx_buf = adis->tx + 6, .bits_per_word = 8, @@ -134,12 +137,14 @@ int adis_read_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->read_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .tx_buf = adis->tx + 4, .rx_buf = adis->rx, @@ -147,6 +152,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->read_delay, + .cs_change_delay_usecs = adis->data->cs_change_delay, }, { .rx_buf = adis->rx + 2, .bits_per_word = 8, diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 469a493f7ae0..fd884b45ed45 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -27,6 +27,7 @@ struct adis_burst; * struct adis_data - ADIS chip variant specific data * @read_delay: SPI delay for read operations in us * @write_delay: SPI delay for write operations in us + * @cs_change_delay: SPI delay between CS changes in us * @glob_cmd_reg: Register address of the GLOB_CMD register * @msc_ctrl_reg: Register address of the MSC_CTRL register * @diag_stat_reg: Register address of the DIAG_STAT register @@ -36,6 +37,7 @@ struct adis_burst; struct adis_data { unsigned int read_delay; unsigned int write_delay; + unsigned int cs_change_delay; unsigned int glob_cmd_reg; unsigned int msc_ctrl_reg; From patchwork Wed Jul 17 11:51:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11047757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8EC2817E0 for ; Wed, 17 Jul 2019 11:52:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 801A528702 for ; Wed, 17 Jul 2019 11:52:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74545286E2; Wed, 17 Jul 2019 11:52:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78021286B8 for ; Wed, 17 Jul 2019 11:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732650AbfGQLv6 (ORCPT ); Wed, 17 Jul 2019 07:51:58 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:16050 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfGQLvp (ORCPT ); Wed, 17 Jul 2019 07:51:45 -0400 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6HBmHEQ030988; Wed, 17 Jul 2019 07:51:41 -0400 Received: from nam02-cy1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2051.outbound.protection.outlook.com [104.47.37.51]) by mx0a-00128a01.pphosted.com with ESMTP id 2tsf0g3hw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 07:51:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d9WhWLRxrdlA72+DtrDw/KE8bt8exZi2IcXurvk3LMRCM3Zo0U05xQ+OgtX2irthtGQ9NozKIw/+THqNZgcuTSmrPrjXl3ix9XE7jFdPLVPHRX1njFsHtcllsbpHH9DpYaoZoxA9/ZmA0x+flQVwYm+/SV2KDkf9Z/IcN3CfMn3cfjBhC/5tEVonjMPkFy7J0+QB4dMCm+rjU/U9dTBamwEsZVxCSppNIQjKJqzEPd5ZIQZyUXRb1XDp49XPSWK1LrhsdfLMfY4ZGyqS5wLf/+LjJrFNdLXVBrB3bi2G64pVrfJDtUM3pjGF8WyThkyseU6pqCPxZJ7kYOMAOGGYUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9+MNPfHIw4Y5w7vMcBRpj44vkyRT4kcvuWAxAFNkRKY=; b=Dcp8ow7QQ3k2iaIftQnVcNDthi41rceQvRZ/xuCTftoXRMvKAnCFTQJLxi8QlKYtFhqtumYvNIHBvSA9dLhYRLeyLiORR3bxOJcVanCNKUbkFHb+EB23dZoHhDfm9OGnvBGf8iS/d3qgrq39cHtmSE6SAb2LNVpLWh61e3BEeao7PxkClMh4fPaY3gSlWWxwmlIz3erS+/VVyqAmOLLBIoaibWGQNgBBvcZgGKE3iNY0enjBzD+uTwq98lz1DWJbprIQ006Zlwelcl29oUopYGOPcxziyetRD9lMeD++1DKmnFRH6fNJzwM9gpaZLh5s4JxcopA5CEVYgzS1xAoPMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com;dmarc=bestguesspass action=none header.from=analog.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9+MNPfHIw4Y5w7vMcBRpj44vkyRT4kcvuWAxAFNkRKY=; b=ahjpDQABPCeE/xmbFn28N+1pfVo/iW/d+QNW315F9Gk0JysirwGR09YorvE6Tn68JXmdp9pILx67b1p8C34uwhxJGDkVjFKMGHOooBmsf9YbGMpxEVxwmBL51JCNVF70fxpPin9r6o9l9POGVcMxcq98BOEHaYzteOwMDjtXbog= Received: from DM5PR03CA0032.namprd03.prod.outlook.com (2603:10b6:4:3b::21) by MN2PR03MB4718.namprd03.prod.outlook.com (2603:10b6:208:ae::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.10; Wed, 17 Jul 2019 11:51:38 +0000 Received: from SN1NAM02FT037.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::204) by DM5PR03CA0032.outlook.office365.com (2603:10b6:4:3b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.10 via Frontend Transport; Wed, 17 Jul 2019 11:51:38 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT037.mail.protection.outlook.com (10.152.72.89) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2052.25 via Frontend Transport; Wed, 17 Jul 2019 11:51:38 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x6HBpbXn003303 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Wed, 17 Jul 2019 04:51:37 -0700 Received: from saturn.ad.analog.com (10.48.65.145) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Wed, 17 Jul 2019 07:51:36 -0400 From: Alexandru Ardelean To: , , , CC: , , , , Alexandru Ardelean , Dragos Bogdan , Michael Hennerich Subject: [PATCH 3/4][V2] iio: imu: Add support for the ADIS16460 IMU Date: Wed, 17 Jul 2019 14:51:08 +0300 Message-ID: <20190717115109.15168-4-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717115109.15168-1-alexandru.ardelean@analog.com> References: <20190717115109.15168-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(136003)(346002)(376002)(2980300002)(199004)(189003)(2616005)(7636002)(426003)(356004)(70206006)(30864003)(476003)(106002)(8676002)(1076003)(126002)(107886003)(305945005)(14444005)(446003)(36756003)(70586007)(2201001)(6666004)(336012)(48376002)(486006)(11346002)(246002)(8936002)(478600001)(316002)(44832011)(47776003)(186003)(26005)(86362001)(50226002)(2906002)(110136005)(2870700001)(7696005)(6306002)(5660300002)(54906003)(51416003)(966005)(76176011)(4326008)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR03MB4718;H:nwd2mta2.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail11.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e3c49a2-5e2a-4898-cd1d-08d70aad2050 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:MN2PR03MB4718; X-MS-TrafficTypeDiagnostic: MN2PR03MB4718: X-MS-Exchange-PUrlCount: 2 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 01018CB5B3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: v2R5DKTKpez+a0Sphln2Ha+MOFzk63y/SsB/8jJZHrzaDJvPZKD1xnCsjpT9qVPNiP5rxq65Rzfi3C4ek64SwonHIh1XHVcHSXMcTwYQ2/uub9Xia/hnCYIx9ERN6x3VNvU8lhcHSIFjQwYAltkDvJjKo+1SPOSSvKzLHIy/vh+Xluz0BUiP/yMqhWgKhETg4iHwb44Gf66q0v7CNz/d3U80CH2pKqjyQmvtWsTMudEnLIavphpKDNvmBBSjLjZotHIsCPSCr1iaI1DBN7CWyM33/m4XDBdMUV1zCDuKt3aZC2b5pTiPDUadkWJXSJlImX0R7kwKJ92HEVw3GpfIVLr7tFcT4lMeP51KLupVZH/dpjPEa/zOoxEezXHZHClKco/e7ZRPOkrg5CuzRbg3eacPWvX3OXnpU71tF+iHneg= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2019 11:51:38.0087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e3c49a2-5e2a-4898-cd1d-08d70aad2050 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.57];Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4718 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170145 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADIS16460 device is a complete inertial system that includes a triaxial gyroscope and a triaxial accelerometer. It's more simplified design than that of the ADIS16480, and does not offer the triaxial magnetometers & pressure sensors. It does also have a temperature sensor (like the ADIS16480). Since it is part of the ADIS16XXX family, it re-uses parts of the ADIS library. Naturally, the register map is different and much more simplified than the ADIS16480 subfamily, so it cannot be integrated into that driver. A major difference is that the registers are not paged. One thing that is particularly special about it, is that it requires a higher delay between CS changes (i.e. when CS goes up, the spec recommends that it be brought down after a minimum of 16 uS). Other ADIS chips require (via spec) a minimum of 2 uS between CS changes. The kernel's 10 uS default should be fine for those other chips; they haven't been tested with lower CS change delays yet. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adis16460.pdf Signed-off-by: Dragos Bogdan Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean --- MAINTAINERS | 7 + drivers/iio/imu/Kconfig | 12 + drivers/iio/imu/Makefile | 1 + drivers/iio/imu/adis16460.c | 489 ++++++++++++++++++++++++++++++++++++ 4 files changed, 509 insertions(+) create mode 100644 drivers/iio/imu/adis16460.c diff --git a/MAINTAINERS b/MAINTAINERS index ad498428b38c..8e679504c087 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -937,6 +937,13 @@ L: linux-iio@vger.kernel.org F: include/linux/iio/imu/adis.h F: drivers/iio/imu/adis.c +ANALOG DEVICES INC ADIS16460 DRIVER +M: Dragos Bogdan +S: Supported +L: linux-iio@vger.kernel.org +W: http://ez.analog.com/community/linux-device-drivers +F: drivers/iio/imu/adis16460.c + ANALOG DEVICES INC ADP5061 DRIVER M: Stefan Popa L: linux-pm@vger.kernel.org diff --git a/drivers/iio/imu/Kconfig b/drivers/iio/imu/Kconfig index 156630a21696..f048d0d757b1 100644 --- a/drivers/iio/imu/Kconfig +++ b/drivers/iio/imu/Kconfig @@ -16,6 +16,18 @@ config ADIS16400 adis16365, adis16400 and adis16405 triaxial inertial sensors (adis16400 series also have magnetometers). +config ADIS16460 + tristate "Analog Devices ADIS16460 and similar IMU driver" + depends on SPI + select IIO_ADIS_LIB + select IIO_ADIS_LIB_BUFFER if IIO_BUFFER + help + Say yes here to build support for Analog Devices ADIS16460 inertial + sensor. + + To compile this driver as a module, choose M here: the module will be + called adis16460. + config ADIS16480 tristate "Analog Devices ADIS16480 and similar IMU driver" depends on SPI diff --git a/drivers/iio/imu/Makefile b/drivers/iio/imu/Makefile index 9e452fce1aaf..4a6958865504 100644 --- a/drivers/iio/imu/Makefile +++ b/drivers/iio/imu/Makefile @@ -5,6 +5,7 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_ADIS16400) += adis16400.o +obj-$(CONFIG_ADIS16460) += adis16460.o obj-$(CONFIG_ADIS16480) += adis16480.o adis_lib-y += adis.o diff --git a/drivers/iio/imu/adis16460.c b/drivers/iio/imu/adis16460.c new file mode 100644 index 000000000000..db713cba75a2 --- /dev/null +++ b/drivers/iio/imu/adis16460.c @@ -0,0 +1,489 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * ADIS16460 IMU driver + * + * Copyright 2019 Analog Devices Inc. + */ + +#include +#include +#include + +#include +#include + +#include + +#define ADIS16460_REG_FLASH_CNT 0x00 +#define ADIS16460_REG_DIAG_STAT 0x02 +#define ADIS16460_REG_X_GYRO_LOW 0x04 +#define ADIS16460_REG_X_GYRO_OUT 0x06 +#define ADIS16460_REG_Y_GYRO_LOW 0x08 +#define ADIS16460_REG_Y_GYRO_OUT 0x0A +#define ADIS16460_REG_Z_GYRO_LOW 0x0C +#define ADIS16460_REG_Z_GYRO_OUT 0x0E +#define ADIS16460_REG_X_ACCL_LOW 0x10 +#define ADIS16460_REG_X_ACCL_OUT 0x12 +#define ADIS16460_REG_Y_ACCL_LOW 0x14 +#define ADIS16460_REG_Y_ACCL_OUT 0x16 +#define ADIS16460_REG_Z_ACCL_LOW 0x18 +#define ADIS16460_REG_Z_ACCL_OUT 0x1A +#define ADIS16460_REG_SMPL_CNTR 0x1C +#define ADIS16460_REG_TEMP_OUT 0x1E +#define ADIS16460_REG_X_DELT_ANG 0x24 +#define ADIS16460_REG_Y_DELT_ANG 0x26 +#define ADIS16460_REG_Z_DELT_ANG 0x28 +#define ADIS16460_REG_X_DELT_VEL 0x2A +#define ADIS16460_REG_Y_DELT_VEL 0x2C +#define ADIS16460_REG_Z_DELT_VEL 0x2E +#define ADIS16460_REG_MSC_CTRL 0x32 +#define ADIS16460_REG_SYNC_SCAL 0x34 +#define ADIS16460_REG_DEC_RATE 0x36 +#define ADIS16460_REG_FLTR_CTRL 0x38 +#define ADIS16460_REG_GLOB_CMD 0x3E +#define ADIS16460_REG_X_GYRO_OFF 0x40 +#define ADIS16460_REG_Y_GYRO_OFF 0x42 +#define ADIS16460_REG_Z_GYRO_OFF 0x44 +#define ADIS16460_REG_X_ACCL_OFF 0x46 +#define ADIS16460_REG_Y_ACCL_OFF 0x48 +#define ADIS16460_REG_Z_ACCL_OFF 0x4A +#define ADIS16460_REG_LOT_ID1 0x52 +#define ADIS16460_REG_LOT_ID2 0x54 +#define ADIS16460_REG_PROD_ID 0x56 +#define ADIS16460_REG_SERIAL_NUM 0x58 +#define ADIS16460_REG_CAL_SGNTR 0x60 +#define ADIS16460_REG_CAL_CRC 0x62 +#define ADIS16460_REG_CODE_SGNTR 0x64 +#define ADIS16460_REG_CODE_CRC 0x66 + +struct adis16460_chip_info { + unsigned int num_channels; + const struct iio_chan_spec *channels; + unsigned int gyro_max_val; + unsigned int gyro_max_scale; + unsigned int accel_max_val; + unsigned int accel_max_scale; +}; + +struct adis16460 { + const struct adis16460_chip_info *chip_info; + struct adis adis; +}; + +#ifdef CONFIG_DEBUG_FS + +static int adis16460_show_serial_number(void *arg, u64 *val) +{ + struct adis16460 *adis16460 = arg; + u16 serial; + int ret; + + ret = adis_read_reg_16(&adis16460->adis, ADIS16460_REG_SERIAL_NUM, + &serial); + if (ret < 0) + return ret; + + *val = serial; + + return 0; +} +DEFINE_SIMPLE_ATTRIBUTE(adis16460_serial_number_fops, + adis16460_show_serial_number, NULL, "0x%.4llx\n"); + +static int adis16460_show_product_id(void *arg, u64 *val) +{ + struct adis16460 *adis16460 = arg; + u16 prod_id; + int ret; + + ret = adis_read_reg_16(&adis16460->adis, ADIS16460_REG_PROD_ID, + &prod_id); + if (ret < 0) + return ret; + + *val = prod_id; + + return 0; +} +DEFINE_SIMPLE_ATTRIBUTE(adis16460_product_id_fops, + adis16460_show_product_id, NULL, "%llu\n"); + +static int adis16460_show_flash_count(void *arg, u64 *val) +{ + struct adis16460 *adis16460 = arg; + u32 flash_count; + int ret; + + ret = adis_read_reg_32(&adis16460->adis, ADIS16460_REG_FLASH_CNT, + &flash_count); + if (ret < 0) + return ret; + + *val = flash_count; + + return 0; +} +DEFINE_SIMPLE_ATTRIBUTE(adis16460_flash_count_fops, + adis16460_show_flash_count, NULL, "%lld\n"); + +static int adis16460_debugfs_init(struct iio_dev *indio_dev) +{ + struct adis16460 *adis16460 = iio_priv(indio_dev); + + debugfs_create_file("serial_number", 0400, indio_dev->debugfs_dentry, + adis16460, &adis16460_serial_number_fops); + debugfs_create_file("product_id", 0400, indio_dev->debugfs_dentry, + adis16460, &adis16460_product_id_fops); + debugfs_create_file("flash_count", 0400, indio_dev->debugfs_dentry, + adis16460, &adis16460_flash_count_fops); + + return 0; +} + +#else + +static int adis16460_debugfs_init(struct iio_dev *indio_dev) +{ + return 0; +} + +#endif + +static int adis16460_set_freq(struct iio_dev *indio_dev, int val, int val2) +{ + struct adis16460 *st = iio_priv(indio_dev); + unsigned int t; + + t = val * 1000 + val2 / 1000; + if (t <= 0) + return -EINVAL; + + t = 2048000 / t; + if (t > 2048) + t = 2048; + + if (t != 0) + t--; + + return adis_write_reg_16(&st->adis, ADIS16460_REG_DEC_RATE, t); +} + +static int adis16460_get_freq(struct iio_dev *indio_dev, int *val, int *val2) +{ + struct adis16460 *st = iio_priv(indio_dev); + uint16_t t; + int ret; + unsigned int freq; + + ret = adis_read_reg_16(&st->adis, ADIS16460_REG_DEC_RATE, &t); + if (ret < 0) + return ret; + + freq = 2048000 / (t + 1); + *val = freq / 1000; + *val2 = (freq % 1000) * 1000; + + return IIO_VAL_INT_PLUS_MICRO; +} + +static int adis16460_read_raw(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, int *val, int *val2, long info) +{ + struct adis16460 *st = iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_RAW: + return adis_single_conversion(indio_dev, chan, 0, val); + case IIO_CHAN_INFO_SCALE: + switch (chan->type) { + case IIO_ANGL_VEL: + *val = st->chip_info->gyro_max_scale; + *val2 = st->chip_info->gyro_max_val; + return IIO_VAL_FRACTIONAL; + case IIO_ACCEL: + *val = st->chip_info->accel_max_scale; + *val2 = st->chip_info->accel_max_val; + return IIO_VAL_FRACTIONAL; + case IIO_TEMP: + *val = 50; /* 50 milli degrees Celsius/LSB */ + return IIO_VAL_INT; + default: + return -EINVAL; + } + case IIO_CHAN_INFO_OFFSET: + *val = 500; /* 25 degrees Celsius = 0x0000 */ + return IIO_VAL_INT; + case IIO_CHAN_INFO_SAMP_FREQ: + return adis16460_get_freq(indio_dev, val, val2); + default: + return -EINVAL; + } +} + +static int adis16460_write_raw(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, int val, int val2, long info) +{ + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + return adis16460_set_freq(indio_dev, val, val2); + default: + return -EINVAL; + } +} + +enum { + ADIS16460_SCAN_GYRO_X, + ADIS16460_SCAN_GYRO_Y, + ADIS16460_SCAN_GYRO_Z, + ADIS16460_SCAN_ACCEL_X, + ADIS16460_SCAN_ACCEL_Y, + ADIS16460_SCAN_ACCEL_Z, + ADIS16460_SCAN_TEMP, +}; + +#define ADIS16460_MOD_CHANNEL(_type, _mod, _address, _si, _bits) \ + { \ + .type = (_type), \ + .modified = 1, \ + .channel2 = (_mod), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .address = (_address), \ + .scan_index = (_si), \ + .scan_type = { \ + .sign = 's', \ + .realbits = (_bits), \ + .storagebits = (_bits), \ + .endianness = IIO_BE, \ + }, \ + } + +#define ADIS16460_GYRO_CHANNEL(_mod) \ + ADIS16460_MOD_CHANNEL(IIO_ANGL_VEL, IIO_MOD_ ## _mod, \ + ADIS16460_REG_ ## _mod ## _GYRO_LOW, ADIS16460_SCAN_GYRO_ ## _mod, \ + 32) + +#define ADIS16460_ACCEL_CHANNEL(_mod) \ + ADIS16460_MOD_CHANNEL(IIO_ACCEL, IIO_MOD_ ## _mod, \ + ADIS16460_REG_ ## _mod ## _ACCL_LOW, ADIS16460_SCAN_ACCEL_ ## _mod, \ + 32) + +#define ADIS16460_TEMP_CHANNEL() { \ + .type = IIO_TEMP, \ + .indexed = 1, \ + .channel = 0, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_OFFSET), \ + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .address = ADIS16460_REG_TEMP_OUT, \ + .scan_index = ADIS16460_SCAN_TEMP, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_BE, \ + }, \ + } + +static const struct iio_chan_spec adis16460_channels[] = { + ADIS16460_GYRO_CHANNEL(X), + ADIS16460_GYRO_CHANNEL(Y), + ADIS16460_GYRO_CHANNEL(Z), + ADIS16460_ACCEL_CHANNEL(X), + ADIS16460_ACCEL_CHANNEL(Y), + ADIS16460_ACCEL_CHANNEL(Z), + ADIS16460_TEMP_CHANNEL(), + IIO_CHAN_SOFT_TIMESTAMP(7) +}; + +static const struct adis16460_chip_info adis16460_chip_info = { + .channels = adis16460_channels, + .num_channels = ARRAY_SIZE(adis16460_channels), + /* + * storing the value in rad/degree and the scale in degree + * gives us the result in rad and better precession than + * storing the scale directly in rad. + */ + .gyro_max_val = IIO_RAD_TO_DEGREE(200 << 16), + .gyro_max_scale = 1, + .accel_max_val = IIO_M_S_2_TO_G(20000 << 16), + .accel_max_scale = 5, +}; + +static const struct iio_info adis16460_info = { + .read_raw = &adis16460_read_raw, + .write_raw = &adis16460_write_raw, + .update_scan_mode = adis_update_scan_mode, + .debugfs_reg_access = adis_debugfs_reg_access, +}; + +static int adis16460_enable_irq(struct adis *adis, bool enable) +{ + /* + * There is no way to gate the data-ready signal internally inside the + * ADIS16460 :( + */ + if (enable) + enable_irq(adis->spi->irq); + else + disable_irq(adis->spi->irq); + + return 0; +} + +static int adis16460_initial_setup(struct iio_dev *indio_dev) +{ + struct adis16460 *st = iio_priv(indio_dev); + uint16_t prod_id; + unsigned int device_id; + int ret; + + adis_reset(&st->adis); + msleep(222); + + ret = adis_write_reg_16(&st->adis, ADIS16460_REG_GLOB_CMD, BIT(1)); + if (ret) + return ret; + msleep(75); + + ret = adis_check_status(&st->adis); + if (ret) + return ret; + + ret = adis_read_reg_16(&st->adis, ADIS16460_REG_PROD_ID, &prod_id); + if (ret) + return ret; + + ret = sscanf(indio_dev->name, "adis%u\n", &device_id); + if (ret != 1) + return -EINVAL; + + if (prod_id != device_id) + dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.", + device_id, prod_id); + + return 0; +} + +#define ADIS16460_DIAG_STAT_IN_CLK_OOS 7 +#define ADIS16460_DIAG_STAT_FLASH_MEM 6 +#define ADIS16460_DIAG_STAT_SELF_TEST 5 +#define ADIS16460_DIAG_STAT_OVERRANGE 4 +#define ADIS16460_DIAG_STAT_SPI_COMM 3 +#define ADIS16460_DIAG_STAT_FLASH_UPT 2 + +static const char * const adis16460_status_error_msgs[] = { + [ADIS16460_DIAG_STAT_IN_CLK_OOS] = "Input clock out of sync", + [ADIS16460_DIAG_STAT_FLASH_MEM] = "Flash memory failure", + [ADIS16460_DIAG_STAT_SELF_TEST] = "Self test diagnostic failure", + [ADIS16460_DIAG_STAT_OVERRANGE] = "Sensor overrange", + [ADIS16460_DIAG_STAT_SPI_COMM] = "SPI communication failure", + [ADIS16460_DIAG_STAT_FLASH_UPT] = "Flash update failure", +}; + +static const struct adis_data adis16460_data = { + .diag_stat_reg = ADIS16460_REG_DIAG_STAT, + .glob_cmd_reg = ADIS16460_REG_GLOB_CMD, + .has_paging = false, + .read_delay = 5, + .write_delay = 5, + .cs_change_delay = 16, + .status_error_msgs = adis16460_status_error_msgs, + .status_error_mask = BIT(ADIS16460_DIAG_STAT_IN_CLK_OOS) | + BIT(ADIS16460_DIAG_STAT_FLASH_MEM) | + BIT(ADIS16460_DIAG_STAT_SELF_TEST) | + BIT(ADIS16460_DIAG_STAT_OVERRANGE) | + BIT(ADIS16460_DIAG_STAT_SPI_COMM) | + BIT(ADIS16460_DIAG_STAT_FLASH_UPT), + .enable_irq = adis16460_enable_irq, +}; + +static int adis16460_probe(struct spi_device *spi) +{ + struct iio_dev *indio_dev; + struct adis16460 *st; + int ret; + + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + spi_set_drvdata(spi, indio_dev); + + st = iio_priv(indio_dev); + + st->chip_info = &adis16460_chip_info; + indio_dev->dev.parent = &spi->dev; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->channels = st->chip_info->channels; + indio_dev->num_channels = st->chip_info->num_channels; + indio_dev->info = &adis16460_info; + indio_dev->modes = INDIO_DIRECT_MODE; + + ret = adis_init(&st->adis, indio_dev, spi, &adis16460_data); + if (ret) + return ret; + + ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); + if (ret) + return ret; + + adis16460_enable_irq(&st->adis, 0); + + ret = adis16460_initial_setup(indio_dev); + if (ret) + goto error_cleanup_buffer; + + ret = iio_device_register(indio_dev); + if (ret) + goto error_cleanup_buffer; + + adis16460_debugfs_init(indio_dev); + + return 0; + +error_cleanup_buffer: + adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); + return ret; +} + +static int adis16460_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct adis16460 *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); + + return 0; +} + +static const struct spi_device_id adis16460_ids[] = { + { "adis16460", 0 }, + {} +}; +MODULE_DEVICE_TABLE(spi, adis16460_id); + +static const struct of_device_id adis16460_of_match[] = { + { .compatible = "adi,adis16460" }, + {} +}; +MODULE_DEVICE_TABLE(of, adis16460_of_match); + +static struct spi_driver adis16460_driver = { + .driver = { + .name = "adis16460", + .of_match_table = adis16460_of_match, + }, + .id_table = adis16460_ids, + .probe = adis16460_probe, + .remove = adis16460_remove, +}; +module_spi_driver(adis16460_driver); + +MODULE_AUTHOR("Dragos Bogdan "); +MODULE_DESCRIPTION("Analog Devices ADIS16460 IMU driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Jul 17 11:51:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11047749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5683138D for ; Wed, 17 Jul 2019 11:51:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4A84286FD for ; Wed, 17 Jul 2019 11:51:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B569B286D5; Wed, 17 Jul 2019 11:51:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A0D0286E2 for ; Wed, 17 Jul 2019 11:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732571AbfGQLvt (ORCPT ); Wed, 17 Jul 2019 07:51:49 -0400 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]:42866 "EHLO mx0b-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732069AbfGQLvs (ORCPT ); Wed, 17 Jul 2019 07:51:48 -0400 Received: from pps.filterd (m0167090.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6HBmSrN024429; Wed, 17 Jul 2019 07:51:43 -0400 Received: from nam05-co1-obe.outbound.protection.outlook.com (mail-co1nam05lp2053.outbound.protection.outlook.com [104.47.48.53]) by mx0b-00128a01.pphosted.com with ESMTP id 2ts491myvj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 07:51:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xy0VOJCYAFoPHsIt83NSjgutx0FFy3LhdjDEmA6k+NQnVBkA0Fy/VfydlgNeiCii55JiLGCUpKaunqO7Gha2OXdUs458ESqP9F7G7OmxaYX4Lb4/e2FkB+jIRXopgYVXsIrDhjw4QqmqtavdCy8+GnM072B8Kf3+AYcWJA63HFOjXyAV8I3v2qW9sXHVKXfRfGZuifT6jILDi0FiMN8ujPU7kYCbm1XXKFEIw1pbcKwMaH0C6EPh2ewjMp1k8XrOp055T1WCS3Qi0lP1C05BKfc0GjYWwO4a5VR8B+ccsymuC8cUqid2KrdU2MUp4mNiT5ivqM2x7qnypAdJ35Unqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LbVEdqT7vCnY5ogGVUu4BAWVGt4Dcsgei+RokeZjvCk=; b=CmpZ1G7zekAniBXaND95G7asw7CxC7wz5c4PIv8rsLzjAbkqf8L7aMTPvzyrT5VXNRcOamgXnoTKOmc7lE58dopns19ikPKmEg2HA2kTUbyfHGZiyYInv38Ye6hyX9SBqhleGzTPvpDw/bcQLFPAZM0zX+IJzpfneeD5TjDuJyqJfcdOAPRzszhBWdS6Rb2zvJF4TdX64d+bEZ/RCin/ufmyHwM+myz224bBTaFe2i21VZGc7xAPy5SuM7iji4xeu8cWjK9gmjrO9fdvWEL7+Lxe05I1N8TZjG8HaQUI2yXDXgMwuBzYnM5WXAiOJ53BzsJXaS2lEZDhR3TiA39glg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com;dmarc=bestguesspass action=none header.from=analog.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LbVEdqT7vCnY5ogGVUu4BAWVGt4Dcsgei+RokeZjvCk=; b=LBHiMndEMxYA5WqGHP1jvHg0364tPGGPIPHiWkIgj+eEsd7T0n3Ytic3egc9tc4eLcryk4U1ClJ2tpP8wCShN/SZKdp9VPI2XX4Ofx9krrglobocKTRm22dCrCSJ0SpWDkB+Ta+7ITTKwikjQTgs13zE7Bu2It7ZFADIvjJVHsk= Received: from DM3PR03CA0007.namprd03.prod.outlook.com (2603:10b6:0:50::17) by DM6PR03MB4715.namprd03.prod.outlook.com (2603:10b6:5:181::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Wed, 17 Jul 2019 11:51:41 +0000 Received: from CY1NAM02FT019.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::204) by DM3PR03CA0007.outlook.office365.com (2603:10b6:0:50::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.14 via Frontend Transport; Wed, 17 Jul 2019 11:51:40 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT019.mail.protection.outlook.com (10.152.75.177) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2052.25 via Frontend Transport; Wed, 17 Jul 2019 11:51:40 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x6HBpdj0003310 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Wed, 17 Jul 2019 04:51:39 -0700 Received: from saturn.ad.analog.com (10.48.65.145) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Wed, 17 Jul 2019 07:51:38 -0400 From: Alexandru Ardelean To: , , , CC: , , , , Alexandru Ardelean Subject: [PATCH 4/4][V2] dt-bindings: iio: imu: add bindings for ADIS16460 Date: Wed, 17 Jul 2019 14:51:09 +0300 Message-ID: <20190717115109.15168-5-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717115109.15168-1-alexandru.ardelean@analog.com> References: <20190717115109.15168-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(39860400002)(396003)(346002)(376002)(2980300002)(199004)(189003)(48376002)(26005)(6666004)(356004)(54906003)(8676002)(2616005)(478600001)(86362001)(44832011)(486006)(11346002)(50226002)(7696005)(110136005)(8936002)(51416003)(446003)(47776003)(106002)(70586007)(2870700001)(336012)(2906002)(966005)(36756003)(1076003)(107886003)(305945005)(7636002)(4326008)(246002)(5660300002)(53376002)(186003)(126002)(426003)(6306002)(476003)(50466002)(316002)(70206006)(2201001)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR03MB4715;H:nwd2mta2.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail11.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0076831-df31-4ba0-bfe6-08d70aad21b0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:DM6PR03MB4715; X-MS-TrafficTypeDiagnostic: DM6PR03MB4715: X-MS-Exchange-PUrlCount: 4 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-Forefront-PRVS: 01018CB5B3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: mCajjOsM28zkg0Aku1AMf6ySDJSiS/kxkdzxrUzgigWCxx+UQay67awxgrIjvNOh5ZUWA311SAV7iDztqtSjbAoB1LRT1xE6l5gIyQM4tUTUvOBkO0D+MKv62QhnHw8haDBLOE2h0B8CFjCLkL3czUcWAE77mPhURZ/1rzNv+fxZH0kPnfIY0kmfaVh4ELgY0DvvEJ8c+4nakCgHMa3WrRMohSPIia4VL2dYQVFSk8BMs+5jvQpTyvEmOSzUTwS/j36bj1ZVvLncuDak119meCVgN0ws6EEaAdS2NEqOrbGlWzsdhzsBj2VuLRkwIjihT8jTYMKb8I+b86VMT6A51QwPG2Uf5lOccDQO6RBO3RSHqj/R8kv5yzfmyMIFe8Sdb/5KsiF4vZVa2RQUQBV1KN6HNJor4xXVfpl/FGTgK2s= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2019 11:51:40.0751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0076831-df31-4ba0-bfe6-08d70aad21b0 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.57];Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4715 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-17_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170145 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change adds device-tree bindings for the ADIS16460. Signed-off-by: Alexandru Ardelean Reviewed-by: Rob Herring --- .../bindings/iio/imu/adi,adis16460.yaml | 53 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml new file mode 100644 index 000000000000..0c53009ba7d6 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/adi,adis16460.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADIS16460 and similar IMUs + +maintainers: + - Dragos Bogdan + +description: | + Analog Devices ADIS16460 and similar IMUs + https://www.analog.com/media/en/technical-documentation/data-sheets/ADIS16460.pdf + +properties: + compatible: + enum: + - adi,adis16460 + + reg: + maxItems: 1 + + spi-cpha: true + + spi-cpol: true + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +examples: + - | + #include + #include + spi0 { + #address-cells = <1>; + #size-cells = <0>; + + imu@0 { + compatible = "adi,adis16460"; + reg = <0>; + spi-max-frequency = <5000000>; + spi-cpol; + spi-cpha; + interrupt-parent = <&gpio0>; + interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 8e679504c087..c44fbe8e91e9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -943,6 +943,7 @@ S: Supported L: linux-iio@vger.kernel.org W: http://ez.analog.com/community/linux-device-drivers F: drivers/iio/imu/adis16460.c +F: Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml ANALOG DEVICES INC ADP5061 DRIVER M: Stefan Popa