The Holtek HT16K33 LED controller is not only used for driving...
dot-matrix displays, but also for driving segment displays.
Add support for 4-digit 7-segment and quad 14-segment alphanumeric
displays, like the Adafruit 7-segment and 14-segment display backpack
and FeatherWing expansion boards. Use the character line display core
support to display a message, which will be scrolled if it doesn't fit.
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
The 7-segment support is based on schematics, and untested on actual
hardware.
---
drivers/auxdisplay/ht16k33.c | 198 +++++++++++++++++++++++++++++++++--
1 file changed, 191 insertions(+), 7 deletions(-)
+static int ht16k33_seg_probe(struct i2c_client *client,
+ struct ht16k33_priv *priv, uint32_t brightness)
+{
+ struct ht16k33_seg *seg = &priv->seg;
+ struct device *dev = &client->dev;
+ int err;
+
+ err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS);
+ if (err)
+ return err;
+
+ switch (priv->type) {
+ case DISP_MATRIX:
+ /* not handled here */
+ break;
+
+ case DISP_QUAD_7SEG:
+ INIT_DELAYED_WORK(&priv->work, ht16k33_seg7_update);
+ seg->map.seg7 = initial_map_seg7;
+ seg->map_size = sizeof(seg->map.seg7);
+ err = device_create_file(dev, &dev_attr_map_seg7);
+ break;
+
+ case DISP_QUAD_14SEG:
+ INIT_DELAYED_WORK(&priv->work, ht16k33_seg14_update);
+ seg->map.seg14 = initial_map_seg14;
+ seg->map_size = sizeof(seg->map.seg14);
+ err = device_create_file(dev, &dev_attr_map_seg14);
+ break;
+ }
+ if (err)
+ return err;
+
+ err = linedisp_register(&seg->linedisp, dev, 4, seg->curr,
+ ht16k33_linedisp_update);
+ if (err)
+ goto err_remove_map_file;
+
+ return 0;