staging: ti-soc-thermal: rename symbols to use better prefix

As this driver has been renamed to cope with the chips it
is supposed to support, this patch also changes the symbol
names to use a proper prefix, so it is not suggestive that
this driver supports only OMAP devices.

Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Benoit <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Eduardo Valentin 2013-03-19 10:54:21 -04:00 committed by Greg Kroah-Hartman
parent 097ca6a347
commit 03e859d344
6 changed files with 420 additions and 431 deletions

View File

@ -66,17 +66,17 @@ omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
};
/* OMAP4430 data */
const struct omap_bandgap_data omap4430_data = {
.features = OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_POWER_SWITCH,
const struct ti_bandgap_data omap4430_data = {
.features = TI_BANDGAP_FEATURE_MODE_CONFIG |
TI_BANDGAP_FEATURE_CLK_CTRL |
TI_BANDGAP_FEATURE_POWER_SWITCH,
.fclock_name = "bandgap_fclk",
.div_ck_name = "bandgap_fclk",
.conv_table = omap4430_adc_to_temp,
.adc_start_val = OMAP4430_ADC_START_VALUE,
.adc_end_val = OMAP4430_ADC_END_VALUE,
.expose_sensor = omap_thermal_expose_sensor,
.remove_sensor = omap_thermal_remove_sensor,
.expose_sensor = ti_thermal_expose_sensor,
.remove_sensor = ti_thermal_remove_sensor,
.sensors = {
{
.registers = &omap4430_mpu_temp_sensor_registers,
@ -86,8 +86,8 @@ const struct omap_bandgap_data omap4430_data = {
.constant = 20000,
.slope_pcb = 0,
.constant_pcb = 20000,
.register_cooling = omap_thermal_register_cpu_cooling,
.unregister_cooling = omap_thermal_unregister_cpu_cooling,
.register_cooling = ti_thermal_register_cpu_cooling,
.unregister_cooling = ti_thermal_unregister_cpu_cooling,
},
},
.sensor_count = 1,
@ -201,21 +201,21 @@ omap4460_adc_to_temp[OMAP4460_ADC_END_VALUE - OMAP4460_ADC_START_VALUE + 1] = {
};
/* OMAP4460 data */
const struct omap_bandgap_data omap4460_data = {
.features = OMAP_BANDGAP_FEATURE_TSHUT |
OMAP_BANDGAP_FEATURE_TSHUT_CONFIG |
OMAP_BANDGAP_FEATURE_TALERT |
OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_POWER_SWITCH |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_COUNTER,
const struct ti_bandgap_data omap4460_data = {
.features = TI_BANDGAP_FEATURE_TSHUT |
TI_BANDGAP_FEATURE_TSHUT_CONFIG |
TI_BANDGAP_FEATURE_TALERT |
TI_BANDGAP_FEATURE_MODE_CONFIG |
TI_BANDGAP_FEATURE_POWER_SWITCH |
TI_BANDGAP_FEATURE_CLK_CTRL |
TI_BANDGAP_FEATURE_COUNTER,
.fclock_name = "bandgap_ts_fclk",
.div_ck_name = "div_ts_ck",
.conv_table = omap4460_adc_to_temp,
.adc_start_val = OMAP4460_ADC_START_VALUE,
.adc_end_val = OMAP4460_ADC_END_VALUE,
.expose_sensor = omap_thermal_expose_sensor,
.remove_sensor = omap_thermal_remove_sensor,
.expose_sensor = ti_thermal_expose_sensor,
.remove_sensor = ti_thermal_remove_sensor,
.sensors = {
{
.registers = &omap4460_mpu_temp_sensor_registers,
@ -225,29 +225,29 @@ const struct omap_bandgap_data omap4460_data = {
.constant = OMAP_GRADIENT_CONST_4460,
.slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_4460,
.constant_pcb = OMAP_GRADIENT_CONST_W_PCB_4460,
.register_cooling = omap_thermal_register_cpu_cooling,
.unregister_cooling = omap_thermal_unregister_cpu_cooling,
.register_cooling = ti_thermal_register_cpu_cooling,
.unregister_cooling = ti_thermal_unregister_cpu_cooling,
},
},
.sensor_count = 1,
};
/* OMAP4470 data */
const struct omap_bandgap_data omap4470_data = {
.features = OMAP_BANDGAP_FEATURE_TSHUT |
OMAP_BANDGAP_FEATURE_TSHUT_CONFIG |
OMAP_BANDGAP_FEATURE_TALERT |
OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_POWER_SWITCH |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_COUNTER,
const struct ti_bandgap_data omap4470_data = {
.features = TI_BANDGAP_FEATURE_TSHUT |
TI_BANDGAP_FEATURE_TSHUT_CONFIG |
TI_BANDGAP_FEATURE_TALERT |
TI_BANDGAP_FEATURE_MODE_CONFIG |
TI_BANDGAP_FEATURE_POWER_SWITCH |
TI_BANDGAP_FEATURE_CLK_CTRL |
TI_BANDGAP_FEATURE_COUNTER,
.fclock_name = "bandgap_ts_fclk",
.div_ck_name = "div_ts_ck",
.conv_table = omap4460_adc_to_temp,
.adc_start_val = OMAP4460_ADC_START_VALUE,
.adc_end_val = OMAP4460_ADC_END_VALUE,
.expose_sensor = omap_thermal_expose_sensor,
.remove_sensor = omap_thermal_remove_sensor,
.expose_sensor = ti_thermal_expose_sensor,
.remove_sensor = ti_thermal_remove_sensor,
.sensors = {
{
.registers = &omap4460_mpu_temp_sensor_registers,
@ -257,8 +257,8 @@ const struct omap_bandgap_data omap4470_data = {
.constant = OMAP_GRADIENT_CONST_4470,
.slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_4470,
.constant_pcb = OMAP_GRADIENT_CONST_W_PCB_4470,
.register_cooling = omap_thermal_register_cpu_cooling,
.unregister_cooling = omap_thermal_unregister_cpu_cooling,
.register_cooling = ti_thermal_register_cpu_cooling,
.unregister_cooling = ti_thermal_unregister_cpu_cooling,
},
},
.sensor_count = 1,

View File

@ -312,24 +312,24 @@ omap5430_adc_to_temp[
/* OMAP54xx ES2.0 data */
/* TODO : Need to update the slope/constant for ES2.0 silicon */
const struct omap_bandgap_data omap5430_data = {
.features = OMAP_BANDGAP_FEATURE_TSHUT_CONFIG |
OMAP_BANDGAP_FEATURE_FREEZE_BIT |
OMAP_BANDGAP_FEATURE_TALERT,
const struct ti_bandgap_data omap5430_data = {
.features = TI_BANDGAP_FEATURE_TSHUT_CONFIG |
TI_BANDGAP_FEATURE_FREEZE_BIT |
TI_BANDGAP_FEATURE_TALERT,
.fclock_name = "l3instr_ts_gclk_div",
.div_ck_name = "l3instr_ts_gclk_div",
.conv_table = omap5430_adc_to_temp,
.adc_start_val = OMAP5430_ADC_START_VALUE,
.adc_end_val = OMAP5430_ADC_END_VALUE,
.expose_sensor = omap_thermal_expose_sensor,
.remove_sensor = omap_thermal_remove_sensor,
.expose_sensor = ti_thermal_expose_sensor,
.remove_sensor = ti_thermal_remove_sensor,
.sensors = {
{
.registers = &omap5430_mpu_temp_sensor_registers,
.ts_data = &omap5430_mpu_temp_sensor_data,
.domain = "cpu",
.register_cooling = omap_thermal_register_cpu_cooling,
.unregister_cooling = omap_thermal_unregister_cpu_cooling,
.register_cooling = ti_thermal_register_cpu_cooling,
.unregister_cooling = ti_thermal_unregister_cpu_cooling,
.slope = OMAP_GRADIENT_SLOPE_5430_CPU,
.constant = OMAP_GRADIENT_CONST_5430_CPU,
.slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU,

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,8 @@
* 02110-1301 USA
*
*/
#ifndef __OMAP_BANDGAP_H
#define __OMAP_BANDGAP_H
#ifndef __TI_BANDGAP_H
#define __TI_BANDGAP_H
#include <linux/spinlock.h>
#include <linux/types.h>
@ -30,22 +30,22 @@
/**
* DOC: bandgap driver data structure
* ==================================
* +---------------------+ +-----------------+
* | struct omap_bandgap |-->| struct device * |
* +----------+----------+ +-----------------+
* +-------------------+ +-----------------+
* | struct ti_bandgap |-->| struct device * |
* +----------+--------+ +-----------------+
* |
* |
* V
* +--------------------------+
* | struct omap_bandgap_data |
* +--------------------------+
* +------------------------+
* | struct ti_bandgap_data |
* +------------------------+
* |
* |
* * (Array of)
* +------------+------------------------------------------------------+
* | +----------+--------------+ +-------------------------+ |
* | | struct omap_temp_sensor |-->| struct temp_sensor_data | |
* | +-------------------------+ +------------+------------+ |
* | +----------+------------+ +-------------------------+ |
* | | struct ti_temp_sensor |-->| struct temp_sensor_data | |
* | +-----------------------+ +------------+------------+ |
* | | |
* | +--------------------------+ |
* | V V |
@ -56,7 +56,7 @@
* +-------------------------------------------------------------------+
*
* Above is a simple diagram describing how the data structure below
* are organized. For each bandgap device there should be a omap_bandgap_data
* are organized. For each bandgap device there should be a ti_bandgap_data
* containing the device instance configuration, as well as, an array of
* sensors, representing every sensor instance present in this bandgap.
*/
@ -187,16 +187,16 @@ struct temp_sensor_data {
u32 update_int2; /* not used */
};
struct omap_bandgap_data;
struct ti_bandgap_data;
/**
* struct omap_bandgap - bandgap device structure
* struct ti_bandgap - bandgap device structure
* @dev: struct device pointer
* @base: io memory base address
* @conf: struct with bandgap configuration set (# sensors, conv_table, etc)
* @fclock: pointer to functional clock of temperature sensor
* @div_clk: pointer to divider clock of temperature sensor fclk
* @bg_mutex: mutex for omap_bandgap structure
* @bg_mutex: mutex for ti_bandgap structure
* @irq: MPU IRQ number for thermal alert
* @tshut_gpio: GPIO where Tshut signal is routed
* @clk_rate: Holds current clock rate
@ -205,10 +205,10 @@ struct omap_bandgap_data;
* It holds most of the dynamic stuff. Configurations and sensor specific
* entries are inside the @conf structure.
*/
struct omap_bandgap {
struct ti_bandgap {
struct device *dev;
void __iomem *base;
struct omap_bandgap_data *conf;
struct ti_bandgap_data *conf;
struct clk *fclock;
struct clk *div_clk;
spinlock_t lock; /* shields this struct */
@ -237,7 +237,7 @@ struct temp_sensor_regval {
};
/**
* struct omap_temp_sensor - bandgap temperature sensor configuration data
* struct ti_temp_sensor - bandgap temperature sensor configuration data
* @ts_data: pointer to struct with thresholds, limits of temperature sensor
* @registers: pointer to the list of register offsets and bitfields
* @regval: temperature sensor register values
@ -258,7 +258,7 @@ struct temp_sensor_regval {
* assess the gradient from hotspot, how to cooldown the domain when sensor
* reports too hot temperature.
*/
struct omap_temp_sensor {
struct ti_temp_sensor {
struct temp_sensor_data *ts_data;
struct temp_sensor_registers *registers;
struct temp_sensor_regval regval;
@ -269,56 +269,56 @@ struct omap_temp_sensor {
const int slope_pcb;
const int constant_pcb;
void *data;
int (*register_cooling)(struct omap_bandgap *bgp, int id);
int (*unregister_cooling)(struct omap_bandgap *bgp, int id);
int (*register_cooling)(struct ti_bandgap *bgp, int id);
int (*unregister_cooling)(struct ti_bandgap *bgp, int id);
};
/**
* DOC: omap bandgap feature types
*
* OMAP_BANDGAP_FEATURE_TSHUT - used when the thermal shutdown signal output
* TI_BANDGAP_FEATURE_TSHUT - used when the thermal shutdown signal output
* of a bandgap device instance is routed to the processor. This means
* the system must react and perform the shutdown by itself (handle an
* IRQ, for instance).
*
* OMAP_BANDGAP_FEATURE_TSHUT_CONFIG - used when the bandgap device has control
* TI_BANDGAP_FEATURE_TSHUT_CONFIG - used when the bandgap device has control
* over the thermal shutdown configuration. This means that the thermal
* shutdown thresholds are programmable, for instance.
*
* OMAP_BANDGAP_FEATURE_TALERT - used when the bandgap device instance outputs
* TI_BANDGAP_FEATURE_TALERT - used when the bandgap device instance outputs
* a signal representing violation of programmable alert thresholds.
*
* OMAP_BANDGAP_FEATURE_MODE_CONFIG - used when it is possible to choose which
* TI_BANDGAP_FEATURE_MODE_CONFIG - used when it is possible to choose which
* mode, continuous or one shot, the bandgap device instance will operate.
*
* OMAP_BANDGAP_FEATURE_COUNTER - used when the bandgap device instance allows
* TI_BANDGAP_FEATURE_COUNTER - used when the bandgap device instance allows
* programming the update interval of its internal state machine.
*
* OMAP_BANDGAP_FEATURE_POWER_SWITCH - used when the bandgap device allows
* TI_BANDGAP_FEATURE_POWER_SWITCH - used when the bandgap device allows
* itself to be switched on/off.
*
* OMAP_BANDGAP_FEATURE_CLK_CTRL - used when the clocks feeding the bandgap
* TI_BANDGAP_FEATURE_CLK_CTRL - used when the clocks feeding the bandgap
* device are gateable or not.
*
* OMAP_BANDGAP_FEATURE_FREEZE_BIT - used when the bandgap device features
* TI_BANDGAP_FEATURE_FREEZE_BIT - used when the bandgap device features
* a history buffer that its update can be freezed/unfreezed.
*
* OMAP_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a
* TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a
* specific feature (above) or not. Return non-zero, if yes.
*/
#define OMAP_BANDGAP_FEATURE_TSHUT BIT(0)
#define OMAP_BANDGAP_FEATURE_TSHUT_CONFIG BIT(1)
#define OMAP_BANDGAP_FEATURE_TALERT BIT(2)
#define OMAP_BANDGAP_FEATURE_MODE_CONFIG BIT(3)
#define OMAP_BANDGAP_FEATURE_COUNTER BIT(4)
#define OMAP_BANDGAP_FEATURE_POWER_SWITCH BIT(5)
#define OMAP_BANDGAP_FEATURE_CLK_CTRL BIT(6)
#define OMAP_BANDGAP_FEATURE_FREEZE_BIT BIT(7)
#define OMAP_BANDGAP_HAS(b, f) \
((b)->conf->features & OMAP_BANDGAP_FEATURE_ ## f)
#define TI_BANDGAP_FEATURE_TSHUT BIT(0)
#define TI_BANDGAP_FEATURE_TSHUT_CONFIG BIT(1)
#define TI_BANDGAP_FEATURE_TALERT BIT(2)
#define TI_BANDGAP_FEATURE_MODE_CONFIG BIT(3)
#define TI_BANDGAP_FEATURE_COUNTER BIT(4)
#define TI_BANDGAP_FEATURE_POWER_SWITCH BIT(5)
#define TI_BANDGAP_FEATURE_CLK_CTRL BIT(6)
#define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7)
#define TI_BANDGAP_HAS(b, f) \
((b)->conf->features & TI_BANDGAP_FEATURE_ ## f)
/**
* struct omap_bandgap_data - omap bandgap data configuration structure
* struct ti_bandgap_data - omap bandgap data configuration structure
* @features: a bitwise flag set to describe the device features
* @conv_table: Pointer to ADC to temperature conversion table
* @adc_start_val: ADC conversion table starting value
@ -337,7 +337,7 @@ struct omap_temp_sensor {
* their configuration representation, and how to export and unexport them to
* a thermal API.
*/
struct omap_bandgap_data {
struct ti_bandgap_data {
unsigned int features;
const int *conv_table;
u32 adc_start_val;
@ -345,32 +345,31 @@ struct omap_bandgap_data {
char *fclock_name;
char *div_ck_name;
int sensor_count;
int (*report_temperature)(struct omap_bandgap *bgp, int id);
int (*expose_sensor)(struct omap_bandgap *bgp, int id, char *domain);
int (*remove_sensor)(struct omap_bandgap *bgp, int id);
int (*report_temperature)(struct ti_bandgap *bgp, int id);
int (*expose_sensor)(struct ti_bandgap *bgp, int id, char *domain);
int (*remove_sensor)(struct ti_bandgap *bgp, int id);
/* this needs to be at the end */
struct omap_temp_sensor sensors[];
struct ti_temp_sensor sensors[];
};
int omap_bandgap_read_thot(struct omap_bandgap *bgp, int id, int *thot);
int omap_bandgap_write_thot(struct omap_bandgap *bgp, int id, int val);
int omap_bandgap_read_tcold(struct omap_bandgap *bgp, int id, int *tcold);
int omap_bandgap_write_tcold(struct omap_bandgap *bgp, int id, int val);
int omap_bandgap_read_update_interval(struct omap_bandgap *bgp, int id,
int *interval);
int omap_bandgap_write_update_interval(struct omap_bandgap *bgp, int id,
u32 interval);
int omap_bandgap_read_temperature(struct omap_bandgap *bgp, int id,
int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot);
int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold);
int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
int *interval);
int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id,
u32 interval);
int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id,
int *temperature);
int omap_bandgap_set_sensor_data(struct omap_bandgap *bgp, int id,
void *data);
void *omap_bandgap_get_sensor_data(struct omap_bandgap *bgp, int id);
int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
#ifdef CONFIG_OMAP4_THERMAL
extern const struct omap_bandgap_data omap4430_data;
extern const struct omap_bandgap_data omap4460_data;
extern const struct omap_bandgap_data omap4470_data;
extern const struct ti_bandgap_data omap4430_data;
extern const struct ti_bandgap_data omap4460_data;
extern const struct ti_bandgap_data omap4470_data;
#else
#define omap4430_data NULL
#define omap4460_data NULL
@ -378,7 +377,7 @@ extern const struct omap_bandgap_data omap4470_data;
#endif
#ifdef CONFIG_OMAP5_THERMAL
extern const struct omap_bandgap_data omap5430_data;
extern const struct ti_bandgap_data omap5430_data;
#else
#define omap5430_data NULL
#endif

View File

@ -36,33 +36,33 @@
#include "ti-bandgap.h"
/* common data structures */
struct omap_thermal_data {
struct thermal_zone_device *omap_thermal;
struct ti_thermal_data {
struct thermal_zone_device *ti_thermal;
struct thermal_cooling_device *cool_dev;
struct omap_bandgap *bgp;
struct ti_bandgap *bgp;
enum thermal_device_mode mode;
struct work_struct thermal_wq;
int sensor_id;
};
static void omap_thermal_work(struct work_struct *work)
static void ti_thermal_work(struct work_struct *work)
{
struct omap_thermal_data *data = container_of(work,
struct omap_thermal_data, thermal_wq);
struct ti_thermal_data *data = container_of(work,
struct ti_thermal_data, thermal_wq);
thermal_zone_device_update(data->omap_thermal);
thermal_zone_device_update(data->ti_thermal);
dev_dbg(&data->omap_thermal->device, "updated thermal zone %s\n",
data->omap_thermal->type);
dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n",
data->ti_thermal->type);
}
/**
* omap_thermal_hotspot_temperature - returns sensor extrapolated temperature
* ti_thermal_hotspot_temperature - returns sensor extrapolated temperature
* @t: omap sensor temperature
* @s: omap sensor slope value
* @c: omap sensor const value
*/
static inline int omap_thermal_hotspot_temperature(int t, int s, int c)
static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
{
int delta = t * s / 1000 + c;
@ -74,12 +74,12 @@ static inline int omap_thermal_hotspot_temperature(int t, int s, int c)
/* thermal zone ops */
/* Get temperature callback function for thermal zone*/
static inline int omap_thermal_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
struct omap_thermal_data *data = thermal->devdata;
struct omap_bandgap *bgp;
struct omap_temp_sensor *s;
struct ti_thermal_data *data = thermal->devdata;
struct ti_bandgap *bgp;
struct ti_temp_sensor *s;
int ret, tmp, pcb_temp, slope, constant;
if (!data)
@ -88,7 +88,7 @@ static inline int omap_thermal_get_temp(struct thermal_zone_device *thermal,
bgp = data->bgp;
s = &bgp->conf->sensors[data->sensor_id];
ret = omap_bandgap_read_temperature(bgp, data->sensor_id, &tmp);
ret = ti_bandgap_read_temperature(bgp, data->sensor_id, &tmp);
if (ret)
return ret;
@ -103,16 +103,16 @@ static inline int omap_thermal_get_temp(struct thermal_zone_device *thermal,
slope = s->slope;
constant = s->constant;
}
*temp = omap_thermal_hotspot_temperature(tmp, slope, constant);
*temp = ti_thermal_hotspot_temperature(tmp, slope, constant);
return ret;
}
/* Bind callback functions for thermal zone */
static int omap_thermal_bind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
static int ti_thermal_bind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
{
struct omap_thermal_data *data = thermal->devdata;
struct ti_thermal_data *data = thermal->devdata;
int id;
if (IS_ERR_OR_NULL(data))
@ -132,10 +132,10 @@ static int omap_thermal_bind(struct thermal_zone_device *thermal,
}
/* Unbind callback functions for thermal zone */
static int omap_thermal_unbind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
static int ti_thermal_unbind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
{
struct omap_thermal_data *data = thermal->devdata;
struct ti_thermal_data *data = thermal->devdata;
if (IS_ERR_OR_NULL(data))
return -ENODEV;
@ -149,10 +149,10 @@ static int omap_thermal_unbind(struct thermal_zone_device *thermal,
}
/* Get mode callback functions for thermal zone */
static int omap_thermal_get_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
static int ti_thermal_get_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
{
struct omap_thermal_data *data = thermal->devdata;
struct ti_thermal_data *data = thermal->devdata;
if (data)
*mode = data->mode;
@ -161,38 +161,38 @@ static int omap_thermal_get_mode(struct thermal_zone_device *thermal,
}
/* Set mode callback functions for thermal zone */
static int omap_thermal_set_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode mode)
static int ti_thermal_set_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode mode)
{
struct omap_thermal_data *data = thermal->devdata;
struct ti_thermal_data *data = thermal->devdata;
if (!data->omap_thermal) {
if (!data->ti_thermal) {
dev_notice(&thermal->device, "thermal zone not registered\n");
return 0;
}
mutex_lock(&data->omap_thermal->lock);
mutex_lock(&data->ti_thermal->lock);
if (mode == THERMAL_DEVICE_ENABLED)
data->omap_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
data->ti_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
else
data->omap_thermal->polling_delay = 0;
data->ti_thermal->polling_delay = 0;
mutex_unlock(&data->omap_thermal->lock);
mutex_unlock(&data->ti_thermal->lock);
data->mode = mode;
thermal_zone_device_update(data->omap_thermal);
thermal_zone_device_update(data->ti_thermal);
dev_dbg(&thermal->device, "thermal polling set for duration=%d msec\n",
data->omap_thermal->polling_delay);
data->ti_thermal->polling_delay);
return 0;
}
/* Get trip type callback functions for thermal zone */
static int omap_thermal_get_trip_type(struct thermal_zone_device *thermal,
int trip, enum thermal_trip_type *type)
static int ti_thermal_get_trip_type(struct thermal_zone_device *thermal,
int trip, enum thermal_trip_type *type)
{
if (!omap_thermal_is_valid_trip(trip))
if (!ti_thermal_is_valid_trip(trip))
return -EINVAL;
if (trip + 1 == OMAP_TRIP_NUMBER)
@ -204,41 +204,41 @@ static int omap_thermal_get_trip_type(struct thermal_zone_device *thermal,
}
/* Get trip temperature callback functions for thermal zone */
static int omap_thermal_get_trip_temp(struct thermal_zone_device *thermal,
int trip, unsigned long *temp)
static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
int trip, unsigned long *temp)
{
if (!omap_thermal_is_valid_trip(trip))
if (!ti_thermal_is_valid_trip(trip))
return -EINVAL;
*temp = omap_thermal_get_trip_value(trip);
*temp = ti_thermal_get_trip_value(trip);
return 0;
}
/* Get critical temperature callback functions for thermal zone */
static int omap_thermal_get_crit_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
/* shutdown zone */
return omap_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
}
static struct thermal_zone_device_ops omap_thermal_ops = {
.get_temp = omap_thermal_get_temp,
static struct thermal_zone_device_ops ti_thermal_ops = {
.get_temp = ti_thermal_get_temp,
/* TODO: add .get_trend */
.bind = omap_thermal_bind,
.unbind = omap_thermal_unbind,
.get_mode = omap_thermal_get_mode,
.set_mode = omap_thermal_set_mode,
.get_trip_type = omap_thermal_get_trip_type,
.get_trip_temp = omap_thermal_get_trip_temp,
.get_crit_temp = omap_thermal_get_crit_temp,
.bind = ti_thermal_bind,
.unbind = ti_thermal_unbind,
.get_mode = ti_thermal_get_mode,
.set_mode = ti_thermal_set_mode,
.get_trip_type = ti_thermal_get_trip_type,
.get_trip_temp = ti_thermal_get_trip_temp,
.get_crit_temp = ti_thermal_get_crit_temp,
};
static struct omap_thermal_data
*omap_thermal_build_data(struct omap_bandgap *bgp, int id)
static struct ti_thermal_data
*ti_thermal_build_data(struct ti_bandgap *bgp, int id)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = devm_kzalloc(bgp->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
@ -248,69 +248,69 @@ static struct omap_thermal_data
data->sensor_id = id;
data->bgp = bgp;
data->mode = THERMAL_DEVICE_ENABLED;
INIT_WORK(&data->thermal_wq, omap_thermal_work);
INIT_WORK(&data->thermal_wq, ti_thermal_work);
return data;
}
int omap_thermal_expose_sensor(struct omap_bandgap *bgp, int id,
char *domain)
int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
char *domain)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = omap_bandgap_get_sensor_data(bgp, id);
data = ti_bandgap_get_sensor_data(bgp, id);
if (IS_ERR_OR_NULL(data))
data = omap_thermal_build_data(bgp, id);
data = ti_thermal_build_data(bgp, id);
if (!data)
return -EINVAL;
/* TODO: remove TC1 TC2 */
/* Create thermal zone */
data->omap_thermal = thermal_zone_device_register(domain,
OMAP_TRIP_NUMBER, 0, data, &omap_thermal_ops,
data->ti_thermal = thermal_zone_device_register(domain,
OMAP_TRIP_NUMBER, 0, data, &ti_thermal_ops,
NULL, FAST_TEMP_MONITORING_RATE,
FAST_TEMP_MONITORING_RATE);
if (IS_ERR_OR_NULL(data->omap_thermal)) {
if (IS_ERR_OR_NULL(data->ti_thermal)) {
dev_err(bgp->dev, "thermal zone device is NULL\n");
return PTR_ERR(data->omap_thermal);
return PTR_ERR(data->ti_thermal);
}
data->omap_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
omap_bandgap_set_sensor_data(bgp, id, data);
data->ti_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
ti_bandgap_set_sensor_data(bgp, id, data);
return 0;
}
int omap_thermal_remove_sensor(struct omap_bandgap *bgp, int id)
int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = omap_bandgap_get_sensor_data(bgp, id);
data = ti_bandgap_get_sensor_data(bgp, id);
thermal_zone_device_unregister(data->omap_thermal);
thermal_zone_device_unregister(data->ti_thermal);
return 0;
}
int omap_thermal_report_sensor_temperature(struct omap_bandgap *bgp, int id)
int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = omap_bandgap_get_sensor_data(bgp, id);
data = ti_bandgap_get_sensor_data(bgp, id);
schedule_work(&data->thermal_wq);
return 0;
}
int omap_thermal_register_cpu_cooling(struct omap_bandgap *bgp, int id)
int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = omap_bandgap_get_sensor_data(bgp, id);
data = ti_bandgap_get_sensor_data(bgp, id);
if (IS_ERR_OR_NULL(data))
data = omap_thermal_build_data(bgp, id);
data = ti_thermal_build_data(bgp, id);
if (!data)
return -EINVAL;
@ -322,16 +322,16 @@ int omap_thermal_register_cpu_cooling(struct omap_bandgap *bgp, int id)
"Failed to register cpufreq cooling device\n");
return PTR_ERR(data->cool_dev);
}
omap_bandgap_set_sensor_data(bgp, id, data);
ti_bandgap_set_sensor_data(bgp, id, data);
return 0;
}
int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bgp, int id)
int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
{
struct omap_thermal_data *data;
struct ti_thermal_data *data;
data = omap_bandgap_get_sensor_data(bgp, id);
data = ti_bandgap_get_sensor_data(bgp, id);
cpufreq_cooling_unregister(data->cool_dev);
return 0;

View File

@ -60,47 +60,45 @@
/* helper macros */
/**
* omap_thermal_get_trip_value - returns trip temperature based on index
* ti_thermal_get_trip_value - returns trip temperature based on index
* @i: trip index
*/
#define omap_thermal_get_trip_value(i) \
#define ti_thermal_get_trip_value(i) \
(OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
/**
* omap_thermal_is_valid_trip - check for trip index
* ti_thermal_is_valid_trip - check for trip index
* @i: trip index
*/
#define omap_thermal_is_valid_trip(trip) \
#define ti_thermal_is_valid_trip(trip) \
((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
#ifdef CONFIG_TI_THERMAL
int omap_thermal_expose_sensor(struct omap_bandgap *bgp, int id,
char *domain);
int omap_thermal_remove_sensor(struct omap_bandgap *bgp, int id);
int omap_thermal_register_cpu_cooling(struct omap_bandgap *bgp, int id);
int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bgp, int id);
int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
#else
static inline
int omap_thermal_expose_sensor(struct omap_bandgap *bgp, int id,
char *domain)
int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
{
return 0;
}
static inline
int omap_thermal_remove_sensor(struct omap_bandgap *bgp, int id)
int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
{
return 0;
}
static inline
int omap_thermal_register_cpu_cooling(struct omap_bandgap *bgp, int id)
int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
{
return 0;
}
static inline
int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bgp, int id)
int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
{
return 0;
}