* [PATCH 0/2] add enable gpio support for a24 eeprom driver
@ 2022-08-16 13:00 Eliav Farber
2022-08-16 13:00 ` [PATCH 1/2] dt-bindings: at24: new optional property - enable-gpios Eliav Farber
2022-08-16 13:00 ` [PATCH 2/2] eeprom: at24: add enable gpio support Eliav Farber
0 siblings, 2 replies; 5+ messages in thread
From: Eliav Farber @ 2022-08-16 13:00 UTC (permalink / raw)
To: brgl, robh+dt, mark.rutland, arnd, gregkh, linux-i2c, devicetree,
linux-kernel
Cc: farbere, talel, hhhawa, jonnyc, hanochu, ronenk, itamark,
shellykz, shorer, amitlavi, almogbs, dwmw
First patch describes the new binding property.
Second patch adds the functionality to the driver.
Eliav Farber (2):
dt-bindings: at24: new optional property - enable-gpios
eeprom: at24: add enable gpio support
Documentation/devicetree/bindings/eeprom/at24.txt | 3 +++
drivers/misc/eeprom/at24.c | 5 +++++
2 files changed, 8 insertions(+)
--
2.37.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dt-bindings: at24: new optional property - enable-gpios
2022-08-16 13:00 [PATCH 0/2] add enable gpio support for a24 eeprom driver Eliav Farber
@ 2022-08-16 13:00 ` Eliav Farber
2022-08-18 1:48 ` Rob Herring
2022-08-16 13:00 ` [PATCH 2/2] eeprom: at24: add enable gpio support Eliav Farber
1 sibling, 1 reply; 5+ messages in thread
From: Eliav Farber @ 2022-08-16 13:00 UTC (permalink / raw)
To: brgl, robh+dt, mark.rutland, arnd, gregkh, linux-i2c, devicetree,
linux-kernel
Cc: farbere, talel, hhhawa, jonnyc, hanochu, ronenk, itamark,
shellykz, shorer, amitlavi, almogbs, dwmw
Boards using the AT24 EEPROMs might have a GPIO that must be set to
enable the chip (e.g. pin that controls the power supply).
Add a new optional property to the device tree binding document, which
allows to specify the GPIO line to which the enable pin is connected.
On Linux this means that we need to hog the line at the beginning of
probe function.
Signed-off-by: Eliav Farber <farbere@amazon.com>
---
Documentation/devicetree/bindings/eeprom/at24.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
index f9a7c984274c..553b53ed3e4c 100644
--- a/Documentation/devicetree/bindings/eeprom/at24.txt
+++ b/Documentation/devicetree/bindings/eeprom/at24.txt
@@ -73,6 +73,9 @@ Optional properties:
- wp-gpios: GPIO to which the write-protect pin of the chip is connected.
+ - enable-gpios: GPIO to enables the chip (e.g. pin that controls the eeprom
+ power supply).
+
- address-width: number of address bits (one of 8, 16).
Example:
--
2.37.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] eeprom: at24: add enable gpio support
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-16 13:00 ` Eliav Farber
1 sibling, 0 replies; 5+ messages in thread
From: Eliav Farber @ 2022-08-16 13:00 UTC (permalink / raw)
To: brgl, robh+dt, mark.rutland, arnd, gregkh, linux-i2c, devicetree,
linux-kernel
Cc: farbere, talel, hhhawa, jonnyc, hanochu, ronenk, itamark,
shellykz, shorer, amitlavi, almogbs, dwmw
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: at24: new optional property - enable-gpios
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
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2022-08-18 1:48 UTC (permalink / raw)
To: Eliav Farber
Cc: brgl, mark.rutland, arnd, gregkh, linux-i2c, devicetree,
linux-kernel, talel, hhhawa, jonnyc, hanochu, ronenk, itamark,
shellykz, shorer, amitlavi, almogbs, dwmw
On Tue, Aug 16, 2022 at 01:00:01PM +0000, Eliav Farber wrote:
> Boards using the AT24 EEPROMs might have a GPIO that must be set to
> enable the chip (e.g. pin that controls the power supply).
>
If this is a power supply control, use a gpio regulator.
> Add a new optional property to the device tree binding document, which
> allows to specify the GPIO line to which the enable pin is connected.
>
> On Linux this means that we need to hog the line at the beginning of
> probe function.
>
> Signed-off-by: Eliav Farber <farbere@amazon.com>
> ---
> Documentation/devicetree/bindings/eeprom/at24.txt | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
> index f9a7c984274c..553b53ed3e4c 100644
> --- a/Documentation/devicetree/bindings/eeprom/at24.txt
> +++ b/Documentation/devicetree/bindings/eeprom/at24.txt
> @@ -73,6 +73,9 @@ Optional properties:
>
> - wp-gpios: GPIO to which the write-protect pin of the chip is connected.
>
> + - enable-gpios: GPIO to enables the chip (e.g. pin that controls the eeprom
> + power supply).
> +
> - address-width: number of address bits (one of 8, 16).
>
> Example:
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: at24: new optional property - enable-gpios
2022-08-18 1:48 ` Rob Herring
@ 2022-08-18 15:59 ` Farber, Eliav
0 siblings, 0 replies; 5+ messages in thread
From: Farber, Eliav @ 2022-08-18 15:59 UTC (permalink / raw)
To: Rob Herring
Cc: brgl, mark.rutland, arnd, gregkh, linux-i2c, devicetree,
linux-kernel, talel, hhhawa, jonnyc, hanochu, ronenk, itamark,
shellykz, shorer, amitlavi, almogbs, dwmw
On 8/18/2022 4:48 AM, Rob Herring wrote:
> If this is a power supply control, use a gpio regulator.
It is indeed a power supply control.
I'll push a new series that uses a gpio regulator.
--
Thanks, Eliav
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-18 16:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] eeprom: at24: add enable gpio support Eliav Farber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).