1. 24 Feb, 2017 1 commit
    • Phil Reid's avatar
      rtc: ds3232: Call device_init_wakeup before device_register · d4f6c6f1
      Phil Reid authored
      The wakealarm attribute is currently not exposed in the sysfs interface
      as the device has not been set as doing wakealarm when device_register
      is called. Changing the order of the calls fixes that problem. Interrupts
      are cleared in check_rtc_status prior to requesting the interrupt.
      
      This is only set if an irq is defined. If irq registration fails then
      set wakeup_capable to false. With this change the sysfs wakealarm
      attribute will be left visible but it is non functional. rtcwake
      still returns that the device is not enabled for wakeup.
      Signed-off-by: default avatarPhil Reid <preid@electromag.com.au>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      d4f6c6f1
  2. 23 Feb, 2017 1 commit
  3. 21 Feb, 2017 9 commits
  4. 12 Feb, 2017 3 commits
  5. 11 Feb, 2017 2 commits
  6. 01 Feb, 2017 8 commits
  7. 24 Jan, 2017 2 commits
  8. 22 Jan, 2017 3 commits
    • Amelie Delaunay's avatar
      rtc: stm32: fix comparison warnings · 1d70ba3b
      Amelie Delaunay authored
      This patches fixes comparison between signed and unsigned values as it
      could produce an incorrect result when the signed value is converted to
      unsigned:
      
      drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_valid_alrm':
      drivers/rtc/rtc-stm32.c:404:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
        if ((((tm->tm_year > cur_year) &&
      ...
      
      It also fixes comparison always true or false due to the fact that unsigned
      value is compared against zero with >= or <:
      
      drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_init':
      drivers/rtc/rtc-stm32.c:514:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
        for (pred_a = pred_a_max; pred_a >= 0; pred_a-- ) {
      
      drivers/rtc/rtc-stm32.c:530:44: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
           (rate - ((pred_a + 1) * (pred_s + 1)) < 0) ?
      
      Fixes: 4e64350f ("rtc: add STM32 RTC driver")
      Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@st.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      1d70ba3b
    • Amelie Delaunay's avatar
      rtc: stm32: use 0 instead of ~PWR_CR_DBP in regmap_update_bits · a560c527
      Amelie Delaunay authored
      Using the ~ operator on a BIT() constant results in a large 'unsigned long'
      constant that won't fit into an 'unsigned int' function argument on 64-bit
      architectures, resulting in a harmless build warning in x86 allmodconfig:
      
      drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_probe':
      drivers/rtc/rtc-stm32.c:651:51: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
        regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, ~PWR_CR_DBP);
      
      As PWR_CR_DBP mask prevents other bits to be cleared, replace all
      ~PWR_CR_DBP by 0.
      
      Fixes: 4e64350f ("rtc: add STM32 RTC driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@st.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      a560c527
    • Thierry Reding's avatar
      rtc: tegra: Implement clock handling · 5fa40869
      Thierry Reding authored
      Accessing the registers of the RTC block on Tegra requires the module
      clock to be enabled. This only works because the RTC module clock will
      be enabled by default during early boot. However, because the clock is
      unused, the CCF will disable it at late_init time. This causes the RTC
      to become unusable afterwards. This can easily be reproduced by trying
      to use the RTC:
      
      	$ hwclock --rtc /dev/rtc1
      
      This will hang the system. I ran into this by following up on a report
      by Martin Michlmayr that reboot wasn't working on Tegra210 systems. It
      turns out that the rtc-tegra driver's ->shutdown() implementation will
      hang the CPU, because of the disabled clock, before the system can be
      rebooted.
      
      What confused me for a while is that the same driver is used on prior
      Tegra generations where the hang can not be observed. However, as Peter
      De Schrijver pointed out, this is because on 32-bit Tegra chips the RTC
      clock is enabled by the tegra20_timer.c clocksource driver, which uses
      the RTC to provide a persistent clock. This code is never enabled on
      64-bit Tegra because the persistent clock infrastructure does not exist
      on 64-bit ARM.
      
      The proper fix for this is to add proper clock handling to the RTC
      driver in order to ensure that the clock is enabled when the driver
      requires it. All device trees contain the clock already, therefore
      no additional changes are required.
      Reported-by: default avatarMartin Michlmayr <tbm@cyrius.com>
      Acked-By Peter De Schrijver <pdeschrijver@nvidia.com>
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      5fa40869
  9. 13 Jan, 2017 5 commits
  10. 12 Jan, 2017 1 commit
    • Russell King's avatar
      rtc: armada38x: make struct rtc_class_ops const · d748c981
      Russell King authored
      Armada38x wants to modify its rtc_class_ops to remove the interrupt
      handling when there is no usable interrupt, but this means we leave
      function pointers in writable memory.
      
      Since rtc_class_ops is small, arrange to have two instances, one for
      when we have interrupts, and one for when we have none, both marked
      const.  This allows the compiler to place them in read-only memory,
      which is better than placing them in __ro_after_init.
      
      Thanks to Bhumika Goyal <bhumirks@gmail.com> for pointing out that
      the structure was writable and submitting a patch to add
      __ro_after_init.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      d748c981
  11. 11 Jan, 2017 5 commits