From patchwork Sun Apr 22 22:03: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: 10355839 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 3D31D60388 for ; Sun, 22 Apr 2018 22:03:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 263792893F for ; Sun, 22 Apr 2018 22:03:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A65128964; Sun, 22 Apr 2018 22:03: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 B153F2893F for ; Sun, 22 Apr 2018 22:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753574AbeDVWDh (ORCPT ); Sun, 22 Apr 2018 18:03:37 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42928 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021AbeDVWDh (ORCPT ); Sun, 22 Apr 2018 18:03:37 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18-v6so36018639wrg.9; Sun, 22 Apr 2018 15:03: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=rUy9POpTIecSU+/TJtaJMHHfxrtzb/O7jRqacTBabsY=; b=e4rxTugBWGeEz61CqJ7z0UNL36jxzp5BGpALv4bjrcAYGYtyOeCJbtyc7PlQEbT0vH RpP2F7UxERrsDOkNhKpDMbj0C4iZKNfj3XrqieIuqX/caS5wSGxrjGkGBE8lntIrqCMZ VgDMQawbU6zsykR+KC3p39ThP3iEzzgZjxIM898AyEIGYcM0BzWSmBuxr/wrVDXT2biE 28GYfT4/UUMu79p7gsIH67YSLDnIoEwlpWRFafv0Gt+C3q0WoqyDzGwxNlBUkO346qoR ZWoi72mHUJazJ2a1nw1c/j48oKy6f6Dcje1I3H4zYG3GCeSgtvjuCLbf41MkOaPpAyyz 4zZQ== 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=rUy9POpTIecSU+/TJtaJMHHfxrtzb/O7jRqacTBabsY=; b=sFNIyQ9tSwCBOfIyaxbQA0RADPzLSA4FdNKbcVTYldv/QokppSsWf4GRa4f6pXNEJe rlnX9xNmgwE1AIPK3NUWS/BhvLlSc78naudjHTPaG0tyMLgnafBFmkn1T/an2unWDq4m HgyqrCQWvBu3HbvbgH9b63d2LWI1FmZoLFrxFAnER0CLurxoGRmDsAhPRIX7uph+i29I 5k6rr2TOxXKUCpRhOgTFIhueWd1whRWN/BhYq6bOjutkbn4ss3uusycUZH5s4Sgt3OWM U4tUDBVVjt94Q/CWl1GfyaZ/NAqDU7y3Rz93sXdYeQiplQlTgV4aETWlQOdILPXZE5I7 dvlA== X-Gm-Message-State: ALQs6tCqssYM8gKaXT/2iCHIm6XwIKjIY8nxtn72fLHMFJhV/tXQXw0w +X9GVugAj9FRqw/WT4mgm+c= X-Google-Smtp-Source: AIpwx4/Dw1nlLm97TOEPoOiuaAZd9vE8+kRpMzEYe5LY+fl4UcE32KH3lBnBHoYORMxoKfpspy/Tpw== X-Received: by 10.80.151.163 with SMTP id e32mr25348342edb.58.1524434615894; Sun, 22 Apr 2018 15:03:35 -0700 (PDT) Received: from zenbook-arch (s559434a1.adsl.online.nl. [85.148.52.161]) by smtp.gmail.com with ESMTPSA id k24sm6521089ede.62.2018.04.22.15.03.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Apr 2018 15:03:35 -0700 (PDT) Date: Mon, 23 Apr 2018 00:03:32 +0200 From: David Veenstra To: jic23@kernel.org, lars@metafoo.de, pmeerw@pmeerw.net Cc: robh+dt@kernel.org, Michael.Hennerich@analog.com, knaack.h@gmx.de, linux-iio@vger.kernel.org, daniel.baluta@nxp.com, devel@driverdev.osuosl.org, devicetree@vger.kernel.org Subject: [PATCH v3 4/9] staging: iio: ad2s1200: Replace platform data with dt bindings Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) 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 v3: - Introduced in this version. 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 e7bfe5aa4c45..3c7163610ff6 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -26,9 +26,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 */ @@ -113,20 +110,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 = 0; - - 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 = 0; indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (!indio_dev) @@ -136,8 +122,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, "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, "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;