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

(-)x/drivers/acpi/processor_thermal.c.orig (-6 / +18 lines)
Lines 139-147 Link Here
139
	if (cpufreq_thermal_reduction_pctg[cpu] >= 20) {
139
	if (cpufreq_thermal_reduction_pctg[cpu] >= 20) {
140
		cpufreq_thermal_reduction_pctg[cpu] -= 20;
140
		cpufreq_thermal_reduction_pctg[cpu] -= 20;
141
		cpufreq_update_policy(cpu);
141
		cpufreq_update_policy(cpu);
142
		// We reached max freq again and can leave passive mode
143
		if (cpufreq_thermal_reduction_pctg[cpu] == 0)
144
			return 1;
142
		return 0;
145
		return 0;
143
	}
146
	}
144
145
	return -ERANGE;
147
	return -ERANGE;
146
}
148
}
147
149
Lines 206-212 Link Here
206
	int			result = 0;
208
	int			result = 0;
207
	struct acpi_processor	*pr = NULL;
209
	struct acpi_processor	*pr = NULL;
208
	struct acpi_device	*device = NULL;
210
	struct acpi_device	*device = NULL;
209
	int			tx = 0;
211
	int			tx = 0, max_tx_px = 0;
210
212
211
	ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit");
213
	ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit");
212
214
Lines 265-273 Link Here
265
		/* if going down: T-states first, P-states later */
267
		/* if going down: T-states first, P-states later */
266
268
267
		if (pr->flags.throttling) {
269
		if (pr->flags.throttling) {
268
			if (tx == 0)
270
			if (tx == 0){
271
				max_tx_px = 1;
269
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
272
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
270
					"At minimum throttling state\n"));
273
					"At minimum throttling state\n"));
274
			}
271
			else {
275
			else {
272
				tx--;
276
				tx--;
273
				goto end;
277
				goto end;
Lines 275-284 Link Here
275
		}
279
		}
276
280
277
		result = acpi_thermal_cpufreq_decrease(pr->id);
281
		result = acpi_thermal_cpufreq_decrease(pr->id);
278
		if (result == -ERANGE)
282
		if (result){
283
			// We only could get -ERANGE, 1 or 0.
284
			// In the first two cases we reached max freq again.
279
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
285
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
280
					"At minimum performance state\n"));
286
					"At minimum performance state\n"));
281
287
			max_tx_px = 1;
288
		}
289
		else
290
			max_tx_px = 0;
282
		break;
291
		break;
283
	}
292
	}
284
293
Lines 298-304 Link Here
298
	} else
307
	} else
299
		result = 0;
308
		result = 0;
300
309
301
	return_VALUE(result);
310
	if (max_tx_px)
311
		return_VALUE(1);
312
	else
313
		return_VALUE(result);
302
}
314
}
303
315
304
316
(-)x/drivers/acpi/thermal.c.orig (-19 / +29 lines)
Lines 516-522 Link Here
516
acpi_thermal_passive (
516
acpi_thermal_passive (
517
	struct acpi_thermal	*tz)
517
	struct acpi_thermal	*tz)
518
{
518
{
519
	int			result = 0;
519
	int			result = 1;
520
	struct acpi_thermal_passive *passive = NULL;
520
	struct acpi_thermal_passive *passive = NULL;
521
	int			trend = 0;
521
	int			trend = 0;
522
	int			i = 0;
522
	int			i = 0;
Lines 542-548 Link Here
542
			trend, passive->tc1, tz->temperature, 
542
			trend, passive->tc1, tz->temperature, 
543
			tz->last_temperature, passive->tc2, 
543
			tz->last_temperature, passive->tc2, 
544
			tz->temperature, passive->temperature));
544
			tz->temperature, passive->temperature));
545
		tz->trips.passive.flags.enabled = 1;
545
		passive->flags.enabled = 1;
546
		/* Heating up? */
546
		/* Heating up? */
547
		if (trend > 0)
547
		if (trend > 0)
548
			for (i=0; i<passive->devices.count; i++)
548
			for (i=0; i<passive->devices.count; i++)
Lines 552-560 Link Here
552
		/* Cooling off? */
552
		/* Cooling off? */
553
		else if (trend < 0)
553
		else if (trend < 0)
554
			for (i=0; i<passive->devices.count; i++)
554
			for (i=0; i<passive->devices.count; i++)
555
				acpi_processor_set_thermal_limit(
555
				// assume that we are on highest freq/lowest thrott
556
					passive->devices.handles[i], 
556
				// and can leave passive mode, even in error case
557
					ACPI_PROCESSOR_LIMIT_DECREMENT);
557
				if (!acpi_processor_set_thermal_limit(
558
					    passive->devices.handles[i], 
559
					    ACPI_PROCESSOR_LIMIT_DECREMENT))
560
					result = 0;
561
		// Leave cooling mode, even we the temp might higher than trip point.
562
		// This is because some machines might have long thermal polling frequencies
563
		// (tsp) defined. We will fall back into passive mode in next cycle (probably quicker)
564
		if (result){
565
			passive->flags.enabled = 0;
566
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
567
				"Disabling passive cooling, still above threshold, but we cooled down\n"));
568
		}
558
	}
569
	}
559
570
560
	/*
571
	/*
Lines 564-576 Link Here
564
	 * and avoid thrashing around the passive trip point.  Note that we
575
	 * and avoid thrashing around the passive trip point.  Note that we
565
	 * assume symmetry.
576
	 * assume symmetry.
566
	 */
577
	 */
567
	else if (tz->trips.passive.flags.enabled) {
578
	else if (passive->flags.enabled) {
568
		for (i=0; i<passive->devices.count; i++)
579
		for (i=0; i<passive->devices.count; i++)
569
			result = acpi_processor_set_thermal_limit(
580
			if (!acpi_processor_set_thermal_limit(
570
				passive->devices.handles[i], 
581
				    passive->devices.handles[i], 
571
				ACPI_PROCESSOR_LIMIT_DECREMENT);
582
				    ACPI_PROCESSOR_LIMIT_DECREMENT))
572
		if (result == 1) {
583
				result = 0;
573
			tz->trips.passive.flags.enabled = 0;
584
		if (result) {
585
			passive->flags.enabled = 0;
574
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
586
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
575
				"Disabling passive cooling (zone is cool)\n"));
587
				"Disabling passive cooling (zone is cool)\n"));
576
		}
588
		}
Lines 722-736 Link Here
722
	 * Again, separated from the above two to allow independent policy
734
	 * Again, separated from the above two to allow independent policy
723
	 * decisions.
735
	 * decisions.
724
	 */
736
	 */
725
	if (tz->trips.critical.flags.enabled)
737
	tz->state.critical = tz->trips.critical.flags.enabled;
726
		tz->state.critical = 1;
738
	tz->state.hot = tz->trips.hot.flags.enabled;
727
	if (tz->trips.hot.flags.enabled)
739
	tz->state.passive = tz->trips.passive.flags.enabled;
728
		tz->state.hot = 1;
740
	tz->state.active = 0;
729
	if (tz->trips.passive.flags.enabled)
730
		tz->state.passive = 1;
731
	for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
741
	for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
732
		if (tz->trips.active[i].flags.enabled)
742
		tz->state.active |= tz->trips.active[i].flags.enabled;
733
			tz->state.active = 1;
743
			
734
744
735
	/*
745
	/*
736
	 * Calculate Sleep Time
746
	 * Calculate Sleep Time

Return to bug 98178