Skip to content

Conversation

mchp-asif
Copy link
Contributor

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.

@mchp-asif mchp-asif marked this pull request as ready for review October 3, 2025 12:43
@zephyrbot zephyrbot added area: Devicetree Bindings area: PWM Pulse Width Modulation platform: Microchip MEC Microchip MEC Platform area: Boards/SoCs platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels Oct 3, 2025
@mchp-asif mchp-asif force-pushed the g1_pwm_tcc_driver_upstream branch from 20edb6b to 8ba6293 Compare October 6, 2025 10:20
uint32_t top = ((uint32_t)(1 << mchp_pwm_cfg->max_bit_width) - 1);

MCHP_PWM_DATA_LOCK(&mchp_pwm_data->lock);
do {
Copy link

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.

Copy link
Contributor Author

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>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be aligned vertically

Copy link
Contributor Author

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]>
@mchp-asif mchp-asif force-pushed the g1_pwm_tcc_driver_upstream branch from 8ba6293 to 16fde87 Compare October 8, 2025 09:18
Copy link

sonarqubecloud bot commented Oct 8, 2025

@mchp-asif mchp-asif requested review from NhMchp and ArunMCHP October 8, 2025 09:45
@@ -0,0 +1,71 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

Copy link
Contributor

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

Copy link
Contributor

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) {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards/SoCs area: Devicetree Bindings area: PWM Pulse Width Modulation platform: Microchip MEC Microchip MEC Platform platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants