cpufreq.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * linux/include/linux/cpufreq.h
  3. *
  4. * Copyright (C) 2001 Russell King
  5. * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _LINUX_CPUFREQ_H
  12. #define _LINUX_CPUFREQ_H
  13. #include <linux/clk.h>
  14. #include <linux/cpumask.h>
  15. #include <linux/completion.h>
  16. #include <linux/kobject.h>
  17. #include <linux/notifier.h>
  18. #include <linux/spinlock.h>
  19. #include <linux/sysfs.h>
  20. /*********************************************************************
  21. * CPUFREQ INTERFACE *
  22. *********************************************************************/
  23. /*
  24. * Frequency values here are CPU kHz
  25. *
  26. * Maximum transition latency is in nanoseconds - if it's unknown,
  27. * CPUFREQ_ETERNAL shall be used.
  28. */
  29. #define CPUFREQ_ETERNAL (-1)
  30. #define CPUFREQ_NAME_LEN 16
  31. /* Print length for names. Extra 1 space for accomodating '\n' in prints */
  32. #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
  33. struct cpufreq_governor;
  34. struct cpufreq_freqs {
  35. unsigned int cpu; /* cpu nr */
  36. unsigned int old;
  37. unsigned int new;
  38. u8 flags; /* flags of cpufreq_driver, see below. */
  39. };
  40. struct cpufreq_cpuinfo {
  41. unsigned int max_freq;
  42. unsigned int min_freq;
  43. /* in 10^(-9) s = nanoseconds */
  44. unsigned int transition_latency;
  45. };
  46. struct cpufreq_real_policy {
  47. unsigned int min; /* in kHz */
  48. unsigned int max; /* in kHz */
  49. unsigned int policy; /* see above */
  50. struct cpufreq_governor *governor; /* see below */
  51. };
  52. struct cpufreq_policy {
  53. /* CPUs sharing clock, require sw coordination */
  54. cpumask_var_t cpus; /* Online CPUs only */
  55. cpumask_var_t related_cpus; /* Online + Offline CPUs */
  56. unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs
  57. should set cpufreq */
  58. unsigned int cpu; /* cpu managing this policy, must be online */
  59. unsigned int kobj_cpu; /* cpu managing sysfs files, can be offline */
  60. struct clk *clk;
  61. struct cpufreq_cpuinfo cpuinfo;/* see above */
  62. unsigned int min; /* in kHz */
  63. unsigned int max; /* in kHz */
  64. unsigned int cur; /* in kHz, only needed if cpufreq
  65. * governors are used */
  66. unsigned int restore_freq; /* = policy->cur before transition */
  67. unsigned int suspend_freq; /* freq to set during suspend */
  68. unsigned int policy; /* see above */
  69. struct cpufreq_governor *governor; /* see below */
  70. void *governor_data;
  71. bool governor_enabled; /* governor start/stop flag */
  72. char last_governor[CPUFREQ_NAME_LEN]; /* last governor used */
  73. struct work_struct update; /* if update_policy() needs to be
  74. * called, but you're in IRQ context */
  75. struct cpufreq_real_policy user_policy;
  76. struct cpufreq_frequency_table *freq_table;
  77. struct list_head policy_list;
  78. struct kobject kobj;
  79. struct completion kobj_unregister;
  80. /*
  81. * The rules for this semaphore:
  82. * - Any routine that wants to read from the policy structure will
  83. * do a down_read on this semaphore.
  84. * - Any routine that will write to the policy structure and/or may take away
  85. * the policy altogether (eg. CPU hotplug), will hold this lock in write
  86. * mode before doing so.
  87. *
  88. * Additional rules:
  89. * - Lock should not be held across
  90. * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
  91. */
  92. struct rw_semaphore rwsem;
  93. /* Synchronization for frequency transitions */
  94. bool transition_ongoing; /* Tracks transition status */
  95. spinlock_t transition_lock;
  96. wait_queue_head_t transition_wait;
  97. struct task_struct *transition_task; /* Task which is doing the transition */
  98. /* cpufreq-stats */
  99. struct cpufreq_stats *stats;
  100. /* For cpufreq driver's internal use */
  101. void *driver_data;
  102. };
  103. /* Only for ACPI */
  104. #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
  105. #define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
  106. #define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
  107. #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
  108. #ifdef CONFIG_CPU_FREQ
  109. struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
  110. void cpufreq_cpu_put(struct cpufreq_policy *policy);
  111. #else
  112. static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
  113. {
  114. return NULL;
  115. }
  116. static inline void cpufreq_cpu_put(struct cpufreq_policy *policy) { }
  117. #endif
  118. static inline bool policy_is_shared(struct cpufreq_policy *policy)
  119. {
  120. return cpumask_weight(policy->cpus) > 1;
  121. }
  122. /* /sys/devices/system/cpu/cpufreq: entry point for global variables */
  123. extern struct kobject *cpufreq_global_kobject;
  124. int cpufreq_get_global_kobject(void);
  125. void cpufreq_put_global_kobject(void);
  126. int cpufreq_sysfs_create_file(const struct attribute *attr);
  127. void cpufreq_sysfs_remove_file(const struct attribute *attr);
  128. #ifdef CONFIG_CPU_FREQ
  129. unsigned int cpufreq_get(unsigned int cpu);
  130. unsigned int cpufreq_quick_get(unsigned int cpu);
  131. unsigned int cpufreq_quick_get_max(unsigned int cpu);
  132. void disable_cpufreq(void);
  133. u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
  134. int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
  135. int cpufreq_update_policy(unsigned int cpu);
  136. bool have_governor_per_policy(void);
  137. struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
  138. #else
  139. static inline unsigned int cpufreq_get(unsigned int cpu)
  140. {
  141. return 0;
  142. }
  143. static inline unsigned int cpufreq_quick_get(unsigned int cpu)
  144. {
  145. return 0;
  146. }
  147. static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
  148. {
  149. return 0;
  150. }
  151. static inline void disable_cpufreq(void) { }
  152. #endif
  153. /*********************************************************************
  154. * CPUFREQ DRIVER INTERFACE *
  155. *********************************************************************/
  156. #define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
  157. #define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
  158. #define CPUFREQ_RELATION_C 2 /* closest frequency to target */
  159. struct freq_attr {
  160. struct attribute attr;
  161. ssize_t (*show)(struct cpufreq_policy *, char *);
  162. ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
  163. };
  164. #define cpufreq_freq_attr_ro(_name) \
  165. static struct freq_attr _name = \
  166. __ATTR(_name, 0444, show_##_name, NULL)
  167. #define cpufreq_freq_attr_ro_perm(_name, _perm) \
  168. static struct freq_attr _name = \
  169. __ATTR(_name, _perm, show_##_name, NULL)
  170. #define cpufreq_freq_attr_rw(_name) \
  171. static struct freq_attr _name = \
  172. __ATTR(_name, 0644, show_##_name, store_##_name)
  173. struct global_attr {
  174. struct attribute attr;
  175. ssize_t (*show)(struct kobject *kobj,
  176. struct attribute *attr, char *buf);
  177. ssize_t (*store)(struct kobject *a, struct attribute *b,
  178. const char *c, size_t count);
  179. };
  180. #define define_one_global_ro(_name) \
  181. static struct global_attr _name = \
  182. __ATTR(_name, 0444, show_##_name, NULL)
  183. #define define_one_global_rw(_name) \
  184. static struct global_attr _name = \
  185. __ATTR(_name, 0644, show_##_name, store_##_name)
  186. struct cpufreq_driver {
  187. char name[CPUFREQ_NAME_LEN];
  188. u8 flags;
  189. void *driver_data;
  190. /* needed by all drivers */
  191. int (*init)(struct cpufreq_policy *policy);
  192. int (*verify)(struct cpufreq_policy *policy);
  193. /* define one out of two */
  194. int (*setpolicy)(struct cpufreq_policy *policy);
  195. /*
  196. * On failure, should always restore frequency to policy->restore_freq
  197. * (i.e. old freq).
  198. */
  199. int (*target)(struct cpufreq_policy *policy,
  200. unsigned int target_freq,
  201. unsigned int relation); /* Deprecated */
  202. int (*target_index)(struct cpufreq_policy *policy,
  203. unsigned int index);
  204. /*
  205. * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION
  206. * unset.
  207. *
  208. * get_intermediate should return a stable intermediate frequency
  209. * platform wants to switch to and target_intermediate() should set CPU
  210. * to to that frequency, before jumping to the frequency corresponding
  211. * to 'index'. Core will take care of sending notifications and driver
  212. * doesn't have to handle them in target_intermediate() or
  213. * target_index().
  214. *
  215. * Drivers can return '0' from get_intermediate() in case they don't
  216. * wish to switch to intermediate frequency for some target frequency.
  217. * In that case core will directly call ->target_index().
  218. */
  219. unsigned int (*get_intermediate)(struct cpufreq_policy *policy,
  220. unsigned int index);
  221. int (*target_intermediate)(struct cpufreq_policy *policy,
  222. unsigned int index);
  223. /* should be defined, if possible */
  224. unsigned int (*get)(unsigned int cpu);
  225. /* optional */
  226. int (*bios_limit)(int cpu, unsigned int *limit);
  227. int (*exit)(struct cpufreq_policy *policy);
  228. void (*stop_cpu)(struct cpufreq_policy *policy);
  229. int (*suspend)(struct cpufreq_policy *policy);
  230. int (*resume)(struct cpufreq_policy *policy);
  231. /* Will be called after the driver is fully initialized */
  232. void (*ready)(struct cpufreq_policy *policy);
  233. struct freq_attr **attr;
  234. /* platform specific boost support code */
  235. bool boost_supported;
  236. bool boost_enabled;
  237. int (*set_boost)(int state);
  238. };
  239. /* flags */
  240. #define CPUFREQ_STICKY (1 << 0) /* driver isn't removed even if
  241. all ->init() calls failed */
  242. #define CPUFREQ_CONST_LOOPS (1 << 1) /* loops_per_jiffy or other
  243. kernel "constants" aren't
  244. affected by frequency
  245. transitions */
  246. #define CPUFREQ_PM_NO_WARN (1 << 2) /* don't warn on suspend/resume
  247. speed mismatches */
  248. /*
  249. * This should be set by platforms having multiple clock-domains, i.e.
  250. * supporting multiple policies. With this sysfs directories of governor would
  251. * be created in cpu/cpu<num>/cpufreq/ directory and so they can use the same
  252. * governor with different tunables for different clusters.
  253. */
  254. #define CPUFREQ_HAVE_GOVERNOR_PER_POLICY (1 << 3)
  255. /*
  256. * Driver will do POSTCHANGE notifications from outside of their ->target()
  257. * routine and so must set cpufreq_driver->flags with this flag, so that core
  258. * can handle them specially.
  259. */
  260. #define CPUFREQ_ASYNC_NOTIFICATION (1 << 4)
  261. /*
  262. * Set by drivers which want cpufreq core to check if CPU is running at a
  263. * frequency present in freq-table exposed by the driver. For these drivers if
  264. * CPU is found running at an out of table freq, we will try to set it to a freq
  265. * from the table. And if that fails, we will stop further boot process by
  266. * issuing a BUG_ON().
  267. */
  268. #define CPUFREQ_NEED_INITIAL_FREQ_CHECK (1 << 5)
  269. int cpufreq_register_driver(struct cpufreq_driver *driver_data);
  270. int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
  271. const char *cpufreq_get_current_driver(void);
  272. void *cpufreq_get_driver_data(void);
  273. static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
  274. unsigned int min, unsigned int max)
  275. {
  276. if (policy->min < min)
  277. policy->min = min;
  278. if (policy->max < min)
  279. policy->max = min;
  280. if (policy->min > max)
  281. policy->min = max;
  282. if (policy->max > max)
  283. policy->max = max;
  284. if (policy->min > policy->max)
  285. policy->min = policy->max;
  286. return;
  287. }
  288. static inline void
  289. cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
  290. {
  291. cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
  292. policy->cpuinfo.max_freq);
  293. }
  294. #ifdef CONFIG_CPU_FREQ
  295. void cpufreq_suspend(void);
  296. void cpufreq_resume(void);
  297. int cpufreq_generic_suspend(struct cpufreq_policy *policy);
  298. #else
  299. static inline void cpufreq_suspend(void) {}
  300. static inline void cpufreq_resume(void) {}
  301. #endif
  302. /*********************************************************************
  303. * CPUFREQ NOTIFIER INTERFACE *
  304. *********************************************************************/
  305. #define CPUFREQ_TRANSITION_NOTIFIER (0)
  306. #define CPUFREQ_POLICY_NOTIFIER (1)
  307. /* Transition notifiers */
  308. #define CPUFREQ_PRECHANGE (0)
  309. #define CPUFREQ_POSTCHANGE (1)
  310. /* Policy Notifiers */
  311. #define CPUFREQ_ADJUST (0)
  312. #define CPUFREQ_INCOMPATIBLE (1)
  313. #define CPUFREQ_NOTIFY (2)
  314. #define CPUFREQ_START (3)
  315. #define CPUFREQ_CREATE_POLICY (4)
  316. #define CPUFREQ_REMOVE_POLICY (5)
  317. #ifdef CONFIG_CPU_FREQ
  318. int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
  319. int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
  320. void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
  321. struct cpufreq_freqs *freqs);
  322. void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
  323. struct cpufreq_freqs *freqs, int transition_failed);
  324. #else /* CONFIG_CPU_FREQ */
  325. static inline int cpufreq_register_notifier(struct notifier_block *nb,
  326. unsigned int list)
  327. {
  328. return 0;
  329. }
  330. static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
  331. unsigned int list)
  332. {
  333. return 0;
  334. }
  335. #endif /* !CONFIG_CPU_FREQ */
  336. /**
  337. * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
  338. * safe)
  339. * @old: old value
  340. * @div: divisor
  341. * @mult: multiplier
  342. *
  343. *
  344. * new = old * mult / div
  345. */
  346. static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
  347. u_int mult)
  348. {
  349. #if BITS_PER_LONG == 32
  350. u64 result = ((u64) old) * ((u64) mult);
  351. do_div(result, div);
  352. return (unsigned long) result;
  353. #elif BITS_PER_LONG == 64
  354. unsigned long result = old * ((u64) mult);
  355. result /= div;
  356. return result;
  357. #endif
  358. }
  359. /*********************************************************************
  360. * CPUFREQ GOVERNORS *
  361. *********************************************************************/
  362. /*
  363. * If (cpufreq_driver->target) exists, the ->governor decides what frequency
  364. * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
  365. * two generic policies are available:
  366. */
  367. #define CPUFREQ_POLICY_POWERSAVE (1)
  368. #define CPUFREQ_POLICY_PERFORMANCE (2)
  369. /* Governor Events */
  370. #define CPUFREQ_GOV_START 1
  371. #define CPUFREQ_GOV_STOP 2
  372. #define CPUFREQ_GOV_LIMITS 3
  373. #define CPUFREQ_GOV_POLICY_INIT 4
  374. #define CPUFREQ_GOV_POLICY_EXIT 5
  375. struct cpufreq_governor {
  376. char name[CPUFREQ_NAME_LEN];
  377. int initialized;
  378. int (*governor) (struct cpufreq_policy *policy,
  379. unsigned int event);
  380. ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
  381. char *buf);
  382. int (*store_setspeed) (struct cpufreq_policy *policy,
  383. unsigned int freq);
  384. unsigned int max_transition_latency; /* HW must be able to switch to
  385. next freq faster than this value in nano secs or we
  386. will fallback to performance governor */
  387. struct list_head governor_list;
  388. struct module *owner;
  389. };
  390. /* Pass a target to the cpufreq driver */
  391. int cpufreq_driver_target(struct cpufreq_policy *policy,
  392. unsigned int target_freq,
  393. unsigned int relation);
  394. int __cpufreq_driver_target(struct cpufreq_policy *policy,
  395. unsigned int target_freq,
  396. unsigned int relation);
  397. int cpufreq_register_governor(struct cpufreq_governor *governor);
  398. void cpufreq_unregister_governor(struct cpufreq_governor *governor);
  399. /* CPUFREQ DEFAULT GOVERNOR */
  400. /*
  401. * Performance governor is fallback governor if any other gov failed to auto
  402. * load due latency restrictions
  403. */
  404. #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
  405. extern struct cpufreq_governor cpufreq_gov_performance;
  406. #endif
  407. #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
  408. #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
  409. #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE)
  410. extern struct cpufreq_governor cpufreq_gov_powersave;
  411. #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_powersave)
  412. #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
  413. extern struct cpufreq_governor cpufreq_gov_userspace;
  414. #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)
  415. #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND)
  416. extern struct cpufreq_governor cpufreq_gov_ondemand;
  417. #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_ondemand)
  418. #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
  419. extern struct cpufreq_governor cpufreq_gov_conservative;
  420. #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
  421. #endif
  422. /*********************************************************************
  423. * FREQUENCY TABLE HELPERS *
  424. *********************************************************************/
  425. /* Special Values of .frequency field */
  426. #define CPUFREQ_ENTRY_INVALID ~0u
  427. #define CPUFREQ_TABLE_END ~1u
  428. /* Special Values of .flags field */
  429. #define CPUFREQ_BOOST_FREQ (1 << 0)
  430. struct cpufreq_frequency_table {
  431. unsigned int flags;
  432. unsigned int driver_data; /* driver specific data, not used by core */
  433. unsigned int frequency; /* kHz - doesn't need to be in ascending
  434. * order */
  435. };
  436. #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
  437. int dev_pm_opp_init_cpufreq_table(struct device *dev,
  438. struct cpufreq_frequency_table **table);
  439. void dev_pm_opp_free_cpufreq_table(struct device *dev,
  440. struct cpufreq_frequency_table **table);
  441. #else
  442. static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
  443. struct cpufreq_frequency_table
  444. **table)
  445. {
  446. return -EINVAL;
  447. }
  448. static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
  449. struct cpufreq_frequency_table
  450. **table)
  451. {
  452. }
  453. #endif
  454. static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
  455. {
  456. while ((*pos)->frequency != CPUFREQ_TABLE_END)
  457. if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
  458. return true;
  459. else
  460. (*pos)++;
  461. return false;
  462. }
  463. /*
  464. * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
  465. * @pos: the cpufreq_frequency_table * to use as a loop cursor.
  466. * @table: the cpufreq_frequency_table * to iterate over.
  467. */
  468. #define cpufreq_for_each_entry(pos, table) \
  469. for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
  470. /*
  471. * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
  472. * excluding CPUFREQ_ENTRY_INVALID frequencies.
  473. * @pos: the cpufreq_frequency_table * to use as a loop cursor.
  474. * @table: the cpufreq_frequency_table * to iterate over.
  475. */
  476. #define cpufreq_for_each_valid_entry(pos, table) \
  477. for (pos = table; cpufreq_next_valid(&pos); pos++)
  478. int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
  479. struct cpufreq_frequency_table *table);
  480. int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
  481. struct cpufreq_frequency_table *table);
  482. int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy);
  483. int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
  484. struct cpufreq_frequency_table *table,
  485. unsigned int target_freq,
  486. unsigned int relation,
  487. unsigned int *index);
  488. int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
  489. unsigned int freq);
  490. ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
  491. #ifdef CONFIG_CPU_FREQ
  492. int cpufreq_boost_trigger_state(int state);
  493. int cpufreq_boost_supported(void);
  494. int cpufreq_boost_enabled(void);
  495. #else
  496. static inline int cpufreq_boost_trigger_state(int state)
  497. {
  498. return 0;
  499. }
  500. static inline int cpufreq_boost_supported(void)
  501. {
  502. return 0;
  503. }
  504. static inline int cpufreq_boost_enabled(void)
  505. {
  506. return 0;
  507. }
  508. #endif
  509. /* the following funtion is for cpufreq core use only */
  510. struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
  511. /* the following are really really optional */
  512. extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
  513. extern struct freq_attr *cpufreq_generic_attr[];
  514. int cpufreq_table_validate_and_show(struct cpufreq_policy *policy,
  515. struct cpufreq_frequency_table *table);
  516. unsigned int cpufreq_generic_get(unsigned int cpu);
  517. int cpufreq_generic_init(struct cpufreq_policy *policy,
  518. struct cpufreq_frequency_table *table,
  519. unsigned int transition_latency);
  520. #endif /* _LINUX_CPUFREQ_H */