cpufreq: cpufreq_interactive: avoid NULL point access
[firefly-linux-kernel-4.4.55.git] / drivers / cpufreq / speedstep-lib.h
1 /*
2  * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
3  *
4  *  Licensed under the terms of the GNU GPL License version 2.
5  *
6  *  Library for common functions for Intel SpeedStep v.1 and v.2 support
7  *
8  *  BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
9  */
10
11
12
13 /* processors */
14 enum speedstep_processor {
15         SPEEDSTEP_CPU_PIII_C_EARLY = 0x00000001,  /* Coppermine core */
16         SPEEDSTEP_CPU_PIII_C       = 0x00000002,  /* Coppermine core */
17         SPEEDSTEP_CPU_PIII_T       = 0x00000003,  /* Tualatin core */
18         SPEEDSTEP_CPU_P4M          = 0x00000004,  /* P4-M  */
19 /* the following processors are not speedstep-capable and are not auto-detected
20  * in speedstep_detect_processor(). However, their speed can be detected using
21  * the speedstep_get_frequency() call. */
22         SPEEDSTEP_CPU_PM           = 0xFFFFFF03,  /* Pentium M  */
23         SPEEDSTEP_CPU_P4D          = 0xFFFFFF04,  /* desktop P4  */
24         SPEEDSTEP_CPU_PCORE        = 0xFFFFFF05,  /* Core */
25 };
26
27 /* speedstep states -- only two of them */
28
29 #define SPEEDSTEP_HIGH  0x00000000
30 #define SPEEDSTEP_LOW   0x00000001
31
32
33 /* detect a speedstep-capable processor */
34 extern enum speedstep_processor speedstep_detect_processor(void);
35
36 /* detect the current speed (in khz) of the processor */
37 extern unsigned int speedstep_get_frequency(enum speedstep_processor processor);
38
39
40 /* detect the low and high speeds of the processor. The callback
41  * set_state"'s first argument is either SPEEDSTEP_HIGH or
42  * SPEEDSTEP_LOW; the second argument is zero so that no
43  * cpufreq_notify_transition calls are initiated.
44  */
45 extern unsigned int speedstep_get_freqs(enum speedstep_processor processor,
46         unsigned int *low_speed,
47         unsigned int *high_speed,
48         unsigned int *transition_latency,
49         void (*set_state) (unsigned int state));