2022-05-09 03:18:23

by Markuss Broks

[permalink] [raw]
Subject: [PATCH v7 0/2] Make AUX gpio pin optional for ktd2692

Some appliances of ktd2692 don't have the AUX pin connected to
a GPIO. Specifically, Samsung Galaxy J5 (2015), which uses ktd2692
for driving the front flash LED, has the pin not connected anywhere on
schematics. Make specifying the AUX pin optional, since it is additional
functionality and only affects amount of current going through the LED.

Also convert the txt device-tree bindings to yaml and pick up maintenance
over the yaml binding and the driver itself.

v2:
- fix the dt_binding_check
v3:
- set the aux_gpio to NULL to avoid passing ERR_PTR as a gpio
v4:
- maintainership -> maintenance (description)
- remove the if (led->aux_gpio)
- use devm_gpiod_get_optional for aux gpio
v5:
- use ret to pass a correct error return code (Christophe)
v6:
- use PTR_ERR properly (when IS_ERR is true) (Christophe)
v6-a:
- ended up being a mess, corrected-v2 should have proper tags now
v7:
- drop the MAINTAINERS part

Markuss Broks (2):
dt-bindings: leds: convert ktd2692 bindings to yaml
leds: ktd2692: Make aux-gpios optional

.../bindings/leds/kinetic,ktd2692.yaml | 87 +++++++++++++++++++
.../devicetree/bindings/leds/leds-ktd2692.txt | 50 -----------
MAINTAINERS | 6 ++
drivers/leds/flash/leds-ktd2692.c | 18 ++--
4 files changed, 103 insertions(+), 58 deletions(-)
create mode 100644 Documentation/devicetree/bindings/leds/kinetic,ktd2692.yaml
delete mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt

--
2.35.1



2022-05-09 08:34:54

by Markuss Broks

[permalink] [raw]
Subject: [PATCH v7 2/2] leds: ktd2692: Make aux-gpios optional

Make the AUX pin optional, since it isn't a core part of functionality,
and the device is designed to be operational with only one CTRL pin.

Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Markuss Broks <[email protected]>
---
drivers/leds/flash/leds-ktd2692.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/flash/leds-ktd2692.c b/drivers/leds/flash/leds-ktd2692.c
index ed1f20a58bf6..1736b3f6b899 100644
--- a/drivers/leds/flash/leds-ktd2692.c
+++ b/drivers/leds/flash/leds-ktd2692.c
@@ -284,9 +284,9 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
return ret;
}

- led->aux_gpio = devm_gpiod_get(dev, "aux", GPIOD_ASIS);
- ret = PTR_ERR_OR_ZERO(led->aux_gpio);
- if (ret) {
+ led->aux_gpio = devm_gpiod_get_optional(dev, "aux", GPIOD_ASIS);
+ if (IS_ERR(led->aux_gpio)) {
+ ret = PTR_ERR(led->aux_gpio);
dev_err(dev, "cannot get aux-gpios %d\n", ret);
return ret;
}
--
2.35.1