diff mbox series

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

Message ID 20191212033952.5967-13-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

Commit Message

Andreas Färber Dec. 12, 2019, 3:39 a.m. UTC
Add definition for FD628 chipset.

Cc: sales@fdhisi.com
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 drivers/leds/Kconfig       |  4 ++--
 drivers/leds/leds-tm1628.c | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);