-
-
Notifications
You must be signed in to change notification settings - Fork 244
SPMI driver #517
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
base: main
Are you sure you want to change the base?
SPMI driver #517
Conversation
d6876ed to
01bb482
Compare
svenpeter42
left a comment
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.
Looks good to me except for a few very minor comments
src/spmi.c
Outdated
| #define SPMI_STATUS_TX_EMPTY BIT(8) | ||
| #define SPMI_STATUS_TX_COUNT GENMASK(7, 0) | ||
|
|
||
| #define SPMI_CMD__RESET 0x10 |
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.
that double __ is a bit unusual but I can't thing of a better name schema here either.
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.
yeah, same... I think I'll change it to SPMI_OPCODE_ (or SPMI_OPC_) which is what Linux uses (well, Linux uses it for the name of the parameter in methods, not for the constants, but...)
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.
added a commit with the rename, let me know if it's okay or you prefer something else (or if you want the commit squashed into the previous ones)
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 squash the commit and then i'm going to merge this. you can ignore the pytest CI failure fwiw
01bb482 to
a2c3d4b
Compare
- refactor into a single raw_command method for simplicity - add timeout when waiting for RX data - implement all slave commands, including the rest of the register access commands (this is necessary for the USB-PD controller, which REQUIRES a reg 0 write command specifically. if written using any other command, it will appear to work but the other registers won't be updated) - parse and check replies (check command / slave, padding, frame parity) - validate command inputs Signed-off-by: Alba Mendez <[email protected]>
(especially interrupts) Signed-off-by: Alba Mendez <[email protected]>
a2c3d4b to
b561120
Compare
a straightforward translation of the Python version in hw.spmi, but I was too lazy to implement all of the commands Signed-off-by: Alba Mendez <[email protected]>
we'll use 'command' (or 'cmd') to mean the entire transaction, and 'opcode' (or 'opc') to mean the part of a command that specifies which kind of operation to perform (i.e. the value carried in the SPMI "command frame") Signed-off-by: Alba Mendez <[email protected]>
b561120 to
3e7d39c
Compare
expands the Python driver / regmaps with many of the things in AsahiLinux/docs#225 and implements the basic functionality as a C driver