Re: [PATCH v6 7/7] auxdisplay: TM16xx: Add support for SPI-based controllers

From: Andy Shevchenko
Date: Mon Nov 24 2025 - 12:00:38 EST


On Fri, Nov 21, 2025 at 09:59:07AM -0500, Jean-François Lessard wrote:
> Add support for TM16xx-compatible auxiliary display controllers connected
> via the SPI bus.
>
> The implementation includes:
> - SPI driver registration and initialization
> - Probe/remove logic for SPI devices
> - Controller-specific handling and communication sequences
> - Integration with the TM16xx core driver for common functionality
>
> This allows platforms using TM16xx or compatible controllers over SPI to be
> managed by the TM16xx driver infrastructure.

...

Seems like same/similar comments as per I2C glue driver are applicable here.
Please, address accordingly.

Additional comments below.

...

> + tm16xx_for_each_key(display, row, col) {
> + byte = col >> 1;

> + bit = (2 - row) + ((col & 1) << 2);

If you do something like

byte = col / 2;
... = col % 2;

it may be optimised to a single assembly instruction on some architectures
by a compiler (and yes, I saw it in real life that `idiv` on x86 has been
chosen over other approaches by GCC).


> + value = !!(codes[byte] & BIT(bit));

Seems unneeded

> + tm16xx_set_key(display, row, col, value);

tm16xx_set_key(display, row, col, codes[byte] & BIT(bit));


> + }
> +
> + return 0;
> +}

...

> + tm16xx_set_key(display, 0, 0, !!(codes[0] & BIT(1)));
> + tm16xx_set_key(display, 0, 1, !!(codes[0] & BIT(4)));
> + tm16xx_set_key(display, 0, 2, !!(codes[1] & BIT(1)));
> + tm16xx_set_key(display, 0, 3, !!(codes[1] & BIT(4)));
> + tm16xx_set_key(display, 0, 4, !!(codes[2] & BIT(1)));

Do we really need !!() ?

--
With Best Regards,
Andy Shevchenko