All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH V2] clockevents: rockchip: Add rockchip timer for rk3288
Date: Mon, 26 Jan 2015 10:33:23 +0100	[thread overview]
Message-ID: <54C609E3.8020303@linaro.org> (raw)
In-Reply-To: <54C59782.80504-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

On 01/26/2015 02:25 AM, Kever Yang wrote:
> Hi Daniel,

Hi Kever,

[ ... ]

>> +static inline int rk_timer_set_next_event(unsigned long cycles,
>> +                      struct clock_event_device *ce)
>> +{
>> +    rk_timer_disable(ce);
>> +    rk_timer_update_counter(cycles, ce);
>> +    rk_timer_enable(ce, TIMER_MODE_USER_DEFINED_COUNT);
>> +    return 0;
>> +}
>> +
>> +static inline void rk_timer_set_mode(enum clock_event_mode mode,
>> +                     struct clock_event_device *ce)
>> +{
>> +    switch (mode) {
>> +    case CLOCK_EVT_MODE_PERIODIC:
>> +        rk_timer_disable(ce);
>> +        rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce);
>> +        rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING);
>> +    case CLOCK_EVT_MODE_ONESHOT:
> This driver seems init the timer as ONE SHOT mode, and we can
> set to PERIODIC by this code, but what if user set the timer
> as PERIODIC mode and then want to set back to ONESHOT mode?

Mmh, I think that will be followed by a call set_next_event, hence 
disabling the timer and set the right mode with the next event.


-- 
  <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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Kever Yang <kever.yang@rock-chips.com>, heiko@sntech.de
Cc: devicetree@vger.kernel.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH V2] clockevents: rockchip: Add rockchip timer for rk3288
Date: Mon, 26 Jan 2015 10:33:23 +0100	[thread overview]
Message-ID: <54C609E3.8020303@linaro.org> (raw)
In-Reply-To: <54C59782.80504@rock-chips.com>

On 01/26/2015 02:25 AM, Kever Yang wrote:
> Hi Daniel,

Hi Kever,

[ ... ]

>> +static inline int rk_timer_set_next_event(unsigned long cycles,
>> +                      struct clock_event_device *ce)
>> +{
>> +    rk_timer_disable(ce);
>> +    rk_timer_update_counter(cycles, ce);
>> +    rk_timer_enable(ce, TIMER_MODE_USER_DEFINED_COUNT);
>> +    return 0;
>> +}
>> +
>> +static inline void rk_timer_set_mode(enum clock_event_mode mode,
>> +                     struct clock_event_device *ce)
>> +{
>> +    switch (mode) {
>> +    case CLOCK_EVT_MODE_PERIODIC:
>> +        rk_timer_disable(ce);
>> +        rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce);
>> +        rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING);
>> +    case CLOCK_EVT_MODE_ONESHOT:
> This driver seems init the timer as ONE SHOT mode, and we can
> set to PERIODIC by this code, but what if user set the timer
> as PERIODIC mode and then want to set back to ONESHOT mode?

Mmh, I think that will be followed by a call set_next_event, hence 
disabling the timer and set the right mode with the next event.


-- 
  <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


  parent reply	other threads:[~2015-01-26  9:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25  9:42 [PATCH V2] clockevents: rockchip: Add rockchip timer for rk3288 Daniel Lezcano
2015-01-26  1:25 ` Kever Yang
     [not found]   ` <54C59782.80504-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-01-26  9:33     ` Daniel Lezcano [this message]
2015-01-26  9:33       ` Daniel Lezcano
     [not found] ` <1422178979-12382-1-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-25 20:52   ` Heiko Stübner
2015-01-25 20:52     ` Heiko Stübner
2015-01-25 21:16     ` Daniel Lezcano
     [not found]       ` <54C55D1A.9010706-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-25 21:28         ` Heiko Stübner
2015-01-25 21:28           ` Heiko Stübner
2015-01-26  9:43   ` Thomas Gleixner
2015-01-26  9:43     ` Thomas Gleixner
2015-01-26  9:50     ` 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=54C609E3.8020303@linaro.org \
    --to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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.