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

Commit cf54360e authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

drivers: of-thermal: Notify all sibling thermal zones on trip



Sibling thermal zone trips are aggregated to set the threshold on the
sensor. When the trip threshold is reached, sensor driver needs to
notify all the sibling thermal zones. But the sibling relation is not
visible to sensor driver to notify them.

Provide a new API in the thermal core, which can be used by the sensor
drivers to notify all the sibling thermal zones.

Change-Id: I8e1042cbcdc6e4ac3c252042e9525ed920f55356
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 01ffea27
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -492,6 +492,25 @@ 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)
{
	struct thermal_zone_device *zone;
	struct __thermal_zone *data = tz->devdata;
	struct list_head *head;

	head = &data->senps->first_tz;
	for_each_tz_sibling(data, head) {
		zone = data->tzd;
		thermal_zone_device_update(zone, THERMAL_EVENT_UNSPECIFIED);
	}
}
EXPORT_SYMBOL(of_thermal_handle_trip);

static struct thermal_zone_device_ops of_thermal_ops = {
	.get_mode = of_thermal_get_mode,
	.set_mode = of_thermal_set_mode,
+1 −1
Original line number Diff line number Diff line
@@ -457,7 +457,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
	}
}

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

+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ 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);
@@ -108,6 +109,7 @@ of_thermal_get_trip_points(struct thermal_zone_device *);
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);
#else
static inline int of_parse_thermal_zones(void) { return 0; }
static inline void of_thermal_destroy_zones(void) { }
@@ -131,6 +133,9 @@ static inline int of_thermal_aggregate_trip(struct thermal_zone_device *tz,
{
	return -ENODEV;
}
static inline
void of_thermal_handle_trip(struct thermal_zone_device *tz)
{ }
#endif

#endif /* __THERMAL_CORE_H__ */