Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp356289ima; Fri, 15 Mar 2019 04:30:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOm+lauppkw7ZacRhgXsBJLpMsq9Ol+5WYFJHUdnKwXfguVxN54l14ZbkH4bKHKSJ5X7mO X-Received: by 2002:a17:902:1121:: with SMTP id d30mr3764739pla.104.1552649430923; Fri, 15 Mar 2019 04:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552649430; cv=none; d=google.com; s=arc-20160816; b=On6Fy2H9ou+sIIu4e8Kb2QP1XgeMM0OYJeKn68dEU4qGHNQN3zpqQgHBLFTouNYiyp HmeBoJ5QPRc+8A5Tdlv0/zGQjTkn8uOkddUd/nxKKfZkIQK+jJztbl7CEGyW9DmpMpPP e9SkX8q8i/s99/w0mydXKqwCCHThg3dM6L1fTfKlXTL7wF2AxENJTbrGRmNPbmjm2eaH u89qaGUlDvMQyGgrf9Db84JVlaQjbjw68iR99Ahx/pZlmyeDjI25lXar8VfJDtnE8dgA Qkf26McRiRPOf5vvfF2QEeKmUurEIK8jNc8QoxgcEq0ttgfUP14n2+EtMdjTI0ux9zKL 7h/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1WADb2XkRjRqBoQMxI9IQb8edvNfMsMpwdkP8qBQ1eo=; b=SSUpjpluDFf/IJ3LDB0+Jxe6qb7CZdh79Z9hTMeFSz96hRoJrrY3jhxhrY6Pzudq+/ v2gMO5U+UjcdjsQX8TfjaspBROsrb6n4FlJRBj5jtFk0HWuWaMRb+aKodBYXGPW2Qsxk s3Om2yJTtKzlZe4yjxSSm+SBEuHgZ9CPn0WJvDsB3Ubpq5Ua1pH+2v6xoHIfg+xMdW1K 7Qpsmh3svX4Q9QvnH+IGt9xsuD2bqphdnT/bOs2TAkGsyQd+vXTREe8Gl5INg/7z54v3 AvXNheZBi7kM2FvbzntSUlTBPAo4sie4c7vZZgHXKIpQW4kcZ7Ahxby7gQF/JS1K4pu6 CRzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@analog.onmicrosoft.com header.s=selector1-analog-com header.b=EIfEZcNM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63si1686496pld.139.2019.03.15.04.30.15; Fri, 15 Mar 2019 04:30:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@analog.onmicrosoft.com header.s=selector1-analog-com header.b=EIfEZcNM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728807AbfCOL3d (ORCPT + 99 others); Fri, 15 Mar 2019 07:29:33 -0400 Received: from mail-eopbgr780047.outbound.protection.outlook.com ([40.107.78.47]:40439 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727553AbfCOL3c (ORCPT ); Fri, 15 Mar 2019 07:29:32 -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=1WADb2XkRjRqBoQMxI9IQb8edvNfMsMpwdkP8qBQ1eo=; b=EIfEZcNMgZu3uwCTG3GDFIgWT+26bQye0yMhV6JjsLkY+axIw21OmRUa6luTUCXHPdKPrbbmkJPjrCb6U/zuJetuFLM7k6DnZaQV7JtF8rRrX1z+q1iqT3pfhoS4ceNghTb8yY5WEVxqmjmVL9t9Vv4nv04UaKQuNcr6grom1tw= Received: from BN6PR03CA0095.namprd03.prod.outlook.com (10.164.122.161) by BL2PR03MB548.namprd03.prod.outlook.com (10.141.91.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Fri, 15 Mar 2019 11:29:29 +0000 Received: from BL2NAM02FT035.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::205) by BN6PR03CA0095.outlook.office365.com (2603:10b6:405:6f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13 via Frontend Transport; Fri, 15 Mar 2019 11:29:29 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; metafoo.de; dkim=none (message not signed) header.d=none;metafoo.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 BL2NAM02FT035.mail.protection.outlook.com (10.152.77.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1709.13 via Frontend Transport; Fri, 15 Mar 2019 11:29:22 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id x2FBTLFR008781 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 15 Mar 2019 04:29:21 -0700 Received: from mircea-Latitude-E6540.analog.com (10.50.3.101) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 15 Mar 2019 07:29:21 -0400 From: Mircea Caprioru To: CC: , , , , , , Mircea Caprioru Subject: [PATCH 2/2] staging: iio: adc: ad7192: Convert platform data to DT properties Date: Fri, 15 Mar 2019 13:29:03 +0200 Message-ID: <20190315112903.15855-2-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190315112903.15855-1-mircea.caprioru@analog.com> References: <20190315112903.15855-1-mircea.caprioru@analog.com> MIME-Version: 1.0 Content-Type: text/plain 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)(39860400002)(396003)(376002)(346002)(2980300002)(189003)(199004)(72206003)(8676002)(50466002)(6916009)(486006)(7696005)(2616005)(106002)(7636002)(246002)(8936002)(47776003)(478600001)(51416003)(4326008)(6666004)(336012)(48376002)(426003)(305945005)(5660300002)(356004)(36756003)(50226002)(44832011)(107886003)(76176011)(86362001)(446003)(77096007)(2906002)(26005)(11346002)(186003)(106466001)(476003)(126002)(316002)(53416004)(54906003)(14444005)(2351001)(1076003)(16586007);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR03MB548;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd582063-3e31-4080-dfcc-08d6a9397c48 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4608103)(4709054)(2017052603328)(7153060);SRVR:BL2PR03MB548; X-MS-TrafficTypeDiagnostic: BL2PR03MB548: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09778E995A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: GuyGEbGhNh+ot3w6fB3Bxcrgmb4iPuU2+69fMGL+1Od8+Y2qikEWIRIHlejdEudB+7dpd9Osjx0jG7K8pizwSYl5Im9+xsapoEh24nBhVvQX3G2eOGR3WK78BukQ47074t6KaDzEr4lT0CvdLuqDDZHH3a8oMKR0hm+YQlqdRvex6j21RrB4n3rq5/NWl4CbOLQP7Nro3OUJv37LGmb6j99DKWwnbwVjGoJRvMyTXE2opUAcO1PtB0eMMeljolEiGIZcrsMvjkwU1GoYN5ZOGu4ftGuuuyEwdo7KT0NF+Zj4IQzwj73RCV2nlleObNaZUtz96klMfmcFgvORoiWvJ9qvGxjBubCzJ97Elx5jUOmQZ0GO/pQBxHaRsGQ4Ubyr8WmloKs/8/F1+U1dqTT8KkRclHi9B72Yd6GaEJeo5Kw= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2019 11:29:22.4843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd582063-3e31-4080-dfcc-08d6a9397c48 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: BL2PR03MB548 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch will remove platform data members and replace them with device tree properties. These properties will be subject to further modifications and probably replaced with other functionalities at some point in time. Signed-off-by: Mircea Caprioru --- drivers/staging/iio/adc/ad7192.c | 33 ++++++++++++++++++++------------ drivers/staging/iio/adc/ad7192.h | 7 ------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 5c54ce380fa5..c56eaefbbe41 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -250,10 +250,11 @@ static int ad7192_of_clock_select(struct ad7192_state *st) return clock_sel; } -static int ad7192_setup(struct ad7192_state *st, - const struct ad7192_platform_data *pdata) +static int ad7192_setup(struct ad7192_state *st, struct device_node *np) { struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi); + bool rej60_en, sinc3_en, refin2_en, chop_en; + bool buf_en, bipolar, burnout_curr_en; unsigned long long scale_uv; int i, ret, id; @@ -280,18 +281,22 @@ static int ad7192_setup(struct ad7192_state *st, st->conf = AD7192_CONF_GAIN(0); - if (pdata->rej60_en) + rej60_en = of_property_read_bool(np, "adi,rejection-60-Hz-enable"); + if (rej60_en) st->mode |= AD7192_MODE_REJ60; - if (pdata->sinc3_en) + sinc3_en = of_property_read_bool(np, "adi,sinc3-filter-enable"); + if (sinc3_en) st->mode |= AD7192_MODE_SINC3; - if (pdata->refin2_en && st->devid != ID_AD7195) + refin2_en = of_property_read_bool(np, "adi,refin2-pins-enable"); + if (refin2_en && st->devid != ID_AD7195) st->conf |= AD7192_CONF_REFSEL; - if (pdata->chop_en) { + chop_en = of_property_read_bool(np, "adi,chop-enable"); + if (chop_en) { st->conf |= AD7192_CONF_CHOP; - if (pdata->sinc3_en) + if (sinc3_en) st->f_order = 3; /* SINC 3rd order */ else st->f_order = 4; /* SINC 4th order */ @@ -299,15 +304,19 @@ static int ad7192_setup(struct ad7192_state *st, st->f_order = 1; } - if (pdata->buf_en) + buf_en = of_property_read_bool(np, "adi,buffer-enable"); + if (buf_en) st->conf |= AD7192_CONF_BUF; - if (pdata->unipolar_en) + bipolar = of_property_read_bool(np, "bipolar"); + if (!bipolar) st->conf |= AD7192_CONF_UNIPOLAR; - if (pdata->burnout_curr_en && pdata->buf_en && !pdata->chop_en) { + burnout_curr_en = of_property_read_bool(np, + "adi,burnout-currents-enable"); + if (burnout_curr_en && buf_en && !chop_en) { st->conf |= AD7192_CONF_BURN; - } else if (pdata->burnout_curr_en) { + } else if (burnout_curr_en) { dev_warn(&st->sd.spi->dev, "Can't enable burnout currents: see CHOP or buffer\n"); } @@ -735,7 +744,7 @@ static int ad7192_probe(struct spi_device *spi) } } - ret = ad7192_setup(st, pdata); + ret = ad7192_setup(st, spi->dev.of_node); if (ret) goto error_disable_clk; diff --git a/drivers/staging/iio/adc/ad7192.h b/drivers/staging/iio/adc/ad7192.h index 3be3ee269ed5..aa3322c14e38 100644 --- a/drivers/staging/iio/adc/ad7192.h +++ b/drivers/staging/iio/adc/ad7192.h @@ -33,13 +33,6 @@ struct ad7192_platform_data { u16 vref_mv; - bool refin2_en; - bool rej60_en; - bool sinc3_en; - bool chop_en; - bool buf_en; - bool unipolar_en; - bool burnout_curr_en; }; #endif /* IIO_ADC_AD7192_H_ */ -- 2.17.1