static int sh_tmu_clocksource_enable(struct clocksource *cs) { struct sh_tmu_priv *p = cs_to_sh_tmu(cs); int ret; ret = sh_tmu_enable(p); if (!ret) __clocksource_updatefreq_hz(cs, p->rate); return ret; }
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); } }
static int sh_tmu_clocksource_enable(struct clocksource *cs) { struct sh_tmu_priv *p = cs_to_sh_tmu(cs); int ret; ret = sh_tmu_enable(p); if (ret) return ret; /* TODO: calculate good shift from rate and counter bit width */ cs->shift = 10; cs->mult = clocksource_hz2mult(p->rate, cs->shift); return 0; }
static int sh_tmu_clocksource_enable(struct clocksource *cs) { struct sh_tmu_channel *ch = cs_to_sh_tmu(cs); int ret; if (WARN_ON(ch->cs_enabled)) return 0; ret = sh_tmu_enable(ch); if (!ret) { __clocksource_update_freq_hz(cs, ch->rate); ch->cs_enabled = true; } return ret; }
static int sh_tmu_clocksource_enable(struct clocksource *cs) { struct sh_tmu_priv *p = cs_to_sh_tmu(cs); int ret; if (WARN_ON(p->cs_enabled)) return 0; ret = sh_tmu_enable(p); if (!ret) { __clocksource_updatefreq_hz(cs, p->rate); p->cs_enabled = true; } return ret; }
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); /* TODO: calculate good shift from rate and counter bit width */ ced->shift = 32; ced->mult = div_sc(p->rate, NSEC_PER_SEC, ced->shift); ced->max_delta_ns = clockevent_delta2ns(0xffffffff, ced); ced->min_delta_ns = 5000; if (periodic) { p->periodic = (p->rate + HZ/2) / HZ; sh_tmu_set_next(p, p->periodic, 1); } }
static int sh_tmu_clocksource_enable(struct clocksource *cs) { struct sh_tmu_priv *p = cs_to_sh_tmu(cs); return sh_tmu_enable(p); }