All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eliav Farber <farbere@amazon.com>
To: <brgl@bgdev.pl>, <robh+dt@kernel.org>, <mark.rutland@arm.com>,
	<arnd@arndb.de>, <gregkh@linuxfoundation.org>,
	<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <farbere@amazon.com>, <talel@amazon.com>, <hhhawa@amazon.com>,
	<jonnyc@amazon.com>, <hanochu@amazon.com>, <ronenk@amazon.com>,
	<itamark@amazon.com>, <shellykz@amazon.com>, <shorer@amazon.com>,
	<amitlavi@amazon.com>, <almogbs@amazon.com>, <dwmw@amazon.co.uk>
Subject: [PATCH 2/2] eeprom: at24: add enable gpio support
Date: Tue, 16 Aug 2022 13:00:02 +0000	[thread overview]
Message-ID: <20220816130002.41450-3-farbere@amazon.com> (raw)
In-Reply-To: <20220816130002.41450-1-farbere@amazon.com>

Add gpio support to enable the eeprom device as part of probe sequence.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/misc/eeprom/at24.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index dc3537651b80..06535b9e1da5 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -623,6 +623,7 @@ static int at24_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	bool i2c_fn_i2c, i2c_fn_block;
 	unsigned int i, num_addresses;
+	struct gpio_desc *enable_gpio;
 	struct at24_data *at24;
 	struct regmap *regmap;
 	size_t at24_size;
@@ -630,6 +631,10 @@ static int at24_probe(struct i2c_client *client)
 	u8 test_byte;
 	int err;
 
+	enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(enable_gpio))
+		return PTR_ERR(enable_gpio);
+
 	i2c_fn_i2c = i2c_check_functionality(client->adapter, I2C_FUNC_I2C);
 	i2c_fn_block = i2c_check_functionality(client->adapter,
 					       I2C_FUNC_SMBUS_WRITE_I2C_BLOCK);
-- 
2.37.1


      parent reply	other threads:[~2022-08-16 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 13:00 [PATCH 0/2] add enable gpio support for a24 eeprom driver Eliav Farber
2022-08-16 13:00 ` [PATCH 1/2] dt-bindings: at24: new optional property - enable-gpios Eliav Farber
2022-08-18  1:48   ` Rob Herring
2022-08-18 15:59     ` Farber, Eliav
2022-08-16 13:00 ` Eliav Farber [this message]

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=20220816130002.41450-3-farbere@amazon.com \
    --to=farbere@amazon.com \
    --cc=almogbs@amazon.com \
    --cc=amitlavi@amazon.com \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw@amazon.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanochu@amazon.com \
    --cc=hhhawa@amazon.com \
    --cc=itamark@amazon.com \
    --cc=jonnyc@amazon.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=ronenk@amazon.com \
    --cc=shellykz@amazon.com \
    --cc=shorer@amazon.com \
    --cc=talel@amazon.com \
    /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: link
Be 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.