Exemplo n.º 1
0
static int acpi_thermal_get_info(struct acpi_thermal *tz)
{
	int result = 0;


	if (!tz)
		return -EINVAL;

	/* Get trip points [_CRT, _PSV, etc.] (required) */
	result = acpi_thermal_get_trip_points(tz);
	if (result)
		return result;

	/* Get temperature [_TMP] (required) */
	result = acpi_thermal_get_temperature(tz);
	if (result)
		return result;

	/* Set the cooling mode [_SCP] to active cooling (default) */
	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
	if (!result)
		tz->flags.cooling_mode = 1;

	/* Get default polling frequency [_TZP] (optional) */
	if (tzp)
		tz->polling_frequency = tzp;
	else
		acpi_thermal_get_polling_frequency(tz);

	return 0;
}
Exemplo n.º 2
0
static int
acpi_thermal_write_cooling_mode (
	struct file		*file,
	const char		*buffer,
	unsigned long		count,
	void			*data)
{
	int			result = 0;
	struct acpi_thermal	*tz = (struct acpi_thermal *) data;
	char			mode_string[12] = {'\0'};

	ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode");

	if (!tz || (count > sizeof(mode_string) - 1))
		return_VALUE(-EINVAL);

	if (!tz->flags.cooling_mode)
		return_VALUE(-ENODEV);

	if (copy_from_user(mode_string, buffer, count))
		return_VALUE(-EFAULT);
	
	mode_string[count] = '\0';
	
	result = acpi_thermal_set_cooling_mode(tz, 
		simple_strtoul(mode_string, NULL, 0));
	if (result)
		return_VALUE(result);

	return_VALUE(count);
}
Exemplo n.º 3
0
static int
acpi_thermal_get_info (
	struct acpi_thermal	*tz)
{
	int			result = 0;

	ACPI_FUNCTION_TRACE("acpi_thermal_get_info");

	if (!tz)
		return_VALUE(-EINVAL);

	/* Get temperature [_TMP] (required) */
	result = acpi_thermal_get_temperature(tz);
	if (result)
		return_VALUE(result);

	/* Get trip points [_CRT, _PSV, etc.] (required) */
	result = acpi_thermal_get_trip_points(tz);
	if (result)
		return_VALUE(result);

	/* Set the cooling mode [_SCP] to active cooling (default) */
	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
	if (!result) 
		tz->flags.cooling_mode = 1;
	else { 
		/* Oh,we have not _SCP method.
		   Generally show cooling_mode by _ACx, _PSV,spec 12.2*/
		tz->flags.cooling_mode = 0;
		if ( tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
			if ( tz->trips.passive.temperature > tz->trips.active[0].temperature )
				tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
			else 
				tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
		} else if ( !tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
			tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
		} else if ( tz->trips.active[0].flags.valid && !tz->trips.passive.flags.valid ) {
			tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
		} else {
			/* _ACx and _PSV are optional, but _CRT is required */
			tz->cooling_mode = ACPI_THERMAL_MODE_CRITICAL;
		}
	}

	/* Get default polling frequency [_TZP] (optional) */
	acpi_thermal_get_polling_frequency(tz);

	/* Get devices in this thermal zone [_TZD] (optional) */
	result = acpi_thermal_get_devices(tz);
	if (!result)
		tz->flags.devices = 1;

	return_VALUE(0);
}
Exemplo n.º 4
0
static int
acpi_thermal_get_info (
	struct acpi_thermal	*tz)
{
	int			result = 0;

	ACPI_FUNCTION_TRACE("acpi_thermal_get_info");

	if (!tz)
		return_VALUE(-EINVAL);

	/* Get temperature [_TMP] (required) */
	result = acpi_thermal_get_temperature(tz);
	if (result)
		return_VALUE(result);

	/* Set the cooling mode [_SCP] to active cooling (default) */
	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
	if (!result)
		tz->flags.cooling_mode = 1;

	/* Get trip points [_CRT, _PSV, etc.] (required) */
	result = acpi_thermal_get_trip_points(tz);
	if (result)
		return_VALUE(result);

	/* Get default polling frequency [_TZP] (optional) */
	if (tzp)
		tz->polling_frequency = tzp;
	else
		acpi_thermal_get_polling_frequency(tz);

	/* Get devices in this thermal zone [_TZD] (optional) */
	result = acpi_thermal_get_devices(tz);
	if (!result)
		tz->flags.devices = 1;

	return_VALUE(0);
}