Lines Matching refs:phc
51 struct mock_phc *phc = info_to_phc(info);
57 spin_lock(&phc->lock);
58 timecounter_read(&phc->tc);
59 phc->cc.mult = MOCK_PHC_CC_MULT + adj;
60 spin_unlock(&phc->lock);
67 struct mock_phc *phc = info_to_phc(info);
69 spin_lock(&phc->lock);
70 timecounter_adjtime(&phc->tc, delta);
71 spin_unlock(&phc->lock);
79 struct mock_phc *phc = info_to_phc(info);
82 spin_lock(&phc->lock);
83 timecounter_init(&phc->tc, &phc->cc, ns);
84 spin_unlock(&phc->lock);
91 struct mock_phc *phc = info_to_phc(info);
94 spin_lock(&phc->lock);
95 ns = timecounter_read(&phc->tc);
96 spin_unlock(&phc->lock);
112 int mock_phc_index(struct mock_phc *phc)
114 return ptp_clock_index(phc->clock);
120 struct mock_phc *phc;
123 phc = kzalloc(sizeof(*phc), GFP_KERNEL);
124 if (!phc) {
129 phc->info = (struct ptp_clock_info) {
140 phc->cc = (struct cyclecounter) {
147 spin_lock_init(&phc->lock);
148 timecounter_init(&phc->tc, &phc->cc, 0);
150 phc->clock = ptp_clock_register(&phc->info, dev);
151 if (IS_ERR(phc->clock)) {
152 err = PTR_ERR(phc->clock);
156 ptp_schedule_worker(phc->clock, MOCK_PHC_REFRESH_INTERVAL);
158 return phc;
161 kfree(phc);
167 void mock_phc_destroy(struct mock_phc *phc)
169 ptp_clock_unregister(phc->clock);
170 kfree(phc);