Message ID | 20220614142704.155496-1-jjhiblot@traphandler.com |
---|---|
Headers | show |
Series | Add support for the TLC5925 | expand |
On Tue, Jun 14, 2022 at 4:27 PM Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote: > > The TLC5925 is a 16-channels constant-current LED sink driver. > It is controlled via SPI but doesn't offer a register-based interface. > Instead it contains a shift register and latches that convert the > serial input into a parallel output. > > Datasheet: https://www.ti.com/lit/ds/symlink/tlc5925.pdf > No blank lines are allowed in the tag block. > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com> ... > +#include <linux/err.h> > +#include <linux/leds.h> > +#include <linux/module.h> > +#include <linux/property.h> > +#include <linux/spi/spi.h> This misses a few headers that this code is direct user of: container_of.h gpio/consumer.h types.h ... > + // assign_bit() is atomic, no need for lock Comment is useless, since it's a pattern that is used in the kernel: __op is non-atomic, op is atomic. ... > + > + One blank line is enough ... > + > + Ditto. ... > + gpios = devm_gpiod_get_array(dev, "output-enable-b", GPIOD_OUT_LOW); > + if (IS_ERR(gpios)) { > + return dev_err_probe(dev, PTR_ERR(gpios), > + "Unable to get the 'output-enable-b' gpios\n"); > + } {} are not needed, and you may put the return on one line. ... > + count = device_get_child_node_count(dev); > + if (!count) { > + dev_err(dev, "no led defined.\n"); > + return -ENODEV; > + } It's fine to use return dev_err_probe() in such cases like above, it's written in the documentation. ... > + ret = fwnode_property_read_u32(child, "reg", &idx); > + if (ret || idx >= max_num_leds) { > + dev_warn(dev, "%s: invalid reg value. Ignoring.\n", > + fwnode_get_name(child)); %pfw / %pfwP ? > + fwnode_handle_put(child); > + continue; > + } ... > + ret = devm_led_classdev_register_ext(dev, cdev, &init_data); > + if (ret) { > + dev_warn(dev, "%s: cannot create LED device.\n", > + fwnode_get_name(child)); Ditto. > + fwnode_handle_put(child); > + continue; > + }
On Tue, Jun 14, 2022 at 4:27 PM Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote: > > This series add the support for the TLC5925 LED controller. adds > This LED controller is driven though SPI. There is little internal logic through > and it can be thought of as a deserializer + latches. > The TLC5925 itself drives up to 16 LEDs, but multiple TLC5925s can be > chained to drive more. > > The first patch describes the dt bindings. > The second patch implements most of the driver and supports only > synchronous brightness setting (brightness_set_blocking). > The last patch implements the non-blocking version (brightness_set). Much better, I have a few comments and I believe next version will be final. > changes v3->v4: > * add missing MODULE_DEVICE_TABLE(of, ...) > * use dev_err_probe() to avoid spaming the log in case of deferred probe spamming > * use bitmap ops instead of direct mem access + lock memory > * sort headers and a few other cosmetic changes. > > changes v2->v3: > * fixed the yaml description of the bindings (now passes dt_binding_check) > * renamed shit-register-length into ti,shift-register-length and specify its > type > > changes v1->v2: > * renamed property shift_register_length into shift-register-length > * add a SPI MODULE_DEVICE_TABLE structure > * fixed the yaml description of the bindings (now passes dt_binding_check) > > Jean-Jacques Hiblot (3): > dt-bindings: leds: Add bindings for the TLC5925 controller > leds: Add driver for the TLC5925 LED controller > leds: tlc5925: Add support for non blocking operations > > .../devicetree/bindings/leds/ti,tlc5925.yaml | 107 ++++++++++ > drivers/leds/Kconfig | 6 + > drivers/leds/Makefile | 1 + > drivers/leds/leds-tlc5925.c | 191 ++++++++++++++++++ > 4 files changed, 305 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/ti,tlc5925.yaml > create mode 100644 drivers/leds/leds-tlc5925.c > > -- > 2.25.1 >