Commit graph

32 commits

Author SHA1 Message Date
Eduardo Valentin 262235b13c staging: ti-soc-thermal: fix device removal
While removing, the device needs to unregister
the sensor from thermal framework. Before
calling the call back the driver needs to check
if the call back is registered. This patch
fix the check by checking the right callback.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:09 -07:00
Eduardo Valentin f155333423 staging: ti-soc-thermal: defer probe if cpufreq is not ready
When builtin compiled, there is a chance for this driver
be probed before cpufreq driver is up and running. In this
case, the cpucooling device can be wrong initialized.

Thus, this patch makes sure this driver is probed only
when cpufreq driver is ready. Whenever there is no
cpufreq driver registered, the probe will return -EPROBE_DEFER.

Tested-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin 537eb9364c staging: ti-soc-thermal: remove extrapolation rules from TODO
Extrapolation rules have been revisited.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin 21bf220211 staging: ti-soc-thermal: update OMAP5 extrapolation rules
Update the constants to the correct hotspot extrapolation
equation constants. OMAP4 constants are revisited and correct.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin b763fdaeae staging: ti-soc-thermal: introduce OMAP4430 extrapolation constants
This patch defines and utilizes the extrapolation constants for OMAP4430.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin 0359090ea7 staging: ti-soc-thermal: Remove TC1/TC2 TODO (already done)
TC1/TC2 are not needed anymore, API has been upgraded.
This is a TODO left-over.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin 67b4c47422 staging: ti-soc-thermal: fix min/max TODO (already done)
Min/Max cooling state are defined by registration helper
function, if no specific limits are passed. No need to change
this code.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
Eduardo Valentin 2c014c841e staging: ti-soc-thermal: update TODO list
This patch removes out of the TODO list those already completed.

Here is the status and why they are removed:
 on ti-bandgap.c:
-- Add support to hwmon: REMOVED, no need to have hwmon interfaces as
   the control is done via thermal framework.
-- Test every exposed API to userland: DONE, via thermal fw APIs
   By now, no specific API is exposed by this driver
-- Revisit data structures and simplify them: DONE, all
   unused fields are flagged for future removal.
-- Once SCM-core api settles, update this driver accordingly: DONE,
   the BG driver can exist without SCM driver by ioremapping its own
   registers and doing its own locking.

 on ti-thermal-common.c/ti-thermal.h:
-- Revisit trips and its definitions: DONE, for now there is no
   need to change current definition. Alert based policy will be add
   in future.
-- Revisit trending: DONE, OMAP5 history buffer support has been
   implemented. Devices without history buffer will use thermal fw
   trending capability.

on omap5-thermal.c
-- Add support for GPU cooling: REMOVED: this will not be part
   of this driver. Must be done in a separated cooling device.

 generally:
-- make checkpatch.pl and sparse happy: DONE, sparse remaining
   warning is not an issue.
-- update documentation: DONE, kernel-doc for ti-bandgap is now
   available.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08 10:35:08 -07:00
J Keerthy 03b7f67bd1 staging: ti-soc-thermal: Add get_trend support
Patch adds get_trend functionality for OMAP Bandgap thermal devices.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:31 -07:00
J Keerthy 2f440b0622 staging: ti-soc-thermal:Introduce ti_bandgap_get_trend function for OMAP5
The patch adds ti_bandgap_get_trend function. This is specific
to OMAP5 for now it computes the trend from the temp values stored
in the hardware history buffer.

Formula: (T1 - T2) / P.

Where:
                T1: Last read valid temperature.
                T2: Last but one read valid temperature.
                P:  Update Interval.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 54b59c9224 staging: ti-soc-thermal: Enable HISTORY_BUFFER Feature for OMAP5
This patch enables the HISTORY_BUFFER eature for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 07a7fb648f staging: ti-soc-thermal: Introduce HAS_HISTORY_BUFFER feature for bandgap
The patch introduces HISTORY_BUFFER feature. This is present in OMAP5 bandgap
and it is a hardware history buffer of previously read temperatures.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 58bccd073b staging: ti-soc-thermal: Modify update_interval r/w functions to incorporate the OMAP5 feature of COUNTER_DELAY.
Update ti_bandgap_write_update_interval and ti_bandgap_read_update_interval
functions to incorporate the OMAP5 feature of COUNTER_DELAY. The way we
program the delay between two successive temperature conversions
is different for OMAP5 as when compared with OMAP4. Incorporating
the changes required to program the delay for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 16b39738f9 staging: ti-soc-thermal: Enable COUNTER_DELAY feature for OMAP5
Enable COUNTER_DELAY feature for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 3ff027f1b7 staging: ti-soc-thermal: Introduce HAS_COUNTER_DELAY feature for bandgap
Introduce HAS_COUNTER_DELAY feature for bandgap.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:30 -07:00
J Keerthy 8b6ecd3584 staging: ti-soc-thermal: Initialise counter_delay field for OMAP5 sensors
Initialize all 3 temperature sensors of OMAP5 bandgap with the counter delay
mask.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
J Keerthy 525ee2818f staging: ti-soc-thermal: Add counter_delay_mask field to temp_sensor_registers struct
Add counter_delay_mask field to temp_sensor_registers structure.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
Eduardo Valentin 97df4ecb8e staging: ti-soc-thermal: report alert events on OMAP5 devices
OMAP5430 devices have the capability to generate
alert temperature. Thus, whenever a T_ALERT IRQ is served,
the ti-bandgap will call .report_temperature to notify the
thermal framework about thermal zone update request.

This patch allows OMAP5430 devices to notify
the thermal framework about T_ALERT events.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
Eduardo Valentin 7a779490b9 staging: ti-soc-thermal: report alert events on OMAP4 devices
OMAP4460 and OMAP4470 devices have the capability to generate
alert temperature. Thus, whenever a T_ALERT IRQ is served,
the ti-bandgap will call .report_temperature to notify the
thermal framework about thermal zone update request.

This patch allows OMAP4460 and OMAP4470 devices to notify
the thermal framework about T_ALERT events.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
Eduardo Valentin 8c99c166bd staging: ti-soc-thermal: expose ti_thermal_report_temperature
Whenever a sensor has an alert to be reported to the thermal framework,
it can use the report ti_thermal_report_temperature helper. This patch
expose this function so that bandgap data config declarations could use it.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
Nishanth Menon 169e8d03f0 staging: ti-soc-thermal: remove kernel-doc warnings reported with -v
Fix all kernel-doc warnings by add documentation about returns.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:29 -07:00
Eduardo Valentin 422a306380 staging: ti-soc-thermal: return error in case power switch is not supported
Improve ti_bandgap_power by returning an error code in case
the device does not support controlling its power state.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-01 12:27:28 -07:00
Eduardo Valentin d52361c6bd staging: ti-soc-thermal: propagate error code
While writing talert thresholds, propagate the error code from
ti_bandgap_update_alert_threshold to the caller of
_ti_bandgap_write_threshold.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:32 -07:00
Eduardo Valentin 0fb3c244fe staging: ti-soc-thermal: fix bitfield writing while updating thresholds
Wrong threshold cold values may be written with current implementation.
This patch fixes the threshold update function by simplifying the
bitfield manipulation sequence.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin f5d43b7a51 staging: ti-soc-thermal: fix condition to apply hyst
While updating talert thresholds, threshold cold must
always be lower than threshold hot. This patch fixes
the function ti_bandgap_update_alert_threshold to only
change the thresholds by applying a hysteresis when
they violate this condition.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin 61603af326 staging: ti-soc-thermal: fix several kernel-doc warnings and error
This patch updates the documentation to remove
all warnings and errors reported by scripts/kernel-doc.
Most are missing arguments due to wrong format.

Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin f6843569de stating: ti-soc-thermal: use sizeof(*pointer) while allocating
Follow Documentation/CodingStyle and use sizeof(*pointer)
instead of sizeof(struct type).

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin 9879b2c46f staging: ti-soc-thermal: split writable data from readonly data
This patch changes the data structures of this driver so
that readonly data can reside only in the conf pointer.
Now each register has a struct to hold its configuration info,
to be used base on chip version for instance, and a
struct of values to be written, like register shadow and priv data.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin 2f8ec2a971 staging: ti-soc-thermal: make unexported functions local
Move _ti_bandgap_write_threshold and _ti_bandgap_read_threshold to static
area, as they are local functions.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 11:28:31 -07:00
Eduardo Valentin 03e859d344 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>
2013-03-25 11:27:49 -07:00
Eduardo Valentin 097ca6a347 staging: ti-soc-thermal: rename Kconfig options
This patch renames the Kconfig options to cope with
the new naming convention.

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>
2013-03-25 11:27:49 -07:00
Eduardo Valentin 7372add4a1 staging: rename omap-thermal driver to ti-soc-thermal
Because this driver will support also OMAP derivatives,
this patch does a big rename inside this driver, so it
better fits its usage.

This patch only renames the directory, file names,
includes, Makefiles and Kconfig includes.

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>
2013-03-25 11:25:35 -07:00