From patchwork Tue Oct 2 11:57:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10623497 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 3105216B1 for ; Tue, 2 Oct 2018 11:58:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2424728815 for ; Tue, 2 Oct 2018 11:58:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 188DF2884B; Tue, 2 Oct 2018 11:58:53 +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 9F8BA28815 for ; Tue, 2 Oct 2018 11:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727528AbeJBSlt (ORCPT ); Tue, 2 Oct 2018 14:41:49 -0400 Received: from mail-by2nam01on0088.outbound.protection.outlook.com ([104.47.34.88]:51615 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727434AbeJBSls (ORCPT ); Tue, 2 Oct 2018 14:41:48 -0400 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:X-MS-Exchange-SenderADCheck; bh=ILRDAN9ouWaUFGd7xPPcnxXFUBtkAqfRLiP0O8TjdBI=; b=HsYterVWj6zsqaMGiEWJmDSonEscKF69aW/uaNZNZyJiXUS0rGkwmk205SP1SMsMOcqFzKwq/K2g3h9aG9PUyTAgQB3SeQgFU3xJ0n7j/cJNV821EcG9KvoaqMAdY0U/TVr11Xx8tG+ILD8cmWn7wAUPwswh4bNVrqkXIZ0pi+E= Received: from CY4PR03CA0024.namprd03.prod.outlook.com (2603:10b6:903:33::34) by MWHPR03MB3135.namprd03.prod.outlook.com (2603:10b6:301:3c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.24; Tue, 2 Oct 2018 11:58:48 +0000 Received: from BL2FFO11FD008.protection.gbl (2a01:111:f400:7c09::109) by CY4PR03CA0024.outlook.office365.com (2603:10b6:903:33::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1207.18 via Frontend Transport; Tue, 2 Oct 2018 11:58:48 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; gmx.de; dkim=none (message not signed) header.d=none;gmx.de; 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 BL2FFO11FD008.mail.protection.outlook.com (10.173.161.4) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1164.13 via Frontend Transport; Tue, 2 Oct 2018 11:58:47 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.69.108]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id w92Bwlp1006473 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 2 Oct 2018 04:58:47 -0700 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; Tue, 2 Oct 2018 07:58:48 -0400 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w92BwKjI012604; Tue, 2 Oct 2018 07:58:38 -0400 From: Alexandru Ardelean To: , , , CC: , , Dragos Bogdan , Alexandru Ardelean Subject: [PATCH 2/4] staging: iio: ad5933: Add regulator binding for vref Date: Tue, 2 Oct 2018 14:57:58 +0300 Message-ID: <20181002115800.12399-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181002115800.12399-1-alexandru.ardelean@analog.com> References: <20181002115800.12399-1-alexandru.ardelean@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)(136003)(396003)(346002)(376002)(39860400002)(2980300002)(438002)(199004)(189003)(50466002)(48376002)(6666003)(47776003)(8936002)(4326008)(107886003)(36756003)(44832011)(1076002)(486006)(14444005)(5660300001)(2616005)(86362001)(77096007)(476003)(26005)(110136005)(2201001)(51416003)(478600001)(7696005)(316002)(186003)(356003)(11346002)(76176011)(54906003)(126002)(426003)(106002)(246002)(2906002)(8676002)(50226002)(16586007)(53416004)(106466001)(446003)(7636002)(336012)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR03MB3135;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD008;1:pjsNWUZbiEY47ZsDR+Tzde15BKVhTay8YSQZAgJE+Gv+B2BTn3vxvaBjZ0Ufg8N/bvnzMzYF2VJa/e8i8fVZMxVwAi++JrBSKK1gh8VRXXJpzbj5I4U7AAB0pSKs909x X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3fd311a-2e95-4bc3-24d6-08d6285e693c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:MWHPR03MB3135; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB3135;3:EO20MdN6uyR4vRLBFICkG4NOZAos9EOF7YeSmqPpfKGDuo/35dGLg3nwrOks3gTR1/FqofckkNrGlPXNavy4uXlbrXlbzwKfItK93l3Hnq+5LRGP25hiapSfvre1U7WGhHwKZ32tpDx9hvYDkTN+pbyc4ktxwODIS1/elcSs7efNtlxBJkTNr5OWkFlMDmhkTY2a7accLQEysUZ3K02Yd98wwgrA3J6LJqgqWI9fk73d0ckVivjVz/KiCHUcH5PAILBMk2KOXDa3sX6iYMFgcm3Iiwd/kobt0lf887esEer/vFgCP0e8EqwAvgGk9YzTchE1rJDysgEQbKlnNB1HbzUPHpfl0j90xzSf8E0ayE4=;25:NY1QT7rNJHTIudq1DwoBmJOGhe+TIv7jCZr5Yi+N33hCKcjnk/9e7abPt5MIIG7/oVw3rvjEVZHT9ZfHoLfPrV7yy7cUGwX3HsOPME7i/MHu3H+4EerssJfcj8+AAoISwwBfJ1XnllECFdyU/AEBOcYlZV8qz7LpN2okEMBjFkRy/FE8RewA9HH+gCA5+I8BwkaAs/opWEaEMH+LlPURIqmHUDs+gZ8SDsRBxIgnGxWpdlhxOU0urXbstRr5wZxJ8CkwHMuaNJXDkQcJUb4tWBueANF0l7xcVwoR+jdmJysnyranQgnTihTS5a2Q8fdfidIY7aLJei84yfq1QUlSCw== X-MS-TrafficTypeDiagnostic: MWHPR03MB3135: X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB3135;31:4dfrNxwYTpwJIihmboXMr6jugmd4rjKPLkT1sbTIWDbjReLeV276p5OcAIObLZETS7nE/JgBIEUPV6JGIv+E12LAWe5tDMpnhDQPuYT6IpwNyuOu2D1m+ALKphsMj5G8d5DPIg+xQVsr/SsvSgloI3wSz8VkXwT/i4ubv8d08caJwql9SuHBLmOUB+yMBn4QQ2MiGBCK+kXXSFs1xuAZDHDk5iQDnoM/kPHWYX5k0vI=;20:Dw6TwbS6onDds533MRhCFtNqaRYKkL81ilamBsR7uiDFLpsswAgpMzEtxRf8heO7Q5fTeNdr79Tr9zrqKAwgs2SjLNFvglbhjLVEaZAo9yfwQnZSklDf0F/na0yMvdUoeo9cnaP5GYsfmDH98VtWBPmoN6w48oNCsVwRIPytZhhx46Dd34PYgneRUzUyFdAH0VUtJlJYZxDojAFTDhGwi+bt5dPD9m+1eHai21teQLX0+RInurOdimPXxSJk5CiCYBYuRhqvHIE+jUIGIzzhrI6Hr/I88+o4Fndesa/vzQgjFqXLrfL9ifECcXbEhbNvOyZ7l47gFeqdKRq0RHloWYKh3dGFRbqDDZwgd8+3EZCe3RRJBcdFrn0JrmI+BaHWtzWMYJNfnGmj+CRNvTc0s9jio9CdvL205L12M4YOTbDpz1BdpdgapgV3wewBdk7sJxujPQoR+G7iVUMuZpZ+EZkJJee/PEuVkS16SZh3tIWSS5w2jsLC3yRBkwRUzwxR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93004095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051);SRVR:MWHPR03MB3135;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB3135; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB3135;4:xoD8VX4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ogFuRANU0iLyGbOtMOX2A6dv6n5DDCb2HiLNgSw4D1zpJpP9UrJCRZYOr7chfCgKfx8oQGiC2RzOPfI0a1xtKgyAOAbdP/axP00QGAe/Cx6F+mrnvTuVltj4MizRA0zcVmeEy8aTAdtgvSF8i6OUXQsaBI0lnnDQHIoUqSL5LsrOd1HWKDY9Dpzo9LvKoEsrZdU5WfSgfMYJyVwGil//zxH2j8c66qbi24xF6PInrw3akadArw==;5:dbWPJ0EZaW1i6/mpRBVYkFd4zbJA66S2gZmDRGy3qMm17j4ul+6tI0exV7zuLpNwdoK/QpKjyPbt4buLGlLin5IdWmvUGxMAFPrXy+XUkPnztcaso+e8KUc+6iZmwC4BuynzRECIkkri5xBP1oeH1nNuVvWgTz/bKg9aCvFrr7k=;7:QAWofRB4+0eiGYKW9HlGMBkCpO4AiPSqucbvIilpK4XLlvHDmNBTLIuXi1xRvJUznm3EGafZAI6EM/iJ4qclo855CXr9Eo+I68+u4DtPcQcoHTjFmKGAC3djPHIk9Zfokq5N2PnyTEotKzeMgFN39ki5/wgSV+nRAHSsdVaZZW5e/5epW/s8pGZ90k9tmUKcR+4Uixx35IXGzG9/Q+qNu5TND248BTnCS4cLQ3FXt0FGqLmkeWAl23V7TfI3KNhC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2018 11:58:47.5996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3fd311a-2e95-4bc3-24d6-08d6285e693c 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: MWHPR03MB3135 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: Dragos Bogdan In order to add full device tree support, add the option of specifying the vref using the regulator framework. Signed-off-by: Dragos Bogdan Signed-off-by: Alexandru Ardelean --- drivers/staging/iio/impedance-analyzer/ad5933.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 8a920f675b83..ec54ab4471b9 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -97,6 +97,7 @@ struct ad5933_platform_data { struct ad5933_state { struct i2c_client *client; struct regulator *reg; + struct regulator *vref; struct delayed_work work; struct mutex lock; /* Protect sensor state */ unsigned long mclk_hz; @@ -721,6 +722,14 @@ static int ad5933_probe(struct i2c_client *client, } voltage_uv = regulator_get_voltage(st->reg); + st->reg = devm_regulator_get(&client->dev, "vref"); + if (!IS_ERR(st->vref)) { + ret = regulator_enable(st->vref); + if (ret) + goto error_disable_reg; + pdata->vref_mv = regulator_get_voltage(st->vref) / 1000; + } + if (voltage_uv) st->vref_mv = voltage_uv / 1000; else @@ -747,7 +756,7 @@ static int ad5933_probe(struct i2c_client *client, ret = ad5933_register_ring_funcs_and_init(indio_dev); if (ret) - goto error_disable_reg; + goto error_disable_vref; ret = ad5933_setup(st); if (ret) @@ -761,6 +770,8 @@ static int ad5933_probe(struct i2c_client *client, error_unreg_ring: iio_kfifo_free(indio_dev->buffer); +error_disable_vref: + regulator_disable(st->vref); error_disable_reg: regulator_disable(st->reg); @@ -775,6 +786,7 @@ static int ad5933_remove(struct i2c_client *client) iio_device_unregister(indio_dev); iio_kfifo_free(indio_dev->buffer); regulator_disable(st->reg); + regulator_disable(st->vref); return 0; }