When PWM Meets the Common Clock Framework: How To Write a (not So)...
summary
Covers converting nanosecond-range period/duty requests into real hardware regs using the new PWM waveform internal API, then applies that to an Allwinner H616 PWM with six paired channels, per-pair and per-channel prescalers, and two input clocks (24 MHz and 100 MHz). Uses the Common Clock Framework to iterate clock rates (fastest→slowest), pick the divisor that maximizes period without exceeding the request, and keep enough duty steps; shows handling of the PWM bypass as a clock provider for exact-frequency consumers. Works but leaves rounding uncertainties and no direct access to clock-calculated divisors.
AI-written summary · about
