Skip to content

pwm: atmel-hlcdc: Fix frequency output being half of expected#5

Closed
kay54068 wants to merge 10000 commits intolinux4microchip:linux-6.6-mchpfrom
kay54068:fix_hlcdc_pwm
Closed

pwm: atmel-hlcdc: Fix frequency output being half of expected#5
kay54068 wants to merge 10000 commits intolinux4microchip:linux-6.6-mchpfrom
kay54068:fix_hlcdc_pwm

Conversation

@kay54068
Copy link

The atmel-hlcdc PWM driver generates an output frequency that is
exactly half of the value requested in the device tree. For example,
a request for 1000 Hz results in a 500 Hz output.

This is caused by an incorrect prescaler calculation. The driver's
formula for the clock divider did not match the hardware, which uses
a division factor of 2^(pres + 1). The driver was missing the "+1",
causing the output period to be doubled.

This patch corrects the calculation to 2^(pres + 1), aligning it
with the hardware's behavior and ensuring the generated frequency is
correct.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.