thermal: consistently use int for temperatures
The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
Родитель
25a0a5ce16
Коммит
17e8351a77
|
@ -529,8 +529,7 @@ static void acpi_thermal_check(void *data)
|
||||||
|
|
||||||
/* sys I/F for generic thermal sysfs support */
|
/* sys I/F for generic thermal sysfs support */
|
||||||
|
|
||||||
static int thermal_get_temp(struct thermal_zone_device *thermal,
|
static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
|
||||||
unsigned long *temp)
|
|
||||||
{
|
{
|
||||||
struct acpi_thermal *tz = thermal->devdata;
|
struct acpi_thermal *tz = thermal->devdata;
|
||||||
int result;
|
int result;
|
||||||
|
@ -637,7 +636,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct acpi_thermal *tz = thermal->devdata;
|
struct acpi_thermal *tz = thermal->devdata;
|
||||||
int i;
|
int i;
|
||||||
|
@ -690,7 +689,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
|
static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temperature) {
|
int *temperature)
|
||||||
|
{
|
||||||
struct acpi_thermal *tz = thermal->devdata;
|
struct acpi_thermal *tz = thermal->devdata;
|
||||||
|
|
||||||
if (tz->trips.critical.flags.valid) {
|
if (tz->trips.critical.flags.valid) {
|
||||||
|
@ -713,8 +713,8 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (type == THERMAL_TRIP_ACTIVE) {
|
if (type == THERMAL_TRIP_ACTIVE) {
|
||||||
unsigned long trip_temp;
|
int trip_temp;
|
||||||
unsigned long temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
|
int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
|
||||||
tz->temperature, tz->kelvin_offset);
|
tz->temperature, tz->kelvin_offset);
|
||||||
if (thermal_get_trip_temp(thermal, trip, &trip_temp))
|
if (thermal_get_trip_temp(thermal, trip, &trip_temp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -104,7 +104,7 @@ static inline long lm75_reg_to_mc(s16 temp, u8 resolution)
|
||||||
|
|
||||||
/* sysfs attributes for hwmon */
|
/* sysfs attributes for hwmon */
|
||||||
|
|
||||||
static int lm75_read_temp(void *dev, long *temp)
|
static int lm75_read_temp(void *dev, int *temp)
|
||||||
{
|
{
|
||||||
struct lm75_data *data = lm75_update_device(dev);
|
struct lm75_data *data = lm75_update_device(dev);
|
||||||
|
|
||||||
|
|
|
@ -477,7 +477,7 @@ static int ntc_thermistor_get_ohm(struct ntc_data *data)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ntc_read_temp(void *dev, long *temp)
|
static int ntc_read_temp(void *dev, int *temp)
|
||||||
{
|
{
|
||||||
struct ntc_data *data = dev_get_drvdata(dev);
|
struct ntc_data *data = dev_get_drvdata(dev);
|
||||||
int ohm;
|
int ohm;
|
||||||
|
|
|
@ -98,7 +98,7 @@ static struct tmp102 *tmp102_update_device(struct device *dev)
|
||||||
return tmp102;
|
return tmp102;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tmp102_read_temp(void *dev, long *temp)
|
static int tmp102_read_temp(void *dev, int *temp)
|
||||||
{
|
{
|
||||||
struct tmp102 *tmp102 = tmp102_update_device(dev);
|
struct tmp102 *tmp102 = tmp102_update_device(dev);
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ static void sun4i_ts_close(struct input_dev *dev)
|
||||||
writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
|
writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
|
static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
|
||||||
{
|
{
|
||||||
/* No temp_data until the first irq */
|
/* No temp_data until the first irq */
|
||||||
if (ts->temp_data == -1)
|
if (ts->temp_data == -1)
|
||||||
|
@ -202,7 +202,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sun4i_get_tz_temp(void *data, long *temp)
|
static int sun4i_get_tz_temp(void *data, int *temp)
|
||||||
{
|
{
|
||||||
return sun4i_get_temp(data, temp);
|
return sun4i_get_temp(data, temp);
|
||||||
}
|
}
|
||||||
|
@ -215,14 +215,14 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct sun4i_ts_data *ts = dev_get_drvdata(dev);
|
struct sun4i_ts_data *ts = dev_get_drvdata(dev);
|
||||||
long temp;
|
int temp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = sun4i_get_temp(ts, &temp);
|
error = sun4i_get_temp(ts, &temp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
return sprintf(buf, "%ld\n", temp);
|
return sprintf(buf, "%d\n", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_temp_label(struct device *dev,
|
static ssize_t show_temp_label(struct device *dev,
|
||||||
|
|
|
@ -346,8 +346,7 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
|
||||||
* as late as the polling interval is since we can't do that in the respective
|
* as late as the polling interval is since we can't do that in the respective
|
||||||
* accessors of the module parameters.
|
* accessors of the module parameters.
|
||||||
*/
|
*/
|
||||||
static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal,
|
static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, int *t)
|
||||||
unsigned long *t)
|
|
||||||
{
|
{
|
||||||
int temp, err = 0;
|
int temp, err = 0;
|
||||||
|
|
||||||
|
@ -453,7 +452,7 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
|
static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
if (trip != 0)
|
if (trip != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -464,7 +463,7 @@ static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
|
static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
if (trip == 0)
|
if (trip == 0)
|
||||||
*temp = fanon;
|
*temp = fanon;
|
||||||
|
@ -477,7 +476,7 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
|
static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temperature)
|
int *temperature)
|
||||||
{
|
{
|
||||||
*temperature = ACERHDF_TEMP_CRIT;
|
*temperature = ACERHDF_TEMP_CRIT;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -132,7 +132,7 @@ static int is_valid_adc(uint16_t adc_val, uint16_t min, uint16_t max)
|
||||||
* to achieve very close approximate temp value with less than
|
* to achieve very close approximate temp value with less than
|
||||||
* 0.5C error
|
* 0.5C error
|
||||||
*/
|
*/
|
||||||
static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp)
|
static int adc_to_temp(int direct, uint16_t adc_val, int *tp)
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
|
@ -174,14 +174,13 @@ static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp)
|
||||||
*
|
*
|
||||||
* Can sleep
|
* Can sleep
|
||||||
*/
|
*/
|
||||||
static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp)
|
static int mid_read_temp(struct thermal_zone_device *tzd, int *temp)
|
||||||
{
|
{
|
||||||
struct thermal_device_info *td_info = tzd->devdata;
|
struct thermal_device_info *td_info = tzd->devdata;
|
||||||
uint16_t adc_val, addr;
|
uint16_t adc_val, addr;
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned long curr_temp;
|
int curr_temp;
|
||||||
|
|
||||||
|
|
||||||
addr = td_info->chnl_addr;
|
addr = td_info->chnl_addr;
|
||||||
|
|
||||||
|
@ -453,7 +452,7 @@ static SIMPLE_DEV_PM_OPS(mid_thermal_pm,
|
||||||
*
|
*
|
||||||
* Can sleep
|
* Can sleep
|
||||||
*/
|
*/
|
||||||
static int read_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp)
|
static int read_curr_temp(struct thermal_zone_device *tzd, int *temp)
|
||||||
{
|
{
|
||||||
WARN_ON(tzd == NULL);
|
WARN_ON(tzd == NULL);
|
||||||
return mid_read_temp(tzd, temp);
|
return mid_read_temp(tzd, temp);
|
||||||
|
|
|
@ -619,7 +619,7 @@ static int cm_get_battery_temperature(struct charger_manager *cm,
|
||||||
|
|
||||||
#ifdef CONFIG_THERMAL
|
#ifdef CONFIG_THERMAL
|
||||||
if (cm->tzd_batt) {
|
if (cm->tzd_batt) {
|
||||||
ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp);
|
ret = thermal_zone_get_temp(cm->tzd_batt, temp);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
/* Calibrate temperature unit */
|
/* Calibrate temperature unit */
|
||||||
*temp /= 100;
|
*temp /= 100;
|
||||||
|
|
|
@ -557,7 +557,7 @@ EXPORT_SYMBOL_GPL(power_supply_unreg_notifier);
|
||||||
|
|
||||||
#ifdef CONFIG_THERMAL
|
#ifdef CONFIG_THERMAL
|
||||||
static int power_supply_read_temp(struct thermal_zone_device *tzd,
|
static int power_supply_read_temp(struct thermal_zone_device *tzd,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct power_supply *psy;
|
struct power_supply *psy;
|
||||||
union power_supply_propval val;
|
union power_supply_propval val;
|
||||||
|
|
|
@ -155,7 +155,7 @@ static bool armada_is_valid(struct armada_thermal_priv *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int armada_get_temp(struct thermal_zone_device *thermal,
|
static int armada_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct armada_thermal_priv *priv = thermal->devdata;
|
struct armada_thermal_priv *priv = thermal->devdata;
|
||||||
unsigned long reg;
|
unsigned long reg;
|
||||||
|
|
|
@ -107,8 +107,7 @@ static int db8500_cdev_unbind(struct thermal_zone_device *thermal,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback to get current temperature */
|
/* Callback to get current temperature */
|
||||||
static int db8500_sys_get_temp(struct thermal_zone_device *thermal,
|
static int db8500_sys_get_temp(struct thermal_zone_device *thermal, int *temp)
|
||||||
unsigned long *temp)
|
|
||||||
{
|
{
|
||||||
struct db8500_thermal_zone *pzone = thermal->devdata;
|
struct db8500_thermal_zone *pzone = thermal->devdata;
|
||||||
|
|
||||||
|
@ -180,7 +179,7 @@ static int db8500_sys_get_trip_type(struct thermal_zone_device *thermal,
|
||||||
|
|
||||||
/* Callback to get trip point temperature */
|
/* Callback to get trip point temperature */
|
||||||
static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
|
static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct db8500_thermal_zone *pzone = thermal->devdata;
|
struct db8500_thermal_zone *pzone = thermal->devdata;
|
||||||
struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
|
struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
|
||||||
|
@ -195,7 +194,7 @@ static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
|
||||||
|
|
||||||
/* Callback to get critical trip point temperature */
|
/* Callback to get critical trip point temperature */
|
||||||
static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal,
|
static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct db8500_thermal_zone *pzone = thermal->devdata;
|
struct db8500_thermal_zone *pzone = thermal->devdata;
|
||||||
struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
|
struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
|
||||||
|
|
|
@ -93,7 +93,7 @@ static int dove_init_sensor(const struct dove_thermal_priv *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dove_get_temp(struct thermal_zone_device *thermal,
|
static int dove_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
unsigned long reg;
|
unsigned long reg;
|
||||||
struct dove_thermal_priv *priv = thermal->devdata;
|
struct dove_thermal_priv *priv = thermal->devdata;
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
static int get_trip_level(struct thermal_zone_device *tz)
|
static int get_trip_level(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
unsigned long trip_temp;
|
int trip_temp;
|
||||||
enum thermal_trip_type trip_type;
|
enum thermal_trip_type trip_type;
|
||||||
|
|
||||||
if (tz->trips == 0 || !tz->ops->get_trip_temp)
|
if (tz->trips == 0 || !tz->ops->get_trip_temp)
|
||||||
|
|
|
@ -25,14 +25,13 @@
|
||||||
|
|
||||||
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
{
|
{
|
||||||
long trip_temp;
|
int trip_temp, trip_hyst;
|
||||||
unsigned long trip_hyst;
|
|
||||||
struct thermal_instance *instance;
|
struct thermal_instance *instance;
|
||||||
|
|
||||||
tz->ops->get_trip_temp(tz, trip, &trip_temp);
|
tz->ops->get_trip_temp(tz, trip, &trip_temp);
|
||||||
tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
|
tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
|
||||||
|
|
||||||
dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
|
dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
|
||||||
trip, trip_temp, tz->temperature,
|
trip, trip_temp, tz->temperature,
|
||||||
trip_hyst);
|
trip_hyst);
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ static void hisi_thermal_disable_sensor(struct hisi_thermal_data *data)
|
||||||
mutex_unlock(&data->thermal_lock);
|
mutex_unlock(&data->thermal_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hisi_thermal_get_temp(void *_sensor, long *temp)
|
static int hisi_thermal_get_temp(void *_sensor, int *temp)
|
||||||
{
|
{
|
||||||
struct hisi_thermal_sensor *sensor = _sensor;
|
struct hisi_thermal_sensor *sensor = _sensor;
|
||||||
struct hisi_thermal_data *data = sensor->thermal;
|
struct hisi_thermal_data *data = sensor->thermal;
|
||||||
|
@ -178,7 +178,7 @@ static int hisi_thermal_get_temp(void *_sensor, long *temp)
|
||||||
data->irq_bind_sensor = sensor_id;
|
data->irq_bind_sensor = sensor_id;
|
||||||
mutex_unlock(&data->thermal_lock);
|
mutex_unlock(&data->thermal_lock);
|
||||||
|
|
||||||
dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%ld, thres=%d\n",
|
dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d, thres=%d\n",
|
||||||
sensor->id, data->irq_enabled, *temp, sensor->thres_temp);
|
sensor->id, data->irq_enabled, *temp, sensor->thres_temp);
|
||||||
/*
|
/*
|
||||||
* Bind irq to sensor for two cases:
|
* Bind irq to sensor for two cases:
|
||||||
|
|
|
@ -98,10 +98,10 @@ struct imx_thermal_data {
|
||||||
enum thermal_device_mode mode;
|
enum thermal_device_mode mode;
|
||||||
struct regmap *tempmon;
|
struct regmap *tempmon;
|
||||||
u32 c1, c2; /* See formula in imx_get_sensor_data() */
|
u32 c1, c2; /* See formula in imx_get_sensor_data() */
|
||||||
unsigned long temp_passive;
|
int temp_passive;
|
||||||
unsigned long temp_critical;
|
int temp_critical;
|
||||||
unsigned long alarm_temp;
|
int alarm_temp;
|
||||||
unsigned long last_temp;
|
int last_temp;
|
||||||
bool irq_enabled;
|
bool irq_enabled;
|
||||||
int irq;
|
int irq;
|
||||||
struct clk *thermal_clk;
|
struct clk *thermal_clk;
|
||||||
|
@ -109,7 +109,7 @@ struct imx_thermal_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void imx_set_panic_temp(struct imx_thermal_data *data,
|
static void imx_set_panic_temp(struct imx_thermal_data *data,
|
||||||
signed long panic_temp)
|
int panic_temp)
|
||||||
{
|
{
|
||||||
struct regmap *map = data->tempmon;
|
struct regmap *map = data->tempmon;
|
||||||
int critical_value;
|
int critical_value;
|
||||||
|
@ -121,7 +121,7 @@ static void imx_set_panic_temp(struct imx_thermal_data *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imx_set_alarm_temp(struct imx_thermal_data *data,
|
static void imx_set_alarm_temp(struct imx_thermal_data *data,
|
||||||
signed long alarm_temp)
|
int alarm_temp)
|
||||||
{
|
{
|
||||||
struct regmap *map = data->tempmon;
|
struct regmap *map = data->tempmon;
|
||||||
int alarm_value;
|
int alarm_value;
|
||||||
|
@ -133,7 +133,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
|
||||||
TEMPSENSE0_ALARM_VALUE_SHIFT);
|
TEMPSENSE0_ALARM_VALUE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
|
static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = tz->devdata;
|
struct imx_thermal_data *data = tz->devdata;
|
||||||
struct regmap *map = data->tempmon;
|
struct regmap *map = data->tempmon;
|
||||||
|
@ -189,13 +189,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
|
||||||
if (data->alarm_temp == data->temp_critical &&
|
if (data->alarm_temp == data->temp_critical &&
|
||||||
*temp < data->temp_passive) {
|
*temp < data->temp_passive) {
|
||||||
imx_set_alarm_temp(data, data->temp_passive);
|
imx_set_alarm_temp(data, data->temp_passive);
|
||||||
dev_dbg(&tz->device, "thermal alarm off: T < %lu\n",
|
dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
|
||||||
data->alarm_temp / 1000);
|
data->alarm_temp / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*temp != data->last_temp) {
|
if (*temp != data->last_temp) {
|
||||||
dev_dbg(&tz->device, "millicelsius: %ld\n", *temp);
|
dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
|
||||||
data->last_temp = *temp;
|
data->last_temp = *temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,8 +262,7 @@ static int imx_get_trip_type(struct thermal_zone_device *tz, int trip,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_get_crit_temp(struct thermal_zone_device *tz,
|
static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
|
||||||
unsigned long *temp)
|
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = tz->devdata;
|
struct imx_thermal_data *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -272,7 +271,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = tz->devdata;
|
struct imx_thermal_data *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -282,7 +281,7 @@ static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
|
static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = tz->devdata;
|
struct imx_thermal_data *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -434,7 +433,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = dev;
|
struct imx_thermal_data *data = dev;
|
||||||
|
|
||||||
dev_dbg(&data->tz->device, "THERMAL ALARM: T > %lu\n",
|
dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
|
||||||
data->alarm_temp / 1000);
|
data->alarm_temp / 1000);
|
||||||
|
|
||||||
thermal_zone_device_update(data->tz);
|
thermal_zone_device_update(data->tz);
|
||||||
|
|
|
@ -186,7 +186,7 @@ static int int3400_thermal_run_osc(acpi_handle handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
|
static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
*temp = 20 * 1000; /* faked temp sensor with 20C */
|
*temp = 20 * 1000; /* faked temp sensor with 20C */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "int340x_thermal_zone.h"
|
#include "int340x_thermal_zone.h"
|
||||||
|
|
||||||
static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
|
static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct int34x_thermal_zone *d = zone->devdata;
|
struct int34x_thermal_zone *d = zone->devdata;
|
||||||
unsigned long long tmp;
|
unsigned long long tmp;
|
||||||
|
@ -49,7 +49,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone,
|
static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct int34x_thermal_zone *d = zone->devdata;
|
struct int34x_thermal_zone *d = zone->devdata;
|
||||||
int i;
|
int i;
|
||||||
|
@ -114,7 +114,7 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
|
static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
|
||||||
int trip, unsigned long temp)
|
int trip, int temp)
|
||||||
{
|
{
|
||||||
struct int34x_thermal_zone *d = zone->devdata;
|
struct int34x_thermal_zone *d = zone->devdata;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
@ -136,7 +136,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
|
||||||
|
|
||||||
|
|
||||||
static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
|
static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct int34x_thermal_zone *d = zone->devdata;
|
struct int34x_thermal_zone *d = zone->devdata;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
@ -163,7 +163,7 @@ static struct thermal_zone_device_ops int340x_thermal_zone_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int int340x_thermal_get_trip_config(acpi_handle handle, char *name,
|
static int int340x_thermal_get_trip_config(acpi_handle handle, char *name,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
unsigned long long r;
|
unsigned long long r;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
|
#define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
|
||||||
|
|
||||||
struct active_trip {
|
struct active_trip {
|
||||||
unsigned long temp;
|
int temp;
|
||||||
int id;
|
int id;
|
||||||
bool valid;
|
bool valid;
|
||||||
};
|
};
|
||||||
|
@ -31,11 +31,11 @@ struct int34x_thermal_zone {
|
||||||
struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
|
struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
|
||||||
unsigned long *aux_trips;
|
unsigned long *aux_trips;
|
||||||
int aux_trip_nr;
|
int aux_trip_nr;
|
||||||
unsigned long psv_temp;
|
int psv_temp;
|
||||||
int psv_trip_id;
|
int psv_trip_id;
|
||||||
unsigned long crt_temp;
|
int crt_temp;
|
||||||
int crt_trip_id;
|
int crt_trip_id;
|
||||||
unsigned long hot_temp;
|
int hot_temp;
|
||||||
int hot_trip_id;
|
int hot_trip_id;
|
||||||
struct thermal_zone_device *zone;
|
struct thermal_zone_device *zone;
|
||||||
struct thermal_zone_device_ops *override_ops;
|
struct thermal_zone_device_ops *override_ops;
|
||||||
|
|
|
@ -145,7 +145,7 @@ static int get_tjmax(void)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_temp_msr(unsigned long *temp)
|
static int read_temp_msr(int *temp)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
u32 eax, edx;
|
u32 eax, edx;
|
||||||
|
@ -177,7 +177,7 @@ err_ret:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone,
|
static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ static int soc_dts_disable(struct thermal_zone_device *tzd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _get_trip_temp(int trip, unsigned long *temp)
|
static int _get_trip_temp(int trip, int *temp)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
u32 out;
|
u32 out;
|
||||||
|
@ -212,19 +212,18 @@ static int _get_trip_temp(int trip, unsigned long *temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int sys_get_trip_temp(struct thermal_zone_device *tzd,
|
static inline int sys_get_trip_temp(struct thermal_zone_device *tzd,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
return _get_trip_temp(trip, temp);
|
return _get_trip_temp(trip, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int sys_get_crit_temp(struct thermal_zone_device *tzd,
|
static inline int sys_get_crit_temp(struct thermal_zone_device *tzd, int *temp)
|
||||||
unsigned long *temp)
|
|
||||||
{
|
{
|
||||||
return _get_trip_temp(QRK_DTS_ID_TP_CRITICAL, temp);
|
return _get_trip_temp(QRK_DTS_ID_TP_CRITICAL, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_trip_temp(struct soc_sensor_entry *aux_entry,
|
static int update_trip_temp(struct soc_sensor_entry *aux_entry,
|
||||||
int trip, unsigned long temp)
|
int trip, int temp)
|
||||||
{
|
{
|
||||||
u32 out;
|
u32 out;
|
||||||
u32 temp_out;
|
u32 temp_out;
|
||||||
|
@ -272,7 +271,7 @@ failed:
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
return update_trip_temp(tzd->devdata, trip, temp);
|
return update_trip_temp(tzd->devdata, trip, temp);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +288,7 @@ static int sys_get_trip_type(struct thermal_zone_device *thermal,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_get_curr_temp(struct thermal_zone_device *tzd,
|
static int sys_get_curr_temp(struct thermal_zone_device *tzd,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
u32 out;
|
u32 out;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -80,7 +80,7 @@ err_ret:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
|
static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
u32 out;
|
u32 out;
|
||||||
|
@ -106,7 +106,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
|
static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
|
||||||
int thres_index, unsigned long temp,
|
int thres_index, int temp,
|
||||||
enum thermal_trip_type trip_type)
|
enum thermal_trip_type trip_type)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
@ -196,7 +196,7 @@ err_restore_ptps:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
struct intel_soc_dts_sensor_entry *dts = tzd->devdata;
|
struct intel_soc_dts_sensor_entry *dts = tzd->devdata;
|
||||||
struct intel_soc_dts_sensors *sensors = dts->sensors;
|
struct intel_soc_dts_sensors *sensors = dts->sensors;
|
||||||
|
@ -226,7 +226,7 @@ static int sys_get_trip_type(struct thermal_zone_device *tzd,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_get_curr_temp(struct thermal_zone_device *tzd,
|
static int sys_get_curr_temp(struct thermal_zone_device *tzd,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
u32 out;
|
u32 out;
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct kirkwood_thermal_priv {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int kirkwood_get_temp(struct thermal_zone_device *thermal,
|
static int kirkwood_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
unsigned long reg;
|
unsigned long reg;
|
||||||
struct kirkwood_thermal_priv *priv = thermal->devdata;
|
struct kirkwood_thermal_priv *priv = thermal->devdata;
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct __thermal_zone {
|
||||||
/*** DT thermal zone device callbacks ***/
|
/*** DT thermal zone device callbacks ***/
|
||||||
|
|
||||||
static int of_thermal_get_temp(struct thermal_zone_device *tz,
|
static int of_thermal_get_temp(struct thermal_zone_device *tz,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
|
||||||
* Return: zero on success, error code otherwise
|
* Return: zero on success, error code otherwise
|
||||||
*/
|
*/
|
||||||
static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
|
static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
|
static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
|
static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long *hyst)
|
int *hyst)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
|
static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
|
||||||
unsigned long hyst)
|
int hyst)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
|
static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct __thermal_zone *data = tz->devdata;
|
struct __thermal_zone *data = tz->devdata;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -92,8 +92,8 @@ struct power_allocator_params {
|
||||||
* Return: The power budget for the next period.
|
* Return: The power budget for the next period.
|
||||||
*/
|
*/
|
||||||
static u32 pid_controller(struct thermal_zone_device *tz,
|
static u32 pid_controller(struct thermal_zone_device *tz,
|
||||||
unsigned long current_temp,
|
int current_temp,
|
||||||
unsigned long control_temp,
|
int control_temp,
|
||||||
u32 max_allocatable_power)
|
u32 max_allocatable_power)
|
||||||
{
|
{
|
||||||
s64 p, i, d, power_range;
|
s64 p, i, d, power_range;
|
||||||
|
@ -102,7 +102,7 @@ static u32 pid_controller(struct thermal_zone_device *tz,
|
||||||
|
|
||||||
max_power_frac = int_to_frac(max_allocatable_power);
|
max_power_frac = int_to_frac(max_allocatable_power);
|
||||||
|
|
||||||
err = ((s32)control_temp - (s32)current_temp);
|
err = control_temp - current_temp;
|
||||||
err = int_to_frac(err);
|
err = int_to_frac(err);
|
||||||
|
|
||||||
/* Calculate the proportional term */
|
/* Calculate the proportional term */
|
||||||
|
@ -223,8 +223,8 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int allocate_power(struct thermal_zone_device *tz,
|
static int allocate_power(struct thermal_zone_device *tz,
|
||||||
unsigned long current_temp,
|
int current_temp,
|
||||||
unsigned long control_temp)
|
int control_temp)
|
||||||
{
|
{
|
||||||
struct thermal_instance *instance;
|
struct thermal_instance *instance;
|
||||||
struct power_allocator_params *params = tz->governor_data;
|
struct power_allocator_params *params = tz->governor_data;
|
||||||
|
@ -326,7 +326,7 @@ static int allocate_power(struct thermal_zone_device *tz,
|
||||||
granted_power, total_granted_power,
|
granted_power, total_granted_power,
|
||||||
num_actors, power_range,
|
num_actors, power_range,
|
||||||
max_allocatable_power, current_temp,
|
max_allocatable_power, current_temp,
|
||||||
(s32)control_temp - (s32)current_temp);
|
control_temp - current_temp);
|
||||||
|
|
||||||
devm_kfree(&tz->device, req_power);
|
devm_kfree(&tz->device, req_power);
|
||||||
unlock:
|
unlock:
|
||||||
|
@ -411,7 +411,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct power_allocator_params *params;
|
struct power_allocator_params *params;
|
||||||
unsigned long switch_on_temp, control_temp;
|
int switch_on_temp, control_temp;
|
||||||
u32 temperature_threshold;
|
u32 temperature_threshold;
|
||||||
|
|
||||||
if (!tz->tzp || !tz->tzp->sustainable_power) {
|
if (!tz->tzp || !tz->tzp->sustainable_power) {
|
||||||
|
@ -476,7 +476,7 @@ static void power_allocator_unbind(struct thermal_zone_device *tz)
|
||||||
static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
|
static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned long switch_on_temp, control_temp, current_temp;
|
int switch_on_temp, control_temp, current_temp;
|
||||||
struct power_allocator_params *params = tz->governor_data;
|
struct power_allocator_params *params = tz->governor_data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -117,7 +117,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qpnp_tm_get_temp(void *data, long *temp)
|
static int qpnp_tm_get_temp(void *data, int *temp)
|
||||||
{
|
{
|
||||||
struct qpnp_tm_chip *chip = data;
|
struct qpnp_tm_chip *chip = data;
|
||||||
int ret, mili_celsius;
|
int ret, mili_celsius;
|
||||||
|
|
|
@ -200,8 +200,7 @@ err_out_unlock:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
|
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
|
||||||
unsigned long *temp)
|
|
||||||
{
|
{
|
||||||
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
|
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
|
||||||
|
|
||||||
|
@ -235,7 +234,7 @@ static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
|
static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
|
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
|
||||||
struct device *dev = rcar_priv_to_dev(priv);
|
struct device *dev = rcar_priv_to_dev(priv);
|
||||||
|
@ -299,7 +298,7 @@ static void _rcar_thermal_irq_ctrl(struct rcar_thermal_priv *priv, int enable)
|
||||||
static void rcar_thermal_work(struct work_struct *work)
|
static void rcar_thermal_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct rcar_thermal_priv *priv;
|
struct rcar_thermal_priv *priv;
|
||||||
unsigned long cctemp, nctemp;
|
int cctemp, nctemp;
|
||||||
|
|
||||||
priv = container_of(work, struct rcar_thermal_priv, work.work);
|
priv = container_of(work, struct rcar_thermal_priv, work.work);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct rockchip_tsadc_chip {
|
||||||
void (*control)(void __iomem *reg, bool on);
|
void (*control)(void __iomem *reg, bool on);
|
||||||
|
|
||||||
/* Per-sensor methods */
|
/* Per-sensor methods */
|
||||||
int (*get_temp)(int chn, void __iomem *reg, long *temp);
|
int (*get_temp)(int chn, void __iomem *reg, int *temp);
|
||||||
void (*set_tshut_temp)(int chn, void __iomem *reg, long temp);
|
void (*set_tshut_temp)(int chn, void __iomem *reg, long temp);
|
||||||
void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
|
void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
|
||||||
};
|
};
|
||||||
|
@ -191,7 +191,7 @@ static u32 rk_tsadcv2_temp_to_code(long temp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long rk_tsadcv2_code_to_temp(u32 code)
|
static int rk_tsadcv2_code_to_temp(u32 code)
|
||||||
{
|
{
|
||||||
unsigned int low = 0;
|
unsigned int low = 0;
|
||||||
unsigned int high = ARRAY_SIZE(v2_code_table) - 1;
|
unsigned int high = ARRAY_SIZE(v2_code_table) - 1;
|
||||||
|
@ -277,7 +277,7 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable)
|
||||||
writel_relaxed(val, regs + TSADCV2_AUTO_CON);
|
writel_relaxed(val, regs + TSADCV2_AUTO_CON);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, long *temp)
|
static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, int *temp)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rockchip_thermal_get_temp(void *_sensor, long *out_temp)
|
static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
|
||||||
{
|
{
|
||||||
struct rockchip_thermal_sensor *sensor = _sensor;
|
struct rockchip_thermal_sensor *sensor = _sensor;
|
||||||
struct rockchip_thermal_data *thermal = sensor->thermal;
|
struct rockchip_thermal_data *thermal = sensor->thermal;
|
||||||
|
@ -374,7 +374,7 @@ static int rockchip_thermal_get_temp(void *_sensor, long *out_temp)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp);
|
retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp);
|
||||||
dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %ld, retval: %d\n",
|
dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n",
|
||||||
sensor->id, *out_temp, retval);
|
sensor->id, *out_temp, retval);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -207,8 +207,7 @@ struct exynos_tmu_data {
|
||||||
int (*tmu_initialize)(struct platform_device *pdev);
|
int (*tmu_initialize)(struct platform_device *pdev);
|
||||||
void (*tmu_control)(struct platform_device *pdev, bool on);
|
void (*tmu_control)(struct platform_device *pdev, bool on);
|
||||||
int (*tmu_read)(struct exynos_tmu_data *data);
|
int (*tmu_read)(struct exynos_tmu_data *data);
|
||||||
void (*tmu_set_emulation)(struct exynos_tmu_data *data,
|
void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp);
|
||||||
unsigned long temp);
|
|
||||||
void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
|
void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,7 +215,7 @@ static void exynos_report_trigger(struct exynos_tmu_data *p)
|
||||||
{
|
{
|
||||||
char data[10], *envp[] = { data, NULL };
|
char data[10], *envp[] = { data, NULL };
|
||||||
struct thermal_zone_device *tz = p->tzd;
|
struct thermal_zone_device *tz = p->tzd;
|
||||||
unsigned long temp;
|
int temp;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (!tz) {
|
if (!tz) {
|
||||||
|
@ -517,7 +516,7 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev)
|
||||||
struct thermal_zone_device *tz = data->tzd;
|
struct thermal_zone_device *tz = data->tzd;
|
||||||
unsigned int status, trim_info;
|
unsigned int status, trim_info;
|
||||||
unsigned int rising_threshold = 0, falling_threshold = 0;
|
unsigned int rising_threshold = 0, falling_threshold = 0;
|
||||||
unsigned long temp, temp_hist;
|
int temp, temp_hist;
|
||||||
int ret = 0, threshold_code, i, sensor_id, cal_type;
|
int ret = 0, threshold_code, i, sensor_id, cal_type;
|
||||||
|
|
||||||
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
||||||
|
@ -610,7 +609,7 @@ static int exynos5440_tmu_initialize(struct platform_device *pdev)
|
||||||
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
|
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
|
||||||
unsigned int trim_info = 0, con, rising_threshold;
|
unsigned int trim_info = 0, con, rising_threshold;
|
||||||
int ret = 0, threshold_code;
|
int ret = 0, threshold_code;
|
||||||
unsigned long crit_temp = 0;
|
int crit_temp = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For exynos5440 soc triminfo value is swapped between TMU0 and
|
* For exynos5440 soc triminfo value is swapped between TMU0 and
|
||||||
|
@ -663,7 +662,7 @@ static int exynos7_tmu_initialize(struct platform_device *pdev)
|
||||||
unsigned int status, trim_info;
|
unsigned int status, trim_info;
|
||||||
unsigned int rising_threshold = 0, falling_threshold = 0;
|
unsigned int rising_threshold = 0, falling_threshold = 0;
|
||||||
int ret = 0, threshold_code, i;
|
int ret = 0, threshold_code, i;
|
||||||
unsigned long temp, temp_hist;
|
int temp, temp_hist;
|
||||||
unsigned int reg_off, bit_off;
|
unsigned int reg_off, bit_off;
|
||||||
|
|
||||||
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
||||||
|
@ -876,7 +875,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
|
||||||
writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
|
writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exynos_get_temp(void *p, long *temp)
|
static int exynos_get_temp(void *p, int *temp)
|
||||||
{
|
{
|
||||||
struct exynos_tmu_data *data = p;
|
struct exynos_tmu_data *data = p;
|
||||||
|
|
||||||
|
@ -896,7 +895,7 @@ static int exynos_get_temp(void *p, long *temp)
|
||||||
|
|
||||||
#ifdef CONFIG_THERMAL_EMULATION
|
#ifdef CONFIG_THERMAL_EMULATION
|
||||||
static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
|
static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
if (temp) {
|
if (temp) {
|
||||||
temp /= MCELSIUS;
|
temp /= MCELSIUS;
|
||||||
|
@ -926,7 +925,7 @@ static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
|
static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
u32 emul_con;
|
u32 emul_con;
|
||||||
|
@ -946,7 +945,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
|
static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
|
@ -955,7 +954,7 @@ static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
|
||||||
writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG);
|
writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
|
static int exynos_tmu_set_emulation(void *drv_data, int temp)
|
||||||
{
|
{
|
||||||
struct exynos_tmu_data *data = drv_data;
|
struct exynos_tmu_data *data = drv_data;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
@ -978,7 +977,7 @@ out:
|
||||||
#else
|
#else
|
||||||
#define exynos4412_tmu_set_emulation NULL
|
#define exynos4412_tmu_set_emulation NULL
|
||||||
#define exynos5440_tmu_set_emulation NULL
|
#define exynos5440_tmu_set_emulation NULL
|
||||||
static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
|
static int exynos_tmu_set_emulation(void *drv_data, int temp)
|
||||||
{ return -EINVAL; }
|
{ return -EINVAL; }
|
||||||
#endif /* CONFIG_THERMAL_EMULATION */
|
#endif /* CONFIG_THERMAL_EMULATION */
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct spear_thermal_dev {
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int thermal_get_temp(struct thermal_zone_device *thermal,
|
static inline int thermal_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct spear_thermal_dev *stdev = thermal->devdata;
|
struct spear_thermal_dev *stdev = thermal->devdata;
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback to get temperature from HW*/
|
/* Callback to get temperature from HW*/
|
||||||
static int st_thermal_get_temp(struct thermal_zone_device *th,
|
static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
|
||||||
unsigned long *temperature)
|
|
||||||
{
|
{
|
||||||
struct st_thermal_sensor *sensor = th->devdata;
|
struct st_thermal_sensor *sensor = th->devdata;
|
||||||
struct device *dev = sensor->dev;
|
struct device *dev = sensor->dev;
|
||||||
|
@ -159,7 +158,7 @@ static int st_thermal_get_trip_type(struct thermal_zone_device *th,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st_thermal_get_trip_temp(struct thermal_zone_device *th,
|
static int st_thermal_get_trip_temp(struct thermal_zone_device *th,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
struct st_thermal_sensor *sensor = th->devdata;
|
struct st_thermal_sensor *sensor = th->devdata;
|
||||||
struct device *dev = sensor->dev;
|
struct device *dev = sensor->dev;
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void update_passive_instance(struct thermal_zone_device *tz,
|
||||||
|
|
||||||
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
{
|
{
|
||||||
long trip_temp;
|
int trip_temp;
|
||||||
enum thermal_trip_type trip_type;
|
enum thermal_trip_type trip_type;
|
||||||
enum thermal_trend trend;
|
enum thermal_trend trend;
|
||||||
struct thermal_instance *instance;
|
struct thermal_instance *instance;
|
||||||
|
@ -135,7 +135,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
trace_thermal_zone_trip(tz, trip, trip_type);
|
trace_thermal_zone_trip(tz, trip, trip_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n",
|
dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
|
||||||
trip, trip_type, trip_temp, trend, throttle);
|
trip, trip_type, trip_temp, trend, throttle);
|
||||||
|
|
||||||
mutex_lock(&tz->lock);
|
mutex_lock(&tz->lock);
|
||||||
|
|
|
@ -293,7 +293,7 @@ static int enable_tsensor(struct tegra_soctherm *tegra,
|
||||||
* H denotes an addition of 0.5 Celsius and N denotes negation
|
* H denotes an addition of 0.5 Celsius and N denotes negation
|
||||||
* of the final value.
|
* of the final value.
|
||||||
*/
|
*/
|
||||||
static long translate_temp(u16 val)
|
static int translate_temp(u16 val)
|
||||||
{
|
{
|
||||||
long t;
|
long t;
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ static long translate_temp(u16 val)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra_thermctl_get_temp(void *data, long *out_temp)
|
static int tegra_thermctl_get_temp(void *data, int *out_temp)
|
||||||
{
|
{
|
||||||
struct tegra_thermctl_zone *zone = data;
|
struct tegra_thermctl_zone *zone = data;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
|
@ -426,7 +426,7 @@ static void handle_non_critical_trips(struct thermal_zone_device *tz,
|
||||||
static void handle_critical_trips(struct thermal_zone_device *tz,
|
static void handle_critical_trips(struct thermal_zone_device *tz,
|
||||||
int trip, enum thermal_trip_type trip_type)
|
int trip, enum thermal_trip_type trip_type)
|
||||||
{
|
{
|
||||||
long trip_temp;
|
int trip_temp;
|
||||||
|
|
||||||
tz->ops->get_trip_temp(tz, trip, &trip_temp);
|
tz->ops->get_trip_temp(tz, trip, &trip_temp);
|
||||||
|
|
||||||
|
@ -474,12 +474,12 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
|
||||||
*
|
*
|
||||||
* Return: On success returns 0, an error code otherwise
|
* Return: On success returns 0, an error code otherwise
|
||||||
*/
|
*/
|
||||||
int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
|
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
#ifdef CONFIG_THERMAL_EMULATION
|
#ifdef CONFIG_THERMAL_EMULATION
|
||||||
int count;
|
int count;
|
||||||
unsigned long crit_temp = -1UL;
|
int crit_temp = INT_MAX;
|
||||||
enum thermal_trip_type type;
|
enum thermal_trip_type type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -516,8 +516,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp);
|
||||||
|
|
||||||
static void update_temperature(struct thermal_zone_device *tz)
|
static void update_temperature(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
long temp;
|
int temp, ret;
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = thermal_zone_get_temp(tz, &temp);
|
ret = thermal_zone_get_temp(tz, &temp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -577,15 +576,14 @@ static ssize_t
|
||||||
temp_show(struct device *dev, struct device_attribute *attr, char *buf)
|
temp_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||||
long temperature;
|
int temperature, ret;
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = thermal_zone_get_temp(tz, &temperature);
|
ret = thermal_zone_get_temp(tz, &temperature);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return sprintf(buf, "%ld\n", temperature);
|
return sprintf(buf, "%d\n", temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
@ -689,7 +687,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
|
||||||
{
|
{
|
||||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||||
int trip, ret;
|
int trip, ret;
|
||||||
long temperature;
|
int temperature;
|
||||||
|
|
||||||
if (!tz->ops->get_trip_temp)
|
if (!tz->ops->get_trip_temp)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -702,7 +700,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return sprintf(buf, "%ld\n", temperature);
|
return sprintf(buf, "%d\n", temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
@ -711,7 +709,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
|
||||||
{
|
{
|
||||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||||
int trip, ret;
|
int trip, ret;
|
||||||
unsigned long temperature;
|
int temperature;
|
||||||
|
|
||||||
if (!tz->ops->set_trip_hyst)
|
if (!tz->ops->set_trip_hyst)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -719,7 +717,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
|
||||||
if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
|
if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (kstrtoul(buf, 10, &temperature))
|
if (kstrtoint(buf, 10, &temperature))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -738,7 +736,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
|
||||||
{
|
{
|
||||||
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
struct thermal_zone_device *tz = to_thermal_zone(dev);
|
||||||
int trip, ret;
|
int trip, ret;
|
||||||
unsigned long temperature;
|
int temperature;
|
||||||
|
|
||||||
if (!tz->ops->get_trip_hyst)
|
if (!tz->ops->get_trip_hyst)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -748,7 +746,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
|
||||||
|
|
||||||
ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
|
ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
|
||||||
|
|
||||||
return ret ? ret : sprintf(buf, "%ld\n", temperature);
|
return ret ? ret : sprintf(buf, "%d\n", temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
|
|
@ -69,7 +69,7 @@ static DEVICE_ATTR(name, 0444, name_show, NULL);
|
||||||
static ssize_t
|
static ssize_t
|
||||||
temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
|
temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
long temperature;
|
int temperature;
|
||||||
int ret;
|
int ret;
|
||||||
struct thermal_hwmon_attr *hwmon_attr
|
struct thermal_hwmon_attr *hwmon_attr
|
||||||
= container_of(attr, struct thermal_hwmon_attr, attr);
|
= container_of(attr, struct thermal_hwmon_attr, attr);
|
||||||
|
@ -83,7 +83,7 @@ temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return sprintf(buf, "%ld\n", temperature);
|
return sprintf(buf, "%d\n", temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
@ -95,14 +95,14 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
= container_of(hwmon_attr, struct thermal_hwmon_temp,
|
= container_of(hwmon_attr, struct thermal_hwmon_temp,
|
||||||
temp_crit);
|
temp_crit);
|
||||||
struct thermal_zone_device *tz = temp->tz;
|
struct thermal_zone_device *tz = temp->tz;
|
||||||
long temperature;
|
int temperature;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = tz->ops->get_trip_temp(tz, 0, &temperature);
|
ret = tz->ops->get_trip_temp(tz, 0, &temperature);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return sprintf(buf, "%ld\n", temperature);
|
return sprintf(buf, "%d\n", temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
|
||||||
|
|
||||||
static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
|
static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
unsigned long temp;
|
int temp;
|
||||||
return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
|
return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,14 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
|
||||||
|
|
||||||
/* thermal zone ops */
|
/* thermal zone ops */
|
||||||
/* Get temperature callback function for thermal zone */
|
/* Get temperature callback function for thermal zone */
|
||||||
static inline int __ti_thermal_get_temp(void *devdata, long *temp)
|
static inline int __ti_thermal_get_temp(void *devdata, int *temp)
|
||||||
{
|
{
|
||||||
struct thermal_zone_device *pcb_tz = NULL;
|
struct thermal_zone_device *pcb_tz = NULL;
|
||||||
struct ti_thermal_data *data = devdata;
|
struct ti_thermal_data *data = devdata;
|
||||||
struct ti_bandgap *bgp;
|
struct ti_bandgap *bgp;
|
||||||
const struct ti_temp_sensor *s;
|
const struct ti_temp_sensor *s;
|
||||||
int ret, tmp, slope, constant;
|
int ret, tmp, slope, constant;
|
||||||
unsigned long pcb_temp;
|
int pcb_temp;
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -119,7 +119,7 @@ static inline int __ti_thermal_get_temp(void *devdata, long *temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
|
static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
struct ti_thermal_data *data = thermal->devdata;
|
struct ti_thermal_data *data = thermal->devdata;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static int ti_thermal_get_trip_type(struct thermal_zone_device *thermal,
|
||||||
|
|
||||||
/* Get trip temperature callback functions for thermal zone */
|
/* Get trip temperature callback functions for thermal zone */
|
||||||
static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
if (!ti_thermal_is_valid_trip(trip))
|
if (!ti_thermal_is_valid_trip(trip))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -280,7 +280,7 @@ static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
|
||||||
|
|
||||||
/* Get critical temperature callback functions for thermal zone */
|
/* Get critical temperature callback functions for thermal zone */
|
||||||
static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
|
static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
|
||||||
unsigned long *temp)
|
int *temp)
|
||||||
{
|
{
|
||||||
/* shutdown zone */
|
/* shutdown zone */
|
||||||
return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
|
return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
|
||||||
|
|
|
@ -164,7 +164,7 @@ err_ret:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp)
|
static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
|
||||||
{
|
{
|
||||||
u32 eax, edx;
|
u32 eax, edx;
|
||||||
struct phy_dev_entry *phy_dev_entry;
|
struct phy_dev_entry *phy_dev_entry;
|
||||||
|
@ -175,7 +175,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem
|
||||||
if (eax & 0x80000000) {
|
if (eax & 0x80000000) {
|
||||||
*temp = phy_dev_entry->tj_max -
|
*temp = phy_dev_entry->tj_max -
|
||||||
((eax >> 16) & 0x7f) * 1000;
|
((eax >> 16) & 0x7f) * 1000;
|
||||||
pr_debug("sys_get_curr_temp %ld\n", *temp);
|
pr_debug("sys_get_curr_temp %d\n", *temp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_get_trip_temp(struct thermal_zone_device *tzd,
|
static int sys_get_trip_temp(struct thermal_zone_device *tzd,
|
||||||
int trip, unsigned long *temp)
|
int trip, int *temp)
|
||||||
{
|
{
|
||||||
u32 eax, edx;
|
u32 eax, edx;
|
||||||
struct phy_dev_entry *phy_dev_entry;
|
struct phy_dev_entry *phy_dev_entry;
|
||||||
|
@ -214,13 +214,13 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd,
|
||||||
*temp = phy_dev_entry->tj_max - thres_reg_value * 1000;
|
*temp = phy_dev_entry->tj_max - thres_reg_value * 1000;
|
||||||
else
|
else
|
||||||
*temp = 0;
|
*temp = 0;
|
||||||
pr_debug("sys_get_trip_temp %ld\n", *temp);
|
pr_debug("sys_get_trip_temp %d\n", *temp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
|
||||||
unsigned long temp)
|
int temp)
|
||||||
{
|
{
|
||||||
u32 l, h;
|
u32 l, h;
|
||||||
struct phy_dev_entry *phy_dev_entry;
|
struct phy_dev_entry *phy_dev_entry;
|
||||||
|
|
|
@ -92,23 +92,19 @@ struct thermal_zone_device_ops {
|
||||||
struct thermal_cooling_device *);
|
struct thermal_cooling_device *);
|
||||||
int (*unbind) (struct thermal_zone_device *,
|
int (*unbind) (struct thermal_zone_device *,
|
||||||
struct thermal_cooling_device *);
|
struct thermal_cooling_device *);
|
||||||
int (*get_temp) (struct thermal_zone_device *, unsigned long *);
|
int (*get_temp) (struct thermal_zone_device *, int *);
|
||||||
int (*get_mode) (struct thermal_zone_device *,
|
int (*get_mode) (struct thermal_zone_device *,
|
||||||
enum thermal_device_mode *);
|
enum thermal_device_mode *);
|
||||||
int (*set_mode) (struct thermal_zone_device *,
|
int (*set_mode) (struct thermal_zone_device *,
|
||||||
enum thermal_device_mode);
|
enum thermal_device_mode);
|
||||||
int (*get_trip_type) (struct thermal_zone_device *, int,
|
int (*get_trip_type) (struct thermal_zone_device *, int,
|
||||||
enum thermal_trip_type *);
|
enum thermal_trip_type *);
|
||||||
int (*get_trip_temp) (struct thermal_zone_device *, int,
|
int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
|
||||||
unsigned long *);
|
int (*set_trip_temp) (struct thermal_zone_device *, int, int);
|
||||||
int (*set_trip_temp) (struct thermal_zone_device *, int,
|
int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
|
||||||
unsigned long);
|
int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
|
||||||
int (*get_trip_hyst) (struct thermal_zone_device *, int,
|
int (*get_crit_temp) (struct thermal_zone_device *, int *);
|
||||||
unsigned long *);
|
int (*set_emul_temp) (struct thermal_zone_device *, int);
|
||||||
int (*set_trip_hyst) (struct thermal_zone_device *, int,
|
|
||||||
unsigned long);
|
|
||||||
int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
|
|
||||||
int (*set_emul_temp) (struct thermal_zone_device *, unsigned long);
|
|
||||||
int (*get_trend) (struct thermal_zone_device *, int,
|
int (*get_trend) (struct thermal_zone_device *, int,
|
||||||
enum thermal_trend *);
|
enum thermal_trend *);
|
||||||
int (*notify) (struct thermal_zone_device *, int,
|
int (*notify) (struct thermal_zone_device *, int,
|
||||||
|
@ -332,9 +328,9 @@ struct thermal_genl_event {
|
||||||
* temperature.
|
* temperature.
|
||||||
*/
|
*/
|
||||||
struct thermal_zone_of_device_ops {
|
struct thermal_zone_of_device_ops {
|
||||||
int (*get_temp)(void *, long *);
|
int (*get_temp)(void *, int *);
|
||||||
int (*get_trend)(void *, long *);
|
int (*get_trend)(void *, long *);
|
||||||
int (*set_emul_temp)(void *, unsigned long);
|
int (*set_emul_temp)(void *, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -406,7 +402,7 @@ thermal_of_cooling_device_register(struct device_node *np, char *, void *,
|
||||||
const struct thermal_cooling_device_ops *);
|
const struct thermal_cooling_device_ops *);
|
||||||
void thermal_cooling_device_unregister(struct thermal_cooling_device *);
|
void thermal_cooling_device_unregister(struct thermal_cooling_device *);
|
||||||
struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
|
struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
|
||||||
int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp);
|
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
|
||||||
|
|
||||||
int get_tz_trend(struct thermal_zone_device *, int);
|
int get_tz_trend(struct thermal_zone_device *, int);
|
||||||
struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
|
struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
|
||||||
|
@ -457,7 +453,7 @@ static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
|
||||||
const char *name)
|
const char *name)
|
||||||
{ return ERR_PTR(-ENODEV); }
|
{ return ERR_PTR(-ENODEV); }
|
||||||
static inline int thermal_zone_get_temp(
|
static inline int thermal_zone_get_temp(
|
||||||
struct thermal_zone_device *tz, unsigned long *temp)
|
struct thermal_zone_device *tz, int *temp)
|
||||||
{ return -ENODEV; }
|
{ return -ENODEV; }
|
||||||
static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
|
static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
|
||||||
{ return -ENODEV; }
|
{ return -ENODEV; }
|
||||||
|
|
|
@ -11,7 +11,7 @@ TRACE_EVENT(thermal_power_allocator,
|
||||||
u32 total_req_power, u32 *granted_power,
|
u32 total_req_power, u32 *granted_power,
|
||||||
u32 total_granted_power, size_t num_actors,
|
u32 total_granted_power, size_t num_actors,
|
||||||
u32 power_range, u32 max_allocatable_power,
|
u32 power_range, u32 max_allocatable_power,
|
||||||
unsigned long current_temp, s32 delta_temp),
|
int current_temp, s32 delta_temp),
|
||||||
TP_ARGS(tz, req_power, total_req_power, granted_power,
|
TP_ARGS(tz, req_power, total_req_power, granted_power,
|
||||||
total_granted_power, num_actors, power_range,
|
total_granted_power, num_actors, power_range,
|
||||||
max_allocatable_power, current_temp, delta_temp),
|
max_allocatable_power, current_temp, delta_temp),
|
||||||
|
@ -24,7 +24,7 @@ TRACE_EVENT(thermal_power_allocator,
|
||||||
__field(size_t, num_actors )
|
__field(size_t, num_actors )
|
||||||
__field(u32, power_range )
|
__field(u32, power_range )
|
||||||
__field(u32, max_allocatable_power )
|
__field(u32, max_allocatable_power )
|
||||||
__field(unsigned long, current_temp )
|
__field(int, current_temp )
|
||||||
__field(s32, delta_temp )
|
__field(s32, delta_temp )
|
||||||
),
|
),
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
|
@ -42,7 +42,7 @@ TRACE_EVENT(thermal_power_allocator,
|
||||||
__entry->delta_temp = delta_temp;
|
__entry->delta_temp = delta_temp;
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%lu delta_temperature=%d",
|
TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d",
|
||||||
__entry->tz_id,
|
__entry->tz_id,
|
||||||
__print_array(__get_dynamic_array(req_power),
|
__print_array(__get_dynamic_array(req_power),
|
||||||
__entry->num_actors, 4),
|
__entry->num_actors, 4),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче