From patchwork Mon Dec 17 12:23:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733263 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 3C11713AD for ; Mon, 17 Dec 2018 12:24:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3AC29C95 for ; Mon, 17 Dec 2018 12:24:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EA3E29D0E; Mon, 17 Dec 2018 12:24:25 +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 8E7D629C95 for ; Mon, 17 Dec 2018 12:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbeLQMYY (ORCPT ); Mon, 17 Dec 2018 07:24:24 -0500 Received: from mail-eopbgr780088.outbound.protection.outlook.com ([40.107.78.88]:27695 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727068AbeLQMYX (ORCPT ); Mon, 17 Dec 2018 07:24:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=efl6YdC5zuNQ/GgkPLl0lIMlcGZ7aQrZ+MS2QX5lRNg=; b=e0zHYuV0SJ3NOx+HtQH7UfPo3dV9Kaqes09p2mUSVoBZqMhSmpV560NmWzB2/lsbgKo0+gFPKILkwp/0ArFDgrdmPoMdEkwpylw6b7Waag1uU0NkeCV4treZT9mBFRi+pqCLWHdJOAL7B25On+/YIGkjZ76lIV802AtDqyPHmWE= Received: from BYAPR03CA0010.namprd03.prod.outlook.com (2603:10b6:a02:a8::23) by BYAPR03MB3717.namprd03.prod.outlook.com (2603:10b6:a02:ac::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Mon, 17 Dec 2018 12:24:18 +0000 Received: from BY2FFO11FD005.protection.gbl (2a01:111:f400:7c0c::126) by BYAPR03CA0010.outlook.office365.com (2603:10b6:a02:a8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:24:18 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BY2FFO11FD005.mail.protection.outlook.com (10.1.14.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:24:17 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCOHox016334 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:24:17 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:24:16 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 1/6] staging: iio: adc: ad7606: Simplify the Kconfing menu Date: Mon, 17 Dec 2018 14:23:35 +0200 Message-ID: <1545049420-16484-2-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(136003)(396003)(346002)(376002)(2980300002)(3190300001)(199004)(189003)(77096007)(478600001)(50226002)(76176011)(316002)(305945005)(486006)(5660300001)(2616005)(44832011)(116002)(476003)(106002)(126002)(16586007)(50466002)(6666004)(8676002)(356004)(54906003)(110136005)(36756003)(246002)(48376002)(7636002)(4326008)(11346002)(7416002)(2906002)(8936002)(53416004)(426003)(7696005)(47776003)(106466001)(72206003)(446003)(186003)(26005)(336012)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB3717;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD005;1:uQg2Ne+sarYRM4CfMAxfvjR6tmxE1YsDyY/CdJPvlspca2OPoLUr7EV4+lYq0TkIygMF5o8yqOYwEIw0+dDQnJSwuU2fERVKRqv0nETvH/lBMiMJc8HFgRpgWX2zAxHk X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55f42daa-0c36-445e-aace-08d6641a90ab X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:BYAPR03MB3717; X-Microsoft-Exchange-Diagnostics: 1;BYAPR03MB3717;3:hHTInnOXl/8aGNeOVt+3gtgVkIWz2LgCZ/PpfBxwePBqoXdkAMs03KZxGLt77jHMczW3KNNFbzZpTlHT5gwihgov7Iaz32cPtFR4Kl7mhnmTQFlvdkSXVPvqaylML1/Tod9KoicNKURK7q+gseCa+/H/sBflUIQWDT71oVdu/OWDvg3FIaXAIvw66hvFbs4lby9QunmLogc5IJPFXC1TmRl6NLoS07+0tWyObF60H+HH1vuyjAbFvE1DIBowySbCDvC9jVn3/rDmQ+3omLpx4O1hm9ypk49I/4nF9OdDaeuU2UV+R/8V7k34TJHZHi0XzF1Tnf4BT4RC3on+GHeOEe6UxIlNf0CJuox1fhI9M14=;25:axvDRGFhjpbfL+BRm482EruuLr/stKa9LxxRe7FMo4sOhF7rxE1202BMTjsYAgJWrDoIoD4aA/9uTsLYa6L2OKtg9+fWAFStsQucypRFkQiLGoAeOavyoVjcrAi6SYoMzMOkeg4o9GKO5j5GC+ZRASEZ2MQtH2iQB+B4WrDokKZgQDn04CzSoRJr1QppvC1EgHc5Un2+e9kfWBzUl2M6vLtH5I4b341V3KkncXtpJWZhvQ8u++dlwC7pgDnge9OVYnjwUoD9V7ZT1d/SmlcWNzSneRnZhG1Uh29lwUUzas/YEhaw9ks9Hv93WE0PaRfXF9l0wCvZ23p1wTJdhyxrMw== X-MS-TrafficTypeDiagnostic: BYAPR03MB3717: X-Microsoft-Exchange-Diagnostics: 1;BYAPR03MB3717;31:PfTATKEi22J+SPDsPTi1WoAVxiR2TV9foYBJDmptr1UACdRDDI47PtoFT1ieaJl4KzqFPY6ACY9m5DOr09RnSt9swf1b3e0BHcC7TgCN+5aLBAGuWahLUVDekS+fsK2Or4EvU4em9+rKVNuLVBn+3ubN22nyqoY+XmamemfYYwiRthKDOq6Q7IGzt6BwOXt5vo8YvuPmTz1FDp+0ceRUW6UKgdnlO9hUp748pxZuoIY=;20:+Le7XTuxGnqicMWXTDqWM6Ny4Ff3Fi2NnGLNPZxDf86WnyMucOcWpzkFRU15B8J4fvAss+kAfaSEK1YMkYRYRQqgzy7RUoqADfsbVW5KggHIAkoDSHYAnDWtX7Z5GpEg1R6RiioVUZ9dHSht5FOlMrAccrOHrwfXcCGWvTnH60Mj8O+jY4qIDdisUOICDo0M/SG1DxMgF8KP7ikSJltOITfJAD2o/r6YQoF4j8PvqU6yQiGpaTDtDehzdF0O/H3BUHhduRw8QxX+c7ILZ4Rzeu/+hklWcdn2edRrbEHiL0lSjlyBAzVmMDXmiqKeIxnvlF0WLXS50CCAwh+mhwklCklCmWA2SacKMFzK4yY1MaQFRDRDSsedfw22uXEXCo9hv/qZ2xMocN/Cs6ecpTtsu0YlkZasXjfDq/q+uk56jK2wV/pTYyX8OUZfzglVXkVQ+Lu2TCin5izRlGC96dU3suEyhVqCeCjCimxDh/mP5VQaht9YCfcGUg8iDuDXzkCn X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(3231475)(944501520)(52105112)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:BYAPR03MB3717;BCL:0;PCL:0;RULEID:;SRVR:BYAPR03MB3717; X-Microsoft-Exchange-Diagnostics: 1;BYAPR03MB3717;4:rVikKa0yBtt+35q51kXcp5SPzViN+0Di1w2adZziMkxyzNUe/6Pez8vmcW6XuT1z6qUPLtuanolZ/yzo6ONUj+joNjC4QslgPZPsvFRZ79RenQosp5B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iEwxhV/Y03H2Vhq/EmeSO34Wg==;5:ZKhni+yNW1XuRLdtYOyMNt5eL6HJX6VHi+TE/IeXtsFNumoDzwXs1ustGGj24JUrEjOYZXLaGw7qGBuMgYOUkpPxmP157S6b58UjLvuLm2KGMAvxAiO5M06Yx+7vTW2j1eQWYmZxgXKSDFGodKEi80WKL+BwB3m6ZX4vRn9osNo=;7:xN3vPu1zbmtWmgZammUzL3pVqmgaOAHC9v6Xo8riyw5eyR6Q0R9cviurd29LtO6jyAs9NwclCSAJhN+j0irSJDzWbjGQJf1PtyKuQ6rh+UcvLoVrOHQak9xM7gL7cm9OVBWtd/MkoXY91fQuRTkSlw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:24:17.5788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55f42daa-0c36-445e-aace-08d6641a90ab 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3717 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 There is no point in having three menu entries that can be selected individually. Instead, the SPI and parallel interfaces should select AD7606. Signed-off-by: Stefan Popa --- drivers/staging/iio/adc/Kconfig | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index fc23059..302639a 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -4,35 +4,28 @@ menu "Analog to digital converters" config AD7606 - tristate "Analog Devices AD7606 ADC driver" - depends on GPIOLIB || COMPILE_TEST - depends on HAS_IOMEM + tristate select IIO_BUFFER select IIO_TRIGGERED_BUFFER - help - Say yes here to build support for Analog Devices: - ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). - - To compile this driver as a module, choose M here: the - module will be called ad7606. config AD7606_IFACE_PARALLEL - tristate "parallel interface support" - depends on AD7606 + tristate "Analog Devices AD7606 ADC driver with parallel interface support" + depends on HAS_IOMEM + select AD7606 help - Say yes here to include parallel interface support on the AD7606 - ADC driver. + Say yes here to build parallel interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). To compile this driver as a module, choose M here: the module will be called ad7606_parallel. config AD7606_IFACE_SPI - tristate "spi interface support" - depends on AD7606 + tristate "Analog Devices AD7606 ADC driver with spi interface support" depends on SPI + select AD7606 help - Say yes here to include parallel interface support on the AD7606 - ADC driver. + Say yes here to build spi interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). To compile this driver as a module, choose M here: the module will be called ad7606_spi. From patchwork Mon Dec 17 12:23:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733265 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 C4DE213B5 for ; Mon, 17 Dec 2018 12:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B1829CBB for ; Mon, 17 Dec 2018 12:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3CBF29D95; Mon, 17 Dec 2018 12:24:49 +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 57B0629CBB for ; Mon, 17 Dec 2018 12:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727356AbeLQMYr (ORCPT ); Mon, 17 Dec 2018 07:24:47 -0500 Received: from mail-eopbgr690040.outbound.protection.outlook.com ([40.107.69.40]:15264 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727068AbeLQMYr (ORCPT ); Mon, 17 Dec 2018 07:24:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fg/1+UU99U33g2Rr7bYb8mBQa9NmDrj5RvPVE6WHu8c=; b=P8sbdKyn6cCTXSY0zZJc2urUhyfTE5YSWAczJinYm/Hsocb5EbSCkq78uCD2tWofOuL5Kk2lvBy1MdGxs/fcPF1GmRaNS+deg9uboC6hyDs+DHXbmetCJNaDYi5/FSIFyrNtCU3PYFFLz++rcjLvORi6BUWtJRkdUPrnqxPIpCU= Received: from DM6PR03CA0017.namprd03.prod.outlook.com (2603:10b6:5:40::30) by DM6PR03MB3756.namprd03.prod.outlook.com (2603:10b6:5:50::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.18; Mon, 17 Dec 2018 12:24:43 +0000 Received: from BN1BFFO11FD014.protection.gbl (2a01:111:f400:7c10::1:173) by DM6PR03CA0017.outlook.office365.com (2603:10b6:5:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:24:43 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BN1BFFO11FD014.mail.protection.outlook.com (10.58.144.77) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:24:43 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCOg0a016454 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:24:42 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:24:42 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 2/6] staging: iio: adc: ad7606: Use SPDX identifier Date: Mon, 17 Dec 2018 14:23:36 +0200 Message-ID: <1545049420-16484-3-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(136003)(39860400002)(2980300002)(3190300001)(189003)(199004)(53416004)(356004)(6666004)(316002)(54906003)(110136005)(16586007)(106466001)(50466002)(50226002)(5660300001)(246002)(51416003)(7696005)(8676002)(575784001)(76176011)(4326008)(478600001)(126002)(116002)(476003)(2616005)(72206003)(486006)(8936002)(7636002)(47776003)(44832011)(336012)(426003)(7416002)(186003)(446003)(2906002)(36756003)(48376002)(11346002)(77096007)(26005)(106002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR03MB3756;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD014;1:Tum4ch4wq4hrejSPFDvaESSQrZ3LOgrO+h67wFr9kxqu+9RPZHEJMX9QH77d4QNjzenRWsJX4v9RNM88jLEm+y8slhQQ6w6oghbcXJ2jLj4nqyeJwLP7CSUX2+qo8aye X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84a8b62f-5b95-413e-1dc5-08d6641a9fca X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR03MB3756; X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3756;3:NDOugE1ewcwAhYshuPioDLWGByARIRdIS+X9LIUppO1w6kkw2/lshS9Znvn3hIAOEZ9NItx1DDXSBLIHIBNXYfzb1pAVDXrMASZki0CaWxOrh6T8jQtg6EuzMLjeix8n4/aU4p+Cs00kArj2emrau08wS6IBPv3ufgJGssmIFs3nx8zCS3Jy9+PJtmQfn0g6i4xsfrLK84g4i3UMXHLAbHE1UjvumfuyLYJ0QCpy1b383QTzV4F5sVBYDHXoDztPOPKOF0RTk63LxIglSCuPndTDFCZFnIVDq8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QDq6CBUVlY144ywYtw89DSD6JNZZ1k0YPsRnCYPCKZo0vywObbhpJ7eNr0akhKaQWHxKxTUEsv+0SWyjOxUb9euagm5MveSthcfeCX/o01HFPcetJ7PokO+QnKQ4bBm9EXP13lBLnPSXeCQfPR0KAT6vobmdrQH X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231475)(944501520)(52105112)(3002001)(93006095)(93004095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:DM6PR03MB3756;BCL:0;PCL:0;RULEID:;SRVR:DM6PR03MB3756; X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3756;4:R2NmiQKLgVKXgyz/FnJ4iF/7wnEcKGEOkYfDUGenrrd2J7ubF3K/bFP8x6xmZRjKOTmNvwGaOX+1DEWI7aftXAfNnh9FPSCuw9DDZMGvrNwKGEO7zSM780eBt59fyofb/M0kN+FBlqlmmwuXMklf1aBf9qXDlfg0Rh/kAlgRQ/+YOT9pv77hgxVdDHMPKzmvsMMseakx/hQEmps4S/YfGK8FDUj2XdVI5Q9Q0FPbSGoU9VVC4BWJSh6uMTH9Kez4RzQ9WBGMC7HNikjpHUNYrA== X-Forefront-PRVS: 08897B549D X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3756;23:KSVCbYO6A3HoCOxIcrAC1Gk8d9XGWJbQmVONyeI8BnQ4yi0wsdTuPhr3fGEyYir4HX22z+DrWFoty1n1uLvbcPwlNrDrd6E0O3RALjA+3zghmwlqQbqYKkWDPjdSEOBPgIgOmKG3RJhuTw/yOgkyAC/AQM63spnPiDlftd2TbpYLUHg2HMDxgadGVPYbGl6v/gVgOjVAWwBZ80zK24ecO1+vtcQQ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analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:24:43.0847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84a8b62f-5b95-413e-1dc5-08d6641a9fca 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB3756 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 patch replaces the license text at the top of ad7606 driver files and instead adds SPDX GPL-2.0 license identifier. Signed-off-by: Stefan Popa --- drivers/staging/iio/adc/ad7606.c | 5 ++--- drivers/staging/iio/adc/ad7606.h | 3 +-- drivers/staging/iio/adc/ad7606_par.c | 5 ++--- drivers/staging/iio/adc/ad7606_spi.c | 5 ++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c index e1d85b7..97b4a83 100644 --- a/drivers/staging/iio/adc/ad7606.c +++ b/drivers/staging/iio/adc/ad7606.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AD7606 SPI ADC driver * * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. */ #include @@ -531,4 +530,4 @@ EXPORT_SYMBOL_GPL(ad7606_pm_ops); MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h index 510a93d..3e12fff 100644 --- a/drivers/staging/iio/adc/ad7606.h +++ b/drivers/staging/iio/adc/ad7606.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * AD7606 ADC driver * * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. */ #ifndef IIO_ADC_AD7606_H_ diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c index da26742..2d137b1 100644 --- a/drivers/staging/iio/adc/ad7606_par.c +++ b/drivers/staging/iio/adc/ad7606_par.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AD7606 Parallel Interface ADC driver * * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. */ #include @@ -114,4 +113,4 @@ module_platform_driver(ad7606_driver); MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index e533917..f38f0d6 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * AD7606 SPI ADC driver * * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. */ #include @@ -80,4 +79,4 @@ module_spi_driver(ad7606_driver); MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL"); From patchwork Mon Dec 17 12:23:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733267 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 36B1E13AD for ; Mon, 17 Dec 2018 12:25:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 265C229CBB for ; Mon, 17 Dec 2018 12:25:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A1E829D76; Mon, 17 Dec 2018 12:25:15 +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 4B2F029CBB for ; Mon, 17 Dec 2018 12:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726981AbeLQMZI (ORCPT ); Mon, 17 Dec 2018 07:25:08 -0500 Received: from mail-eopbgr810040.outbound.protection.outlook.com ([40.107.81.40]:33440 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726938AbeLQMZH (ORCPT ); Mon, 17 Dec 2018 07:25:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zTKwXQ5CLNBCPOn2zNXVn6JSO3H/Q35XSt7Wj/6E3/o=; b=t69Cn9oCuXItWQ/I2k9aJqDIBXqE5nn3YUKCiCuxTAwyJ4QiZNPeV9Gw95m5vm/Wt3J6EpDvFbkm3tAB8Fn7uoN/ZCNFPsBuXeJ5PzqQDpkAV8aYMLkH0z3EfhQ+v74LzOZk0z9YWhMGeFII16xX3lerhMrY/akHLIkBZWMcVDk= Received: from DM6PR03CA0015.namprd03.prod.outlook.com (2603:10b6:5:40::28) by SN6PR03MB3517.namprd03.prod.outlook.com (2603:10b6:805:41::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Mon, 17 Dec 2018 12:25:03 +0000 Received: from BN1AFFO11FD006.protection.gbl (2a01:111:f400:7c10::126) by DM6PR03CA0015.outlook.office365.com (2603:10b6:5:40::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:25:03 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BN1AFFO11FD006.mail.protection.outlook.com (10.58.52.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:25:03 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCP2EV016567 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:25:02 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:25:02 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 3/6] staging: iio: adc: ad7606: Add support for threaded irq Date: Mon, 17 Dec 2018 14:23:37 +0200 Message-ID: <1545049420-16484-4-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(3190300001)(189003)(199004)(8936002)(54906003)(110136005)(72206003)(47776003)(478600001)(14444005)(48376002)(186003)(6666004)(356004)(106466001)(5660300001)(305945005)(7696005)(51416003)(7636002)(36756003)(50466002)(2616005)(53416004)(446003)(7416002)(2906002)(336012)(44832011)(16586007)(76176011)(11346002)(4326008)(426003)(26005)(8676002)(246002)(126002)(476003)(77096007)(316002)(50226002)(116002)(486006)(106002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR03MB3517;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD006;1:Q8YyPguWkgo48IJnXHOVktMmWCAwkqHwZ+1xoV3IkQ8hW2d//VYrnVIYt860EydVn7kdlC95B4ApwiHFP3LK61Mkv5y/cRRFFWVyT7Ko5mHJToauhA3V4Ir/jxiOu32r X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7853e3ce-0fbc-41f8-31ff-08d6641aabb4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:SN6PR03MB3517; X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3517;3:Y1+EHuEV3OgPPN7YujmthcElbRwYMvSYVgQpnKKLCn0U5g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NYMDtG9T9jr+5aCSQSxu9fH1KlshdSJYfQtuQHsrlEAg5JHWHkXXCvFnwdWnrYV2W0MBn1zJFNuKiuTUSaikGYa2+PfFfcfzMNMYlvi3Zz+/rOhfotHe9wLK5aAFORyBfle0rlGxywmEPs1WRkXgitQTBRt2abY2y54uUCifF9jgs3itYUO9vuwTxbsIES93ZAmy1pqeuo++My6ghNgo5m1KUWTUiNdYsQie+Zu8TNqsnEoBaDBRbuYTjkNg7A9+ED43CMneFN3xBbWqw8wbDqFleNpYJQAVpzmNepcPvr67oYWTzDOLD2lMgKEodXUyT8Kr8QgrGDssVRhy1dhnJ/j+QwVkzusg+6UNGpJzKn3/veK4xl+cFezm1C0hUUsUqR0KM9vQldmWAMzS8EG9z+nDOiI5OpN87rZWNWZb X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93004095)(3002001)(3231475)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:SN6PR03MB3517;BCL:0;PCL:0;RULEID:;SRVR:SN6PR03MB3517; X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3517;4:wZJjQR9U+LH+ZALGjTE+kKCnadJ+fnRQ9sRcdladujA6BZjhcHYeBiC0JgW39VHtLlMHQ+Jk1ru4h1EBK1rkNhyu1ZTGpdebSJ+JBUq+OBKdOyb/KLzyjKb2wLON4kqpjblpkm7qg8BJe7dNirP2CAu7/bxjS58IvPvbh0pVOGsrDGpmDnFL4hEDcK5qSQmm97S/VSH/b1Lf0+b1PyUp1ZVd3LgVv2v09VzCWXVOR9g6qhIpbRqiILxH2QWBUpXb+NfpaViEGz+XdhR2M9iC5g== X-Forefront-PRVS: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HD9WrcLHUsj41v2C/FoysalXpWmBeySTR1t0pw5N53InBuTxIH+Q=;7:MLNgZUh/bqOaZ8JqvQ/PRyLHyNvLijtffIhryte/W+73yPZytV/SQyCnSfh9uieqbOlw1GX+gqqAAcW3cSPh37RzJnCmIveOtM7QhN5Cx9IQl63PN3AtYrRYEZxut1eZi7Ix2AfGH3cTHXZE4SVBkg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:25:03.1050 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7853e3ce-0fbc-41f8-31ff-08d6641aabb4 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3517 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 patch replaces the use of a polling ring buffer with a threaded interrupt. Enabling the buffer sets the CONVST signal to high. When the rising edge of the CONVST is applied, BUSY signal goes logic high and transitions low at the end of the entire conversion process. The falling edge of the BUSY signal triggers the interrupt. ad7606_trigger_handler() is used as bottom half of the poll function. It reads data from the device and stores it in the internal buffer. Signed-off-by: Stefan Popa --- drivers/staging/iio/adc/ad7606.c | 111 +++++++++++++++++++++++++++++---------- drivers/staging/iio/adc/ad7606.h | 6 +-- 2 files changed, 84 insertions(+), 33 deletions(-) diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c index 97b4a83..5f0712c 100644 --- a/drivers/staging/iio/adc/ad7606.c +++ b/drivers/staging/iio/adc/ad7606.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "ad7606.h" @@ -86,36 +87,24 @@ static int ad7606_read_samples(struct ad7606_state *st) static irqreturn_t ad7606_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; - struct ad7606_state *st = iio_priv(pf->indio_dev); - - gpiod_set_value(st->gpio_convst, 1); - - return IRQ_HANDLED; -} - -/** - * ad7606_poll_bh_to_ring() bh of trigger launched polling to ring buffer - * @work_s: the work struct through which this was scheduled - * - * Currently there is no option in this driver to disable the saving of - * timestamps within the ring. - * I think the one copy of this at a time was to avoid problems if the - * trigger was set far too high and the reads then locked up the computer. - **/ -static void ad7606_poll_bh_to_ring(struct work_struct *work_s) -{ - struct ad7606_state *st = container_of(work_s, struct ad7606_state, - poll_work); - struct iio_dev *indio_dev = iio_priv_to_dev(st); + struct iio_dev *indio_dev = pf->indio_dev; + struct ad7606_state *st = iio_priv(indio_dev); int ret; + mutex_lock(&st->lock); + ret = ad7606_read_samples(st); if (ret == 0) iio_push_to_buffers_with_timestamp(indio_dev, st->data, iio_get_time_ns(indio_dev)); - gpiod_set_value(st->gpio_convst, 0); iio_trigger_notify_done(indio_dev->trig); + /* The rising edge of the CONVST signal starts a new conversion. */ + gpiod_set_value(st->gpio_convst, 1); + + mutex_unlock(&st->lock); + + return IRQ_HANDLED; } static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch) @@ -366,8 +355,11 @@ static int ad7606_request_gpios(struct ad7606_state *st) return PTR_ERR_OR_ZERO(st->gpio_os); } -/** - * Interrupt handler +/* + * The BUSY signal indicates when conversions are in progress, so when a rising + * edge of CONVST is applied, BUSY goes logic high and transitions low at the + * end of the entire conversion process. The falling edge of the BUSY signal + * triggers this interrupt. */ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) { @@ -375,7 +367,8 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) struct ad7606_state *st = iio_priv(indio_dev); if (iio_buffer_enabled(indio_dev)) { - schedule_work(&st->poll_work); + gpiod_set_value(st->gpio_convst, 0); + iio_trigger_poll_chained(st->trig); } else { complete(&st->completion); } @@ -383,26 +376,69 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) return IRQ_HANDLED; }; +static int ad7606_validate_trigger(struct iio_dev *indio_dev, + struct iio_trigger *trig) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + if (st->trig != trig) + return -EINVAL; + + return 0; +} + +static int ad7606_buffer_postenable(struct iio_dev *indio_dev) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + iio_triggered_buffer_postenable(indio_dev); + gpiod_set_value(st->gpio_convst, 1); + + return 0; +} + +static int ad7606_buffer_predisable(struct iio_dev *indio_dev) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + gpiod_set_value(st->gpio_convst, 0); + + return iio_triggered_buffer_predisable(indio_dev); +} + +static const struct iio_buffer_setup_ops ad7606_buffer_ops = { + .postenable = &ad7606_buffer_postenable, + .predisable = &ad7606_buffer_predisable, +}; + static const struct iio_info ad7606_info_no_os_or_range = { .read_raw = &ad7606_read_raw, + .validate_trigger = &ad7606_validate_trigger, }; static const struct iio_info ad7606_info_os_and_range = { .read_raw = &ad7606_read_raw, .write_raw = &ad7606_write_raw, .attrs = &ad7606_attribute_group_os_and_range, + .validate_trigger = &ad7606_validate_trigger, }; static const struct iio_info ad7606_info_os = { .read_raw = &ad7606_read_raw, .write_raw = &ad7606_write_raw, .attrs = &ad7606_attribute_group_os, + .validate_trigger = &ad7606_validate_trigger, }; static const struct iio_info ad7606_info_range = { .read_raw = &ad7606_read_raw, .write_raw = &ad7606_write_raw, .attrs = &ad7606_attribute_group_range, + .validate_trigger = &ad7606_validate_trigger, +}; + +static const struct iio_trigger_ops ad7606_trigger_ops = { + .validate_device = iio_trigger_validate_own_device, }; static void ad7606_regulator_disable(void *data) @@ -434,7 +470,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, /* tied to logic low, analog input range is +/- 5V */ st->range = 0; st->oversampling = 1; - INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring); st->reg = devm_regulator_get(dev, "avcc"); if (IS_ERR(st->reg)) @@ -479,14 +514,32 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, if (ret) dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n"); - ret = devm_request_irq(dev, irq, ad7606_interrupt, IRQF_TRIGGER_FALLING, - name, indio_dev); + st->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", + indio_dev->name, indio_dev->id); + if (!st->trig) + return -ENOMEM; + + st->trig->ops = &ad7606_trigger_ops; + st->trig->dev.parent = dev; + iio_trigger_set_drvdata(st->trig, indio_dev); + ret = devm_iio_trigger_register(dev, st->trig); + if (ret) + return ret; + + indio_dev->trig = iio_trigger_get(st->trig); + + ret = devm_request_threaded_irq(dev, irq, + NULL, + &ad7606_interrupt, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + name, indio_dev); if (ret) return ret; ret = devm_iio_triggered_buffer_setup(dev, indio_dev, + &iio_pollfunc_store_time, &ad7606_trigger_handler, - NULL, NULL); + &ad7606_buffer_ops); if (ret) return ret; diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h index 3e12fff..9a832d2 100644 --- a/drivers/staging/iio/adc/ad7606.h +++ b/drivers/staging/iio/adc/ad7606.h @@ -26,8 +26,6 @@ struct ad7606_chip_info { * @dev pointer to kernel device * @chip_info entry in the table of chips that describes this device * @reg regulator info for the the power supply of the device - * @poll_work work struct for continuously reading data from the device - * into an IIO triggered buffer * @bops bus operations (SPI or parallel) * @range voltage range selection, selects which scale to apply * @oversampling oversampling selection @@ -42,14 +40,13 @@ struct ad7606_chip_info { * is being read on the first channel * @gpio_os GPIO descriptors to control oversampling on the device * @complete completion to indicate end of conversion + * @trig The IIO trigger associated with the device. * @data buffer for reading data from the device */ - struct ad7606_state { struct device *dev; const struct ad7606_chip_info *chip_info; struct regulator *reg; - struct work_struct poll_work; const struct ad7606_bus_ops *bops; unsigned int range; unsigned int oversampling; @@ -62,6 +59,7 @@ struct ad7606_state { struct gpio_desc *gpio_standby; struct gpio_desc *gpio_frstdata; struct gpio_descs *gpio_os; + struct iio_trigger *trig; struct completion completion; /* From patchwork Mon Dec 17 12:23:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733269 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 3153E13B5 for ; Mon, 17 Dec 2018 12:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20DCB29D76 for ; Mon, 17 Dec 2018 12:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14CE029D96; Mon, 17 Dec 2018 12:25:39 +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 6CEF729D76 for ; Mon, 17 Dec 2018 12:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731680AbeLQMZi (ORCPT ); Mon, 17 Dec 2018 07:25:38 -0500 Received: from mail-eopbgr810071.outbound.protection.outlook.com ([40.107.81.71]:51424 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726938AbeLQMZh (ORCPT ); Mon, 17 Dec 2018 07:25:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DdRQfoIDXiInfjwnXJJa5Ls0fzDkePleJuZBaXEQuZc=; b=FejgNDiFa+Ar54z6YY2okqm/lNHRUlbdZnO3p6/pYXhJKs+zwoY4QbYB2f1ML4te90amMH0hU+qrgGKucDnYIJLVScVD0CQcFGXMCuVphv/lw8yfrxYPjtbynGt42zEQyh7PMe2nULdvOCoPwnCbbADCDerfBtJk2nH+K8DB2n8= Received: from BN3PR03CA0111.namprd03.prod.outlook.com (2603:10b6:400:4::29) by SN6PR03MB3727.namprd03.prod.outlook.com (2603:10b6:805:43::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.20; Mon, 17 Dec 2018 12:25:30 +0000 Received: from BY2FFO11FD028.protection.gbl (2a01:111:f400:7c0c::109) by BN3PR03CA0111.outlook.office365.com (2603:10b6:400:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:25:30 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BY2FFO11FD028.mail.protection.outlook.com (10.1.15.217) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:25:29 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCPSef016650 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:25:28 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:25:28 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 4/6] staging: iio: adc: ad7606: Misc style fixes (no functional change) Date: Mon, 17 Dec 2018 14:23:38 +0200 Message-ID: <1545049420-16484-5-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(39860400002)(396003)(136003)(2980300002)(3190300001)(199004)(189003)(575784001)(4326008)(53416004)(110136005)(16586007)(6666004)(356004)(106002)(54906003)(48376002)(50466002)(426003)(316002)(336012)(7636002)(77096007)(26005)(246002)(76176011)(47776003)(51416003)(7696005)(106466001)(36756003)(8936002)(186003)(8676002)(2906002)(50226002)(2616005)(5660300001)(476003)(116002)(126002)(7416002)(72206003)(11346002)(14444005)(486006)(446003)(305945005)(478600001)(44832011);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR03MB3727;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD028;1:E4lmmK8HsT2MRFsnFsIsMOx1PWk/uNAogMwKOx6fFlMQIMdEWlxk/uye4cobp0vHzrHqHMxuYIKhF5f3VzdytUH3eEdOIkGgxSWd5lXYTItG3l8rPKFU0NnxkDfDuo58 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6917a64d-c467-4a7f-b771-08d6641abb95 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR03MB3727; X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3727;3:p1AyKxIPXZ3mmO+cMcw9a8i4aKzJBwEQoxdSUTYYx33O5VYIvvSycPeUqDKQ9rUyqjKTt5oHtMRoc3iMtilPqpipAqCtsx43LUb9TiBXVnbP0QCy4iQtqnKlj2ZjjfJmsAimfnb5LvBCIcg5VKPWhPur7/+Gr2feEw88EW0jpQK1OUnkbdijqFe0yG+DGSeQR0ArUNZZI+Za1OsjSQyZPLoE+VcrW3v+c3g+hI3DLZYZy2DEQHswlYT4v7zuhFOPTIKFwTDT7mofSOv/6aWVngTIieIuRsI1nxUUy0a3C4CKoJnIfIbSyn2fXMextAQ9ErLWQg+APqCnJYkAm8S1bQJnFFrQ/FFAHzjpD7VEQ8c=;25:DhxMGy/9wwaqWUHB8C9anqaQaV3Q68aueecV+czNSmgG1PQXmcQClvm9pZ8BTohbsT7WMkHgJmH7hYsxZyBgD6tZAHxQ0SvLqliPpKwilPEkLciqAOwoBCfzBXxQv2Z9a1JeNP+VD5UY/zytnC5JKHYVrBQYKbUhs6t7RvkUZMQlnGixdsC3kRhsEwKBO/n7zYUAgHDiZ3DyV6Wd6eYkXDCuET4UiL7oj2Z6FdaW0bMf4gQq/pD9GNktnZDMMS1LTaoIsoNn7vo7QqajcOjI8H8lirTyEhXlxn345psmpr/7VddelJ/rEuFKRLkixNpE0hfmAudc6rZGsgIDT6ViEg== X-MS-TrafficTypeDiagnostic: SN6PR03MB3727: X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3727;31:ddQ1Zp3v0fcp0KG7qq4IpuqtJzgW2+UujWmAEdQZ2+w/XJ5qEpdAy+t95EoR2HFFvnTBZcUA7IIK3OlmX/d4OvTe525QwDyryDruyPRr6VgjIuIxwU1zIWJfWSJW8ynufzwidXlhIEgnT3ey3qqXya5Q/aS+XrbYBIUwunIxrZzcrl93psDsKFmMXGQK7gkCl9zb+qUrnz81sijJ1FLkWnEEMA4i27xrFe7O65/kxbY=;20:cnWeusOcphZhaxUcJzpGyPYrQH48o9bilG6E/2GYZ73bIUP1xzIhwoZRONOEu+DfzqgkzCdG8cvZR5O9pWj6/CxOK9Hud6IiSojsVK4U+0sloFD8rLcmUF524hWKTnHV9R22JNo+/rHzkLWqPxf+DB/7yZIPHZTEWghLpE3STDOYLsM6aA9lOvQY2ih6uDu1AWZEcjaj/yfcZq0aVsly4H3KvIg/qKayq5a6pB51h2CORRyusBcryue1iLa9G5EMYBbsKPADsrpE0TVW3qcl/t6ooY880xnRqvV68ERhB5kJ06vOLTmrNg+kqx2At867KbDELCNmFL5cj1z4fT/+ZRv5OXCSd7Wqzparj1yfm4QZhkbvBiErHNGBcvJBbXjUq8LyOEblnpCMxTE5tiwGuzGqtvgx7TUA7iGCSCH77DaRLzIJxV/pUXc59yyKJcRaqlKWcx8Nlq7q9FFJ4qZXw6aMVX7VZAkPHzQ4peqnvtClqLahVCQ2762+iNJmkiZA X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(3002001)(3231475)(944501520)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:SN6PR03MB3727;BCL:0;PCL:0;RULEID:;SRVR:SN6PR03MB3727; X-Microsoft-Exchange-Diagn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ARR0YLkkNE5JwvKm4yBeB8wNXeVn8gSEi68d5qNvOogMyRC8/xchTSRplmZnh0FG9C2BtJcFz+rXKsh7qPr47yEtUt9cVJ1dNX7axduG2S2+hmLXZQLHt/1/VIpJ7l5sYjDLSoKoKZXb9CnSjxqtmvx6x0kKlsnB/tNiD+9/Fp+DNJKKNEg+zzVMARmJ4cj9frAydsD0Rn/NezlCOK4g==;5:15IbjKAGbk/JacbnSJCdqcH5DUvnQjOXOy6C8gp4r++MtiuV/3q72FpraB+1QBJNAfNqVl/9tamLYh+lX4TGqEvnRpqfnekrh3RCoFml3TKBFz0a07tcVnltc5EEl4S4NlLfWGMK37n3CLeHbMm19N412Z+oScNFJeiWqOJf0+o=;7:tftlBZvOMx1yGG2Fhl4KCUnlEX+MDgGw8VpmPL7/nqu2PqDC7iEb1Q6T0gF1F8K/g388wOpp5jG3BbTwZq9o1BYn7lXKKNtFbDm18N0MN7lcaeUerzivhXocbBzjokQRSTOaCXRPssuLPxlm44PnRA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:25:29.5768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6917a64d-c467-4a7f-b771-08d6641abb95 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3727 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 * Placed includes in alphabetical order * Added brackets around num and mask through out for AD760X_CHANNEL * Used single line comments where needed * Removed extra lines and spaces Signed-off-by: Stefan Popa --- drivers/staging/iio/adc/ad7606.c | 27 ++++++++++++--------------- drivers/staging/iio/adc/ad7606.h | 1 - drivers/staging/iio/adc/ad7606_par.c | 27 ++++++++------------------- drivers/staging/iio/adc/ad7606_spi.c | 16 ++++++++-------- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c index 5f0712c..32854f1 100644 --- a/drivers/staging/iio/adc/ad7606.c +++ b/drivers/staging/iio/adc/ad7606.c @@ -5,25 +5,25 @@ * Copyright 2011 Analog Devices Inc. */ -#include +#include #include -#include -#include -#include -#include #include #include -#include -#include +#include +#include #include +#include +#include +#include +#include #include #include -#include #include -#include +#include #include #include +#include #include "ad7606.h" @@ -249,8 +249,7 @@ static const struct attribute_group ad7606_attribute_group_range = { .attrs = ad7606_attributes_range, }; -#define AD760X_CHANNEL(num, mask) \ - { \ +#define AD760X_CHANNEL(num, mask) { \ .type = IIO_VOLTAGE, \ .indexed = 1, \ .channel = num, \ @@ -265,7 +264,7 @@ static const struct attribute_group ad7606_attribute_group_range = { .storagebits = 16, \ .endianness = IIO_CPU, \ }, \ - } +} #define AD7605_CHANNEL(num) \ AD760X_CHANNEL(num, 0) @@ -294,9 +293,7 @@ static const struct iio_chan_spec ad7606_channels[] = { }; static const struct ad7606_chip_info ad7606_chip_info_tbl[] = { - /* - * More devices added in future - */ + /* More devices added in future */ [ID_AD7605_4] = { .channels = ad7605_channels, .num_channels = 5, diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h index 9a832d2..5d12410 100644 --- a/drivers/staging/iio/adc/ad7606.h +++ b/drivers/staging/iio/adc/ad7606.h @@ -14,7 +14,6 @@ * @num_channels: number of channels * @has_oversampling: whether the device has oversampling support */ - struct ad7606_chip_info { const struct iio_chan_spec *channels; unsigned int num_channels; diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c index 2d137b1..df607c7 100644 --- a/drivers/staging/iio/adc/ad7606_par.c +++ b/drivers/staging/iio/adc/ad7606_par.c @@ -26,7 +26,7 @@ static int ad7606_par16_read_block(struct device *dev, } static const struct ad7606_bus_ops ad7606_par16_bops = { - .read_block = ad7606_par16_read_block, + .read_block = ad7606_par16_read_block, }; static int ad7606_par8_read_block(struct device *dev, @@ -41,7 +41,7 @@ static int ad7606_par8_read_block(struct device *dev, } static const struct ad7606_bus_ops ad7606_par8_bops = { - .read_block = ad7606_par8_read_block, + .read_block = ad7606_par8_read_block, }; static int ad7606_par_probe(struct platform_device *pdev) @@ -72,22 +72,12 @@ static int ad7606_par_probe(struct platform_device *pdev) } static const struct platform_device_id ad7606_driver_ids[] = { - { - .name = "ad7605-4", - .driver_data = ID_AD7605_4, - }, { - .name = "ad7606-8", - .driver_data = ID_AD7606_8, - }, { - .name = "ad7606-6", - .driver_data = ID_AD7606_6, - }, { - .name = "ad7606-4", - .driver_data = ID_AD7606_4, - }, + { .name = "ad7605-4", .driver_data = ID_AD7605_4, }, + { .name = "ad7606-4", .driver_data = ID_AD7606_4, }, + { .name = "ad7606-6", .driver_data = ID_AD7606_6, }, + { .name = "ad7606-8", .driver_data = ID_AD7606_8, }, { } }; - MODULE_DEVICE_TABLE(platform, ad7606_driver_ids); static const struct of_device_id ad7606_of_match[] = { @@ -103,12 +93,11 @@ static struct platform_driver ad7606_driver = { .probe = ad7606_par_probe, .id_table = ad7606_driver_ids, .driver = { - .name = "ad7606", - .pm = AD7606_PM_OPS, + .name = "ad7606", + .pm = AD7606_PM_OPS, .of_match_table = ad7606_of_match, }, }; - module_platform_driver(ad7606_driver); MODULE_AUTHOR("Michael Hennerich "); diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index f38f0d6..f842eba 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c @@ -36,7 +36,7 @@ static int ad7606_spi_read_block(struct device *dev, } static const struct ad7606_bus_ops ad7606_spi_bops = { - .read_block = ad7606_spi_read_block, + .read_block = ad7606_spi_read_block, }; static int ad7606_spi_probe(struct spi_device *spi) @@ -48,14 +48,14 @@ static int ad7606_spi_probe(struct spi_device *spi) &ad7606_spi_bops); } -static const struct spi_device_id ad7606_id[] = { - {"ad7605-4", ID_AD7605_4}, - {"ad7606-8", ID_AD7606_8}, - {"ad7606-6", ID_AD7606_6}, - {"ad7606-4", ID_AD7606_4}, +static const struct spi_device_id ad7606_id_table[] = { + { "ad7605-4", ID_AD7605_4 }, + { "ad7606-4", ID_AD7606_4 }, + { "ad7606-6", ID_AD7606_6 }, + { "ad7606-8", ID_AD7606_8 }, {} }; -MODULE_DEVICE_TABLE(spi, ad7606_id); +MODULE_DEVICE_TABLE(spi, ad7606_id_table); static const struct of_device_id ad7606_of_match[] = { { .compatible = "adi,ad7605-4" }, @@ -73,7 +73,7 @@ static struct spi_driver ad7606_driver = { .pm = AD7606_PM_OPS, }, .probe = ad7606_spi_probe, - .id_table = ad7606_id, + .id_table = ad7606_id_table, }; module_spi_driver(ad7606_driver); From patchwork Mon Dec 17 12:23:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733283 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 7477B13AD for ; Mon, 17 Dec 2018 12:27:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6078329D76 for ; Mon, 17 Dec 2018 12:27:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53DBF29D96; Mon, 17 Dec 2018 12:27:50 +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 8D39C29D95 for ; Mon, 17 Dec 2018 12:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbeLQM1q (ORCPT ); Mon, 17 Dec 2018 07:27:46 -0500 Received: from mail-eopbgr740055.outbound.protection.outlook.com ([40.107.74.55]:18762 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726938AbeLQM1q (ORCPT ); Mon, 17 Dec 2018 07:27:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5J2euVfYvogJ9rk2LM3EysI3aCz0xMeP+G0wAOlD1No=; b=EFIt14RUFrp4HIpXpp0XA5vvWTmWbSoxn1zeUN57tSRZw2Uis1SLfCENR9XQVIQXIcVnVe3soY4h5+HXUAR8XXDUmkmgkXg33+oChposm3mS3rxnEZ9gfiHzXL/d1M26y7cDZt3h6fqkmtnzy3e2A/Q//1xkIVPqwWrCyMC3GQU= Received: from MWHPR03CA0045.namprd03.prod.outlook.com (2603:10b6:301:3b::34) by DM6PR03MB3721.namprd03.prod.outlook.com (2603:10b6:5:ac::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.18; Mon, 17 Dec 2018 12:26:26 +0000 Received: from BN1BFFO11FD026.protection.gbl (2a01:111:f400:7c10::1:194) by MWHPR03CA0045.outlook.office365.com (2603:10b6:301:3b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:26:26 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:26:25 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCQPdj016802 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:26:25 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:26:24 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 5/6] staging: iio: adc: ad7606: Move out of staging Date: Mon, 17 Dec 2018 14:23:39 +0200 Message-ID: <1545049420-16484-6-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(39860400002)(346002)(376002)(136003)(2980300002)(3190300001)(199004)(189003)(246002)(126002)(11346002)(446003)(36756003)(116002)(2906002)(486006)(48376002)(44832011)(2616005)(51416003)(26005)(14444005)(106466001)(476003)(336012)(7696005)(426003)(186003)(50466002)(72206003)(5660300001)(966005)(6666004)(7416002)(53416004)(50226002)(77096007)(53946003)(356004)(8936002)(4744004)(6306002)(478600001)(305945005)(47776003)(16586007)(54906003)(110136005)(106002)(4326008)(7636002)(8676002)(316002)(76176011)(579004)(559001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR03MB3721;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD026;1:CHA7zVNdGUeo2Y7jpkb+KL4sAK3CuZ/7lxbrjQux/LqdhfGaid+s+8tfrJWAkNkwilpwciQMcRKIjeFumnotKkMWGH+/ist7ielRTtrh2T45ObnnOyvK5z81OUODC6Ww X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 17756b6d-3e0d-4118-4005-08d6641add14 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR03MB3721; X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3721;3:nGKMkgAsMO4fC19ER3Kf4iMIuuzeoo7+CkmoL/XbAARs5NFNQDMFGHn9V2Hg4QqvLVUOrYpGi9F0miv3tjXuGpGqDUDj6qIuTc/VjNy/jyP7pFRSGUjaKooCcEPYNNAxo3XU8k42M3OjDlOi43Kqd8iyoC7OXvb73drrzZjlx47dVr8AgieK7agJxQiOrKdnifrQbW+3wqKw8AMrxE+yB9jMSECljt5u8KDSpirTVGCNNORbp9kTp63KG3C6MkSeIsCsxTCCcXJXEeu/Q966jdpmRmILawx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SENPZHpxP0sm7BI5OLxJanQni1nxOoJ09oKW0KvQasUKSH8vwUT3XAyqDph+8HtgcgIxyeNpaH7aJDw5aLsicwnl2PRCB8Duz6+F6NOMUSK2iWlUOfpEtArO8jeUdEI5YLop21mvXAtOfLAgTrFFAud3C6cpE5GxpZQ17/Tfqsxxw3N//bLbwf X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231475)(944501520)(4982022)(52105112)(3002001)(93006095)(93004095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:DM6PR03MB3721;BCL:0;PCL:0;RULEID:;SRVR:DM6PR03MB3721; X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3721;4:onQReeQgulUWOjOmn2GDHAtI6htGGjxlNyoeEtaQ1hReVTF6b4/CJ5cqCF6YB0cwWvnkTB6oNnJ1rxYUp+pUzqBz3yob96QYYLg2UTNb9Ktv8UmS7vhm4kFOUnWpLXHgdhPDRW1RjLKjG4X1t67XJsCu1hnkUQ3E0OSzX8GQuF7uRBFNICOybYeEOjkNUIeTbR15xDMqKVaAoIOTKnqQ3LJmLHeQtb8TKAw3tcZWjKJ1rYDcPdv+doDERp/xD+NoEJ0MkOGPzK94XYxlzuBDhg== X-Forefront-PRVS: 08897B549D X-Microsoft-Exchange-Diagnostics: 1;DM6PR03MB3721;23:+9fEagdtMwfmT2Nccqm6Jaqr9Ko77C6jx0LnDvmOjX0jiFy3trjmPJeFnCmU6awa4JH7w3nDG4A5wxk3H/Ezabhk6Dwpz+qSmpP3hv52z577nm3r7CeVgVvTTFJONAvs/PTUorIezs1ioEoXuN8NSvrQ/uI9o0yhKxbjTXUKq+KH1Z+55yXnhOfQ9nx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blAdETPRh3UnFX/PL0U6b+T3fd7fmhn8AgzkXOtGCTegX4vwvQHg5OSchZI+Q== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:26:25.9273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17756b6d-3e0d-4118-4005-08d6641add14 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB3721 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 Move ad7606 ADC driver out of staging and into the mainline. Signed-off-by: Stefan Popa --- MAINTAINERS | 7 + drivers/iio/adc/Kconfig | 27 ++ drivers/iio/adc/Makefile | 3 + drivers/iio/adc/ad7606.c | 583 +++++++++++++++++++++++++++++++++++ drivers/iio/adc/ad7606.h | 99 ++++++ drivers/iio/adc/ad7606_par.c | 105 +++++++ drivers/iio/adc/ad7606_spi.c | 82 +++++ drivers/staging/iio/adc/Kconfig | 27 -- drivers/staging/iio/adc/Makefile | 4 - drivers/staging/iio/adc/ad7606.c | 583 ----------------------------------- drivers/staging/iio/adc/ad7606.h | 99 ------ drivers/staging/iio/adc/ad7606_par.c | 105 ------- drivers/staging/iio/adc/ad7606_spi.c | 82 ----- 13 files changed, 906 insertions(+), 900 deletions(-) create mode 100644 drivers/iio/adc/ad7606.c create mode 100644 drivers/iio/adc/ad7606.h create mode 100644 drivers/iio/adc/ad7606_par.c create mode 100644 drivers/iio/adc/ad7606_spi.c delete mode 100644 drivers/staging/iio/adc/ad7606.c delete mode 100644 drivers/staging/iio/adc/ad7606.h delete mode 100644 drivers/staging/iio/adc/ad7606_par.c delete mode 100644 drivers/staging/iio/adc/ad7606_spi.c diff --git a/MAINTAINERS b/MAINTAINERS index db9fcf2..bc9f816 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -854,6 +854,13 @@ S: Supported F: drivers/iio/adc/ad7124.c F: Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt +ANALOG DEVICES INC AD7606 DRIVER +M: Stefan Popa +L: linux-iio@vger.kernel.org +W: http://ez.analog.com/community/linux-device-drivers +S: Supported +F: drivers/iio/adc/ad7606.c + ANALOG DEVICES INC AD9389B DRIVER M: Hans Verkuil L: linux-media@vger.kernel.org diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7a3ca4e..f3cc7a3 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -69,6 +69,33 @@ config AD7476 To compile this driver as a module, choose M here: the module will be called ad7476. +config AD7606 + tristate + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + +config AD7606_IFACE_PARALLEL + tristate "Analog Devices AD7606 ADC driver with parallel interface support" + depends on HAS_IOMEM + select AD7606 + help + Say yes here to build parallel interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the + module will be called ad7606_parallel. + +config AD7606_IFACE_SPI + tristate "Analog Devices AD7606 ADC driver with spi interface support" + depends on SPI + select AD7606 + help + Say yes here to build spi interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the + module will be called ad7606_spi. + config AD7766 tristate "Analog Devices AD7766/AD7767 ADC driver" depends on SPI_MASTER diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 07df37f..ea50313 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -11,6 +11,9 @@ obj-$(CONFIG_AD7291) += ad7291.o obj-$(CONFIG_AD7298) += ad7298.o obj-$(CONFIG_AD7923) += ad7923.o obj-$(CONFIG_AD7476) += ad7476.o +obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o +obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o +obj-$(CONFIG_AD7606) += ad7606.o obj-$(CONFIG_AD7766) += ad7766.o obj-$(CONFIG_AD7791) += ad7791.o obj-$(CONFIG_AD7793) += ad7793.o diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c new file mode 100644 index 0000000..32854f1 --- /dev/null +++ b/drivers/iio/adc/ad7606.c @@ -0,0 +1,583 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AD7606 SPI ADC driver + * + * Copyright 2011 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ad7606.h" + +/* + * Scales are computed as 5000/32768 and 10000/32768 respectively, + * so that when applied to the raw values they provide mV values + */ +static const unsigned int scale_avail[2] = { + 152588, 305176 +}; + +static const unsigned int ad7606_oversampling_avail[7] = { + 1, 2, 4, 8, 16, 32, 64, +}; + +static int ad7606_reset(struct ad7606_state *st) +{ + if (st->gpio_reset) { + gpiod_set_value(st->gpio_reset, 1); + ndelay(100); /* t_reset >= 100ns */ + gpiod_set_value(st->gpio_reset, 0); + return 0; + } + + return -ENODEV; +} + +static int ad7606_read_samples(struct ad7606_state *st) +{ + unsigned int num = st->chip_info->num_channels; + u16 *data = st->data; + int ret; + + /* + * The frstdata signal is set to high while and after reading the sample + * of the first channel and low for all other channels. This can be used + * to check that the incoming data is correctly aligned. During normal + * operation the data should never become unaligned, but some glitch or + * electrostatic discharge might cause an extra read or clock cycle. + * Monitoring the frstdata signal allows to recover from such failure + * situations. + */ + + if (st->gpio_frstdata) { + ret = st->bops->read_block(st->dev, 1, data); + if (ret) + return ret; + + if (!gpiod_get_value(st->gpio_frstdata)) { + ad7606_reset(st); + return -EIO; + } + + data++; + num--; + } + + return st->bops->read_block(st->dev, num, data); +} + +static irqreturn_t ad7606_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct ad7606_state *st = iio_priv(indio_dev); + int ret; + + mutex_lock(&st->lock); + + ret = ad7606_read_samples(st); + if (ret == 0) + iio_push_to_buffers_with_timestamp(indio_dev, st->data, + iio_get_time_ns(indio_dev)); + + iio_trigger_notify_done(indio_dev->trig); + /* The rising edge of the CONVST signal starts a new conversion. */ + gpiod_set_value(st->gpio_convst, 1); + + mutex_unlock(&st->lock); + + return IRQ_HANDLED; +} + +static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch) +{ + struct ad7606_state *st = iio_priv(indio_dev); + int ret; + + gpiod_set_value(st->gpio_convst, 1); + ret = wait_for_completion_timeout(&st->completion, + msecs_to_jiffies(1000)); + if (!ret) { + ret = -ETIMEDOUT; + goto error_ret; + } + + ret = ad7606_read_samples(st); + if (ret == 0) + ret = st->data[ch]; + +error_ret: + gpiod_set_value(st->gpio_convst, 0); + + return ret; +} + +static int ad7606_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long m) +{ + int ret; + struct ad7606_state *st = iio_priv(indio_dev); + + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + + ret = ad7606_scan_direct(indio_dev, chan->address); + iio_device_release_direct_mode(indio_dev); + + if (ret < 0) + return ret; + *val = (short)ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + *val = 0; + *val2 = scale_avail[st->range]; + return IIO_VAL_INT_PLUS_MICRO; + case IIO_CHAN_INFO_OVERSAMPLING_RATIO: + *val = st->oversampling; + return IIO_VAL_INT; + } + return -EINVAL; +} + +static ssize_t in_voltage_scale_available_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int i, len = 0; + + for (i = 0; i < ARRAY_SIZE(scale_avail); i++) + len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", + scale_avail[i]); + + buf[len - 1] = '\n'; + + return len; +} + +static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0); + +static int ad7606_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, + int val2, + long mask) +{ + struct ad7606_state *st = iio_priv(indio_dev); + DECLARE_BITMAP(values, 3); + int i; + + switch (mask) { + case IIO_CHAN_INFO_SCALE: + mutex_lock(&st->lock); + i = find_closest(val2, scale_avail, ARRAY_SIZE(scale_avail)); + gpiod_set_value(st->gpio_range, i); + st->range = i; + mutex_unlock(&st->lock); + + return 0; + case IIO_CHAN_INFO_OVERSAMPLING_RATIO: + if (val2) + return -EINVAL; + i = find_closest(val, ad7606_oversampling_avail, + ARRAY_SIZE(ad7606_oversampling_avail)); + + values[0] = i; + + mutex_lock(&st->lock); + gpiod_set_array_value(ARRAY_SIZE(values), st->gpio_os->desc, + st->gpio_os->info, values); + st->oversampling = ad7606_oversampling_avail[i]; + mutex_unlock(&st->lock); + + return 0; + default: + return -EINVAL; + } +} + +static IIO_CONST_ATTR(oversampling_ratio_available, "1 2 4 8 16 32 64"); + +static struct attribute *ad7606_attributes_os_and_range[] = { + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + &iio_const_attr_oversampling_ratio_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ad7606_attribute_group_os_and_range = { + .attrs = ad7606_attributes_os_and_range, +}; + +static struct attribute *ad7606_attributes_os[] = { + &iio_const_attr_oversampling_ratio_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ad7606_attribute_group_os = { + .attrs = ad7606_attributes_os, +}; + +static struct attribute *ad7606_attributes_range[] = { + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ad7606_attribute_group_range = { + .attrs = ad7606_attributes_range, +}; + +#define AD760X_CHANNEL(num, mask) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = num, \ + .address = num, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\ + .info_mask_shared_by_all = mask, \ + .scan_index = num, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_CPU, \ + }, \ +} + +#define AD7605_CHANNEL(num) \ + AD760X_CHANNEL(num, 0) + +#define AD7606_CHANNEL(num) \ + AD760X_CHANNEL(num, BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO)) + +static const struct iio_chan_spec ad7605_channels[] = { + IIO_CHAN_SOFT_TIMESTAMP(4), + AD7605_CHANNEL(0), + AD7605_CHANNEL(1), + AD7605_CHANNEL(2), + AD7605_CHANNEL(3), +}; + +static const struct iio_chan_spec ad7606_channels[] = { + IIO_CHAN_SOFT_TIMESTAMP(8), + AD7606_CHANNEL(0), + AD7606_CHANNEL(1), + AD7606_CHANNEL(2), + AD7606_CHANNEL(3), + AD7606_CHANNEL(4), + AD7606_CHANNEL(5), + AD7606_CHANNEL(6), + AD7606_CHANNEL(7), +}; + +static const struct ad7606_chip_info ad7606_chip_info_tbl[] = { + /* More devices added in future */ + [ID_AD7605_4] = { + .channels = ad7605_channels, + .num_channels = 5, + }, + [ID_AD7606_8] = { + .channels = ad7606_channels, + .num_channels = 9, + .has_oversampling = true, + }, + [ID_AD7606_6] = { + .channels = ad7606_channels, + .num_channels = 7, + .has_oversampling = true, + }, + [ID_AD7606_4] = { + .channels = ad7606_channels, + .num_channels = 5, + .has_oversampling = true, + }, +}; + +static int ad7606_request_gpios(struct ad7606_state *st) +{ + struct device *dev = st->dev; + + st->gpio_convst = devm_gpiod_get(dev, "adi,conversion-start", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_convst)) + return PTR_ERR(st->gpio_convst); + + st->gpio_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_reset)) + return PTR_ERR(st->gpio_reset); + + st->gpio_range = devm_gpiod_get_optional(dev, "adi,range", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_range)) + return PTR_ERR(st->gpio_range); + + st->gpio_standby = devm_gpiod_get_optional(dev, "standby", + GPIOD_OUT_HIGH); + if (IS_ERR(st->gpio_standby)) + return PTR_ERR(st->gpio_standby); + + st->gpio_frstdata = devm_gpiod_get_optional(dev, "adi,first-data", + GPIOD_IN); + if (IS_ERR(st->gpio_frstdata)) + return PTR_ERR(st->gpio_frstdata); + + if (!st->chip_info->has_oversampling) + return 0; + + st->gpio_os = devm_gpiod_get_array_optional(dev, + "adi,oversampling-ratio", + GPIOD_OUT_LOW); + return PTR_ERR_OR_ZERO(st->gpio_os); +} + +/* + * The BUSY signal indicates when conversions are in progress, so when a rising + * edge of CONVST is applied, BUSY goes logic high and transitions low at the + * end of the entire conversion process. The falling edge of the BUSY signal + * triggers this interrupt. + */ +static irqreturn_t ad7606_interrupt(int irq, void *dev_id) +{ + struct iio_dev *indio_dev = dev_id; + struct ad7606_state *st = iio_priv(indio_dev); + + if (iio_buffer_enabled(indio_dev)) { + gpiod_set_value(st->gpio_convst, 0); + iio_trigger_poll_chained(st->trig); + } else { + complete(&st->completion); + } + + return IRQ_HANDLED; +}; + +static int ad7606_validate_trigger(struct iio_dev *indio_dev, + struct iio_trigger *trig) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + if (st->trig != trig) + return -EINVAL; + + return 0; +} + +static int ad7606_buffer_postenable(struct iio_dev *indio_dev) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + iio_triggered_buffer_postenable(indio_dev); + gpiod_set_value(st->gpio_convst, 1); + + return 0; +} + +static int ad7606_buffer_predisable(struct iio_dev *indio_dev) +{ + struct ad7606_state *st = iio_priv(indio_dev); + + gpiod_set_value(st->gpio_convst, 0); + + return iio_triggered_buffer_predisable(indio_dev); +} + +static const struct iio_buffer_setup_ops ad7606_buffer_ops = { + .postenable = &ad7606_buffer_postenable, + .predisable = &ad7606_buffer_predisable, +}; + +static const struct iio_info ad7606_info_no_os_or_range = { + .read_raw = &ad7606_read_raw, + .validate_trigger = &ad7606_validate_trigger, +}; + +static const struct iio_info ad7606_info_os_and_range = { + .read_raw = &ad7606_read_raw, + .write_raw = &ad7606_write_raw, + .attrs = &ad7606_attribute_group_os_and_range, + .validate_trigger = &ad7606_validate_trigger, +}; + +static const struct iio_info ad7606_info_os = { + .read_raw = &ad7606_read_raw, + .write_raw = &ad7606_write_raw, + .attrs = &ad7606_attribute_group_os, + .validate_trigger = &ad7606_validate_trigger, +}; + +static const struct iio_info ad7606_info_range = { + .read_raw = &ad7606_read_raw, + .write_raw = &ad7606_write_raw, + .attrs = &ad7606_attribute_group_range, + .validate_trigger = &ad7606_validate_trigger, +}; + +static const struct iio_trigger_ops ad7606_trigger_ops = { + .validate_device = iio_trigger_validate_own_device, +}; + +static void ad7606_regulator_disable(void *data) +{ + struct ad7606_state *st = data; + + regulator_disable(st->reg); +} + +int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, + const char *name, unsigned int id, + const struct ad7606_bus_ops *bops) +{ + struct ad7606_state *st; + int ret; + struct iio_dev *indio_dev; + + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); + if (!indio_dev) + return -ENOMEM; + + st = iio_priv(indio_dev); + dev_set_drvdata(dev, indio_dev); + + st->dev = dev; + mutex_init(&st->lock); + st->bops = bops; + st->base_address = base_address; + /* tied to logic low, analog input range is +/- 5V */ + st->range = 0; + st->oversampling = 1; + + st->reg = devm_regulator_get(dev, "avcc"); + if (IS_ERR(st->reg)) + return PTR_ERR(st->reg); + + ret = regulator_enable(st->reg); + if (ret) { + dev_err(dev, "Failed to enable specified AVcc supply\n"); + return ret; + } + + ret = devm_add_action_or_reset(dev, ad7606_regulator_disable, st); + if (ret) + return ret; + + st->chip_info = &ad7606_chip_info_tbl[id]; + + ret = ad7606_request_gpios(st); + if (ret) + return ret; + + indio_dev->dev.parent = dev; + if (st->gpio_os) { + if (st->gpio_range) + indio_dev->info = &ad7606_info_os_and_range; + else + indio_dev->info = &ad7606_info_os; + } else { + if (st->gpio_range) + indio_dev->info = &ad7606_info_range; + else + indio_dev->info = &ad7606_info_no_os_or_range; + } + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->name = name; + indio_dev->channels = st->chip_info->channels; + indio_dev->num_channels = st->chip_info->num_channels; + + init_completion(&st->completion); + + ret = ad7606_reset(st); + if (ret) + dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n"); + + st->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", + indio_dev->name, indio_dev->id); + if (!st->trig) + return -ENOMEM; + + st->trig->ops = &ad7606_trigger_ops; + st->trig->dev.parent = dev; + iio_trigger_set_drvdata(st->trig, indio_dev); + ret = devm_iio_trigger_register(dev, st->trig); + if (ret) + return ret; + + indio_dev->trig = iio_trigger_get(st->trig); + + ret = devm_request_threaded_irq(dev, irq, + NULL, + &ad7606_interrupt, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + name, indio_dev); + if (ret) + return ret; + + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, + &iio_pollfunc_store_time, + &ad7606_trigger_handler, + &ad7606_buffer_ops); + if (ret) + return ret; + + return devm_iio_device_register(dev, indio_dev); +} +EXPORT_SYMBOL_GPL(ad7606_probe); + +#ifdef CONFIG_PM_SLEEP + +static int ad7606_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct ad7606_state *st = iio_priv(indio_dev); + + if (st->gpio_standby) { + gpiod_set_value(st->gpio_range, 1); + gpiod_set_value(st->gpio_standby, 0); + } + + return 0; +} + +static int ad7606_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct ad7606_state *st = iio_priv(indio_dev); + + if (st->gpio_standby) { + gpiod_set_value(st->gpio_range, st->range); + gpiod_set_value(st->gpio_standby, 1); + ad7606_reset(st); + } + + return 0; +} + +SIMPLE_DEV_PM_OPS(ad7606_pm_ops, ad7606_suspend, ad7606_resume); +EXPORT_SYMBOL_GPL(ad7606_pm_ops); + +#endif + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); +MODULE_LICENSE("GPL"); diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h new file mode 100644 index 0000000..5d12410 --- /dev/null +++ b/drivers/iio/adc/ad7606.h @@ -0,0 +1,99 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * AD7606 ADC driver + * + * Copyright 2011 Analog Devices Inc. + */ + +#ifndef IIO_ADC_AD7606_H_ +#define IIO_ADC_AD7606_H_ + +/** + * struct ad7606_chip_info - chip specific information + * @channels: channel specification + * @num_channels: number of channels + * @has_oversampling: whether the device has oversampling support + */ +struct ad7606_chip_info { + const struct iio_chan_spec *channels; + unsigned int num_channels; + bool has_oversampling; +}; + +/** + * struct ad7606_state - driver instance specific data + * @dev pointer to kernel device + * @chip_info entry in the table of chips that describes this device + * @reg regulator info for the the power supply of the device + * @bops bus operations (SPI or parallel) + * @range voltage range selection, selects which scale to apply + * @oversampling oversampling selection + * @base_address address from where to read data in parallel operation + * @lock protect sensor state from concurrent accesses to GPIOs + * @gpio_convst GPIO descriptor for conversion start signal (CONVST) + * @gpio_reset GPIO descriptor for device hard-reset + * @gpio_range GPIO descriptor for range selection + * @gpio_standby GPIO descriptor for stand-by signal (STBY), + * controls power-down mode of device + * @gpio_frstdata GPIO descriptor for reading from device when data + * is being read on the first channel + * @gpio_os GPIO descriptors to control oversampling on the device + * @complete completion to indicate end of conversion + * @trig The IIO trigger associated with the device. + * @data buffer for reading data from the device + */ +struct ad7606_state { + struct device *dev; + const struct ad7606_chip_info *chip_info; + struct regulator *reg; + const struct ad7606_bus_ops *bops; + unsigned int range; + unsigned int oversampling; + void __iomem *base_address; + + struct mutex lock; /* protect sensor state */ + struct gpio_desc *gpio_convst; + struct gpio_desc *gpio_reset; + struct gpio_desc *gpio_range; + struct gpio_desc *gpio_standby; + struct gpio_desc *gpio_frstdata; + struct gpio_descs *gpio_os; + struct iio_trigger *trig; + struct completion completion; + + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + * 8 * 16-bit samples + 64-bit timestamp + */ + unsigned short data[12] ____cacheline_aligned; +}; + +/** + * struct ad7606_bus_ops - driver bus operations + * @read_block function pointer for reading blocks of data + */ +struct ad7606_bus_ops { + /* more methods added in future? */ + int (*read_block)(struct device *dev, int num, void *data); +}; + +int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, + const char *name, unsigned int id, + const struct ad7606_bus_ops *bops); + +enum ad7606_supported_device_ids { + ID_AD7605_4, + ID_AD7606_8, + ID_AD7606_6, + ID_AD7606_4 +}; + +#ifdef CONFIG_PM_SLEEP +extern const struct dev_pm_ops ad7606_pm_ops; +#define AD7606_PM_OPS (&ad7606_pm_ops) +#else +#define AD7606_PM_OPS NULL +#endif + +#endif /* IIO_ADC_AD7606_H_ */ diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c new file mode 100644 index 0000000..df607c7 --- /dev/null +++ b/drivers/iio/adc/ad7606_par.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AD7606 Parallel Interface ADC driver + * + * Copyright 2011 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include + +#include +#include "ad7606.h" + +static int ad7606_par16_read_block(struct device *dev, + int count, void *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct ad7606_state *st = iio_priv(indio_dev); + + insw((unsigned long)st->base_address, buf, count); + + return 0; +} + +static const struct ad7606_bus_ops ad7606_par16_bops = { + .read_block = ad7606_par16_read_block, +}; + +static int ad7606_par8_read_block(struct device *dev, + int count, void *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct ad7606_state *st = iio_priv(indio_dev); + + insb((unsigned long)st->base_address, buf, count * 2); + + return 0; +} + +static const struct ad7606_bus_ops ad7606_par8_bops = { + .read_block = ad7606_par8_read_block, +}; + +static int ad7606_par_probe(struct platform_device *pdev) +{ + const struct platform_device_id *id = platform_get_device_id(pdev); + struct resource *res; + void __iomem *addr; + resource_size_t remap_size; + int irq; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "no irq: %d\n", irq); + return irq; + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + addr = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(addr)) + return PTR_ERR(addr); + + remap_size = resource_size(res); + + return ad7606_probe(&pdev->dev, irq, addr, + id->name, id->driver_data, + remap_size > 1 ? &ad7606_par16_bops : + &ad7606_par8_bops); +} + +static const struct platform_device_id ad7606_driver_ids[] = { + { .name = "ad7605-4", .driver_data = ID_AD7605_4, }, + { .name = "ad7606-4", .driver_data = ID_AD7606_4, }, + { .name = "ad7606-6", .driver_data = ID_AD7606_6, }, + { .name = "ad7606-8", .driver_data = ID_AD7606_8, }, + { } +}; +MODULE_DEVICE_TABLE(platform, ad7606_driver_ids); + +static const struct of_device_id ad7606_of_match[] = { + { .compatible = "adi,ad7605-4" }, + { .compatible = "adi,ad7606-4" }, + { .compatible = "adi,ad7606-6" }, + { .compatible = "adi,ad7606-8" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ad7606_of_match); + +static struct platform_driver ad7606_driver = { + .probe = ad7606_par_probe, + .id_table = ad7606_driver_ids, + .driver = { + .name = "ad7606", + .pm = AD7606_PM_OPS, + .of_match_table = ad7606_of_match, + }, +}; +module_platform_driver(ad7606_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); +MODULE_LICENSE("GPL"); diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c new file mode 100644 index 0000000..f842eba --- /dev/null +++ b/drivers/iio/adc/ad7606_spi.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AD7606 SPI ADC driver + * + * Copyright 2011 Analog Devices Inc. + */ + +#include +#include +#include +#include + +#include +#include "ad7606.h" + +#define MAX_SPI_FREQ_HZ 23500000 /* VDRIVE above 4.75 V */ + +static int ad7606_spi_read_block(struct device *dev, + int count, void *buf) +{ + struct spi_device *spi = to_spi_device(dev); + int i, ret; + unsigned short *data = buf; + __be16 *bdata = buf; + + ret = spi_read(spi, buf, count * 2); + if (ret < 0) { + dev_err(&spi->dev, "SPI read error\n"); + return ret; + } + + for (i = 0; i < count; i++) + data[i] = be16_to_cpu(bdata[i]); + + return 0; +} + +static const struct ad7606_bus_ops ad7606_spi_bops = { + .read_block = ad7606_spi_read_block, +}; + +static int ad7606_spi_probe(struct spi_device *spi) +{ + const struct spi_device_id *id = spi_get_device_id(spi); + + return ad7606_probe(&spi->dev, spi->irq, NULL, + id->name, id->driver_data, + &ad7606_spi_bops); +} + +static const struct spi_device_id ad7606_id_table[] = { + { "ad7605-4", ID_AD7605_4 }, + { "ad7606-4", ID_AD7606_4 }, + { "ad7606-6", ID_AD7606_6 }, + { "ad7606-8", ID_AD7606_8 }, + {} +}; +MODULE_DEVICE_TABLE(spi, ad7606_id_table); + +static const struct of_device_id ad7606_of_match[] = { + { .compatible = "adi,ad7605-4" }, + { .compatible = "adi,ad7606-4" }, + { .compatible = "adi,ad7606-6" }, + { .compatible = "adi,ad7606-8" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ad7606_of_match); + +static struct spi_driver ad7606_driver = { + .driver = { + .name = "ad7606", + .of_match_table = ad7606_of_match, + .pm = AD7606_PM_OPS, + }, + .probe = ad7606_spi_probe, + .id_table = ad7606_id_table, +}; +module_spi_driver(ad7606_driver); + +MODULE_AUTHOR("Michael Hennerich "); +MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 302639a..7a93d3a 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -3,33 +3,6 @@ # menu "Analog to digital converters" -config AD7606 - tristate - select IIO_BUFFER - select IIO_TRIGGERED_BUFFER - -config AD7606_IFACE_PARALLEL - tristate "Analog Devices AD7606 ADC driver with parallel interface support" - depends on HAS_IOMEM - select AD7606 - help - Say yes here to build parallel interface support for Analog Devices: - ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). - - To compile this driver as a module, choose M here: the - module will be called ad7606_parallel. - -config AD7606_IFACE_SPI - tristate "Analog Devices AD7606 ADC driver with spi interface support" - depends on SPI - select AD7606 - help - Say yes here to build spi interface support for Analog Devices: - ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). - - To compile this driver as a module, choose M here: the - module will be called ad7606_spi. - config AD7780 tristate "Analog Devices AD7780 and similar ADCs driver" depends on SPI diff --git a/drivers/staging/iio/adc/Makefile b/drivers/staging/iio/adc/Makefile index ebe83c1..7a42108 100644 --- a/drivers/staging/iio/adc/Makefile +++ b/drivers/staging/iio/adc/Makefile @@ -3,10 +3,6 @@ # Makefile for industrial I/O ADC drivers # -obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o -obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o -obj-$(CONFIG_AD7606) += ad7606.o - obj-$(CONFIG_AD7780) += ad7780.o obj-$(CONFIG_AD7816) += ad7816.o obj-$(CONFIG_AD7192) += ad7192.o diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c deleted file mode 100644 index 32854f1..0000000 --- a/drivers/staging/iio/adc/ad7606.c +++ /dev/null @@ -1,583 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * AD7606 SPI ADC driver - * - * Copyright 2011 Analog Devices Inc. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "ad7606.h" - -/* - * Scales are computed as 5000/32768 and 10000/32768 respectively, - * so that when applied to the raw values they provide mV values - */ -static const unsigned int scale_avail[2] = { - 152588, 305176 -}; - -static const unsigned int ad7606_oversampling_avail[7] = { - 1, 2, 4, 8, 16, 32, 64, -}; - -static int ad7606_reset(struct ad7606_state *st) -{ - if (st->gpio_reset) { - gpiod_set_value(st->gpio_reset, 1); - ndelay(100); /* t_reset >= 100ns */ - gpiod_set_value(st->gpio_reset, 0); - return 0; - } - - return -ENODEV; -} - -static int ad7606_read_samples(struct ad7606_state *st) -{ - unsigned int num = st->chip_info->num_channels; - u16 *data = st->data; - int ret; - - /* - * The frstdata signal is set to high while and after reading the sample - * of the first channel and low for all other channels. This can be used - * to check that the incoming data is correctly aligned. During normal - * operation the data should never become unaligned, but some glitch or - * electrostatic discharge might cause an extra read or clock cycle. - * Monitoring the frstdata signal allows to recover from such failure - * situations. - */ - - if (st->gpio_frstdata) { - ret = st->bops->read_block(st->dev, 1, data); - if (ret) - return ret; - - if (!gpiod_get_value(st->gpio_frstdata)) { - ad7606_reset(st); - return -EIO; - } - - data++; - num--; - } - - return st->bops->read_block(st->dev, num, data); -} - -static irqreturn_t ad7606_trigger_handler(int irq, void *p) -{ - struct iio_poll_func *pf = p; - struct iio_dev *indio_dev = pf->indio_dev; - struct ad7606_state *st = iio_priv(indio_dev); - int ret; - - mutex_lock(&st->lock); - - ret = ad7606_read_samples(st); - if (ret == 0) - iio_push_to_buffers_with_timestamp(indio_dev, st->data, - iio_get_time_ns(indio_dev)); - - iio_trigger_notify_done(indio_dev->trig); - /* The rising edge of the CONVST signal starts a new conversion. */ - gpiod_set_value(st->gpio_convst, 1); - - mutex_unlock(&st->lock); - - return IRQ_HANDLED; -} - -static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch) -{ - struct ad7606_state *st = iio_priv(indio_dev); - int ret; - - gpiod_set_value(st->gpio_convst, 1); - ret = wait_for_completion_timeout(&st->completion, - msecs_to_jiffies(1000)); - if (!ret) { - ret = -ETIMEDOUT; - goto error_ret; - } - - ret = ad7606_read_samples(st); - if (ret == 0) - ret = st->data[ch]; - -error_ret: - gpiod_set_value(st->gpio_convst, 0); - - return ret; -} - -static int ad7606_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int *val, - int *val2, - long m) -{ - int ret; - struct ad7606_state *st = iio_priv(indio_dev); - - switch (m) { - case IIO_CHAN_INFO_RAW: - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; - - ret = ad7606_scan_direct(indio_dev, chan->address); - iio_device_release_direct_mode(indio_dev); - - if (ret < 0) - return ret; - *val = (short)ret; - return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE: - *val = 0; - *val2 = scale_avail[st->range]; - return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_OVERSAMPLING_RATIO: - *val = st->oversampling; - return IIO_VAL_INT; - } - return -EINVAL; -} - -static ssize_t in_voltage_scale_available_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - int i, len = 0; - - for (i = 0; i < ARRAY_SIZE(scale_avail); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", - scale_avail[i]); - - buf[len - 1] = '\n'; - - return len; -} - -static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0); - -static int ad7606_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, - int val, - int val2, - long mask) -{ - struct ad7606_state *st = iio_priv(indio_dev); - DECLARE_BITMAP(values, 3); - int i; - - switch (mask) { - case IIO_CHAN_INFO_SCALE: - mutex_lock(&st->lock); - i = find_closest(val2, scale_avail, ARRAY_SIZE(scale_avail)); - gpiod_set_value(st->gpio_range, i); - st->range = i; - mutex_unlock(&st->lock); - - return 0; - case IIO_CHAN_INFO_OVERSAMPLING_RATIO: - if (val2) - return -EINVAL; - i = find_closest(val, ad7606_oversampling_avail, - ARRAY_SIZE(ad7606_oversampling_avail)); - - values[0] = i; - - mutex_lock(&st->lock); - gpiod_set_array_value(ARRAY_SIZE(values), st->gpio_os->desc, - st->gpio_os->info, values); - st->oversampling = ad7606_oversampling_avail[i]; - mutex_unlock(&st->lock); - - return 0; - default: - return -EINVAL; - } -} - -static IIO_CONST_ATTR(oversampling_ratio_available, "1 2 4 8 16 32 64"); - -static struct attribute *ad7606_attributes_os_and_range[] = { - &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, - &iio_const_attr_oversampling_ratio_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad7606_attribute_group_os_and_range = { - .attrs = ad7606_attributes_os_and_range, -}; - -static struct attribute *ad7606_attributes_os[] = { - &iio_const_attr_oversampling_ratio_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad7606_attribute_group_os = { - .attrs = ad7606_attributes_os, -}; - -static struct attribute *ad7606_attributes_range[] = { - &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, - NULL, -}; - -static const struct attribute_group ad7606_attribute_group_range = { - .attrs = ad7606_attributes_range, -}; - -#define AD760X_CHANNEL(num, mask) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ - .channel = num, \ - .address = num, \ - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\ - .info_mask_shared_by_all = mask, \ - .scan_index = num, \ - .scan_type = { \ - .sign = 's', \ - .realbits = 16, \ - .storagebits = 16, \ - .endianness = IIO_CPU, \ - }, \ -} - -#define AD7605_CHANNEL(num) \ - AD760X_CHANNEL(num, 0) - -#define AD7606_CHANNEL(num) \ - AD760X_CHANNEL(num, BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO)) - -static const struct iio_chan_spec ad7605_channels[] = { - IIO_CHAN_SOFT_TIMESTAMP(4), - AD7605_CHANNEL(0), - AD7605_CHANNEL(1), - AD7605_CHANNEL(2), - AD7605_CHANNEL(3), -}; - -static const struct iio_chan_spec ad7606_channels[] = { - IIO_CHAN_SOFT_TIMESTAMP(8), - AD7606_CHANNEL(0), - AD7606_CHANNEL(1), - AD7606_CHANNEL(2), - AD7606_CHANNEL(3), - AD7606_CHANNEL(4), - AD7606_CHANNEL(5), - AD7606_CHANNEL(6), - AD7606_CHANNEL(7), -}; - -static const struct ad7606_chip_info ad7606_chip_info_tbl[] = { - /* More devices added in future */ - [ID_AD7605_4] = { - .channels = ad7605_channels, - .num_channels = 5, - }, - [ID_AD7606_8] = { - .channels = ad7606_channels, - .num_channels = 9, - .has_oversampling = true, - }, - [ID_AD7606_6] = { - .channels = ad7606_channels, - .num_channels = 7, - .has_oversampling = true, - }, - [ID_AD7606_4] = { - .channels = ad7606_channels, - .num_channels = 5, - .has_oversampling = true, - }, -}; - -static int ad7606_request_gpios(struct ad7606_state *st) -{ - struct device *dev = st->dev; - - st->gpio_convst = devm_gpiod_get(dev, "adi,conversion-start", - GPIOD_OUT_LOW); - if (IS_ERR(st->gpio_convst)) - return PTR_ERR(st->gpio_convst); - - st->gpio_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(st->gpio_reset)) - return PTR_ERR(st->gpio_reset); - - st->gpio_range = devm_gpiod_get_optional(dev, "adi,range", - GPIOD_OUT_LOW); - if (IS_ERR(st->gpio_range)) - return PTR_ERR(st->gpio_range); - - st->gpio_standby = devm_gpiod_get_optional(dev, "standby", - GPIOD_OUT_HIGH); - if (IS_ERR(st->gpio_standby)) - return PTR_ERR(st->gpio_standby); - - st->gpio_frstdata = devm_gpiod_get_optional(dev, "adi,first-data", - GPIOD_IN); - if (IS_ERR(st->gpio_frstdata)) - return PTR_ERR(st->gpio_frstdata); - - if (!st->chip_info->has_oversampling) - return 0; - - st->gpio_os = devm_gpiod_get_array_optional(dev, - "adi,oversampling-ratio", - GPIOD_OUT_LOW); - return PTR_ERR_OR_ZERO(st->gpio_os); -} - -/* - * The BUSY signal indicates when conversions are in progress, so when a rising - * edge of CONVST is applied, BUSY goes logic high and transitions low at the - * end of the entire conversion process. The falling edge of the BUSY signal - * triggers this interrupt. - */ -static irqreturn_t ad7606_interrupt(int irq, void *dev_id) -{ - struct iio_dev *indio_dev = dev_id; - struct ad7606_state *st = iio_priv(indio_dev); - - if (iio_buffer_enabled(indio_dev)) { - gpiod_set_value(st->gpio_convst, 0); - iio_trigger_poll_chained(st->trig); - } else { - complete(&st->completion); - } - - return IRQ_HANDLED; -}; - -static int ad7606_validate_trigger(struct iio_dev *indio_dev, - struct iio_trigger *trig) -{ - struct ad7606_state *st = iio_priv(indio_dev); - - if (st->trig != trig) - return -EINVAL; - - return 0; -} - -static int ad7606_buffer_postenable(struct iio_dev *indio_dev) -{ - struct ad7606_state *st = iio_priv(indio_dev); - - iio_triggered_buffer_postenable(indio_dev); - gpiod_set_value(st->gpio_convst, 1); - - return 0; -} - -static int ad7606_buffer_predisable(struct iio_dev *indio_dev) -{ - struct ad7606_state *st = iio_priv(indio_dev); - - gpiod_set_value(st->gpio_convst, 0); - - return iio_triggered_buffer_predisable(indio_dev); -} - -static const struct iio_buffer_setup_ops ad7606_buffer_ops = { - .postenable = &ad7606_buffer_postenable, - .predisable = &ad7606_buffer_predisable, -}; - -static const struct iio_info ad7606_info_no_os_or_range = { - .read_raw = &ad7606_read_raw, - .validate_trigger = &ad7606_validate_trigger, -}; - -static const struct iio_info ad7606_info_os_and_range = { - .read_raw = &ad7606_read_raw, - .write_raw = &ad7606_write_raw, - .attrs = &ad7606_attribute_group_os_and_range, - .validate_trigger = &ad7606_validate_trigger, -}; - -static const struct iio_info ad7606_info_os = { - .read_raw = &ad7606_read_raw, - .write_raw = &ad7606_write_raw, - .attrs = &ad7606_attribute_group_os, - .validate_trigger = &ad7606_validate_trigger, -}; - -static const struct iio_info ad7606_info_range = { - .read_raw = &ad7606_read_raw, - .write_raw = &ad7606_write_raw, - .attrs = &ad7606_attribute_group_range, - .validate_trigger = &ad7606_validate_trigger, -}; - -static const struct iio_trigger_ops ad7606_trigger_ops = { - .validate_device = iio_trigger_validate_own_device, -}; - -static void ad7606_regulator_disable(void *data) -{ - struct ad7606_state *st = data; - - regulator_disable(st->reg); -} - -int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, - const char *name, unsigned int id, - const struct ad7606_bus_ops *bops) -{ - struct ad7606_state *st; - int ret; - struct iio_dev *indio_dev; - - indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); - if (!indio_dev) - return -ENOMEM; - - st = iio_priv(indio_dev); - dev_set_drvdata(dev, indio_dev); - - st->dev = dev; - mutex_init(&st->lock); - st->bops = bops; - st->base_address = base_address; - /* tied to logic low, analog input range is +/- 5V */ - st->range = 0; - st->oversampling = 1; - - st->reg = devm_regulator_get(dev, "avcc"); - if (IS_ERR(st->reg)) - return PTR_ERR(st->reg); - - ret = regulator_enable(st->reg); - if (ret) { - dev_err(dev, "Failed to enable specified AVcc supply\n"); - return ret; - } - - ret = devm_add_action_or_reset(dev, ad7606_regulator_disable, st); - if (ret) - return ret; - - st->chip_info = &ad7606_chip_info_tbl[id]; - - ret = ad7606_request_gpios(st); - if (ret) - return ret; - - indio_dev->dev.parent = dev; - if (st->gpio_os) { - if (st->gpio_range) - indio_dev->info = &ad7606_info_os_and_range; - else - indio_dev->info = &ad7606_info_os; - } else { - if (st->gpio_range) - indio_dev->info = &ad7606_info_range; - else - indio_dev->info = &ad7606_info_no_os_or_range; - } - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->name = name; - indio_dev->channels = st->chip_info->channels; - indio_dev->num_channels = st->chip_info->num_channels; - - init_completion(&st->completion); - - ret = ad7606_reset(st); - if (ret) - dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n"); - - st->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", - indio_dev->name, indio_dev->id); - if (!st->trig) - return -ENOMEM; - - st->trig->ops = &ad7606_trigger_ops; - st->trig->dev.parent = dev; - iio_trigger_set_drvdata(st->trig, indio_dev); - ret = devm_iio_trigger_register(dev, st->trig); - if (ret) - return ret; - - indio_dev->trig = iio_trigger_get(st->trig); - - ret = devm_request_threaded_irq(dev, irq, - NULL, - &ad7606_interrupt, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - name, indio_dev); - if (ret) - return ret; - - ret = devm_iio_triggered_buffer_setup(dev, indio_dev, - &iio_pollfunc_store_time, - &ad7606_trigger_handler, - &ad7606_buffer_ops); - if (ret) - return ret; - - return devm_iio_device_register(dev, indio_dev); -} -EXPORT_SYMBOL_GPL(ad7606_probe); - -#ifdef CONFIG_PM_SLEEP - -static int ad7606_suspend(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad7606_state *st = iio_priv(indio_dev); - - if (st->gpio_standby) { - gpiod_set_value(st->gpio_range, 1); - gpiod_set_value(st->gpio_standby, 0); - } - - return 0; -} - -static int ad7606_resume(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad7606_state *st = iio_priv(indio_dev); - - if (st->gpio_standby) { - gpiod_set_value(st->gpio_range, st->range); - gpiod_set_value(st->gpio_standby, 1); - ad7606_reset(st); - } - - return 0; -} - -SIMPLE_DEV_PM_OPS(ad7606_pm_ops, ad7606_suspend, ad7606_resume); -EXPORT_SYMBOL_GPL(ad7606_pm_ops); - -#endif - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h deleted file mode 100644 index 5d12410..0000000 --- a/drivers/staging/iio/adc/ad7606.h +++ /dev/null @@ -1,99 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * AD7606 ADC driver - * - * Copyright 2011 Analog Devices Inc. - */ - -#ifndef IIO_ADC_AD7606_H_ -#define IIO_ADC_AD7606_H_ - -/** - * struct ad7606_chip_info - chip specific information - * @channels: channel specification - * @num_channels: number of channels - * @has_oversampling: whether the device has oversampling support - */ -struct ad7606_chip_info { - const struct iio_chan_spec *channels; - unsigned int num_channels; - bool has_oversampling; -}; - -/** - * struct ad7606_state - driver instance specific data - * @dev pointer to kernel device - * @chip_info entry in the table of chips that describes this device - * @reg regulator info for the the power supply of the device - * @bops bus operations (SPI or parallel) - * @range voltage range selection, selects which scale to apply - * @oversampling oversampling selection - * @base_address address from where to read data in parallel operation - * @lock protect sensor state from concurrent accesses to GPIOs - * @gpio_convst GPIO descriptor for conversion start signal (CONVST) - * @gpio_reset GPIO descriptor for device hard-reset - * @gpio_range GPIO descriptor for range selection - * @gpio_standby GPIO descriptor for stand-by signal (STBY), - * controls power-down mode of device - * @gpio_frstdata GPIO descriptor for reading from device when data - * is being read on the first channel - * @gpio_os GPIO descriptors to control oversampling on the device - * @complete completion to indicate end of conversion - * @trig The IIO trigger associated with the device. - * @data buffer for reading data from the device - */ -struct ad7606_state { - struct device *dev; - const struct ad7606_chip_info *chip_info; - struct regulator *reg; - const struct ad7606_bus_ops *bops; - unsigned int range; - unsigned int oversampling; - void __iomem *base_address; - - struct mutex lock; /* protect sensor state */ - struct gpio_desc *gpio_convst; - struct gpio_desc *gpio_reset; - struct gpio_desc *gpio_range; - struct gpio_desc *gpio_standby; - struct gpio_desc *gpio_frstdata; - struct gpio_descs *gpio_os; - struct iio_trigger *trig; - struct completion completion; - - /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. - * 8 * 16-bit samples + 64-bit timestamp - */ - unsigned short data[12] ____cacheline_aligned; -}; - -/** - * struct ad7606_bus_ops - driver bus operations - * @read_block function pointer for reading blocks of data - */ -struct ad7606_bus_ops { - /* more methods added in future? */ - int (*read_block)(struct device *dev, int num, void *data); -}; - -int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, - const char *name, unsigned int id, - const struct ad7606_bus_ops *bops); - -enum ad7606_supported_device_ids { - ID_AD7605_4, - ID_AD7606_8, - ID_AD7606_6, - ID_AD7606_4 -}; - -#ifdef CONFIG_PM_SLEEP -extern const struct dev_pm_ops ad7606_pm_ops; -#define AD7606_PM_OPS (&ad7606_pm_ops) -#else -#define AD7606_PM_OPS NULL -#endif - -#endif /* IIO_ADC_AD7606_H_ */ diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c deleted file mode 100644 index df607c7..0000000 --- a/drivers/staging/iio/adc/ad7606_par.c +++ /dev/null @@ -1,105 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * AD7606 Parallel Interface ADC driver - * - * Copyright 2011 Analog Devices Inc. - */ - -#include -#include -#include -#include -#include - -#include -#include "ad7606.h" - -static int ad7606_par16_read_block(struct device *dev, - int count, void *buf) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad7606_state *st = iio_priv(indio_dev); - - insw((unsigned long)st->base_address, buf, count); - - return 0; -} - -static const struct ad7606_bus_ops ad7606_par16_bops = { - .read_block = ad7606_par16_read_block, -}; - -static int ad7606_par8_read_block(struct device *dev, - int count, void *buf) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad7606_state *st = iio_priv(indio_dev); - - insb((unsigned long)st->base_address, buf, count * 2); - - return 0; -} - -static const struct ad7606_bus_ops ad7606_par8_bops = { - .read_block = ad7606_par8_read_block, -}; - -static int ad7606_par_probe(struct platform_device *pdev) -{ - const struct platform_device_id *id = platform_get_device_id(pdev); - struct resource *res; - void __iomem *addr; - resource_size_t remap_size; - int irq; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) { - dev_err(&pdev->dev, "no irq: %d\n", irq); - return irq; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - addr = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(addr)) - return PTR_ERR(addr); - - remap_size = resource_size(res); - - return ad7606_probe(&pdev->dev, irq, addr, - id->name, id->driver_data, - remap_size > 1 ? &ad7606_par16_bops : - &ad7606_par8_bops); -} - -static const struct platform_device_id ad7606_driver_ids[] = { - { .name = "ad7605-4", .driver_data = ID_AD7605_4, }, - { .name = "ad7606-4", .driver_data = ID_AD7606_4, }, - { .name = "ad7606-6", .driver_data = ID_AD7606_6, }, - { .name = "ad7606-8", .driver_data = ID_AD7606_8, }, - { } -}; -MODULE_DEVICE_TABLE(platform, ad7606_driver_ids); - -static const struct of_device_id ad7606_of_match[] = { - { .compatible = "adi,ad7605-4" }, - { .compatible = "adi,ad7606-4" }, - { .compatible = "adi,ad7606-6" }, - { .compatible = "adi,ad7606-8" }, - { }, -}; -MODULE_DEVICE_TABLE(of, ad7606_of_match); - -static struct platform_driver ad7606_driver = { - .probe = ad7606_par_probe, - .id_table = ad7606_driver_ids, - .driver = { - .name = "ad7606", - .pm = AD7606_PM_OPS, - .of_match_table = ad7606_of_match, - }, -}; -module_platform_driver(ad7606_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c deleted file mode 100644 index f842eba..0000000 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ /dev/null @@ -1,82 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * AD7606 SPI ADC driver - * - * Copyright 2011 Analog Devices Inc. - */ - -#include -#include -#include -#include - -#include -#include "ad7606.h" - -#define MAX_SPI_FREQ_HZ 23500000 /* VDRIVE above 4.75 V */ - -static int ad7606_spi_read_block(struct device *dev, - int count, void *buf) -{ - struct spi_device *spi = to_spi_device(dev); - int i, ret; - unsigned short *data = buf; - __be16 *bdata = buf; - - ret = spi_read(spi, buf, count * 2); - if (ret < 0) { - dev_err(&spi->dev, "SPI read error\n"); - return ret; - } - - for (i = 0; i < count; i++) - data[i] = be16_to_cpu(bdata[i]); - - return 0; -} - -static const struct ad7606_bus_ops ad7606_spi_bops = { - .read_block = ad7606_spi_read_block, -}; - -static int ad7606_spi_probe(struct spi_device *spi) -{ - const struct spi_device_id *id = spi_get_device_id(spi); - - return ad7606_probe(&spi->dev, spi->irq, NULL, - id->name, id->driver_data, - &ad7606_spi_bops); -} - -static const struct spi_device_id ad7606_id_table[] = { - { "ad7605-4", ID_AD7605_4 }, - { "ad7606-4", ID_AD7606_4 }, - { "ad7606-6", ID_AD7606_6 }, - { "ad7606-8", ID_AD7606_8 }, - {} -}; -MODULE_DEVICE_TABLE(spi, ad7606_id_table); - -static const struct of_device_id ad7606_of_match[] = { - { .compatible = "adi,ad7605-4" }, - { .compatible = "adi,ad7606-4" }, - { .compatible = "adi,ad7606-6" }, - { .compatible = "adi,ad7606-8" }, - { }, -}; -MODULE_DEVICE_TABLE(of, ad7606_of_match); - -static struct spi_driver ad7606_driver = { - .driver = { - .name = "ad7606", - .of_match_table = ad7606_of_match, - .pm = AD7606_PM_OPS, - }, - .probe = ad7606_spi_probe, - .id_table = ad7606_id_table, -}; -module_spi_driver(ad7606_driver); - -MODULE_AUTHOR("Michael Hennerich "); -MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); -MODULE_LICENSE("GPL"); From patchwork Mon Dec 17 12:23:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Popa X-Patchwork-Id: 10733279 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 9993013AD for ; Mon, 17 Dec 2018 12:27:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 870B129D76 for ; Mon, 17 Dec 2018 12:27:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78DAC29D96; Mon, 17 Dec 2018 12:27:10 +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 C18FD29D76 for ; Mon, 17 Dec 2018 12:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732430AbeLQM1J (ORCPT ); Mon, 17 Dec 2018 07:27:09 -0500 Received: from mail-eopbgr800040.outbound.protection.outlook.com ([40.107.80.40]:20311 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726436AbeLQM1I (ORCPT ); Mon, 17 Dec 2018 07:27:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K45XkEKNUbGgjjdYOt2AIVqg/z24N25Egc5GPwVc/L4=; b=k92ycEIIze7q9alQOTlnMnKJPGEv/2HrAeYVQtlWBWuRfkyGZJUlE2fbebqdT/yTSZB8S8NRQzCuMYOk1p808C/WunrlsI8WtEAM4j0hzJuFbr7r/+sGIn6j62U0SuOH2Wa+T5BD9SS5ejJczLS9392nvTtKhf/y/PM0R3c7beE= Received: from CY4PR03CA0106.namprd03.prod.outlook.com (2603:10b6:910:4d::47) by SN6PR03MB3728.namprd03.prod.outlook.com (2603:10b6:805:43::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.18; Mon, 17 Dec 2018 12:27:03 +0000 Received: from BN1AFFO11FD024.protection.gbl (2a01:111:f400:7c10::136) by CY4PR03CA0106.outlook.office365.com (2603:10b6:910:4d::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.19 via Frontend Transport; Mon, 17 Dec 2018 12:27:03 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BN1AFFO11FD024.mail.protection.outlook.com (10.58.52.84) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1446.11 via Frontend Transport; Mon, 17 Dec 2018 12:27:03 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id wBHCR2Q8016963 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2018 04:27:02 -0800 Received: from linux.analog.com (10.50.1.118) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 17 Dec 2018 07:27:02 -0500 From: Stefan Popa To: , , CC: Stefan Popa , , , , , , , , Subject: [PATCH v2 6/6] dt-bindings: iio: adc: Add docs for AD7606 ADC Date: Mon, 17 Dec 2018 14:23:40 +0200 Message-ID: <1545049420-16484-7-git-send-email-stefan.popa@analog.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545049420-16484-1-git-send-email-stefan.popa@analog.com> References: <1545049420-16484-1-git-send-email-stefan.popa@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.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(396003)(39860400002)(376002)(2980300002)(3190300001)(199004)(189003)(44832011)(76176011)(8936002)(8676002)(336012)(23676004)(186003)(11346002)(106002)(7696005)(426003)(36756003)(53416004)(26005)(2906002)(7636002)(7416002)(126002)(486006)(478600001)(966005)(316002)(305945005)(4326008)(2870700001)(116002)(6306002)(50466002)(446003)(110136005)(54906003)(77096007)(5820100001)(72206003)(50226002)(47776003)(106466001)(2616005)(476003)(246002)(5660300001)(6666004)(356004);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR03MB3728;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD024;1:UbW8ZB7tEI1zVoWsNSIN+xirdfJoe9zy0I4nkUdOT4VQbGZZSoIL+KlZ7gTMKX+KMqRn6697JFye8YHPdse5Ywzop/o3OLUK6Fa/elLsF9eYkBOWTerG1JnsNJvgzia+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6131fb72-5595-40b9-6b34-08d6641af348 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR03MB3728; X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3728;3:xOtbaYXWtUxPuIh7Wrohj3W7OXzcvDEDA9cc7YB/OhMdH7UDyV7trPCtKUMpy/Pvf3u5Y6Q87qAyQJUHw/IGlrVIQn1iHuFxn+aATnw7xKaFyFlJVa8fu1zq2jIYPahbKZ2W9WmthL3hUXaQ0nN4bjZqw0bbCMlLFqvwiY/liLG8chU8zArfxxwrEclyAX8nPSTSkco3qwAT/GHaABXF6fmLqP1meaVYCqwD3qaGw0cxsR537mn1NTlHwEyhsunlZ7IXc6iVfpDILY4TXAB7uxgKZKvM9mbxW0/TS9XiJqIQ2H/rhwYE25RDl8df32NqzdcbqJclp61pJ9m57hp9/HKZ8c1oRTscnlSXTR6lzZw=;25:XfmP6G1Dm/kddnHGgo1Iqd5bz7OlMc2RziGIUUHQTtNA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dV7Efm/3tCrvx2TZCHusNlSE5AYWLO X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(3231475)(944501520)(4982022)(52105112)(93006095)(93004095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:SN6PR03MB3728;BCL:0;PCL:0;RULEID:;SRVR:SN6PR03MB3728; X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3728;4:FUKbh2lL8QWMwVE9zdhoENVuVqO1oZ5KnImx30bQfh/GjzchEVTCHxJyicgv3hAQD2LkChjAPoe/yZ+tI3/ZsIk/mSOc2TcJaK1ubLdOvBift3tGwCoajrJuCFePDB46W9PxlZAj4vvpbItokEQhMXE8MaNVDM3op6aFiyQGd1dlt8lep++VHbXTWmLMjCia0Ck0IxBGOz3BXyqN5+fkUlSGmu3il93obOgnMPIsRRrpcCxHtku4GFg++0lBRUNvmh8BeafxByTmlj12nKLcGw== X-Forefront-PRVS: 08897B549D X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN6PR03MB3728=3B23=3APQWWBc7?= =?utf-8?q?ls0i+qZEMaICKfb0G/dP+Wcc6wH6Cmho6jR2288MZvz4iRKeu1EbNQe9FfTlkhH2s?= =?utf-8?q?5hdY3zM0vuOWR+g27UzS1OLgKLmDgBdUO/GYuwccjBD7OHOOulK4qNn2Pk5cM/h1b?= =?utf-8?q?drn8L7mV9weAMpsvi4SXjdnNxa62WmojVem+z3GQJ6g+Q8msbfSvcrr42OQTYLb6L?= =?utf-8?q?kpE4YHcDr+l0PshMUnfPe7G95xYThLxOQOhY+7LBcWlug54jfvispeb6Ri9EBD9Lc?= =?utf-8?q?9ciu2LUyAdh6Gg/Dm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vDOe3JTgAjIHPb31imFZHBpMNgAIOPPJaq1YV2iCDrymY/v4F5CRffYFhdi186J+Nlo6Tg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2018 12:27:03.1946 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6131fb72-5595-40b9-6b34-08d6641af348 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.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3728 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 Document support for AD7606 Analog to Digital Converter. Signed-off-by: Stefan Popa Reviewed-by: Rob Herring --- .../devicetree/bindings/iio/adc/adi,ad7606.txt | 65 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7606.txt diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.txt b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.txt new file mode 100644 index 0000000..d7b6241 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.txt @@ -0,0 +1,65 @@ +Analog Devices AD7606 Simultaneous Sampling ADC + +Required properties for the AD7606: + +- compatible: Must be one of + * "adi,ad7605-4" + * "adi,ad7606-8" + * "adi,ad7606-6" + * "adi,ad7606-4" +- reg: SPI chip select number for the device +- spi-max-frequency: Max SPI frequency to use + see: Documentation/devicetree/bindings/spi/spi-bus.txt +- spi-cpha: See Documentation/devicetree/bindings/spi/spi-bus.txt +- avcc-supply: phandle to the Avcc power supply +- interrupts: IRQ line for the ADC + see: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +- adi,conversion-start-gpios: must be the device tree identifier of the CONVST pin. + This logic input is used to initiate conversions on the analog + input channels. As the line is active high, it should be marked + GPIO_ACTIVE_HIGH. + +Optional properties: + +- reset-gpios: must be the device tree identifier of the RESET pin. If specified, + it will be asserted during driver probe. As the line is active high, + it should be marked GPIO_ACTIVE_HIGH. +- standby-gpios: must be the device tree identifier of the STBY pin. This pin is used + to place the AD7606 into one of two power-down modes, Standby mode or + Shutdown mode. As the line is active low, it should be marked + GPIO_ACTIVE_LOW. +- adi,first-data-gpios: must be the device tree identifier of the FRSTDATA pin. + The FRSTDATA output indicates when the first channel, V1, is + being read back on either the parallel, byte or serial interface. + As the line is active high, it should be marked GPIO_ACTIVE_HIGH. +- adi,range-gpios: must be the device tree identifier of the RANGE pin. The polarity on + this pin determines the input range of the analog input channels. If + this pin is tied to a logic high, the analog input range is ±10V for + all channels. If this pin is tied to a logic low, the analog input range + is ±5V for all channels. As the line is active high, it should be marked + GPIO_ACTIVE_HIGH. +- adi,oversampling-ratio-gpios: must be the device tree identifier of the over-sampling + mode pins. As the line is active high, it should be marked + GPIO_ACTIVE_HIGH. + +Example: + + adc@0 { + compatible = "adi,ad7606-8"; + reg = <0>; + spi-max-frequency = <1000000>; + spi-cpol; + + avcc-supply = <&adc_vref>; + + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent = <&gpio>; + + adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; + adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + adi,oversampling-ratio-gpios = <&gpio 18 GPIO_ACTIVE_HIGH + &gpio 23 GPIO_ACTIVE_HIGH + &gpio 26 GPIO_ACTIVE_HIGH>; + standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index bc9f816..d039f66 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -860,6 +860,7 @@ L: linux-iio@vger.kernel.org W: http://ez.analog.com/community/linux-device-drivers S: Supported F: drivers/iio/adc/ad7606.c +F: Documentation/devicetree/bindings/iio/adc/ad7606.txt ANALOG DEVICES INC AD9389B DRIVER M: Hans Verkuil