diff options
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
-rw-r--r-- | drivers/acpi/processor_throttling.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 0b8204e7082a..5fa8ac1c0c84 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
70 | 70 | ||
71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | 71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) |
72 | { | 72 | { |
73 | return acpi_processor_get_platform_limit(pr); | 73 | int result = 0; |
74 | int throttling_limit; | ||
75 | int current_state; | ||
76 | struct acpi_processor_limit *limit; | ||
77 | int target_state; | ||
78 | |||
79 | result = acpi_processor_get_platform_limit(pr); | ||
80 | if (result) { | ||
81 | /* Throttling Limit is unsupported */ | ||
82 | return result; | ||
83 | } | ||
84 | |||
85 | throttling_limit = pr->throttling_platform_limit; | ||
86 | if (throttling_limit >= pr->throttling.state_count) { | ||
87 | /* Uncorrect Throttling Limit */ | ||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | current_state = pr->throttling.state; | ||
92 | if (current_state > throttling_limit) { | ||
93 | /* | ||
94 | * The current state can meet the requirement of | ||
95 | * _TPC limit. But it is reasonable that OSPM changes | ||
96 | * t-states from high to low for better performance. | ||
97 | * Of course the limit condition of thermal | ||
98 | * and user should be considered. | ||
99 | */ | ||
100 | limit = &pr->limit; | ||
101 | target_state = throttling_limit; | ||
102 | if (limit->thermal.tx > target_state) | ||
103 | target_state = limit->thermal.tx; | ||
104 | if (limit->user.tx > target_state) | ||
105 | target_state = limit->user.tx; | ||
106 | } else if (current_state == throttling_limit) { | ||
107 | /* | ||
108 | * Unnecessary to change the throttling state | ||
109 | */ | ||
110 | return 0; | ||
111 | } else { | ||
112 | /* | ||
113 | * If the current state is lower than the limit of _TPC, it | ||
114 | * will be forced to switch to the throttling state defined | ||
115 | * by throttling_platfor_limit. | ||
116 | * Because the previous state meets with the limit condition | ||
117 | * of thermal and user, it is unnecessary to check it again. | ||
118 | */ | ||
119 | target_state = throttling_limit; | ||
120 | } | ||
121 | return acpi_processor_set_throttling(pr, target_state); | ||
74 | } | 122 | } |
75 | 123 | ||
76 | /* | 124 | /* |