03 Nov, 2011
3 commits
-
Add "depends on GENERIC_HARDIRQS" to avoid compile breakage on s390:
drivers/built-in.o: In function `pps_gpio_remove':
linux-next/drivers/pps/clients/pps-gpio.c:189: undefined reference to `free_irq'Signed-off-by: Heiko Carstens
Cc: James Nuss
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This client driver allows you to use a GPIO pin as a source for PPS
signals. Platform data [1] are used to specify the GPIO pin number,
label, assert event edge type, and whether clear events are captured.This driver is based on the work by Ricardo Martins who submitted an
initial implementation [2] of a PPS IRQ client driver to the linuxpps
mailing-list on Dec 3 2010.[1] include/linux/pps-gpio.h
[2] http://ml.enneenne.com/pipermail/linuxpps/2010-December/004155.html[akpm@linux-foundation.org: remove unneeded cast of void*]
Signed-off-by: James Nuss
Cc: Ricardo Martins
Acked-by: Rodolfo Giometti
Signed-off-by: Ricardo Martins
Cc: Alexander Gordeev
Cc: Igor Plyatov
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
A default echo function has been provided so it is no longer an error when
you specify PPS_ECHOASSERT or PPS_ECHOCLEAR without an explicit echo
function. This allows some code re-use and also makes it easier to write
client drivers since the default echo function does not normally need to
change.Signed-off-by: James Nuss
Reviewed-by: Ben Gardiner
Acked-by: Rodolfo Giometti
Cc: Ricardo Martins
Cc: Alexander Gordeev
Cc: Igor Plyatov
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
31 Mar, 2011
1 commit
-
Fixes generated by 'codespell' and manually reviewed.
Signed-off-by: Lucas De Marchi
23 Mar, 2011
1 commit
-
Remove code enabled only when CONFIG_PREEMPT_RT is turned on because it is
not used in the vanilla kernel.Signed-off-by: Alexander Gordeev
Cc: john stultz
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Mar, 2011
1 commit
-
Replace EXTRA_CFLAGS with ccflags-y.
Signed-off-by: matt mooney
Acked-by: WANG Cong
Signed-off-by: Michal Marek
05 Mar, 2011
1 commit
-
This driver causes hard lockups, when the active clock soure is jiffies.
The reason is that it loops with interrupts disabled waiting for a
timestamp to be reached by polling getnstimeofday(). Though with a
jiffies clocksource, when that code runs on the same CPU which is
responsible for updating jiffies, then we loop in circles for ever
simply because the timer interrupt cannot update jiffies. So both UP
and SMP can be affected.There is no easy fix for that problem so make it depend on BROKEN for
now.Signed-off-by: Thomas Gleixner
Cc: Alexander Gordeev
Cc: Rodolfo Giometti
Cc: john stultz
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
26 Feb, 2011
1 commit
-
Initialize ts_real.flags to fix compiler warning about possible
uninitialized use of this field.Signed-off-by: Alexander Gordeev
Cc: john stultz
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
26 Jan, 2011
2 commits
-
Both pps_parport and pps_gen_parport are written in a way that they
can't share a port with any other driver. This can result in locking up
the process that loads modules or even the whole kernel if the modules
are compiled in. Use PARPORT_FLAG_EXCL to indicate this.Signed-off-by: Alexander Gordeev
Cc: Alexander Gordeev
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Signed-off-by: Rodolfo Giometti
Reported-by: Ingo Molnar
Cc: Alexander Gordeev
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Jan, 2011
16 commits
-
Add PPS signal generator which utilizes STROBE pin of a parallel port to
send PPS signals. It uses parport abstraction layer and hrtimers to
precisely control the signal.Signed-off-by: Alexander Gordeev
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add PPS signal generator which utilizes STROBE pin of a parallel port to
send PPS signals. It uses parport abstraction layer and hrtimers to
precisely control the signal.[akpm@linux-foundation.org: fix build]
Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add parallel port PPS client. It uses a standard method for capturing
timestamps for assert edge transitions: getting a timestamp soon after an
interrupt has happened.This is not a very precise source of time information due to interrupt
handling delays. However, timestamps for clear edge transitions are much
more precise because the interrupt handler continuously polls hardware
port until the transition is done.Hardware port operations require only about 1us so the maximum error
should not exceed this value. This was my primary goal when developing
this client.Clear edge capture could be disabled using clear_wait parameter.
Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add an optional feature of PPSAPI, kernel consumer support, which uses the
added hardpps() function.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This commit adds hardpps() implementation based upon the original one from
the NTPv4 reference kernel code from David Mills. However, it is highly
optimized towards very fast syncronization and maximum stickness to PPS
signal. The typical error is less then a microsecond.To make it sync faster I had to throw away exponential phase filter so
that the full phase offset is corrected immediately. Then I also had to
throw away median phase filter because it gives a bigger error itself if
used without exponential filter.Maybe we will find an appropriate filtering scheme in the future but it's
not necessary if the signal quality is ok.Signed-off-by: Alexander Gordeev
Acked-by: John Stultz
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Remove the code that gatheres timestamp in pps_tty_dcd_change() in case
passed ts parameter is NULL because it never happens in the current code.
Fix comments as well.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Bitwise conjunction is distributive so we can simplify some conditions.
Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This way less overhead is involved when running production kernel. If you
want to debug a pps client module please define DEBUG to enable the
checks.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Now pps_idr_lock is never used in interrupt context so we can replace
spin_lock_irq/spin_unlock_irq with plain spin_lock/spin_unlock. But
there is also a potential race condition when someone can steal an id
which was allocated by idr_pre_get before it is used. So convert spin
lock to mutex and protect the whole id generation process.Signed-off-by: Alexander Gordeev
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since now idr is only used to manage char device id's and not used in
kernel API anymore it should be moved to pps.c. This also makes it
possible to release id only at actual device freeing so nobody can
register a pps device with the same id while our device is not freed yet.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Since we now have direct pointers to struct pps_device everywhere it's
easy to use dev_* functions to print messages instead of plain printks.
Where dev_* cannot be used printks are converted to pr_*.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Using device index as a pointer needs some unnecessary work to be done
every time the pointer is needed (in irq handler for example). Using a
direct pointer is much more easy (and safe as well).Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add a helper function to gather timestamps. This way clients don't have
to duplicate it.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
There was a race in PPS_FETCH ioctl handler when several processes want to
obtain PPS data simultaneously using sleeping PPS_FETCH. They all sleep
most of the time in the system call.With the old approach when the first process waiting on the pps queue is
waken up it makes new system call right away and zeroes pps->go. So other
processes continue to sleep. This is a clear race condition because of
the global 'go' variable.With the new approach pps->last_ev holds some value increasing at each PPS
event. PPS_FETCH ioctl handler saves current value to the local variable
at the very beginning so it can safely check that there is a new event by
just comparing both variables.Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Move variable declarations where they are used in pps_cdev_ioctl.
Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Here are some very trivial fixes combined:
- add macro definitions to protect header file from including several times
- remove declaration for an unexistent array
- fix typos
Signed-off-by: Alexander Gordeev
Acked-by: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Mar, 2010
1 commit
-
…it slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
13 Mar, 2010
2 commits
-
Adds support, by using the PPS line discipline, for the PPS sources
connected with the CD (Carrier Detect) pin of a serial port.[akpm@linux-foundation.org: fix cast size warnings]
Signed-off-by: Rodolfo Giometti
Cc: David Woodhouse
Cc: Greg KH
Cc: Alan Cox
Cc: Alexander Gordeev
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Each PPS source can be registered/deregistered into the system by using
special modules called "clients". They simply define the PPS sources'
attributes and implement the time signal registration mechanism.This patch adds a special directory for such clients and adds a dummy
client that can be useful to test system integrity on real systems.[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Rodolfo Giometti
Cc: David Woodhouse
Cc: Greg KH
Cc: Alan Cox
Cc: Alexander Gordeev
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Nov, 2009
2 commits
-
PPS events must be recorded according to PPS's mode settings.
If a process asks for (i.e.) capture-assert events only, when the PPS
client calls the pps_event() function to save the current PPS event, we
should verify the event type and then discard unwanted ones.Also, without this patch userland processes waiting for a specific PPS
event (assert or clear but not both) may be awakened at wrong time.Signed-off-by: Rodolfo Giometti
Tested-by: William S. Brasher
Tested-by: Reg Clemens
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Userland programs may read/write PPS parameters at same time and these
operations may corrupt PPS data.Signed-off-by: Rodolfo Giometti
Tested-by: Reg Clemens
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
27 Aug, 2009
1 commit
-
Fix incorrect verdict check and returns error if device_create failed,
otherwise driver triggers kernel oops.Signed-off-by: Joonwoo Park
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
19 Jun, 2009
1 commit
-
This patch adds the kernel side of the PPS support currently named
"LinuxPPS".PPS means "pulse per second" and a PPS source is just a device which
provides a high precision signal each second so that an application can
use it to adjust system clock time.Common use is the combination of the NTPD as userland program with a GPS
receiver as PPS source to obtain a wallclock-time with sub-millisecond
synchronisation to UTC.To obtain this goal the userland programs shoud use the PPS API
specification (RFC 2783 - Pulse-Per-Second API for UNIX-like Operating
Systems, Version 1.0) which in part is implemented by this patch. It
provides a set of chars devices, one per PPS source, which can be used to
get the time signal. The RFC's functions can be implemented by accessing
to these char devices.Signed-off-by: Rodolfo Giometti
Cc: David Woodhouse
Cc: Greg KH
Cc: Randy Dunlap
Cc: Kay Sievers
Acked-by: Alan Cox
Cc: Michael Kerrisk
Cc: Christoph Hellwig
Cc: Roman Zippel
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds