-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: led: Introduce LP5521 driver #73194
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: Introduce LP5521 driver #73194
Conversation
e41727d
to
6901f20
Compare
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.
First pass review
7594d5b
to
83eaa40
Compare
I glanced at the drivers made for linux and documented at TI and they have a seperate driver for each of the leddrivers but with a "leds-lp55xx-common.h" file for the generic lp55xx stuff and a common devicetree binding: We can do something similar right? |
There's a clear upside in refactoring these drivers into common code, as it makes it easier to maintain and catch bugs. As pointed out by @RickBruyninckx, this has been somewhat done on Linux so it's possible. However, I disagree with this being a requirement for merging this PR, for the following reasons:
Long-story short: the benefits for getting this feature for 3.7.0 far outweigh the cost of introducing it as a separate driver now and refactoring it later. @simonguinot @RickBruyninckx please, reconsider your stance on this. |
@AyushKot96 please fix CI failures. Rememeber you can run these locally: twister -p croxel_cx1825/nrf52840 -T samples |
Issue captured: #74027 |
@ubieda I understand this feature is important for your company. But here is my problem. I can see a lot of similarities between the lp5521 and lp5562 drivers. And I am opposed to the addition of a new driver duplicating code with an existing one if the latter can be extended. So I am trying to evaluate the cost of a such extension here and I am asking @AyushKot96 about it. I think it is a legitimate request which should have been anticipated considering that the code of the lp5521 driver has been copied from lp5562. Please note that I already raised this point two weeks ago and here is the answer I got:
About the registers addresses it is not accurate. I can see that most of them are identical. And I already know that the lp5562 driver won't work with the LP5521 controller in its current state. But that didn't answer my question... @AyushKot96 is that possible to add support for the LP5521 controller to the lp5562 driver ? have you considered this option ? And why did choose to write a separate driver ? |
@simonguinot Upon revisiting the drivers, I came to know that I could have refactor them and make a common driver. I am prepared to address this in a separate pull request. |
I agree with Simon. Please create a generic |
Hi @AyushKot96 - I think it's fair that the maintainer of a particular area would not want to accept new code that's duplicated if it's clear that there is a better path. That's how technical debt can quickly add up in an open source project as the promised follow-up PR may or may not ever show up (and I am by no means implying that you, in particular, won't follow up, but you get the idea).
Of course! On the other hand it's also worth pointing out it's a not unsignificant amount of code that was submitted 3-ish weeks ahead of feature freeze :) And the feedback re: trying to identify common code was mentioned very early in the review process.
It seems to me as the lp5569 driver is vastly different from the existing LP5562, where the LP5512 one is effectively copy-pasting a lot of existing code? |
3e34e30
to
01f3be2
Compare
@simonguinot @kartben Understood. We'll refactor the driver. Thanks! |
01f3be2
to
281a4b7
Compare
@simonguinot @ubieda Hey guys, I have pushed a new common driver for LP5521 and LP5562. |
ad819fe
to
6917f69
Compare
- Add common driver for LP5521 and LP5562 - Remove LP5562 driver source and KConfig files - Add sample application for LP5521 Signed-off-by: Ayush Kothari <ayush@croxel.com>
-Add LP5521 node in croxel_cx1825 board dts file -Remove arduino_i2c and arduino_gpio from dts file to prevent shield sample build test Signed-off-by: Ayush Kothari <ayush@croxel.com>
6917f69
to
954a45f
Compare
}; | ||
|
||
arduino_i2c: &i2c0 { | ||
&i2c0 { |
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.
Needs rebasing. This has been updated already: #74893
@simonguinot Seems like the refactoring has been done. Would you mind taking another look at this? Thanks |
Hello @ubieda, I'll look at it next week. Note that I already reviewed #72713 from @AyushKot96 last month but I didn't get any answer since... That's why I was hesitant to start the review for this PR. |
Thanks! We'll come back to that one soon (it's in our backlog). CC: @cx-anuj-pathak |
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 @AyushKot96,
You need to help me a little here. I can't review a such big commit with everything in it, including renamed files. You need to structure the pull request with several commits. For example:
- rename the
lp5562
driver and sample intolp55xx
. So I'll be able to use git to visualize the changes coming in the next commits. - make the driver and sample generic to prepare for adding support of the LP5521 controller. Don't be afraid to split this step into several commits as well.
- add support for the LP5521 controller to the driver.
- add support for the LP5521 controller to the sample.
Thanks in advance !
@simonguinot we have rearranged commits. but it went upto 14 commits, and in the process we have identified few other things too and a bug in lp5562 driver. So we have decided internally to break it down in 3-4 PR's.
Let me know if you have any suggestions? |
Hi @cx-anuj-pathak. Yes it seems fine to use several PRs ! |
FIled a new PR #78968 |
Description
This PR adds a new common driver for controlling LP5521, supported by CX1825 (in-tree hardware) and LP5562
Changes
croxel_cx1825
.Testing
Testing has been done using samples/drivers/led_lp5521 application on croxel_cx1825 board.
west build -b croxel_cx1825/nrf52840 samples/drivers/led_lp5521
Due to unavailability of LP5562, its testing is currently pending.