From patchwork Wed Jan 10 11:14:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10154901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2686560231 for ; Wed, 10 Jan 2018 11:14:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1817F274D1 for ; Wed, 10 Jan 2018 11:14:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C47327DA4; Wed, 10 Jan 2018 11:14:48 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 71567274D1 for ; Wed, 10 Jan 2018 11:14:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964911AbeAJLOp (ORCPT ); Wed, 10 Jan 2018 06:14:45 -0500 Received: from mail-sn1nam02on0064.outbound.protection.outlook.com ([104.47.36.64]:63232 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965241AbeAJLOk (ORCPT ); Wed, 10 Jan 2018 06:14:40 -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; bh=QnyPA9/+BJ3Y0aHtI8p+4bsn3Wx0wi5MwSfJsDRQd6M=; b=NosQEcliUwXE8kYg6cuY/QmatZSXralUEhurSK01CmYIik6pwobkp5753kBG6keodvY6T9qJzLpH/RadR2XAUsaepn2q1/jUVfaA84zrIGC9zajRENakAaTaPaHsGLffQ4u8rTO5qaOq5RtSa0pSX79Q52CZ/QBW7mKk2zpSQE0= Received: from BN6PR03CA0064.namprd03.prod.outlook.com (10.173.137.26) by CY1PR0301MB2057.namprd03.prod.outlook.com (10.164.2.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 10 Jan 2018 11:14:38 +0000 Received: from BY2FFO11FD020.protection.gbl (2a01:111:f400:7c0c::111) by BN6PR03CA0064.outlook.office365.com (2603:10b6:404:4c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Wed, 10 Jan 2018 11:14:38 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.57) smtp.mailfrom=analog.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta4.analog.com; Received: from nwd2mta4.analog.com (137.71.25.57) by BY2FFO11FD020.mail.protection.outlook.com (10.1.14.137) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Wed, 10 Jan 2018 11:14:06 +0000 Received: from NWD2HUBCAS9.ad.analog.com (nwd2hubcas9.ad.analog.com [10.64.69.109]) by nwd2mta4.analog.com (8.13.8/8.13.8) with ESMTP id w0ABEaII017038 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Wed, 10 Jan 2018 03:14:36 -0800 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS9.ad.analog.com (10.64.69.109) with Microsoft SMTP Server id 14.3.210.2; Wed, 10 Jan 2018 06:14:35 -0500 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w0ABEYrc021399; Wed, 10 Jan 2018 06:14:35 -0500 From: To: CC: , Alexandru Ardelean Subject: [PATCH] staging: iio: adc: ad7192: disable burnout currents on misconfig Date: Wed, 10 Jan 2018 13:14:11 +0200 Message-ID: <20180110111411.18505-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(396003)(346002)(2980300002)(438002)(199004)(189003)(316002)(48376002)(50466002)(106002)(54906003)(53416004)(5660300001)(2906002)(50226002)(86362001)(16586007)(8936002)(47776003)(6916009)(246002)(4326008)(59450400001)(8676002)(7696005)(51416003)(36756003)(1076002)(478600001)(77096006)(2876002)(6666003)(356003)(106466001)(86152003)(305945005)(107886003)(7636002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB2057; H:nwd2mta4.analog.com; FPR:; SPF:Pass; PTR:nwd2mail11.analog.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD020; 1:Jga3eL0pdCiB8M5Sqlk6qpwoOex/dRRwK/A4BlgiYVl7AHQ2jpigl6RiRnb4u/a+bR/+OaA0jOHkuy5ETcX7yyOPxIRa8A+s+nvHiQSzkHjP0J4UVcZZ11ZyTpt5Ys0A X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae18a365-b66b-4cc9-95f0-08d5581b43a2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020050)(4652020)(4534080)(4602075)(4627176)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CY1PR0301MB2057; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2057; 3:knL3gFv/9TK5ytbAcJQKCnF2U0v02rClfFqjCG8suu91oCpWikFuS4BFQmza7ZhU36JIwi14HyTI7k2n7FwvvNhh2uS/cuovsYPlJ2awPlHFb74E9MpUOleX4unhp4eGEmUc0FYe85UQvk4DZZaMz4kkNBy+0Dpm4YntU+9zThPAMqNin4JR9vMQF/5sbtLR6HvmcEAl72MliodB6sA5c8xC4s1GhrcO+4VQLC8xtPk0YvuK9/+Nc4EKeLMeNk2kQRdwZLcxUzdJRr/Lfoi9RbIvvpUQifKRBMXGuFgN7KY3qAXx1LMFIGcE2liLj2Mxuh/cn7BjhuhIFkYtB9VIpg==; 25:NMDR/emWYC7cRbQZ8CQE5/FUbJT0ZH8ECRUB6DUmUe3djNOdNggvgmnDVxsCSooSFz2quZYf8/I38wEbHtfB73G+GdO5LPgXKQydmY1RxblyM66q3YkHC4piECsQbnMq4woRGln9vJOvYe30+BW7PhqUNee5mYYk5dCQ3L2ZyQPh1hDXnuDtKMhWv6qPLgoILogp5xNqU5GnJQbbrjIYK3u7nrrLVElpfQUkFmNwKAQ2f0/1QA12A+d4SOsW9DDmE7BlZTfuFoCKUnmdKVvhfwh1T5mxASq5IEY+AFuPsrX4aQ/H99h1bvLmjGz1toPVZln1TPercSUgWy/AvWnXlg==; 31:ewZOeP1CoBOpETheuIqngPsIzCxAXvqUpJxAEOqJsLzgsLtQrCGtVniD5P3MKp2kAQUr7dsLM5oov6QK1+Rf+6P7xd8lq8m9Qgu1rV4qOiEQrU7Se/JDTubIika5F8+5uBn05+fQ399xt1vQGGWBWMwCSBfHQhHZOhC8r7rEjrqgp3DXd3hM5HALXAb6STRjZczlqA1SgkoUzONEoZUVzMXRjuBye3UiBNgdFgnkoO4= X-MS-TrafficTypeDiagnostic: CY1PR0301MB2057: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2057; 20:/Tg+u2xuPsPP6nX6KwZaZe31FQkw/bpou39bbfp+pJ515u2P3P7CDcyxg6aufvisJ+PchqZRicyp3YnAh4bF5ZSVvrnv7YR1KOnJ/wXddJYz3/yq5aqcLW0BpioHq1ZYp7fAJWpBabIRGll5w1EhYbpeGq6KbMBdPUWFcbphCcovjF53ZUsovXqklTAzHMkCAZ9l9PkrXd/hH0dQ5GISRFzYZB+pARFvKeODdL0cWv8kQTzEkGV8j2HFZYw6tI7Txo4vTLhUmv3VrLHO2mlik6+pp8CyMRT2quwxjek9zto/ybnLzFWL6PYK/IafuuXGzxcnsUW39x99nWELScRBetwiL2PpnXF7BY3kppPCihQckt6RFOeYBBrUg/PhLgnkTYAyPTgSISv0yymgFevCcsqbAkM6WMhS7knncszZD3Q24Pz9d8bIA88oBZlKsSUURvPgpRz2nHqje/ynUbX1uQlQ6MSPCooA3MwAIdem9cbj5cH+qVnMkZYX/NDNAXh+; 4:5LWQwPcG/3ReyGznMruHdT0vEq1OCrHvua1pJv4Xzf/wFLaVunqflBmaO8p+zkyACcdsuo3YkYweaS76GNbfh1UuTfqhkW6xmI/YcubMVL9GCUBWhbdjx/7JPAN5I7TQJns+JnP2TJ+iMc8pwwKgFJ1+UyDBuW7MrXccNAdYwvOPp9Tbg1UF3zn7eHq0iRIypYM1nSCffTmDkNZ+0JNBhmVlSpXiv4pYXY3evncyuqofM2FJPvL1TbQ/cPXPfHnpY9Vom/KFSLpQT//vPpeHOtXMe7I2SkuujjOGSNpdO8j4npgO6XEyqIkUPVR2o2uk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501119)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041268)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:CY1PR0301MB2057; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0301MB2057; X-Forefront-PRVS: 0548586081 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB2057; 23:kF6whuTdV3P9QSc20TWk2a5C18BlyT1iBNUUM+5?= =?us-ascii?Q?eoRpBy05CpN6y2Au6WPKosjPpaJ9U4F8q8BeQD2JS7BGcb+U/7iNM2iJxVAf?= =?us-ascii?Q?oHXXxCunYBbYfU1pnhcZNcRzQjWHhpRsFIzna5sL6caB/IekDsob5uPQMLbO?= =?us-ascii?Q?SfsNYvYplHlMcPEjuvXRSKe6odyQTLrgXZcz5+dHJY08cg4be4Mf656OooGc?= =?us-ascii?Q?9d1hHfAfx1qTIao+NQXMBAavTuo03BxftRy1tzRYs747j6FbJ5cmZwBYE3G3?= =?us-ascii?Q?4bLgUuu9xicHPgtHK6O3a6IGQyAjZi5UsSTen5jRtddmI81SSXjYEjn0M6Fj?= =?us-ascii?Q?bnwd3HoGif098jjzyJ8LTh+sRG23FaAu73IPdgdBQKHM4JMTK2bvli4+++zW?= =?us-ascii?Q?frpST7FjvVaeb6Cwn6sP4MH0usUXrTzdq+kNHGGmhC9q1edIsWFv90miY4sh?= =?us-ascii?Q?WgUuOfheS2vSXr7aIEOjPVXEs8CG9sGmmbZyQbHk8E6gQyBV4QwmWNuYxFqt?= =?us-ascii?Q?FbVODzanofZGwvu50DOC/D9YSJMdJU7SW4Ljn+MJUlwxn9q9/wCbdB20Q+hU?= =?us-ascii?Q?5NCvm6pUFvIJbq6PrQxpoo4iVSbuUOxiFSI2NHRVjgcLp6p9cV84T7Il91uo?= =?us-ascii?Q?CbVj9SdPumzvj0JZuQwYltvWE/Vl3klp9C2HIynxhzZn76OktdO21sXjqP8Y?= =?us-ascii?Q?QzfRVHws7OgXmVuKyL4/NAE0u2p9PAEW4DdtlP6E00XnUOxz/5BvDXmd/r3t?= =?us-ascii?Q?lzjUvaJOMXnTZA0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Ay4j6tlHiJZDCEsRZFsUUudvSXW3bROBVRvNDUd3Zi2Nu7jEF284aqjnYBGa2mL7ht2T86qKi3ZCnZcFcmOEzSCQ7LrKzg/5wavUYWB44AIVcThtt5sosnd5zGObjfjaGtUP7tyJN+Jzpb3TCm64pCddPoRKjrDy/4p SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 11:14:06.2075 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae18a365-b66b-4cc9-95f0-08d5581b43a2 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta4.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB2057 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 From: Alexandru Ardelean According to the datasheet for all ad719x ADCs, the burnout currents can be enabled only if buffer is enabled and CHOP is disabled. So, if neither of these conditions are met, then we should disable the burnout currents in the driver as well, and warn the user. Signed-off-by: Alexandru Ardelean --- drivers/staging/iio/adc/ad7192.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index d11c6de9c777..7f204013d6d4 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -266,6 +266,12 @@ static int ad7192_setup(struct ad7192_state *st, st->conf = AD7192_CONF_GAIN(0); + if (pdata->burnout_curr_en && (!pdata->buf_en || pdata->chop_en)) { + pdata->burnout_curr_en = false; + dev_warn(dev, + "Can't enable burnout currents: see CHOP or buffer\n"); + } + if (pdata->rej60_en) st->mode |= AD7192_MODE_REJ60;