Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/drivers/clocksource/dummy_timer.c
0004  *
0005  *  Copyright (C) 2013 ARM Ltd.
0006  *  All Rights Reserved
0007  */
0008 #include <linux/clockchips.h>
0009 #include <linux/cpu.h>
0010 #include <linux/init.h>
0011 #include <linux/percpu.h>
0012 #include <linux/cpumask.h>
0013 
0014 static DEFINE_PER_CPU(struct clock_event_device, dummy_timer_evt);
0015 
0016 static int dummy_timer_starting_cpu(unsigned int cpu)
0017 {
0018     struct clock_event_device *evt = per_cpu_ptr(&dummy_timer_evt, cpu);
0019 
0020     evt->name   = "dummy_timer";
0021     evt->features   = CLOCK_EVT_FEAT_PERIODIC |
0022               CLOCK_EVT_FEAT_ONESHOT |
0023               CLOCK_EVT_FEAT_DUMMY;
0024     evt->rating = 100;
0025     evt->cpumask    = cpumask_of(cpu);
0026 
0027     clockevents_register_device(evt);
0028     return 0;
0029 }
0030 
0031 static int __init dummy_timer_register(void)
0032 {
0033     return cpuhp_setup_state(CPUHP_AP_DUMMY_TIMER_STARTING,
0034                  "clockevents/dummy_timer:starting",
0035                  dummy_timer_starting_cpu, NULL);
0036 }
0037 early_initcall(dummy_timer_register);