Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
30072fb9
Commit
30072fb9
authored
Jun 13, 2013
by
Zhang Rui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'for-rc' and 'ti-soc' of .git into next
parents
e7cd7886
0c872507
ca0c7114
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
844 additions
and
25 deletions
+844
-25
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt
+13
-0
drivers/thermal/cpu_cooling.c
drivers/thermal/cpu_cooling.c
+1
-1
drivers/thermal/thermal_core.c
drivers/thermal/thermal_core.c
+2
-1
drivers/thermal/ti-soc-thermal/Kconfig
drivers/thermal/ti-soc-thermal/Kconfig
+12
-0
drivers/thermal/ti-soc-thermal/Makefile
drivers/thermal/ti-soc-thermal/Makefile
+1
-0
drivers/thermal/ti-soc-thermal/dra752-bandgap.h
drivers/thermal/ti-soc-thermal/dra752-bandgap.h
+280
-0
drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
+476
-0
drivers/thermal/ti-soc-thermal/ti-bandgap.c
drivers/thermal/ti-soc-thermal/ti-bandgap.c
+21
-7
drivers/thermal/ti-soc-thermal/ti-bandgap.h
drivers/thermal/ti-soc-thermal/ti-bandgap.h
+5
-0
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+27
-16
drivers/thermal/ti-soc-thermal/ti-thermal.h
drivers/thermal/ti-soc-thermal/ti-thermal.h
+6
-0
No files found.
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt
View file @
30072fb9
...
...
@@ -57,4 +57,17 @@ bandgap {
0x4a002380 0x2c
0x4a0023C0 0x3c>;
compatible = "ti,omap5430-bandgap";
interrupts = <0 126 4>; /* talert */
};
DRA752:
bandgap {
reg = <0x4a0021e0 0xc
0x4a00232c 0xc
0x4a002380 0x2c
0x4a0023C0 0x3c
0x4a002564 0x8
0x4a002574 0x50>;
compatible = "ti,dra752-bandgap";
interrupts = <0 126 4>; /* talert */
};
drivers/thermal/cpu_cooling.c
View file @
30072fb9
...
...
@@ -167,7 +167,7 @@ static int get_property(unsigned int cpu, unsigned long input,
continue
;
/* get the frequency order */
if
(
freq
!=
CPUFREQ_ENTRY_INVALID
&&
descend
!
=
-
1
)
if
(
freq
!=
CPUFREQ_ENTRY_INVALID
&&
descend
=
=
-
1
)
descend
=
!!
(
freq
>
table
[
i
].
frequency
);
freq
=
table
[
i
].
frequency
;
...
...
drivers/thermal/thermal_core.c
View file @
30072fb9
...
...
@@ -156,7 +156,8 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
{
enum
thermal_trend
trend
;
if
(
!
tz
->
ops
->
get_trend
||
tz
->
ops
->
get_trend
(
tz
,
trip
,
&
trend
))
{
if
(
tz
->
emul_temperature
||
!
tz
->
ops
->
get_trend
||
tz
->
ops
->
get_trend
(
tz
,
trip
,
&
trend
))
{
if
(
tz
->
temperature
>
tz
->
last_temperature
)
trend
=
THERMAL_TREND_RAISING
;
else
if
(
tz
->
temperature
<
tz
->
last_temperature
)
...
...
drivers/thermal/ti-soc-thermal/Kconfig
View file @
30072fb9
...
...
@@ -46,3 +46,15 @@ config OMAP5_THERMAL
This includes alert interrupts generation and also the TSHUT
support.
config DRA752_THERMAL
bool "Texas Instruments DRA752 thermal support"
depends on TI_SOC_THERMAL
depends on SOC_DRA7XX
help
If you say yes here you get thermal support for the Texas Instruments
DRA752 SoC family. The current chip supported are:
- DRA752
This includes alert interrupts generation and also the TSHUT
support.
drivers/thermal/ti-soc-thermal/Makefile
View file @
30072fb9
obj-$(CONFIG_TI_SOC_THERMAL)
+=
ti-soc-thermal.o
ti-soc-thermal-y
:=
ti-bandgap.o
ti-soc-thermal-$(CONFIG_TI_THERMAL)
+=
ti-thermal-common.o
ti-soc-thermal-$(CONFIG_DRA752_THERMAL)
+=
dra752-thermal-data.o
ti-soc-thermal-$(CONFIG_OMAP4_THERMAL)
+=
omap4-thermal-data.o
ti-soc-thermal-$(CONFIG_OMAP5_THERMAL)
+=
omap5-thermal-data.o
drivers/thermal/ti-soc-thermal/dra752-bandgap.h
0 → 100644
View file @
30072fb9
This diff is collapsed.
Click to expand it.
drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
0 → 100644
View file @
30072fb9
This diff is collapsed.
Click to expand it.
drivers/thermal/ti-soc-thermal/ti-bandgap.c
View file @
30072fb9
...
...
@@ -469,7 +469,7 @@ static inline int ti_bandgap_validate(struct ti_bandgap *bgp, int id)
{
int
ret
=
0
;
if
(
IS_ERR_OR_NULL
(
bgp
))
{
if
(
!
bgp
||
IS_ERR
(
bgp
))
{
pr_err
(
"%s: invalid bandgap pointer
\n
"
,
__func__
);
ret
=
-
EINVAL
;
goto
exit
;
...
...
@@ -992,9 +992,12 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
goto
exit
;
}
spin_lock
(
&
bgp
->
lock
);
tsr
=
bgp
->
conf
->
sensors
[
id
].
registers
;
/* Freeze and read the last 2 valid readings */
RMW_BITS
(
bgp
,
id
,
bgap_mask_ctrl
,
mask_freeze_mask
,
1
);
reg1
=
tsr
->
ctrl_dtemp_1
;
reg2
=
tsr
->
ctrl_dtemp_2
;
...
...
@@ -1008,22 +1011,25 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
/* Convert from adc values to mCelsius temperature */
ret
=
ti_bandgap_adc_to_mcelsius
(
bgp
,
temp1
,
&
t1
);
if
(
ret
)
goto
exit
;
goto
unfreeze
;
ret
=
ti_bandgap_adc_to_mcelsius
(
bgp
,
temp2
,
&
t2
);
if
(
ret
)
goto
exit
;
goto
unfreeze
;
/* Fetch the update interval */
ret
=
ti_bandgap_read_update_interval
(
bgp
,
id
,
&
interval
);
if
(
ret
||
!
interval
)
goto
exit
;
goto
unfreeze
;
*
trend
=
(
t1
-
t2
)
/
interval
;
dev_dbg
(
bgp
->
dev
,
"The temperatures are t1 = %d and t2 = %d and trend =%d
\n
"
,
t1
,
t2
,
*
trend
);
unfreeze:
RMW_BITS
(
bgp
,
id
,
bgap_mask_ctrl
,
mask_freeze_mask
,
0
);
spin_unlock
(
&
bgp
->
lock
);
exit:
return
ret
;
}
...
...
@@ -1191,7 +1197,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
int
clk_rate
,
ret
=
0
,
i
;
bgp
=
ti_bandgap_build
(
pdev
);
if
(
IS_ERR
_OR_NULL
(
bgp
))
{
if
(
IS_ERR
(
bgp
))
{
dev_err
(
&
pdev
->
dev
,
"failed to fetch platform data
\n
"
);
return
PTR_ERR
(
bgp
);
}
...
...
@@ -1207,17 +1213,19 @@ int ti_bandgap_probe(struct platform_device *pdev)
}
bgp
->
fclock
=
clk_get
(
NULL
,
bgp
->
conf
->
fclock_name
);
ret
=
IS_ERR
_OR_NULL
(
bgp
->
fclock
);
ret
=
IS_ERR
(
bgp
->
fclock
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"failed to request fclock reference
\n
"
);
ret
=
PTR_ERR
(
bgp
->
fclock
);
goto
free_irqs
;
}
bgp
->
div_clk
=
clk_get
(
NULL
,
bgp
->
conf
->
div_ck_name
);
ret
=
IS_ERR
_OR_NULL
(
bgp
->
div_clk
);
ret
=
IS_ERR
(
bgp
->
div_clk
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"failed to request div_ts_ck clock ref
\n
"
);
ret
=
PTR_ERR
(
bgp
->
div_clk
);
goto
free_irqs
;
}
...
...
@@ -1522,6 +1530,12 @@ static const struct of_device_id of_ti_bandgap_match[] = {
.
compatible
=
"ti,omap5430-bandgap"
,
.
data
=
(
void
*
)
&
omap5430_data
,
},
#endif
#ifdef CONFIG_DRA752_THERMAL
{
.
compatible
=
"ti,dra752-bandgap"
,
.
data
=
(
void
*
)
&
dra752_data
,
},
#endif
/* Sentinel */
{
},
...
...
drivers/thermal/ti-soc-thermal/ti-bandgap.h
View file @
30072fb9
...
...
@@ -400,4 +400,9 @@ extern const struct ti_bandgap_data omap5430_data;
#define omap5430_data NULL
#endif
#ifdef CONFIG_DRA752_THERMAL
extern
const
struct
ti_bandgap_data
dra752_data
;
#else
#define dra752_data NULL
#endif
#endif
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
View file @
30072fb9
...
...
@@ -38,6 +38,7 @@
/* common data structures */
struct
ti_thermal_data
{
struct
thermal_zone_device
*
ti_thermal
;
struct
thermal_zone_device
*
pcb_tz
;
struct
thermal_cooling_device
*
cool_dev
;
struct
ti_bandgap
*
bgp
;
enum
thermal_device_mode
mode
;
...
...
@@ -77,10 +78,12 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
static
inline
int
ti_thermal_get_temp
(
struct
thermal_zone_device
*
thermal
,
unsigned
long
*
temp
)
{
struct
thermal_zone_device
*
pcb_tz
=
NULL
;
struct
ti_thermal_data
*
data
=
thermal
->
devdata
;
struct
ti_bandgap
*
bgp
;
const
struct
ti_temp_sensor
*
s
;
int
ret
,
tmp
,
pcb_temp
,
slope
,
constant
;
int
ret
,
tmp
,
slope
,
constant
;
unsigned
long
pcb_temp
;
if
(
!
data
)
return
0
;
...
...
@@ -92,16 +95,22 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
if
(
ret
)
return
ret
;
pcb_temp
=
0
;
/* TODO: Introduce pcb temperature lookup */
/* Default constants */
slope
=
s
->
slope
;
constant
=
s
->
constant
;
pcb_tz
=
data
->
pcb_tz
;
/* In case pcb zone is available, use the extrapolation rule with it */
if
(
pcb_temp
)
{
tmp
-=
pcb_temp
;
slope
=
s
->
slope_pcb
;
constant
=
s
->
constant_pcb
;
}
else
{
slope
=
s
->
slope
;
constant
=
s
->
constant
;
if
(
!
IS_ERR
(
pcb_tz
))
{
ret
=
thermal_zone_get_temp
(
pcb_tz
,
&
pcb_temp
);
if
(
!
ret
)
{
tmp
-=
pcb_temp
;
/* got a valid PCB temp */
slope
=
s
->
slope_pcb
;
constant
=
s
->
constant_pcb
;
}
else
{
dev_err
(
bgp
->
dev
,
"Failed to read PCB state. Using defaults
\n
"
);
}
}
*
temp
=
ti_thermal_hotspot_temperature
(
tmp
,
slope
,
constant
);
...
...
@@ -115,7 +124,7 @@ static int ti_thermal_bind(struct thermal_zone_device *thermal,
struct
ti_thermal_data
*
data
=
thermal
->
devdata
;
int
id
;
if
(
IS_ERR_OR_NULL
(
data
))
if
(
!
data
||
IS_ERR
(
data
))
return
-
ENODEV
;
/* check if this is the cooling device we registered */
...
...
@@ -137,7 +146,7 @@ static int ti_thermal_unbind(struct thermal_zone_device *thermal,
{
struct
ti_thermal_data
*
data
=
thermal
->
devdata
;
if
(
IS_ERR_OR_NULL
(
data
))
if
(
!
data
||
IS_ERR
(
data
))
return
-
ENODEV
;
/* check if this is the cooling device we registered */
...
...
@@ -273,6 +282,8 @@ static struct ti_thermal_data
data
->
sensor_id
=
id
;
data
->
bgp
=
bgp
;
data
->
mode
=
THERMAL_DEVICE_ENABLED
;
/* pcb_tz will be either valid or PTR_ERR() */
data
->
pcb_tz
=
thermal_zone_get_zone_by_name
(
"pcb"
);
INIT_WORK
(
&
data
->
thermal_wq
,
ti_thermal_work
);
return
data
;
...
...
@@ -285,7 +296,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
data
=
ti_bandgap_get_sensor_data
(
bgp
,
id
);
if
(
IS_ERR_OR_NULL
(
data
))
if
(
!
data
||
IS_ERR
(
data
))
data
=
ti_thermal_build_data
(
bgp
,
id
);
if
(
!
data
)
...
...
@@ -296,7 +307,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
OMAP_TRIP_NUMBER
,
0
,
data
,
&
ti_thermal_ops
,
NULL
,
FAST_TEMP_MONITORING_RATE
,
FAST_TEMP_MONITORING_RATE
);
if
(
IS_ERR
_OR_NULL
(
data
->
ti_thermal
))
{
if
(
IS_ERR
(
data
->
ti_thermal
))
{
dev_err
(
bgp
->
dev
,
"thermal zone device is NULL
\n
"
);
return
PTR_ERR
(
data
->
ti_thermal
);
}
...
...
@@ -333,7 +344,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
struct
ti_thermal_data
*
data
;
data
=
ti_bandgap_get_sensor_data
(
bgp
,
id
);
if
(
IS_ERR_OR_NULL
(
data
))
if
(
!
data
||
IS_ERR
(
data
))
data
=
ti_thermal_build_data
(
bgp
,
id
);
if
(
!
data
)
...
...
@@ -346,7 +357,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
/* Register cooling device */
data
->
cool_dev
=
cpufreq_cooling_register
(
cpu_present_mask
);
if
(
IS_ERR
_OR_NULL
(
data
->
cool_dev
))
{
if
(
IS_ERR
(
data
->
cool_dev
))
{
dev_err
(
bgp
->
dev
,
"Failed to register cpufreq cooling device
\n
"
);
return
PTR_ERR
(
data
->
cool_dev
);
...
...
drivers/thermal/ti-soc-thermal/ti-thermal.h
View file @
30072fb9
...
...
@@ -38,6 +38,9 @@
#define OMAP_GRADIENT_SLOPE_5430_GPU 117
#define OMAP_GRADIENT_CONST_5430_GPU -2992
#define DRA752_GRADIENT_SLOPE 0
#define DRA752_GRADIENT_CONST 2000
/* PCB sensor calculation constants */
#define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
#define OMAP_GRADIENT_CONST_W_PCB_4430 20000
...
...
@@ -51,6 +54,9 @@
#define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
#define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
#define DRA752_GRADIENT_SLOPE_W_PCB 0
#define DRA752_GRADIENT_CONST_W_PCB 2000
/* trip points of interest in milicelsius (at hotspot level) */
#define OMAP_TRIP_COLD 100000
#define OMAP_TRIP_HOT 110000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment