Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbdCDHmk (ORCPT ); Sat, 4 Mar 2017 02:42:40 -0500 Received: from mail1.hce-engineering.com ([104.233.86.154]:42625 "EHLO mail1.hce-engineering.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750761AbdCDHmj (ORCPT ); Sat, 4 Mar 2017 02:42:39 -0500 To: Andrey Drobyshev , linux-kernel@vger.kernel.org References: <1487169069-15721-1-git-send-email-immortalguardian1@gmail.com> <1487169069-15721-8-git-send-email-immortalguardian1@gmail.com> Cc: gq@cs.msu.su From: Rodolfo Giometti Message-ID: <69f05d19-9e0d-3674-ee6f-1cf50b35985c@enneenne.com> Date: Sat, 4 Mar 2017 08:42:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1487169069-15721-8-git-send-email-immortalguardian1@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 93.146.66.165 X-SA-Exim-Mail-From: giometti@enneenne.com Subject: Re: [PATCH 7/8] LinuxPPS: pps_gen_parport: Add polarity parameter for inverted signal. X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on hce1.hce-engineering.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1650 Lines: 45 On 02/15/17 15:31, Andrey Drobyshev wrote: > From: Alexander GQ Gerasiov > > 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 > --- > 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