From patchwork Thu Jan 18 14:38:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10173399 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 8FDEA60230 for ; Thu, 18 Jan 2018 14:38:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79AEC2018E for ; Thu, 18 Jan 2018 14:38:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A01624B5B; Thu, 18 Jan 2018 14:38:31 +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 86E3A2018E for ; Thu, 18 Jan 2018 14:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932642AbeAROi3 (ORCPT ); Thu, 18 Jan 2018 09:38:29 -0500 Received: from mail-bl2nam02on0088.outbound.protection.outlook.com ([104.47.38.88]:4368 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932601AbeAROi0 (ORCPT ); Thu, 18 Jan 2018 09:38:26 -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=/M4gbbMbgP8owUdatkzJSlrw7H8484sXo2UykKweLvM=; b=VLS2UKpvSQAmIWzKRuSzslqn+A/5aMI8PJym8OgJ0AdgJB7BkkaH4LbwNEobnpFkcvieQlNtBBKXGcgCV694R1nqKvkB5ltiVAC0tfVXKIDFxO/98RxFNMmRt5mXTXrvuXL1IUKm4dfCHF9bSPih3+jzVXhxa/L1suvbCqP8TSg= Received: from BN6PR03CA0073.namprd03.prod.outlook.com (2603:10b6:405:6f::11) by BN1PR0301MB0689.namprd03.prod.outlook.com (2a01:111:e400:5a::26) 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:38:24 +0000 Received: from BL2FFO11OLC015.protection.gbl (2a01:111:f400:7c09::129) by BN6PR03CA0073.outlook.office365.com (2603:10b6:405:6f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Thu, 18 Jan 2018 14:38:24 +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 BL2FFO11OLC015.mail.protection.outlook.com (10.173.160.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:38:24 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.69.108]) by nwd2mta4.analog.com (8.13.8/8.13.8) with ESMTP id w0IEcObO016248 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Thu, 18 Jan 2018 06:38:24 -0800 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS8.ad.analog.com (10.64.69.108) with Microsoft SMTP Server id 14.3.301.0; Thu, 18 Jan 2018 09:38:23 -0500 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w0IEcMsQ001311; Thu, 18 Jan 2018 09:38:22 -0500 From: To: CC: , Alexandru Ardelean Subject: [PATCH v3] staging: iio: adc: ad7192: disable burnout currents on misconfig Date: Thu, 18 Jan 2018 16:38:19 +0200 Message-ID: <20180118143819.18999-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)(39860400002)(346002)(376002)(39380400002)(396003)(2980300002)(438002)(199004)(189003)(2950100002)(53416004)(86362001)(246002)(2876002)(4326008)(107886003)(106002)(26005)(77096007)(356003)(51416003)(59450400001)(16586007)(76176011)(36756003)(48376002)(5660300001)(50466002)(106466001)(478600001)(54906003)(316002)(86152003)(2351001)(8676002)(2906002)(305945005)(6666003)(8936002)(50226002)(7636002)(6916009)(7696005)(47776003)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0689; H:nwd2mta4.analog.com; FPR:; SPF:Pass; PTR:nwd2mail11.analog.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC015; 1:91j7HOb8TSDCxlfnifOMRu0I6N/957MOvyE1xbk9ZeZEtSLyHKZlG5nisZgpMbGtHQwlDobtER6SM6OVngFwS9/WmBZJA1CbddzqWjVLoWvAJg0jpvFTDbezAKJNGJLG X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0bd16298-ee6a-4e03-b2ca-08d55e812159 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BN1PR0301MB0689; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0689; 3:AAC+vu29SdfNcmK6Q17Uz0+kgOjje5j9KuDXUHjlsNTB5rrGcRWWGZpBmj2nf+dpo7A+aVPCTPx1+YkBTdemCvkn4gQ8JvMwnHzq2ocIEQ8XgdGw4hcjogkUZ3DXhgUqka1c0hMP/chHor5GIOTSrNX0l1qGeboRH0nllB7lFUuJUPCjKe2LEVHBb/7+qCf4mrAqi92Lv5EwpLItd19r28b+odNYH85u8Q6qeO5NIZ0m+S6kMIJmWEFsm1rU2mIVq1IAArLdA0xAWLUscE3tEvax5cT+LYnnHuphIFoP+3qW1rzYEjxzYO5TnbIcrt0ZZjops5b/VGNvvxKw/KyCOw==; 25:5TJMOz3wfeDCJN6URmLzOJ3nHaTgxfxdeXcrE21T+SzGhkphXGD9rqiS2s95X1N4I7JHu6SCpizD6c3UE4jwM+1j0qrWa8dLReC/FsY0GLFDk0AWAvmyVC69Vtwg9Vl3s86uFqxb6vngGkWrgb7LTaU8OcmNDA/R/ja78KAOl/NzmfWNg0vTKzvFXaCyMEVIy6aUf2b4YmPwUBxAO049oaxz4DW8bL5nAW1LHI4AiEbHrSBgXl3MwaKYPVqo79bUUk3CtLdkY79OJwyVAMXv7yjqNiqAp6ZoXOahVV344PXSogQgV51lTp8ef+AXTgDirShla/gXvzyOaEjhbfzHjA==; 31:0qinhW0oErYRUtF7AYdUAI9KxIXpEB3OlHFQEbOMzzQCOcdbOC3QYwMIIQlYflXZjBEm80IG+52x8916mOM5Hg8mskx2ndICyWTJ97ErcFqPvECqndMWtIOqRqtPk2aUy1X+dbDAXhCGUrNEQyP+lciHDCQQ17JWL/k6J4AR2WCSQkiuzc1dWq1lcEW8xTXL724UzUd3q3a3ZhfQjiN2SlO2BUL50OyHiHxSkKcgwes= X-MS-TrafficTypeDiagnostic: BN1PR0301MB0689: X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0689; 20:Ko6PrJmb8ZTniTj5zfT0po0czCsmu5U3byaeW7oVdTltHpVlh+8WkxobHnbvbY4PwL3CA/waI54rqw0LmxjqZYqBAmLzHYs2zBM3oTtuulE6MPsIn6GQdgpYWuFjcyz5nYHOqDZNRiyIblyus5edIB32aShewcHfG2ESPdYUxIpMKHx+XwsT0LjmWxRS3nREltI5dR+7RoAJXa3J48FWRrlkA9/gtJxXG0T5paG7rdBwkB7+lHsV99uIaqtLL0SEx3ICoo3/kHEluUK1lNadDelg29pBznKSQLuqUaNzYU8Sg95EDWgRDKYqcgwTyvMw/4hC39ljFpbdqZ92LX5IQcxPNWivetwZtQTFv4JMLWQuAiCtJZyramdXkZeO4xFujnZWCEGA20lS4g4DwKv+ZVmtyCsWG0rdvk9+2XUxKlrTZFVlIazEoNnlbGoFpw4pMUcrAqG7V0uxfCDkPbe4m8oUCZ6V/+iXYYeRgk/L8RdAEk5CP6Osuf6Uud8cK5H6; 4:cUL9YMNG/wkoY0ZqzTNsYXpLTTVi3FFWtafIOjZmwZOl7GlvHHP/Tkzk3ZkFXVIQOng9un4nUEo9nbJRLtf2JpD4qKGLzAlK4X1wOqhq2+TJih61lxDsrGKGVt1kxDVFPYRaofMNVrAbaKJvTZVhyUhXRbrxQ67HB53SxYsOl+hTA4J+xL3DSCoduUr5kL6Qu69EXDCZhk7R5452v9F6QLAHbPrNxVvlixf4/RX7ANZsAcwxC9fSp3YfeVL/HSje8qMlIkAcEUgXAiJ28F8I08ZGvwBm9AkbL50hNaLCM3RszMvTNo4Iekuaepp6LkZmQz+VywV6Kyam9V8qninriMzKZ3OQrrOVTF6t7nkeGXQ= 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)(3231023)(2400063)(944501161)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:BN1PR0301MB0689; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN1PR0301MB0689; X-Forefront-PRVS: 05568D1FF7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0689; 23:kPf9NBa5C3rQbyiRRXOG0CNEcWtdDDRPPdmMvH9?= =?us-ascii?Q?zeCEFZph7uhg39NhFMSFFsl8CKuIAuOUqP0JJd5Un+M7fmHxhvBnNcQu9TVj?= =?us-ascii?Q?F4Wyxgky297p28a17fTM8m4soAChLv+JU8N7i1RboO2A8Zrzy3JZstGODr09?= =?us-ascii?Q?SihAK6mJANZVhoQzejZYbfh8DBtcOXvCe8WLGrEh9lCXA+SK5JmsHye6qoLQ?= =?us-ascii?Q?9SoDnU+WuNolHbU6VUR9iMoGSuxfAvt/qmJi21zepUsqWV8aycE6cdWYgkx4?= =?us-ascii?Q?LXkEWTlykvm6E6WAUrpjqSgUx9XTsd5o26c4tMQmE0zC/Daxl4civPxqbCTK?= =?us-ascii?Q?PZPmKLyAXnVnASL49Zlo0/9kT5GycWfqhlSjU3dso7usTokfNSJqYE7d1+oz?= =?us-ascii?Q?DJ8Ubh28yy9EUDffL94S9bXPM/hMdiQnVPAJG8qiYQmywFb0MB7BRwpHpKJm?= =?us-ascii?Q?k376l2VRsRqFVuQbgk8UiTfM8wdTQqcJXupWR73fbdqMlaX7FJKDpNOU8jKh?= =?us-ascii?Q?g7J6T6bPAUEfiyzAFXhpn3bUgAQK0+GXDQHK0TF3w0QyYZUp1pP6YePMhwcF?= =?us-ascii?Q?oEUnXUzzFO/c4YG904/KTPcDrDx94KUvG3tuC1Lo8WhxaH+I1DnWNTSNgblB?= =?us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=; 24:0NJ77wNr+iCQOUG86e1YvBfPNm7iC/r2Jhc0bE0S8B89HZBUAPXWgxLskXemf7JcJYDaosOCSxn4bjVECMe4v52794vTo0rzmghQx7ssIiY=; 7:Za8yHzQUEtQOYE1N6pGI+JyI/8n3G8F2SeQ4TgQ/3JRh85X1oFfxnn3UN5e9WnoxKONhqBIwh+TKVBA1qXoIyNH1QeJP7xCsZ0/wNAIFkpmBPqecRGmvuiUyN9X1wAxROBokt9PmhHT4aTB1CP2CxlDP0nP/viVCJhFaw7i9hJpBlWOMofS/sGFRVH1u+2pxLVw3AbqEaMb55il13CfS5KKRXMQ+PKR8GCRnU0DGSsH9PTNYgEYj7JEdJozygkMv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 14:38:24.4863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bd16298-ee6a-4e03-b2ca-08d55e812159 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: BN1PR0301MB0689 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 v2 -> v3: * fixed "dev_warn(dev," ==> "dev_warn(&st->sd.spi->dev," `dev` does not exist * moved the warning as part of an else case ; patch is simpler and `pdata` is const which fails 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..aebbc3b58194 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 { + 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)