clkt2xxx_dpll.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * OMAP2-specific DPLL control functions
  4. *
  5. * Copyright (C) 2011 Nokia Corporation
  6. * Paul Walmsley
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/errno.h>
  10. #include <linux/clk.h>
  11. #include <linux/io.h>
  12. #include "clock.h"
  13. #include "cm2xxx.h"
  14. #include "cm-regbits-24xx.h"
  15. /* Private functions */
  16. /**
  17. * _allow_idle - enable DPLL autoidle bits
  18. * @clk: struct clk * of the DPLL to operate on
  19. *
  20. * Enable DPLL automatic idle control. The DPLL will enter low-power
  21. * stop when its downstream clocks are gated. No return value.
  22. * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
  23. * instead. Add some mechanism to optionally enter this mode.
  24. */
  25. static void _allow_idle(struct clk_hw_omap *clk)
  26. {
  27. if (!clk || !clk->dpll_data)
  28. return;
  29. omap2xxx_cm_set_dpll_auto_low_power_stop();
  30. }
  31. /**
  32. * _deny_idle - prevent DPLL from automatically idling
  33. * @clk: struct clk * of the DPLL to operate on
  34. *
  35. * Disable DPLL automatic idle control. No return value.
  36. */
  37. static void _deny_idle(struct clk_hw_omap *clk)
  38. {
  39. if (!clk || !clk->dpll_data)
  40. return;
  41. omap2xxx_cm_set_dpll_disable_autoidle();
  42. }
  43. /* Public data */
  44. const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
  45. .allow_idle = _allow_idle,
  46. .deny_idle = _deny_idle,
  47. };