Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
33d3842
Documentation
arch
alpha
arc
arm
boot
common
configs
crypto
firmware
include
kernel
kvm
lib
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed
mach-at91
mach-axxia
mach-bcm
mach-berlin
mach-clps711x
mach-cns3xxx
mach-davinci
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-highbank
mach-hisi
mach-imx
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek
mach-meson
mach-mmp
mach-moxart
mach-mv78xx0
mach-mvebu
mach-mxs
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2
include
Kconfig
Makefile
am33xx-restart.c
am33xx.h
board-generic.c
board-n8x0.c
clkt2xxx_dpll.c
clkt2xxx_dpllcore.c
clkt2xxx_virt_prcm_set.c
clock.c
clock.h
clock2xxx.h
clock3xxx.h
clockdomain.c
clockdomain.h
clockdomains2420_data.c
clockdomains2430_data.c
clockdomains2xxx_3xxx_data.c
clockdomains33xx_data.c
clockdomains3xxx_data.c
clockdomains43xx_data.c
clockdomains44xx_data.c
clockdomains54xx_data.c
clockdomains7xx_data.c
clockdomains81xx_data.c
cm-regbits-24xx.h
cm-regbits-33xx.h
cm-regbits-34xx.h
cm-regbits-44xx.h
cm-regbits-54xx.h
cm-regbits-7xx.h
cm.h
cm1_44xx.h
cm1_54xx.h
cm1_7xx.h
cm2_44xx.h
cm2_54xx.h
cm2_7xx.h
cm2xxx.c
cm2xxx.h
cm2xxx_3xxx.h
cm33xx.c
cm33xx.h
cm3xxx.c
cm3xxx.h
cm44xx.h
cm81xx.h
cm_common.c
cminst44xx.c
common-board-devices.h
common.c
common.h
control.c
control.h
cpuidle34xx.c
cpuidle44xx.c
ctrl_module_wkup_44xx.h
devices.c
display.c
display.h
dma.c
drm.c
fb.c
gpmc-onenand.c
gpmc.h
hdq1w.c
hdq1w.h
hsmmc.c
hsmmc.h
i2c.c
i2c.h
id.c
id.h
io.c
iomap.h
l3_2xxx.h
l3_3xxx.h
l4_2xxx.h
l4_3xxx.h
mcbsp.c
mmc.h
msdi.c
omap-headsmp.S
omap-hotplug.c
omap-mpuss-lowpower.c
omap-pm-noop.c
omap-pm.h
omap-secure.c
omap-secure.h
omap-smc.S
omap-smp.c
omap-wakeupgen.c
omap-wakeupgen.h
omap2-restart.c
omap24xx.h
omap3-restart.c
omap34xx.h
omap4-common.c
omap4-restart.c
omap4-sar-layout.h
omap44xx.h
omap54xx.h
omap_device.c
omap_device.h
omap_hwmod.c
omap_hwmod.h
omap_hwmod_2420_data.c
omap_hwmod_2430_data.c
omap_hwmod_2xxx_3xxx_interconnect_data.c
omap_hwmod_2xxx_3xxx_ipblock_data.c
omap_hwmod_2xxx_interconnect_data.c
omap_hwmod_2xxx_ipblock_data.c
omap_hwmod_33xx_43xx_common_data.h
omap_hwmod_33xx_43xx_interconnect_data.c
omap_hwmod_33xx_43xx_ipblock_data.c
omap_hwmod_33xx_data.c
omap_hwmod_3xxx_data.c
omap_hwmod_43xx_data.c
omap_hwmod_44xx_data.c
omap_hwmod_54xx_data.c
omap_hwmod_7xx_data.c
omap_hwmod_81xx_data.c
omap_hwmod_common_data.c
omap_hwmod_common_data.h
omap_hwmod_common_ipblock_data.c
omap_hwmod_reset.c
omap_opp_data.h
omap_phy_internal.c
omap_twl.c
opp.c
opp2420_data.c
opp2430_data.c
opp2xxx.h
opp3xxx_data.c
opp4xxx_data.c
pdata-quirks.c
pm-debug.c
pm.c
pm.h
pm24xx.c
pm34xx.c
pm44xx.c
pmu.c
powerdomain-common.c
powerdomain.c
powerdomain.h
powerdomains2xxx_3xxx_data.c
powerdomains2xxx_3xxx_data.h
powerdomains2xxx_data.c
powerdomains33xx_data.c
powerdomains3xxx_data.c
powerdomains43xx_data.c
powerdomains44xx_data.c
powerdomains54xx_data.c
powerdomains7xx_data.c
prcm-common.h
prcm43xx.h
prcm44xx.h
prcm_mpu44xx.c
prcm_mpu44xx.h
prcm_mpu54xx.h
prcm_mpu7xx.h
prcm_mpu_44xx_54xx.h
prm-regbits-24xx.h
prm-regbits-33xx.h
prm-regbits-34xx.h
prm-regbits-44xx.h
prm.h
prm2xxx.c
prm2xxx.h
prm2xxx_3xxx.c
prm2xxx_3xxx.h
prm33xx.c
prm33xx.h
prm3xxx.c
prm3xxx.h
prm44xx.c
prm44xx.h
prm44xx_54xx.h
prm54xx.h
prm7xx.h
prm_common.c
prminst44xx.c
prminst44xx.h
scrm44xx.h
scrm54xx.h
sdrc.c
sdrc.h
sdrc2xxx.c
serial.h
sleep24xx.S
sleep34xx.S
sleep44xx.S
smartreflex-class3.c
soc.h
sr_device.c
sram.c
sram.h
sram242x.S
sram243x.S
ti81xx-restart.c
ti81xx.h
timer.c
usb-tusb6010.c
usb.h
vc.c
vc.h
vc3xxx_data.c
vc44xx_data.c
voltage.c
voltage.h
voltagedomains2xxx_data.c
voltagedomains3xxx_data.c
voltagedomains44xx_data.c
voltagedomains54xx_data.c
vp.c
vp.h
vp3xxx_data.c
vp44xx_data.c
wd_timer.c
wd_timer.h
mach-orion5x
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa
mach-qcom
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx
mach-s3c64xx
mach-s5pv210
mach-sa1100
mach-shmobile
mach-socfpga
mach-spear
mach-sti
mach-stm32
mach-sunxi
mach-tango
mach-tegra
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress
mach-vt8500
mach-w90x900
mach-zx
mach-zynq
mm
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
probes
tools
vdso
vfp
xen
Kconfig
Kconfig-nommu
Kconfig.debug
Makefile
arm64
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
arm
/
mach-omap2
/
pm.c
Blame
Blame
Latest commit
History
History
256 lines (214 loc) · 5.41 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-omap2
/
pm.c
Top
File metadata and controls
Code
Blame
256 lines (214 loc) · 5.41 KB
Raw
/* * pm.c - Common OMAP2+ power management-related code * * Copyright (C) 2010 Texas Instruments, Inc. * Copyright (C) 2010 Nokia Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> #include <linux/err.h> #include <linux/pm_opp.h> #include <linux/export.h> #include <linux/suspend.h> #include <linux/cpu.h> #include <asm/system_misc.h> #include "omap-pm.h" #include "omap_device.h" #include "common.h" #include "soc.h" #include "prcm-common.h" #include "voltage.h" #include "powerdomain.h" #include "clockdomain.h" #include "pm.h" #ifdef CONFIG_SUSPEND /* * omap_pm_suspend: points to a function that does the SoC-specific * suspend work */ static int (*omap_pm_suspend)(void); #endif #ifdef CONFIG_PM /** * struct omap2_oscillator - Describe the board main oscillator latencies * @startup_time: oscillator startup latency * @shutdown_time: oscillator shutdown latency */ struct omap2_oscillator { u32 startup_time; u32 shutdown_time; }; static struct omap2_oscillator oscillator = { .startup_time = ULONG_MAX, .shutdown_time = ULONG_MAX, }; void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { oscillator.startup_time = tstart; oscillator.shutdown_time = tshut; } void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { if (!tstart || !tshut) return; *tstart = oscillator.startup_time; *tshut = oscillator.shutdown_time; } #endif int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) { clkdm_allow_idle(clkdm); return 0; } /* * This API is to be called during init to set the various voltage * domains to the voltage as per the opp table. Typically we boot up * at the nominal voltage. So this function finds out the rate of * the clock associated with the voltage domain, finds out the correct * opp entry and sets the voltage domain to the voltage specified * in the opp entry */ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, const char *oh_name) { struct voltagedomain *voltdm; struct clk *clk; struct dev_pm_opp *opp; unsigned long freq, bootup_volt; struct device *dev; if (!vdd_name || !clk_name || !oh_name) { pr_err("%s: invalid parameters\n", __func__); goto exit; } if (!strncmp(oh_name, "mpu", 3)) /* * All current OMAPs share voltage rail and clock * source, so CPU0 is used to represent the MPU-SS. */ dev = get_cpu_device(0); else dev = omap_device_get_by_hwmod_name(oh_name); if (IS_ERR(dev)) { pr_err("%s: Unable to get dev pointer for hwmod %s\n", __func__, oh_name); goto exit; } voltdm = voltdm_lookup(vdd_name); if (!voltdm) { pr_err("%s: unable to get vdd pointer for vdd_%s\n", __func__, vdd_name); goto exit; } clk = clk_get(NULL, clk_name); if (IS_ERR(clk)) { pr_err("%s: unable to get clk %s\n", __func__, clk_name); goto exit; } freq = clk_get_rate(clk); clk_put(clk); opp = dev_pm_opp_find_freq_ceil(dev, &freq); if (IS_ERR(opp)) { pr_err("%s: unable to find boot up OPP for vdd_%s\n", __func__, vdd_name); goto exit; } bootup_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); if (!bootup_volt) { pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", __func__, vdd_name); goto exit; } voltdm_scale(voltdm, bootup_volt); return 0; exit: pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name); return -EINVAL; } #ifdef CONFIG_SUSPEND static int omap_pm_enter(suspend_state_t suspend_state) { int ret = 0; if (!omap_pm_suspend) return -ENOENT; /* XXX doublecheck */ switch (suspend_state) { case PM_SUSPEND_MEM: ret = omap_pm_suspend(); break; default: ret = -EINVAL; } return ret; } static int omap_pm_begin(suspend_state_t state) { cpu_idle_poll_ctrl(true); if (soc_is_omap34xx()) omap_prcm_irq_prepare(); return 0; } static void omap_pm_end(void) { cpu_idle_poll_ctrl(false); } static void omap_pm_finish(void) { if (soc_is_omap34xx()) omap_prcm_irq_complete(); } static const struct platform_suspend_ops omap_pm_ops = { .begin = omap_pm_begin, .end = omap_pm_end, .enter = omap_pm_enter, .finish = omap_pm_finish, .valid = suspend_valid_only_mem, }; /** * omap_common_suspend_init - Set common suspend routines for OMAP SoCs * @pm_suspend: function pointer to SoC specific suspend function */ void omap_common_suspend_init(void *pm_suspend) { omap_pm_suspend = pm_suspend; suspend_set_ops(&omap_pm_ops); } #endif /* CONFIG_SUSPEND */ static void __init omap3_init_voltages(void) { if (!soc_is_omap34xx()) return; omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu"); omap2_set_init_voltage("core", "l3_ick", "l3_main"); } static void __init omap4_init_voltages(void) { if (!soc_is_omap44xx()) return; omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu"); omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1"); omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); } static int __init omap2_common_pm_init(void) { omap_pm_if_init(); return 0; } omap_postcore_initcall(omap2_common_pm_init); int __init omap2_common_pm_late_init(void) { /* Init the voltage layer */ omap3_twl_init(); omap4_twl_init(); omap_voltage_late_init(); /* Initialize the voltages */ omap3_init_voltages(); omap4_init_voltages(); /* Smartreflex device init */ omap_devinit_smartreflex(); return 0; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
You can’t perform that action at this time.