From patchwork Mon Jun 24 08:08:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mircea Caprioru X-Patchwork-Id: 11012589 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 B0A0913AF for ; Mon, 24 Jun 2019 08:09:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97E93212D8 for ; Mon, 24 Jun 2019 08:09:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 888A0286DE; Mon, 24 Jun 2019 08:09:36 +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 F1BAC212D8 for ; Mon, 24 Jun 2019 08:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727070AbfFXIJf (ORCPT ); Mon, 24 Jun 2019 04:09:35 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:24676 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfFXIJf (ORCPT ); Mon, 24 Jun 2019 04:09:35 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O88PRw025043; Mon, 24 Jun 2019 04:09:12 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2055.outbound.protection.outlook.com [104.47.50.55]) by mx0a-00128a01.pphosted.com with ESMTP id 2t9h86cqs6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 04:09:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kw9XZWHXnjFo/2Xi0CM4TgJxFVpNoMjwC82UF/Mevn8=; b=4wnzatpBpsZ6nPCONUTq3J2OJEJku90xmds0ILc6uWTR0EcRusmEBqDB8Gk13qJrAGdEFbu9836DHsXIoBAkBQF8mesI/r+x5IHn1yXo3n8TLNioY5+J9uDOjhL8y8kr9szp57hIwIcvuUTS6slPo2QxMBAOFwE9WlLFy7wY+/Y= Received: from BN6PR03CA0017.namprd03.prod.outlook.com (10.168.230.155) by BY2PR03MB554.namprd03.prod.outlook.com (10.141.141.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 08:09:10 +0000 Received: from BL2NAM02FT038.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::206) by BN6PR03CA0017.outlook.office365.com (2603:10b6:404:23::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13 via Frontend Transport; Mon, 24 Jun 2019 08:09:09 +0000 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 BL2NAM02FT038.mail.protection.outlook.com (10.152.77.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1987.11 via Frontend Transport; Mon, 24 Jun 2019 08:09:09 +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 x5O898Cp019134 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 24 Jun 2019 01:09:08 -0700 Received: from mircea-Latitude-E6540.ad.analog.com (10.48.65.115) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 24 Jun 2019 04:09:07 -0400 From: Mircea Caprioru To: CC: , , , , , , , , Mircea Caprioru Subject: [PATCH V3 1/5] iio: adc: ad7124: Remove input number limitation Date: Mon, 24 Jun 2019 11:08:41 +0300 Message-ID: <20190624080845.18537-1-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 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)(136003)(346002)(376002)(39860400002)(2980300002)(199004)(189003)(54534003)(37524003)(8936002)(8676002)(2906002)(48376002)(478600001)(6916009)(2616005)(50466002)(305945005)(47776003)(70586007)(70206006)(246002)(336012)(426003)(44832011)(7636002)(72206003)(476003)(126002)(36756003)(486006)(4326008)(5660300002)(186003)(26005)(77096007)(7696005)(356004)(6666004)(86362001)(51416003)(107886003)(1076003)(2351001)(50226002)(316002)(54906003)(106002)(16586007);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB554;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3e0922e-52c0-4a6c-8a3b-08d6f87b3c13 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:BY2PR03MB554; X-MS-TrafficTypeDiagnostic: BY2PR03MB554: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 007814487B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: cZu0Kju0Nr1qgHmM/PxMm1YcKCKi+vo7o1JoziMkKlChQ8LSJifEuQ1AtevqflW85w2UFtmZZv3sRDeD0onZg3k00U1lPSS0pe7aXYelriuu6pGayM1/3a2uq6V0ATH71Y80hhdAG/Gckn9OrdB+BO8fYXNd1hF43+1MPP8iiXd8Q8XiS2gRziRRRac9bGVQmUCalRfjsCcM5a9H7RmthycydUo+nhdWuk1GhTTx99srCFaSvMJIppLLSF4KBoLd0i2E1ZVddILrg3p23kY8PAV0xcIx5TL5F7ZnQmsH0ASU4i/R+dDLgTL1ssE2beStYeRgGCz5Qs79rDBFe8PPcQCnLulTfoyZMD+0viUyRGbfaIc0i82BUjdQJ7JVwnGHYbyVnHeDGOkw5zcP5wckoVPUhnT0YN1PatyMTus/d7Y= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2019 08:09:09.1082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3e0922e-52c0-4a6c-8a3b-08d6f87b3c13 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: BY2PR03MB554 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-24_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=819 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240068 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver limits the user to use only 4/8 differential inputs, but this device has the option to use pseudo-differential channels. This will increase the number of channels to be equal with the number of inputs so 8 channels for ad7124-4 and 16 for ad7124-8. This patch removes the check between channel nodes and num_inputs value. Signed-off-by: Mircea Caprioru --- Changelog v2: - nothing changed here Changelog v3: - nothing changed here drivers/iio/adc/ad7124.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index 659ef37d5fe8..810234db9c0d 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -462,13 +462,6 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, if (ret) goto err; - if (ain[0] >= st->chip_info->num_inputs || - ain[1] >= st->chip_info->num_inputs) { - dev_err(indio_dev->dev.parent, - "Input pin number out of range.\n"); - ret = -EINVAL; - goto err; - } st->channel_config[channel].ain = AD7124_CHANNEL_AINP(ain[0]) | AD7124_CHANNEL_AINM(ain[1]); st->channel_config[channel].bipolar = From patchwork Mon Jun 24 08:08:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mircea Caprioru X-Patchwork-Id: 11012591 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 C6E7613AF for ; Mon, 24 Jun 2019 08:09:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8173212D8 for ; Mon, 24 Jun 2019 08:09:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A90DB286DE; Mon, 24 Jun 2019 08:09:43 +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 36F98212D8 for ; Mon, 24 Jun 2019 08:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbfFXIJi (ORCPT ); Mon, 24 Jun 2019 04:09:38 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:26084 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfFXIJi (ORCPT ); Mon, 24 Jun 2019 04:09:38 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O88OsK025039; Mon, 24 Jun 2019 04:09:18 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2058.outbound.protection.outlook.com [104.47.50.58]) by mx0a-00128a01.pphosted.com with ESMTP id 2t9h86cqsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 04:09:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNYzvT/mGJb3/s5VvR0c7fd4Un94IaKTvvKGGRqzskY=; b=FfEQs9q7y5cWjTGa7TTKQmk0wc5c7sEh+n9tjNcRxt+WwnWJr/80XZf5bWE1F1jpoHh8IxA9vWnmyWCNh/RmFInlFKP9+Sr0REIHhlN8A/WMSbOkGvrX+uo/4aSTd0jKqTcshRyEL42bq02F8l1xdzT83NjSpEBi9bjfDBHecc0= Received: from BY5PR03CA0015.namprd03.prod.outlook.com (2603:10b6:a03:1e0::25) by BN6PR03MB3122.namprd03.prod.outlook.com (2603:10b6:405:3c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 08:09:16 +0000 Received: from BL2NAM02FT014.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::209) by BY5PR03CA0015.outlook.office365.com (2603:10b6:a03:1e0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.16 via Frontend Transport; Mon, 24 Jun 2019 08:09:15 +0000 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 BL2NAM02FT014.mail.protection.outlook.com (10.152.76.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1987.11 via Frontend Transport; Mon, 24 Jun 2019 08:09:15 +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 x5O89Fn1019154 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 24 Jun 2019 01:09:15 -0700 Received: from mircea-Latitude-E6540.ad.analog.com (10.48.65.115) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 24 Jun 2019 04:09:14 -0400 From: Mircea Caprioru To: CC: , , , , , , , , Mircea Caprioru Subject: [PATCH V3 2/5] iio: adc: ad7124: Add buffered input support Date: Mon, 24 Jun 2019 11:08:42 +0300 Message-ID: <20190624080845.18537-2-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624080845.18537-1-mircea.caprioru@analog.com> References: <20190624080845.18537-1-mircea.caprioru@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)(346002)(396003)(136003)(376002)(2980300002)(54534003)(189003)(199004)(48376002)(478600001)(7696005)(51416003)(50226002)(8676002)(6916009)(72206003)(54906003)(4326008)(316002)(36756003)(11346002)(8936002)(7636002)(106002)(47776003)(26005)(186003)(16586007)(77096007)(50466002)(86362001)(76176011)(107886003)(44832011)(1076003)(5660300002)(305945005)(2351001)(126002)(426003)(2616005)(336012)(476003)(486006)(446003)(70206006)(70586007)(2906002)(356004)(6666004)(246002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR03MB3122;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15341d5d-a136-4c00-bb80-08d6f87b3fc1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:BN6PR03MB3122; X-MS-TrafficTypeDiagnostic: BN6PR03MB3122: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-Forefront-PRVS: 007814487B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: zlts/OnNcd8PQlBAMPZQNWgXuQ69FhJlCORVLlgG9mMslCs/qP+R8oAb3SiMdMR/E/G7s49JXmOz0I5iJZDtKVlv8cZFNK0elUQ2tPpjRJ+enevjlKW3oLzpdvRCQh2jhyuOS9dy5847E8jg1LIUXE6W1r+nZ56R8X3EE+0zeEicItHyjMDsKT0otQdsV973J44ZI3DlI4XWwTNctxZ+I6HK8Rs3evxK9sjN+wtRA8K4EuxefeQJSyrIE2Kb0k8qS2/XfZuVBTUTfjP/++t4GF4zty4tCz1nEKs20OGrjppajT1wrTlmcctiEv3ZdASuPkXAZisV/m0anFIUBrZG2owsXsAfqHwZMnuiW5l00RJ/77SXOSK5qAPozDB/gWIdbF9t9qodpISrJXuM99JSGWsjylPKzTq0Q+YwieKQgR0= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2019 08:09:15.2829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15341d5d-a136-4c00-bb80-08d6f87b3fc1 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: BN6PR03MB3122 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-24_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240068 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 adds the option to enable the buffered mode for positive and negative inputs. Each option can be enabled independently. In buffered mode, the input channel feeds into a high impedance input stage of the buffer amplifier. Therefore, the input can tolerate significant source impedances and is tailored for direct connection to external resistive type sensors such as strain gages or RTDs. Signed-off-by: Mircea Caprioru --- Changelog v2: - nothing changed here Changelog v3: - nothing changed here drivers/iio/adc/ad7124.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index 810234db9c0d..ab52c5e9ecb1 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -61,6 +61,8 @@ #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x) #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0) #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x) +#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6) +#define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x) /* AD7124_FILTER_X */ #define AD7124_FILTER_FS_MSK GENMASK(10, 0) @@ -108,6 +110,8 @@ struct ad7124_chip_info { struct ad7124_channel_config { enum ad7124_ref_sel refsel; bool bipolar; + bool buf_positive; + bool buf_negative; unsigned int ain; unsigned int vref_mv; unsigned int pga_bits; @@ -473,6 +477,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, else st->channel_config[channel].refsel = tmp; + st->channel_config[channel].buf_positive = + of_property_read_bool(child, "adi,buffered-positive"); + st->channel_config[channel].buf_negative = + of_property_read_bool(child, "adi,buffered-negative"); + *chan = ad7124_channel_template; chan->address = channel; chan->scan_index = channel; @@ -492,7 +501,7 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, static int ad7124_setup(struct ad7124_state *st) { unsigned int val, fclk, power_mode; - int i, ret; + int i, ret, tmp; fclk = clk_get_rate(st->mclk); if (!fclk) @@ -525,8 +534,12 @@ static int ad7124_setup(struct ad7124_state *st) if (ret < 0) return ret; + tmp = (st->channel_config[i].buf_positive << 1) + + st->channel_config[i].buf_negative; + val = AD7124_CONFIG_BIPOLAR(st->channel_config[i].bipolar) | - AD7124_CONFIG_REF_SEL(st->channel_config[i].refsel); + AD7124_CONFIG_REF_SEL(st->channel_config[i].refsel) | + AD7124_CONFIG_IN_BUFF(tmp); ret = ad_sd_write_reg(&st->sd, AD7124_CONFIG(i), 2, val); if (ret < 0) return ret; From patchwork Mon Jun 24 08:08:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mircea Caprioru X-Patchwork-Id: 11012593 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 7FBF513AF for ; Mon, 24 Jun 2019 08:09:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74271212D8 for ; Mon, 24 Jun 2019 08:09:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68289286DE; Mon, 24 Jun 2019 08:09:47 +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 00D25212D8 for ; Mon, 24 Jun 2019 08:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbfFXIJq (ORCPT ); Mon, 24 Jun 2019 04:09:46 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:30298 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfFXIJq (ORCPT ); Mon, 24 Jun 2019 04:09:46 -0400 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O88SMH006110; Mon, 24 Jun 2019 04:09:25 -0400 Received: from nam02-cy1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2053.outbound.protection.outlook.com [104.47.37.53]) by mx0a-00128a01.pphosted.com with ESMTP id 2t9e63cwwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 04:09:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xNZ3hPJROK9jkkVwQhmEw11XkqP4EWF11iSxK1IAjlQ=; b=tw8MfGam/6Yb+8Cu0nJk2FhDcj51kB1JiHvuhriLZkxF76y3KQtKvIG210NZh169fquupPNY093Swrh+EJC4JG8qcK55yKtFS6SUQTI0yTraZ+v5UJut7gp9rvHzY4C4etOoXa+kt8W1ZPON8AVzkjB/mblISgHDrRSVO8SfErc= Received: from BN6PR03CA0118.namprd03.prod.outlook.com (2603:10b6:404:10::32) by BY2PR03MB553.namprd03.prod.outlook.com (2a01:111:e400:2c38::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 08:09:23 +0000 Received: from CY1NAM02FT033.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by BN6PR03CA0118.outlook.office365.com (2603:10b6:404:10::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16 via Frontend Transport; Mon, 24 Jun 2019 08:09:22 +0000 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 CY1NAM02FT033.mail.protection.outlook.com (10.152.75.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1987.11 via Frontend Transport; Mon, 24 Jun 2019 08:09:21 +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 x5O89Kba019170 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 24 Jun 2019 01:09:20 -0700 Received: from mircea-Latitude-E6540.ad.analog.com (10.48.65.115) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 24 Jun 2019 04:09:19 -0400 From: Mircea Caprioru To: CC: , , , , , , , , Mircea Caprioru Subject: [PATCH V3 3/5] iio: adc: ad7124: Shift to dynamic allocation for channel configuration Date: Mon, 24 Jun 2019 11:08:43 +0300 Message-ID: <20190624080845.18537-3-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624080845.18537-1-mircea.caprioru@analog.com> References: <20190624080845.18537-1-mircea.caprioru@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)(39850400004)(396003)(376002)(136003)(346002)(2980300002)(54534003)(199004)(189003)(246002)(11346002)(86362001)(50226002)(77096007)(186003)(6916009)(16586007)(72206003)(356004)(26005)(14444005)(54906003)(8676002)(1076003)(478600001)(8936002)(76176011)(2351001)(4326008)(50466002)(51416003)(7696005)(316002)(2616005)(5660300002)(336012)(48376002)(6666004)(106002)(446003)(47776003)(70586007)(44832011)(7636002)(305945005)(2906002)(36756003)(107886003)(126002)(486006)(476003)(426003)(70206006);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB553;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9538ba3-1261-4e97-1620-08d6f87b4399 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:BY2PR03MB553; X-MS-TrafficTypeDiagnostic: BY2PR03MB553: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 007814487B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: YHmSvMJ97rxg7J/th8r1MNT6x7z6W9palsywznJvITwBFlFzaZyVX8ioY4dQjnMO1hDc9zwBu0Y2/BPF+WzERtWLdaQenPOv6BagTeU11lTpt2wxOI9p0B8P1Jl4KtFxgUlVTEbGlV5KHKtQ++c7miNN5VQEdVuvr0fSEqKa5yfU/cRyhu00Jh/L11B6yUZZa1m1rGo96TvrWERmOgdGzybxkS1sqcdf0iKaQJtRRjC2LRTZ3mRjx4qH+vTejNfOqMNyKI2g0koILrouQrC5ofPKNmEeBMBb4oRHsuwsmdnBlEu4tbb2FJ/z2jFmWyHaHyIeJ/cVerenO8ifhYneb+KjV0oAzEqmk8v/V1ptMbg9lRBpA+uHZ3KURnyR1aEqD5cesPFXfIViuZnARchXTOTnsBZ4dPM1qJxK96bxuKw= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2019 08:09:21.2839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9538ba3-1261-4e97-1620-08d6f87b4399 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: BY2PR03MB553 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-24_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240068 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 changes the channel configuration member of the device structure from a fixed size array to a dynamic allocated one with a size equal to the number of channels specified in the device tree. This will ensure a more flexibility for compatible devices. Ex. ad7124-4 - can have 4 differential or 8 pseudo-differential channels ad7124-8 - can have 8 differential or 16 pseudo-differential channels Also the device can suspport any other combination of differential and pseudo-differential channels base on the physical number of inputs available. Signed-off-by: Mircea Caprioru --- Changelog v2: - nothing changed here Changelog v3: - nothing changed here drivers/iio/adc/ad7124.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index ab52c5e9ecb1..edc6f1cc90b2 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -121,7 +121,7 @@ struct ad7124_channel_config { struct ad7124_state { const struct ad7124_chip_info *chip_info; struct ad_sigma_delta sd; - struct ad7124_channel_config channel_config[4]; + struct ad7124_channel_config *channel_config; struct regulator *vref[4]; struct clk *mclk; unsigned int adc_control; @@ -439,6 +439,7 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, struct ad7124_state *st = iio_priv(indio_dev); struct device_node *child; struct iio_chan_spec *chan; + struct ad7124_channel_config *chan_config; unsigned int ain[2], channel = 0, tmp; int ret; @@ -453,8 +454,14 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, if (!chan) return -ENOMEM; + chan_config = devm_kcalloc(indio_dev->dev.parent, st->num_channels, + sizeof(*chan_config), GFP_KERNEL); + if (!chan_config) + return -ENOMEM; + indio_dev->channels = chan; indio_dev->num_channels = st->num_channels; + st->channel_config = chan_config; for_each_available_child_of_node(np, child) { ret = of_property_read_u32(child, "reg", &channel); From patchwork Mon Jun 24 08:08:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mircea Caprioru X-Patchwork-Id: 11012595 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 242C113AF for ; Mon, 24 Jun 2019 08:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1304B284D1 for ; Mon, 24 Jun 2019 08:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 047472873B; Mon, 24 Jun 2019 08:09:57 +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 57D08284D1 for ; Mon, 24 Jun 2019 08:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfFXIJz (ORCPT ); Mon, 24 Jun 2019 04:09:55 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:34770 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfFXIJz (ORCPT ); Mon, 24 Jun 2019 04:09:55 -0400 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O88Q8X006107; Mon, 24 Jun 2019 04:09:31 -0400 Received: from nam03-by2-obe.outbound.protection.outlook.com (mail-by2nam03lp2055.outbound.protection.outlook.com [104.47.42.55]) by mx0a-00128a01.pphosted.com with ESMTP id 2t9e63cwwt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 04:09:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UGrvOlEX9u3QitbO06Kq6lHDzuClvTJzfxxCJl0BoYY=; b=u9Pl1R+GLXBE9OJPHppK4QEO2c3nLpE36EjIx6NXECn5dtHWYCjFONGxpjjxoS/1klmKYqyaabS2DA4vV98ncW+GeJfzFBs/DidhDSrX6+fY9+ZoKrcM1OM8RyTmZdu8Rq1EruOLneNODa0CrZ7pAopWo/jS6fvogRw+eXWED3I= Received: from BN6PR03CA0084.namprd03.prod.outlook.com (2603:10b6:405:6f::22) by BY2PR03MB556.namprd03.prod.outlook.com (2a01:111:e400:2c3a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 08:09:29 +0000 Received: from BL2NAM02FT057.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::207) by BN6PR03CA0084.outlook.office365.com (2603:10b6:405:6f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16 via Frontend Transport; Mon, 24 Jun 2019 08:09:28 +0000 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 BL2NAM02FT057.mail.protection.outlook.com (10.152.77.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1987.11 via Frontend Transport; Mon, 24 Jun 2019 08:09:28 +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 x5O89SEp019184 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 24 Jun 2019 01:09:28 -0700 Received: from mircea-Latitude-E6540.ad.analog.com (10.48.65.115) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 24 Jun 2019 04:09:27 -0400 From: Mircea Caprioru To: CC: , , , , , , , , Mircea Caprioru Subject: [PATCH V3 4/5] dt-bindings: iio: adc: Convert ad7124 documentation to YAML Date: Mon, 24 Jun 2019 11:08:44 +0300 Message-ID: <20190624080845.18537-4-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624080845.18537-1-mircea.caprioru@analog.com> References: <20190624080845.18537-1-mircea.caprioru@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)(39860400002)(346002)(136003)(396003)(2980300002)(54534003)(199004)(189003)(106002)(4326008)(2870700001)(36756003)(50466002)(316002)(6306002)(50226002)(8936002)(966005)(478600001)(1076003)(76176011)(5660300002)(54906003)(47776003)(7696005)(6916009)(7636002)(305945005)(2351001)(26005)(72206003)(86362001)(186003)(44832011)(70586007)(70206006)(246002)(2906002)(486006)(126002)(8676002)(446003)(426003)(77096007)(336012)(476003)(11346002)(53376002)(6666004)(356004)(107886003)(2616005);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR03MB556;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28ddf83e-2e56-44e3-36ab-08d6f87b47ac X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:BY2PR03MB556; X-MS-TrafficTypeDiagnostic: BY2PR03MB556: X-MS-Exchange-PUrlCount: 3 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-Forefront-PRVS: 007814487B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: SUdh+4nYXjhjXVdfsCA0MTm3hwzAM8dDIxlhUY6kJkDpwou3a1ApEtJunbft8vpDXPeRoA284pHDZjbOUsElO/SQRPiOHzrChCwQ4/DiRj60Lkh4vROHQF7zVOoCu12RQk+cZRNrcMDpQbAnGoP1MEl2U9NCg2TX8HfL2w/Vz8WrbRupGzGpmvfiFozMxcRhyx7sLmVSe9Z2BRDVXMp+HdrNRY6/HjpKnAUF7/eRfsyPMotvZ0Ffm9CGnmKAnLAVTdXq+5/xaPjjkOd/RX+GKUKPmOjgeKgu3W85Ljp+KxjZXMBW14jZoj25XLazqpukV/dE6YOgN6zQ2+wjFybxyY+zZ/5ghXs8Z32KiqZ5beQkBfoo23S9O0qxghQSDCOA+oxZIpGwtgJ0lSDCdqNNkqWcHQTKZ5W0x7dWlk9JVqQ= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2019 08:09:28.5657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28ddf83e-2e56-44e3-36ab-08d6f87b47ac 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: BY2PR03MB556 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-24_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240068 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 Convert AD7124 bindings documentation to YAML format. Signed-off-by: Mircea Caprioru --- Changelog v2: - modified SPDX license to GPL-2.0 OR BSD-2-Clause - added regex for a range from 0 to 15 - added minimum and maximum constraints for reg property - set type and range of values for adi,reference-select property - used items for diff-channels property - set bipolar, adi,buffered-positive and negative to type: boolean Changelog v3: - moved adi,buffered-positive and negative properties to own commit .../bindings/iio/adc/adi,ad7124.yaml | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml new file mode 100644 index 000000000000..1b3d84d08609 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/iio/adc/adi,ad7124.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD7124 ADC device driver + +maintainers: + - Stefan Popa + +description: | + Bindings for the Analog Devices AD7124 ADC device. Datasheet can be + found here: + https://www.analog.com/media/en/technical-documentation/data-sheets/AD7124-8.pdf + +properties: + compatible: + enum: + - adi,ad7124-4 + - adi,ad7124-8 + + reg: + description: SPI chip select number for the device + maxItems: 1 + + clocks: + maxItems: 1 + description: phandle to the master clock (mclk) + + clock-names: + items: + - const: mclk + + interrupts: + description: IRQ line for the ADC + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + refin1-supply: + description: refin1 supply can be used as reference for conversion. + maxItems: 1 + + refin2-supply: + description: refin2 supply can be used as reference for conversion. + maxItems: 1 + + avdd-supply: + description: avdd supply can be used as reference for conversion. + maxItems: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + +patternProperties: + "^channel@([0-9]|1[0-5])$": + type: object + description: | + Represents the external channels which are connected to the ADC. + See Documentation/devicetree/bindings/iio/adc/adc.txt. + + properties: + reg: + description: | + The channel number. It can have up to 8 channels on ad7124-4 + and 16 channels on ad7124-8, numbered from 0 to 15. + items: + minimum: 0 + maximum: 15 + + adi,reference-select: + description: | + Select the reference source to use when converting on + the specific channel. Valid values are: + 0: REFIN1(+)/REFIN1(−). + 1: REFIN2(+)/REFIN2(−). + 3: AVDD + If this field is left empty, internal reference is selected. + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [0, 1, 3] + + diff-channels: + description: see Documentation/devicetree/bindings/iio/adc/adc.txt + items: + minimum: 0 + maximum: 15 + + bipolar: + description: see Documentation/devicetree/bindings/iio/adc/adc.txt + type: boolean + + required: + - reg + - diff-channels + +examples: + - | + adc@0 { + compatible = "adi,ad7124-4"; + reg = <0>; + spi-max-frequency = <5000000>; + interrupts = <25 2>; + interrupt-parent = <&gpio>; + refin1-supply = <&adc_vref>; + clocks = <&ad7124_mclk>; + clock-names = "mclk"; + + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + diff-channels = <0 1>; + adi,reference-select = <0>; + }; + + channel@1 { + reg = <1>; + bipolar; + diff-channels = <2 3>; + adi,reference-select = <0>; + }; + + channel@2 { + reg = <2>; + diff-channels = <4 5>; + }; + + channel@3 { + reg = <3>; + diff-channels = <6 7>; + }; + }; From patchwork Mon Jun 24 08:08:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mircea Caprioru X-Patchwork-Id: 11012597 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 BD5C21580 for ; Mon, 24 Jun 2019 08:10:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B2F287E5 for ; Mon, 24 Jun 2019 08:10:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 967B4286DE; Mon, 24 Jun 2019 08:10:04 +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 22153286DE for ; Mon, 24 Jun 2019 08:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727460AbfFXIJ7 (ORCPT ); Mon, 24 Jun 2019 04:09:59 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:36534 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfFXIJ7 (ORCPT ); Mon, 24 Jun 2019 04:09:59 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5O88Ua3025097; Mon, 24 Jun 2019 04:09:38 -0400 Received: from nam01-sn1-obe.outbound.protection.outlook.com (mail-sn1nam01lp2056.outbound.protection.outlook.com [104.47.32.56]) by mx0a-00128a01.pphosted.com with ESMTP id 2t9h86cqst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 04:09:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5vAb0V8G4Zhq9cQIZ2h83Qt5dk8v6JmrboSu//Ep3qc=; b=uI5nrCFvwWV+eCHjl1fXynnrs/tRe2p30uNgORS2R1SERSEh9fCz4Zmo+zS8CidpFd3OH1cv12GCiPWTEIZ23naDJyadVKrZOX1Vf13wtSmmHgMJgHIG0sPCbSo20XaebYmYEjxDGAp7ez5YVrnj97X892kIW+iPl+s0cnHdPkY= Received: from BN6PR03CA0095.namprd03.prod.outlook.com (2603:10b6:405:6f::33) by DM2PR03MB558.namprd03.prod.outlook.com (2a01:111:e400:241d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 08:09:35 +0000 Received: from BL2NAM02FT060.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::200) by BN6PR03CA0095.outlook.office365.com (2603:10b6:405:6f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16 via Frontend Transport; Mon, 24 Jun 2019 08:09:35 +0000 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 BL2NAM02FT060.mail.protection.outlook.com (10.152.76.124) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1987.11 via Frontend Transport; Mon, 24 Jun 2019 08:09:34 +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 x5O89YeO019269 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Mon, 24 Jun 2019 01:09:34 -0700 Received: from mircea-Latitude-E6540.ad.analog.com (10.48.65.115) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Mon, 24 Jun 2019 04:09:33 -0400 From: Mircea Caprioru To: CC: , , , , , , , , Mircea Caprioru Subject: [PATCH V3 5/5] dt-bindings: iio: adc: Add buffered input property Date: Mon, 24 Jun 2019 11:08:45 +0300 Message-ID: <20190624080845.18537-5-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624080845.18537-1-mircea.caprioru@analog.com> References: <20190624080845.18537-1-mircea.caprioru@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)(189003)(199004)(54534003)(4326008)(6916009)(50466002)(2351001)(107886003)(8936002)(50226002)(7636002)(54906003)(11346002)(426003)(446003)(8676002)(26005)(5660300002)(70586007)(356004)(1076003)(77096007)(6666004)(70206006)(106002)(2906002)(48376002)(44832011)(7696005)(76176011)(305945005)(51416003)(86362001)(16586007)(316002)(478600001)(47776003)(486006)(2616005)(186003)(126002)(72206003)(476003)(246002)(36756003)(336012);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR03MB558;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edd16a5d-d6ef-4153-fc09-08d6f87b4b40 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328);SRVR:DM2PR03MB558; X-MS-TrafficTypeDiagnostic: DM2PR03MB558: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:639; X-Forefront-PRVS: 007814487B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 8iccR4QUWuGiiIvc1koNIOZgRI2No1CRvKWebvgTRwtt0z5oshZwKoIFcKsJD/pOjySiEK4o/Gj7fK+St7+TkocfZq6Orh3qVdZYLW47C7R9lzTlQh9MyXKS9AGhLSvwYwpvWjkqsCfujqn32lr8h+ZcTPf7FW+KSQEnUl7Bmx64PVxuFWApqBTiXGNZxNhsDjdA52EUjl7Gbua+Z4THzwS9nLQKCeURImKiIRLa/lzeYudXQkRdtUTrej6Cz2Pnwwi60LqX5etl8khCmeXlHlnjXkSvJfhfF1RwlrBfT0LhEKuMbhHwx95PUx/cAryXbf4wWXyrB10vZo9oURr464rvMvnupyw7DQAshW4HqZb1tWUTnHgQRB6sNDFh1iMjEt+meHicPR8E00KlxqsBL9YBDkyymuYkxNdJVnh6rIA= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2019 08:09:34.5738 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edd16a5d-d6ef-4153-fc09-08d6f87b4b40 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: DM2PR03MB558 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-24_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240068 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 adds the buffered mode device tree property for positive and negative inputs. Each option can be enabled independently. In buffered mode, the input channel feeds into a high impedance input stage of the buffer amplifier. Therefore, the input can tolerate significant source impedances and is tailored for direct connection to external resistive type sensors such as strain gages or RTDs. Signed-off-by: Mircea Caprioru Reviewed-by: Rob Herring --- Changelog v3: - added this separate commit for adi,buffered-positive and negative properties .../devicetree/bindings/iio/adc/adi,ad7124.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml index 1b3d84d08609..cf494a08b837 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml @@ -100,6 +100,14 @@ patternProperties: description: see Documentation/devicetree/bindings/iio/adc/adc.txt type: boolean + adi,buffered-positive: + description: Enable buffered mode for positive input. + type: boolean + + adi,buffered-negative: + description: Enable buffered mode for negative input. + type: boolean + required: - reg - diff-channels @@ -123,6 +131,7 @@ examples: reg = <0>; diff-channels = <0 1>; adi,reference-select = <0>; + adi,buffered-positive; }; channel@1 { @@ -130,6 +139,8 @@ examples: bipolar; diff-channels = <2 3>; adi,reference-select = <0>; + adi,buffered-positive; + adi,buffered-negative; }; channel@2 {