Re: [PATCH v4 1/2] dt-bindings: leds-lp55xx: add ti,charge-pump-mode

From: Maarten Zanders
Date: Thu Feb 02 2023 - 09:12:40 EST



On 2/2/23 14:43, Krzysztof Kozlowski wrote:

Strings in DTS are usually easier to for humans to read, but it's not a
requirement to use them. The problem of storing register values is that
binding is tied/coupled with hardware programming model, so you cannot
add a new device if the register value is a bit different (e.g.
LP55XX_CP_OFF is 0x1). You need entire new binding for such case. With
string - no need.
I understand and this is why I started with the string in the first place (as suggested by yourself in V1).
With binding constants (IDs) also no need, so was this
the intention? Just to be clear - it is then ID or binding constant, not
a value for hardware register.

For simplicity sake, yes, now the setting is propagating directly into the register as a bit value. But this is how the current implementation of the drivers work. If we add a device in the future which indeed has different bit mappings, that driver will have to do a mapping of the DT binding to its own bit field definitions. I consider this DT binding as the "master", which is now conveniently chosen to match the register values.

Cheers,

Maarten