-
Notifications
You must be signed in to change notification settings - Fork 8k
sam_e54_xpro : Add support for PWM using tcc peripheral #96963
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?
sam_e54_xpro : Add support for PWM using tcc peripheral #96963
Conversation
20edb6b
to
8ba6293
Compare
drivers/pwm/pwm_mchp_tcc_g1.c
Outdated
uint32_t top = ((uint32_t)(1 << mchp_pwm_cfg->max_bit_width) - 1); | ||
|
||
MCHP_PWM_DATA_LOCK(&mchp_pwm_data->lock); | ||
do { |
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.
its possible to avoid multiple returns without using do-while with if-else.
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.
refactored the code to use if-else for avoiding multiple returns
reg = <0x42000c00 0x2000>; | ||
interrupts = <97 0>, <98 0>, <99 0>, <100 0>; | ||
clocks = <&mclkperiph CLOCK_MCHP_MCLKPERIPH_ID_APBC_TCC2>, | ||
<&gclkperiph CLOCK_MCHP_GCLKPERIPH_ID_TCC2>; |
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.
Should be aligned vertically
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.
Updated the alignment.
Adds the dts nodes and binding yamls for pwm driver using tcc peripheral. Signed-off-by: Muhammed Asif <[email protected]>
Add pwm driver using tcc g1 peripheral. Adds the support for generating pwm output. Supports both 16-bit and 24bit mode of tcc peripheral Signed-off-by: Muhammed Asif <[email protected]>
Added the pinmuxing as well as the dts node for supporting blinky on sam_e54_xpro board. Signed-off-by: Muhammed Asif <[email protected]>
8ba6293
to
16fde87
Compare
|
@@ -0,0 +1,71 @@ | |||
# Copyright (c) 2025 Microchip Technology Inc. | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
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 add a title
property providing a brief, descriptive name for the peripheral.
@@ -0,0 +1,30 @@ | |||
# Copyright (c) 2025 Microchip Technology Inc. | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
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 add a title
property providing a brief, descriptive name for the peripheral.
*/ | ||
static inline void tcc_sync_wait(void *pwm_reg) | ||
{ | ||
while ((PWM_REG(pwm_reg)->TCC_SYNCBUSY) != 0) { |
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.
Use WAIT_FOR macro with required timeout.
Adds dts nodes of the available tcc nodes in all the series
Added the driver which can generate pwm using tcc peripheral in output on respective pins. It can work either in16 or 24 bit mode.
Added the blinky_pwm support for led on board.