09 Jul, 2016

1 commit


26 Jun, 2016

1 commit

  • nn10300 has a dependency on mc146818_get_time/mc146818_set_time,
    which we want to move from the mc146818rtc.h header into the
    rtc subsystem, which in turn is not usable on mn10300.

    This changes mn10300 to use the modern rtc-cmos driver instead
    of the old RTC driver, and that in turn lets us completely
    remove the read_persistent_clock/update_persistent_clock callbacks.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Alexandre Belloni

    Arnd Bergmann
     

04 Jun, 2016

1 commit

  • Drivers should not really include stuff from asm-generic directly,
    and the PC-style cmos rtc driver does this in order to reuse the
    mc146818 implementation of get_rtc_time/set_rtc_time rather than
    the architecture specific one for the architecture it gets built for.

    To make it more obvious what is going on, this moves and renames the
    two functions into include/linux/mc146818rtc.h, which holds the
    other mc146818 specific code. Ideally it would be in a .c file,
    but that would require extra infrastructure as the functions are
    called by multiple drivers with conflicting dependencies.

    With this change, the asm-generic/rtc.h header also becomes much
    more generic, so it can be reused more easily across any architecture
    that still relies on the genrtc driver.

    The only caller of the internal __get_rtc_time/__set_rtc_time
    functions is in arch/alpha/kernel/rtc.c, and we just change those
    over to the new naming.

    Signed-off-by: Arnd Bergmann
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Alexandre Belloni

    Arnd Bergmann
     

20 May, 2016

1 commit


12 Jan, 2016

1 commit

  • The Microsoft Surface 3 tablet shares interrupt line between RTC and one of SPI
    controllers. However, the rtc_cmos driver doesn't allow shared interrupts and
    user sees the following warning

    genirq: Flags mismatch irq 8. 00000080 (8086228E:02) vs. 00000000 (rtc0)
    ...
    [] pxa2xx_spi_probe+0x151/0x600 [spi_pxa2xx_platform]

    Allow RTC driver to use shared interrupts.

    Seems we are on the safe side to do just this simple change since
    cmos_interrupt() handler checks for the actual hardware status anyway.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Alexandre Belloni

    Andy Shevchenko
     

05 Sep, 2015

3 commits

  • The change removes redundant sysfs binary file boundary checks, since
    this task is already done on caller side in fs/sysfs/file.c

    Signed-off-by: Vladimir Zapolskiy
    Signed-off-by: Alexandre Belloni

    Vladimir Zapolskiy
     
  • Commit d5a1c7e3fc38 ("rtc-cmos: Add an alarm disable quirk") that
    added a special quirk is not needed because [PATCH 1/2] of this
    patchset makes the kernel more robust:
    rtc-cmos: Cancel alarm timer if alarm time is equal to now+1 seconds

    Signed-off-by: Adrian Huang
    Tested-by: Egbert Eich
    Tested-by: Diego Ercolani
    Cc: Borislav Petkov
    Signed-off-by: Alexandre Belloni

    Adrian Huang
     
  • Steps to reproduce the problem:
    1) Enable RTC wake-up option in BIOS Setup
    2) Issue one of these commands in the OS: "poweroff"
    or "shutdown -h now"
    3) System will shut down and then reboot automatically

    Root-cause of the issue:
    1) During the shutdown process, the hwclock utility is used
    to save the system clock to hardware clock (RTC).
    2) The hwclock utility invokes ioctl() with RTC_UIE_ON. The
    kernel configures the RTC alarm for the periodic interrupt
    (every 1 second).
    3) The hwclock uitlity closes the /dev/rtc0 device, and the
    kernel disables the RTC alarm irq (AIE bit of Register B)
    via ioctl() with RTC_UIE_OFF. But, the configured alarm
    time is the current_time + 1.
    4) After the next 1 second is elapsed, the AF (alarm
    interrupt flag) of Register C is set.
    5) The S5 handler in BIOS is invoked to configure alarm
    registers (enable AIE bit and configure alarm date/time).
    But, BIOS does not clear the previous interrupt status
    during alarm configuration. Therefore, "AF=AIE=1" causes
    the rtc device to trigger an interrupt.
    6) So, the machine reboots automatically right after shutdown.

    This patch cancels the alarm timer if the following condictions are
    met (suggested by Alexandre):
    1) The configured alarm time is equal to current_time + 1
    seconds.
    2) The AIE timer is not in use.

    The member 'alarm_expires' is introduced in struct cmos_rtc because
    of the following reasons:
    1) The configured alarm time can be retrieved from
    cmos_read_alarm(), but we need to take the 'wrapped
    timestamp' and 'time rollover' into consideration. The
    function __rtc_read_alarm() eliminates the concerns. To
    avoid the duplicated code in the lower level RTC driver,
    invoking __rtc_read_alarm from the lower level RTC driver
    is not encouraged. Moreover, the compilation error 'the
    undefined __rtc_read_alarm" is observed if the lower level
    RTC driver is compiled as a kernel module.
    2) The uie_rtctimer.node.expires and aie_timer.node.expires can
    be retrieved for the configured alarm time. But, the problem
    is that either of them might configure the CMOS alarm time.
    We cannot make sure UIE timer or AIE tiemr configured the
    CMOS alarm time before. (uie_rtctimer or aie_timer is enabled
    and then is disabled).
    3) The patch introduces the member 'alarm_expires' to keep the
    newly configured alarm time, so the above-mentioned concerns
    can be eliminated.

    The issue goes away after 20-time shutdown tests.

    Signed-off-by: Adrian Huang
    Tested-by: Egbert Eich
    Tested-by: Diego Ercolani
    Cc: Borislav Petkov
    Signed-off-by: Alexandre Belloni

    Adrian Huang
     

17 Apr, 2015

1 commit

  • Neaten the logging a bit by adding #define pr_fmt

    Miscellanea:

    o Remove __FILE__/__func__ uses
    o Coalesce formats adding missing spaces
    o Align arguments
    o (rtc-cmos) Integrated 2 consecutive messages

    Signed-off-by: Joe Perches
    Acked-by: Alexandre Belloni
    Cc: Alessandro Zummo
    Cc: Joshua Kinard
    Cc: Chanwoo Choi
    Reviewed-by: Krzysztof Kozlowski
    Tested-by: Krzysztof Kozlowski
    Cc: Aaro Koskinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

16 Apr, 2015

1 commit

  • The seq_printf return value, because it's frequently misused,
    will eventually be converted to void.

    See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
    seq_has_overflowed() and make public")

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

14 Oct, 2014

1 commit

  • Commit b5ada4600dfd ("drivers/rtc/rtc-cmos.c: fix compilation warning
    when !CONFIG_PM_SLEEP") broke wakeup from S5 by making cmos_poweroff a
    nop unless CONFIG_PM_SLEEP was defined.

    Fix this by restricting the #ifdef to cmos_resume and restoring the old
    dependency on CONFIG_PM for cmos_suspend and cmos_poweroff.

    Signed-off-by: Daniel Glöckner
    Cc: Mika Westerberg
    Cc: Alessandro Zummo
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Glöckner
     

07 Jun, 2014

1 commit

  • This brings in drivers/char/rtc.c functionality required for DECstation
    and, should the maintainers decide to switch, Alpha systems to use
    rtc-cmos.

    Specifically these features are made available:

    * RTC iomem rather than x86/PCI port I/O mapping, controlled with the
    RTC_IOMAPPED macro as with the original driver. The DS1287A chip in all
    DECstation systems is mapped in the host bus address space as a
    contiguous block of 64 32-bit words of which the least significant byte
    accesses the RTC chip for both reads and writes. All the address and
    data window register accesses are made transparently by the chipset glue
    logic so that the device appears directly mapped on the host bus.

    * A way to set the size of the address space explicitly with the
    newly-added `address_space' member of the platform part of the RTC
    device structure. This avoids the unreliable heuristics that does not
    work in a setup where the RTC is not explicitly accessed with the usual
    address and data window register pair.

    * The ability to use the RTC periodic interrupt as a system clock
    device, which is implemented by arch/mips/kernel/cevt-ds1287.c for
    DECstation systems and takes the RTC interrupt away from the RTC driver.
    Eventually hooking back to the clock device's interrupt handler should
    be possible for the purpose of the alarm clock and possibly also
    update-in-progress interrupt, but this is not done by this change.

    o To avoid interfering with the clock interrupt all the places where
    the RTC interrupt mask is fiddled with are only executed if and IRQ
    has been assigned to the RTC driver.

    o To avoid changing the clock setup Register A is not fiddled with
    if CMOS_RTC_FLAGS_NOFREQ is set in the newly-added `flags' member of
    the platform part of the RTC device structure. Originally, in
    drivers/char/rtc.c, this was keyed with the absence of the RTC
    interrupt, just like the interrupt mask, but there only the periodic
    interrupt frequency is set, whereas rtc-cmos also sets the divider
    bits. Therefore a new flag is introduced so that systems where the
    RTC interrupt is not usable rather than used as a system clock device
    can fully initialise the RTC.

    * A small clean-up is made to the IRQ assignment code that makes the IRQ
    number hardcoded to -1 rather than arbitrary -ENXIO (or whatever error
    happens to be returned by platform_get_irq) where no IRQ has been
    assigned to the RTC driver (NO_IRQ might be another candidate, but it
    looks like this macro has inconsistent or missing definitions and
    limited use and might therefore be unsafe).

    Verified to work correctly with a DECstation 5000/240 system.

    [akpm@linux-foundation.org: fix weird code layout]
    Signed-off-by: Maciej W. Rozycki
    Cc: Alessandro Zummo
    Cc: Ralf Baechle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej W. Rozycki
     

04 Apr, 2014

1 commit

  • CONFIG_PM will be set also if only CONFIG_PM_RUNTIME is set which causes
    the compiler to emit following warning:

    drivers/rtc/rtc-cmos.c:845:12: warning: =E2=80=98cmos_resume=E2=80=99 defined but not used [-Wunused-function]

    Fix this by using CONFIG_PM_SLEEP instead of CONFIG_PM and removing it
    from the driver pm ops as this has been taken care by
    SIMPLE_DEV_PM_OPS() already.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mika Westerberg
     

24 Jan, 2014

2 commits


24 Dec, 2013

1 commit

  • 41c7f7424259f ("rtc: Disable the alarm in the hardware (v2)") added the
    functionality to disable the RTC wake alarm when shutting down the box.

    However, there are at least two b0rked BIOSes we know about:

    https://bugzilla.novell.com/show_bug.cgi?id=812592
    https://bugzilla.novell.com/show_bug.cgi?id=805740

    where, when wakeup alarm is enabled in the BIOS, the machine reboots
    automatically right after shutdown, regardless of what wakeup time is
    programmed.

    Bisecting the issue lead to this patch so disable its functionality with
    a DMI quirk only for those boxes.

    Cc: Brecht Machiels
    Cc: Thomas Gleixner
    Cc: John Stultz
    Cc: Rabin Vincent
    Cc: stable
    Signed-off-by: Borislav Petkov
    [jstultz: Changed variable name for clarity, added extra dmi entry]
    Tested-by: Brecht Machiels
    Tested-by: Borislav Petkov
    Signed-off-by: John Stultz

    Borislav Petkov
     

13 Nov, 2013

2 commits


12 Sep, 2013

1 commit

  • Convert drivers/rtc/rtc-cmos to use dev_pm_ops instead of legacy pm_ops.
    This patch depends on pnp driver bus ops change to invoke pnp_driver
    dev_pm_ops.

    Signed-off-by: Shuah Khan
    Cc: Matthew Garrett
    Cc: Leonidas Da Silva Barbosa
    Cc: Ashley Lai
    Cc: Rajiv Andrade
    Cc: Marcel Selhorst
    Cc: Sirrix AG
    Cc: Alessandro Zummo
    Cc: "Rafael J. Wysocki"
    Cc: Bjorn Helgaas
    Cc: Grant Likely
    Cc: Rob Herring
    Cc: Peter Hüwe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shuah Khan
     

04 Jul, 2013

2 commits

  • The bios may clear the rtc control register when resuming the system. Since the
    cmos interrupt handler may now be run before the rtc_cmos is resumed, this can
    cause the interrupt handler to ignore an alarm since the alarm bit is not set in
    the rtc control register. To work around this, check if the rtc_cmos is
    suspended and use the stored value for the rtc control register.

    Signed-off-by: Derek Basehore
    Reviewed-by: Sameer Nanda
    Cc: Alessandro Zummo
    Cc: Jingoo Han
    Cc: Steven Rostedt
    Cc: John Stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Derek Basehore
     
  • Fixes the following types of issues:

    ERROR: space required after that ',' (ctx:VxV)
    WARNING: please, no spaces at the start of a line

    Signed-off-by: Sachin Kamat
    Cc: Jingoo Han
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sachin Kamat
     

13 Jun, 2013

1 commit

  • During resume, we call hpet_rtc_timer_init after masking an irq bit in
    hpet. This will cause the call to hpet_disable_rtc_channel to be undone
    if RTC_AIE is the only bit not masked.

    Allowing the cmos interrupt handler to run before resuming caused some
    issues where the timer for the alarm was not removed. This would cause
    other, later timers to not be cleared, so utilities such as hwclock
    would time out when waiting for the update interrupt.

    [akpm@linux-foundation.org: coding-style tweak]
    Signed-off-by: Derek Basehore
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Derek Basehore
     

30 Apr, 2013

1 commit

  • There's a bug where rtc alarms are ignored after the rtc cmos suspends
    but before the system finishes suspend. Since hpet emulation is
    disabled and it still handles the interrupts, a wake event is never
    registered which is done from the rtc layer.

    This patch reverts commit d1b2efa83fbf ("rtc: disable hpet emulation on
    suspend") which disabled hpet emulation. To fix the problem mentioned
    in that commit, hpet_rtc_timer_init() is called directly on resume.

    Signed-off-by: Derek Basehore
    Cc: Maxim Levitsky
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "Rafael J. Wysocki"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Derek Basehore
     

22 Feb, 2013

2 commits


04 Jan, 2013

1 commit

  • CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
    markings need to be removed.

    This change removes the use of __devinit, __devexit_p, __devinitdata,
    __devinitconst, and __devexit from these drivers.

    Based on patches originally written by Bill Pemberton, but redone by me
    in order to handle some of the coding style issues better, by hand.

    Cc: Bill Pemberton
    Cc: Alessandro Zummo
    Cc: Srinidhi Kasagar
    Cc: Linus Walleij
    Cc: Mike Frysinger
    Cc: Wan ZongShun
    Cc: Guan Xuetao
    Cc: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

09 Aug, 2012

1 commit

  • If an RTC alarm fires just as suspend is happening, it is possible for
    suspend to complete and the alarm to be missed.

    To avoid the race, we must register the event with the PM core.

    As the event is made visible to userspace through a thread which is
    only scheduled by the interrupt, we need a pm_stay_awake/pm_relax
    pair preventing suspend from the interrupt until the thread completes
    its work.

    This makes the pm_wakeup_event() call in cmos_interrupt unnecessary as
    it provides suspend protection for all RTCs that use rtc_update_irq.

    Signed-off-by: NeilBrown
    Signed-off-by: Rafael J. Wysocki

    NeilBrown
     

18 Jul, 2012

1 commit

  • When suspending the system with an important RTC wake alarm active,
    it is possible that the RTC alarm will expire before the system has
    gone to sleep (e.g. short alarm timer, or an unusually long suspend
    routine).

    If this happens, the RTC alarm should trigger a wakeup event, possibly
    aborting system suspend. This condition can be detected in the form
    of an RTC alarm interrupt.

    Signed-off-by: Paul Fox
    Signed-off-by: Daniel Drake
    Signed-off-by: Rafael J. Wysocki

    Paul Fox
     

30 May, 2012

1 commit


24 Mar, 2012

1 commit

  • Since commit e58aa3d2d0cc ("genirq: run irq handlers with interrupts
    disabled") we run all interrupt handlers with interrupts disabled and we
    even check and yell when an interrupt handler returns with interrupts
    enabled - see commit b738a50a2026 ("genirq: warn when handler enables
    interrupts").

    So now this flag is a NOOP and can be removed.

    Signed-off-by: Yong Zhang
    Acked-by: Linus Walleij
    Acked-by: Wan ZongShun
    Cc: Alessandro Zummo
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yong Zhang
     

11 Jan, 2012

1 commit


10 Jun, 2011

1 commit


16 Mar, 2011

1 commit

  • …el/git/tip/linux-2.6-tip

    * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (27 commits)
    x86: Clean up apic.c and apic.h
    x86: Remove superflous goal definition of tsc_sync
    x86: dt: Correct local apic documentation in device tree bindings
    x86: dt: Cleanup local apic setup
    x86: dt: Fix OLPC=y/INTEL_CE=n build
    rtc: cmos: Add OF bindings
    x86: ce4100: Use OF to setup devices
    x86: ioapic: Add OF bindings for IO_APIC
    x86: dtb: Add generic bus probe
    x86: dtb: Add support for PCI devices backed by dtb nodes
    x86: dtb: Add device tree support for HPET
    x86: dtb: Add early parsing of IO_APIC
    x86: dtb: Add irq domain abstraction
    x86: dtb: Add a device tree for CE4100
    x86: Add device tree support
    x86: e820: Remove conditional early mapping in parse_e820_ext
    x86: OLPC: Make OLPC=n build again
    x86: OLPC: Remove extra OLPC_OPENFIRMWARE_DT indirection
    x86: OLPC: Cleanup config maze completely
    x86: OLPC: Hide OLPC_OPENFIRMWARE config switch
    ...

    Fix up conflicts in arch/x86/platform/ce4100/ce4100.c

    Linus Torvalds
     

10 Mar, 2011

3 commits

  • 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
    CC: Alessandro Zummo
    CC: Marcelo Roberto Jimenez
    CC: rtc-linux@googlegroups.com
    Signed-off-by: John Stultz

    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
    CC: Alessandro Zummo
    CC: Marcelo Roberto Jimenez
    CC: rtc-linux@googlegroups.com
    Signed-off-by: John Stultz

    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
    CC: Alessandro Zummo
    CC: Marcelo Roberto Jimenez
    CC: rtc-linux@googlegroups.com
    Signed-off-by: John Stultz

    John Stultz
     

24 Feb, 2011

1 commit

  • This allows to load the OF driver based informations from the device
    tree. Systems without BIOS may need to perform some initialization.
    PowerPC creates a PNP device from the OF information and performs this
    kind of initialization in their private PCI quirk. This looks more
    generic.

    This patch also avoids registering the platform RTC driver on X86 if
    we have a device tree blob. Otherwise we would setup the device based
    on the hardcoded information in arch/x86 rather than the device tree
    based one.

    [ tglx: Changed "int of_have_populated_dt()" to bool as recommended by
    Grant ]

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Dirk Brandewie
    Acked-by: Grant Likely
    Cc: sodaville@linutronix.de
    Cc: devicetree-discuss@lists.ozlabs.org
    Cc: rtc-linux@googlegroups.com
    Cc: Alessandro Zummo
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Sebastian Andrzej Siewior
     

14 Jan, 2011

1 commit

  • rtc-cmos was setting suspend/resume hooks at the device_driver level.
    However, the platform bus code (drivers/base/platform.c) only looks for
    resume hooks at the dev_pm_ops level, or within the platform_driver.

    Switch rtc_cmos to use dev_pm_ops so that suspend/resume code is executed
    again.

    Paul said:

    : The user visible symptom in our (XO laptop) case was that rtcwake would
    : fail to wake the laptop. The RTC alarm would expire, but the wakeup
    : wasn't unmasked.
    :
    : As for severity, the impact may have been reduced because if I recall
    : correctly, the bug only affected platforms with CONFIG_PNP disabled.

    Signed-off-by: Paul Fox
    Signed-off-by: Daniel Drake
    Acked-by: Rafael J. Wysocki
    Cc: [2.6.37.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Fox
     

29 Nov, 2010

1 commit

  • The following warning is seen while compilation of PowerPC kernel:

    CC drivers/rtc/rtc-cmos.o
    drivers/rtc/rtc-cmos.c:697:2: warning: #warning Assuming 128 bytes
    of RTC+NVRAM address space, not 64 bytes.

    Fix it by adding defined(__powerpc__).

    Signed-off-by: Srikanth Krishnakar
    Signed-off-by: Benjamin Herrenschmidt

    Srikanth Krishnakar
     

11 Aug, 2010

1 commit