Lines Matching +full:clock +full:- +full:source
1 // SPDX-License-Identifier: GPL-2.0-only
7 * A clock source registers using mISDN_register_clock:
8 * name = text string to name clock source
9 * priority = value to priorize clock sources (0 = default)
10 * ctl = callback function to enable/disable clock source
11 * priv = private pointer of clock source
12 * return = pointer to clock source structure;
17 * A clock source calls mISDN_clock_update with given samples elapsed, if
21 * A clock source unregisters using mISDN_unregister_clock.
23 * To get current clock, call mISDN_clock_get. The signed short value
24 * counts the number of samples since. Time since last clock event is added.
39 static u16 iclock_count; /* counter of last clock */
40 static ktime_t iclock_timestamp; /* time stamp of last clock */
55 int pri = -128; in select_iclock()
58 if (iclock->pri > pri) { in select_iclock()
59 pri = iclock->pri; in select_iclock()
66 /* last used clock source still exists but changes, disable */ in select_iclock()
68 printk(KERN_DEBUG "Old clock source '%s' disable.\n", in select_iclock()
69 lastclock->name); in select_iclock()
70 lastclock->ctl(lastclock->priv, 0); in select_iclock()
73 /* new clock source selected, enable */ in select_iclock()
75 printk(KERN_DEBUG "New clock source '%s' enable.\n", in select_iclock()
76 bestclock->name); in select_iclock()
77 bestclock->ctl(bestclock->priv, 1); in select_iclock()
80 /* no clock received yet */ in select_iclock()
96 printk(KERN_ERR "%s: No memory for clock entry.\n", __func__); in mISDN_register_clock()
99 strscpy(iclock->name, name, sizeof(iclock->name)); in mISDN_register_clock()
100 iclock->pri = pri; in mISDN_register_clock()
101 iclock->priv = priv; in mISDN_register_clock()
102 iclock->ctl = ctl; in mISDN_register_clock()
104 list_add_tail(&iclock->list, &iclock_list); in mISDN_register_clock()
117 printk(KERN_DEBUG "%s: %s %d\n", __func__, iclock->name, in mISDN_unregister_clock()
118 iclock->pri); in mISDN_unregister_clock()
123 "Current clock source '%s' unregisters.\n", in mISDN_unregister_clock()
124 iclock->name); in mISDN_unregister_clock()
125 iclock->ctl(iclock->priv, 0); in mISDN_unregister_clock()
127 list_del(&iclock->list); in mISDN_unregister_clock()
142 printk(KERN_ERR "%s: '%s' sends us clock updates, but we do " in mISDN_clock_update()
144 iclock->name, in mISDN_clock_update()
145 iclock_current ? iclock_current->name : "nothing"); in mISDN_clock_update()
146 iclock->ctl(iclock->priv, 0); in mISDN_clock_update()
159 /* calc elapsed time by system clock */ in mISDN_clock_update()
172 printk("Received first clock from source '%s'.\n", in mISDN_clock_update()
173 iclock_current ? iclock_current->name : "nothing"); in mISDN_clock_update()
188 /* calc elapsed time by system clock */ in mISDN_clock_get()