static void em_sti_clock_event_mode(enum clock_event_mode mode, struct clock_event_device *ced) { struct em_sti_priv *p = ced_to_em_sti(ced); /* deal with old setting first */ switch (ced->mode) { case CLOCK_EVT_MODE_ONESHOT: em_sti_stop(p, USER_CLOCKEVENT); break; default: break; } switch (mode) { case CLOCK_EVT_MODE_ONESHOT: dev_info(&p->pdev->dev, "used for oneshot clock events\n"); em_sti_start(p, USER_CLOCKEVENT); clockevents_config(&p->ced, p->rate); break; case CLOCK_EVT_MODE_SHUTDOWN: case CLOCK_EVT_MODE_UNUSED: em_sti_stop(p, USER_CLOCKEVENT); break; default: break; } }
/** * clockevents_update_freq - Update frequency and reprogram a clock event device. * @dev: device to modify * @freq: new device frequency * * Reconfigure and reprogram a clock event device in oneshot * mode. Must be called on the cpu for which the device delivers per * cpu timer events with interrupts disabled! Returns 0 on success, * -ETIME when the event is in the past. */ int clockevents_update_freq(struct clock_event_device *dev, u32 freq) { clockevents_config(dev, freq); if (dev->mode != CLOCK_EVT_MODE_ONESHOT) return 0; return clockevents_program_event(dev, dev->next_event, false); }
/** * clockevents_config_and_register - Configure and register a clock event device * @dev: device to register * @freq: The clock frequency * @min_delta: The minimum clock ticks to program in oneshot mode * @max_delta: The maximum clock ticks to program in oneshot mode * * min/max_delta can be 0 for devices which do not support oneshot mode. */ void clockevents_config_and_register(struct clock_event_device *dev, u32 freq, unsigned long min_delta, unsigned long max_delta) { dev->min_delta_ticks = min_delta; dev->max_delta_ticks = max_delta; clockevents_config(dev, freq); clockevents_register_device(dev); }
static int em_sti_clock_event_set_oneshot(struct clock_event_device *ced) { struct em_sti_priv *p = ced_to_em_sti(ced); dev_info(&p->pdev->dev, "used for oneshot clock events\n"); em_sti_start(p, USER_CLOCKEVENT); clockevents_config(&p->ced, p->rate); return 0; }
static void sh_tmu_clock_event_start(struct sh_tmu_channel *ch, int periodic) { struct clock_event_device *ced = &ch->ced; sh_tmu_enable(ch); clockevents_config(ced, ch->rate); if (periodic) { ch->periodic = (ch->rate + HZ/2) / HZ; sh_tmu_set_next(ch, ch->periodic, 1); } }
static void sh_tmu_clock_event_start(struct sh_tmu_priv *p, int periodic) { struct clock_event_device *ced = &p->ced; sh_tmu_enable(p); clockevents_config(ced, p->rate); if (periodic) { p->periodic = (p->rate + HZ/2) / HZ; sh_tmu_set_next(p, p->periodic, 1); } }