Skip to content

clk: sunxi-ng: Use sigma-delta modulation for audio PLL

Chen-Yu Tsai linux-arm-kernel linux-clk 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9clk: sunxi-ng: sun5i: Fix bit offset of audio PLL post-dividerdrivers/clk/sunxi-ng/ccu-sun5i.c+2 -20 replies
2/9clk: sunxi-ng: nm: Check if requested rate is supported by fractional clockdrivers/clk/sunxi-ng/ccu_nm.c+3 -00 replies
3/9clk: sunxi-ng: Add sigma-delta modulation supportdrivers/clk/sunxi-ng/Makefile drivers/clk/sunxi-ng/ccu_common.h drivers/clk/sunxi-ng/ccu_sdm.c +1 more+240 -00 replies
4/9clk: sunxi-ng: nm: Add support for sigma-delta modulationdrivers/clk/sunxi-ng/ccu_nm.c drivers/clk/sunxi-ng/ccu_nm.h+46 -10 replies
5/9clk: sunxi-ng: sun8i: h3: Use sigma-delta modulation for audio PLLdrivers/clk/sunxi-ng/ccu-sun8i-h3.c+25 -130 replies
6/9clk: sunxi-ng: sun4i: Use sigma-delta modulation for audio PLLdrivers/clk/sunxi-ng/ccu-sun4i-a10.c+20 -60 replies
7/9clk: sunxi-ng: sun5i: Use sigma-delta modulation for audio PLLdrivers/clk/sunxi-ng/ccu-sun5i.c+19 -60 replies
8/9clk: sunxi-ng: sun6i: Use sigma-delta modulation for audio PLLdrivers/clk/sunxi-ng/ccu-sun6i-a31.c+25 -130 replies
9/9clk: sunxi-ng: sun8i: a23: Use sigma-delta modulation for audio PLLdrivers/clk/sunxi-ng/ccu-sun8i-a23.c+25 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] clk: sunxi-ng: Use sigma-delta modulation for audio PLL

Hi everyone,

This series adds support for fractional-N synthesis using sigma-delta modulation in the audio PLL to get the exact required clock rate. This fixes the speed and pitch change when audio is played back on sunxi platforms, due to the slightly inaccurate audio clock.

I've done this for all platforms I can test at the moment. A83T is left out for now as the the clock unit's design is slightly different. I was unable to work on the A33, as my board is very unstable, plus A33 audio playback seems to be broken at the moment. There might be some issue with the DAPM routes.

Patch 1 fixes an error with the audio PLL's post-divider bit field offset.

Patch 2 adds a check for fractional mode clock rates in the N-M clock's round_rate callback. This is mostly for aesthetics to have both round_rate and set_rate code paths look the same. In practice the N-M factors can also generate the fractional mode clock rates directly.

Patch 3 adds a table based sigma-delta modulation clock type. This is implemented much like the fractional mode clocks, as a helper library to be integrated into the various factor clocks where needed. As there is no explanation on how to calculate the parameters for SDM, the table based approach allows us to copy existing parameters from the vendor kernel.

Patch 4 hooks the SDM clock type helpers into the N-M factors clock type. The audio PLLs on most of our are of this type.

Patches 5 ~ 9 convert the audio PLL to using SDM on various SoCs. The changes are the same, accounting for minor variances between SoCs:

- audio PLL post-divider now forced to 1.

- pll-audio-1x fixed-factor-clock divider now set to 1, matching the hardware setting from above.

- SDM parameter table added.

- SDM parameters added to pll-audio-base clock.

Please have a look.

ChenYu

Chen-Yu Tsai (9):
clk: sunxi-ng: sun5i: Fix bit offset of audio PLL post-divider
clk: sunxi-ng: nm: Check if requested rate is supported by fractional
clock
clk: sunxi-ng: Add sigma-delta modulation support
clk: sunxi-ng: nm: Add support for sigma-delta modulation
clk: sunxi-ng: sun8i: h3: Use sigma-delta modulation for audio PLL
clk: sunxi-ng: sun4i: Use sigma-delta modulation for audio PLL
clk: sunxi-ng: sun5i: Use sigma-delta modulation for audio PLL
clk: sunxi-ng: sun6i: Use sigma-delta modulation for audio PLL
clk: sunxi-ng: sun8i: a23: Use sigma-delta modulation for audio PLL

 drivers/clk/sunxi-ng/Makefile        |   1 +
 drivers/clk/sunxi-ng/ccu-sun4i-a10.c |  26 ++++--
 drivers/clk/sunxi-ng/ccu-sun5i.c     |  27 ++++--
 drivers/clk/sunxi-ng/ccu-sun6i-a31.c |  38 ++++++---
 drivers/clk/sunxi-ng/ccu-sun8i-a23.c |  38 ++++++---
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c  |  38 ++++++---
 drivers/clk/sunxi-ng/ccu_common.h    |   1 +
 drivers/clk/sunxi-ng/ccu_nm.c        |  25 +++++-
 drivers/clk/sunxi-ng/ccu_nm.h        |  25 ++++++
 drivers/clk/sunxi-ng/ccu_sdm.c       | 158 +++++++++++++++++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu_sdm.h       |  80 ++++++++++++++++++
 11 files changed, 404 insertions(+), 53 deletions(-)
 create mode 100644 drivers/clk/sunxi-ng/ccu_sdm.c
 create mode 100644 drivers/clk/sunxi-ng/ccu_sdm.h
Signature · 1 line
2.14.2