Lines Matching refs:level

65 	struct cf_level			level;
105 static int cf_set_method(device_t dev, const struct cf_level *level,
107 static int cf_get_method(device_t dev, struct cf_level *level);
241 cf_set_method(device_t dev, const struct cf_level *level, int priority)
256 EVENTHANDLER_INVOKE(cpufreq_pre_change, level, &error);
258 EVENTHANDLER_INVOKE(cpufreq_post_change, level, error);
284 * If the requested level has a lower priority, don't allow
285 * the new level right now.
295 * If the caller didn't specify a level and one is saved, prepare to
296 * restore the saved level. If none has been saved, return an error.
298 if (level == NULL) {
301 CF_DEBUG("NULL level, no saved level\n");
305 level = &saved_freq->level;
307 CF_DEBUG("restoring saved level, freq %d prio %d\n",
308 level->total_set.freq, priority);
312 if (level->total_set.freq < cf_lowest_freq) {
314 level->total_set.freq, cf_lowest_freq);
319 /* If already at this level, just return. */
320 if (sc->curr_level.total_set.freq == level->total_set.freq) {
321 CF_DEBUG("skipping freq %d, same as current level %d\n",
322 level->total_set.freq, sc->curr_level.total_set.freq);
327 set = &level->abs_set;
360 for (i = 0; i < level->rel_count; i++) {
361 set = &level->rel_set[i];
389 * Before recording the current level, check if we're going to a
390 * higher priority. If so, save the previous level and priority.
394 CF_DEBUG("saving level, freq %d prio %d\n",
401 curr_freq->level = sc->curr_level;
405 sc->curr_level = *level;
410 CF_DEBUG("resetting saved level\n");
423 EVENTHANDLER_INVOKE(cpufreq_post_change, level, error);
431 cf_get_method(device_t dev, struct cf_level *level)
455 * We need to figure out the current level. Loop through every
457 * match of settings against each level.
477 * Reacquire the lock and search for the given level.
480 * through each level and compare both absolute and relative
505 * match against a level.
526 *level = sc->curr_level;
688 struct cf_level *level, *search;
695 level = malloc(sizeof(*level), M_TEMP, M_NOWAIT | M_ZERO);
696 if (level == NULL)
698 level->abs_set = sets[i];
699 level->total_set = sets[i];
700 level->total_set.dev = NULL;
707 TAILQ_INSERT_HEAD(list, level, link);
715 TAILQ_INSERT_AFTER(list, search, level, link);
725 TAILQ_INSERT_BEFORE(search, level, link);
750 * For instance, a level of 50 Mhz derived from 100 Mhz + 50% is
755 /* Add each setting to the level, duplicating if necessary. */
760 * If this setting is less than 100%, split the level
761 * into two and add this setting to the new level.
768 * The new level was a duplicate of an existing
769 * level or its absolute setting is too high
771 * derived level of 1000 MHz/25% if a level
778 /* Add this setting to the existing or new level. */
785 "expand set added rel setting %d%% to %d level\n",
805 * Create a new level, copy it from the old one, and update the
829 * If we copied an old level that we already modified (say, at 100%),
843 * Insert the new level in sorted order. If it is a duplicate of an
844 * existing level (1) or has an absolute setting higher than the
845 * existing level (2), do not add it. We can do this since any such
846 * level is guaranteed use less power. For example (1), a level with
849 * Also for example (2), a level of 800 Mhz/75% is preferable to
864 "dup done, inserting new level %d after %d\n",
877 /* We didn't find a good place for this new level so free it. */
879 CF_DEBUG("dup set freeing new level %d (not optimal)\n",