is31fl3741: split PWM and scaling buffers #23049
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The 3741 is a little unusual in its PWM and scaling register layouts; it has two of each, which are not symmetrical and oddly organised.
The first page holds the 180 {PWM,scaling} values for SW1, CS1 through SW6, CS30.
The second page holds the 171 values for SW7, CS1 through SW9, CS30, then SW1, CS31 through SW9, CS39.
Currently the code does some modulo magic to map PWM/scaling values into a single buffer for each, and perform the page switching as necessary. I think this is rather obscure so instead, I have split these buffers in two to simplify some of the logic, and adjusted the
CSx_SWy
values accordingly.The registers on page 0 are still
0x00-0xB3
as before, but the ones on page 1 are now0x100-0x1AA
, where the top bit marks the page and can simply be masked off to get the "true" register address.Types of Changes
Issues Fixed or Closed by This PR
Checklist