From patchwork Fri Nov 9 07:35:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishad Kamdar X-Patchwork-Id: 10675411 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 3C68913BF for ; Fri, 9 Nov 2018 07:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 261552E6DB for ; Fri, 9 Nov 2018 07:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 197362E6AE; Fri, 9 Nov 2018 07:35:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 7F5E22E6AE for ; Fri, 9 Nov 2018 07:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbeKIROq (ORCPT ); Fri, 9 Nov 2018 12:14:46 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44279 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbeKIROq (ORCPT ); Fri, 9 Nov 2018 12:14:46 -0500 Received: by mail-pg1-f193.google.com with SMTP id w3-v6so489347pgs.11; Thu, 08 Nov 2018 23:35:27 -0800 (PST) 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=kf7F8wtFsGvrz6CVwT+ZgV4e1Du8AsiVGW49VRpy7h0=; b=ng1Im+w+bGHfLgjj0UMCVN2NXy44vnynJkgqjF1GXMVXJJBnJpImxBPr30dyi6mQsr SKkQVDWI1GlvWZLctk+SUxpWFAz1gwtY94ZchQeoZOO8FVtEPGhq6WNrKSYBI77oWZc+ TWd0sBO95xBLMF1hwGxqDz1IW6cTb29upWXVvoR+zklD0vmjoAuTTAS4fkpzoePnqLLG JHgFWkwr3eNcXUdD6cWkVKgcQHTfT3snzCleovH4+0FscSvwwIbztwI607ILVhWugG1C BBV401cYNFd38USHx9hrVYBlqVOOoU+blngK9aiHfYfUu5MgtvtifoOT2HAH/XgVWeJo Sw4Q== 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=kf7F8wtFsGvrz6CVwT+ZgV4e1Du8AsiVGW49VRpy7h0=; b=pbV32JgYftg5eM5xMh8xRG/3bIn4U/Yyc/fScOunWPrn7bNHKhLzo0T78e0z71/JXy 3pORA9jfFvPcn/MG7Wml7ktDl74yqGiYWItAW+Am3JTLreIORzGJOrPBFZm2kkrrEOM5 836b5cwdVevXGSfAnuHe7Jl+UmC4/8UIrkjH76wbO645Grbv4cXjq2gSuEeh42awxHoO 5MeeliGkutdu6XO6XesCe4RUWmJ1sAdOdRc1nMKpJVe+q1c760SYP7cXdsyE+onMVdcD o7VLZtXfuFeV4FZ2FtPJkehVgD9q/8662NKySEXVZr6HzeqPKwVriBKkl07YCAtSg9oY GrjA== X-Gm-Message-State: AGRZ1gJnLf3Z2r2ru5Zx0niqOWNG/vntpJGk32gHy9UW5gt1NIj3Lwqg f5kV7CYoxvJef84D+Vxc6CA= X-Google-Smtp-Source: AJdET5c3QCXZ7J8S7gTab+qIMtOhOCDv1yRH/pNeccTPOTTbNXGVvfBFY6pTsao7+RY2S7Tv3k0xDg== X-Received: by 2002:a63:6a42:: with SMTP id f63-v6mr6737388pgc.48.1541748926698; Thu, 08 Nov 2018 23:35:26 -0800 (PST) Received: from nishad ([106.210.186.71]) by smtp.gmail.com with ESMTPSA id m3sm1787836pgl.69.2018.11.08.23.35.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 23:35:26 -0800 (PST) Date: Fri, 9 Nov 2018 13:05:17 +0530 From: Nishad Kamdar To: Lars-Peter Clausen Cc: Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/4] staging: iio: ad7816: Switch to the gpio descriptor interface Message-ID: <3f9ea18864230b2758f86899b9bd1acb020dd176.1541733949.git.nishadkamdar@gmail.com> 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 Use the gpiod interface for rdwr_pin, convert_pin and busy_pin instead of the deprecated old non-descriptor interface. Signed-off-by: Nishad Kamdar --- drivers/staging/iio/adc/ad7816.c | 80 ++++++++++++++------------------ 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index bf76a8620bdb..12c4e0ab4713 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -7,7 +7,7 @@ */ #include -#include +#include #include #include #include @@ -44,9 +44,9 @@ struct ad7816_chip_info { struct spi_device *spi_dev; - u16 rdwr_pin; - u16 convert_pin; - u16 busy_pin; + struct gpio_desc *rdwr_pin; + struct gpio_desc *convert_pin; + struct gpio_desc *busy_pin; u8 oti_data[AD7816_CS_MAX + 1]; u8 channel_id; /* 0 always be temperature */ u8 mode; @@ -61,28 +61,28 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data) int ret = 0; __be16 buf; - gpio_set_value(chip->rdwr_pin, 1); - gpio_set_value(chip->rdwr_pin, 0); + gpiod_set_value(chip->rdwr_pin, 1); + gpiod_set_value(chip->rdwr_pin, 0); ret = spi_write(spi_dev, &chip->channel_id, sizeof(chip->channel_id)); if (ret < 0) { dev_err(&spi_dev->dev, "SPI channel setting error\n"); return ret; } - gpio_set_value(chip->rdwr_pin, 1); + gpiod_set_value(chip->rdwr_pin, 1); if (chip->mode == AD7816_PD) { /* operating mode 2 */ - gpio_set_value(chip->convert_pin, 1); - gpio_set_value(chip->convert_pin, 0); + gpiod_set_value(chip->convert_pin, 1); + gpiod_set_value(chip->convert_pin, 0); } else { /* operating mode 1 */ - gpio_set_value(chip->convert_pin, 0); - gpio_set_value(chip->convert_pin, 1); + gpiod_set_value(chip->convert_pin, 0); + gpiod_set_value(chip->convert_pin, 1); } - while (gpio_get_value(chip->busy_pin)) + while (gpiod_get_value(chip->busy_pin)) cpu_relax(); - gpio_set_value(chip->rdwr_pin, 0); - gpio_set_value(chip->rdwr_pin, 1); + gpiod_set_value(chip->rdwr_pin, 0); + gpiod_set_value(chip->rdwr_pin, 1); ret = spi_read(spi_dev, &buf, sizeof(*data)); if (ret < 0) { dev_err(&spi_dev->dev, "SPI data read error\n"); @@ -99,8 +99,8 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data) struct spi_device *spi_dev = chip->spi_dev; int ret = 0; - gpio_set_value(chip->rdwr_pin, 1); - gpio_set_value(chip->rdwr_pin, 0); + gpiod_set_value(chip->rdwr_pin, 1); + gpiod_set_value(chip->rdwr_pin, 0); ret = spi_write(spi_dev, &data, sizeof(data)); if (ret < 0) dev_err(&spi_dev->dev, "SPI oti data write error\n"); @@ -129,10 +129,10 @@ static ssize_t ad7816_store_mode(struct device *dev, struct ad7816_chip_info *chip = iio_priv(indio_dev); if (strcmp(buf, "full")) { - gpio_set_value(chip->rdwr_pin, 1); + gpiod_set_value(chip->rdwr_pin, 1); chip->mode = AD7816_FULL; } else { - gpio_set_value(chip->rdwr_pin, 0); + gpiod_set_value(chip->rdwr_pin, 0); chip->mode = AD7816_PD; } @@ -345,15 +345,9 @@ static int ad7816_probe(struct spi_device *spi_dev) { struct ad7816_chip_info *chip; struct iio_dev *indio_dev; - unsigned short *pins = dev_get_platdata(&spi_dev->dev); int ret = 0; int i; - if (!pins) { - dev_err(&spi_dev->dev, "No necessary GPIO platform data.\n"); - return -EINVAL; - } - indio_dev = devm_iio_device_alloc(&spi_dev->dev, sizeof(*chip)); if (!indio_dev) return -ENOMEM; @@ -364,34 +358,28 @@ static int ad7816_probe(struct spi_device *spi_dev) chip->spi_dev = spi_dev; for (i = 0; i <= AD7816_CS_MAX; i++) chip->oti_data[i] = 203; - chip->rdwr_pin = pins[0]; - chip->convert_pin = pins[1]; - chip->busy_pin = pins[2]; - - ret = devm_gpio_request(&spi_dev->dev, chip->rdwr_pin, - spi_get_device_id(spi_dev)->name); - if (ret) { - dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n", - chip->rdwr_pin); + + chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_IN); + if (IS_ERR(chip->rdwr_pin)) { + ret = PTR_ERR(chip->rdwr_pin); + dev_err(&spi_dev->dev, "Failed to request rdwr GPIO: %d\n", + ret); return ret; } - gpio_direction_input(chip->rdwr_pin); - ret = devm_gpio_request(&spi_dev->dev, chip->convert_pin, - spi_get_device_id(spi_dev)->name); - if (ret) { - dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n", - chip->convert_pin); + chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert", GPIOD_IN); + if (IS_ERR(chip->convert_pin)) { + ret = PTR_ERR(chip->convert_pin); + dev_err(&spi_dev->dev, "Failed to request convert GPIO: %d\n", + ret); return ret; } - gpio_direction_input(chip->convert_pin); - ret = devm_gpio_request(&spi_dev->dev, chip->busy_pin, - spi_get_device_id(spi_dev)->name); - if (ret) { - dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n", - chip->busy_pin); + chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy", GPIOD_IN); + if (IS_ERR(chip->busy_pin)) { + ret = PTR_ERR(chip->busy_pin); + dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n", + ret); return ret; } - gpio_direction_input(chip->busy_pin); indio_dev->name = spi_get_device_id(spi_dev)->name; indio_dev->dev.parent = &spi_dev->dev; From patchwork Fri Nov 9 07:36:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishad Kamdar X-Patchwork-Id: 10675413 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 561A513BF for ; Fri, 9 Nov 2018 07:36:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F292E6DB for ; Fri, 9 Nov 2018 07:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 352632E6F7; Fri, 9 Nov 2018 07:36:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 C9E742E6DB for ; Fri, 9 Nov 2018 07:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbeKIRPw (ORCPT ); Fri, 9 Nov 2018 12:15:52 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38287 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbeKIRPw (ORCPT ); Fri, 9 Nov 2018 12:15:52 -0500 Received: by mail-pf1-f193.google.com with SMTP id b11-v6so552197pfi.5; Thu, 08 Nov 2018 23:36:33 -0800 (PST) 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=D+hgTAknwOvfgpgcMHvVyFVBDFXLuZFMqPVNoy67gvo=; b=QTrzCvOj6AKg8ZpmlfN2nsvfuG6x+foMlC8StA1kzAFLDwCQkHIOQTkKSD34/EzoIl /pcp4fXkxxuoZuhgg/4qBiboAzCM+y9fJ9iZ4cuSmNfZwHOGCdcas2u7zBYe+kS1cpTx Mk/sMBtnKi1fO5n2y/5L9gCpGXYAABxLlwGENMbSl34279nmmsDVa4ovia0wNCFjkcQ7 AYDg2XRicPdjWwTvyahu8UaLH10EbdFPfDzbvCluUtculMmXYP13vOYmyR2zNXg1IEYn feHNOsGdhMNtfG+UQOd5/jBIUkAEJeoEXxKbj55tqAgp9jTqgiAPReUy7OO+OG5FfKh/ 6wZA== 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=D+hgTAknwOvfgpgcMHvVyFVBDFXLuZFMqPVNoy67gvo=; b=TzC4wazqYP5FGgTfmOaClT7enbyP8WuFEccokP7Fcb+NAp1GTeoH11OqdatXuThthQ fzmM0HLszUvdTzVvrRHj3Yu5eYGdISq7Ccl5RxpDjX0p/yjlzB+UhaELhERHyBq3k2o3 Cc9QpxGmBiXeJ6BGBE1ghj6ov1ca38hToZOv0BV7v9+LffvIPzO54VrnjI1lNA6f1/W+ rkAQlysOKTj33N8dwt4Nmod8zgvuKOtroBjZ8Z0bSu9sGaFEWWwMGFssYcnzhvgA/7/u 4mZxkTNf4XKodwSvXiaXPmUQ7386q0k5yKb9w/6ZLMaBdrccbSSsvN3o8FcO4s8GXECo wAmQ== X-Gm-Message-State: AGRZ1gL3Q3XeSRCiRgQBcqD/D0PsENQeRIXYqlP3TbT+hpaBzzBouvyb EjdDadfZYEPpZ/WKGIaL39k= X-Google-Smtp-Source: AJdET5c8AHD4Kf7dl/Sowt1yG7Y4P54rtXfXwTtWGoHgAPyYTN+gFNbn/fz7VJZpei4UzASaCA6fww== X-Received: by 2002:aa7:8546:: with SMTP id y6-v6mr8047452pfn.83.1541748992787; Thu, 08 Nov 2018 23:36:32 -0800 (PST) Received: from nishad ([106.210.186.71]) by smtp.gmail.com with ESMTPSA id n17-v6sm12553638pfj.148.2018.11.08.23.36.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 23:36:32 -0800 (PST) Date: Fri, 9 Nov 2018 13:06:24 +0530 From: Nishad Kamdar To: Lars-Peter Clausen Cc: Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/4] staging: iio: ad7816: Do not use busy_pin in case of AD7818 Message-ID: <3f0bc36261c54c945a3213ef03425099e57e9060.1541733949.git.nishadkamdar@gmail.com> 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 AD7818 does not support busy_pin functionality as per datasheet. Hence drop busy_pin when AD7818 is used. Signed-off-by: Nishad Kamdar --- drivers/staging/iio/adc/ad7816.c | 35 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index 12c4e0ab4713..3cda5cd09365 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -43,6 +43,7 @@ */ struct ad7816_chip_info { + kernel_ulong_t id; struct spi_device *spi_dev; struct gpio_desc *rdwr_pin; struct gpio_desc *convert_pin; @@ -52,6 +53,12 @@ struct ad7816_chip_info { u8 mode; }; +enum ad7816_type { + ID_AD7816, + ID_AD7817, + ID_AD7818, +}; + /* * ad7816 data access by SPI */ @@ -78,8 +85,10 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data) gpiod_set_value(chip->convert_pin, 1); } - while (gpiod_get_value(chip->busy_pin)) - cpu_relax(); + if (chip->id == ID_AD7816 || chip->id == ID_AD7817) { + while (gpiod_get_value(chip->busy_pin)) + cpu_relax(); + } gpiod_set_value(chip->rdwr_pin, 0); gpiod_set_value(chip->rdwr_pin, 1); @@ -359,6 +368,7 @@ static int ad7816_probe(struct spi_device *spi_dev) for (i = 0; i <= AD7816_CS_MAX; i++) chip->oti_data[i] = 203; + chip->id = spi_get_device_id(spi_dev)->driver_data; chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_IN); if (IS_ERR(chip->rdwr_pin)) { ret = PTR_ERR(chip->rdwr_pin); @@ -373,12 +383,15 @@ static int ad7816_probe(struct spi_device *spi_dev) ret); return ret; } - chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy", GPIOD_IN); - if (IS_ERR(chip->busy_pin)) { - ret = PTR_ERR(chip->busy_pin); - dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n", - ret); - return ret; + if (chip->id == ID_AD7816 || chip->id == ID_AD7817) { + chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy", + GPIOD_IN); + if (IS_ERR(chip->busy_pin)) { + ret = PTR_ERR(chip->busy_pin); + dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n", + ret); + return ret; + } } indio_dev->name = spi_get_device_id(spi_dev)->name; @@ -409,9 +422,9 @@ static int ad7816_probe(struct spi_device *spi_dev) } static const struct spi_device_id ad7816_id[] = { - { "ad7816", 0 }, - { "ad7817", 0 }, - { "ad7818", 0 }, + { "ad7816", ID_AD7816 }, + { "ad7817", ID_AD7817 }, + { "ad7818", ID_AD7818 }, {} }; From patchwork Fri Nov 9 07:37:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishad Kamdar X-Patchwork-Id: 10675415 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 2360414BD for ; Fri, 9 Nov 2018 07:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DB202E6D9 for ; Fri, 9 Nov 2018 07:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 012252E6F7; Fri, 9 Nov 2018 07:37:28 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 A3E362E6D9 for ; Fri, 9 Nov 2018 07:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728022AbeKIRQq (ORCPT ); Fri, 9 Nov 2018 12:16:46 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39371 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbeKIRQq (ORCPT ); Fri, 9 Nov 2018 12:16:46 -0500 Received: by mail-pf1-f195.google.com with SMTP id n11-v6so550055pfb.6; Thu, 08 Nov 2018 23:37:27 -0800 (PST) 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=4+PAvBAE61dVOxvVN8/bfDlsvUQtrCUyU7kVnOn+CtI=; b=btTzOVlB6dWnEac6xl4QIMsbbuXtkwLsUBtSl0JGCToezCRNRI5zEAkM7SCU9Big0+ t5m6EudaRN/6jil11sVMp0nWTKwnnoQWmSi3NdmTQtHvMzOjC+U55PXF7S8yMBimCvnv bhtFagK6+wdHWf9EfKuysu43fy3xLhX9UsbYw6ofxD7aCMUg0cyavjadeTIqd3aQWOcj jpBgjwCvFX3uSB6o3qzYEQSxJgP7uXUx//765+JOTpdr9flKsPL6++G2EDoTJPknuW8D sZc3tzA7qUvA68f29Kg/NAWPPlXEcFA4GU+q/DdgyNP3cLBq1e8nvBOliy4RpeVQjdMe PAcQ== 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=4+PAvBAE61dVOxvVN8/bfDlsvUQtrCUyU7kVnOn+CtI=; b=ESctIyOrDN4cATI0w382Dd9WZGwBkgndqUo25N0wS87ROy51IUk12ZSahOsBy8jZ5+ 36nklyxNNAoAURkztMnIeZbNseTDK0vWrZROKJDWrxCAJhysByLeov+HyPng4hWfs3/K 1gIKDc8ePatp0pRIdglMTXqgx5Et9sajSsVJCW+ihQuaqpyqL9xU7WH7rGk+Qeulat8D Ji6GQJIDY7vdkfcY7tesULP3ftoPVkfH+AjkgC00QKx3koKyg1zp/OSfDbsuywARiyg1 RCyWmxK9itInWbjvBxEZfV6akC4Nddt7qdUbhKEQVi2mDPYn56QqDifsytqTLu1SEt/F LWpQ== X-Gm-Message-State: AGRZ1gKEZolSDTxlTLP+byJKDrp/O7yc56+GyvBhV4Na4VTFNyrMlx9A 6pn0fxLyizfzXeHVpQLkdkw= X-Google-Smtp-Source: AJdET5e4847IyrQCzTDChObQDm1w48qorPNr35gunbuxYlpp5GRrkwn4fZ4QSMkCkpF3d8dJEutnag== X-Received: by 2002:a63:6302:: with SMTP id x2mr6503038pgb.183.1541749046936; Thu, 08 Nov 2018 23:37:26 -0800 (PST) Received: from nishad ([106.210.186.71]) by smtp.gmail.com with ESMTPSA id w2-v6sm6714112pfn.89.2018.11.08.23.37.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 23:37:26 -0800 (PST) Date: Fri, 9 Nov 2018 13:07:18 +0530 From: Nishad Kamdar To: Lars-Peter Clausen Cc: Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/4] staging: iio: ad7816: Set RD/WR pin and CONVST pin as outputs. 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 The RD/WR pin and CONVST pin are logical inputs to the AD78xx chip as per the datasheet. Hence convert them to outputs. Signed-off-by: Nishad Kamdar --- drivers/staging/iio/adc/ad7816.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index 3cda5cd09365..a2fead85cd46 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -369,14 +369,15 @@ static int ad7816_probe(struct spi_device *spi_dev) chip->oti_data[i] = 203; chip->id = spi_get_device_id(spi_dev)->driver_data; - chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_IN); + chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_OUT_HIGH); if (IS_ERR(chip->rdwr_pin)) { ret = PTR_ERR(chip->rdwr_pin); dev_err(&spi_dev->dev, "Failed to request rdwr GPIO: %d\n", ret); return ret; } - chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert", GPIOD_IN); + chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert", + GPIOD_OUT_HIGH); if (IS_ERR(chip->convert_pin)) { ret = PTR_ERR(chip->convert_pin); dev_err(&spi_dev->dev, "Failed to request convert GPIO: %d\n", From patchwork Fri Nov 9 07:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishad Kamdar X-Patchwork-Id: 10675417 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 C358913BF for ; Fri, 9 Nov 2018 07:38:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B04E42DB9A for ; Fri, 9 Nov 2018 07:38:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A46892DBA1; Fri, 9 Nov 2018 07:38:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5AA592DB9A for ; Fri, 9 Nov 2018 07:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728276AbeKIRSA (ORCPT ); Fri, 9 Nov 2018 12:18:00 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41875 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbeKIRSA (ORCPT ); Fri, 9 Nov 2018 12:18:00 -0500 Received: by mail-pg1-f193.google.com with SMTP id 70so498829pgh.8; Thu, 08 Nov 2018 23:38:41 -0800 (PST) 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=mv3W8L/OrmYU2mKhLZMK0Ul1e9qD7XLq6l5YIls48S0=; b=EraU+Qkxc1/6VnYGNeJltz2WWcrkWjQb3lT4M94pebvZEncZkOanqM8NMOtEsYV1ym BBAYztr89QWKEm16QTvyD0Y2ZiHIF0wSRuKzWnXqmObAo5laVAb193h1xe9moZDjldPl lE0MoiZbLzSugt0ZokfL3l9DNtTf/Da7o97R8/EjPXhdreBgeUL7X4EnKb+t9uJhdm1C ioiITfy+1bMogec6cjbDbbzJ9R1ak+V79dhvngrXPdPy+x/EKKD97mGnPJr/916lqrc4 Zv/Ml+Txp5hTTTlezV5+hB8CPEZqrz1gNKlaHURoUzq7ZK70yVFfKPFoheroiUEgYRsb xq9Q== 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=mv3W8L/OrmYU2mKhLZMK0Ul1e9qD7XLq6l5YIls48S0=; b=DDGPpqu+GzmK/1tObpIii+YX4nv3/0cSsFLoslIOg3QQVCOMi2QrRIi+jN4jaQqAW5 oh5kTSFJzX3WQwdMA62SD1GXuD+eIryreo3EWsI1WBNJfyKYqeaYYumkruZHovvKO385 WWrkOsA5jzwfBISCLWI8dw+quzb31iy1OVkdRaQR1+lm0LwV14NjTHCZjIdcvqvEUqJs eNV2WTx6fdcGebOovZt34I4V8Ef3TyQs+buYjm+LUprhhUnw6hCc6HfBz8qLteNradO8 UfqycpXSPfHdjNUNMRCm2eT3VSmD2pyrypCsnEDaD51bkfqaBlEMRpm5HRS06JdKaRdH LsgA== X-Gm-Message-State: AGRZ1gIkaQJ2en+QPZmbpE9PFevgaquHIY7tzGR1/vNt/82kqvSuCcK9 zzUYcObi4bZ7DHDL7l0GsMc= X-Google-Smtp-Source: AJdET5dQ4HDrzyjxjzqP5hL2Hi1PKdgkZ/fdve9EViF7H6OcM6TjzCzniUg/QqY3lueR3kXKC7pKdQ== X-Received: by 2002:a63:4e41:: with SMTP id o1mr6705523pgl.282.1541749120981; Thu, 08 Nov 2018 23:38:40 -0800 (PST) Received: from nishad ([106.210.186.71]) by smtp.gmail.com with ESMTPSA id r6-v6sm333838pfk.157.2018.11.08.23.38.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 23:38:40 -0800 (PST) Date: Fri, 9 Nov 2018 13:08:32 +0530 From: Nishad Kamdar To: Lars-Peter Clausen Cc: Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/4] staging: iio: ad7816: Add device tree table. Message-ID: <209172d47d8d14c1244556e5f05bbd6455b4de04.1541733949.git.nishadkamdar@gmail.com> 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 Add device tree table for matching vendor ID. Signed-off-by: Nishad Kamdar --- drivers/staging/iio/adc/ad7816.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index a2fead85cd46..b8a9149fbac1 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -422,6 +422,12 @@ static int ad7816_probe(struct spi_device *spi_dev) return 0; } +static const struct of_device_id ad7816_of_match[] = { + { .compatible = "adi,ad7816", }, + { } +}; +MODULE_DEVICE_TABLE(of, ad7816_of_match); + static const struct spi_device_id ad7816_id[] = { { "ad7816", ID_AD7816 }, { "ad7817", ID_AD7817 }, @@ -434,6 +440,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id); static struct spi_driver ad7816_driver = { .driver = { .name = "ad7816", + .of_match_table = of_match_ptr(ad7816_of_match), }, .probe = ad7816_probe, .id_table = ad7816_id,