From patchwork Tue Jan 16 10:04:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10166313 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 306BE601E7 for ; Tue, 16 Jan 2018 10:05:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DDEC1FFE5 for ; Tue, 16 Jan 2018 10:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5250F20CCF; Tue, 16 Jan 2018 10:05:37 +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 A3F5F1FFE5 for ; Tue, 16 Jan 2018 10:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750816AbeAPKFg (ORCPT ); Tue, 16 Jan 2018 05:05:36 -0500 Received: from mail-dm3nam03on0080.outbound.protection.outlook.com ([104.47.41.80]:27808 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750812AbeAPKFe (ORCPT ); Tue, 16 Jan 2018 05:05:34 -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=pCE6bHK4roGIrA3FwMSVHIzPLJqWgWuBEP9v7ULHP1A=; b=UQuB2FGMnTDUY/OHABanHQNCyNRk4ZH8OvYNz02gONHudIErYsGP/UuSwz1nuOELevcqELFN5bKtchlTb4TLHKWa2ziPatutLPuBGCObueFmXiMdVuVjdOfwuPuBL9Y2IcNSIsT4ZOQntLcFJWaj15/AL39/eJ5+0VWc5qkiUug= Received: from BN6PR03CA0056.namprd03.prod.outlook.com (10.173.137.18) by BLUPR0301MB2049.namprd03.prod.outlook.com (10.164.22.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 10:05:32 +0000 Received: from BY2FFO11OLC002.protection.gbl (2a01:111:f400:7c0c::150) by BN6PR03CA0056.outlook.office365.com (2603:10b6:404:4c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Tue, 16 Jan 2018 10:05:32 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) 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.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 BY2FFO11OLC002.mail.protection.outlook.com (10.1.15.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 16 Jan 2018 10:05:32 +0000 Received: from NWD2HUBCAS9.ad.analog.com (nwd2hubcas9.ad.analog.com [10.64.69.109]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id w0GA5VhB001420 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 16 Jan 2018 02:05:31 -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; Tue, 16 Jan 2018 05:05:30 -0500 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w0GA5TMY019703; Tue, 16 Jan 2018 05:05:29 -0500 From: To: CC: , Alexandru Ardelean Subject: [PATCH][RESEND] staging: iio: adc: ad7192: disable burnout currents on misconfig Date: Tue, 16 Jan 2018 12:04:37 +0200 Message-ID: <20180116100437.10220-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.55; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(396003)(376002)(346002)(39380400002)(2980300002)(438002)(189003)(199004)(50466002)(246002)(36756003)(48376002)(8936002)(86152003)(47776003)(53416004)(305945005)(7636002)(5660300001)(86362001)(26005)(478600001)(356003)(107886003)(16586007)(59450400001)(77096006)(6916009)(2876002)(50226002)(8676002)(2351001)(1076002)(316002)(54906003)(106002)(106466001)(4326008)(2906002)(7696005)(51416003)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB2049; H:nwd2mta1.analog.com; FPR:; SPF:Pass; PTR:nwd2mail10.analog.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC002; 1:Hkg6R5GSiecVIEmuRkbDgUhFHzvmeocjuJJFRFcmbWhjER2GHajASKB+bbe5LnOe1C6zHagzKdq+IGZDlBziX0VrNWCy9TweX3AcMVI9NA1uV7uk9dS4KvJ75jgQzyVX X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0d0e5a4-374f-4ef6-fca4-08d55cc8ade3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BLUPR0301MB2049; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2049; 3:uGd+BJE62kgM4tK+Zq6SltApvttvEn1IYQYJzSjcp0VjwzHaM3ApG1RN0O4xpmbAdtvxMjX6REVgdbJ3xIQRjHgu6B2c7hs9P6lr6S4uCaljgn+oaDNxRQbwdgHGEHRnj7V/CQD8pfj8geZXtMRCzuFhLME6HH9rrxK2TSeJO+Re+u7W3b/6/4WwfOtQeHJ5yABd9gC4L9guSqxE+TwZt+WUFMn5JcHBDaCu3ydb/1AyHImZ8J2DDGFQ5IhZzvRERMa4S+d5JuOvmTvE28Y1NO1ANQnCfyBfunV4juIAhj/JtkVKf1/QypRLBxvsN5bw/I92I+X3Mti3s5pcUAxvQg==; 25:iomXPHQC/YYAeePxRZaJsA0v/ILproCvT+Zdn/TSL56SdbY2KbfRyrol+7MZbxyr9ZYhuDC2rNAGYXTq1z2X5ceee6uBc4e+F58J5HJmiur1uc0wDrA+fxsHF0HzRXZoC2dfUrxJS2FMMTfDzF0VWsX+0EtTMhO3y+fBgELXqQZICo4J6b0KyD6ef+eFLW7q8IXWbbNEV/ipLWNPve0uEKWCZg3UBJHliEEAx9ozqbkHbaZB0GNo1cfr9zSBH8CJRbkXHxt9PvlVUx9VaxEtxp/WtSFRA9VvSp1Zyc8zh7S9uRrSLJ84WxZclTPlwM08dBW4Mk1RHtqm5NAwQ0F8Jw==; 31:VxpGOfCuOOW7DuK/0nFfSuEgHgCVVKPuiNA0aVpkCXwNPaBgGCzAnmliixlpFDjJ5KnwTozmxX0yw6Jfb8GmjXCO1yIuilIkyCT6339Y+YIgzca9OEglaRsrykOzAH7GmNGfX/PNq08bvGiU65Bn8hWkVbflpfMA1I7THnGdQY8SNHLeVOdSl897/O9eqE2yqeVKMmzR2gVEBIj3wLVUYHFLOT7kwAMVobHJkRvUky8= X-MS-TrafficTypeDiagnostic: BLUPR0301MB2049: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2049; 20:774xlrprXh6GBfY3mAc9LweaIUG4aN89tOC44T/gKDJsw1prkQdv6vi0HgUgCVE9nes96UCgzhOb28jh788G7G1KyDBdE/faeMsdVe0nRIFhwphWvG5fFnwsBNEvUrCxxwwGc4NQJHfnLDO//MXH7FH47hDhMXEehujUmhgsekqEngDVuWOGbXSgRH0K3aSO39a/2khObQXcnYRY4hTxmj4Msk5eoXys5qj3B2oUZJZ31PFr0RwhZ8iKSLjGEzE1Q92u5BtQk7oj0uN6EBUxfLC6AxFf00rmswKdACURrx5C+8zjW4gIDnm/POaI0BL5kGjlamaosx70xNBf+LHzHTHUCn99NBGRSxOREETKvQ09Ln7LjPz7xwcaHbOa/jQporXG4wEPFncd+UtfsDpaAWGTwOlGk/LxqZsC6VCkg+07DAahCVKM1Q/dvlX3DcgfFvy88AS+BtL8E3ykT8FSYT9PAvsTcGJfSGSCVPGADe54BepC57FZyPhKc/+5oT35; 4:ocu773kAdiH9Vxw/uPLX1/9DObyhkaIB596xD3PHEEuE2G8x1x4svo1K69Ldu77K0cVsDk2j1Molqw6fwWWO5QQDhBY0cVExA0RP5bKmlwGdBpqZyZASFu/Cey21spqd87TS7jMQY/a52LKsAXY73sX29uxbfK0cHis7G2MH1LsHoKTWMWPYyQpXMDWUfHKit8J4MbuSsHF3g5jr1SfF3aiI8qgbWTYWm2G/jPArdeSOmpdv1POBtq5SJB5iy+YvcGNQOcBZUfRdJajyD2zJ4xWExDaqPr/x3WnEVfiD8S5s+aFAEv6g/MxJyf08V375m6ZwZUgNghqT4BtLDjBOYjJdyqHZ9ns2JID48iOK8zc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93004095)(3231023)(944501161)(10201501046)(3002001)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:BLUPR0301MB2049; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR0301MB2049; X-Forefront-PRVS: 0554B1F54F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB2049; 23:jHvfxSKP4Qy9gKijNfzXExUPRUqWaPGPo5oSMfq?= =?us-ascii?Q?TUT5F0Q+e/6b7MHQYSFFz6a6rf277G2gRiMA5lDUTvfZIVKXuO7hF0ymptOT?= =?us-ascii?Q?noWOqH7f3JjzhMjUa2O+D8mzJHA+b3gNM1qerFnJjbjHjuUSpMv1CfU428yL?= =?us-ascii?Q?yzbCdc0DXcM61IueiIOaxNOL1ZrxG7QrVy9qRaSXT3i8BvnTS9AeHmpqLxsI?= =?us-ascii?Q?HTudpuVbqAWwrfgSgbkKJDpSAG0gb7ij7frNdJAU/zRycS0qAjag30EGR/Kt?= =?us-ascii?Q?5p4qulsiRHojrz2q1Y1c+iKc9mt6wRwe93VwFAkOzV8XPACts18Tn2yZvXXR?= =?us-ascii?Q?IJtj3HfjRyHZ56qL0HHNEEtHxPhEObIEgLWpG2NsBQQ00skKwqntSyi6G3/x?= =?us-ascii?Q?52y62ipzfQN3qVidesbpvun9ZbfS27jgmMDGzYEX3lJd6dQakbI5q/9Yc3OY?= =?us-ascii?Q?ldJgzopEnMnPnwzNZCwVXcN7fbjLIMS0bEdzbmdEK6ZbPolNjX/R8jeh73wy?= =?us-ascii?Q?JqM8+iclt+MtabwKt01lQDAz9FMSsIiI0zhGZBYe6gZuWuQf1y7peDMIbPnX?= =?us-ascii?Q?w7jRbylnJ43NdWBnf2s6RmZkweTn/iQ/uYIQOeBQI7fZ5fXQFIZPql1qwuwa?= =?us-ascii?Q?SEUU8qwpcN/A8T4mNauqSt0m3QtXQ24kKSuX6XmA3l4onSx3wb1jzlGprSSc?= =?us-ascii?Q?54izy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:3l/meUUuo3BP3wYWWolTFVCfot2o1ZlijadPtFQ8VEV8dDdCtzaSjHIriieuLEdY3BdVqQQOIPNMaVrxlLznqo+MwaCAia+4NwHLngJoskZmtzNnFeEbr8llb0f7oA9RanTDZXI922T4X80jPmoZ/JjUguCsoLaDkF9VvAzt/zwMRn6gX5tqpzwy/WYfgE9zy9IynjF2HSQB1HsVJIXInh4ZED42nW//coeJZsJ6FowcoIGCFsYkXkrao46OkYov SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 10:05:32.0131 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0d0e5a4-374f-4ef6-fca4-08d55cc8ade3 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: BLUPR0301MB2049 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. This change doesn't fix anything. The burnout currents simply won't work if CHOP is enabled or buffer is disabled. The intent is to provide the user with some feedback instead of silently not working inside the chip. This is especially useful when considering device-tree support (and/or device-tree overlays) at a later point, which will allow for a quicker/simpler reconfiguration of the chip settings. 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;