Lines Matching full:pps

41 static void pps_echo_client_default(struct pps_device *pps, int event,  in pps_echo_client_default()  argument
44 dev_info(&pps->dev, "echo %s %s\n", in pps_echo_client_default()
53 /* pps_register_source - add a PPS source in the system
54 * @info: the PPS info struct
55 * @default_params: the default PPS parameters of the new source
57 * This function is used to add a new PPS source in the system. The new
58 * source is described by info's fields and it will have, as default PPS
61 * The function returns, in case of success, the PPS device. Otherwise
68 struct pps_device *pps; in pps_register_source() local
85 /* Allocate memory for the new PPS source struct */ in pps_register_source()
86 pps = kzalloc_obj(struct pps_device); in pps_register_source()
87 if (pps == NULL) { in pps_register_source()
95 pps->params.api_version = PPS_API_VERS; in pps_register_source()
96 pps->params.mode = default_params; in pps_register_source()
97 pps->info = *info; in pps_register_source()
100 if ((pps->info.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) && in pps_register_source()
101 pps->info.echo == NULL) in pps_register_source()
102 pps->info.echo = pps_echo_client_default; in pps_register_source()
104 init_waitqueue_head(&pps->queue); in pps_register_source()
105 spin_lock_init(&pps->lock); in pps_register_source()
108 err = pps_register_cdev(pps); in pps_register_source()
115 dev_dbg(&pps->dev, "new PPS source %s\n", info->name); in pps_register_source()
117 return pps; in pps_register_source()
126 /* pps_unregister_source - remove a PPS source from the system
127 * @pps: the PPS source
129 * This function is used to remove a previously registered PPS source from
133 void pps_unregister_source(struct pps_device *pps) in pps_unregister_source() argument
135 pps_kc_remove(pps); in pps_unregister_source()
136 pps_unregister_cdev(pps); in pps_unregister_source()
138 /* don't have to kfree(pps) here because it will be done on in pps_unregister_source()
143 /* pps_event - register a PPS event into the system
144 * @pps: the PPS device
149 * This function is used by each PPS client in order to register a new
150 * PPS event into the system (it's usually called inside an IRQ handler).
152 * If an echo function is associated with the PPS device it will be called
154 * pps->info.echo(pps, event, data);
156 void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, in pps_event() argument
166 dev_dbg(&pps->dev, "PPS event at %ptSp\n", &ts->ts_real); in pps_event()
170 spin_lock_irqsave(&pps->lock, flags); in pps_event()
173 if ((pps->params.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR))) in pps_event()
174 pps->info.echo(pps, event, data); in pps_event()
177 pps->current_mode = pps->params.mode; in pps_event()
178 if (event & pps->params.mode & PPS_CAPTUREASSERT) { in pps_event()
180 if (pps->params.mode & PPS_OFFSETASSERT) in pps_event()
182 &pps->params.assert_off_tu); in pps_event()
185 pps->assert_tu = ts_real; in pps_event()
186 pps->assert_sequence++; in pps_event()
187 dev_dbg(&pps->dev, "capture assert seq #%u\n", in pps_event()
188 pps->assert_sequence); in pps_event()
192 if (event & pps->params.mode & PPS_CAPTURECLEAR) { in pps_event()
194 if (pps->params.mode & PPS_OFFSETCLEAR) in pps_event()
196 &pps->params.clear_off_tu); in pps_event()
199 pps->clear_tu = ts_real; in pps_event()
200 pps->clear_sequence++; in pps_event()
201 dev_dbg(&pps->dev, "capture clear seq #%u\n", in pps_event()
202 pps->clear_sequence); in pps_event()
207 pps_kc_event(pps, ts, event); in pps_event()
211 pps->last_ev++; in pps_event()
212 wake_up_interruptible_all(&pps->queue); in pps_event()
214 kill_fasync(&pps->async_queue, SIGIO, POLL_IN); in pps_event()
217 spin_unlock_irqrestore(&pps->lock, flags); in pps_event()