[Sound-open-firmware] [PATCH] timer: pass platform timer structure in to all platform timer calls.
Make sure we pass in our timer structure. In preparation for 64bit timers.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/ipc/intel-ipc.c | 2 +- src/lib/schedule.c | 4 ++-- src/lib/trace.c | 2 +- src/platform/baytrail/clk.c | 3 +-- src/platform/baytrail/include/platform/timer.h | 1 + src/platform/baytrail/platform.c | 9 +++------ 6 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 01c83b6..0c1b10a 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -505,7 +505,7 @@ static int ipc_pm_context_save(uint32_t header) /* TODO: clear any outstanding platform IRQs - TODO refine */
/* TODO: stop ALL timers */ - platform_timer_stop(0); + platform_timer_stop(platform_timer);
/* TODO: disable SSP and DMA HW */
diff --git a/src/lib/schedule.c b/src/lib/schedule.c index b10bb98..147bfff 100644 --- a/src/lib/schedule.c +++ b/src/lib/schedule.c @@ -84,7 +84,7 @@ static inline struct task *edf_get_next(void) return NULL;
/* get the current time */ - current = platform_timer_get(NULL); + current = platform_timer_get(platform_timer);
/* check every queued or running task in list */ list_for_item(clist, &sch->list) { @@ -174,7 +174,7 @@ void schedule_task(struct task *task, uint32_t deadline, uint16_t priority, }
/* get the current time */ - current = platform_timer_get(NULL); + current = platform_timer_get(platform_timer);
/* calculate deadline - TODO: include MIPS */ ticks = clock_us_to_ticks(sch->clock, deadline); diff --git a/src/lib/trace.c b/src/lib/trace.c index 5da7c95..33e1466 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -56,7 +56,7 @@ void _trace_event(uint32_t event)
/* write timestamp and event to trace buffer */ t =(volatile uint32_t*)(MAILBOX_TRACE_BASE + trace.pos); - t[0] = platform_timer_get(0); + t[0] = platform_timer_get(platform_timer); t[1] = event;
/* writeback trace data */ diff --git a/src/platform/baytrail/clk.c b/src/platform/baytrail/clk.c index 5d8a73a..fdffcd5 100644 --- a/src/platform/baytrail/clk.c +++ b/src/platform/baytrail/clk.c @@ -240,8 +240,7 @@ uint32_t clock_time_elapsed(int clock, uint32_t previous, uint32_t *current) _current = arch_timer_get_system(NULL); break; case CLK_SSP: - // TODO: fix timer ID - _current = platform_timer_get(NULL); + _current = platform_timer_get(platform_timer); break; default: return 0; diff --git a/src/platform/baytrail/include/platform/timer.h b/src/platform/baytrail/include/platform/timer.h index 309828c..a7d2fc8 100644 --- a/src/platform/baytrail/include/platform/timer.h +++ b/src/platform/baytrail/include/platform/timer.h @@ -49,6 +49,7 @@ struct comp_dev; struct sof_ipc_stream_posn;
+extern struct timer *platform_timer; void platform_timer_set(struct timer *timer, uint32_t ticks); void platform_timer_clear(struct timer *timer); uint32_t platform_timer_get(struct timer *timer); diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index b8c3e49..f97971a 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -83,6 +83,8 @@ static struct work_queue_timesource platform_generic_queue = { .timer_get = platform_timer_get, };
+struct timer *platform_timer = &platform_generic_queue.timer; + int platform_boot_complete(uint32_t boot_message) { uint64_t outbox = MAILBOX_HOST_OFFSET >> 3; @@ -138,11 +140,6 @@ void platform_interrupt_unmask(uint32_t irq, uint32_t mask)
}
-static struct timer platform_ext_timer = { - .id = TIMER3, - .irq = IRQ_NUM_EXT_TIMER, -}; - int platform_init(struct reef *reef) { #if defined CONFIG_BAYTRAIL @@ -176,7 +173,7 @@ int platform_init(struct reef *reef)
/* init work queues and clocks */ trace_point(TRACE_BOOT_PLATFORM_TIMER); - platform_timer_start(&platform_ext_timer); + platform_timer_start(platform_timer);
trace_point(TRACE_BOOT_PLATFORM_CLOCK); init_platform_clocks();
participants (1)
-
Liam Girdwood