Lines Matching refs:timer

67 to_ingenic_tcu(struct ingenic_tcu_timer *timer)  in to_ingenic_tcu()  argument
69 return container_of(timer, struct ingenic_tcu, timers[timer->cpu]); in to_ingenic_tcu()
80 struct ingenic_tcu_timer *timer = to_ingenic_tcu_timer(evt); in ingenic_tcu_cevt_set_state_shutdown() local
81 struct ingenic_tcu *tcu = to_ingenic_tcu(timer); in ingenic_tcu_cevt_set_state_shutdown()
83 regmap_write(tcu->map, TCU_REG_TECR, BIT(timer->channel)); in ingenic_tcu_cevt_set_state_shutdown()
91 struct ingenic_tcu_timer *timer = to_ingenic_tcu_timer(evt); in ingenic_tcu_cevt_set_next() local
92 struct ingenic_tcu *tcu = to_ingenic_tcu(timer); in ingenic_tcu_cevt_set_next()
97 regmap_write(tcu->map, TCU_REG_TDFRc(timer->channel), next); in ingenic_tcu_cevt_set_next()
98 regmap_write(tcu->map, TCU_REG_TCNTc(timer->channel), 0); in ingenic_tcu_cevt_set_next()
99 regmap_write(tcu->map, TCU_REG_TESR, BIT(timer->channel)); in ingenic_tcu_cevt_set_next()
113 struct ingenic_tcu_timer *timer = dev_id; in ingenic_tcu_cevt_cb() local
114 struct ingenic_tcu *tcu = to_ingenic_tcu(timer); in ingenic_tcu_cevt_cb()
117 regmap_write(tcu->map, TCU_REG_TECR, BIT(timer->channel)); in ingenic_tcu_cevt_cb()
119 if (timer->cevt.event_handler) { in ingenic_tcu_cevt_cb()
120 csd = &per_cpu(ingenic_cevt_csd, timer->cpu); in ingenic_tcu_cevt_cb()
121 csd->info = (void *) &timer->cevt; in ingenic_tcu_cevt_cb()
123 smp_call_function_single_async(timer->cpu, csd); in ingenic_tcu_cevt_cb()
143 struct ingenic_tcu_timer *timer = &tcu->timers[cpu]; in ingenic_tcu_setup_cevt() local
149 timer->clk = ingenic_tcu_get_clock(tcu->np, timer->channel); in ingenic_tcu_setup_cevt()
150 if (IS_ERR(timer->clk)) in ingenic_tcu_setup_cevt()
151 return PTR_ERR(timer->clk); in ingenic_tcu_setup_cevt()
153 err = clk_prepare_enable(timer->clk); in ingenic_tcu_setup_cevt()
157 rate = clk_get_rate(timer->clk); in ingenic_tcu_setup_cevt()
169 timer_virq = irq_create_mapping(domain, timer->channel); in ingenic_tcu_setup_cevt()
175 snprintf(timer->name, sizeof(timer->name), "TCU%u", timer->channel); in ingenic_tcu_setup_cevt()
178 timer->name, timer); in ingenic_tcu_setup_cevt()
182 timer->cpu = smp_processor_id(); in ingenic_tcu_setup_cevt()
183 timer->cevt.cpumask = cpumask_of(smp_processor_id()); in ingenic_tcu_setup_cevt()
184 timer->cevt.features = CLOCK_EVT_FEAT_ONESHOT; in ingenic_tcu_setup_cevt()
185 timer->cevt.name = timer->name; in ingenic_tcu_setup_cevt()
186 timer->cevt.rating = 200; in ingenic_tcu_setup_cevt()
187 timer->cevt.set_state_shutdown = ingenic_tcu_cevt_set_state_shutdown; in ingenic_tcu_setup_cevt()
188 timer->cevt.set_next_event = ingenic_tcu_cevt_set_next; in ingenic_tcu_setup_cevt()
190 clockevents_config_and_register(&timer->cevt, rate, 10, 0xffff); in ingenic_tcu_setup_cevt()
197 clk_disable_unprepare(timer->clk); in ingenic_tcu_setup_cevt()
199 clk_put(timer->clk); in ingenic_tcu_setup_cevt()
276 struct ingenic_tcu_timer *timer; in ingenic_tcu_init() local
317 timer = &tcu->timers[cpu]; in ingenic_tcu_init()
319 timer->cpu = cpu; in ingenic_tcu_init()
320 timer->channel = find_next_zero_bit(&tcu->pwm_channels_mask, in ingenic_tcu_init()
323 last_bit = timer->channel; in ingenic_tcu_init()