Linux Audio

Check our new training course

Loading...
v4.6
 
 1/*
 2 * Based on arch/arm/kernel/time.c
 3 *
 4 * Copyright (C) 1991, 1992, 1995  Linus Torvalds
 5 * Modifications for ARM (C) 1994-2001 Russell King
 6 * Copyright (C) 2012 ARM Ltd.
 7 *
 8 * This program is free software; you can redistribute it and/or modify
 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/clockchips.h>
22#include <linux/export.h>
23#include <linux/kernel.h>
24#include <linux/interrupt.h>
25#include <linux/time.h>
26#include <linux/init.h>
27#include <linux/sched.h>
28#include <linux/smp.h>
29#include <linux/timex.h>
30#include <linux/errno.h>
31#include <linux/profile.h>
32#include <linux/syscore_ops.h>
33#include <linux/timer.h>
34#include <linux/irq.h>
35#include <linux/delay.h>
36#include <linux/clocksource.h>
37#include <linux/clk-provider.h>
38#include <linux/acpi.h>
39
40#include <clocksource/arm_arch_timer.h>
41
42#include <asm/thread_info.h>
43#include <asm/stacktrace.h>
44
45unsigned long profile_pc(struct pt_regs *regs)
46{
47	struct stackframe frame;
48
49	if (!in_lock_functions(regs->pc))
50		return regs->pc;
51
52	frame.fp = regs->regs[29];
53	frame.sp = regs->sp;
54	frame.pc = regs->pc;
55#ifdef CONFIG_FUNCTION_GRAPH_TRACER
56	frame.graph = -1; /* no task info */
57#endif
58	do {
59		int ret = unwind_frame(NULL, &frame);
60		if (ret < 0)
61			return 0;
62	} while (in_lock_functions(frame.pc));
63
64	return frame.pc;
65}
66EXPORT_SYMBOL(profile_pc);
67
68void __init time_init(void)
69{
70	u32 arch_timer_rate;
71
72	of_clk_init(NULL);
73	clocksource_probe();
74
75	tick_setup_hrtimer_broadcast();
76
77	arch_timer_rate = arch_timer_get_rate();
78	if (!arch_timer_rate)
79		panic("Unable to initialise architected timer.\n");
80
81	/* Calibrate the delay loop directly */
82	lpj_fine = arch_timer_rate / HZ;
83}
v5.4
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Based on arch/arm/kernel/time.c
 4 *
 5 * Copyright (C) 1991, 1992, 1995  Linus Torvalds
 6 * Modifications for ARM (C) 1994-2001 Russell King
 7 * Copyright (C) 2012 ARM Ltd.
 
 
 
 
 
 
 
 
 
 
 
 
 8 */
 9
10#include <linux/clockchips.h>
11#include <linux/export.h>
12#include <linux/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/time.h>
15#include <linux/init.h>
16#include <linux/sched.h>
17#include <linux/smp.h>
18#include <linux/timex.h>
19#include <linux/errno.h>
20#include <linux/profile.h>
21#include <linux/syscore_ops.h>
22#include <linux/timer.h>
23#include <linux/irq.h>
24#include <linux/delay.h>
25#include <linux/clocksource.h>
26#include <linux/clk-provider.h>
27#include <linux/acpi.h>
28
29#include <clocksource/arm_arch_timer.h>
30
31#include <asm/thread_info.h>
32#include <asm/stacktrace.h>
33
34unsigned long profile_pc(struct pt_regs *regs)
35{
36	struct stackframe frame;
37
38	if (!in_lock_functions(regs->pc))
39		return regs->pc;
40
41	start_backtrace(&frame, regs->regs[29], regs->pc);
42
 
 
 
 
43	do {
44		int ret = unwind_frame(NULL, &frame);
45		if (ret < 0)
46			return 0;
47	} while (in_lock_functions(frame.pc));
48
49	return frame.pc;
50}
51EXPORT_SYMBOL(profile_pc);
52
53void __init time_init(void)
54{
55	u32 arch_timer_rate;
56
57	of_clk_init(NULL);
58	timer_probe();
59
60	tick_setup_hrtimer_broadcast();
61
62	arch_timer_rate = arch_timer_get_rate();
63	if (!arch_timer_rate)
64		panic("Unable to initialise architected timer.\n");
65
66	/* Calibrate the delay loop directly */
67	lpj_fine = arch_timer_rate / HZ;
68}