On 11/10/25 11:01, Daniel Thompson wrote:
On Mon, Nov 10, 2025 at 09:40:07AM +0100, Maud Spierings wrote:
On 11/7/25 17:14, Daniel Thompson wrote:
On Fri, Nov 07, 2025 at 01:49:59PM +0100, Maud Spierings via B4 Relay wrote:
+/**
+ * @brief control the brightness with i2c registers
+ *
+ * @param regmap trivial
+ * @param brt brightness
+ * @return int
+ */
+static int max25014_register_control(struct regmap *regmap, uint32_t brt)

This isn't a good name for a function. It doesn't really say what it
does. Please find a more descriptive name.

Having a lot of difficulties find a succinct name that fits better,
max25014_register_brightness_control()?
max25014_i2c_brightness_control()?

I'd focus on what it does rather than how it does it meaning something
like max25014_update_brightness() would work.

However, at present, this code is only called from
max25014_update_status() so the simplest thing to do is to move the
code into max25014_update_status() and remove this function entirely
(then it doesn't matter what it is called ;-) ).


Perhaps this could be seperated out if/when pwm functionality is implemented. I believe the brightness may also be controlled that way in hybrid mode, but I am not entirely sure.


+/*
+ * 1. disable unused strings
+ * 2. set dim mode
+ * 3. set initial brightness

How does this code set the initial brightness? It doens't set the
MAX25014_TON* registers.

Yep forgot to remove that, I discovered the backlight core takes care of the
default brightness, so I removed it from here.

What do you mean by this? Are you sure you aren't relying on another
driver to enable the backlight rather than the backlight core?

Not that I know of, there is the systemd backlight service, but I am pretty sure I can see it first turn on, then get switched to the old value by the systemd service. Unless the simple-panel driver controls it? The backlight is linked to that.

+ * 4. set setting register
+ * 5. enable the backlight
+ */
+static int max25014_configure(struct max25014 *maxim)


+static int max25014_probe(struct i2c_client *cl)
<snip>
+
+       /* Enable can be tied to vin rail wait if either is available */
+       if (maxim->enable || maxim->vin) {
+               /* Datasheet Electrical Characteristics tSTARTUP 2ms */
+               usleep_range(2000, 2500);
+       }

If you really want to keep the devm_regulator_get_optional() I guess
maybe you could persuade me it's need to avoid this sleep... although
I'd be fairly happy to remove the NULL checks here too!

Just wait unconditionally?

If you think it will be unusual for the driver to be used without enable
or regulator then it's ok to wait unconditionally (all examples you
have added so far have an enable pin).

I think it may actually be a very common implementation to have the enable pin attached to Vin, we don't have it set up that way. But it is displayed that way in an example schematic in the datasheet.

Kind regards,
Maud

Reply via email to