[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2868cd091dc6ff0cab14b5da07f89984@protonic.nl>
Date: Mon, 29 Mar 2021 09:08:59 +0200
From: Robin van der Gracht <robin@...tonic.nl>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Rob Herring <robh+dt@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Paul Burton <paulburton@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devicetree@...r.kernel.org, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment
displays
Hello Geert,
On 2021-03-22 15:48, Geert Uytterhoeven wrote:
> 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@...ux-m68k.org>
> ---
> 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;
This 'case' shouldn't happen. Having said that, the break here will
still
cause the linedisp_register() function to be called for the DISP_MATRIX
type.
If you'd like to handle this case, a return (or setting 'err') should
prevent this.
> +
> + 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;
Groetjes/Kind regards,
Robin van der Gracht
Powered by blists - more mailing lists