-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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: usb_c:: support Nuvoton's NuMaker M2L31 series #73635
base: main
Are you sure you want to change the base?
Conversation
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
description: | | ||
Rate of timer-triggered EADC measurement (Hz). | ||
This is ignored when none of above is specified. | ||
default: 100 |
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.
default needs justification https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#rules-for-default-values
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.
explained the default
drivers/usb_c/tcpc/ucpd_numaker.c
Outdated
} | ||
NUMAKER_UTCPD_REG_WRITE_BY_NAME(dev, CMD, cmd); | ||
|
||
cleanup: |
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 cleanup:
labels should be removed along with the other in the file.
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.
Originally, goto cleanup
is embedded in NUMAKER_UTCPD_REG_WRITE_BY_NAME
. Now it is moved outside.
drivers/usb_c/tcpc/ucpd_numaker.c
Outdated
|
||
cleanup: | ||
|
||
return rc; |
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.
Just return 0. Same in other function.
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.
Fixed as above
|
||
/* Functions below with name pattern "*_tcpc_ppc_*" are to invoke by NuMaker PPC driver */ | ||
|
||
int numaker_tcpc_ppc_is_dead_battery_mode(const struct device *dev) |
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.
Are these wrapper functions necessary?
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.
yes, they are to be invoked by ppc/vbus drivers. tcpc driver implements all the functions to match UTCPD H/W
drivers/usb_c/ppc/usbc_ppc_numaker.c
Outdated
}; | ||
|
||
/* TCPC exported */ | ||
int numaker_tcpc_ppc_is_dead_battery_mode(const struct device *dev); |
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.
These prototypes should be commented and placed in a header file.
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.
They are moved to one internal header file.
drivers/usb_c/tcpc/ucpd_numaker.c
Outdated
*/ | ||
|
||
/* Invalid or missing value */ | ||
#define NUMAKER_INVALID_VALUE ((uint32_t)-1) |
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.
0xFFFFFFFF
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.
UINT32_MAX
is also an option
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.
Chose UINT32_MAX
drivers/usb_c/tcpc/ucpd_numaker.c
Outdated
enum adc_reference reference; | ||
|
||
if (data->vref_mv) { | ||
goto cleanup; |
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.
Remove goto cleanup
and just return error value. Same in other functions
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.
Removed most goto cleanup
, keep only needed
Please run clang-format and follow Zephyr Code Documentation |
drivers/usb_c/tcpc/ucpd_numaker.c
Outdated
*/ | ||
|
||
/* Invalid or missing value */ | ||
#define NUMAKER_INVALID_VALUE ((uint32_t)-1) |
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.
UINT32_MAX
is also an option
Run |
drivers/usb_c/ppc/usbc_ppc_numaker.c
Outdated
struct numaker_ppc_data { | ||
uint32_t dummy; | ||
}; |
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.
drop this too?
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.
thanks, dropped this too
357b878
to
8ac4b7a
Compare
rebase on main to fix conflict |
@fabiobaltieri Please re-review if you are available |
1. Support USB-C drivers TCPC, PPC, and VBUS with UTCPD H/W IP 2. UTCPD is interconnected with Timer-triggered EADC for updating VBUS/VCONN voltage periodically Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
Add support for NuMaker-M2L31 board Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
Rebase on main to merge in #73632, which fixes |
This PR adds Nuvoton's NuMaker M2L31 series UTCPD support in usb_c: