Lines Matching refs:hc
205 struct hpet_channel *hc = hpet_base.channels + i; in hpet_reserve_platform_timers() local
208 hd.hd_irq[i] = hc->irq; in hpet_reserve_platform_timers()
210 switch (hc->mode) { in hpet_reserve_platform_timers()
213 hc->mode = HPET_MODE_DEVICE; in hpet_reserve_platform_timers()
217 hpet_reserve_timer(&hd, hc->num); in hpet_reserve_platform_timers()
230 struct hpet_channel *hc = hpet_base.channels + i; in hpet_select_device_channel() local
233 if (hc->mode == HPET_MODE_UNUSED) { in hpet_select_device_channel()
234 hc->mode = HPET_MODE_DEVICE; in hpet_select_device_channel()
396 static void hpet_init_clockevent(struct hpet_channel *hc, unsigned int rating) in hpet_init_clockevent() argument
398 struct clock_event_device *evt = &hc->evt; in hpet_init_clockevent()
401 evt->irq = hc->irq; in hpet_init_clockevent()
402 evt->name = hc->name; in hpet_init_clockevent()
403 evt->cpumask = cpumask_of(hc->cpu); in hpet_init_clockevent()
409 if (hc->boot_cfg & HPET_TN_PERIODIC) { in hpet_init_clockevent()
415 static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc) in hpet_legacy_clockevent_register() argument
421 hc->cpu = boot_cpu_data.cpu_index; in hpet_legacy_clockevent_register()
422 strncpy(hc->name, "hpet", sizeof(hc->name)); in hpet_legacy_clockevent_register()
423 hpet_init_clockevent(hc, 50); in hpet_legacy_clockevent_register()
425 hc->evt.tick_resume = hpet_clkevt_legacy_resume; in hpet_legacy_clockevent_register()
455 hc->evt.features |= CLOCK_EVT_FEAT_PERIODIC; in hpet_legacy_clockevent_register()
456 hc->evt.set_state_periodic = hpet_clkevt_set_state_periodic; in hpet_legacy_clockevent_register()
461 clockevents_config_and_register(&hc->evt, hpet_freq, in hpet_legacy_clockevent_register()
463 global_clock_event = &hc->evt; in hpet_legacy_clockevent_register()
474 struct hpet_channel *hc = irq_data_get_irq_handler_data(data); in hpet_msi_unmask() local
477 cfg = hpet_readl(HPET_Tn_CFG(hc->num)); in hpet_msi_unmask()
479 hpet_writel(cfg, HPET_Tn_CFG(hc->num)); in hpet_msi_unmask()
484 struct hpet_channel *hc = irq_data_get_irq_handler_data(data); in hpet_msi_mask() local
487 cfg = hpet_readl(HPET_Tn_CFG(hc->num)); in hpet_msi_mask()
489 hpet_writel(cfg, HPET_Tn_CFG(hc->num)); in hpet_msi_mask()
492 void hpet_msi_write(struct hpet_channel *hc, struct msi_msg *msg) in hpet_msi_write() argument
494 hpet_writel(msg->data, HPET_Tn_ROUTE(hc->num)); in hpet_msi_write()
495 hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hc->num) + 4); in hpet_msi_write()
500 struct hpet_channel *hc = clockevent_to_channel(evt); in hpet_clkevt_msi_resume() local
501 struct irq_data *data = irq_get_irq_data(hc->irq); in hpet_clkevt_msi_resume()
506 hpet_msi_write(hc, &msg); in hpet_clkevt_msi_resume()
513 struct hpet_channel *hc = data; in hpet_msi_interrupt_handler() local
514 struct clock_event_device *evt = &hc->evt; in hpet_msi_interrupt_handler()
517 pr_info("Spurious interrupt HPET channel %d\n", hc->num); in hpet_msi_interrupt_handler()
525 static int hpet_setup_msi_irq(struct hpet_channel *hc) in hpet_setup_msi_irq() argument
527 if (request_irq(hc->irq, hpet_msi_interrupt_handler, in hpet_setup_msi_irq()
529 hc->name, hc)) in hpet_setup_msi_irq()
532 disable_irq(hc->irq); in hpet_setup_msi_irq()
533 irq_set_affinity(hc->irq, cpumask_of(hc->cpu)); in hpet_setup_msi_irq()
534 enable_irq(hc->irq); in hpet_setup_msi_irq()
536 pr_debug("%s irq %u for MSI\n", hc->name, hc->irq); in hpet_setup_msi_irq()
542 static void init_one_hpet_msi_clockevent(struct hpet_channel *hc, int cpu) in init_one_hpet_msi_clockevent() argument
544 struct clock_event_device *evt = &hc->evt; in init_one_hpet_msi_clockevent()
546 hc->cpu = cpu; in init_one_hpet_msi_clockevent()
547 per_cpu(cpu_hpet_channel, cpu) = hc; in init_one_hpet_msi_clockevent()
548 hpet_setup_msi_irq(hc); in init_one_hpet_msi_clockevent()
550 hpet_init_clockevent(hc, 110); in init_one_hpet_msi_clockevent()
562 struct hpet_channel *hc = hpet_base.channels + i; in hpet_get_unused_clockevent() local
564 if (hc->mode != HPET_MODE_CLOCKEVT || hc->in_use) in hpet_get_unused_clockevent()
566 hc->in_use = 1; in hpet_get_unused_clockevent()
567 return hc; in hpet_get_unused_clockevent()
574 struct hpet_channel *hc = hpet_get_unused_clockevent(); in hpet_cpuhp_online() local
576 if (hc) in hpet_cpuhp_online()
577 init_one_hpet_msi_clockevent(hc, cpu); in hpet_cpuhp_online()
583 struct hpet_channel *hc = per_cpu(cpu_hpet_channel, cpu); in hpet_cpuhp_dead() local
585 if (!hc) in hpet_cpuhp_dead()
587 free_irq(hc->irq, hc); in hpet_cpuhp_dead()
588 hc->in_use = 0; in hpet_cpuhp_dead()
610 struct hpet_channel *hc = hpet_base.channels + i; in hpet_select_clockevents() local
613 if (hc->mode != HPET_MODE_UNUSED) in hpet_select_clockevents()
617 if (!(hc->boot_cfg & HPET_TN_FSB_CAP)) in hpet_select_clockevents()
620 sprintf(hc->name, "hpet%d", i); in hpet_select_clockevents()
622 irq = hpet_assign_irq(hpet_domain, hc, hc->num); in hpet_select_clockevents()
626 hc->irq = irq; in hpet_select_clockevents()
627 hc->mode = HPET_MODE_CLOCKEVT; in hpet_select_clockevents()
816 struct hpet_channel *hc; in hpet_enable() local
859 hc = kcalloc(channels, sizeof(*hc), GFP_KERNEL); in hpet_enable()
860 if (!hc) { in hpet_enable()
864 hpet_base.channels = hc; in hpet_enable()
876 for (i = 0; i < channels; i++, hc++) { in hpet_enable()
877 hc->num = i; in hpet_enable()
880 hc->boot_cfg = cfg; in hpet_enable()
882 hc->irq = irq; in hpet_enable()