1. 03 4月, 2015 1 次提交
  2. 24 1月, 2015 1 次提交
  3. 22 11月, 2014 1 次提交
    • P
      rtc/lib: Provide y2038 safe rtc_tm_to_time()/rtc_time_to_tm() replacement · c2c11ae4
      pang.xunlei 提交于
      As part of addressing "y2038 problem" for in-kernel uses, this patch
      adds safe rtc_tm_to_time64()/rtc_time64_to_tm() respectively using
      time64_t.
      
      After this patch, rtc_tm_to_time() is deprecated and all its call
      sites will be fixed using corresponding safe versions, it can be
      removed when having no users. Also change rtc_tm_to_time64() to
      return time64_t directly instead of just as a parameter like
      rtc_tm_to_time() does.
      
      After this patch, rtc_time_to_tm() is deprecated and all its call
      sites will be fixed using corresponding safe versions, it can be
      removed when having no users.
      
      In addition, change rtc_tm_to_ktime() and rtc_ktime_to_tm() to use
      the safe version in passing.
      Signed-off-by: Npang.xunlei <pang.xunlei@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      c2c11ae4
  4. 30 4月, 2013 2 次提交
  5. 07 2月, 2013 1 次提交
  6. 16 1月, 2013 1 次提交
    • J
      NTP: Add a CONFIG_RTC_SYSTOHC configuration · 023f333a
      Jason Gunthorpe 提交于
      The purpose of this option is to allow ARM/etc systems that rely on the
      class RTC subsystem to have the same kind of automatic NTP based
      synchronization that we have on PC platforms. Today ARM does not
      implement update_persistent_clock and makes extensive use of the class
      RTC system.
      
      When enabled CONFIG_RTC_SYSTOHC will provide a generic
      rtc_update_persistent_clock that stores the current time in the RTC and
      is intended complement the existing CONFIG_RTC_HCTOSYS option that loads
      the RTC at boot.
      
      Like with RTC_HCTOSYS the platform's update_persistent_clock is used
      first, if it works. Platforms with mixed class RTC and non-RTC drivers
      need to return ENODEV when class RTC should be used. Such an update for
      PPC is included in this patch.
      
      Long term, implementations of update_persistent_clock should migrate to
      proper class RTC drivers and use CONFIG_RTC_SYSTOHC instead.
      
      Tested on ARM kirkwood and PPC405
      Signed-off-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      023f333a
  7. 13 10月, 2012 1 次提交
  8. 06 10月, 2012 1 次提交
    • D
      rtc_sysfs_show_hctosys(): display 0 if resume failed · 4c24e29e
      David Fries 提交于
      Without this patch /sys/class/rtc/$CONFIG_RTC_HCTOSYS_DEVICE/hctosys
      contains a 1 (meaning "This rtc was used to initialize the system
      clock") even if setting the time by do_settimeofday() at bootup failed.
      The RTC can also be used to set the clock on resume, if it did 1,
      otherwise 0.  Previously there was no indication if the RTC was used
      to set the clock in resume.
      
      This uses only CONFIG_RTC_HCTOSYS_DEVICE for conditional compilation
      instead of it and CONFIG_RTC_HCTOSYS to be more consistent.
      rtc_hctosys_ret was moved to class.c so class.c no longer depends on
      hctosys.c.
      
      [sfr@canb.auug.org.au: fix build]
      Signed-off-by: NDavid Fries <David@Fries.net>
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4c24e29e
  9. 30 5月, 2012 1 次提交
  10. 16 3月, 2012 1 次提交
  11. 11 8月, 2011 1 次提交
    • J
      rtc: Fix RTC PIE frequency limit · 938f97bc
      John Stultz 提交于
      Thomas earlier submitted a fix to limit the RTC PIE freq, but
      picked 5000Hz out of the air. Willy noticed that we should
      instead use the 8192Hz max from the rtc man documentation.
      
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: stable@kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      938f97bc
  12. 27 7月, 2011 1 次提交
  13. 27 5月, 2011 1 次提交
  14. 30 3月, 2011 1 次提交
    • J
      RTC: Fix early irqs caused by calling rtc_set_alarm too early · f6d5b331
      John Stultz 提交于
      When we register an rtc device at boot, we read the alarm value
      in hardware and set the rtc device's aie_timer to that value.
      
      The initial method to do this was to simply call rtc_set_alarm()
      with the value read from hardware. However, this may cause problems
      as rtc_set_alarm may enable interupts, and the RTC alarm might fire,
      which can cause invalid pointer dereferencing since the RTC registration
      is not complete.
      
      This patch solves the issue by initializing the rtc_device.aie_timer
      y hand via rtc_initialize_alarm(). This avoids any calls to the RTC
      hardware which might enable interrupts too early.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      Reported-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Tested-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      f6d5b331
  15. 10 3月, 2011 4 次提交
    • J
      RTC: Cleanup rtc_class_ops->update_irq_enable() · 51ba60c5
      John Stultz 提交于
      Now that the generic code handles UIE mode irqs via periodic
      alarm interrupts, no one calls the
      rtc_class_ops->update_irq_enable() method anymore.
      
      This patch removes the driver hooks and implementations of
      update_irq_enable if no one else is calling it.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      51ba60c5
    • J
      RTC: Cleanup rtc_class_ops->irq_set_freq() · 696160fe
      John Stultz 提交于
      With the generic rtc code now emulating PIE mode irqs via an
      hrtimer, no one calls the rtc_class_ops->irq_set_freq call.
      
      This patch removes the hook and deletes the driver functions
      if no one else calls them.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      696160fe
    • J
      RTC: Cleanup rtc_class_ops->irq_set_state · 80d4bb51
      John Stultz 提交于
      With PIE mode interrupts now emulated in generic code via an hrtimer,
      no one calls rtc_class_ops->irq_set_state(), so this patch removes it
      along with driver implementations.
      
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: rtc-linux@googlegroups.com
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      80d4bb51
    • J
      RTC: Initialize kernel state from RTC · f44f7f96
      John Stultz 提交于
      Mark Brown pointed out a corner case: that RTC alarms should
      be allowed to be persistent across reboots if the hardware
      supported it.
      
      The rework of the generic layer to virtualize the RTC alarm
      virtualized much of the alarm handling, and removed the
      code used to read the alarm time from the hardware.
      
      Mark noted if we want the alarm to be persistent across
      reboots, we need to re-read the alarm value into the
      virtualized generic layer at boot up, so that the generic
      layer properly exposes that value.
      
      This patch restores much of the earlier removed
      rtc_read_alarm code and wires it in so that we
      set the kernel's alarm value to what we find in the
      hardware at boot time.
      
      NOTE: Not all hardware supports persistent RTC alarm state across
      system reset. rtc-cmos for example will keep the alarm time, but
      disables the AIE mode irq. Applications should not expect the RTC
      alarm to be valid after a system reset. We will preserve what
      we can, to represent the hardware state at boot, but its not
      guarenteed.
      
      Further, in the future, with multiplexed RTC alarms, the
      soonest alarm to fire may not be the one set via the /dev/rt
      ioctls. So an application may set the alarm with RTC_ALM_SET,
      but after a reset find that RTC_ALM_READ returns an earlier
      time. Again, we preserve what we can, but applications should
      not expect the RTC alarm state to persist across a system reset.
      
      Big thanks to Mark for pointing out the issue!
      Thanks also to Marcelo for helping think through the solution.
      
      CC: Mark Brown <broonie@opensource.wolfsonmicro.com>
      CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: rtc-linux@googlegroups.com
      Reported-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      f44f7f96
  16. 18 2月, 2011 2 次提交
  17. 22 1月, 2011 2 次提交
  18. 14 12月, 2010 1 次提交
  19. 11 12月, 2010 2 次提交
    • J
      RTC: Remove UIE emulation · 042620a0
      John Stultz 提交于
      Since we provide UIE interrupts via a rtc_timer, the old
      emulation code can be removed.
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      LKML Reference: <1290136329-18291-5-git-send-email-john.stultz@linaro.org>
      Acked-by: NAlessandro Zummo <a.zummo@towertech.it>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Richard Cochran <richardcochran@gmail.com>
      042620a0
    • J
      RTC: Rework RTC code to use timerqueue for events · 6610e089
      John Stultz 提交于
      This patch reworks a large portion of the generic RTC code
      to in-effect virtualize the rtc interrupt code.
      
      The current RTC interface is very much a raw hardware interface.
      Via the proc, /dev/, or sysfs interfaces, applciations can set
      the hardware to trigger interrupts in one of three modes:
      
      AIE: Alarm interrupt
      UIE: Update interrupt (ie: once per second)
      PIE: Periodic interrupt (sub-second irqs)
      
      The problem with this interface is that it limits the RTC hardware
      so it can only be used by one application at a time.
      
      The purpose of this patch is to extend the RTC code so that we can
      multiplex multiple applications event needs onto a single RTC device.
      This is done by utilizing the timerqueue infrastructure to manage
      a list of events, which cause the RTC hardware to be programmed
      to fire an interrupt for the next event in the list.
      
      In order to preserve the functionality of the exsting proc,/dev/ and
      sysfs interfaces, we emulate the different interrupt modes as follows:
      
      AIE: We create a rtc_timer dedicated to AIE mode interrupts. There is
      only one per device, so we don't change existing interface semantics.
      
      UIE: Again, a dedicated rtc_timer, set for periodic mode, is used
      to emulate UIE interrupts. Again, only one per device.
      
      PIE: Since PIE mode interrupts fire faster then the RTC's clock read
      granularity, we emulate PIE mode interrupts using a hrtimer. Again,
      one per device.
      
      With this patch, the rtctest.c application in Documentation/rtc.txt
      passes fine on x86 hardware. However, there may very well still be
      bugs, so greatly I'd appreciate any feedback or testing!
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      LKML Reference: <1290136329-18291-4-git-send-email-john.stultz@linaro.org>
      Acked-by: NAlessandro Zummo <a.zummo@towertech.it>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      CC: Alessandro Zummo <a.zummo@towertech.it>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Richard Cochran <richardcochran@gmail.com>
      6610e089
  20. 13 3月, 2010 1 次提交
  21. 01 4月, 2009 1 次提交
  22. 05 1月, 2009 1 次提交
  23. 27 7月, 2008 1 次提交
  24. 25 7月, 2008 1 次提交
    • D
      rtc: remove BKL for ioctl() · 5ad31a57
      David Brownell 提交于
      Remove implicit use of BKL in ioctl() from the RTC framework.
      
      Instead, the rtc->ops_lock is used.  That's the same lock that already
      protects the RTC operations when they're issued through the exported
      rtc_*() calls in drivers/rtc/interface.c ...  making this a bugfix, not
      just a cleanup, since both ioctl calls and set_alarm() need to update IRQ
      enable flags and that implies a common lock (which RTC drivers as a rule
      do not provide on their own).
      
      A new comment at the declaration of "struct rtc_class_ops" summarizes
      current locking rules.  It's not clear to me that the exceptions listed
      there should exist ...  if not, those are pre-existing problems which can
      be fixed in a patch that doesn't relate to BKL removal.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Acked-by: NAlessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5ad31a57
  25. 30 11月, 2007 1 次提交
  26. 09 5月, 2007 4 次提交
  27. 11 12月, 2006 1 次提交
  28. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  29. 01 10月, 2006 1 次提交
  30. 01 7月, 2006 1 次提交