From: Linus Walleij <linus.walleij@linaro.org> To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dev@lists.96boards.org Cc: Mark Rutland <mark.rutland@arm.com>, Arnd Bergmann <arnd@arndb.de>, Mika Westerberg <mika.westerberg@linux.intel.com>, Linus Walleij <linus.walleij@linaro.org>, Michal Simek <michal.simek@xilinx.com>, Rob Herring <robh+dt@kernel.org>, Mark Brown <broonie@kernel.org>, John Stultz <john.stultz@linaro.org>, linux-i2c@vger.kernel.org, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Frank Rowand <frowand.list@gmail.com>, Bartosz Golaszewski <brgl@bgdev.pl>, Andy Shevchenko <andy@infradead.org> Subject: [PATCH 1/4] eeprom: at24: Allow passing gpiodesc from pdata Date: Thu, 23 Aug 2018 12:33:29 +0200 [thread overview] Message-ID: <20180823103332.32047-2-linus.walleij@linaro.org> (raw) In-Reply-To: <20180823103332.32047-1-linus.walleij@linaro.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. Cc: Bartosz Golaszewski <brgl@bgdev.pl> Cc: linux-i2c@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v1->v2: - No changes - Requesting an ACK from the EEPROM maintainer (Bartosz) so we can apply this to the ARM SoC tree with the series depending on it. --- drivers/misc/eeprom/at24.c | 6 +++++- include/linux/platform_data/at24.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 <linux/types.h> #include <linux/nvmem-consumer.h> #include <linux/bitops.h> +#include <linux/gpio/consumer.h> /** * 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 */ -- 2.17.0
WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] eeprom: at24: Allow passing gpiodesc from pdata Date: Thu, 23 Aug 2018 12:33:29 +0200 [thread overview] Message-ID: <20180823103332.32047-2-linus.walleij@linaro.org> (raw) In-Reply-To: <20180823103332.32047-1-linus.walleij@linaro.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. Cc: Bartosz Golaszewski <brgl@bgdev.pl> Cc: linux-i2c at vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v1->v2: - No changes - Requesting an ACK from the EEPROM maintainer (Bartosz) so we can apply this to the ARM SoC tree with the series depending on it. --- drivers/misc/eeprom/at24.c | 6 +++++- include/linux/platform_data/at24.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 <linux/types.h> #include <linux/nvmem-consumer.h> #include <linux/bitops.h> +#include <linux/gpio/consumer.h> /** * 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 */ -- 2.17.0
next prev parent reply other threads:[~2018-08-23 10:33 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-23 10:33 [PATCH 0/4 v1] Mezzanine Low Speed connector bus Linus Walleij 2018-08-23 10:33 ` Linus Walleij 2018-08-23 10:33 ` Linus Walleij [this message] 2018-08-23 10:33 ` [PATCH 1/4] eeprom: at24: Allow passing gpiodesc from pdata Linus Walleij 2018-08-23 11:14 ` Bartosz Golaszewski 2018-08-23 11:14 ` Bartosz Golaszewski 2018-08-23 10:33 ` [PATCH 2/4] spi: Make of_find_spi_device_by_node() available Linus Walleij 2018-08-23 10:33 ` Linus Walleij 2018-08-23 10:33 ` [PATCH 3/4] bus: Add DT bindings for 96Boards low speed connector Linus Walleij 2018-08-23 10:33 ` Linus Walleij 2018-08-23 13:45 ` Rob Herring 2018-08-23 13:45 ` Rob Herring 2018-09-05 9:05 ` Linus Walleij 2018-09-05 9:05 ` Linus Walleij 2018-08-23 10:33 ` [PATCH 4/4] bus: 96boards Low-Speed Connector Linus Walleij 2018-08-23 10:33 ` Linus Walleij 2018-08-23 23:06 ` [PATCH 0/4 v1] Mezzanine Low Speed connector bus Frank Rowand 2018-08-23 23:06 ` Frank Rowand 2018-08-24 7:28 ` Linus Walleij 2018-08-24 7:28 ` Linus Walleij 2018-11-15 16:26 ` Frank Rowand 2018-11-15 16:26 ` Frank Rowand 2018-11-15 22:59 ` Linus Walleij 2018-11-15 22:59 ` Linus Walleij 2018-11-16 0:16 ` Frank Rowand 2018-11-16 0:16 ` Frank Rowand
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180823103332.32047-2-linus.walleij@linaro.org \ --to=linus.walleij@linaro.org \ --cc=andy@infradead.org \ --cc=arnd@arndb.de \ --cc=brgl@bgdev.pl \ --cc=broonie@kernel.org \ --cc=dev@lists.96boards.org \ --cc=devicetree@vger.kernel.org \ --cc=frowand.list@gmail.com \ --cc=john.stultz@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-i2c@vger.kernel.org \ --cc=manivannan.sadhasivam@linaro.org \ --cc=mark.rutland@arm.com \ --cc=michal.simek@xilinx.com \ --cc=mika.westerberg@linux.intel.com \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.