27 Nov, 2015

1 commit

  • With the actual code, read_alarm() always returns -EINVAL when called
    during the RTC device registration. This prevents from retrieving an
    already configured alarm in hardware.

    This patch fixes the issue by moving the HAS_ALARM bit configuration
    (if supported by the hardware) above the rtc_device_register() call.

    Signed-off-by: Simon Guinot
    Signed-off-by: Alexandre Belloni

    Simon Guinot
     

25 Nov, 2015

1 commit

  • Since commit 3fffd1283927 ("i2c: allow specifying
    separate wakeup interrupt in device tree") we have
    automatic wakeup irq support for i2c devices. That
    commit missed the fact that rtc-1307 had its own
    wakeup irq handling and ended up introducing a
    kernel splat for at least Beagle x15 boards.

    Fix that by reverting original commit _and_ passing
    correct interrupt names on DTS so i2c-core can
    choose correct IRQ as wakeup.

    Now that we have automatic wakeirq support, we can
    revert the original commit which did it manually.

    Fixes the following warning:

    [ 10.346582] WARNING: CPU: 1 PID: 263 at linux/drivers/base/power/wakeirq.c:43 dev_pm_attach_wake_irq+0xbc/0xd4()
    [ 10.359244] rtc-ds1307 2-006f: wake irq already initialized

    Cc: Tony Lindgren
    Cc: Nishanth Menon
    Signed-off-by: Felipe Balbi
    Acked-by: Tony Lindgren
    Acked-by: Arnd Bergmann
    Signed-off-by: Alexandre Belloni

    Felipe Balbi
     

11 Nov, 2015

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "Core:
    - Fix rtctest error path

    New drivers:
    - Microcrystal RV8803

    Subsystem wide cleanups:
    - remove misuse of IRQF_NO_SUSPEND flag

    Drivers:
    - at91rm9200: clear RTC alarm status flag prior to suspending
    - davinci: remove incorrect reference to probe function
    - ds1307: Fix alarm programming for mcp794xx
    - ds1390: trickle charger support, fix ds1390_get_reg
    - isl1208: Pass the IRQF_ONESHOT flag
    - opal: fix type of token
    - pcf2127: fix RTC_READ_VL, remove useless driver version
    - pcf85063: return an error when date is invalid
    - pcf8563: add CLKOUT to common clock framework
    - rx8025: remove unnecessary braces
    - s3c: Set year, month, day value for setting alarm
    - stmp3xxx: unify register access macros
    - License fixes: pcf2127, da9063
    - wakeup-source support for isl12057 and opal"

    * tag 'rtc-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (23 commits)
    rtc: Add a driver for Micro Crystal RV8803
    rtc: s3c: Set year, month, day value for setting alarm
    rtc: ds1307: Fix alarm programming for mcp794xx
    rtc: isl12057: enable support for the standard "wakeup-source" property
    rtc: opal: enable support for the stardard "wakeup-source" property
    rtc: isl1208: Pass the IRQF_ONESHOT flag
    rtc: pcf8563: add CLKOUT to common clock framework
    rtc: davinci: remove incorrect reference to probe function
    rtc: at91rm9200: clear RTC alarm status flag prior to suspending
    rtc: pcf2127: remove useless driver version
    rtc: pcf2127: fix reading uninitialized value on RTC_READ_VL ioctl
    rtc: stmp3xxx: unify register access macros
    rtc: da9063: GPL copyright inconsistency fix
    rtc: pcf85063: return an error when date is invalid
    rtc: rx8025: remove unnecessary braces
    rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag
    rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag
    rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag
    rtc: opal: fix type of token
    rtc: ds1390: Add trickle charger device tree binding
    ...

    Linus Torvalds
     

08 Nov, 2015

21 commits

  • This driver supports the following functions:
    - reading and settings time
    - alarms when connected to an IRQ
    - reading and clearing the voltage low flags
    - nvram

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • This patch sets year, month, day value for set_alarm function.
    The current driver omits to set the values.

    This fixes setting wake alarm for dates different than current day.
    Without the patch the alarm scheduled for tomorrow would fire today on
    chosen time.

    Signed-off-by: Donggeun Kim
    Signed-off-by: MyungJoo Ham
    Signed-off-by: KyungMin Park
    [k.kozlowski: Rebase and test the patch, update commit message]
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Alexandre Belloni

    Krzysztof Kozlowski
     
  • mcp794xx alarm registers must be written in BCD format. However, the
    alarm programming logic neglected this by adding one to the value
    after bin2bcd conversion has been already done, writing bad values
    to month register in case the alarm being set is in October. In this
    case, the alarm month value becomes 0x0a instead of the expected 0x10.

    Fix by moving the +1 addition within the bin2bcd call also.

    Fixes: 1d1945d261a2 ("drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips")

    Signed-off-by: Tero Kristo
    Acked-by: Nishanth Menon
    Signed-off-by: Alexandre Belloni

    Tero Kristo
     
  • Though the isl12057 rtc driver should and will continue to support the
    legacy "isil,irq2-can-wakeup-machine" property to enable RTC as the
    wakeup source, we need to add support for the new standard property
    "wakeup-source".

    This patch adds support for "wakeup-source" property in addition to the
    existing "isil,irq2-can-wakeup-machine" property.

    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • Though the opal rtc driver should and will continue to support the legacy
    "has-tpo" property to enable RTC as the wakeup source, we need to add
    support for the new standard property "wakeup-source"

    This patch adds support for "wakeup-source" property in addition to the
    existing "has-tpo" property.

    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject
    bogus threaded irq requests") threaded IRQs without a primary handler
    need to be requested with IRQF_ONESHOT, otherwise the request will fail.

    So pass the IRQF_ONESHOT flag in this case.

    The semantic patch that makes this change is available
    in scripts/coccinelle/misc/irqf_oneshot.cocci

    Signed-off-by: Fabio Estevam
    Signed-off-by: Alexandre Belloni

    Fabio Estevam
     
  • Add the clkout output clk to the common clock framework.
    Disable the CLKOUT of the RTC after power-up.
    After power-up/reset of the RTC, CLKOUT is enabled by default,
    with CLKOUT enabled the RTC chip has 2-3 times higher power
    consumption.

    Signed-off-by: Heiko Schocher
    Signed-off-by: Alexandre Belloni

    Heiko Schocher
     
  • The davinci rtc driver uses the module_platform_driver_probe()
    helper to call the probe function and mark it as __init, but
    it also puts a reference into its davinci_rtc_driver function.

    This will crash if we ever get a deferred probe and the probe
    function is called again after the init section has been removed.
    kbuild warns about this:

    WARNING: vmlinux.o(.data+0x1aa2b4): Section mismatch in reference from the variable davinci_rtc_driver to the function .init.text:davinci_rtc_probe()
    The variable davinci_rtc_driver references
    the function __init davinci_rtc_probe()

    This patch removes the .probe callback from the platform driver,
    which avoids those problems.

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

    Arnd Bergmann
     
  • As said in the SAMA5D2 datasheet, "Prior to instructing the device
    to enter ULP mode 1, ... and the internal sources of wake-up must
    be cleared."

    This patch is to clear the RTC alarm status flag prior to suspending
    to avoid the erroneous wake-up activity, as it is often used as
    the wake-up source for the ULP mode 1.

    Signed-off-by: Wenyou Yang
    Signed-off-by: Alexandre Belloni

    Wenyou Yang
     
  • A driver version is only really sensible for oot drivers. Also the
    dev_info about having found a chip only signals that allocating the
    driver data succeeded and so isn't worth much.

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Alexandre Belloni

    Uwe Kleine-König
     
  • The flag reported on the RTC_READ_VL ioctl is only initialized when the
    date is read out. So the voltage low value doesn't represent reality but
    the status at the time the date was read (or 0 if the date was not read
    yet).

    Moreover when userspace requests a value via an ioctl there is no added
    benefit to also make a prosa representation of this (and other) values
    appear in the kernel log so remove the calls to dev_info and the driver
    data members to track their state.

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Alexandre Belloni

    Uwe Kleine-König
     
  • Use STMP_OFFSET_REG_(SET|CLR) instead of defining _SET and _CLR for
    STMP3XXX_RTC_CTRL and STMP3XXX_RTC_PERSISTENT0 - no functional changes.

    Signed-off-by: Harald Geyer
    Signed-off-by: Alexandre Belloni

    Harald Geyer
     
  • Fix misleading and inconsistent copyright header wording.

    Alter the copyright header text and MODULE_LICENSE macro to ensure the
    GPL v2 licence description is correctly represented.

    It will remove the incorrectly LGPL worded text. Words such as "Library"
    from the line "GNU Library General Public License"; and replace the word
    "library" with "program" in several other places.

    The copyright should match the GPL v2 description as specified in the GNU
    license found here: http://www.gnu.org/licenses/gpl-2.0.html

    It should also match this copyright text with the correct MODULE_LICENSE
    macro text as found in the kernel: include/linux/module.h
    In this case "GNU Public License v2 or later" is linked with "GPL".

    Signed-off-by: Steve Twiss
    Signed-off-by: Alexandre Belloni

    Steve Twiss
     
  • Return an error when the date is invalid as the policy should be
    implemented there.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • braces {} are not necessary for single statement blocks

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
    be left enabled so as to allow them to work as expected during the
    suspend-resume cycle, but doesn't guarantee that it will wake the system
    from a suspended state, enable_irq_wake is recommended to be used for
    the wakeup.

    This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
    introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
    be left enabled so as to allow them to work as expected during the
    suspend-resume cycle, but doesn't guarantee that it will wake the system
    from a suspended state, enable_irq_wake is recommended to be used for
    the wakeup.

    This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
    introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

    Cc: Linus Walleij
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Acked-by: Linus Walleij
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
    be left enabled so as to allow them to work as expected during the
    suspend-resume cycle, but doesn't guarantee that it will wake the system
    from a suspended state, enable_irq_wake is recommended to be used for
    the wakeup.

    This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
    introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

    Cc: Linus Walleij
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Sudeep Holla
    Acked-by: Linus Walleij
    Signed-off-by: Alexandre Belloni

    Sudeep Holla
     
  • The variable can take signed values.

    The problem has been detected using proposed semantic patch
    scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

    [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

    Signed-off-by: Andrzej Hajda
    Signed-off-by: Alexandre Belloni

    Andrzej Hajda
     
  • Introduce a device tree binding for specifying the trickle charger
    configuration for ds1390.

    Signed-off-by: Ivan Grimaldi
    Signed-off-by: Alexandre Belloni

    Ivan Grimaldi
     
  • spi_write_then_read puts in rx_buf the received data starting from
    the first byte of the rx_buf

    Signed-off-by: Ivan Grimaldi
    Signed-off-by: Alexandre Belloni

    Ivan Grimaldi
     

03 Nov, 2015

1 commit


28 Oct, 2015

1 commit


06 Sep, 2015

14 commits

  • Fix RTC write bit as per application manual

    Cc: stable@vger.kernel.org # 4.1+
    Signed-off-by: Mitja Spes
    Signed-off-by: Alexandre Belloni

    Mitja Spes
     
  • Add a sentinel to ab85xx_rtc_ids[] in order to fix the following error:

    drivers/rtc/rtc-ab8500: struct platform_device_id is 24 bytes. The last of 2 is:
    0x61 0x62 0x38 0x35 0x34 0x30 0x2d 0x72 0x74 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x8c
    FATAL: drivers/rtc/rtc-ab8500: struct platform_device_id is not terminated with a NULL entry!

    Reported-by: Andrey Ryabinin
    Reported-by: Olof's autobuilder
    Signed-off-by: Fabio Estevam
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Alexandre Belloni

    Fabio Estevam
     
  • Remove unused variable 'res' and fix the following build warning:

    drivers/rtc/rtc-ds1374.c:667:6: warning: unused variable 'res' [-Wunused-variable]

    Reported-by: Olof's autobuilder
    Signed-off-by: Fabio Estevam
    Signed-off-by: Alexandre Belloni

    Fabio Estevam
     
  • These platform drivers have a OF device ID table but the OF module
    alias information is not created so module autoloading won't work.

    Signed-off-by: Javier Martinez Canillas
    Acked-by: Andrew Lunn
    Signed-off-by: Alexandre Belloni

    Javier Martinez Canillas
     
  • These platform drivers have a platform device ID table but the module
    alias information is not created so module autoloading will not work.

    Signed-off-by: Javier Martinez Canillas
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Alexandre Belloni

    Javier Martinez Canillas
     
  • Configure the clock source to external clock if available.
    External clock is preferred as it can be ticking during suspend.

    Signed-off-by: Keerthy
    Acked-by: Tony Lindgren
    Signed-off-by: Alexandre Belloni

    Keerthy
     
  • The rtc can be clocked by an internal 32K clock. Adding the support
    to enable the same.

    Signed-off-by: Keerthy
    Acked-by: Tony Lindgren
    Signed-off-by: Alexandre Belloni

    Keerthy
     
  • According to datasheet, the S2MPS13X and S2MPS14X should update write
    buffer via setting WUDR bit to high after ctrl register is written.

    If not, ALARM interrupt of rtc-s5m doesn't happen first time when i use
    tools/testing/selftests/timers/rtctest.c test program and hour format is
    used to 12 hour mode in Odroid-XU3 board.

    One more issue is the RTC doesn't keep time on Odroid-XU3 board when i
    turn on board after power off even if RTC battery is connected. It can
    be solved as setting WUDR & RUDR bits to high at the same time after
    RTC_CTRL register is written. It's same with condition of only writing
    ALARM registers, so this is for only S2MPS14 and we should set WUDR &
    A_UDR bits to high on S2MPS13.

    I can't find any reasonable description about this like fix from
    datasheet, but can find similar codes from rtc driver source of
    hardkernel kernel and vendor kernel.

    Signed-off-by: Joonyoung Shim
    Cc: # v3.16
    Reviewed-by: Krzysztof Kozlowski
    Tested-by: Krzysztof Kozlowski
    Signed-off-by: Alexandre Belloni

    Joonyoung Shim
     
  • Add support for RTC controller found on Xilinx Zynq Ultrascale+ MPSoC
    platform.

    Signed-off-by: Suneel Garapati
    Acked-by: Moritz Fischer
    Signed-off-by: Alexandre Belloni

    Suneel Garapati
     
  • The RTC month value is 1-indexed, but the kernel assumes it is 0-indexed.
    This may result in the RTC not rolling over correctly.

    Signed-off-by: Bibek Basu
    Signed-off-by: Felix Janda
    Signed-off-by: Alexandre Belloni

    Bibek Basu
     
  • SA1100 and PXA differ only in register offsets which are currently
    hardcoded in a machine specific header. Some arm64 platforms (PXA1928)
    have this RTC block as well (and not the PXA270 variant).

    Convert the driver to use ioremap and set the register offsets dynamically.
    Since we are touching all the register accesses, convert them all to
    readl_relaxed/writel_relaxed.

    Signed-off-by: Rob Herring
    Acked-by: Robert Jarzmik
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Alexandre Belloni

    Rob Herring
     
  • Currently, the rtc-sa1100 and rtc-pxa drivers co-exist as rtc-pxa has a
    superset of functionality. Having 2 drivers sharing the same memory
    resource is not allowed by the driver model if resources are properly
    declared. This problem was avoided by not adding memory resources to the
    SA1100 RTC driver, but that prevents clean-up of the SA1100 driver.

    This commit converts the PXA RTC to use the exported SA1100 RTC
    functions. Now the sa1100-rtc and pxa-rtc devices are mutually
    exclusive, so we must remove the sa1100-rtc from pxa27x and pxa3xx.

    Signed-off-by: Rob Herring
    Cc: Daniel Mack
    Cc: Haojian Zhuang
    Cc: Robert Jarzmik
    Cc: Russell King
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Alexandre Belloni

    Rob Herring
     
  • Factor out the RTC initialization from the platform device specific
    parts in order to share the RTC device ops with other drivers.
    Specifically, it will be shared with rtc-pxa driver.

    Signed-off-by: Rob Herring
    Cc: Robert Jarzmik
    Cc: Russell King
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: rtc-linux@googlegroups.com
    Signed-off-by: Alexandre Belloni

    Rob Herring
     
  • If ds3232 work on some platform that is not implementing
    irq_set_wake, ds3232 will get a WARNING trace in resume.
    So fix ds3232->suspended state to false when irq_set_irq_wake
    return error.

    WARNING: CPU: 0 PID: 729 at kernel/irq/manage.c:604 irq_set_irq_wake+0x4b/0x8c()
    Unbalanced IRQ 201 wake disable
    Modules linked in:
    CPU: 0 PID: 729 Comm: sh Not tainted 3.12.19-rt30+ #25
    [] (unwind_backtrace+0x1/0x88) from [] (show_stack+0xb/0xc)
    [] (show_stack+0xb/0xc) from [] (dump_stack+0x4d/0x60)
    [] (dump_stack+0x4d/0x60) from [] (warn_slowpath_common+0x45/0x64)
    [] (warn_slowpath_common+0x45/0x64) from [] (warn_slowpath_fmt+0x1b/0x24)
    [] (warn_slowpath_fmt+0x1b/0x24) from [] (irq_set_irq_wake+0x4b/0x8c)
    [] (irq_set_irq_wake+0x4b/0x8c) from [] (ds3232_resume+0x2d/0x36)
    [] (ds3232_resume+0x2d/0x36) from [] (dpm_run_callback.isra.13+0xb/0x28)
    [] (dpm_run_callback.isra.13+0xb/0x28) from [] (device_resume+0x7b/0xa2)
    [] (device_resume+0x7b/0xa2) from [] (dpm_resume+0xbb/0x19c)
    [] (dpm_resume+0xbb/0x19c) from [] (dpm_resume_end+0x9/0x12)
    [] (dpm_resume_end+0x9/0x12) from [] (suspend_devices_and_enter+0x17d/0x1d0)
    [] (suspend_devices_and_enter+0x17d/0x1d0) from [] (pm_suspend+0x71/0x128)
    [] (pm_suspend+0x71/0x128) from [] (state_store+0x6d/0x80)
    [] (state_store+0x6d/0x80) from [] (sysfs_write_file+0x9f/0xde)
    [] (sysfs_write_file+0x9f/0xde) from [] (vfs_write+0x7b/0x104)
    [] (vfs_write+0x7b/0x104) from [] (SyS_write+0x27/0x48)
    [] (SyS_write+0x27/0x48) from [] (ret_fast_syscall+0x1/0x44)

    Signed-off-by: Wang Dongsheng
    Signed-off-by: Alexandre Belloni

    Wang Dongsheng