[LinuxPPS] gpio-pps with echopin

Jan Lübbe jlu at pengutronix.de
Fri Apr 10 10:30:24 CEST 2015


Hi Frank,

On Do, 2015-04-09 at 12:32 +0200, Jan Lübbe wrote:
> The PPS framework distinguishes between "clients" and "generators".
> Clients receive PPS signals and generators produce them.
> 
> The correct place for this functionality would be in a new
> "pps_gen_gpio.c" driver, similar to "pps_gen_parport.c". Then, it
> could be used together with different PPS clients.

Looking again at the source, I'm not so sure anymore. ;)

In include/linux/pps_kernel.h we have:
struct pps_source_info {
...
        void (*echo)(struct pps_device *pps,
                        int event, void *data); /* PPS echo function */
...

This is then called from pps_event if set by the driver, but no current
driver actually implements this interface. All fall back to the default
implementation which just writes to the kernel log.

For the device-tree binding, something like
pps {
	compatible = "pps-gpio";
	gpios = <&gpio2 6 0>;
	echo-gpios = <&gpio2 7 0>;
}
is preferred (see Documentation/devicetree/bindings/gpio/gpio.txt).

The driver then can check if "echo-gpios" is set and set info.echo to a
function which sets that GPIO to the new value. In you patch, you added
many #ifdefs to the driver. That should not be needed if you make it
conditional on the existence of "echo-gpios" in the DT.

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





More information about the discussions mailing list