Re: [PATCH V2] clockevents: rockchip: Add rockchip timer for rk3288

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux