View | Details | Raw Unified | Return to bug 98178
Collapse All | Expand All

(-)processor_thermal.c.orig (-9 / +42 lines)
Lines 116-121 Link Here
116
}
116
}
117
117
118
118
119
/* returns 0 if it was able to set a higher limit and
120
   another call will also succeed
121
   returns 1 if it was able to set a higher limit but 
122
   no further limit possible
123
   returns < 0 otherwise
124
*/
119
static int acpi_thermal_cpufreq_increase(unsigned int cpu)
125
static int acpi_thermal_cpufreq_increase(unsigned int cpu)
120
{
126
{
121
	if (!cpu_has_cpufreq(cpu))
127
	if (!cpu_has_cpufreq(cpu))
Lines 123-136 Link Here
123
129
124
	if (cpufreq_thermal_reduction_pctg[cpu] < 60) {
130
	if (cpufreq_thermal_reduction_pctg[cpu] < 60) {
125
		cpufreq_thermal_reduction_pctg[cpu] += 20;
131
		cpufreq_thermal_reduction_pctg[cpu] += 20;
132
133
		if( cpufreq_thermal_reduction_pctg[cpu] >= 60)
134
                        cpufreq_thermal_reduction_pctg[ cpu ] = 80;
135
	
126
		cpufreq_update_policy(cpu);
136
		cpufreq_update_policy(cpu);
137
138
		if( cpufreq_thermal_reduction_pctg[cpu] >= 60)
139
                        return 1;
127
		return 0;
140
		return 0;
128
	}
141
	}
129
142
130
	return -ERANGE;
143
	return -ERANGE;
131
}
144
}
132
145
133
146
/* returns 0 if it was able to set a higher limit and
147
   another call will also succeed
148
   returns 1 if it was able to set a higher limit but 
149
   no further limit possible
150
   returns < 0 otherwise
151
*/
134
static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
152
static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
135
{
153
{
136
	if (!cpu_has_cpufreq(cpu))
154
	if (!cpu_has_cpufreq(cpu))
Lines 138-145 Link Here
138
156
139
	if (cpufreq_thermal_reduction_pctg[cpu] >= 20) {
157
	if (cpufreq_thermal_reduction_pctg[cpu] >= 20) {
140
		cpufreq_thermal_reduction_pctg[cpu] -= 20;
158
		cpufreq_thermal_reduction_pctg[cpu] -= 20;
159
		if ( cpufreq_thermal_reduction_pctg[cpu] < 20 )
160
                        cpufreq_thermal_reduction_pctg[ cpu ] = 0;
161
141
		cpufreq_update_policy(cpu);
162
		cpufreq_update_policy(cpu);
142
		return 0;
163
164
		if ( cpufreq_thermal_reduction_pctg[cpu] < 20 )
165
                        return 1;
166
 		return 0;
143
	}
167
	}
144
168
145
	return -ERANGE;
169
	return -ERANGE;
Lines 238-243 Link Here
238
	case ACPI_PROCESSOR_LIMIT_NONE:
262
	case ACPI_PROCESSOR_LIMIT_NONE:
239
		do {
263
		do {
240
			result = acpi_thermal_cpufreq_decrease(pr->id);
264
			result = acpi_thermal_cpufreq_decrease(pr->id);
265
                        /* result == 0 means: was able to decrease and further decrease possible */
241
		} while (!result);
266
		} while (!result);
242
		tx = 0;
267
		tx = 0;
243
		break;
268
		break;
Lines 245-253 Link Here
245
	case ACPI_PROCESSOR_LIMIT_INCREMENT:
270
	case ACPI_PROCESSOR_LIMIT_INCREMENT:
246
		/* if going up: P-states first, T-states later */
271
		/* if going up: P-states first, T-states later */
247
272
273
		printk(KERN_INFO "throttling: %d\n", pr->flags.throttling);
248
		result = acpi_thermal_cpufreq_increase(pr->id);
274
		result = acpi_thermal_cpufreq_increase(pr->id);
249
		if (!result)
275
		printk(KERN_INFO "limit_increment: result: %d\n", result);
250
			goto end;
276
		if (result >= 0)
277
			return_VALUE(result);
251
		else if (result == -ERANGE)
278
		else if (result == -ERANGE)
252
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
279
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
253
					"At maximum performance state\n"));
280
					"At maximum performance state\n"));
Lines 263-268 Link Here
263
290
264
	case ACPI_PROCESSOR_LIMIT_DECREMENT:
291
	case ACPI_PROCESSOR_LIMIT_DECREMENT:
265
		/* if going down: T-states first, P-states later */
292
		/* if going down: T-states first, P-states later */
293
		printk(KERN_INFO "throttling: %d\n", pr->flags.throttling);
266
294
267
		if (pr->flags.throttling) {
295
		if (pr->flags.throttling) {
268
			if (tx == 0)
296
			if (tx == 0)
Lines 275-283 Link Here
275
		}
303
		}
276
304
277
		result = acpi_thermal_cpufreq_decrease(pr->id);
305
		result = acpi_thermal_cpufreq_decrease(pr->id);
278
		if (result == -ERANGE)
306
279
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
307
		printk(KERN_INFO "limit_decrement: result: %d\n", result);
280
					"At minimum performance state\n"));
308
		if (result != 0)
309
			printk(KERN_INFO
310
					"At minimum performance state\n");
311
		if ( result )
312
			return_VALUE(result);
281
313
282
		break;
314
		break;
283
	}
315
	}
Lines 295-302 Link Here
295
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n",
327
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n",
296
				  pr->limit.thermal.px,
328
				  pr->limit.thermal.px,
297
				  pr->limit.thermal.tx));
329
				  pr->limit.thermal.tx));
298
	} else
330
	}
299
		result = 0;
331
332
 	printk(KERN_INFO "doing return %d\n", result);
300
333
301
	return_VALUE(result);
334
	return_VALUE(result);
302
}
335
}
(-)thermal.c.orig (-6 / +11 lines)
Lines 535-545 Link Here
535
	 */
535
	 */
536
	if (tz->temperature >= passive->temperature) {
536
	if (tz->temperature >= passive->temperature) {
537
		trend = (passive->tc1 * (tz->temperature - tz->last_temperature)) + (passive->tc2 * (tz->temperature - passive->temperature));
537
		trend = (passive->tc1 * (tz->temperature - tz->last_temperature)) + (passive->tc2 * (tz->temperature - passive->temperature));
538
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
538
		printk(KERN_INFO 
539
			"trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", 
539
			"trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", 
540
			trend, passive->tc1, tz->temperature, 
540
			trend, passive->tc1, tz->temperature, 
541
			tz->last_temperature, passive->tc2, 
541
			tz->last_temperature, passive->tc2, 
542
			tz->temperature, passive->temperature));
542
			tz->temperature, passive->temperature);
543
		tz->trips.passive.flags.enabled = 1;
543
		tz->trips.passive.flags.enabled = 1;
544
		/* Heating up? */
544
		/* Heating up? */
545
		if (trend > 0)
545
		if (trend > 0)
Lines 563-574 Link Here
563
	 * assume symmetry.
563
	 * assume symmetry.
564
	 */
564
	 */
565
	else if (tz->trips.passive.flags.enabled) {
565
	else if (tz->trips.passive.flags.enabled) {
566
		for (i=0; i<passive->devices.count; i++)
566
                int result = 1;
567
			result = acpi_processor_set_thermal_limit(
567
		for (i=0; i<passive->devices.count; i++) {
568
                        int ret = acpi_processor_set_thermal_limit(
568
				passive->devices.handles[i], 
569
				passive->devices.handles[i], 
569
				ACPI_PROCESSOR_LIMIT_DECREMENT);
570
				ACPI_PROCESSOR_LIMIT_DECREMENT);
571
                        result &= ret;
572
                        printk(KERN_INFO "decrementing passive limit, ret: %d result: %d\n", ret, result);
573
                }
570
		if (result == 1) {
574
		if (result == 1) {
571
			tz->trips.passive.flags.enabled = 0;
575
			tz->trips.passive.flags.enabled = 0;
576
			printk(KERN_INFO "disabling passive cooling\n");
572
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
577
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
573
				"Disabling passive cooling (zone is cool)\n"));
578
				"Disabling passive cooling (zone is cool)\n"));
574
		}
579
		}
Lines 744-751 Link Here
744
	else if (tz->polling_frequency > 0)
749
	else if (tz->polling_frequency > 0)
745
		sleep_time = tz->polling_frequency * 100;
750
		sleep_time = tz->polling_frequency * 100;
746
751
747
	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", 
752
	printk(KERN_INFO "%s: temperature[%lu] sleep[%lu] passive state: %d\n", 
748
		tz->name, tz->temperature, sleep_time));
753
		tz->name, tz->temperature, sleep_time,tz->state.passive);
749
754
750
	/*
755
	/*
751
	 * Schedule Next Poll
756
	 * Schedule Next Poll

Return to bug 98178