Lines Matching refs:clockdomain

3  * OMAP2/3/4 clockdomain framework functions
31 #include "clockdomain.h"
37 /* array of clockdomain deps to be added/removed when clkdm in hwsup mode */
46 static struct clockdomain *_clkdm_lookup(const char *name)
48 struct clockdomain *clkdm, *temp_clkdm;
66 * _clkdm_register - register a clockdomain
67 * @clkdm: struct clockdomain * to register
69 * Adds a clockdomain to the internal clockdomain list.
70 * Returns -EINVAL if given a null pointer, -EEXIST if a clockdomain is
73 static int _clkdm_register(struct clockdomain *clkdm)
82 pr_err("clockdomain: %s: powerdomain %s does not exist\n",
88 /* Verify that the clockdomain is not already registered */
96 pr_debug("clockdomain: registered %s\n", clkdm->name);
101 /* _clkdm_deps_lookup - look up the specified clockdomain in a clkdm list */
102 static struct clkdm_dep *_clkdm_deps_lookup(struct clockdomain *clkdm,
128 * Resolve autodep clockdomain names to clockdomain pointers via
130 * "autodep" is a clockdomain sleep/wakeup dependency that is
132 * clockdomain are enabled or disabled (respectively) when the
133 * clockdomain is in hardware-supervised mode. Meant to be called
134 * once at clockdomain layer initialization, since these should remain
142 struct clockdomain *clkdm;
149 pr_err("clockdomain: autodeps: clockdomain %s does not exist\n",
158 * @clkdm: clockdomain that we are resolving dependencies for
161 * Iterates through @clkdm_deps, looking up the struct clockdomain named by
162 * clkdm_name and storing the clockdomain pointer in the struct clkdm_dep.
165 static void _resolve_clkdm_deps(struct clockdomain *clkdm,
175 WARN(!cd->clkdm, "clockdomain: %s: could not find clkdm %s while resolving dependencies - should never happen",
182 * @clkdm1: wake this struct clockdomain * up (dependent)
183 * @clkdm2: when this struct clockdomain * wakes up (source)
185 * When the clockdomain represented by @clkdm2 wakes up, wake up
187 * designed to reduce wakeup latency of the dependent clockdomain @clkdm1.
188 * Returns -EINVAL if presented with invalid clockdomain pointers,
192 static int _clkdm_add_wkdep(struct clockdomain *clkdm1,
193 struct clockdomain *clkdm2)
209 pr_debug("clockdomain: hardware cannot set/clear wake up of %s when %s wakes up\n",
216 pr_debug("clockdomain: hardware will wake up %s when %s wakes up\n",
227 * @clkdm1: wake this struct clockdomain * up (dependent)
228 * @clkdm2: when this struct clockdomain * wakes up (source)
231 * wakes up. Returns -EINVAL if presented with invalid clockdomain
235 static int _clkdm_del_wkdep(struct clockdomain *clkdm1,
236 struct clockdomain *clkdm2)
252 pr_debug("clockdomain: hardware cannot set/clear wake up of %s when %s wakes up\n",
259 pr_debug("clockdomain: hardware will no longer wake up %s after %s wakes up\n",
270 * @clkdm1: prevent this struct clockdomain * from sleeping (dependent)
271 * @clkdm2: when this struct clockdomain * is active (source)
275 * presented with invalid clockdomain pointers or called on a machine
280 static int _clkdm_add_sleepdep(struct clockdomain *clkdm1,
281 struct clockdomain *clkdm2)
297 pr_debug("clockdomain: hardware cannot set/clear sleep dependency affecting %s from %s\n",
304 pr_debug("clockdomain: will prevent %s from sleeping if %s is active\n",
315 * @clkdm1: prevent this struct clockdomain * from sleeping (dependent)
316 * @clkdm2: when this struct clockdomain * is active (source)
320 * if presented with invalid clockdomain pointers or called on a machine
325 static int _clkdm_del_sleepdep(struct clockdomain *clkdm1,
326 struct clockdomain *clkdm2)
342 pr_debug("clockdomain: hardware cannot set/clear sleep dependency affecting %s from %s\n",
349 pr_debug("clockdomain: will no longer prevent %s from sleeping if %s is active\n",
361 * clkdm_register_platform_funcs - register clockdomain implementation fns
365 * clockdomain functions on different OMAP SoCs. Should be called
385 * @cs: pointer to an array of struct clockdomain to register
393 int clkdm_register_clkdms(struct clockdomain **cs)
395 struct clockdomain **c = NULL;
413 * Register clockdomain "automatic dependencies." These are
414 * clockdomain wakeup and sleep dependencies that are automatically
415 * added whenever the first clock inside a clockdomain is enabled, and
416 * removed whenever the last clock inside a clockdomain is disabled.
423 * registered, since the function will resolve autodep clockdomain
424 * names into clockdomain pointers.
470 * clkdm_complete_init - set up the clockdomain layer
479 struct clockdomain *clkdm;
505 * clkdm_lookup - look up a clockdomain by name, return a pointer
506 * @name: name of clockdomain
508 * Find a registered clockdomain by its name @name. Returns a pointer
509 * to the struct clockdomain if found, or NULL otherwise.
511 struct clockdomain *clkdm_lookup(const char *name)
513 struct clockdomain *clkdm, *temp_clkdm;
531 * clkdm_for_each - call function on each registered clockdomain
534 * Call the supplied function @fn for each registered clockdomain.
537 * the clkdm_mutex held, so no clockdomain structure manipulation
539 * clockdomain control functions are fine. Returns the last return
544 int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
547 struct clockdomain *clkdm;
565 * @clkdm: struct clockdomain *
567 * Return a pointer to the struct powerdomain that the specified clockdomain
570 struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)
579 /* Hardware clockdomain control */
583 * @clkdm1: wake this struct clockdomain * up (dependent)
584 * @clkdm2: when this struct clockdomain * wakes up (source)
586 * When the clockdomain represented by @clkdm2 wakes up, wake up
588 * designed to reduce wakeup latency of the dependent clockdomain @clkdm1.
589 * Returns -EINVAL if presented with invalid clockdomain pointers,
593 int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
614 * @clkdm1: wake this struct clockdomain * up (dependent)
615 * @clkdm2: when this struct clockdomain * wakes up (source)
618 * wakes up. Returns -EINVAL if presented with invalid clockdomain
622 int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
643 * @clkdm1: wake this struct clockdomain * up (dependent)
644 * @clkdm2: when this struct clockdomain * wakes up (source)
648 * if either clockdomain pointer is invalid; or -ENOENT if the hardware
655 int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
671 pr_debug("clockdomain: hardware cannot set/clear wake up of %s when %s wakes up\n",
682 * @clkdm: struct clockdomain * to remove all wakeup dependencies from
684 * Remove all inter-clockdomain wakeup dependencies that could cause
690 int clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
703 * @clkdm1: prevent this struct clockdomain * from sleeping (dependent)
704 * @clkdm2: when this struct clockdomain * is active (source)
708 * presented with invalid clockdomain pointers or called on a machine
713 int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
734 * @clkdm1: prevent this struct clockdomain * from sleeping (dependent)
735 * @clkdm2: when this struct clockdomain * is active (source)
739 * if presented with invalid clockdomain pointers or called on a machine
744 int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
765 * @clkdm1: prevent this struct clockdomain * from sleeping (dependent)
766 * @clkdm2: when this struct clockdomain * is active (source)
771 * of @clkdm2's; -EINVAL if either clockdomain pointer is invalid or called
779 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
795 pr_debug("clockdomain: hardware cannot set/clear sleep dependency affecting %s from %s\n",
806 * @clkdm: struct clockdomain * to remove all sleep dependencies from
808 * Remove all inter-clockdomain sleep dependencies that could prevent
814 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
826 * clkdm_sleep_nolock - force clockdomain sleep transition (lockless)
827 * @clkdm: struct clockdomain *
830 * clockdomain @clkdm. Only for use by the powerdomain code. Returns
831 * -EINVAL if @clkdm is NULL or if clockdomain does not support
834 int clkdm_sleep_nolock(struct clockdomain *clkdm)
842 pr_debug("clockdomain: %s does not support forcing sleep via software\n",
850 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name);
860 * clkdm_sleep - force clockdomain sleep transition
861 * @clkdm: struct clockdomain *
864 * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if
865 * clockdomain does not support software-initiated sleep; 0 upon
868 int clkdm_sleep(struct clockdomain *clkdm)
880 * clkdm_wakeup_nolock - force clockdomain wakeup transition (lockless)
881 * @clkdm: struct clockdomain *
884 * clockdomain @clkdm. Only for use by the powerdomain code. Returns
885 * -EINVAL if @clkdm is NULL or if the clockdomain does not support
888 int clkdm_wakeup_nolock(struct clockdomain *clkdm)
896 pr_debug("clockdomain: %s does not support forcing wakeup via software\n",
904 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name);
914 * clkdm_wakeup - force clockdomain wakeup transition
915 * @clkdm: struct clockdomain *
918 * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if the
919 * clockdomain does not support software-controlled wakeup; 0 upon
922 int clkdm_wakeup(struct clockdomain *clkdm)
935 * @clkdm: struct clockdomain *
937 * Allow the hardware to automatically switch the clockdomain @clkdm
939 * clockdomain has any downstream clocks enabled in the clock
944 void clkdm_allow_idle_nolock(struct clockdomain *clkdm)
967 pr_debug("clockdomain: enabling automatic idle transitions for %s\n",
977 * @clkdm: struct clockdomain *
979 * Allow the hardware to automatically switch the clockdomain @clkdm into
981 * clockdomain has any downstream clocks enabled in the clock
985 void clkdm_allow_idle(struct clockdomain *clkdm)
994 * @clkdm: struct clockdomain *
996 * Prevent the hardware from automatically switching the clockdomain
997 * @clkdm into inactive or idle states. If the clockdomain has
1002 void clkdm_deny_idle_nolock(struct clockdomain *clkdm)
1022 pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
1032 * @clkdm: struct clockdomain *
1034 * Prevent the hardware from automatically switching the clockdomain
1035 * @clkdm into inactive or idle states. If the clockdomain has
1039 void clkdm_deny_idle(struct clockdomain *clkdm)
1047 * clkdm_in_hwsup - is clockdomain @clkdm have hardware-supervised idle enabled?
1048 * @clkdm: struct clockdomain *
1050 * Returns true if clockdomain @clkdm currently has
1055 * changed whenever the clockdomain code changes the auto-idle mode.
1057 bool clkdm_in_hwsup(struct clockdomain *clkdm)
1071 * @clkdm: struct clockdomain *
1073 * Returns true if clockdomain @clkdm has the
1078 bool clkdm_missing_idle_reporting(struct clockdomain *clkdm)
1090 * @clkdm: struct clockdomain *
1092 * Add the "autodep" sleep & wakeup dependencies to clockdomain 'clkdm'
1094 * when a clock inside clockdomain 'clkdm' is enabled. No return value.
1099 void clkdm_add_autodeps(struct clockdomain *clkdm)
1110 pr_debug("clockdomain: %s: adding %s sleepdep/wkdep\n",
1120 * @clkdm: struct clockdomain *
1122 * Remove the "autodep" sleep & wakeup dependencies from clockdomain 'clkdm'
1124 * when a clock inside clockdomain 'clkdm' is disabled. No return value.
1129 void clkdm_del_autodeps(struct clockdomain *clkdm)
1140 pr_debug("clockdomain: %s: removing %s sleepdep/wkdep\n",
1152 * @clkdm: struct clockdomain *
1155 * Increment the usecount of the clockdomain @clkdm and ensure that it
1157 * clk_enable() code. If the clockdomain is in software-supervised
1158 * idle mode, force the clockdomain to wake. If the clockdomain is in
1160 * ensure that devices in the clockdomain can be read from/written to
1162 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
1164 int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *unused)
1186 pr_debug("clockdomain: %s: enabled\n", clkdm->name);
1193 * @clkdm: struct clockdomain *
1196 * Decrement the usecount of this clockdomain @clkdm when @clk is
1198 * clockdomain usecount goes to 0, put the clockdomain to sleep
1202 * upon success or if the clockdomain is in hwsup idle mode.
1204 int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1230 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1240 * @clkdm: struct clockdomain *
1243 * Increment the usecount of the clockdomain @clkdm and ensure that it
1246 * If the clockdomain is in software-supervised idle mode, force the
1247 * clockdomain to wake. If the clockdomain is in hardware-supervised idle
1249 * clockdomain can be read from/written to by on-chip processors.
1251 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
1253 int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1272 * @clkdm: struct clockdomain *
1275 * Decrement the usecount of this clockdomain @clkdm when @oh is
1277 * If the clockdomain usecount goes to 0, put the clockdomain to sleep
1281 * underflows; or returns 0 upon success or if the clockdomain is in hwsup
1284 int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1302 static int _clkdm_save_context(struct clockdomain *clkdm, void *ununsed)
1313 * Restore the register values for this clockdomain.
1315 static int _clkdm_restore_context(struct clockdomain *clkdm, void *ununsed)
1326 * Save the context for each registered clockdomain.
1336 * Restore the context for each registered clockdomain.