From patchwork Thu Jan 18 14:57:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10173493 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 A491E602DC for ; Thu, 18 Jan 2018 14:57:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9357A20500 for ; Thu, 18 Jan 2018 14:57:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 873C6223A0; Thu, 18 Jan 2018 14:57:51 +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 DC40420500 for ; Thu, 18 Jan 2018 14:57:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752901AbeARO5t (ORCPT ); Thu, 18 Jan 2018 09:57:49 -0500 Received: from mail-sn1nam02on0054.outbound.protection.outlook.com ([104.47.36.54]:6197 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753527AbeARO5q (ORCPT ); Thu, 18 Jan 2018 09:57: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; bh=kZmN2uDDjIRfoVupMxKGr+NYNMsgwy7LC2WPAjawdaQ=; b=RzSatiDyb0Q7WP+Iv7RnAQOpHNhxvtkr2bx0idcHZCxfWJujqsOydSoo4uZ37gopTJV30etRS+fGMF2qzXHYXWKwX0nQiBG0TRTgO5oxcY+W/lBnDVyoIBZp1N7POTsTMfgo859YdWX85fEna26n/lJQ5cgAV5D9Lix8OzVQv5w= Received: from BLUPR0301CA0017.namprd03.prod.outlook.com (10.162.113.155) by SN1PR0301MB2062.namprd03.prod.outlook.com (10.163.227.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 14:57:45 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::114) by BLUPR0301CA0017.outlook.office365.com (2a01:111:e400:5259::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Thu, 18 Jan 2018 14:57:44 +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 BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Thu, 18 Jan 2018 14:57:44 +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 w0IEvi26022371 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Thu, 18 Jan 2018 06:57:44 -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; Thu, 18 Jan 2018 09:57:43 -0500 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w0IEvgBM002325; Thu, 18 Jan 2018 09:57:43 -0500 From: To: CC: , Alexandru Ardelean Subject: [PATCH v4] staging: iio: adc: ad7192: disable burnout currents on misconfig Date: Thu, 18 Jan 2018 16:57:40 +0200 Message-ID: <20180118145740.5113-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180110111411.18505-1-alexandru.ardelean@analog.com> References: <20180110111411.18505-1-alexandru.ardelean@analog.com> 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)(376002)(346002)(39860400002)(396003)(2980300002)(438002)(189003)(199004)(5660300001)(48376002)(2950100002)(6916009)(107886003)(478600001)(2351001)(4326008)(50466002)(53416004)(106466001)(106002)(77096007)(36756003)(54906003)(47776003)(7636002)(8936002)(16586007)(356003)(246002)(7696005)(51416003)(50226002)(86362001)(316002)(59450400001)(1076002)(2906002)(2876002)(8676002)(76176011)(86152003)(305945005)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB2062; H:nwd2mta4.analog.com; FPR:; SPF:Pass; PTR:nwd2mail11.analog.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD021; 1:odB+0cBxgqgX/rrViaO4i8rOREzNKqdHjIyBi575h8iAPtgQJSpg9JuPI6RtfPdm1PI7Y3YH0cpQ4HxstzyKxrODGgzjSYjUKZcGDbqdXrG6fwBKPiavhAAHGc7L460O X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 56639c09-8968-449f-417f-08d55e83d4f7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:SN1PR0301MB2062; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2062; 3:QBRZLUF8/mnTIJzFA9IbcCxg/EWzapA61QM1ajEcyQvoIOMhaY9kkoOnynlZz5zJ2NMTC8EJSp8GyyBZPeBEYz2VrNVlyBppAJP9CrfRTcjQgSk9Ap21EvBbzBeAAb9TGV9ifEdWub8k02ZQOQn1Sa0gcefZedvSdV4B3vpog0PhMgF94ikObGQC+4fiVPy3a6ed5KDSNDd/bkfupbMLzWC3iKlZKntFLTKjhGaR6wqq7lc1+pTXs4/IHDO3u8gqx9+oM9WHpJyj0itObVGlfQgFcWe4dFqA3b7uc5TGcgYPXkZPzmaE1wWBQiitwmxQY4cJwS0qysD9waKGWbySvg==; 25:CuY4cbBWyylQ+sFgD9AGU5MoVU6aOEX4bgwYTnaq5BbkIZIq/eA/Shfkk4h1WaOcjIKhdLAJ97B7kcvw2T6DsYte5tsPqzXXqUWbzspwQi5LWSVsXu3xR20GJbkynJa9rykUHQVf0OWtxiHISC60xO7k7FHS6bbHA8rN1V8526vFCtrzC+TC3blo4x5u2RX9/4xJnttpfbI5LCaob7WBFbNQM+LXyPDpv8CoZ29OXGxBXsMDFIm7dRVPDHje41BvG+VMPvjfYOaF5BXHdqyl8Kdhq47C9MOuYR315iRedAJ3CSDkUo1HPaOWrixmmq9/0in5LLyQ9nJ7UPgDtwda7w==; 31:T/1x7dsd6EEFXmMiap9Qkj+2kdKZtfbIgeImsmrP9QoJu6hiWJ8YE0fqCc+4JBLYXf+Si5EWVS+auudgQGfEXN1U51NKy4sw3ObQMslcCzewZYqBUwRMb1lDxsft4cdcUzJ7uTjzY2nzG6JZCLkeltlZf78heKo9v7W3AFcxPAuK9DM1f4TD0z3E7gvme/t7ZPZM8OIJ1/WGHl9pG70wAE8ehnkl6tK5BGMFAewkmS8= X-MS-TrafficTypeDiagnostic: SN1PR0301MB2062: X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2062; 20:Q1JHiOrdOC6xpqUi1BBibtyxUtkNqjbl3lOsMDIKwA/o4mMUoPuC8uZ6M0itlRRAUcplcZdE3eUoFmeRP4+H8WB+yVV7UrBQAnF7N7UYz0SylGTDZMDe2pO5fHSjKuLGpi5w3WmFDRr7FutGBKj3tSixLulB9cwZgIxBQYYCNeTAqKRC3sVo3fVyD9yAktPH62rg3FgDU5zO+ZXB3O10Va5F/lp4TzdrC2pyYORgime/lbyd46pih+Bm+CPlvdOnhfv/BpoicH33Mv8dyJ098n4TOd0gQUHeHoHjwDu4uWhSj1DzzsU+MRHNFbuia3S043LNf1De6R/mokAtK4DUlwhqrOgFn34Cc+Q+ggsSc7TC86ECqp/yF9+DcQXkIqK9itB6blUCG/PApm0ifGY5utCldwzhKKZcFq25zh9rrnKb9h3/D4HBTK1HpKBtIigeSWb+vj+ks/N5imFWncPh5woO1KhmT/l9BAVN6P0NkuVpMeZ4E1XFsxNetlOoHYJX; 4:jSULWeAdBMe1lV0ClHsN0r+Qk3msTPYKccfIrbBuyk4YWYa2Es+ydXw+uafO3PSp3PWUJrGeTJu7ti1aRK4b/xezCA3BgzZfOxN2tuNrplpWJ7XebWcaVWkba0BuKMVgjfwZEym4Ms6sCnczwt/p6b0vwtxZHBICFCY63Zvj4VzeuxyfK3oTVVVNo8bM+a1HN++W9Kmel3filHNsF7cGhNV97uO1iSFtgmw3xcITSygjESnpuf1CX6CIGJB+hTjLYhf8raCVJE4Tl3/U5Xqu+xB/xGGlTn25m/1haaTB0lYHaeQhLQxrUsU12VFqwxsse2zo6RudbciB1WdeIz8r8PouwmyufEQa/Gz+Z6zDfYo= 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)(10201501046)(3231023)(944501161)(93006095)(93004095)(3002001)(6055026)(6041268)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:SN1PR0301MB2062; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN1PR0301MB2062; X-Forefront-PRVS: 05568D1FF7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB2062; 23:4kYJwKLPXR1hpP5sG4taD6Pm8uAP/7pUmrCMnB4?= =?us-ascii?Q?gxUAMCOlhUqYnITRAsYcE2z1hdsnzvPoxLV9qnU0TpazH5BQhD8qJak+qgyy?= =?us-ascii?Q?DbFXZStbvjTzR9M8E4FEm5jgaU/Q/BH2z0bhdznPKIG9ezvJUJXUYhom2+lG?= =?us-ascii?Q?Ad6d43DTRV4Y0cTSpTUDhNOMeItSB7Pq6FKhvXnbH6xoP//DnHqNSl8m2ljC?= =?us-ascii?Q?HYHE4owcQjUCWshZ0V6NBYirH39hziDZ7p6venNMbPDZhFkVWbuWqszmxk90?= =?us-ascii?Q?LgZtye0S+MXaObEVuASOdBaYKOJPNXRtTXMO60sET4cvxwhwDgUxotA+WQpm?= =?us-ascii?Q?4ltGY4QDrNxQmUvBJzZ3cYVNTknunB7BrGzz6jnJfKn9JYpeHZOTMOiceleA?= =?us-ascii?Q?GqmeROM8b9Mrw7ReYWrC8kKnUgS4D7/3Qc+0TIctNMNICVX+Glr5GisYSRRT?= =?us-ascii?Q?fF5w7DKJQYE5BzrpIgkN62BF6mCXCQ4JOz/AC9Een1l9xgbXiTnE+v1R1PLU?= =?us-ascii?Q?pM43SI6jjD9nyxb2Upn/3sHh0YjV7v1MEsKw6XBQ5dd2a7pbCYrtH7kjRwnO?= =?us-ascii?Q?qf6utJbZ8aV+mc5PW2UhAR/7XdGhCpY8aTF8w+VcITJIk9XEmNmnvVXoyqeD?= =?us-ascii?Q?+mKve3VSuX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:SBv6Sbk1ZkvwXCHGThhqpM2fEW3OcICneMTKj1Oa0Q9zJTkFtZ1/Wj68OT1Vgc0jOXzOCdEF+hxeVOEl0kZ+K/ZNIQnv/+mWfwmTgYBu9wg=; 7:e/E3VpnhK15s8chbve6nIfyW3TVVRyR0i/ktRj0WZaSFJqTaZAwf8siDrksyyi8r0EKLnmRWMS9IFKK1OcDQMROPRwo3PCHUZnxvHZTiA9r2YvsUH1occcKWi2AJNZYlcTEsJeW0NDVwT6n30x6VGXWcqWE7C8AF0BYnjfJo/93H0xQERH26cLbR9M3NuYEVYPZCpSBZlomoIMEwcK4K11uCRLHt3GU3id2wLMZDgsNA/zyGEiaakhcsZEQ8ROob SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 14:57:44.7777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56639c09-8968-449f-417f-08d55e83d4f7 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: SN1PR0301MB2062 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 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. Signed-off-by: Alexandru Ardelean --- Changes v3 -> v4: * need to check if `pdata->burnout_curr_en` is positive on the else path, otherwise a false warning may be thrown drivers/staging/iio/adc/ad7192.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index d11c6de9c777..9287b50b7870 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -291,8 +291,12 @@ static int ad7192_setup(struct ad7192_state *st, if (pdata->unipolar_en) st->conf |= AD7192_CONF_UNIPOLAR; - if (pdata->burnout_curr_en) + if (pdata->burnout_curr_en && pdata->buf_en && !pdata->chop_en) { st->conf |= AD7192_CONF_BURN; + } else if (pdata->burnout_curr_en) { + dev_warn(&st->sd.spi->dev, + "Can't enable burnout currents: see CHOP or buffer\n"); + } ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); if (ret)