aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clkdev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-20 23:18:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-20 23:18:12 -0400
commit0eff4589c36edd03d50b835d0768b2c2ef3f20bd (patch)
treef0a08e7ed4dac042d89d24bb4c79f66df70085ff /drivers/clk/clkdev.c
parent087afe8aaf562dc7a53f2577049830d6a3245742 (diff)
parentef56b79b66faeeb0dc14213d3cc9e0534a960dee (diff)
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk updates from Stephen Boyd: "It's the usual big pile of driver updates and additions, but we do have a couple core changes in here as well. Core: - CLK_IS_CRITICAL support has been added. This should allow drivers to properly express that a certain clk should stay on even if their prepare/enable count drops to 0 (and in turn the parents of these clks should stay enabled). - A clk registration API has been added, clk_hw_register(), and an OF clk provider API has been added, of_clk_add_hw_provider(). These APIs have been put in place to further split clk providers from clk consumers, with the goal being to have clk providers never deal with struct clk pointers at all. Conversion of provider drivers is on going. clkdev has also gained support for registering clk_hw pointers directly so we can convert drivers that don't use devicetree. New Drivers: - Marvell ap806 and cp110 system controllers (with clks inside!) - Hisilicon Hi3519 clock and reset controller - Axis ARTPEC-6 clock controllers - Oxford Semiconductor OXNAS clock controllers - AXS10X I2S PLL - Rockchip RK3399 clock and reset controller Updates: - MMC2 and UART2 clks on Samsung Exynos 3250, ACLK on Samsung Exynos 542x SoCs, and some more clk ID exporting for bus frequency scaling - Proper BCM2835 PCM clk support and various other clks - i.MX clk updates for i.MX6SX, i.MX7, and VF610 - Renesas updates for R-Car H3 - Tegra210 got updates for DisplayPort and HDMI 2.0 - Rockchip driver refactorings and fixes due to adding RK3399 support" * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (139 commits) clk: fix critical clock locking clk: qcom: mmcc-8996: Remove clocks that should be controlled by RPM clk: ingenic: Allow divider value to be divided clk: sunxi: Add display and TCON0 clocks driver clk: rockchip: drop old_rate calculation on pll rate changes clk: rockchip: simplify GRF handling in pll clocks clk: rockchip: lookup General Register Files in rockchip_clk_init clk: rockchip: fix the rk3399 sdmmc sample / drv name clk: mvebu: new driver for Armada CP110 system controller dt-bindings: arm: add DT binding for Marvell CP110 system controller clk: mvebu: new driver for Armada AP806 system controller clk: hisilicon: add CRG driver for hi3519 soc clk: hisilicon: export some hisilicon APIs to modules reset: hisilicon: add reset controller driver for hisilicon SOCs clk: bcm/kona: Do not use sizeof on pointer type clk: qcom: msm8916: Fix crypto clock flags clk: nxp: lpc18xx: Initialize clk_init_data::flags to 0 clk/axs10x: Add I2S PLL clock driver clk: imx7d: fix ahb clock mux 1 clk: fix comment of devm_clk_hw_register() ...
Diffstat (limited to 'drivers/clk/clkdev.c')
-rw-r--r--drivers/clk/clkdev.c75
1 files changed, 56 insertions, 19 deletions
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index eb20b941154b..89cc700fbc37 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -301,6 +301,20 @@ clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
301} 301}
302EXPORT_SYMBOL(clkdev_alloc); 302EXPORT_SYMBOL(clkdev_alloc);
303 303
304struct clk_lookup *
305clkdev_hw_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt, ...)
306{
307 struct clk_lookup *cl;
308 va_list ap;
309
310 va_start(ap, dev_fmt);
311 cl = vclkdev_alloc(hw, con_id, dev_fmt, ap);
312 va_end(ap);
313
314 return cl;
315}
316EXPORT_SYMBOL(clkdev_hw_alloc);
317
304/** 318/**
305 * clkdev_create - allocate and add a clkdev lookup structure 319 * clkdev_create - allocate and add a clkdev lookup structure
306 * @clk: struct clk to associate with all clk_lookups 320 * @clk: struct clk to associate with all clk_lookups
@@ -324,6 +338,29 @@ struct clk_lookup *clkdev_create(struct clk *clk, const char *con_id,
324} 338}
325EXPORT_SYMBOL_GPL(clkdev_create); 339EXPORT_SYMBOL_GPL(clkdev_create);
326 340
341/**
342 * clkdev_hw_create - allocate and add a clkdev lookup structure
343 * @hw: struct clk_hw to associate with all clk_lookups
344 * @con_id: connection ID string on device
345 * @dev_fmt: format string describing device name
346 *
347 * Returns a clk_lookup structure, which can be later unregistered and
348 * freed.
349 */
350struct clk_lookup *clkdev_hw_create(struct clk_hw *hw, const char *con_id,
351 const char *dev_fmt, ...)
352{
353 struct clk_lookup *cl;
354 va_list ap;
355
356 va_start(ap, dev_fmt);
357 cl = vclkdev_create(hw, con_id, dev_fmt, ap);
358 va_end(ap);
359
360 return cl;
361}
362EXPORT_SYMBOL_GPL(clkdev_hw_create);
363
327int clk_add_alias(const char *alias, const char *alias_dev_name, 364int clk_add_alias(const char *alias, const char *alias_dev_name,
328 const char *con_id, struct device *dev) 365 const char *con_id, struct device *dev)
329{ 366{
@@ -404,28 +441,28 @@ int clk_register_clkdev(struct clk *clk, const char *con_id,
404EXPORT_SYMBOL(clk_register_clkdev); 441EXPORT_SYMBOL(clk_register_clkdev);
405 442
406/** 443/**
407 * clk_register_clkdevs - register a set of clk_lookup for a struct clk 444 * clk_hw_register_clkdev - register one clock lookup for a struct clk_hw
408 * @clk: struct clk to associate with all clk_lookups 445 * @hw: struct clk_hw to associate with all clk_lookups
409 * @cl: array of clk_lookup structures with con_id and dev_id pre-initialized 446 * @con_id: connection ID string on device
410 * @num: number of clk_lookup structures to register 447 * @dev_id: format string describing device name
411 * 448 *
412 * To make things easier for mass registration, we detect error clks 449 * con_id or dev_id may be NULL as a wildcard, just as in the rest of
413 * from a previous clk_register() call, and return the error code for 450 * clkdev.
414 * those. This is to permit this function to be called immediately
415 * after clk_register().
416 */ 451 */
417int clk_register_clkdevs(struct clk *clk, struct clk_lookup *cl, size_t num) 452int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id,
453 const char *dev_id)
418{ 454{
419 unsigned i; 455 struct clk_lookup *cl;
420
421 if (IS_ERR(clk))
422 return PTR_ERR(clk);
423 456
424 for (i = 0; i < num; i++, cl++) { 457 /*
425 cl->clk_hw = __clk_get_hw(clk); 458 * Since dev_id can be NULL, and NULL is handled specially, we must
426 __clkdev_add(cl); 459 * pass it as either a NULL format string, or with "%s".
427 } 460 */
461 if (dev_id)
462 cl = __clk_register_clkdev(hw, con_id, "%s", dev_id);
463 else
464 cl = __clk_register_clkdev(hw, con_id, NULL);
428 465
429 return 0; 466 return cl ? 0 : -ENOMEM;
430} 467}
431EXPORT_SYMBOL(clk_register_clkdevs); 468EXPORT_SYMBOL(clk_hw_register_clkdev);