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
nexedi
linux
Commits
6b221b0a
Commit
6b221b0a
authored
Aug 28, 2019
by
Zhang Rui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'thermal-soc-misc' and 'thermal-soc-qoriq' into thermal-soc
parents
6b8249ab
11f787b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
+1
-0
drivers/thermal/qoriq_thermal.c
drivers/thermal/qoriq_thermal.c
+30
-15
No files found.
Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
View file @
6b221b0a
...
...
@@ -23,6 +23,7 @@ Required properties:
Optional property:
- little-endian : If present, the TMU registers are little endian. If absent,
the default is big endian.
- clocks : the clock for clocking the TMU silicon.
Example:
...
...
drivers/thermal/qoriq_thermal.c
View file @
6b221b0a
...
...
@@ -2,6 +2,7 @@
//
// Copyright 2016 Freescale Semiconductor, Inc.
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/err.h>
...
...
@@ -72,6 +73,7 @@ struct qoriq_sensor {
struct
qoriq_tmu_data
{
struct
qoriq_tmu_regs
__iomem
*
regs
;
struct
clk
*
clk
;
bool
little_endian
;
struct
qoriq_sensor
*
sensor
[
SITES_MAX
];
};
...
...
@@ -202,32 +204,39 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
data
->
little_endian
=
of_property_read_bool
(
np
,
"little-endian"
);
data
->
regs
=
of_iomap
(
np
,
0
);
if
(
!
data
->
regs
)
{
data
->
regs
=
devm_platform_ioremap_resource
(
pdev
,
0
);
if
(
IS_ERR
(
data
->
regs
)
)
{
dev_err
(
&
pdev
->
dev
,
"Failed to get memory region
\n
"
);
ret
=
-
ENODEV
;
goto
err_iomap
;
return
PTR_ERR
(
data
->
regs
);
}
data
->
clk
=
devm_clk_get_optional
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
data
->
clk
))
return
PTR_ERR
(
data
->
clk
);
ret
=
clk_prepare_enable
(
data
->
clk
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"Failed to enable clock
\n
"
);
return
ret
;
}
qoriq_tmu_init_device
(
data
);
/* TMU initialization */
ret
=
qoriq_tmu_calibration
(
pdev
);
/* TMU calibration */
if
(
ret
<
0
)
goto
err
_tmu
;
goto
err
;
ret
=
qoriq_tmu_register_tmu_zone
(
pdev
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"Failed to register sensors
\n
"
);
ret
=
-
ENODEV
;
goto
err
_iomap
;
goto
err
;
}
return
0
;
err_tmu:
iounmap
(
data
->
regs
);
err_iomap:
err:
clk_disable_unprepare
(
data
->
clk
);
platform_set_drvdata
(
pdev
,
NULL
);
return
ret
;
...
...
@@ -240,14 +249,14 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
/* Disable monitoring */
tmu_write
(
data
,
TMR_DISABLE
,
&
data
->
regs
->
tmr
);
iounmap
(
data
->
regs
);
clk_disable_unprepare
(
data
->
clk
);
platform_set_drvdata
(
pdev
,
NULL
);
return
0
;
}
#ifdef CONFIG_PM_SLEEP
static
int
qoriq_tmu_suspend
(
struct
device
*
dev
)
static
int
__maybe_unused
qoriq_tmu_suspend
(
struct
device
*
dev
)
{
u32
tmr
;
struct
qoriq_tmu_data
*
data
=
dev_get_drvdata
(
dev
);
...
...
@@ -257,14 +266,21 @@ static int qoriq_tmu_suspend(struct device *dev)
tmr
&=
~
TMR_ME
;
tmu_write
(
data
,
tmr
,
&
data
->
regs
->
tmr
);
clk_disable_unprepare
(
data
->
clk
);
return
0
;
}
static
int
qoriq_tmu_resume
(
struct
device
*
dev
)
static
int
__maybe_unused
qoriq_tmu_resume
(
struct
device
*
dev
)
{
u32
tmr
;
int
ret
;
struct
qoriq_tmu_data
*
data
=
dev_get_drvdata
(
dev
);
ret
=
clk_prepare_enable
(
data
->
clk
);
if
(
ret
)
return
ret
;
/* Enable monitoring */
tmr
=
tmu_read
(
data
,
&
data
->
regs
->
tmr
);
tmr
|=
TMR_ME
;
...
...
@@ -272,7 +288,6 @@ static int qoriq_tmu_resume(struct device *dev)
return
0
;
}
#endif
static
SIMPLE_DEV_PM_OPS
(
qoriq_tmu_pm_ops
,
qoriq_tmu_suspend
,
qoriq_tmu_resume
);
...
...
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