All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Subject: Re: [PATCH 30/41] clocksource: atmel: Migrate to new 'set-state' interface
Date: Thu, 18 Jun 2015 16:28:01 +0200	[thread overview]
Message-ID: <20150618142801.GG27492@piout.net> (raw)
In-Reply-To: <f6fdf1f810de1cd9ad4d9e3d45f7c5065156c79e.1434622147.git.viresh.kumar@linaro.org>

On 18/06/2015 at 16:24:44 +0530, Viresh Kumar wrote :
> Migrate atmel driver to the new 'set-state' interface provided by
> clockevents core, the earlier 'set-mode' interface is marked obsolete
> now.
> 
> This also enables us to implement callbacks for new states of clockevent
> devices, for example: ONESHOT_STOPPED.
> 
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/clocksource/timer-atmel-pit.c | 41 +++++++++++++++--------------------
>  1 file changed, 18 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index c0304ff608b0..58753223585b 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -90,33 +90,27 @@ static cycle_t read_pit_clk(struct clocksource *cs)
>  	return elapsed;
>  }
>  
> +static int pit_clkevt_shutdown(struct clock_event_device *dev)
> +{
> +	struct pit_data *data = clkevt_to_pit_data(dev);
> +
> +	/* disable irq, leaving the clocksource active */
> +	pit_write(data->base, AT91_PIT_MR, (data->cycle - 1) | AT91_PIT_PITEN);
> +	return 0;
> +}
> +
>  /*
>   * Clockevent device:  interrupts every 1/HZ (== pit_cycles * MCK/16)
>   */
> -static void
> -pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
> +static int pit_clkevt_set_periodic(struct clock_event_device *dev)
>  {
>  	struct pit_data *data = clkevt_to_pit_data(dev);
>  
> -	switch (mode) {
> -	case CLOCK_EVT_MODE_PERIODIC:
> -		/* update clocksource counter */
> -		data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> -		pit_write(data->base, AT91_PIT_MR,
> -			  (data->cycle - 1) | AT91_PIT_PITEN | AT91_PIT_PITIEN);
> -		break;
> -	case CLOCK_EVT_MODE_ONESHOT:
> -		BUG();
> -		/* FALLTHROUGH */
> -	case CLOCK_EVT_MODE_SHUTDOWN:
> -	case CLOCK_EVT_MODE_UNUSED:
> -		/* disable irq, leaving the clocksource active */
> -		pit_write(data->base, AT91_PIT_MR,
> -			  (data->cycle - 1) | AT91_PIT_PITEN);
> -		break;
> -	case CLOCK_EVT_MODE_RESUME:
> -		break;
> -	}
> +	/* update clocksource counter */
> +	data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> +	pit_write(data->base, AT91_PIT_MR,
> +		  (data->cycle - 1) | AT91_PIT_PITEN | AT91_PIT_PITIEN);
> +	return 0;
>  }
>  
>  static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
> @@ -162,7 +156,7 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
>  	WARN_ON_ONCE(!irqs_disabled());
>  
>  	/* The PIT interrupt may be disabled, and is shared */
> -	if ((data->clkevt.mode == CLOCK_EVT_MODE_PERIODIC) &&
> +	if (clockevent_state_periodic(&data->clkevt) &&
>  	    (pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
>  		unsigned nr_ticks;
>  
> @@ -227,7 +221,8 @@ static void __init at91sam926x_pit_common_init(struct pit_data *data)
>  	data->clkevt.rating = 100;
>  	data->clkevt.cpumask = cpumask_of(0);
>  
> -	data->clkevt.set_mode = pit_clkevt_mode;
> +	data->clkevt.set_state_shutdown = pit_clkevt_shutdown;
> +	data->clkevt.set_state_periodic = pit_clkevt_set_periodic;
>  	data->clkevt.resume = at91sam926x_pit_resume;
>  	data->clkevt.suspend = at91sam926x_pit_suspend;
>  	clockevents_register_device(&data->clkevt);
> -- 
> 2.4.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 30/41] clocksource: atmel: Migrate to new 'set-state' interface
Date: Thu, 18 Jun 2015 16:28:01 +0200	[thread overview]
Message-ID: <20150618142801.GG27492@piout.net> (raw)
In-Reply-To: <f6fdf1f810de1cd9ad4d9e3d45f7c5065156c79e.1434622147.git.viresh.kumar@linaro.org>

On 18/06/2015 at 16:24:44 +0530, Viresh Kumar wrote :
> Migrate atmel driver to the new 'set-state' interface provided by
> clockevents core, the earlier 'set-mode' interface is marked obsolete
> now.
> 
> This also enables us to implement callbacks for new states of clockevent
> devices, for example: ONESHOT_STOPPED.
> 
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/clocksource/timer-atmel-pit.c | 41 +++++++++++++++--------------------
>  1 file changed, 18 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index c0304ff608b0..58753223585b 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -90,33 +90,27 @@ static cycle_t read_pit_clk(struct clocksource *cs)
>  	return elapsed;
>  }
>  
> +static int pit_clkevt_shutdown(struct clock_event_device *dev)
> +{
> +	struct pit_data *data = clkevt_to_pit_data(dev);
> +
> +	/* disable irq, leaving the clocksource active */
> +	pit_write(data->base, AT91_PIT_MR, (data->cycle - 1) | AT91_PIT_PITEN);
> +	return 0;
> +}
> +
>  /*
>   * Clockevent device:  interrupts every 1/HZ (== pit_cycles * MCK/16)
>   */
> -static void
> -pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
> +static int pit_clkevt_set_periodic(struct clock_event_device *dev)
>  {
>  	struct pit_data *data = clkevt_to_pit_data(dev);
>  
> -	switch (mode) {
> -	case CLOCK_EVT_MODE_PERIODIC:
> -		/* update clocksource counter */
> -		data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> -		pit_write(data->base, AT91_PIT_MR,
> -			  (data->cycle - 1) | AT91_PIT_PITEN | AT91_PIT_PITIEN);
> -		break;
> -	case CLOCK_EVT_MODE_ONESHOT:
> -		BUG();
> -		/* FALLTHROUGH */
> -	case CLOCK_EVT_MODE_SHUTDOWN:
> -	case CLOCK_EVT_MODE_UNUSED:
> -		/* disable irq, leaving the clocksource active */
> -		pit_write(data->base, AT91_PIT_MR,
> -			  (data->cycle - 1) | AT91_PIT_PITEN);
> -		break;
> -	case CLOCK_EVT_MODE_RESUME:
> -		break;
> -	}
> +	/* update clocksource counter */
> +	data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> +	pit_write(data->base, AT91_PIT_MR,
> +		  (data->cycle - 1) | AT91_PIT_PITEN | AT91_PIT_PITIEN);
> +	return 0;
>  }
>  
>  static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
> @@ -162,7 +156,7 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
>  	WARN_ON_ONCE(!irqs_disabled());
>  
>  	/* The PIT interrupt may be disabled, and is shared */
> -	if ((data->clkevt.mode == CLOCK_EVT_MODE_PERIODIC) &&
> +	if (clockevent_state_periodic(&data->clkevt) &&
>  	    (pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
>  		unsigned nr_ticks;
>  
> @@ -227,7 +221,8 @@ static void __init at91sam926x_pit_common_init(struct pit_data *data)
>  	data->clkevt.rating = 100;
>  	data->clkevt.cpumask = cpumask_of(0);
>  
> -	data->clkevt.set_mode = pit_clkevt_mode;
> +	data->clkevt.set_state_shutdown = pit_clkevt_shutdown;
> +	data->clkevt.set_state_periodic = pit_clkevt_set_periodic;
>  	data->clkevt.resume = at91sam926x_pit_resume;
>  	data->clkevt.suspend = at91sam926x_pit_suspend;
>  	clockevents_register_device(&data->clkevt);
> -- 
> 2.4.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2015-06-18 14:28 UTC|newest]

Thread overview: 171+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1434622147.git.viresh.kumar@linaro.org>
2015-06-18 10:54 ` [PATCH 01/41] clocksource: asm9260: Migrate to new 'set-state' interface Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-30  8:25   ` Daniel Lezcano
2015-06-30  8:25     ` Daniel Lezcano
2015-06-30  9:00     ` Viresh Kumar
2015-06-30  9:00       ` Viresh Kumar
2015-06-30  9:20       ` Daniel Lezcano
2015-06-30  9:20         ` Daniel Lezcano
2015-07-08  5:37   ` Vineet Gupta
2015-07-08  5:37     ` Vineet Gupta
2015-07-08  5:37     ` Vineet Gupta
2015-07-08  5:43     ` Viresh Kumar
2015-07-08  5:43       ` Viresh Kumar
2015-07-08  6:14       ` Vineet Gupta
2015-07-08  6:14         ` Vineet Gupta
2015-06-18 10:54 ` [PATCH 02/41] clocksource: cadence_ttc: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-25 23:15   ` Sören Brinkmann
2015-06-25 23:15     ` Sören Brinkmann
2015-06-30  8:28   ` Daniel Lezcano
2015-06-30  8:28     ` Daniel Lezcano
2015-06-18 10:54 ` [PATCH 03/41] clocksource: clps711x: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 04/41] clocksource: dummy_timer: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 05/41] clocksource: dw_apb: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 06/41] clocksource: exynos_mct: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 16:38   ` Alexey Klimov
2015-06-18 16:38     ` Alexey Klimov
2015-06-19  2:14     ` Viresh Kumar
2015-06-19  2:14       ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 07/41] clocksource: fsl_ftm: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 08/41] clocksource: i8253: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 09/41] clocksource: meson6: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-20  6:53   ` Carlo Caione
2015-06-20  6:53     ` Carlo Caione
2015-06-18 10:54 ` [PATCH 10/41] clocksource: metag_generic: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 11/41] clocksource: mips-gic: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 12/41] clocksource: moxart: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 13/41] clocksource: mtk: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 14/41] clocksource: mxs: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-17  5:28   ` Stefan Wahren
2015-07-17  5:28     ` Stefan Wahren
2015-06-18 10:54 ` [PATCH 15/41] clocksource: nomadik-mtu: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-14 11:11   ` Linus Walleij
2015-07-14 11:11     ` Linus Walleij
2015-06-18 10:54 ` [PATCH 16/41] clocksource: pxa: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-04 15:42   ` Robert Jarzmik
2015-07-04 15:42     ` Robert Jarzmik
2015-07-05  3:37     ` Viresh Kumar
2015-07-05  3:37       ` Viresh Kumar
2015-07-06  6:13       ` Robert Jarzmik
2015-07-06  6:13         ` Robert Jarzmik
2015-06-18 10:54 ` [PATCH 17/41] clocksource: qcom: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-19 19:10   ` Stephen Boyd
2015-06-19 19:10     ` Stephen Boyd
2015-06-18 10:54 ` [PATCH 18/41] clocksource: rockchip: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 19/41] clocksource: samsung_pwm: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 20/41] clocksource: sh_cmt: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 13:10   ` Laurent Pinchart
2015-06-18 13:10     ` Laurent Pinchart
2015-06-18 10:54 ` [PATCH 21/41] clocksource: sh_mtu2: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 13:10   ` Laurent Pinchart
2015-06-18 13:10     ` Laurent Pinchart
2015-06-18 10:54 ` [PATCH 22/41] clocksource: sh_tmu: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 13:10   ` Laurent Pinchart
2015-06-18 13:10     ` Laurent Pinchart
2015-06-18 10:54 ` [PATCH 23/41] clocksource: sun4i: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 12:01   ` Maxime Ripard
2015-06-18 12:01     ` Maxime Ripard
2015-06-18 12:23     ` Viresh Kumar
2015-06-18 12:23       ` Viresh Kumar
2015-06-19 10:30       ` Maxime Ripard
2015-06-19 10:30         ` Maxime Ripard
2015-06-18 10:54 ` [PATCH 24/41] clocksource: tcb_clksrc: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 25/41] clocksource: tegra20: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-02 19:41   ` Daniel Lezcano
2015-07-02 19:41     ` Daniel Lezcano
2015-07-03  8:54     ` Viresh Kumar
2015-07-03  8:54       ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 26/41] clocksource: time-armada-370-xp: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 27/41] clocksource: efm32: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 28/41] clocksource: orion: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 29/41] clocksource: atlas7: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 30/41] clocksource: atmel: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 14:28   ` Alexandre Belloni [this message]
2015-06-18 14:28     ` Alexandre Belloni
2015-06-18 10:54 ` [PATCH 31/41] clocksource: atmel-st: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 14:40   ` Alexandre Belloni
2015-06-18 14:40     ` Alexandre Belloni
2015-06-19  1:49     ` Viresh Kumar
2015-06-19  1:49       ` Viresh Kumar
2015-06-19 11:48       ` Alexandre Belloni
2015-06-19 11:48         ` Alexandre Belloni
2015-06-19 11:52         ` Viresh Kumar
2015-06-19 11:52           ` Viresh Kumar
2015-06-19 12:06           ` Alexandre Belloni
2015-06-19 12:06             ` Alexandre Belloni
2015-06-18 10:54 ` [PATCH 32/41] clocksource: digicolor: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-23 10:17   ` Baruch Siach
2015-06-23 10:17     ` Baruch Siach
2015-06-23 10:21     ` Viresh Kumar
2015-06-23 10:21       ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 33/41] clocksource: integrator: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-14 13:35   ` Linus Walleij
2015-07-14 13:35     ` Linus Walleij
2015-06-18 10:54 ` [PATCH 34/41] clocksource: keystone: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 35/41] clocksource: prima2: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 36/41] clocksource: stm32: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 11:09   ` Maxime Coquelin
2015-06-18 11:09     ` Maxime Coquelin
2015-06-18 11:32     ` Viresh Kumar
2015-06-18 11:32       ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 37/41] clocksource: sun5i: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 38/41] clocksource: u300: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-14 13:36   ` Linus Walleij
2015-07-14 13:36     ` Linus Walleij
2015-06-18 10:54 ` [PATCH 39/41] clocksource: vf_pit: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-03  8:10   ` Stefan Agner
2015-07-03  8:10     ` Stefan Agner
2015-07-03  8:57     ` Viresh Kumar
2015-07-03  8:57       ` Viresh Kumar
2015-07-03 11:11       ` Stefan Agner
2015-07-03 11:11         ` Stefan Agner
2015-07-03 11:17         ` Viresh Kumar
2015-07-03 11:17           ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 40/41] clocksource: vt8500: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-06-18 10:54 ` [PATCH 41/41] clocksource: zevio: " Viresh Kumar
2015-06-18 10:54   ` Viresh Kumar
2015-07-02 20:11   ` Daniel Lezcano
2015-07-02 20:11     ` Daniel Lezcano
2015-07-03  8:56     ` Viresh Kumar
2015-07-03  8:56       ` Viresh Kumar
2015-07-03  8:59       ` Daniel Lezcano
2015-07-03  8:59         ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150618142801.GG27492@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.