On 02/15/17 15:31, Andrey Drobyshev wrote:
> From: Alexander GQ Gerasiov <[email protected]>
>
> On some devices it may be necessary to transmit inverted data. This commit
> simply adds polarity parameter to define which state represents presence of
> signal: it equals 0 if signal is on the low level (default), or 1 if signal
> is on the high level (inverted signal).
>
> Signed-off-by: Alexander GQ Gerasiov <[email protected]>
> ---
> drivers/pps/generators/pps_gen_parport.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
> index dcd39fb..7739301 100644
> --- a/drivers/pps/generators/pps_gen_parport.c
> +++ b/drivers/pps/generators/pps_gen_parport.c
> @@ -36,8 +36,8 @@
>
> #define DRVDESC "parallel port PPS signal generator"
>
> -#define SIGNAL 0
> -#define NO_SIGNAL PARPORT_CONTROL_STROBE
> +#define SIGNAL (polarity?PARPORT_CONTROL_STROBE:0)
> +#define NO_SIGNAL (polarity?0:PARPORT_CONTROL_STROBE)
Add spaces:
> +#define SIGNAL (polarity ? PARPORT_CONTROL_STROBE : 0)
> +#define NO_SIGNAL (polarity ? 0 : PARPORT_CONTROL_STROBE)
> /* module parameters */
>
> @@ -48,6 +48,10 @@ MODULE_PARM_DESC(delay,
> "Delay between setting and dropping the signal (ns)");
> module_param_named(delay, send_delay, uint, 0);
>
> +static unsigned int polarity;
> +MODULE_PARM_DESC(polarity,
> + "Signal is on the low level (0 - default) or on the high level (1).");
> +module_param(polarity, uint, 0);
>
> #define SAFETY_INTERVAL 3000 /* set the hrtimer earlier for safety (ns) */
Acked-by: Rodolfo Giometti <[email protected]>