Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52426201 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: thermal: Evaluate based on trip temperature"

parents 96bbd608 bae93a61
Loading
Loading
Loading
Loading
+32 −7
Original line number Diff line number Diff line
@@ -578,12 +578,8 @@ int of_thermal_aggregate_trip(struct thermal_zone_device *tz,
}
EXPORT_SYMBOL(of_thermal_aggregate_trip);

/*
 * of_thermal_handle_trip - Handle thermal trip from sensors
 *
 * @tz: pointer to the primary thermal zone.
 */
void of_thermal_handle_trip(struct thermal_zone_device *tz)
static void handle_thermal_trip(struct thermal_zone_device *tz,
		bool temp_valid, int trip_temp)
{
	struct thermal_zone_device *zone;
	struct __thermal_zone *data = tz->devdata;
@@ -594,8 +590,37 @@ void of_thermal_handle_trip(struct thermal_zone_device *tz)
		zone = data->tzd;
		if (data->mode == THERMAL_DEVICE_DISABLED)
			continue;
		thermal_zone_device_update(zone, THERMAL_EVENT_UNSPECIFIED);
		if (!temp_valid) {
			thermal_zone_device_update(zone,
				THERMAL_EVENT_UNSPECIFIED);
		} else {
			thermal_zone_device_update_temp(zone,
				THERMAL_EVENT_UNSPECIFIED, trip_temp);
		}
	}
}

/*
 * of_thermal_handle_trip_temp - Handle thermal trip from sensors
 *
 * @tz: pointer to the primary thermal zone.
 * @trip_temp: The temperature
 */
void of_thermal_handle_trip_temp(struct thermal_zone_device *tz,
		int trip_temp)
{
	return handle_thermal_trip(tz, true, trip_temp);
}
EXPORT_SYMBOL(of_thermal_handle_trip_temp);

/*
 * of_thermal_handle_trip - Handle thermal trip from sensors
 *
 * @tz: pointer to the primary thermal zone.
 */
void of_thermal_handle_trip(struct thermal_zone_device *tz)
{
	return handle_thermal_trip(tz, false, 0);
}
EXPORT_SYMBOL(of_thermal_handle_trip);

+37 −13
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
	}
}

void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
{
	enum thermal_trip_type type;

@@ -576,19 +576,8 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz)
}
EXPORT_SYMBOL_GPL(thermal_zone_set_trips);

static void update_temperature(struct thermal_zone_device *tz)
static void store_temperature(struct thermal_zone_device *tz, int temp)
{
	int temp, ret;

	ret = thermal_zone_get_temp(tz, &temp);
	if (ret) {
		if (ret != -EAGAIN)
			dev_warn(&tz->device,
				 "failed to read out thermal zone (%d)\n",
				 ret);
		return;
	}

	mutex_lock(&tz->lock);
	tz->last_temperature = tz->temperature;
	tz->temperature = temp;
@@ -604,6 +593,21 @@ static void update_temperature(struct thermal_zone_device *tz)
			tz->last_temperature, tz->temperature);
}

static void update_temperature(struct thermal_zone_device *tz)
{
	int temp, ret;

	ret = thermal_zone_get_temp(tz, &temp);
	if (ret) {
		if (ret != -EAGAIN)
			dev_warn(&tz->device,
				 "failed to read out thermal zone (%d)\n",
				 ret);
		return;
	}
	store_temperature(tz, temp);
}

static void thermal_zone_device_reset(struct thermal_zone_device *tz)
{
	struct thermal_instance *pos;
@@ -614,6 +618,26 @@ static void thermal_zone_device_reset(struct thermal_zone_device *tz)
		pos->initialized = false;
}

void thermal_zone_device_update_temp(struct thermal_zone_device *tz,
				enum thermal_notify_event event, int temp)
{
	int count;

	if (atomic_read(&in_suspend))
		return;

	trace_thermal_device_update(tz, event);
	store_temperature(tz, temp);

	thermal_zone_set_trips(tz);

	tz->notify_event = event;

	for (count = 0; count < tz->trips; count++)
		handle_thermal_trip(tz, count);
}
EXPORT_SYMBOL(thermal_zone_device_update_temp);

void thermal_zone_device_update(struct thermal_zone_device *tz,
				enum thermal_notify_event event)
{
+6 −1
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ struct thermal_instance {

int thermal_register_governor(struct thermal_governor *);
void thermal_unregister_governor(struct thermal_governor *);
void handle_thermal_trip(struct thermal_zone_device *tz, int trip);

#ifdef CONFIG_THERMAL_GOV_STEP_WISE
int thermal_gov_step_wise_register(void);
@@ -122,6 +121,8 @@ int of_thermal_aggregate_trip(struct thermal_zone_device *tz,
			      enum thermal_trip_type type,
			      int *low, int *high);
void of_thermal_handle_trip(struct thermal_zone_device *tz);
void of_thermal_handle_trip_temp(struct thermal_zone_device *tz,
					int trip_temp);
#else
static inline int of_parse_thermal_zones(void) { return 0; }
static inline void of_thermal_destroy_zones(void) { }
@@ -148,6 +149,10 @@ static inline int of_thermal_aggregate_trip(struct thermal_zone_device *tz,
static inline
void of_thermal_handle_trip(struct thermal_zone_device *tz)
{ }
static inline
void of_thermal_handle_trip_temp(struct thermal_zone_device *tz,
					int trip_temp)
{ }
#endif

#endif /* __THERMAL_CORE_H__ */
+6 −0
Original line number Diff line number Diff line
@@ -531,6 +531,8 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
				       struct thermal_cooling_device *);
void thermal_zone_device_update(struct thermal_zone_device *,
				enum thermal_notify_event);
void thermal_zone_device_update_temp(struct thermal_zone_device *tz,
				enum thermal_notify_event event, int temp);
void thermal_zone_set_trips(struct thermal_zone_device *);

struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
@@ -584,6 +586,10 @@ static inline int thermal_zone_unbind_cooling_device(
static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
					      enum thermal_notify_event event)
{ }
static inline void thermal_zone_device_update_temp(
		struct thermal_zone_device *tz, enum thermal_notify_event event,
		int temp)
{ }
static inline void thermal_zone_set_trips(struct thermal_zone_device *tz)
{ }
static inline struct thermal_cooling_device *