Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1100149imu; Tue, 20 Nov 2018 11:41:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uwnkx1hfcYIqWPtPOu0Bhd1Csuyy2mPD1Pz8mr7wVkUW5hDrNddwFuJ0pXKAJ5HMLCHWom X-Received: by 2002:a17:902:4464:: with SMTP id k91mr3611620pld.13.1542742882884; Tue, 20 Nov 2018 11:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542742882; cv=none; d=google.com; s=arc-20160816; b=V8q4CDtNxhV+NngG6oVqmputpYgCHBtkhvluPVM5Yj0R9kOlopxMEHdwPtP5X6XHVy 8oDmMXYjitSz9qB0UrXf0NBjhc/2SkEhjHhNIAnMbJVsQq1+5QGPBQLcSQWtnkBuh9YV 1CBMgx7QbLPq7b9Ppb1c8hc/RBSJLI7oVS7wVDIQja5EI0l5DauvpmQmVgL+20TUUlfi 5b7Nx+J+fPhSh3H4Jgj8H0xioSBWaSDtNIj/e2M/SelgdjC45cXMa8YZhMUx/MjR3BDQ orQrz72ixPDM+JmlDOHQu1FnJTS2wpA/AmGvlkuIwWfW/lJrbuUxC0YhzMRQ7x4aRl5F B9TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=zNs2xBlZTXJMas/ITpZ31ZhslFUYpV/Egqz6U1dNoRs=; b=fWGQ+yx1cEcNBqM1kDfdKteMNiRkRyWyl5zrtKopEOUGwy0QPwELQHEdHV/TgKxS3+ 8GP/fu5SI8pYTW7YoZ20uGyKM2lhtSqpf1DDIHQB6/o7nHeGaAL+3C/G/2lqISp9wiQE aCs0DvDiqYO3GC59++Xb7zs7bFk+wRAciy0W4AFdPNUkhaPu2ZjCpkjyZpfZIZYwVqH5 MMMIQfdWtlrbogmPQC5wQ9WmLpm4NBBBF7N7cWcwDKx3uKEKdNFia3ZjH7RfFl4QSymr 1oLq0uhYCT593rj2nPEICI1NyLcxsKr5nwrATpAGZxq6VHXpbWHm389UJ2jknCfcOecA HEAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hY0gtWxX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 41-v6si22712312plb.102.2018.11.20.11.41.07; Tue, 20 Nov 2018 11:41:22 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=hY0gtWxX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729796AbeKUDYu (ORCPT + 99 others); Tue, 20 Nov 2018 22:24:50 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46560 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbeKUDYu (ORCPT ); Tue, 20 Nov 2018 22:24:50 -0500 Received: by mail-pl1-f195.google.com with SMTP id t13so1252505ply.13; Tue, 20 Nov 2018 08:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=zNs2xBlZTXJMas/ITpZ31ZhslFUYpV/Egqz6U1dNoRs=; b=hY0gtWxXaEwzMwiiCjFUNAtFtcH3i4uRqQtVOss1FKN1xV8ejI6VnanSfU+FF2+KCf lu2IBdkf150c5qiknE3W9Z6u6/UP8TyoDqkG9Wtn7cLLEQmyOr8krOU272DOgXXf+vj7 w4kUca6u8cDPYHa+wMpXV9md2LSSFEBMQJwFNRw0/5JEZVDijbdJc1LTw/Tkfv4yFqRw 3zVfdVe4Xxgg+lhvPFnZv1dL9kdoBj/w4et8DNLtXgVHrdX+OeITT9HJKDgCewtuUGDg ECdtpIxaRuL+cmvExXfGKv6B/WlUBQnXMyYraFm1FMLUhXJeRUrRP2y6mLLXHQvxio82 nPVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=zNs2xBlZTXJMas/ITpZ31ZhslFUYpV/Egqz6U1dNoRs=; b=Uz1ZuZpivgfjO/famuTwFmjDkW6w5CYeSSMXBPDl9vlqsVIi7DxFTb34TWklHjYLOr 8G1sybpj8gi9Gg7mxtKCY0msLi86j1HA5CBavRU9G1KDVl8NTYD1H21pkfhkTF5QK672 gC7uC3rYSf/EPpNBeFAPlOUJNHwp7IIpKVT43c5cXQcVwUT1aItA03LFyyCggYPfbBwH FtZTFfzn6mmfSNnD2dtCgwE0ZloHx5IKx4TwAdHn/2jBrrT+fwi9I+CTzQNfF4MmTXAd 4jUoKOb+knbZ+r60bHmLuN9IXH7DUlpkNGSvCBxulg2TbRMIGANqeF6xdbcpfGjjTcxe cJaA== X-Gm-Message-State: AA+aEWZftTewxCWY2ieFwIXcPRFIJUJKWBEK1IvyNIqGGkQWVB4uE2iH 8Vw4a7ZFsR0d9/9JRSWouOk= X-Received: by 2002:a17:902:20e9:: with SMTP id v38mr1600686plg.250.1542732884190; Tue, 20 Nov 2018 08:54:44 -0800 (PST) Received: from localhost.localdomain ([103.212.140.152]) by smtp.gmail.com with ESMTPSA id r83sm64235709pfc.115.2018.11.20.08.54.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 08:54:43 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] Staging: iio: adt7316: Use device tree data to set ldac_pin Date: Tue, 20 Nov 2018 22:24:36 +0530 Message-Id: <20181120165436.7178-1-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make the driver use device tree instead of the platform data. Hence, use devm_gpiod_get_optional function to get the data from device tree for ldac-pin and accordingly make the needed changes in the driver. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index 3f22d1088713..deb2f7b40f60 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c @@ -177,7 +177,7 @@ struct adt7316_chip_info { struct adt7316_bus bus; - u16 ldac_pin; + struct gpio_desc *ldac_pin; u16 int_mask; /* 0x2f */ u8 config1; u8 config2; @@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct device *dev, if (ret) return -EIO; } else { - gpio_set_value(chip->ldac_pin, 0); - gpio_set_value(chip->ldac_pin, 1); + gpiod_set_value(chip->ldac_pin, 0); + gpiod_set_value(chip->ldac_pin, 1); } return len; @@ -2120,7 +2120,13 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, else return -ENODEV; - chip->ldac_pin = adt7316_platform_data[1]; + chip->ldac_pin = devm_gpiod_get_optional(dev, "ldac", GPIOD_OUT_LOW); + if (IS_ERR(chip->ldac_pin)) { + ret = PTR_ERR(chip->ldac_pin); + dev_err(dev, "Failed to request ldac GPIO: %d\n", ret); + return ret; + } + if (chip->ldac_pin) { chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA; if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX) -- 2.17.1