Re: [PATCH v2 2/7] Input: s6sy761 - split into core and I2C modules

From: André Draszik

Date: Thu Dec 03 2026 - 05:28:24 EST


Hi Lukas,

On Wed, 2026-12-02 at 19:15 +0100, Lukas Timmermann wrote:
> At first, I tried to do this patch with regmap as I thought it would be
> cleaner. But the touchscreen isn't really register based but works on
> single commands. As far as I understood it, regmap has features like
> caching, bitwise operations and handles IRQs in conjunction with
> registers.

REGCACHE_NONE is the default, and custom framed SPI protocols already use
devm_regmap_init() with custom .read/.write callbacks, e.g.
drivers/input/touchscreen/goodix_berlin_spi.c paired with
devm_regmap_init_i2c() in drivers/input/touchscreen/goodix_berlin_i2c.c

> So on second thought I kept the transport code and just did
> the split.
>
> But I have to say I'm still learning when it comes to kernel
> development, so any advice is always welcome. :-)

Regmap is great, as you get tracing and locking and debugfs for free
and it's a nice abstraction and you should be able to get rid of the
manual I2C transfer code in this driver.

It looks doable - you could do something like regmap + a separate
cmd(dev, u8) callback (like drivers/input/touchscreen/tsc200[45].c) to
allow for the 0-byte payloads (SENSE_ON|OFF) and custom SPI .read/.write
for the framing (like drivers/input/touchscreen/goodix_berlin_spi.c)

That would reuse devm_regmap_init_i2c() and regmap locking/tracing for all
data transfers (except the 0-byte payload).



Cheers,
Andre'