lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] eeprom: at24: add enable gpio support
Date
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
\
 
 \ /
  Last update: 2022-08-16 15:04    [W:1.282 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site