Lines Matching full:channel

95 static int idt82p33_dpll_set_mode(struct idt82p33_channel *channel,  in idt82p33_dpll_set_mode()  argument
98 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_dpll_set_mode()
102 if (channel->pll_mode == mode) in idt82p33_dpll_set_mode()
105 err = idt82p33_read(idt82p33, channel->dpll_mode_cnfg, in idt82p33_dpll_set_mode()
114 err = idt82p33_write(idt82p33, channel->dpll_mode_cnfg, in idt82p33_dpll_set_mode()
119 channel->pll_mode = mode; in idt82p33_dpll_set_mode()
124 static int _idt82p33_gettime(struct idt82p33_channel *channel, in _idt82p33_gettime() argument
127 struct idt82p33 *idt82p33 = channel->idt82p33; in _idt82p33_gettime()
136 err = idt82p33_write(idt82p33, channel->dpll_tod_trigger, in _idt82p33_gettime()
145 err = idt82p33_read(idt82p33, channel->dpll_tod_sts, buf, sizeof(buf)); in _idt82p33_gettime()
161 static int _idt82p33_settime(struct idt82p33_channel *channel, in _idt82p33_settime() argument
164 struct idt82p33 *idt82p33 = channel->idt82p33; in _idt82p33_settime()
175 err = idt82p33_write(idt82p33, channel->dpll_tod_trigger, in _idt82p33_settime()
196 err = idt82p33_write(idt82p33, channel->dpll_tod_cnfg + i, in _idt82p33_settime()
205 static int _idt82p33_adjtime(struct idt82p33_channel *channel, s64 delta_ns) in _idt82p33_adjtime() argument
207 struct idt82p33 *idt82p33 = channel->idt82p33; in _idt82p33_adjtime()
214 err = _idt82p33_gettime(channel, &ts); in _idt82p33_adjtime()
224 err = _idt82p33_settime(channel, &ts); in _idt82p33_adjtime()
229 static int _idt82p33_adjfine(struct idt82p33_channel *channel, long scaled_ppm) in _idt82p33_adjfine() argument
231 struct idt82p33 *idt82p33 = channel->idt82p33; in _idt82p33_adjfine()
236 if (scaled_ppm == channel->current_freq_ppb) in _idt82p33_adjfine()
261 err = idt82p33_dpll_set_mode(channel, PLL_MODE_DCO); in _idt82p33_adjfine()
266 err = idt82p33_write(idt82p33, channel->dpll_freq_cnfg, in _idt82p33_adjfine()
270 channel->current_freq_ppb = scaled_ppm; in _idt82p33_adjfine()
276 struct idt82p33_channel *channel, s64 *overhead_ns) in idt82p33_measure_one_byte_write_overhead() argument
278 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_measure_one_byte_write_overhead()
294 err = idt82p33_write(idt82p33, channel->dpll_tod_trigger, in idt82p33_measure_one_byte_write_overhead()
311 struct idt82p33_channel *channel) in idt82p33_measure_tod_write_9_byte_overhead() argument
313 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_measure_tod_write_9_byte_overhead()
330 channel->dpll_tod_cnfg + i, in idt82p33_measure_tod_write_9_byte_overhead()
348 struct idt82p33_channel *channel, s64 *overhead_ns) in idt82p33_measure_settime_gettime_gap_overhead() argument
356 err = _idt82p33_settime(channel, &ts1); in idt82p33_measure_settime_gettime_gap_overhead()
361 err = _idt82p33_gettime(channel, &ts2); in idt82p33_measure_settime_gettime_gap_overhead()
369 static int idt82p33_measure_tod_write_overhead(struct idt82p33_channel *channel) in idt82p33_measure_tod_write_overhead() argument
372 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_measure_tod_write_overhead()
377 err = idt82p33_measure_settime_gettime_gap_overhead(channel, &gap_ns); in idt82p33_measure_tod_write_overhead()
385 err = idt82p33_measure_one_byte_write_overhead(channel, in idt82p33_measure_tod_write_overhead()
391 err = idt82p33_measure_tod_write_9_byte_overhead(channel); in idt82p33_measure_tod_write_overhead()
420 idt82p33->channel[0].output_mask = val; in idt82p33_check_and_set_masks()
423 idt82p33->channel[1].output_mask = val; in idt82p33_check_and_set_masks()
442 i, idt82p33->channel[i].output_mask); in idt82p33_display_masks()
446 static int idt82p33_sync_tod(struct idt82p33_channel *channel, bool enable) in idt82p33_sync_tod() argument
448 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_sync_tod()
452 err = idt82p33_read(idt82p33, channel->dpll_sync_cnfg, in idt82p33_sync_tod()
461 return idt82p33_write(idt82p33, channel->dpll_sync_cnfg, in idt82p33_sync_tod()
465 static int idt82p33_output_enable(struct idt82p33_channel *channel, in idt82p33_output_enable() argument
468 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_output_enable()
483 static int idt82p33_output_mask_enable(struct idt82p33_channel *channel, in idt82p33_output_mask_enable() argument
490 mask = channel->output_mask; in idt82p33_output_mask_enable()
495 err = idt82p33_output_enable(channel, enable, outn); in idt82p33_output_mask_enable()
507 static int idt82p33_perout_enable(struct idt82p33_channel *channel, in idt82p33_perout_enable() argument
515 return idt82p33_output_mask_enable(channel, enable); in idt82p33_perout_enable()
518 return idt82p33_output_enable(channel, enable, perout->index); in idt82p33_perout_enable()
521 static int idt82p33_enable_tod(struct idt82p33_channel *channel) in idt82p33_enable_tod() argument
523 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_enable_tod()
527 err = idt82p33_measure_tod_write_overhead(channel); in idt82p33_enable_tod()
535 err = _idt82p33_settime(channel, &ts); in idt82p33_enable_tod()
540 return idt82p33_sync_tod(channel, true); in idt82p33_enable_tod()
545 struct idt82p33_channel *channel; in idt82p33_ptp_clock_unregister_all() local
550 channel = &idt82p33->channel[i]; in idt82p33_ptp_clock_unregister_all()
552 if (channel->ptp_clock) in idt82p33_ptp_clock_unregister_all()
553 ptp_clock_unregister(channel->ptp_clock); in idt82p33_ptp_clock_unregister_all()
560 struct idt82p33_channel *channel = in idt82p33_enable() local
562 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_enable()
569 err = idt82p33_perout_enable(channel, false, in idt82p33_enable()
576 err = idt82p33_perout_enable(channel, true, in idt82p33_enable()
590 struct idt82p33_channel *channel = in idt82p33_adjwritephase() local
592 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_adjwritephase()
615 err = idt82p33_dpll_set_mode(channel, PLL_MODE_WPH); in idt82p33_adjwritephase()
622 err = idt82p33_write(idt82p33, channel->dpll_phase_cnfg, val, in idt82p33_adjwritephase()
632 struct idt82p33_channel *channel = in idt82p33_adjfine() local
634 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_adjfine()
638 err = _idt82p33_adjfine(channel, scaled_ppm); in idt82p33_adjfine()
649 struct idt82p33_channel *channel = in idt82p33_adjtime() local
651 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_adjtime()
661 err = _idt82p33_adjtime(channel, delta_ns); in idt82p33_adjtime()
673 struct idt82p33_channel *channel = in idt82p33_gettime() local
675 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_gettime()
679 err = _idt82p33_gettime(channel, ts); in idt82p33_gettime()
691 struct idt82p33_channel *channel = in idt82p33_settime() local
693 struct idt82p33 *idt82p33 = channel->idt82p33; in idt82p33_settime()
697 err = _idt82p33_settime(channel, ts); in idt82p33_settime()
706 static int idt82p33_channel_init(struct idt82p33_channel *channel, int index) in idt82p33_channel_init() argument
710 channel->dpll_tod_cnfg = DPLL1_TOD_CNFG; in idt82p33_channel_init()
711 channel->dpll_tod_trigger = DPLL1_TOD_TRIGGER; in idt82p33_channel_init()
712 channel->dpll_tod_sts = DPLL1_TOD_STS; in idt82p33_channel_init()
713 channel->dpll_mode_cnfg = DPLL1_OPERATING_MODE_CNFG; in idt82p33_channel_init()
714 channel->dpll_freq_cnfg = DPLL1_HOLDOVER_FREQ_CNFG; in idt82p33_channel_init()
715 channel->dpll_phase_cnfg = DPLL1_PHASE_OFFSET_CNFG; in idt82p33_channel_init()
716 channel->dpll_sync_cnfg = DPLL1_SYNC_EDGE_CNFG; in idt82p33_channel_init()
717 channel->dpll_input_mode_cnfg = DPLL1_INPUT_MODE_CNFG; in idt82p33_channel_init()
720 channel->dpll_tod_cnfg = DPLL2_TOD_CNFG; in idt82p33_channel_init()
721 channel->dpll_tod_trigger = DPLL2_TOD_TRIGGER; in idt82p33_channel_init()
722 channel->dpll_tod_sts = DPLL2_TOD_STS; in idt82p33_channel_init()
723 channel->dpll_mode_cnfg = DPLL2_OPERATING_MODE_CNFG; in idt82p33_channel_init()
724 channel->dpll_freq_cnfg = DPLL2_HOLDOVER_FREQ_CNFG; in idt82p33_channel_init()
725 channel->dpll_phase_cnfg = DPLL2_PHASE_OFFSET_CNFG; in idt82p33_channel_init()
726 channel->dpll_sync_cnfg = DPLL2_SYNC_EDGE_CNFG; in idt82p33_channel_init()
727 channel->dpll_input_mode_cnfg = DPLL2_INPUT_MODE_CNFG; in idt82p33_channel_init()
733 channel->current_freq_ppb = 0; in idt82p33_channel_init()
753 struct idt82p33_channel *channel; in idt82p33_enable_channel() local
759 channel = &idt82p33->channel[index]; in idt82p33_enable_channel()
761 err = idt82p33_channel_init(channel, index); in idt82p33_enable_channel()
769 channel->idt82p33 = idt82p33; in idt82p33_enable_channel()
771 idt82p33_caps_init(&channel->caps); in idt82p33_enable_channel()
772 snprintf(channel->caps.name, sizeof(channel->caps.name), in idt82p33_enable_channel()
775 channel->ptp_clock = ptp_clock_register(&channel->caps, NULL); in idt82p33_enable_channel()
777 if (IS_ERR(channel->ptp_clock)) { in idt82p33_enable_channel()
778 err = PTR_ERR(channel->ptp_clock); in idt82p33_enable_channel()
779 channel->ptp_clock = NULL; in idt82p33_enable_channel()
783 if (!channel->ptp_clock) in idt82p33_enable_channel()
786 err = idt82p33_dpll_set_mode(channel, PLL_MODE_DCO); in idt82p33_enable_channel()
794 err = idt82p33_enable_tod(channel); in idt82p33_enable_channel()
803 index, channel->ptp_clock->index); in idt82p33_enable_channel()
886 idt82p33->channel[0].output_mask = DEFAULT_OUTPUT_MASK_PLL0; in idt82p33_probe()
887 idt82p33->channel[1].output_mask = DEFAULT_OUTPUT_MASK_PLL1; in idt82p33_probe()