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

(-)drivers/acpi/thermal.c.orig (-5 / +23 lines)
Lines 519-525 Link Here
519
	int			result = 0;
519
	int			result = 0;
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, ret;
523
523
524
	ACPI_FUNCTION_TRACE("acpi_thermal_passive");
524
	ACPI_FUNCTION_TRACE("acpi_thermal_passive");
525
525
Lines 565-574 Link Here
565
	 * assume symmetry.
565
	 * assume symmetry.
566
	 */
566
	 */
567
	else if (tz->trips.passive.flags.enabled) {
567
	else if (tz->trips.passive.flags.enabled) {
568
		for (i=0; i<passive->devices.count; i++)
568
		result = 1;
569
			result = acpi_processor_set_thermal_limit(
569
		for (i=0; i<passive->devices.count; i++) {
570
			ret = acpi_processor_set_thermal_limit(
570
				passive->devices.handles[i], 
571
				passive->devices.handles[i], 
571
				ACPI_PROCESSOR_LIMIT_DECREMENT);
572
				ACPI_PROCESSOR_LIMIT_DECREMENT);
573
			if(ret < 0) {
574
				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
575
					"Can't use passive device 0x%x to set thermal limit\n",
576
					passive->devices.handles[i]));
577
			} else
578
				result &= ret;
579
		}
572
		if (result == 1) {
580
		if (result == 1) {
573
			tz->trips.passive.flags.enabled = 0;
581
			tz->trips.passive.flags.enabled = 0;
574
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
582
			ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
Lines 724-736 Link Here
724
	 */
732
	 */
725
	if (tz->trips.critical.flags.enabled)
733
	if (tz->trips.critical.flags.enabled)
726
		tz->state.critical = 1;
734
		tz->state.critical = 1;
735
	else
736
		tz->state.critical = 0;
727
	if (tz->trips.hot.flags.enabled)
737
	if (tz->trips.hot.flags.enabled)
728
		tz->state.hot = 1;
738
		tz->state.hot = 1;
739
	else
740
		tz->state.hot = 0;
729
	if (tz->trips.passive.flags.enabled)
741
	if (tz->trips.passive.flags.enabled)
730
		tz->state.passive = 1;
742
		tz->state.passive = 1;
743
	else
744
		tz->state.passive = 0;
731
	for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
745
	for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
732
		if (tz->trips.active[i].flags.enabled)
746
		if (tz->trips.active[i].flags.enabled) {
733
			tz->state.active = 1;
747
			tz->state.active = 1; break; 
748
		}
749
	if ( i == ACPI_THERMAL_MAX_ACTIVE )
750
		tz->state.active = 0;
751
	
734
752
735
	/*
753
	/*
736
	 * Calculate Sleep Time
754
	 * Calculate Sleep Time
(-)drivers/acpi/processor_thermal.c.orig (-4 / +25 lines)
Lines 199-205 Link Here
199
199
200
#endif
200
#endif
201
201
202
202
/**
203
 *  acpi_processor_set_thermal_limit -
204
 *	@handle: device handler	
205
 *	@type: limit inc/dec
206
 *  
207
 *  routine returns 0 when setting limit successfully, especial
208
 *  return value 1 tells thermal module that minimum state is reached,
209
 *  so we can leave passive thermal mode.
210
 */
203
int
211
int
204
acpi_processor_set_thermal_limit (
212
acpi_processor_set_thermal_limit (
205
	acpi_handle		handle,
213
	acpi_handle		handle,
Lines 249-275 Link Here
249
257
250
		result = acpi_thermal_cpufreq_increase(pr->id);
258
		result = acpi_thermal_cpufreq_increase(pr->id);
251
		if (!result)
259
		if (!result)
260
			// Handle error case properly, we need to return
261
			// 1 if we are at max freq/thrott again
252
			goto end;
262
			goto end;
253
		else if (result == -ERANGE)
263
264
		else if (result == -ERANGE){
254
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
265
			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
255
					"At maximum performance state\n"));
266
					"At maximum performance state\n"));
267
			result = 1;
268
		}
256
269
257
		if (pr->flags.throttling) {
270
		if (pr->flags.throttling) {
258
			if (tx == (pr->throttling.state_count - 1))
271
			if (tx == (pr->throttling.state_count - 1))
259
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
272
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
260
					"At maximum throttling state\n"));
273
					"At maximum throttling state\n"));
261
			else
274
			else{
262
				tx++;
275
				tx++;
276
				result = 0;
277
			}
263
		}
278
		}
279
		// TX and PX are at maximum again.
280
		// Tell invoking func -> we can leave passive cooling mode now
281
		if (result)
282
			return_VALUE(1);
283
264
		break;
284
		break;
265
285
266
	case ACPI_PROCESSOR_LIMIT_DECREMENT:
286
	case ACPI_PROCESSOR_LIMIT_DECREMENT:
267
		/* if going down: T-states first, P-states later */
287
		/* if going down: T-states first, P-states later */
268
288
269
		if (pr->flags.throttling) {
289
		if (pr->flags.throttling) {
270
			if (tx == 0)
290
			if (tx == 0) {
271
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
291
				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
272
					"At minimum throttling state\n"));
292
					"At minimum throttling state\n"));
293
			}
273
			else {
294
			else {
274
				tx--;
295
				tx--;
275
				goto end;
296
				goto end;

Return to bug 98178