[v3,1/1] clocksource/timer-riscv: Add riscv_clock_shutdown callback

Message ID 20231116105312.4800-1-joshua.yeong@starfivetech.com
State New
Headers
Series [v3,1/1] clocksource/timer-riscv: Add riscv_clock_shutdown callback |

Commit Message

Joshua Yeong Nov. 16, 2023, 10:53 a.m. UTC
  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>
---
 drivers/clocksource/timer-riscv.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Anup Patel Nov. 16, 2023, 11:51 a.m. UTC | #1
On Thu, Nov 16, 2023 at 4:24 PM Joshua Yeong
<joshua.yeong@starfivetech.com> wrote:
>
> 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>

Please include Rb tags obtained in previous revisions.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  drivers/clocksource/timer-riscv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
> index 57857c0dfba9..e66dcbd66566 100644
> --- a/drivers/clocksource/timer-riscv.c
> +++ b/drivers/clocksource/timer-riscv.c
> @@ -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
>
  
Daniel Lezcano Dec. 4, 2023, 5:40 p.m. UTC | #2
On 16/11/2023 11:53, Joshua Yeong wrote:
> 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>
> ---

Applied, thanks
  

Patch

diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index 57857c0dfba9..e66dcbd66566 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -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,
 };
 
 /*