All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] rtc: enable adjustment of clock offset
@ 2016-01-04 18:31 ` Joshua Clayton
  0 siblings, 0 replies; 85+ messages in thread
From: Joshua Clayton @ 2016-01-04 18:31 UTC (permalink / raw)
  To: Alexandre Belloni, Alessandro Zummo
  Cc: rtc-linux, linux-kernel, Joshua Clayton

Alexandre,
this is the second version of apatch set to be able to adjust the
clock on a pcf2123, but with a big addition. I am also proposing
a couple of new rtc api functions and a new sysfs file.

Patches 1-5 are very much v2 patches that address All of the
concerns you had with v1. It is my hope to get them merged without
too much more trouble.

Patches 6-8 are attemping to add a new function to the rtc class
to adjust the clock rate. I hope I am going about this the right way,
But here goes.

A number of rtc devices, such as the NXP pcf2123 include a facility
to adjust the clock in order to compensate for temperature or a
crystal, capacitor, etc, that results in the rtc clock not running
at exactly 32.768 kHz.

This patchset adds kernel and sysfs hooks to access that ability.

One datasheet suggests it might be adjusted based on input from 
a temperature sensor. I could also potentially see it being set
as part of ntp calibration.

Data sheets I have seen refer to this as a clock offset, and measure it
in parts per million (ppm), however they often reference ppm to 2 digits
of precision, which makes integer ppm less than ideal. I use parts per
billion, which more than covers the precision needed and works nicely
within 32 bits

The name "offset" came from the pcf-2123 datasheet and is used by at
least some other data sheets. I would be happy to use a different term
if someone else comes up with something more concise.
    
Changes since v1:
- Use the BIT() macro for all register bits
- Remove unneeded range checks from read/write functions
- Merge patch 3 (replace magic numbers with defines) into patch 2
- Add a proper commit message to patch 5, now patch 4
- Fix a function alignment bug.
- Move OSC_HAS_STOPPED check into pcf2123_rtc_read_time, and get rid of
  pcf2123_time_valid()
- Drop patches refactoring pcf2123 sysfs.
- Add rtc interface and rtc sysfs file for clock offset

Joshua Clayton (8):
  rtc-pcf2123: define registers and bit macros
  rtc-pcf2123: clean up reads from the chip
  rtc-pcf2123: clean up writes to the rtc chip
  rtc-pcf2123: refactor chip reset into a function
  rtc-pcf2123: avoid resetting the clock if possible
  rtc: Add functions to set and read clock offset
  rtc: implement a sysfs interface for clock offset
  rtc-pcf2123: implement read_offset and set_offset

 drivers/rtc/interface.c   |  57 ++++++++++
 drivers/rtc/rtc-pcf2123.c | 271 +++++++++++++++++++++++++++++++++-------------
 drivers/rtc/rtc-sysfs.c   |  29 +++++
 include/linux/rtc.h       |   4 +
 4 files changed, 284 insertions(+), 77 deletions(-)

-- 
2.5.0


^ permalink raw reply	[flat|nested] 85+ messages in thread

end of thread, other threads:[~2016-02-23 21:44 UTC | newest]

Thread overview: 85+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 18:31 [PATCH v2 0/8] rtc: enable adjustment of clock offset Joshua Clayton
2016-01-04 18:31 ` [rtc-linux] " Joshua Clayton
     [not found] ` <0000-cover-letter.patch>
2016-01-04 18:31   ` [PATCH v2 1/8] rtc-pcf2123: define registers and bit macros Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 2/8] rtc-pcf2123: clean up reads from the chip Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 3/8] rtc-pcf2123: clean up writes to the rtc chip Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 4/8] rtc-pcf2123: refactor chip reset into a function Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 5/8] rtc-pcf2123: avoid resetting the clock if possible Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 6/8] rtc: Add functions to set and read clock offset Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 7/8] rtc: implement a sysfs interface for " Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-31 11:41     ` Alexandre Belloni
2016-01-31 11:41       ` [rtc-linux] " Alexandre Belloni
2016-02-01 20:56       ` Joshua Clayton
2016-02-01 20:56         ` [rtc-linux] " Joshua Clayton
2016-02-02 10:41         ` Alexandre Belloni
2016-02-02 10:41           ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-02-04 22:07             ` Alexandre Belloni
2016-02-04 22:07               ` [rtc-linux] " Alexandre Belloni
2016-02-04 23:32               ` Joshua Clayton
2016-02-04 23:32                 ` [rtc-linux] " Joshua Clayton
2016-02-05 14:39                 ` Alexandre Belloni
2016-02-05 14:39                   ` [rtc-linux] " Alexandre Belloni
2016-02-05 20:41                   ` [PATCH v4 " Joshua Clayton
2016-02-05 20:41                     ` [rtc-linux] " Joshua Clayton
2016-02-05 20:41                     ` [PATCH v4 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton
2016-02-05 20:41                       ` [rtc-linux] " Joshua Clayton
2016-02-05 20:41                     ` [PATCH v4 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton
2016-02-05 20:41                       ` [rtc-linux] " Joshua Clayton
2016-02-23 18:47                     ` [PATCH v4 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton
2016-02-23 18:47                       ` [rtc-linux] " Joshua Clayton
2016-02-23 21:44                       ` Alexandre Belloni
2016-02-23 21:44                         ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-02-04 22:12             ` Alexandre Belloni
2016-02-04 22:12               ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 8/8] " Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-29 18:21   ` [PATCH v6 1/8] eal: pci: add api to rd/wr pci bar region Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 2/8] linuxapp/vfio: ignore mapping for ioport region Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 3/8] eal/linux: never check iopl for arm Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 4/8] virtio: Introduce config RTE_VIRTIO_INC_VECTOR Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 5/8] virtio: move io header and api from virtio_pci.h Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 6/8] virtio: add vfio api to rd/wr ioport space Santosh Shukla
2016-02-01 12:48       ` Yuanhan Liu
2016-02-02  4:30         ` Santosh Shukla
2016-02-02  5:19           ` Yuanhan Liu
2016-02-02  6:02             ` Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 7/8] virtio: extend pci rw api for vfio Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 8/8] virtio: do not parse if interface is vfio Santosh Shukla
2016-02-01 13:48     ` [PATCH v6 1/8] eal: pci: add api to rd/wr pci bar region Yuanhan Liu
2016-02-02  4:14       ` Santosh Shukla
2016-02-02  5:43         ` Yuanhan Liu
2016-02-02  5:50           ` David Marchand
2016-02-02  8:49             ` Yuanhan Liu
2016-02-02 15:51               ` Santosh Shukla
2016-02-02 16:18                 ` Santosh Shukla
2016-02-03  9:50                   ` Santosh Shukla
2016-02-03 11:50                     ` Yuanhan Liu
2016-02-05 17:56                       ` David Marchand
2016-02-03 11:43                   ` Yuanhan Liu
2016-02-02  7:00           ` Santosh Shukla
2016-02-02  7:01             ` Santosh Shukla
2016-02-08 10:03   ` [PATCH v8 3/4] eal/linux: vfio: ignore mapping for ioport region Santosh Shukla
2016-02-08 10:03     ` [PATCH v8 4/4] eal/linux: vfio: add pci ioport support Santosh Shukla
2016-02-08 14:13       ` Burakov, Anatoly
2016-02-09  9:04         ` David Marchand
2016-02-18  5:25           ` Santosh Shukla
2016-02-18 14:00             ` Thomas Monjalon
2016-01-26 14:56 ` [PATCH v2 0/8] rtc: enable adjustment of clock offset Joshua Clayton
2016-01-26 14:56   ` [rtc-linux] " Joshua Clayton
2016-01-26 16:00   ` Alexandre Belloni
2016-01-26 16:00     ` [rtc-linux] " Alexandre Belloni
2016-01-31 11:29     ` Alexandre Belloni
2016-01-31 11:29       ` [rtc-linux] " Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.