05 Aug, 2016

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "RTC for 4.8

    Cleanups:
    - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup
    rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc
    - move mn10300 to rtc-cmos

    Subsystem:
    - fix wakealarms after hibernate
    - multiples fixes for rctest
    - simplify implementations of .read_alarm

    New drivers:
    - Maxim MAX6916

    Drivers:
    - ds1307: fix weekday
    - m41t80: add wakeup support
    - pcf85063: add support for PCF85063A variant
    - rv8803: extend i2c fix and other fixes
    - s35390a: fix alarm reading, this fixes instant reboot after
    shutdown for QNAP TS-41x
    - s3c: clock fixes"

    * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits)
    rtc: rv8803: Clear V1F when setting the time
    rtc: rv8803: Stop the clock while setting the time
    rtc: rv8803: Always apply the I²C workaround
    rtc: rv8803: Fix read day of week
    rtc: rv8803: Remove the check for valid time
    rtc: rv8803: Kconfig: Indicate rx8900 support
    rtc: asm9260: remove .owner field for driver
    rtc: at91sam9: Fix missing spin_lock_init()
    rtc: m41t80: add suspend handlers for alarm IRQ
    rtc: m41t80: make it a real error message
    rtc: pcf85063: Add support for the PCF85063A device
    rtc: pcf85063: fix year range
    rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy
    rtc: explicitly set tm_sec = 0 for drivers with minute accurancy
    rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()
    rtc: s3c: Remove unnecessary call to disable already disabled clock
    rtc: abx80x: use devm_add_action_or_reset()
    rtc: m41t80: use devm_add_action_or_reset()
    rtc: fix a typo and reduce three empty lines to one
    rtc: s35390a: improve two comments in .set_alarm
    ...

    Linus Torvalds
     

28 Jul, 2016

6 commits

  • V1F indicates that the time accuracy may have been compromised because
    of a voltage drop (possibly only temporary) below VLOW1, which stops the
    temperature compensation. When the time is set, the accuracy is
    restored, so V1F should be cleared in order to indicate this and to be
    able to detect the next temperature compensation loss. This is the same
    principle as for V2F, which is cleared when the time is set to indicate
    that the time is no longer invalid and to be able to detect the next
    data loss.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     
  • According to the application manual of the RX8900, the RESET bit must be
    set to 1 to prevent a timer update while setting the time. This also
    resets the subsecond counter. The application manual of the RV-8803 does
    not mention such a requirement, and it says that the 100th Seconds
    register is cleared when writing to the Seconds register, but using the
    RESET bit for the RV-8803 too should not be an issue and is probably
    safer.

    This change also ensures that the RESET bit is initialized properly in
    all cases. Indeed, all the registers must be initialized if the voltage
    has been lower than VLOW2 (triggering V2F), but not low enough to
    trigger a POR.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     
  • The I²C NACK issue of the RV-8803 may occur after any I²C START
    condition, depending on the timings. Consequently, the workaround must
    be applied for all the I²C transfers.

    This commit abstracts the I²C transfer code into register access
    functions. This avoids duplicating the I²C workaround everywhere. This
    also avoids the duplication of the code handling the return value of
    i2c_smbus_read_i2c_block_data(). Error messages are issued in case of
    definitive register access failures (if the workaround fails). This
    change also makes the I²C transfer return value checks consistent.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     
  • The Weekday register is encoded as 2^tm_wday, with tm_wday in 0..6, so
    using tm_wday = ffs(reg) to fill tm_wday from the register value is
    wrong because this gives the expected value + 1. This could be fixed as
    tm_wday = ffs(reg) - 1, but tm_wday = ilog2(reg) works as well and is
    more direct.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     
  • The RTC core always calls rtc_valid_tm() after ->read_time() in case of
    success (in __rtc_read_time()), so do not call it twice.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     
  • This driver supports the Epson RX8900, but this was not indicated in
    Kconfig.

    Signed-off-by: Benoît Thébaudeau
    Signed-off-by: Alexandre Belloni

    Benoît Thébaudeau
     

27 Jul, 2016

1 commit


26 Jul, 2016

1 commit


22 Jul, 2016

2 commits


20 Jul, 2016

4 commits


19 Jul, 2016

4 commits

  • As per code flow s3c_rtc_setfreq() will get called with rtc clock disabled
    and in set_freq we perform h/w registers read/write, which results in a
    kernel crash on exynos7 platform while probing rtc driver.
    Below is code flow:
    s3c_rtc_probe()
    clk_prepare_enable(info->rtc_clk) // rtc clock enabled
    s3c_rtc_gettime() // will enable clk if not done, and disable it upon exit
    s3c_rtc_setfreq() //then this will be called with clk disabled

    This patch take cares of such issue by adding s3c_rtc_{enable/disable}_clk in
    s3c_rtc_setfreq().

    Fixes: 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock control")

    Cc:
    Signed-off-by: Alim Akhtar
    Reviewed-by: Krzysztof Kozlowski
    Reviewed-by: Pankaj Dubey
    Tested-by: Pankaj Dubey
    Signed-off-by: Alexandre Belloni

    Alim Akhtar
     
  • At the end of s3c_rtc_probe(), s3c_rtc_disable_clk() being called with rtc
    clock already disabled (by s3c_rtc_gettime()), which looks extra and
    unnecessary call. Lets clean it up.

    Signed-off-by: Alim Akhtar
    Reviewed-by: Krzysztof Kozlowski
    Reviewed-by: Pankaj Dubey
    Tested-by: Pankaj Dubey
    Signed-off-by: Alexandre Belloni

    Alim Akhtar
     
  • If devm_add_action() fails we are explicitly calling the cleanup to free
    the resources allocated. Lets use the helper devm_add_action_or_reset()
    and return directly in case of error, as we know that the cleanup function
    has been already called by the helper if there was any error.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Alexandre Belloni

    Sudip Mukherjee
     
  • If devm_add_action() fails we are explicitly calling the cleanup to free
    the resources allocated. Lets use the helper devm_add_action_or_reset()
    and return directly in case of error, as we know that the cleanup function
    has been already called by the helper if there was any error.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Alexandre Belloni

    Sudip Mukherjee
     

12 Jul, 2016

8 commits

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

    Uwe Kleine-König
     
  • Be more explicit in some comments.

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

    Uwe Kleine-König
     
  • On some QNAP NAS devices the rtc can wake the machine. Several people
    noticed that once the machine was woken this way it fails to shut down.
    That's because the driver fails to acknowledge the interrupt and so it
    keeps active and restarts the machine immediatly after shutdown. See
    https://bugs.debian.org/794266 for a bug report.

    Doing this correctly requires to interpret the INT2 flag of the first read
    of the STATUS1 register because this bit is cleared by read.

    Note this is not maximally robust though because a pending irq isn't
    detected when the STATUS1 register was already read (and so INT2 is not
    set) but the irq was not disabled. But that is a hardware imposed problem
    that cannot easily be fixed by software.

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

    Uwe Kleine-König
     
  • There were two deviations from the reference manual: you have to wait
    half a second when POC is active and you might have to repeat
    initialization when POC or BLD are still set after the sequence.

    Note however that as POC and BLD are cleared by read the driver might
    not be able to detect that a reset is necessary. I don't have a good
    idea how to fix this.

    Additionally report the value read from STATUS1 to the caller. This
    prepares the next patch.

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

    Uwe Kleine-König
     
  • There are several issues fixed in this patch:

    - When alarm isn't enabled, set .enabled to zero instead of returning
    -EINVAL.
    - Ignore how IRQ1 is configured when determining if IRQ2 is on.
    - The three alarm registers have an enable flag which must be
    evaluated.
    - The chip always triggers when the seconds register gets 0.

    Note that the rtc framework however doesn't handle the result correctly
    because it doesn't check wday being initialized and so interprets an
    alarm being set for 10:00 AM in three days as 10:00 AM tomorrow (or
    today if that's not over yet).

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

    Uwe Kleine-König
     
  • The rtc core doesn't give broken dates to a driver's .set_alarm
    callback, so there should be no need for validation.

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

    Uwe Kleine-König
     
  • This rtc doesn't support triggering on years, so don't assign tm_year
    instead of claiming the alarm is to trigger in year 67435.

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

    Uwe Kleine-König
     
  • The rtc chip doesn't support triggering on month and year. So just don't
    assign the respective fields in .read_alarm and let the rtc core
    interpret this accordingly.

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

    Uwe Kleine-König
     

09 Jul, 2016

3 commits

  • Since commit d68778b80dd7 ("rtc: initialize output parameter for read
    alarm to "uninitialized"") there is no need to explicitly set
    unsupported members to -1. So drop the respective assignments from
    drivers.

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

    Uwe Kleine-König
     
  • The reset value of weekday is 0x1. This is wrong since
    the reset values of the day/month/year make up to Jan 1 2001.
    When computed weekday comes out to be Monday. On a scale
    of 1-7(Sunday - Saturday) it should be 0x2. So we should not
    be relying on the reset value.

    Hence compute the wday using the current date/month/year values.
    Check if reset wday is any different from the computed wday,
    If different then set the wday which we computed using
    date/month/year values.

    Document Referred:
    http://ww1.microchip.com/downloads/en/DeviceDoc/20002266F.pdf

    Fixes: 1d1945d261a2af "drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips"
    Signed-off-by: Keerthy
    Signed-off-by: Alexandre Belloni

    Keerthy
     
  • rtc-v3020.h belongs to include/linux/platform_data/

    Acked-by: Robert Jarzmik
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

08 Jul, 2016

1 commit


29 Jun, 2016

1 commit

  • An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the
    params[1] struct member. However this isn't intuitive or obvious when
    reading the code and requires that a user look at the skiboot
    documentation or opal-api.h to verify this.

    Add an inline function to get the return code from an opal_msg and update
    call sites accordingly.

    Signed-off-by: Suraj Jitindar Singh
    Signed-off-by: Michael Ellerman

    Suraj Jitindar Singh
     

28 Jun, 2016

1 commit


27 Jun, 2016

1 commit


26 Jun, 2016

3 commits

  • The previous workaround may still fail as there are actually 4 retries to
    be done to ensure the communication succeed. Also, some I2C adapter drivers
    may return -EIO instead of -ENXIO.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The mc146818_get_time/mc146818_set_time functions are rather large
    inline functions in a global header file and are used in several
    drivers and in x86 specific code.

    Here we move them into a separate .c file that is compiled whenever
    any of the users require it. This also lets us remove the linux/acpi.h
    header inclusion from mc146818rtc.h, which in turn avoids some
    warnings about duplicate definition of the TRUE/FALSE macros.

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

    Arnd Bergmann
     
  • 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
     

06 Jun, 2016

1 commit

  • While the EFI spec mandates an RTC, not every implementation actually adheres
    to that rule (or can adhere to it - some systems just don't have an RTC).

    For those, we really don't want to probe the EFI RTC driver at all, because if
    we do we'd get a non-functional driver that does nothing useful but only spills
    our kernel log with warnings.

    Signed-off-by: Alexander Graf
    Acked-by: Ard Biesheuvel
    Signed-off-by: Alexandre Belloni

    Alexander Graf
     

04 Jun, 2016

2 commits