-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Add TCPC driver for RT1715 #81109
base: main
Are you sure you want to change the base?
Add TCPC driver for RT1715 #81109
Conversation
84315d9
to
4cd7a1c
Compare
4cd7a1c
to
8796eb8
Compare
8bacd7b
to
5d3b6b4
Compare
|
||
if (data->rx_sop_prime_enable) { | ||
return tcpci_tcpm_set_rx_type(&cfg->bus, | ||
TCPC_REG_RX_DETECT_SOP_SOPP_SOPPP_HRST_MASK); |
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.
Why are you enabling both SOP' and SOP'' messages here?
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.
I noticed that both Numaker and STM32 enable them as well. However, I couldn't find the datasheet for the PS8xxx series, so I suspect that it may not support SOP'' messages.
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.
The PS8xxx does support SOP' and SOP''. However, the API documentation for tcpc_sop_prime_enable()
indicates this command is used to enable SOP' messages, with no mention of SOP''.
The ChromeOS code that USB-C support is based on does enable SOP' and SOP'' for this command.
Do you mind updating the documentation for tcpc_sop_prime_enable()
to note that this enables both SOP' and SOP''?
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.
Done. Please review.
55c7eb8
to
a8bb603
Compare
|
||
if (data->rx_sop_prime_enable) { | ||
return tcpci_tcpm_set_rx_type(&cfg->bus, | ||
TCPC_REG_RX_DETECT_SOP_SOPP_SOPPP_HRST_MASK); |
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.
The PS8xxx does support SOP' and SOP''. However, the API documentation for tcpc_sop_prime_enable()
indicates this command is used to enable SOP' messages, with no mention of SOP''.
The ChromeOS code that USB-C support is based on does enable SOP' and SOP'' for this command.
Do you mind updating the documentation for tcpc_sop_prime_enable()
to note that this enables both SOP' and SOP''?
drivers/usb_c/tcpc/rt1715.c
Outdated
struct pd_msg *msg = &data->rx_msg; | ||
int ret = 0; | ||
|
||
buf[0].buf = TCPC_REG_RX_BUFFER; |
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.
This isn't correct. You're writing the TCPC register number into a pointer.
buf[0].buf = TCPC_REG_RX_BUFFER; | |
uint8_t tcpc_reg = TCPC_REG_RX_BUFFER; | |
buf[0].buf = *tcpc_reg; |
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.
my fault. fixed
a8bb603
to
6247177
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.
Looking good. One last ask. Please add a build test that links in this driver.
See #83187 for an example.
Locally, you can run ./scripts/twister -ivc -s drivers.usb.build.i2c
to verify the test.
1d00144
to
2356a95
Compare
Thanks for your review. |
#83187 has now merged. |
Add generic functions that will be common to all TCPCI compliant drivers. Signed-off-by: Jianxiong Gu <jianxiong.gu@outlook.com>
Add support for RT1715. Signed-off-by: Jianxiong Gu <jianxiong.gu@outlook.com>
This commit modifies the ps8xxx.c driver to use the generic TCPCI function. Signed-off-by: Jianxiong Gu <jianxiong.gu@outlook.com>
Clearly mention that this function enables both SOP' and SOP'' messages. Signed-off-by: Jianxiong Gu <jianxiong.gu@outlook.com>
Add a build test to verify richtek,rt1715 driver builds correctly. Signed-off-by: Jianxiong Gu <jianxiong.gu@outlook.com>
2356a95
to
77d80d3
Compare
Just updated. Local tests passed. |
Add TCPCI functions and add driver for Richtek RT1715.