Skip to content

Commit

Permalink
clocksource/timer-riscv: Add riscv_clock_shutdown callback
Browse files Browse the repository at this point in the history
Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when
switching out riscv timer as clock source

Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231116105312.4800-1-joshua.yeong@starfivetech.com
  • Loading branch information
Joshua Yeong authored and Daniel Lezcano committed Dec 27, 2023
1 parent e0cf601 commit 6a902b1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/clocksource/timer-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,19 @@ static int riscv_clock_next_event(unsigned long delta,
return 0;
}

static int riscv_clock_shutdown(struct clock_event_device *evt)
{
riscv_clock_event_stop();
return 0;
}

static unsigned int riscv_clock_event_irq;
static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = {
.name = "riscv_timer_clockevent",
.features = CLOCK_EVT_FEAT_ONESHOT,
.rating = 100,
.set_next_event = riscv_clock_next_event,
.set_state_shutdown = riscv_clock_shutdown,
};

/*
Expand Down

0 comments on commit 6a902b1

Please sign in to comment.