1. 12 11月, 2011 1 次提交
    • F
      vrtc: change its year offset from 1960 to 1972 · 57e6319d
      Feng Tang 提交于
      Real world year equals the value in vrtc YEAR register plus an offset.
      We used 1960 as the offset to make leap year consistent, but for a
      device's first use, its YEAR register is 0 and the system year will
      be parsed as 1960 which is not a valid UNIX time and will cause many
      applications to fail mysteriously. So we use 1972 instead to fix this
      issue.
      
      Updated patch which adds a sanity check suggested by Mathias
      
      This isn't a change in behaviour for systems, because 1972 is the one we
      actually use. It's the old version in upstream which is out of sync with
      all devices.
      Signed-off-by: NFeng Tang <feng.tang@intel.com>
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      57e6319d
  2. 03 11月, 2011 3 次提交
  3. 02 11月, 2011 1 次提交
  4. 01 11月, 2011 1 次提交
  5. 15 9月, 2011 2 次提交
  6. 27 8月, 2011 2 次提交
    • T
      rtc: twl: Fix registration vs. init order · 7e72c686
      Todd Poynor 提交于
      Only register as an RTC device after the hardware has been
      successfully initialized.  The RTC class driver will call
      back to this driver to read a pending alarm, and other
      drivers watching for new devices on the RTC class may
      read the RTC time upon registration.  Such access might
      occur while the RTC is stopped, prior to clearing
      pending alarms, etc.
      
      The new ordering also avoids leaving the platform
      device drvdata set to an unregistered struct rtc_device *
      on probe errors.
      Signed-off-by: NTodd Poynor <toddpoynor@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      7e72c686
    • M
      rtc: Initialized rtc_time->tm_isdst · a7402deb
      Mike Waychison 提交于
      Even though the Linux kernel does not use the tm_isdst field, it is
      exposed as part of the ABI.  This field can accidentally be left
      initialized, which is why we currently memset buffers returned to
      userland in rtc_read_time.
      
      There is a case however where the field can return garbage from the
      stack though when using the RTC_ALM_READ ioctl on the rtc device.  This
      ioctl invokes rtc_read_alarm, which is careful to memset the rtc_wkalrm
      buffer that is copied to userland, but it then uses a struct copy to
      assign to alarm->time given the return value from rtc_ktime_to_tm().
      
      rtc_ktime_to_tm() is implemented by calling rtc_time_to_tm using a
      derivative seconds counds from ktime, but rtc_time_to_tm does not assign
      a value to ->tm_isdst.  This results in garbage from rtc_ktime_to_tm()'s
      frame ending up being copied out to userland as part of the returned
      rtc_wkalrm.
      
      Fix this by initializing rtc_time->tm_isdst to 0 in rtc_time_to_tm.
      Signed-off-by: NMike Waychison <mikew@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      a7402deb
  7. 26 8月, 2011 2 次提交
  8. 11 8月, 2011 4 次提交
  9. 04 8月, 2011 1 次提交
  10. 27 7月, 2011 6 次提交
  11. 26 7月, 2011 5 次提交
  12. 02 7月, 2011 6 次提交
  13. 28 6月, 2011 1 次提交
  14. 24 6月, 2011 1 次提交
  15. 22 6月, 2011 1 次提交
    • J
      rtc: Avoid accumulating time drift in suspend/resume · 3dcad5ff
      John Stultz 提交于
      Because the RTC interface is only a second granular interface,
      each time we read from the RTC for suspend/resume, we introduce a
      half second (on average) of error.
      
      In order to avoid this error accumulating as the system is suspended
      over and over, this patch measures the time delta between the RTC
      and the system CLOCK_REALTIME.
      
      If the delta is less then 2 seconds from the last suspend, we compensate
      by using the previous time delta (keeping it close). If it is larger
      then 2 seconds, we assume the clock was set or has been changed, so we
      do no correction and update the delta.
      
      Note: If NTP is running, ths could seem to "fight" with the NTP corrected
      time, where as if the system time was off by 1 second, and NTP slewed the
      value in, a suspend/resume cycle could undo this correction, by trying to
      restore the previous offset from the RTC. However, without this patch,
      since each read could cause almost a full second worth of error, its
      possible to get almost 2 seconds of error just from the suspend/resume
      cycle alone, so this about equal to any offset added by the compensation.
      
      Further on systems that suspend/resume frequently, this should keep time
      closer then NTP could compensate for if the errors were allowed to
      accumulate.
      
      Credits to Arve Hjønnevåg for suggesting this solution.
      
      This patch also improves some of the variable names and adds more clear
      comments.
      
      CC: Arve Hjønnevåg <arve@android.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      3dcad5ff
  16. 10 6月, 2011 1 次提交
  17. 09 6月, 2011 2 次提交