From patchwork Mon Jun 18 07:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 138858 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3643890lji; Mon, 18 Jun 2018 00:46:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLsed1WMgi83eqG1WWGRLpCxcXPSsxl+2pFqVfM6gVvzCQU3aZOqP39dqprQZc9k1warQ3D X-Received: by 2002:a65:4042:: with SMTP id h2-v6mr9808803pgp.78.1529307977249; Mon, 18 Jun 2018 00:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529307977; cv=none; d=google.com; s=arc-20160816; b=BtDwSLxq0JCusDx4Uk+Ny2+xS+Cn6FepJlZhP+b04cINqLoERTJw2Yhj2OV9yUnRDx ZY9J88i3mret3ZyxnNeUQL9cLQXFWlE3nqqe4Z6Szeth7CrEIspGh1slWpqiumJ/Ecgz PnSQB6XlWq0gy41h6ugLu1aqFQWZE3D4MXJ4KSUVb0hYrFBUF6aeJTBTP9dUATV82H8J A8gDfB/vygkjAi/+WOwiTZJq3zgs5cq5A9c7gpYNAdCS5BpqsgRiSOC1hDtLakkHoz6e 03KN61g0iEBlNbfITjyGNnKH0Dc1ohOwzQtD8Y/duGZSmc7kt+OHBVvn9stHDmWE/6qW lKGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=gvsGev3u9e1hEWqHZHqWYO1Z2wqWK1c8tfca0ATMOEg=; b=LbexaraxfnBsatlpWtWkMImtLCDpHai5Z0rGWI06DeDOt8WIfYRsvqSUGc+Nr3S7K2 vR2XENX4Fh04AwYhYFAodD9Dwyj6zkfwRMgygLbw047/qawereXQzOWrQviawwar8WL5 /bc4OxgBObPnA9r/KNYLz+xGPb4nSHDeyQTgqT3zvaIDz+YlzKYaGFqa/3dQP8p6Qfu4 c+XqpOJfmOc7rKWdSKz11+PDXEmCwT+HmjAND/z6/OGwo44AkaPMmow7/w/FLQaVRMyI BqLyQm0oypo8vxMfITSQ93Jwhp4O0e+jq6yNAr0WC6j29A4sI5cnm3otL547GHLRXe7T lQbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZgCJ2MTm; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2-v6si11655956pgs.59.2018.06.18.00.46.16; Mon, 18 Jun 2018 00:46:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZgCJ2MTm; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754908AbeFRHqQ (ORCPT + 5 others); Mon, 18 Jun 2018 03:46:16 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:37438 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754655AbeFRHqP (ORCPT ); Mon, 18 Jun 2018 03:46:15 -0400 Received: by mail-lf0-f67.google.com with SMTP id g21-v6so23138317lfb.4 for ; Mon, 18 Jun 2018 00:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=f5/ByYi5LPGeYwNpayKevBwrrBY79aGtPsGnxBORLEQ=; b=ZgCJ2MTmsgNAkZTec1fe/rIjAgB1hVh/UQ0NJibybhCOcvel+b7GSNfaLdKMVGjgtn OQVefsjhMKIyZOVUiMbScCaZPSKKE/1zKwV+zcCgYmZCyH1QZbEcpDEj0a4FtlwOQVIs NGIoIDkfgdt9cZXu6tT4m0LRpA+2bRYO6j8xo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=f5/ByYi5LPGeYwNpayKevBwrrBY79aGtPsGnxBORLEQ=; b=anzi/him3epIs7seS8qzY4P+vRSRLFwv/D3bznZ7ZnDs/uoNSg9WoayAvRyEjOJS4p 17+cSymKQExdmMimR6Lbu7QlY5gAmAY6AOxMkgss4EHpiTe07JFQAUFtflsa1+b3Z/Ks iCVXpZBQsiPKK+h0+XQzjdLB4kpqFh33oF5zgR8DMhLAebOpcPmqk6YPoaSf+yD1gsiP sHl0No9Y94KRvhz2OlRlXxdxmmMFz+VvyR0XWE5aXkXwTKBqubLXx4IOK1PS18/BS8O0 LPoPUV0Dh1yhi06PuOB1Zc3z5AEHehddvi29Grod11HQzuke7X02rz2IFqmURo8amYR0 cRBw== X-Gm-Message-State: APt69E3L8GJ1hPkA9+vtuKRMXCJ8ABWURs+wlg6ly3PaOuGh7myiWgCq V41u/1+3NOJ8CxOzUQqNyKGNIHnFEc8= X-Received: by 2002:a19:9844:: with SMTP id a65-v6mr2633692lfe.29.1529307974346; Mon, 18 Jun 2018 00:46:14 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18-v6sm2616390ljh.63.2018.06.18.00.46.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 00:46:13 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dev@lists.96boards.org Cc: John Stultz , Manivannan Sadhasivam , Rob Herring , Mark Rutland , Frank Rowand , Mark Brown , Michal Simek , Andy Shevchenko , Mika Westerberg , Arnd Bergmann , Linus Walleij Subject: [PATCH 2/5] RFC: eeprom: at24: Allow passing gpiodesc from pdata Date: Mon, 18 Jun 2018 09:45:53 +0200 Message-Id: <20180618074556.6944-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180618074556.6944-1-linus.walleij@linaro.org> References: <20180618074556.6944-1-linus.walleij@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This makes it possible to pass an initialized GPIO descriptor to the driver through platform data. This is useful when we are dealing with EEPROMs on expansion boards where the GPIO has to be looked up indirectly using a connector abstraction (several systems using the same connector) so the machine descriptor tables cannot be used to associate the descriptor with the device and we then want to pass this descriptor on to the EEPROM driver this way instead. Signed-off-by: Linus Walleij --- drivers/misc/eeprom/at24.c | 6 +++++- include/linux/platform_data/at24.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index f5cc517d1131..d577cdbe221e 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -662,7 +662,11 @@ static int at24_probe(struct i2c_client *client) at24->client[0].client = client; at24->client[0].regmap = regmap; - at24->wp_gpio = devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_HIGH); + if (pdata.wp_gpiod) + at24->wp_gpio = pdata.wp_gpiod; + else + at24->wp_gpio = + devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_HIGH); if (IS_ERR(at24->wp_gpio)) return PTR_ERR(at24->wp_gpio); diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h index 63507ff464ee..5606fb2ef76c 100644 --- a/include/linux/platform_data/at24.h +++ b/include/linux/platform_data/at24.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * struct at24_platform_data - data to set up at24 (generic eeprom) driver @@ -55,6 +56,7 @@ struct at24_platform_data { void (*setup)(struct nvmem_device *nvmem, void *context); void *context; + struct gpio_desc *wp_gpiod; }; #endif /* _LINUX_AT24_H */