forked from rubenslte/android_kernel_samsung_msm8226
Merge "thermal-sys: Fix to send correct trip type to get trip temperature"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
393ee6aebc
@@ -92,13 +92,43 @@ int sensor_get_id(char *name)
|
||||
}
|
||||
EXPORT_SYMBOL(sensor_get_id);
|
||||
|
||||
static void init_sensor_trip(struct sensor_info *sensor)
|
||||
{
|
||||
int ret = 0, i = 0;
|
||||
enum thermal_trip_type type;
|
||||
|
||||
for (i = 0; ((sensor->max_idx == -1) ||
|
||||
(sensor->min_idx == -1)) &&
|
||||
(sensor->tz->ops->get_trip_type) &&
|
||||
(i < sensor->tz->trips); i++) {
|
||||
|
||||
sensor->tz->ops->get_trip_type(sensor->tz, i, &type);
|
||||
if (type == THERMAL_TRIP_CONFIGURABLE_HI)
|
||||
sensor->max_idx = i;
|
||||
if (type == THERMAL_TRIP_CONFIGURABLE_LOW)
|
||||
sensor->min_idx = i;
|
||||
type = 0;
|
||||
}
|
||||
|
||||
ret = sensor->tz->ops->get_trip_temp(sensor->tz,
|
||||
sensor->min_idx, &sensor->threshold_min);
|
||||
if (ret)
|
||||
pr_err("Unable to get MIN trip temp. sensor:%d err:%d\n",
|
||||
sensor->sensor_id, ret);
|
||||
|
||||
ret = sensor->tz->ops->get_trip_temp(sensor->tz,
|
||||
sensor->max_idx, &sensor->threshold_max);
|
||||
if (ret)
|
||||
pr_err("Unable to get MAX trip temp. sensor:%d err:%d\n",
|
||||
sensor->sensor_id, ret);
|
||||
}
|
||||
|
||||
static int __update_sensor_thresholds(struct sensor_info *sensor)
|
||||
{
|
||||
long max_of_low_thresh = LONG_MIN;
|
||||
long min_of_high_thresh = LONG_MAX;
|
||||
struct sensor_threshold *pos, *var;
|
||||
enum thermal_trip_type type;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!sensor->tz->ops->set_trip_temp ||
|
||||
!sensor->tz->ops->activate_trip_type ||
|
||||
@@ -108,19 +138,8 @@ static int __update_sensor_thresholds(struct sensor_info *sensor)
|
||||
goto update_done;
|
||||
}
|
||||
|
||||
for (i = 0; ((sensor->max_idx == -1) || (sensor->min_idx == -1)) &&
|
||||
(sensor->tz->ops->get_trip_type) && (i < sensor->tz->trips);
|
||||
i++) {
|
||||
sensor->tz->ops->get_trip_type(sensor->tz, i, &type);
|
||||
if (type == THERMAL_TRIP_CONFIGURABLE_HI)
|
||||
sensor->max_idx = i;
|
||||
if (type == THERMAL_TRIP_CONFIGURABLE_LOW)
|
||||
sensor->min_idx = i;
|
||||
sensor->tz->ops->get_trip_temp(sensor->tz,
|
||||
THERMAL_TRIP_CONFIGURABLE_LOW, &sensor->threshold_min);
|
||||
sensor->tz->ops->get_trip_temp(sensor->tz,
|
||||
THERMAL_TRIP_CONFIGURABLE_HI, &sensor->threshold_max);
|
||||
}
|
||||
if ((sensor->max_idx == -1) || (sensor->min_idx == -1))
|
||||
init_sensor_trip(sensor);
|
||||
|
||||
list_for_each_entry_safe(pos, var, &sensor->threshold_list, list) {
|
||||
if (!pos->active)
|
||||
@@ -368,7 +387,7 @@ int sensor_init(struct thermal_zone_device *tz)
|
||||
|
||||
sensor->sensor_id = tz->id;
|
||||
sensor->tz = tz;
|
||||
sensor->threshold_min = 0;
|
||||
sensor->threshold_min = LONG_MIN;
|
||||
sensor->threshold_max = LONG_MAX;
|
||||
sensor->max_idx = -1;
|
||||
sensor->min_idx = -1;
|
||||
|
||||
Reference in New Issue
Block a user