Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374601
b: refs/heads/master
c: 79d2640
h: refs/heads/master
i:
  374599: f934331
v: v3
  • Loading branch information
Eduardo Valentin authored and Zhang Rui committed Apr 27, 2013
1 parent 384fca0 commit ad07b9e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 86 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09681dfa554743041a3dbd9ca87a320c908c37f4
refs/heads/master: 79d264016ac011b74497b553022d2fc45bf9d9f2
16 changes: 4 additions & 12 deletions trunk/Documentation/thermal/sysfs-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ temperature) and throttle appropriate devices.
1. thermal sysfs driver interface functions

1.1 thermal zone device interface
1.1.1 struct thermal_zone_device *thermal_zone_device_register(char *type,
1.1.1 struct thermal_zone_device *thermal_zone_device_register(char *name,
int trips, int mask, void *devdata,
struct thermal_zone_device_ops *ops,
const struct thermal_zone_params *tzp,
int passive_delay, int polling_delay))
struct thermal_zone_device_ops *ops)

This interface function adds a new thermal zone device (sensor) to
/sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the
thermal cooling devices registered at the same time.

type: the thermal zone type.
name: the thermal zone name.
trips: the total number of trip points this thermal zone supports.
mask: Bit string: If 'n'th bit is set, then trip point 'n' is writeable.
devdata: device private data
Expand All @@ -59,12 +57,6 @@ temperature) and throttle appropriate devices.
will be fired.
.set_emul_temp: set the emulation temperature which helps in debugging
different threshold temperature points.
tzp: thermal zone platform parameters.
passive_delay: number of milliseconds to wait between polls when
performing passive cooling.
polling_delay: number of milliseconds to wait between polls when checking
whether trip points have been crossed (0 for interrupt driven systems).


1.1.2 void thermal_zone_device_unregister(struct thermal_zone_device *tz)

Expand Down Expand Up @@ -375,7 +367,7 @@ This function returns the thermal_instance corresponding to a given
{thermal_zone, cooling_device, trip_point} combination. Returns NULL
if such an instance does not exist.

5.3:thermal_notify_framework:
5.3:notify_thermal_framework:
This function handles the trip events from sensor drivers. It starts
throttling the cooling devices according to the policy configured.
For CRITICAL and HOT trip points, this notifies the respective drivers,
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,13 @@ static int get_property(unsigned int cpu, unsigned long input,
int descend = -1;
struct cpufreq_frequency_table *table =
cpufreq_frequency_get_table(cpu);

if (!output)
return -EINVAL;

if (!table)
return -EINVAL;


for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
/* ignore invalid entries */
if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/thermal/db8500_cpufreq_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int db8500_cpufreq_cooling_probe(struct platform_device *pdev)
cpumask_set_cpu(0, &mask_val);
cdev = cpufreq_cooling_register(&mask_val);

if (IS_ERR(cdev)) {
if (IS_ERR_OR_NULL(cdev)) {
dev_err(&pdev->dev, "Failed to register cooling device\n");
return PTR_ERR(cdev);
}
Expand Down
14 changes: 3 additions & 11 deletions trunk/drivers/thermal/exynos_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,6 @@ static const struct of_device_id exynos_tmu_match[] = {
.compatible = "samsung,exynos4210-tmu",
.data = (void *)EXYNOS4210_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos4412-tmu",
.data = (void *)EXYNOS_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos5250-tmu",
.data = (void *)EXYNOS_TMU_DRV_DATA,
Expand Down Expand Up @@ -941,16 +937,12 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return ret;
}

data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
data->clk = clk_get(NULL, "tmu_apbif");
if (IS_ERR(data->clk)) {
dev_err(&pdev->dev, "Failed to get clock\n");
return PTR_ERR(data->clk);
}

ret = clk_prepare(data->clk);
if (ret)
return ret;

if (pdata->type == SOC_ARCH_EXYNOS ||
pdata->type == SOC_ARCH_EXYNOS4210)
data->soc = pdata->type;
Expand Down Expand Up @@ -1002,7 +994,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return 0;
err_clk:
platform_set_drvdata(pdev, NULL);
clk_unprepare(data->clk);
clk_put(data->clk);
return ret;
}

Expand All @@ -1014,7 +1006,7 @@ static int exynos_tmu_remove(struct platform_device *pdev)

exynos_unregister_thermal();

clk_unprepare(data->clk);
clk_put(data->clk);

platform_set_drvdata(pdev, NULL);

Expand Down
82 changes: 24 additions & 58 deletions trunk/drivers/thermal/thermal_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

MODULE_AUTHOR("Zhang Rui");
MODULE_DESCRIPTION("Generic thermal management sysfs support");
MODULE_LICENSE("GPL v2");
MODULE_LICENSE("GPL");

static DEFINE_IDR(thermal_tz_idr);
static DEFINE_IDR(thermal_cdev_idr);
Expand Down Expand Up @@ -388,7 +388,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
enum thermal_trip_type type;
#endif

if (!tz || IS_ERR(tz))
if (IS_ERR_OR_NULL(tz))
goto exit;

mutex_lock(&tz->lock);
Expand Down Expand Up @@ -446,7 +446,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
for (count = 0; count < tz->trips; count++)
handle_thermal_trip(tz, count);
}
EXPORT_SYMBOL_GPL(thermal_zone_device_update);
EXPORT_SYMBOL(thermal_zone_device_update);

static void thermal_zone_device_check(struct work_struct *work)
{
Expand Down Expand Up @@ -1109,23 +1109,13 @@ thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
#endif

/**
* thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
* @tz: pointer to struct thermal_zone_device
* thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone
* @tz: thermal zone device
* @trip: indicates which trip point the cooling devices is
* associated with in this thermal zone.
* @cdev: pointer to struct thermal_cooling_device
* @upper: the Maximum cooling state for this trip point.
* THERMAL_NO_LIMIT means no upper limit,
* and the cooling device can be in max_state.
* @lower: the Minimum cooling state can be used for this trip point.
* THERMAL_NO_LIMIT means no lower limit,
* and the cooling device can be in cooling state 0.
* @cdev: thermal cooling device
*
* This interface function bind a thermal cooling device to the certain trip
* point of a thermal zone device.
* This function is usually called in the thermal zone device .bind callback.
*
* Return: 0 on success, the proper error value otherwise.
*/
int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
int trip,
Expand Down Expand Up @@ -1219,21 +1209,16 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
kfree(dev);
return result;
}
EXPORT_SYMBOL_GPL(thermal_zone_bind_cooling_device);
EXPORT_SYMBOL(thermal_zone_bind_cooling_device);

/**
* thermal_zone_unbind_cooling_device() - unbind a cooling device from a
* thermal zone.
* @tz: pointer to a struct thermal_zone_device.
* thermal_zone_unbind_cooling_device - unbind a cooling device from a thermal zone
* @tz: thermal zone device
* @trip: indicates which trip point the cooling devices is
* associated with in this thermal zone.
* @cdev: pointer to a struct thermal_cooling_device.
* @cdev: thermal cooling device
*
* This interface function unbind a thermal cooling device from the certain
* trip point of a thermal zone device.
* This function is usually called in the thermal zone device .unbind callback.
*
* Return: 0 on success, the proper error value otherwise.
*/
int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
int trip,
Expand Down Expand Up @@ -1264,7 +1249,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
kfree(pos);
return 0;
}
EXPORT_SYMBOL_GPL(thermal_zone_unbind_cooling_device);
EXPORT_SYMBOL(thermal_zone_unbind_cooling_device);

static void thermal_release(struct device *dev)
{
Expand All @@ -1287,17 +1272,10 @@ static struct class thermal_class = {
};

/**
* thermal_cooling_device_register() - register a new thermal cooling device
* thermal_cooling_device_register - register a new thermal cooling device
* @type: the thermal cooling device type.
* @devdata: device private data.
* @ops: standard thermal cooling devices callbacks.
*
* This interface function adds a new thermal cooling device (fan/processor/...)
* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself
* to all the thermal zone devices registered at the same time.
*
* Return: a pointer to the created struct thermal_cooling_device or an
* ERR_PTR. Caller must check return value with IS_ERR*() helpers.
*/
struct thermal_cooling_device *
thermal_cooling_device_register(char *type, void *devdata,
Expand All @@ -1323,7 +1301,7 @@ thermal_cooling_device_register(char *type, void *devdata,
return ERR_PTR(result);
}

strlcpy(cdev->type, type ? : "", sizeof(cdev->type));
strcpy(cdev->type, type ? : "");
mutex_init(&cdev->lock);
INIT_LIST_HEAD(&cdev->thermal_instances);
cdev->ops = ops;
Expand Down Expand Up @@ -1368,7 +1346,7 @@ thermal_cooling_device_register(char *type, void *devdata,
device_unregister(&cdev->device);
return ERR_PTR(result);
}
EXPORT_SYMBOL_GPL(thermal_cooling_device_register);
EXPORT_SYMBOL(thermal_cooling_device_register);

/**
* thermal_cooling_device_unregister - removes the registered thermal cooling device
Expand Down Expand Up @@ -1428,7 +1406,7 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
device_unregister(&cdev->device);
return;
}
EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
EXPORT_SYMBOL(thermal_cooling_device_unregister);

void thermal_cdev_update(struct thermal_cooling_device *cdev)
{
Expand All @@ -1454,7 +1432,7 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
EXPORT_SYMBOL(thermal_cdev_update);

/**
* thermal_notify_framework - Sensor drivers use this API to notify framework
* notify_thermal_framework - Sensor drivers use this API to notify framework
* @tz: thermal zone device
* @trip: indicates which trip point has been crossed
*
Expand All @@ -1465,21 +1443,16 @@ EXPORT_SYMBOL(thermal_cdev_update);
* The throttling policy is based on the configured platform data; if no
* platform data is provided, this uses the step_wise throttling policy.
*/
void thermal_notify_framework(struct thermal_zone_device *tz, int trip)
void notify_thermal_framework(struct thermal_zone_device *tz, int trip)
{
handle_thermal_trip(tz, trip);
}
EXPORT_SYMBOL_GPL(thermal_notify_framework);
EXPORT_SYMBOL(notify_thermal_framework);

/**
* create_trip_attrs() - create attributes for trip points
* create_trip_attrs - create attributes for trip points
* @tz: the thermal zone device
* @mask: Writeable trip point bitmap.
*
* helper function to instantiate sysfs entries for every trip
* point and its properties of a struct thermal_zone_device.
*
* Return: 0 on success, the proper error value otherwise.
*/
static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
{
Expand Down Expand Up @@ -1580,7 +1553,7 @@ static void remove_trip_attrs(struct thermal_zone_device *tz)
}

/**
* thermal_zone_device_register() - register a new thermal zone device
* thermal_zone_device_register - register a new thermal zone device
* @type: the thermal zone device type
* @trips: the number of trip points the thermal zone support
* @mask: a bit string indicating the writeablility of trip points
Expand All @@ -1593,15 +1566,8 @@ static void remove_trip_attrs(struct thermal_zone_device *tz)
* whether trip points have been crossed (0 for interrupt
* driven systems)
*
* This interface function adds a new thermal zone device (sensor) to
* /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the
* thermal cooling devices registered at the same time.
* thermal_zone_device_unregister() must be called when the device is no
* longer needed. The passive cooling depends on the .get_trend() return value.
*
* Return: a pointer to the created struct thermal_zone_device or an
* in case of error, an ERR_PTR. Caller must check return value with
* IS_ERR*() helpers.
*/
struct thermal_zone_device *thermal_zone_device_register(const char *type,
int trips, int mask, void *devdata,
Expand Down Expand Up @@ -1640,7 +1606,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
return ERR_PTR(result);
}

strlcpy(tz->type, type ? : "", sizeof(tz->type));
strcpy(tz->type, type ? : "");
tz->ops = ops;
tz->tzp = tzp;
tz->device.class = &thermal_class;
Expand Down Expand Up @@ -1733,7 +1699,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
device_unregister(&tz->device);
return ERR_PTR(result);
}
EXPORT_SYMBOL_GPL(thermal_zone_device_register);
EXPORT_SYMBOL(thermal_zone_device_register);

/**
* thermal_device_unregister - removes the registered thermal zone device
Expand Down Expand Up @@ -1800,7 +1766,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
device_unregister(&tz->device);
return;
}
EXPORT_SYMBOL_GPL(thermal_zone_device_unregister);
EXPORT_SYMBOL(thermal_zone_device_unregister);

/**
* thermal_zone_get_zone_by_name() - search for a zone and returns its ref
Expand Down Expand Up @@ -1916,7 +1882,7 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz,

return result;
}
EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);
EXPORT_SYMBOL(thermal_generate_netlink_event);

static int genetlink_init(void)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/thermal.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ int get_tz_trend(struct thermal_zone_device *, int);
struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
struct thermal_cooling_device *, int);
void thermal_cdev_update(struct thermal_cooling_device *);
void thermal_notify_framework(struct thermal_zone_device *, int);
void notify_thermal_framework(struct thermal_zone_device *, int);

#ifdef CONFIG_NET
extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
Expand Down

0 comments on commit ad07b9e

Please sign in to comment.