-
Notifications
You must be signed in to change notification settings - Fork 7.7k
drivers: led: lp50xx fix write_channels #92176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: led: lp50xx fix write_channels #92176
Conversation
Fix implementation of write_channels of the lp50xx driver. Signed-off-by: Matthias Alleman <[email protected]>
|
pong @pdgendt :) Did you test it with the lp50xx sample ? |
The sample isn't really useful. We simply use the channels to control the different outputs of the LP5018 controller.
And confirmed that we can control the individual uart:~$ led set_channel lp5018@3c 0 255
lp5018@3c: setting channel 0 to 255
uart:~$ led set_channel lp5018@3c 5 123
lp5018@3c: setting channel 5 to 123
uart:~$ led write_channels lp5018@3c 8 128 128 128 128
lp5018@3c: writing from channel 8: 128 128 128 128 Which isn't possible without this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @allemanm,
First, let me apologize for the delay. When I saw this patch, I thought it was suspect and that I should do some testing in order to check it. But unfortunately, I never got to the stage where I look through my cabinet full of boards to find an LP50xx evaluation board :)
And I still haven't. But as I said, I find this patch suspect. Please see my comment below.
In addition, at the very least, you should explain the bug or behavior you are trying to fix. "fix write_channel" is way to vague.
@@ -39,7 +39,7 @@ LOG_MODULE_REGISTER(lp50xx, CONFIG_LED_LOG_LEVEL); | |||
|
|||
/* Maximum number of channels */ | |||
#define LP50XX_MAX_CHANNELS(nmodules) \ | |||
((LP50XX_COLORS_PER_LED + 1) * ((nmodules) + 1)) | |||
(LP50XX_COLORS_PER_LED * nmodules) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can you explain what you are fixing ?
I find this change highly suspicious. For each module, there are three color registers and one brightness register, so LP50XX_COLORS_PER_LED + 1
makes sense. And the ->write_channels()
API also exposes the bank registers. And that's (nmodules) + 1
.
So I don't understand :)
Well, there is something wrong with this patch I think. The Note that the |
Maybe we're just failing to understand how the API is supposed to work with this controller. We are under the impression that channels map directly to the
This might be part of what we fail to understand. We could go with adding individual LED nodes to the device tree, but we're not controlling color LEDs, but simple white LEDs. Is that possible with the current implementation to define this? |
I think that the So yes, your assumption is wrong :) This driver exposes all the registers, starting with the bank registers (
Is that related with #85208 ? And yes you can use the |
Closing as it is clear this limits the (ab)use of Adding an offset of 12 ( |
Sorry again for the delay... |
Fix implementation of write_channels of the lp50xx driver.