static int exynos4_unbind(struct thermal_zone_device *thermal,
			  struct thermal_cooling_device *cdev)
{
	if (cdev != th_zone->cool_dev)
		return 0;
	if (thermal_zone_unbind_cooling_device(thermal, 0, cdev)) {
		pr_err("error unbinding cooling dev\n");
		return -EINVAL;
	}
	if (thermal_zone_unbind_cooling_device(thermal, 1, cdev)) {
		pr_err("error unbinding cooling dev\n");
		return -EINVAL;
	}
	return 0;
}
예제 #2
0
static int of_thermal_unbind(struct thermal_zone_device *thermal,
			     struct thermal_cooling_device *cdev)
{
	struct __thermal_zone *data = thermal->devdata;
	int i;

	if (!data || IS_ERR(data))
		return -ENODEV;

	/* find where to unbind */
	for (i = 0; i < data->num_tbps; i++) {
		struct __thermal_bind_params *tbp = data->tbps + i;

		if (tbp->cooling_device == cdev->np) {
			int ret;

			ret = thermal_zone_unbind_cooling_device(thermal,
						tbp->trip_id, cdev);
			if (ret)
				return ret;
		}
	}

	return 0;
}
예제 #3
0
/* Unbind callback functions for thermal zone */
static int exynos_unbind(struct thermal_zone_device *thermal,
			struct thermal_cooling_device *cdev)
{
	int ret = 0, i;

	/* find the cooling device registered*/
	for (i = 0; i < th_zone->cool_dev_size; i++)
		if (cdev == th_zone->cool_dev[i])
			break;

	/*No matching cooling device*/
	if (i == th_zone->cool_dev_size)
		return 0;

	switch (GET_ZONE(i)) {
	case MONITOR_ZONE:
	case WARN_ZONE:
	case PANIC_ZONE:
		if (thermal_zone_unbind_cooling_device(thermal, i, cdev)) {
			pr_err("error unbinding cooling dev\n");
			ret = -EINVAL;
		}
		break;
	default:
		ret = -EINVAL;
	}
	return ret;
}
/* thermal framework callbacks */
static int kona_tmon_tz_cdev_bind(struct thermal_zone_device *tz,
		struct thermal_cooling_device *cdev)
{
	struct kona_tmon_thermal *thermal = tz->devdata;
	int idx, level, ret = 0;

	/* check if the cooling device is registered */
	if (thermal->freq_cdev != cdev)
		return 0;

	for (idx = 0; idx < thermal->active_cnt; idx++) {
		level = cpufreq_cooling_get_level(0,
				thermal->pdata->trips[idx].max_freq);

		if (level == THERMAL_CSTATE_INVALID)
			continue;

		ret = thermal_zone_bind_cooling_device(tz, idx,
					cdev, level, 0);
		if (ret) {
			tmon_dbg(TMON_LOG_ERR, "binding colling device (%s) on trip %d: failed\n",
					cdev->type, idx);
			goto err;
		}
	}
	return ret;

err:
	for (; idx >= 0; --idx)
		thermal_zone_unbind_cooling_device(tz, idx, cdev);
	return ret;
}
static int mtkts6311_unbind(struct thermal_zone_device *thermal,
			  struct thermal_cooling_device *cdev)
{
	int table_val=0;

	if(!strcmp(cdev->type, g_bind0))
	{
		table_val = 0;
	}
	else if(!strcmp(cdev->type, g_bind1))
	{
		table_val = 1;
	}
	else if(!strcmp(cdev->type, g_bind2))
	{
		table_val = 2;
	}
	else if(!strcmp(cdev->type, g_bind3))
	{
		table_val = 3;
	}
	else if(!strcmp(cdev->type, g_bind4))
	{
		table_val = 4;
	}
	else if(!strcmp(cdev->type, g_bind5))
	{
		table_val = 5;
	}
	else if(!strcmp(cdev->type, g_bind6))
	{
		table_val = 6;
	}
	else if(!strcmp(cdev->type, g_bind7))
	{
		table_val = 7;
	}
	else if(!strcmp(cdev->type, g_bind8))
	{
		table_val = 8;
	}
	else if(!strcmp(cdev->type, g_bind9))
	{
		table_val = 9;
	}
	else
		return 0;

	if (thermal_zone_unbind_cooling_device(thermal, table_val, cdev)) {
		mtkts6311_dprintk("[mtkts6311_unbind] error unbinding cooling dev\n");
		return -EINVAL;
	} else {
		mtkts6311_dprintk("[mtkts6311_unbind] unbinding OK\n");
	}

	return 0;
}
예제 #6
0
static int therm_fan_est_unbind(struct thermal_zone_device *thz,
				struct thermal_cooling_device *cdev)
{
	int i;
	struct therm_fan_estimator *est = thz->devdata;
	if (!strcmp(cdev->type, est->cdev_type)) {
		for (i = 0; i < MAX_ACTIVE_STATES; i++)
			thermal_zone_unbind_cooling_device(thz, i, cdev);
	}

	return 0;
}
예제 #7
0
static int imx_unbind(struct thermal_zone_device *tz,
		      struct thermal_cooling_device *cdev)
{
	int ret;

	ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
	if (ret) {
		dev_err(&tz->device,
			"unbinding zone %s with cdev %s failed:%d\n",
			tz->type, cdev->type, ret);
		return ret;
	}

	return 0;
}
static int kona_tmon_tz_cdev_unbind(struct thermal_zone_device *tz,
		struct thermal_cooling_device *cdev)
{
	struct kona_tmon_thermal *thermal = tz->devdata;
	int idx, ret = 0;

	for (idx = 0; idx < thermal->active_cnt; idx++) {
		ret = thermal_zone_unbind_cooling_device(tz, idx, cdev);
		if (ret)
			tmon_dbg(TMON_LOG_ERR, "unbinding colling device (%s) on trip %d: failed\n",
					cdev->type, idx);
	}

	return ret;
}
예제 #9
0
static int tmon_loc_unbind(struct thermal_zone_device *thz,
			struct thermal_cooling_device *cdev)
{
	int i;
	struct tmon_info *tmon_data = thz->devdata;
	struct tmon_plat_data *pdata = tmon_data->pdata;

	for (i = 0; i < pdata->num_trips; i++) {
		if (!strcmp(pdata->trips[i].cdev_type, cdev->type) &&
						pdata->trips[i].bound)
			thermal_zone_unbind_cooling_device(thz, i, cdev);
			pdata->trips[i].bound = false;
	}
	return 0;
}
예제 #10
0
static int tsallts_unbind(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev)
{
	int table_val = 0;

	tsallts_dprintk("[tsallts_unbind_ts2]\n");
	if (!strcmp(cdev->type, g_bind0)) {
		table_val = 0;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind1)) {
		table_val = 1;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind2)) {
		table_val = 2;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind3)) {
		table_val = 3;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind4)) {
		table_val = 4;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind5)) {
		table_val = 5;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind6)) {
		table_val = 6;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind7)) {
		table_val = 7;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind8)) {
		table_val = 8;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else if (!strcmp(cdev->type, g_bind9)) {
		table_val = 9;
		tsallts_dprintk("[tsallts_unbind] %s\n", cdev->type);
	} else
		return 0;

	if (thermal_zone_unbind_cooling_device(thermal, table_val, cdev)) {
		tsallts_dprintk("[tsallts_unbind_ts2] error unbinding cooling dev\n");
		return -EINVAL;
	}

	tsallts_dprintk("[tsallts_unbind_ts2] unbinding OK\n");
	return 0;
}
예제 #11
0
static int therm_est_unbind(struct thermal_zone_device *thz,
				struct thermal_cooling_device *cdev)
{
	struct therm_estimator *est = thz->devdata;
	struct thermal_trip_info *trip_state;
	int i;

	for (i = 0; i < est->num_trips; i++) {
		trip_state = &est->trips[i];
		if (trip_state->cdev_type &&
		    !strncmp(trip_state->cdev_type, cdev->type,
			     THERMAL_NAME_LENGTH))
			thermal_zone_unbind_cooling_device(thz, i, cdev);
	}

	return 0;
}
/* Unbind callback functions for thermal zone */
static int amlogic_unbind(struct thermal_zone_device *thermal,
        struct thermal_cooling_device *cdev)
{
    int i;
    if(thermal && cdev){
        struct  amlogic_thermal_platform_data *pdata= thermal->devdata;
        for (i = 0; i < pdata->temp_trip_count; i++) {
            if (thermal_zone_unbind_cooling_device(thermal, i, cdev)) {
                THERMAL_ERR(" error  %d \n", i);
                return -EINVAL;
            }
            return 0;
        }
    }else{
        return -EINVAL;
    }
    return -EINVAL;
}
예제 #13
0
/* Callback to unbind cooling device from thermal zone */
static int db8500_cdev_unbind(struct thermal_zone_device *thermal,
		struct thermal_cooling_device *cdev)
{
	struct db8500_thermal_zone *pzone = thermal->devdata;
	struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
	int i, ret = -EINVAL;

	for (i = 0; i < ptrips->num_trips; i++) {
		if (db8500_thermal_match_cdev(cdev, &ptrips->trip_points[i]))
			continue;

		ret = thermal_zone_unbind_cooling_device(thermal, i, cdev);

		dev_info(&cdev->device, "%s unbind from %d: %s\n", cdev->type,
			i, ret ? "fail" : "succeed");
	}

	return ret;
}
/* Unbind callback functions for thermal zone */
static int exynos_unbind(struct thermal_zone_device *thermal,
			struct thermal_cooling_device *cdev)
{
	int ret = 0, i, tab_size;
	struct exynos_thermal_zone *th_zone = thermal->devdata;
	struct thermal_sensor_conf *data = th_zone->sensor_conf;

	if (th_zone->bind == false)
		return 0;

	tab_size = data->cooling_data.freq_clip_count;

	if (tab_size == 0)
		return 0;

	/* find the cooling device registered*/
	for (i = 0; i < th_zone->cool_dev_size; i++)
		if (cdev == th_zone->cool_dev[i])
			break;

	/* No matching cooling device */
	if (i == th_zone->cool_dev_size)
		return 0;

	/* Bind the thermal zone to the cpufreq cooling device */
	for (i = 0; i < tab_size; i++) {
		switch (GET_ZONE(i)) {
		case MONITOR_ZONE:
		case WARN_ZONE:
			if (thermal_zone_unbind_cooling_device(thermal, i,
								cdev)) {
				dev_err(data->dev,
					"error unbinding cdev inst=%d\n", i);
				ret = -EINVAL;
			}
			th_zone->bind = false;
			break;
		default:
			ret = -EINVAL;
		}
	}
	return ret;
}
/* Unbind callback functions for thermal zone */
static int amlogic_unbind(struct thermal_zone_device *thermal,
			struct thermal_cooling_device *cdev)
{
	int i;
	if(thermal && cdev){
		struct  amlogic_thermal_platform_data *pdata= thermal->devdata;
		for (i = 0; i < pdata->temp_trip_count; i++) {
			pr_info("\n%s unbinding %s ",thermal->type,cdev->type);
			if (thermal_zone_unbind_cooling_device(thermal, i, cdev)) {
				pr_err(" error  %d \n", i);
				return -EINVAL;
			}
			pr_info(" okay\n");
			return 0;
		}
	}else{
		return -EINVAL;
	}
	return -EINVAL;
}
static int mtktscpu_unbind(struct thermal_zone_device *thermal,
						struct thermal_cooling_device *cdev)
{
	int table_val=0;
	table_val = mtkts_match(cdev,g_bind);
	if(table_val > 9 ) 
	{
		return 0;
	}
	else
	{
		mtktscpu_dprintk("[mtktscpu_unbind] %s\n", cdev->type);	
		if (thermal_zone_unbind_cooling_device(thermal, table_val, cdev)) {
			mtktscpu_dprintk("[mtktscpu_unbind] error unbinding cooling dev\n");
			return -EINVAL;
		} else {
			mtktscpu_dprintk("[mtktscpu_unbind] unbinding OK, %d\n", table_val);
		}	
	}
	return 0;  
}
예제 #17
0
static int mtktspmic_unbind(struct thermal_zone_device *thermal,
			  struct thermal_cooling_device *cdev)
{
    int table_val=0;

    if (cdev == cl_dev_500)
        table_val= 2;
    else if (cdev == cl_dev_250)
        table_val= 1;
    else if (cdev == cl_dev_166)
        table_val= 0;
    else
        return 0;
    
    if (thermal_zone_unbind_cooling_device(thermal, table_val, cdev)) {
	    mtktspmic_dprintk("[mtktspmic_unbind] error unbinding cooling dev\n");
		return -EINVAL;
	} else {
	    mtktspmic_dprintk("[mtktspmic_unbind] unbinding OK\n");
    }

	return 0;
}
예제 #18
0
/* Bind callback functions for thermal zone */
static int exynos4_bind(struct thermal_zone_device *thermal,
			struct thermal_cooling_device *cdev)
{
	int ret = 0;

	/* if the cooling device is the one from exynos4 bind it */
	if (cdev != th_zone->cool_dev[0])
		return 0;

	if (thermal_zone_bind_cooling_device(thermal, 0, cdev)) {
		pr_err("error binding cooling dev inst 0\n");
		return -EINVAL;
	}
	if (thermal_zone_bind_cooling_device(thermal, 1, cdev)) {
		pr_err("error binding cooling dev inst 1\n");
		ret = -EINVAL;
		goto error_bind1;
	}

	return ret;
error_bind1:
	thermal_zone_unbind_cooling_device(thermal, 0, cdev);
	return ret;
}
예제 #19
0
static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
					struct thermal_cooling_device *cdev,
					bool bind)
{
	struct acpi_device *device = cdev->devdata;
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_device *dev;
	acpi_status status;
	acpi_handle handle;
	int i;
	int j;
	int trip = -1;
	int result = 0;

	if (tz->trips.critical.flags.valid)
		trip++;

	if (tz->trips.hot.flags.valid)
		trip++;

	if (tz->trips.passive.flags.valid) {
		trip++;
		for (i = 0; i < tz->trips.passive.devices.count;
		    i++) {
			handle = tz->trips.passive.devices.handles[i];
			status = acpi_bus_get_device(handle, &dev);
			if (ACPI_FAILURE(status) || dev != device)
				continue;
			if (bind)
				result =
					thermal_zone_bind_cooling_device
					(thermal, trip, cdev,
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
					 THERMAL_WEIGHT_DEFAULT);
			else
				result =
					thermal_zone_unbind_cooling_device
					(thermal, trip, cdev);
			if (result)
				goto failed;
		}
	}

	for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
		if (!tz->trips.active[i].flags.valid)
			break;
		trip++;
		for (j = 0;
		    j < tz->trips.active[i].devices.count;
		    j++) {
			handle = tz->trips.active[i].devices.handles[j];
			status = acpi_bus_get_device(handle, &dev);
			if (ACPI_FAILURE(status) || dev != device)
				continue;
			if (bind)
				result = thermal_zone_bind_cooling_device
					(thermal, trip, cdev,
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
					 THERMAL_WEIGHT_DEFAULT);
			else
				result = thermal_zone_unbind_cooling_device
					(thermal, trip, cdev);
			if (result)
				goto failed;
		}
	}

	for (i = 0; i < tz->devices.count; i++) {
		handle = tz->devices.handles[i];
		status = acpi_bus_get_device(handle, &dev);
		if (ACPI_SUCCESS(status) && (dev == device)) {
			if (bind)
				result = thermal_zone_bind_cooling_device
						(thermal, THERMAL_TRIPS_NONE,
						 cdev, THERMAL_NO_LIMIT,
						 THERMAL_NO_LIMIT,
						 THERMAL_WEIGHT_DEFAULT);
			else
				result = thermal_zone_unbind_cooling_device
						(thermal, THERMAL_TRIPS_NONE,
						 cdev);
			if (result)
				goto failed;
		}
	}

failed:
	return result;
}
static int ntc6290_unbind(struct thermal_zone_device *thermal,
        struct thermal_cooling_device *cdev)
{
	int table_val=0;

	if(!strcmp(cdev->type, ntc6290_bind0))
	{
		table_val = 0;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind1))
	{
		table_val = 1;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind2))
	{
		table_val = 2;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind3))
	{
		table_val = 3;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind4))
	{
		table_val = 4;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind5))
	{
		table_val = 5;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind6))
	{
		table_val = 6;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind7))
	{
		table_val = 7;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind8))
	{
		table_val = 8;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else if(!strcmp(cdev->type, ntc6290_bind9))
	{
		table_val = 9;
		mtktspa_dprintk("[%s] %s\n", __func__, cdev->type);
	}
	else
		return 0;

	if (thermal_zone_unbind_cooling_device(thermal, table_val, cdev)) 
	{
		mtktspa_dprintk("[%s] error unbinding cooling dev\n", __func__);
		return -EINVAL;
	} 
	else 
	{
		mtktspa_dprintk("[%s] unbinding OK\n", __func__);
	}

	return 0;
}