From patchwork Fri May 18 18:22:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Veenstra X-Patchwork-Id: 10411799 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 25D82602C2 for ; Fri, 18 May 2018 18:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13E8528A7F for ; Fri, 18 May 2018 18:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0879E28A81; Fri, 18 May 2018 18:22:39 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 A20B028A7F for ; Fri, 18 May 2018 18:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458AbeERSWi (ORCPT ); Fri, 18 May 2018 14:22:38 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53185 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbeERSWh (ORCPT ); Fri, 18 May 2018 14:22:37 -0400 Received: by mail-wm0-f68.google.com with SMTP id w194-v6so15481611wmf.2; Fri, 18 May 2018 11:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZdLWG9kqzZbETrHb7eZ/AfTjDYkumE6AIV85/yxJNKg=; b=sx7kfoD8X7EmzdJNW+fu99glvx92xfebh90KcNefKNiWkqnVViu5LZ4FpeRh9XuFmV i4pIh3G7e4cFHlUpimlBeICrHOE7tg3/p6vo73ozuc5nHuNkXdRyjYsBqA7YPREjSdrx g/C4Tb1V5Vfim1wKWmpaWQjofYy2s1+YpFGs1fz7eWgoB//SJchZ/QNUwGYQld4qLUpz ZfntFrC0eP135JgDtXt7i3V7n+pf3JJ7w6DcSgx16JPHTKZfbtOBWZMQdBJ8siWbPg24 PNgVlmAVPb5DmoOhgLZuM1oDp9inqGLISuDbm3TfnvX1xiPpN/1k0PXrfsgap6VhZgcc iG2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZdLWG9kqzZbETrHb7eZ/AfTjDYkumE6AIV85/yxJNKg=; b=bHx2qXuAl87jJWLdBk08u3tlYsNi2hAGyOawXAn56MTrf1XEKK+RZVGYp13HZaG1SJ BRaVyriucCLqm12OxDTSmcvE6yi+ANXJHthZIEFEXfA8RdAquBNvRyU7VUCq+Tp8Ie9x 7kP9U4qSVq8B4MucRvIZjJcAK5R5KUa+ECpDzHENxRyA9xqAsbqTTgyN8Ejg2+8/tlZY PH9DtX5OhMm7mXKwlcAbJvw0+Dok40RQkmlj/fVIqv/6TCuHnJz8FST5MjGfFa+mnZEL bTcAbvVvUe3SLOTyEl1xDWqyg7lcUc6X2QKjmLQnuMPUZ2FZwL+8qqZVn7llTuHz6nnY lozg== X-Gm-Message-State: ALKqPwebcN6S4XoSc89yjjZTZS4IbQmK6o9hrDoyNUoIZ55IbkKFQ/ii wwxG+IXM+jAxDuiGbPyTaOs= X-Google-Smtp-Source: AB8JxZrnuCJjq5BFsoIDNSQrPwizP/E37kV8up1RNxP2gFxDMyzfqINzB0PuKng28W+0XdgliOQUZA== X-Received: by 2002:a50:ae23:: with SMTP id c32-v6mr12837603edd.131.1526667755979; Fri, 18 May 2018 11:22:35 -0700 (PDT) Received: from zenbook-arch (s559434a1.adsl.online.nl. [85.148.52.161]) by smtp.gmail.com with ESMTPSA id l33-v6sm4333612edd.59.2018.05.18.11.22.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 11:22:35 -0700 (PDT) Date: Fri, 18 May 2018 20:22:32 +0200 From: David Veenstra To: jic23@kernel.org, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org Cc: Michael.Hennerich@analog.com, knaack.h@gmx.de, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, devicetree@vger.kernel.org Subject: [PATCH v4 06/12] staging: iio: ad2s1200: Replace platform data with dt bindings Message-ID: <6beef6b7514c53f4fac77d661dcae139b55935bf.1526667118.git.davidjulianveenstra@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) 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 Remove usage of platform data, and replace it with device tree facilities. Signed-off-by: David Veenstra --- Changes in v4: - Added vendor prefix to gpio function names. drivers/staging/iio/resolver/ad2s1200.c | 32 ++++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index b2c46a8c6b77..9a8aa2448897 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -25,9 +25,6 @@ #define DRV_NAME "ad2s1200" -/* input pin sample and rdvel is controlled by driver */ -#define AD2S1200_PN 2 - /* input clock on serial interface */ #define AD2S1200_HZ 8192000 /* clock period in nano second */ @@ -111,20 +108,9 @@ static const struct iio_info ad2s1200_info = { static int ad2s1200_probe(struct spi_device *spi) { - unsigned short *pins = spi->dev.platform_data; struct ad2s1200_state *st; struct iio_dev *indio_dev; - int pn, ret; - - for (pn = 0; pn < AD2S1200_PN; pn++) { - ret = devm_gpio_request_one(&spi->dev, pins[pn], GPIOF_DIR_OUT, - DRV_NAME); - if (ret) { - dev_err(&spi->dev, "request gpio pin %d failed\n", - pins[pn]); - return ret; - } - } + int ret; indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (!indio_dev) @@ -134,8 +120,20 @@ static int ad2s1200_probe(struct spi_device *spi) st = iio_priv(indio_dev); mutex_init(&st->lock); st->sdev = spi; - st->sample = gpio_to_desc(pins[0]); - st->rdvel = gpio_to_desc(pins[1]); + + st->sample = devm_gpiod_get(&spi->dev, "adi,sample", GPIOD_OUT_LOW); + if (IS_ERR(st->sample)) { + dev_err(&spi->dev, "Failed to claim SAMPLE gpio: err=%ld\n", + PTR_ERR(st->sample)); + return PTR_ERR(st->sample); + } + + st->rdvel = devm_gpiod_get(&spi->dev, "adi,rdvel", GPIOD_OUT_LOW); + if (IS_ERR(st->rdvel)) { + dev_err(&spi->dev, "Failed to claim RDVEL gpio: err=%ld\n", + PTR_ERR(st->rdvel)); + return PTR_ERR(st->rdvel); + } indio_dev->dev.parent = &spi->dev; indio_dev->info = &ad2s1200_info;