return 0;
}
+static int
+of_thermal_get_trip_ctrl_alg_flag(struct thermal_zone_device *tz,int trip,
+ enum thermal_trip_ctrl_alg *flag)
+{
+ struct __thermal_zone *data = tz->devdata;
+
+ if (trip >= data->ntrips || trip < 0)
+ return -EDOM;
+
+ *flag = data->trips[trip].alg_flag;
+
+ return 0;
+}
+
static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
int *temp)
{
.set_mode = of_thermal_set_mode,
.get_trip_type = of_thermal_get_trip_type,
+ .get_trip_ctrl_alg_flag = of_thermal_get_trip_ctrl_alg_flag,
.get_trip_temp = of_thermal_get_trip_temp,
.set_trip_temp = of_thermal_set_trip_temp,
.get_trip_hyst = of_thermal_get_trip_hyst,
return ret;
}
+ ret = of_property_read_u32(np, "ctrl-alg", &prop);
+ if (ret < 0) {
+ trip->alg_flag = THERMAL_TRIP_CTRL_ALG_NONE;
+ } else {
+ trip->alg_flag = (enum thermal_trip_ctrl_alg) prop;
+ }
+
/* Required for cooling map matching */
trip->np = np;
of_node_get(np);
THERMAL_TRIP_CRITICAL,
};
+enum thermal_trip_ctrl_alg {
+ THERMAL_TRIP_CTRL_ALG_NONE = 0,
+ THERMAL_TRIP_CTRL_ALG_SWITCH_ON = 1,
+ THERMAL_TRIP_CTRL_ALG_DESIRED = 2,
+};
+
enum thermal_trend {
THERMAL_TREND_STABLE, /* temperature is stable */
THERMAL_TREND_RAISING, /* temperature is raising */
enum thermal_device_mode);
int (*get_trip_type) (struct thermal_zone_device *, int,
enum thermal_trip_type *);
+ int (*get_trip_ctrl_alg_flag) (struct thermal_zone_device *, int,
+ enum thermal_trip_ctrl_alg *);
int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
int (*set_trip_temp) (struct thermal_zone_device *, int, int);
int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
int temperature;
int hysteresis;
enum thermal_trip_type type;
+ enum thermal_trip_ctrl_alg alg_flag;
};
/* Function declarations */