* Tarun Kanti DebBarma <tarun.kanti@xxxxxx> [100622 12:35]: > +/** > + * omap_dm_timer_ms_correction - hardware correction for millisecond timer > + * @timer: GPTIMER on which the correction support is to be applied > + * @load: timer load value, used here to extract the expiry count > + */ > +static void omap_dm_timer_ms_correction(struct omap_dm_timer *timer, u32 load) > +{ > + int pos_increment, neg_increment; > + unsigned int count = (0xFFFFFFFF - load) * 1024; > + > + pos_increment = (DIV_ROUND_UP(count, 1000) * 1000000) \ > + - (count * 1000); > + neg_increment = ((DIV_ROUND_UP(count, 1000) - 1) * 1000000) \ > + - (count * 1000); > + omap_dm_timer_write_reg(timer, OMAP_TIMER_TICK_POS_REG, pos_increment); > + omap_dm_timer_write_reg(timer, OMAP_TIMER_TICK_NEG_REG, neg_increment); > +} > > struct omap_dm_timer *omap_dm_timer_request(void) > { > @@ -612,6 +639,10 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, > { > u32 l; > > +#ifdef CONFIG_ARCH_OMAP2PLUS > + if (timer->ms_correction) > + omap_dm_timer_ms_correction(timer, load); > +#endif > l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); > if (autoreload) { > l |= OMAP_TIMER_CTRL_AR; How do you know that the timer is configured to use the 32KiHZ source? Also, since omap2_gp_timer_set_next_event calls all the time, we don't want to do this calculation for every tick.. So we should make it a separate optional function. Or can we somehow calculate this drift once during init? Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html