Message ID | 20191212033952.5967-18-afaerber@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: realtek: Add Xnano X5 and implement TM1628/FD628/AiP1618 LED controllers | expand |
Am 12.12.19 um 04:39 schrieb Andreas Färber: > diff --git a/drivers/leds/leds-tm1628.c b/drivers/leds/leds-tm1628.c > index ef85712a84f2..8a8fd1562853 100644 > --- a/drivers/leds/leds-tm1628.c > +++ b/drivers/leds/leds-tm1628.c [...] > @@ -411,9 +412,38 @@ static const struct tm1628_info fd628_info = { > .default_pwm = 0, > }; > > +static const struct tm1628_mode aip1618_modes[4] = { > + { > + .grid_mask = GENMASK(4, 1), > + .seg_mask = GENMASK(8, 1), > + }, > + { > + .grid_mask = GENMASK(5, 1), > + .seg_mask = GENMASK(7, 1), > + }, > + { > + .grid_mask = GENMASK(6, 1), > + .seg_mask = GENMASK(6, 1), > + }, These three segment masks are obviously wrong - they violate the seg_mask below, not leaving the gap between 5 and 12. Fixed. > + { > + .grid_mask = GENMASK(7, 1), > + .seg_mask = GENMASK(5, 1), > + }, > +}; > + > +static const struct tm1628_info aip1618_info = { > + .grid_mask = GENMASK(7, 1), > + .seg_mask = GENMASK(14, 12) | GENMASK(5, 1), > + .modes = aip1618_modes, > + .default_mode = 3, > + .pwm_map = tm1628_pwm_map, > + .default_pwm = 0, > +}; [snip] Regards, Andreas
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a7695d961d9c..3a7e6028ae80 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -842,8 +842,9 @@ config LEDS_TM1628 depends on SPI depends on OF || COMPILE_TEST help - Say Y to enable support for Titan Micro Electronics TM1628 and - Fuda Hisi Microelectronics FD628 LED controllers. + Say Y to enable support for Titan Micro Electronics TM1628, + Fuda Hisi Microelectronics FD628 and Fude Microelectronics AiP1618 + LED controllers. They are 3-wire SPI devices controlling a two-dimensional grid of LEDs. Dimming is applied to all outputs through an internal PWM. diff --git a/drivers/leds/leds-tm1628.c b/drivers/leds/leds-tm1628.c index ef85712a84f2..8a8fd1562853 100644 --- a/drivers/leds/leds-tm1628.c +++ b/drivers/leds/leds-tm1628.c @@ -3,6 +3,7 @@ * Titan Micro Electronics TM1628 LED controller * Also compatible: * Fuda Hisi Microelectronics FD628 + * Fude Microelectronics AiP1618 * * Copyright (c) 2019 Andreas Färber */ @@ -411,9 +412,38 @@ static const struct tm1628_info fd628_info = { .default_pwm = 0, }; +static const struct tm1628_mode aip1618_modes[4] = { + { + .grid_mask = GENMASK(4, 1), + .seg_mask = GENMASK(8, 1), + }, + { + .grid_mask = GENMASK(5, 1), + .seg_mask = GENMASK(7, 1), + }, + { + .grid_mask = GENMASK(6, 1), + .seg_mask = GENMASK(6, 1), + }, + { + .grid_mask = GENMASK(7, 1), + .seg_mask = GENMASK(5, 1), + }, +}; + +static const struct tm1628_info aip1618_info = { + .grid_mask = GENMASK(7, 1), + .seg_mask = GENMASK(14, 12) | GENMASK(5, 1), + .modes = aip1618_modes, + .default_mode = 3, + .pwm_map = tm1628_pwm_map, + .default_pwm = 0, +}; + static const struct of_device_id tm1628_spi_of_matches[] = { { .compatible = "titanmec,tm1628", .data = &tm1628_info }, { .compatible = "fdhisi,fd628", .data = &fd628_info }, + { .compatible = "szfdwdz,aip1618", .data = &aip1618_info }, {} }; MODULE_DEVICE_TABLE(of, tm1628_spi_of_matches);
Add definition for AiP1618 chipset. Signed-off-by: Andreas Färber <afaerber@suse.de> --- drivers/leds/Kconfig | 5 +++-- drivers/leds/leds-tm1628.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)