Loading drivers/thermal/of-thermal.c +8 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,9 @@ #include <linux/thermal.h> #include <linux/list.h> #define CREATE_TRACE_POINTS #include <trace/events/thermal_virtual.h> #include "thermal_core.h" /*** Private data structures to represent thermal device tree data ***/ Loading Loading @@ -113,6 +116,7 @@ struct __thermal_zone { * estimate temperature * @tz - Array of thermal zones of the sensors this virtual sensor will use * to estimate temperature * @virt_tz - Virtual thermal zone pointer * @logic - aggregation logic to be used to estimate the temperature * @last_reading - last estimated temperature * @coefficients - array of coefficients to be used for weighted aggregation Loading @@ -124,6 +128,7 @@ struct __thermal_zone { struct virtual_sensor { int num_sensors; struct thermal_zone_device *tz[THERMAL_MAX_VIRT_SENSORS]; struct thermal_zone_device *virt_tz; enum aggregation_logic logic; int last_reading; int coefficients[THERMAL_MAX_VIRT_SENSORS]; Loading Loading @@ -172,6 +177,8 @@ static int virt_sensor_read_temp(void *data, int *val) default: break; } trace_virtual_temperature(sens->virt_tz, sens->tz[idx], sens_temp, temp); } sens->last_reading = *val = temp; Loading Loading @@ -860,6 +867,7 @@ struct thermal_zone_device *devm_thermal_of_virtual_sensor_register( if (!sens) return ERR_PTR(-ENOMEM); sens->virt_tz = tzd; sens->logic = sensor_data->logic; sens->num_sensors = sensor_data->num_sensors; if (sens->logic == VIRT_WEIGHTED_AVG) { Loading include/trace/events/thermal_virtual.h 0 → 100644 +53 −0 Original line number Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #undef TRACE_SYSTEM #define TRACE_SYSTEM thermal_virtual #if !defined(_TRACE_VIRTUAL_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_VIRTUAL_H #include <linux/thermal.h> #include <linux/tracepoint.h> TRACE_EVENT(virtual_temperature, TP_PROTO(struct thermal_zone_device *virt_tz, struct thermal_zone_device *tz, int sens_temp, int est_temp), TP_ARGS(virt_tz, tz, sens_temp, est_temp), TP_STRUCT__entry( __string(virt_zone, virt_tz->type) __string(therm_zone, tz->type) __field(int, sens_temp) __field(int, est_temp) ), TP_fast_assign( __assign_str(virt_zone, virt_tz->type); __assign_str(therm_zone, tz->type); __entry->sens_temp = sens_temp; __entry->est_temp = est_temp; ), TP_printk("virt_zone=%s zone=%s temp=%d virtual zone estimated temp=%d", __get_str(virt_zone), __get_str(therm_zone), __entry->sens_temp, __entry->est_temp) ); #endif /* _TRACE_VIRTUAL_H */ /* This part must be outside protection */ #include <trace/define_trace.h> Loading
drivers/thermal/of-thermal.c +8 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,9 @@ #include <linux/thermal.h> #include <linux/list.h> #define CREATE_TRACE_POINTS #include <trace/events/thermal_virtual.h> #include "thermal_core.h" /*** Private data structures to represent thermal device tree data ***/ Loading Loading @@ -113,6 +116,7 @@ struct __thermal_zone { * estimate temperature * @tz - Array of thermal zones of the sensors this virtual sensor will use * to estimate temperature * @virt_tz - Virtual thermal zone pointer * @logic - aggregation logic to be used to estimate the temperature * @last_reading - last estimated temperature * @coefficients - array of coefficients to be used for weighted aggregation Loading @@ -124,6 +128,7 @@ struct __thermal_zone { struct virtual_sensor { int num_sensors; struct thermal_zone_device *tz[THERMAL_MAX_VIRT_SENSORS]; struct thermal_zone_device *virt_tz; enum aggregation_logic logic; int last_reading; int coefficients[THERMAL_MAX_VIRT_SENSORS]; Loading Loading @@ -172,6 +177,8 @@ static int virt_sensor_read_temp(void *data, int *val) default: break; } trace_virtual_temperature(sens->virt_tz, sens->tz[idx], sens_temp, temp); } sens->last_reading = *val = temp; Loading Loading @@ -860,6 +867,7 @@ struct thermal_zone_device *devm_thermal_of_virtual_sensor_register( if (!sens) return ERR_PTR(-ENOMEM); sens->virt_tz = tzd; sens->logic = sensor_data->logic; sens->num_sensors = sensor_data->num_sensors; if (sens->logic == VIRT_WEIGHTED_AVG) { Loading
include/trace/events/thermal_virtual.h 0 → 100644 +53 −0 Original line number Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #undef TRACE_SYSTEM #define TRACE_SYSTEM thermal_virtual #if !defined(_TRACE_VIRTUAL_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_VIRTUAL_H #include <linux/thermal.h> #include <linux/tracepoint.h> TRACE_EVENT(virtual_temperature, TP_PROTO(struct thermal_zone_device *virt_tz, struct thermal_zone_device *tz, int sens_temp, int est_temp), TP_ARGS(virt_tz, tz, sens_temp, est_temp), TP_STRUCT__entry( __string(virt_zone, virt_tz->type) __string(therm_zone, tz->type) __field(int, sens_temp) __field(int, est_temp) ), TP_fast_assign( __assign_str(virt_zone, virt_tz->type); __assign_str(therm_zone, tz->type); __entry->sens_temp = sens_temp; __entry->est_temp = est_temp; ), TP_printk("virt_zone=%s zone=%s temp=%d virtual zone estimated temp=%d", __get_str(virt_zone), __get_str(therm_zone), __entry->sens_temp, __entry->est_temp) ); #endif /* _TRACE_VIRTUAL_H */ /* This part must be outside protection */ #include <trace/define_trace.h>