Skip to contentSkip to conversation

clocksource/timer-riscv: Add riscv_clock_shutdown callback

PATCH Applied Joshua Yeong 4 participants 4 messages Nov 16, 2023 – Jan 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 clocksource/timer-riscv: Add riscv_clock_shutdown callback

Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when switching out riscv timer as clock source

---
 drivers/clocksource/timer-riscv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/clocksource/timer-riscv.c +7 -0
index 57857c0dfba9..e66dcbd66566 100644
@@ -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,
 };
 
 /*
Signature · 1 line
2.25.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 5 lines · Joshua Yeong

Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when switching out riscv timer as clock source

Please include Rb tags obtained in previous revisions.

Regards,
Anup

Quoted 31 lines
---
 drivers/clocksource/timer-riscv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/clocksource/timer-riscv.c +7 -1
index 57857c0dfba9..e66dcbd66566 100644
@@ -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,
 };
 
 /*
--

2.25.1

#2 lore raw
In reply to Joshua Yeong
Quoted 5 lines · Joshua Yeong

Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when switching out riscv timer as clock source

---

Applied, thanks

Signature · 11 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
merge bot Applied
#3 lore raw
In reply to Joshua Yeong
The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     6a902b118e7f30dbf0e6248f7b0f97e12c0939c3
Gitweb:        https://git.kernel.org/tip/6a902b118e7f30dbf0e6248f7b0f97e12c0939c3
Author:        Joshua Yeong <[email protected]>
AuthorDate:    Thu, 16 Nov 2023 18:53:12 +08:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 27 Dec 2023 15:37:11 +01:00

clocksource/timer-riscv: Add riscv_clock_shutdown callback

Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when switching out riscv timer as clock source

---
 drivers/clocksource/timer-riscv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/clocksource/timer-riscv.c +7 -0
index 57857c0..e66dcbd 100644
@@ -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,
 };
 
 /*