diff mbox series

[2/2] eeprom: at24: add enable gpio support

Message ID 20220816130002.41450-3-farbere@amazon.com
State New
Headers show
Series add enable gpio support for a24 eeprom driver | expand

Commit Message

Farber, Eliav Aug. 16, 2022, 1 p.m. UTC
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 mbox series

Patch

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);