Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4440244imu; Sun, 25 Nov 2018 03:50:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/U0zGdEPLD5acjkA4pQ35GvKigySxxuWy6DGshs6ohEz36QhBG0B7+NKjAd/Ar/6yWW5Lgk X-Received: by 2002:a17:902:f091:: with SMTP id go17mr23679556plb.235.1543146604641; Sun, 25 Nov 2018 03:50:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543146604; cv=none; d=google.com; s=arc-20160816; b=wNtFacU5cADE5LdPutlFd5Mcx0TQVk4bvHs+eeQe20JUiVAg6R0KM3OEok+97uso4H zE0kOFi30Dz70470Jo+ifWlPUAFY/nsgtbv/6lXh4dVM9SylwCX8rapPN/cuaGKB0yJB sxFrtmmLFsPIFqLbiIzQBUB+2DunRjkwBhEjv26NpaDVrdjjJfQCZuryULJtJZK2pKGP 41/24WYSb0wBf2N5vvb6YWvejYIs8YyTOkC+OQ4aWX4qVbvmBprFbf/u+D2kn9G6TRkr s1yER2MZHsXKTkU/L1JdaFUxWWezmiMGwvvPgbR5nChogy08NHU0P65je4lBn8XYpZAy Xb8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NIThjjmBiDmb5Gk1lUdeYApS0lbkO6q+ee+LPNdO3Bs=; b=amnPpYWTdXtQxjXlq4DHs1e3Gx/NpEZNc27MlZWNfBUw4tN9BVSpS/RmUJr5ySOpJQ gtpGyy+7RnjXuAMAhIBXAaeeIzDdJYqKiB1BhWNgtzhTfGS3ccTcPZp9WHTAEAqVSWSs Mto47jQs5uBs+bczULtIkabVijCZ++X+FDrDVFA8QCzykm2BL0+RkGUSVNCfLhEvmQsd z7l665Raj6Fe/csuSFTgVsrrdNcF+wY7CretLGvPwqzY5ZuvMCNXElMwpF9vRaJkdgfU tH3HplX/SxkLuOuZUhRdxvGBhatXi3gt/p/s1O5fW+hNfl8JCEdcT3L41f2mP+iEp0/j HN+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aRY3W0UL; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si62808766plc.140.2018.11.25.03.49.48; Sun, 25 Nov 2018 03:50:04 -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=@kernel.org header.s=default header.b=aRY3W0UL; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbeKYWkH (ORCPT + 99 others); Sun, 25 Nov 2018 17:40:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:34082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbeKYWkH (ORCPT ); Sun, 25 Nov 2018 17:40:07 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 27BDF20865; Sun, 25 Nov 2018 11:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543146551; bh=yc/BKMMV0TH6Gud/B9bpI5u6a3EiK9I6cembrh2YkIs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aRY3W0ULtQbJeA77pRDH0XqgPeoT6WeGCF0hbmfhGxJE+81P78EcXss7sVSHAd12m 0rzvGf/87kEO/qhlXnKFAh4N89UCiDadHcfXy2yaDy7QMKo+vo0W0EAW9jhs7CKqxt p4enPsuctVbp/EwMlXrR7GGrffUxYiExZX/6Rn/Q= Date: Sun, 25 Nov 2018 11:49:07 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, 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: Re: [PATCH v2 2/5] Staging: iio: adt7316: Use device tree data to set ldac_pin Message-ID: <20181125114907.0691c6c7@archlinux> In-Reply-To: <20181120165436.7178-1-shreeya.patel23498@gmail.com> References: <20181120165436.7178-1-shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Nov 2018 22:24:36 +0530 Shreeya Patel wrote: > 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 Sorry, missed this previously. This is definitely a non standard gpio name, so should be prefixed in the binding and here with adi, I'll fix up, but please check I didn't mess it up! Applied with that change to the togreg branch of iio.git. Thanks, Jonathan > --- > 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)