diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-15 21:41:21 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-15 21:41:21 -0700 |
commit | db06f826ec12bf0701ea7fc0a3c0aa00b84417c8 (patch) | |
tree | 0f5cd2bb7af57574ae8a20bfc0e916512c5f2255 /drivers/clk/meson/clk-audio-divider.c | |
parent | 6de4c691eab8f421e34c5250f63bf3f477d30eec (diff) | |
parent | ac7da1b787d9ea43680c487613269742c48d8747 (diff) |
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk updates from Stephen Boyd:
"The new and exciting feature this time around is in the clk core.
We've added duty cycle support to the clk API so that clk signal duty
cycle ratios can be adjusted while taking into account things like clk
dividers and clk tree hierarchy. So far only one SoC has implemented
support for this, but I expect there will be more to come in the
future.
Outside of the core, we have the usual pile of clk driver updates and
additions. The Amlogic meson driver got the most lines in the diffstat
this time around because it added support for a whole bunch of
hardware and duty cycle configuration. After that the Rockchip PX30,
Qualcomm SDM845, and Renesas SoC drivers fill in a majority of the
diff. We're left with the collection of non-critical fixes after that.
Overall it looks pretty quiet this time.
Core:
- Clk duty cycle support
- Proper CLK_SET_RATE_GATE support throughout the tree
New Drivers:
- Actions Semi Owl series S700 SoC clk driver
- Qualcomm SDM845 display clock controller
- i.MX6SX ocram_s clk support
- Uniphier NAND, USB3 PHY, and SPI clk support
- Qualcomm RPMh clk driver
- i.MX7D mailbox clk support
- Maxim 9485 Programmable Clock Generator
- expose 32 kHz PLL on PXA SoCs
- imx6sll GPIO clk gate support
- Atmel at91 I2S audio clk support
- SI544/SI514 clk on/off support
- i.MX6UL GPIO clock gates in CCM CCGR
- Renesas Crypto Engine clocks on R-Car H3
- Renesas clk support for the new RZ/N1D SoC
- Allwinner A64 display engine clock support
- support for Rockchip's PX30 SoC
- Amlogic Meson axg PCIe and audio clocks
- Amlogic Meson GEN CLK on gxbb, gxl and axg
Updates:
- remove an unused variable from Exynos4412 ISP driver
- fix a thinko bug in SCMI clk division logic
- add missing of_node_put()s in some i.MX clk drivers
- Tegra SDMMC clk jitter improvements with high speed signaling modes
- SPDX tagging for qcom and cs2000-cp drivers
- stop leaking con ids in __clk_put()
- fix a corner case in fixed factor clk probing where node is in DT
but parent clk is registered much later
- Marvell Armada 3700 clk_pm_cpu_get_parent() had an invalid return
value
- i.MX clk init arrays removed in place of CLK_IS_CRITICAL
- convert to CLK_IS_CRITICAL for i.MX51/53 driver
- fix Tegra BPMP driver oops when xlating a NULL clk
- proper default configuration for vic03 and vde clks on Tegra124
- mark Tegra memory controller clks as critical
- fix array bounds clamp in Tegra's emc determine_rate() op
- Ingenic i2s bit update and allow UDC clk to gate
- fix name of aspeed SDC clk define to have only one 'CLK'
- fix i.MX6QDL video clk parent
- critical clk markings for qcom SDM845
- fix Stratix10 mpu_free_clk and sdmmc_free_clk parents
- mark Rockchip's pclk_rkpwm_pmu as critical clock, due to it
supplying the pwm used to drive the logic supply of the rk3399
core"
* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (85 commits)
clk: rockchip: Add pclk_rkpwm_pmu to PMU critical clocks in rk3399
clk: cs2000-cp: convert to SPDX identifiers
clk: scmi: Fix the rounding of clock rate
clk: qcom: Add display clock controller driver for SDM845
clk: mvebu: armada-37xx-periph: Remove unused var num_parents
clk: samsung: Remove unused mout_user_aclk400_mcuisp_p4x12 variable
clk: actions: Add S700 SoC clock support
dt-bindings: clock: Add S700 support for Actions Semi Soc's
clk: actions: Add missing REGMAP_MMIO dependency
clk: uniphier: add clock frequency support for SPI
clk: uniphier: add more USB3 PHY clocks
clk: uniphier: add NAND 200MHz clock
clk: tegra: make sdmmc2 and sdmmc4 as sdmmc clocks
clk: tegra: Add sdmmc mux divider clock
clk: tegra: Refactor fractional divider calculation
clk: tegra: Fix includes required by fence_udelay()
clk: imx6sll: fix missing of_node_put()
clk: imx6ul: fix missing of_node_put()
clk: imx: add ocram_s clock for i.mx6sx
clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
...
Diffstat (limited to 'drivers/clk/meson/clk-audio-divider.c')
-rw-r--r-- | drivers/clk/meson/clk-audio-divider.c | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/drivers/clk/meson/clk-audio-divider.c b/drivers/clk/meson/clk-audio-divider.c deleted file mode 100644 index e4cf96ba704e..000000000000 --- a/drivers/clk/meson/clk-audio-divider.c +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2017 AmLogic, Inc. - * Author: Jerome Brunet <jbrunet@baylibre.com> - */ - -/* - * i2s master clock divider: The algorithm of the generic clk-divider used with - * a very precise clock parent such as the mpll tends to select a low divider - * factor. This gives poor results with this particular divider, especially with - * high frequencies (> 100 MHz) - * - * This driver try to select the maximum possible divider with the rate the - * upstream clock can provide. - */ - -#include <linux/clk-provider.h> -#include "clkc.h" - -static inline struct meson_clk_audio_div_data * -meson_clk_audio_div_data(struct clk_regmap *clk) -{ - return (struct meson_clk_audio_div_data *)clk->data; -} - -static int _div_round(unsigned long parent_rate, unsigned long rate, - unsigned long flags) -{ - if (flags & CLK_DIVIDER_ROUND_CLOSEST) - return DIV_ROUND_CLOSEST_ULL((u64)parent_rate, rate); - - return DIV_ROUND_UP_ULL((u64)parent_rate, rate); -} - -static int _get_val(unsigned long parent_rate, unsigned long rate) -{ - return DIV_ROUND_UP_ULL((u64)parent_rate, rate) - 1; -} - -static int _valid_divider(unsigned int width, int divider) -{ - int max_divider = 1 << width; - - return clamp(divider, 1, max_divider); -} - -static unsigned long audio_divider_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - unsigned long divider; - - divider = meson_parm_read(clk->map, &adiv->div) + 1; - - return DIV_ROUND_UP_ULL((u64)parent_rate, divider); -} - -static long audio_divider_round_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long *parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - unsigned long max_prate; - int divider; - - if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) { - divider = _div_round(*parent_rate, rate, adiv->flags); - divider = _valid_divider(adiv->div.width, divider); - return DIV_ROUND_UP_ULL((u64)*parent_rate, divider); - } - - /* Get the maximum parent rate */ - max_prate = clk_hw_round_rate(clk_hw_get_parent(hw), ULONG_MAX); - - /* Get the corresponding rounded down divider */ - divider = max_prate / rate; - divider = _valid_divider(adiv->div.width, divider); - - /* Get actual rate of the parent */ - *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), - divider * rate); - - return DIV_ROUND_UP_ULL((u64)*parent_rate, divider); -} - -static int audio_divider_set_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - int val = _get_val(parent_rate, rate); - - meson_parm_write(clk->map, &adiv->div, val); - - return 0; -} - -const struct clk_ops meson_clk_audio_divider_ro_ops = { - .recalc_rate = audio_divider_recalc_rate, - .round_rate = audio_divider_round_rate, -}; - -const struct clk_ops meson_clk_audio_divider_ops = { - .recalc_rate = audio_divider_recalc_rate, - .round_rate = audio_divider_round_rate, - .set_rate = audio_divider_set_rate, -}; |