Commit Graph

360979 Commits

Author SHA1 Message Date
Eduardo Valentin e72b7bbd17 staging: omap-thermal: add documentation for omap_bandgap_validate
Document the helper to validate a struct omap_bandgap and a sensor id.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:25 -07:00
Eduardo Valentin ff4a44ce32 staging: omap-thermal: remove TODO entry for exposed APIs
Not all APIs exposed today are used. However all unused APIs
will be required once the thermal layer allows IRQ based
policies.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:25 -07:00
Eduardo Valentin 0205b15fa4 staging: omap-thermal: remove TODO entry suggesting regmap usage
It is hard to use regmap because benefit of using regmap cache
may not be applicable as there is a specific sequence to
restore the bandgap context.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin ebf0bd52e6 staging: omap-thermal: switch mutex to spinlock inside omap-bandgap
Because there is a need to lock inside IRQ handler, this patch
changes the locking mechanism inside the omap-bandgap.[c,h] to
spinlocks. Now this lock is used to protect omap_bandgap struct
during APIs exposed (possibly used in sysfs handling functions)
and inside the ALERT IRQ handler.

Because there are registers shared among the sensors, this lock
is global, not per sensor.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin 1b46f2a239 staging: omap-thermal: Add a MAINTAINERS entry for TI bandgap and thermal driver
Add myself as maintainer of the TI bandgap and thermal driver.

CC: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Zhang Rui <rui.zhang@intel.com>

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin 494bbdd8b1 staging: omap-thermal: change Kconfig dependency method
Now arch code has to specify CONFIG_ARCH_HAS_BANDGAP. So, this driver
will be selectable only if the platform reports itself as having a
bandgap device.

Any OMAP variant or any other OMAP version needs to
	select ARCH_HAS_BANDGAP
so that the driver will be applicable. A part from that it is
required to device the data structures that maps the registers
and their bitfields. The DT compatible list must also be updated.

CC: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Vaibhav Bedia <vaibhav.bedia@ti.com>

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin e9b6f8c4da staging: omap-thermal: document omap_bandgap_build function
Document function to build omap_bandgap structure

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin 094b8aca16 staging: omap-thermal: document omap_bandgap_alert_init function
Document function that sets talert handling up.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin d3790b3ddc staging: omap-thermal: document omap_bandgap_tshut_init function
Add documentation for the function to setup TSHUT handling

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin 7a681a50ed staging: omap-thermal: document _omap_bandgap_read_threshold function
Add documentation of the function for reading alert thresholds

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:24 -07:00
Eduardo Valentin 9efa93b0e6 staging: omap-thermal: document _omap_bandgap_write_threshold function
Document function to update alert thresholds.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin 38d99e807b staging: omap-thermal: document omap_bandgap_update_alert_threshold function
Document function to program alert thresholds

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin 31102a7202 staging: omap-thermal: document omap_bandgap_force_single_read
Document function to initialize the conversion state machine.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin a84b6f4552 staging: omap-thermal: update omap_bandgap_set_continous_mode documentation
Simple update on function documentation.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin 37bf871dd0 staging: omap-thermal: rename enable_continuous_mode
This patch names 'enable_continuous_mode' accordingly to the file
standard naming.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin f91ddfedfd staging: omap-thermal: section of device driver callbacks
Section with platform device callbacks

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin e195aba425 staging: omap-thermal: device initialization section
Section of helper functions to initilize the bandgap device

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin 56f132f78e staging: omap-thermal: refactor APIs handling threshold values
This patch improves the code that handles threshold values
by creating single functions that are usable for tcold and
thot. This way we won't have duplicated functionality just
because it is handling different bitfields. Now
the added functions are reused in several places where
it is needed to update any threshold.

This patch also removes macros that are used only inside
the _validate helper function.

In this patch there is also an addition of an extra function
section for Exposed APIs, used outside the omap-bandgap.c,
but inside the omap-thermal driver.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:23 -07:00
Eduardo Valentin f47f6d3164 staging: omap-thermal: update omap_bandgap_unmask_interrupts documentation
Proper document the function to configure the IRQ event masks.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin 910216890a staging: omap-thermal: refactor temp_sensor_unmask_interrupts
This change improves temp_sensor_unmask_interrupts by:
. renaming it to omap_bandgap_unmask_interrupts
. making it a void function, as there is nothing really to report an error.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin f8ccce20bf staging: omap-thermal: threshold manipulation section
Section of functions manipulating thresholds for Alert and Shutdown.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin 8a1cefe857 staging: omap-thermal: document omap_bandgap_add_hyst function
Document function to handle hysteresis.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin 0f0ed7dee2 staging: omap-thermal: rename add_hyst to omap_bandgap_add_hyst
This patch improves the add_hyst function by:
. Renaming it to omap_bandgap_add_hyst
. Moving it to the ADC conversion functions section
. Changing its signature to follow the driver standard

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin e7f60b5360 staging: omap-thermal: add documentation for omap_bandgap_mcelsius_to_adc
Document the conversion function.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:22 -07:00
Eduardo Valentin 26a70ed987 staging: omap-thermal: move conv table limits out of sensor data
As we have one conv table per bandgap device and not per sensor,
this patch changes the data structures so that the conv table
min and max values are now part of bandgap_data and not sensor_data.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:15 -07:00
Eduardo Valentin a619477f51 staging: omap-thermal: rewrite omap_bandgap_mcelsius_to_adc on kernel coding style
Follow Documentation/CodingStyle while doing omap_bandgap_mcelsius_to_adc

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin e16f072d5d staging: omap-thermal: name temp_to_adc_conversion in a better way
Rename temp_to_adc_conversion to omap_bandgap_mcelsius_to_adc. This name,
though longer, describes better the function.

This patch also changes this function signature so the function follows
the style of this file.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin 2577e937cb staging: omap-thermal: add documentation for omap_bandgap_adc_to_mcelsius
Document the conversion function.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin 2047059921 staging: omap-thermal: rewrite omap_bandgap_adc_to_mcelsius on kernel coding style
Follow Documentation/CodingStyle while doing  omap_bandgap_adc_to_mcelsius.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin bf7a979d43 staging: omap-thermal: name adc_to_temp_conversion in a better way
Rename adc_to_temp_conversion to omap_bandgap_adc_to_mcelsius. This name,
though longer, describes better the function.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin 2f6af4b3db staging: omap-thermal: ADC section
Section of ADC helpers functions

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:11 -07:00
Eduardo Valentin fb65b88a58 staging: omap-thermal: IRQ handler section
Section of IRQ handlers

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin 6ab52402ec staging: omap-thermal: section of basic helpers
Group of simple functions aggregating basic functionality.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin 8abbe71ee5 staging: omap-thermal: add a section of register manipulation
This is introduces a series of marks inside the code to
better organize functions per group, aggregating their
functionality.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin e555c95648 staging: omap-thermal: read status only once inside alert IRQ
There is no need to re-read status register.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin 7cf46dbf0a staging: omap-thermal: remove duplicated code
There is no need to assign twice the same variable with the very same value.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin 79857cd28e staging: omap-thermal: update tshut IRQ handler documentation
Documents tshut handler better.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin ee07d55abb staging: omap-thermal: update documentation for talert irq handler
Document the Talert IRQ handler.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:10 -07:00
Eduardo Valentin f230427c47 staging: omap-thermal: rename talert handler
Simple rename to cope with file naming pattern.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin 4a6554ed29 staging: omap-thermal: add documentation for omap_bandgap_read_temp
Document function which reads temperature register, depending on
bandgap device version.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin 7a556e6a4a staging: omap-thermal: add documentation for omap_bandgap_power
Document the helper function to turn a bandgap device on and off.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin 3d84e52962 staging: omap-thermal: make a omap_bandgap_power with only one exit point
Change the way the omap_bandgap_power is written so that it has only
one exit entry (Documentation/CodingStyle).

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin 9c468aa2d5 staging: omap-thermal: add documentation for register access functions
Document the helper functions that manipulates registers and their
bitfields. All of them work based of the io mapped area.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin d3c291ab80 staging: omap-thermal: introduce RMW_BITS macro
This patch introduce a macro to read, update, write bitfields.
It will be specific to bandgap data structures.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:09 -07:00
Eduardo Valentin 35b052a6c9 staging: omap-thermal: fix error checking
The omap_bandgap_get_sensor_data() function returns ERR_PTR(),
but it can also return NULL, in case of initilization, so we need to use
IS_ERR_OR_NULL() rather than only IS_ERR().

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00
Eduardo Valentin 24796e1281 staging: omap-thermal: style cleanup on omap-bandgap.c
simple changes on alignments and white spaces

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00
Eduardo Valentin 0c00477dae staging: omap-thermal: update documentation of omap-bandgap.h
This patch updates the existing data structures for omap bandgap,
inside omap-bandgap.h.

TODO: remove unused fields.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00
Eduardo Valentin 787f3c27bd staging: omap-thermal: create header for register, bitfields and definitions
In order to have a better code readability and organization, this patch
splits omap-bandgap.h into three headers.
. omap-bandgap.h will contain only the driver related data structures
definitions and macros
. omap4xxx-bandgap.h will contain only defines and bitfields
related to OMAP4 based devices
. omap5xxx-bandgap.h will contain only defines and bitfields
related to OMAP5 based devices

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00
Eduardo Valentin 9011cc2978 staging: omap-thermal: remove unused _SHIFT macros
As these macros are not used on any part of the code,
this patch removes all the *_SHIT defines.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00
Eduardo Valentin af3c226283 staging: omap-thermal: use BIT() macro
For code readability, this patch changes the bit definition
under omap-bandgap.h to use the BIT() macro.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 09:02:08 -07:00