linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] pwm: meson: make full use of common clock framework
@ 2023-04-11 19:21 Heiner Kallweit
  2023-04-11 19:22 ` [PATCH v2 1/4] pwm: meson: switch to using struct clk_parent_data for mux parents Heiner Kallweit
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Heiner Kallweit @ 2023-04-11 19:21 UTC (permalink / raw)
  To: Jerome Brunet, Martin Blumenstingl, Neil Armstrong, Kevin Hilman,
	Uwe Kleine-König, thierry.reding
  Cc: linux-arm-kernel, open list:ARM/Amlogic Meson..., linux-pwm

Newer versions of the PWM block use a core clock with external mux,
divider, and gate. These components either don't exist any longer in
the PWM block, or they are bypassed.
To minimize needed changes for supporting the new version, the internal
divider and gate should be handled by CCF too.

I didn't see a good way to split the patch, therefore it's somewhat
bigger. What it does:

- The internal mux is handled by CCF already. Register also internal
  divider and gate with CCF, so that we have one representation of the
  input clock: [mux] parent of [divider] parent of [gate]
  
- Now that CCF selects an appropriate mux parent, we don't need the
  DT-provided default parent any longer. Accordingly we can also omit
  setting the mux parent directly in the driver.
  
- Instead of manually handling the pre-div divider value, let CCF
  set the input clock. Targeted input clock frequency is
  0xffff * 1/period for best precision.
  
- For the "inverted pwm disabled" scenario target an input clock
  frequency of 1GHz. This ensures that the remaining low pulses
  have minimum length.

I don't have hw with the old PWM block, therefore I couldn't test this
patch. With the not yet included extension for the new PWM block
(channel->clock directly coming from get_clk(external_clk)) I didn't
notice any problem. My system uses PWM for the CPU voltage regulator
and for the SDIO 32kHz clock.

Note: The clock gate in the old PWM block is permanently disabled.
This seems to indicate that it's not used by the new PWM block.

Changes to RFT/RFC version:
- use parent_hws instead of parent_names for div/gate clock
- use devm_clk_hw_register where the struct clk * returned by
  devm_clk_register isn't needed

v2:
- add patch 1
- add patch 3
- switch to using clk_parent_data in all relevant places

Heiner Kallweit (4):
  pwm: meson: switch to using struct clk_parent_data for mux parents
  pwm: meson: don't use hdmi/video clock as mux parent
  pwm: meson: change clk/pwm gate from mask to bit
  pwm: meson: make full use of common clock framework

 drivers/pwm/pwm-meson.c | 194 +++++++++++++++++++++-------------------
 1 file changed, 101 insertions(+), 93 deletions(-)

-- 
2.40.0



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-04-23 17:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 19:21 [PATCH v2 0/4] pwm: meson: make full use of common clock framework Heiner Kallweit
2023-04-11 19:22 ` [PATCH v2 1/4] pwm: meson: switch to using struct clk_parent_data for mux parents Heiner Kallweit
2023-04-11 19:44   ` Martin Blumenstingl
2023-04-11 19:23 ` [PATCH v2 2/4] pwm: meson: don't use hdmi/video clock as mux parent Heiner Kallweit
2023-04-11 19:24 ` [PATCH v2 3/4] pwm: meson: change clk/pwm gate from mask to bit Heiner Kallweit
2023-04-11 19:26 ` [PATCH v2 4/4] pwm: meson: make full use of common clock framework Heiner Kallweit
2023-04-11 19:48   ` Martin Blumenstingl
2023-04-11 21:00     ` Heiner Kallweit
2023-04-13  9:13     ` Thierry Reding
2023-04-14 18:33       ` Martin Blumenstingl
2023-04-17  9:27         ` Thierry Reding
2023-04-23 17:34           ` Martin Blumenstingl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).