long etemp;
struct thermal_cooling_device *passive_cdev;
- struct thermal_cooling_device *active_cdev[NCT1008_MAX_ACTIVE];
+ struct thermal_cooling_device *active_cdev;
struct thermal_zone_device *nct_int;
struct thermal_zone_device *nct_ext;
};
high_temp = trip_temp;
if ((trip_temp < temp) && (trip_temp > low_temp)) {
- cdev = count ? &data->plat_data.active[count - 1] :
+ cdev = count ? &data->plat_data.active :
&data->plat_data.passive;
low_temp = trip_temp - cdev->hysteresis;
}
THERMAL_NO_LIMIT,
THERMAL_NO_LIMIT);
- for (i = 0; data->active_cdev[i]; i++)
- if (cdev == data->active_cdev[i])
- return thermal_zone_bind_cooling_device(thz, i+1, cdev,
- THERMAL_NO_LIMIT,
- THERMAL_NO_LIMIT);
+ if (cdev == data->active_cdev)
+ for (i = 0; i < data->plat_data.active.states[i].trip_temp; i++)
+ thermal_zone_bind_cooling_device(thz, i+1, cdev,
+ data->plat_data.active.states[i].state,
+ data->plat_data.active.states[i].state);
return 0;
}
if (cdev == data->passive_cdev)
return thermal_zone_unbind_cooling_device(thz, 0, cdev);
- for (i = 0; data->active_cdev[i]; i++)
- if (cdev == data->active_cdev[i])
- return thermal_zone_unbind_cooling_device(thz,
- i+1, cdev);
+ if (cdev == data->active_cdev)
+ for (i = 0; i < data->plat_data.active.states[i].trip_temp; i++)
+ thermal_zone_unbind_cooling_device(thz, i+1, cdev);
return 0;
}
if (trip == 0)
*temp = data->plat_data.passive.trip_temp;
else
- *temp = data->plat_data.active[trip-1].trip_temp;
+ *temp = data->plat_data.active.states[trip-1].trip_temp;
return 0;
}
if (trip == 0)
data->plat_data.passive.trip_temp = temp;
else
- data->plat_data.active[trip-1].trip_temp = temp;
+ data->plat_data.active.states[trip-1].trip_temp = temp;
nct1008_update(data);
num_trips++;
}
- for (i = 0; data->plat_data.active[i].create_cdev; i++) {
- data->active_cdev[i] = data->plat_data.active[i].create_cdev(
- data->plat_data.active[i].cdev_data);
- mask |= (1 << num_trips);
- num_trips++;
+ if (data->plat_data.active.create_cdev) {
+ data->active_cdev = data->plat_data.active.create_cdev(NULL);
+ for (i = 0; data->plat_data.active.states[i].trip_temp; i++) {
+ mask |= (1 << num_trips);
+ num_trips++;
+ }
}
data->nct_int = thermal_zone_device_register("nct_int",
enum nct1008_chip { NCT1008, NCT72 };
+
+struct active_temp_state {
+ long trip_temp;
+ unsigned long state;
+};
+
+#define MAX_ACTIVE_TEMP_STATE 16
+
struct nct1008_cdev {
struct thermal_cooling_device *(*create_cdev)(void *);
void *cdev_data;
int tc1;
int tc2;
int passive_delay;
+ struct active_temp_state states[MAX_ACTIVE_TEMP_STATE];
};
-#define NCT1008_MAX_ACTIVE (16)
-
struct nct1008_platform_data {
bool supported_hwrev;
bool ext_range;
s8 shutdown_local_limit;
struct nct1008_cdev passive;
- struct nct1008_cdev active[NCT1008_MAX_ACTIVE];
+ struct nct1008_cdev active;
};
#endif /* _LINUX_NCT1008_H */