Hi Milo,[...]
Thanks for the update. I have few comments below.
+static u8 lm3633_led_scale_max_brightness(struct ti_lmu_led *lmu_led,
u32 imax)
+{
+ u8 max_current = lm3633_led_convert_current_to_index(imax);
+ const u8 max_brightness_table[] = {
+ [LMU_IMAX_5mA] = 191,
+ [LMU_IMAX_6mA] = 197,
+ [LMU_IMAX_7mA] = 203,
+ [LMU_IMAX_8mA] = 208,
+ [LMU_IMAX_9mA] = 212,
+ [LMU_IMAX_10mA] = 216,
+ [LMU_IMAX_11mA] = 219,
+ [LMU_IMAX_12mA] = 222,
+ [LMU_IMAX_13mA] = 225,
+ [LMU_IMAX_14mA] = 228,
+ [LMU_IMAX_15mA] = 230,
+ [LMU_IMAX_16mA] = 233,
+ [LMU_IMAX_17mA] = 235,
+ [LMU_IMAX_18mA] = 237,
+ [LMU_IMAX_19mA] = 239,
+ [LMU_IMAX_20mA] = 241,
+ [LMU_IMAX_21mA] = 242,
+ [LMU_IMAX_22mA] = 244,
+ [LMU_IMAX_23mA] = 246,
+ [LMU_IMAX_24mA] = 247,
+ [LMU_IMAX_25mA] = 249,
+ [LMU_IMAX_26mA] = 250,
+ [LMU_IMAX_27mA] = 251,
+ [LMU_IMAX_28mA] = 253,
+ [LMU_IMAX_29mA] = 254,
+ [LMU_IMAX_30mA] = 255,
+ };
After analyzing the subject one more time I think that we need to
change the approach regarding max brightness issue.
At first - we shouldn't fix max current to max possible register value.
Instead we should take led-max-microamp property and write its value
to the [0x22 + bank offset] registers.
With this approach whole 0-255 range of brightness levels will be
valid for the driver.
In effect all LMU_IMAX* enums seem to be not needed.