[RFC 12/25] leds: tm1628: Add Fuda Hisi Microelectronics FD628

From: Andreas FÃrber
Date: Wed Dec 11 2019 - 22:40:37 EST


Add definition for FD628 chipset.

Cc: sales@xxxxxxxxxx
Signed-off-by: Andreas FÃrber <afaerber@xxxxxxx>
---
drivers/leds/Kconfig | 4 ++--
drivers/leds/leds-tm1628.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index f3afb419a9a1..a7695d961d9c 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -842,8 +842,8 @@ config LEDS_TM1628
depends on SPI
depends on OF || COMPILE_TEST
help
- Say Y to enable support for Titan Micro Electronics TM1628
- LED controllers.
+ Say Y to enable support for Titan Micro Electronics TM1628 and
+ Fuda Hisi Microelectronics FD628 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 319bf34ce835..ef85712a84f2 100644
--- a/drivers/leds/leds-tm1628.c
+++ b/drivers/leds/leds-tm1628.c
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Titan Micro Electronics TM1628 LED controller
+ * Also compatible:
+ * Fuda Hisi Microelectronics FD628
*
* Copyright (c) 2019 Andreas FÃrber
*/
@@ -400,8 +402,18 @@ static const struct tm1628_info tm1628_info = {
.default_pwm = 0,
};

+static const struct tm1628_info fd628_info = {
+ .grid_mask = GENMASK(7, 1),
+ .seg_mask = GENMASK(14, 12) | GENMASK(10, 1),
+ .modes = tm1628_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 },
{}
};
MODULE_DEVICE_TABLE(of, tm1628_spi_of_matches);
--
2.16.4