18 Jul, 2019

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "A quiet cycle this time.

    - ds1307: properly handle oscillator failure flags

    - imx-sc: alarm support

    - pcf2123: alarm support, correct offset handling

    - sun6i: add R40 support

    - simplify getting the adapter of an i2c client"

    * tag 'rtc-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (37 commits)
    rtc: wm831x: Add IRQF_ONESHOT flag
    rtc: stm32: remove one condition check in stm32_rtc_set_alarm()
    rtc: pcf2123: Fix build error
    rtc: interface: Change type of 'count' from int to u64
    rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
    rtc: pcf8563: Fix interrupt trigger method
    rtc: pcf2123: fix negative offset rounding
    rtc: pcf2123: add alarm support
    rtc: pcf2123: use %ptR
    rtc: pcf2123: port to regmap
    rtc: pcf2123: remove sysfs register view
    rtc: rx8025: simplify getting the adapter of a client
    rtc: rx8010: simplify getting the adapter of a client
    rtc: rv8803: simplify getting the adapter of a client
    rtc: m41t80: simplify getting the adapter of a client
    rtc: fm3130: simplify getting the adapter of a client
    rtc: tegra: Drop MODULE_ALIAS
    rtc: sun6i: Add R40 compatible
    dt-bindings: rtc: sun6i: Add the R40 RTC compatible
    dt-bindings: rtc: Convert Allwinner A31 RTC to a schema
    ...

    Linus Torvalds
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

23 May, 2019

1 commit

  • Stop enabling the oscillator and removing the oscillator failure flags in
    probe. Instead, return -EINVAL in .read_time when the oscillaotr is not
    start or when it failed at some point. The oscillator gets enabled on the
    first .set_time after failure and the failure flags are cleared.

    This also removes the possibility of an infinite loop at probe where a
    failing RTC will make the goto read_rtc to be taken every time.

    Tested on mcp79411.

    Reported-by: Mastro Gippo
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

08 Feb, 2019

5 commits


22 Oct, 2018

1 commit

  • Commit 51ed73eb998a1c79a2b0e9bed68f75a8a2c93b9b ("rtc: ds1340: Add support
    for trickle charger.") breaks ds1339 wakealarm support by limiting
    accessible registers. Fix this.

    Fixes: 51ed73eb998a ("rtc: ds1340: Add support for trickle charger.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Soeren Moch
    Signed-off-by: Alexandre Belloni

    Soeren Moch
     

28 Sep, 2018

3 commits


16 Aug, 2018

1 commit

  • We don't have to define an extra config symbol, IS_REACHABLE does
    what we need. And having this config symbol just to save the few
    bytes of hwmon support on non-DS3231 chips isn't worth it IMO
    (especially as the symbol is set per default).

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     

17 Jul, 2018

2 commits

  • The m41t11 variant is very similar to the already supported m41t00 and
    m41t0, but it has also 56 bytes of NVRAM.

    Add it to driver taking into account NVRAM section.

    Signed-off-by: Giulio Benetti
    Reviewed-by: Rob Herring
    Signed-off-by: Alexandre Belloni

    Giulio Benetti
     
  • data field points to m41t00, instead it should point to m41t0.
    Driver works correctly because on both cases(m41t0 and m41t00) chip_desc
    are equal.

    Point to right enum m41t0 instead of m41t00.

    Signed-off-by: Giulio Benetti
    Signed-off-by: Alexandre Belloni

    Giulio Benetti
     

04 May, 2018

1 commit


02 Mar, 2018

1 commit


01 Mar, 2018

2 commits


27 Oct, 2017

1 commit


12 Oct, 2017

1 commit

  • The current code for checking and fixing the weekday in ds1307_probe
    faces some issues:
    - This check is applied to all chips even if its applicable (AFAIK)
    to mcp794xx only
    - The check uses MCP794XX constants for registers and bits even though
    it's executed also on other chips (ok, this could be fixed easily)
    - It relies on tm_wday being properly populated when core calls set_time
    and set_alarm. This is not guaranteed at all.

    First two issue we could solve by moving the check to the
    mcp794xx-specific initialization (where also VBATEN flag is set).

    The proposed alternative is in the set_alarm path for mcp794xx only and
    calculates the alarm weekday based on the current weekday in the RTC
    timekeeping regs and the difference between alarm date and current date.
    So we are fine with any weekday even if it doesn't match the date.

    Still there are cases where this could fail, e.g.:
    - rtc date/time + weekday have power-on-reset default values
    - alarm is set to actual date/time + x
    - set_time is called (may change diff between rtc weekday and actual
    weekday)

    But similar issues we have with the current code too:
    - rtc date/time + weekday have power-on-reset default values
    - alarm is set to rtc date/time + x
    - set_time is called before the alarm triggers

    Using random rtc date/time with relative alarms simply can interfere
    with set_time. I'm not totally convinced of either option yet.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     

14 Sep, 2017

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "Subsystem:
    - remove .open() and .release() RTC ops
    - constify i2c_device_id

    New driver:
    - Realtek RTD1295
    - Android emulator (goldfish) RTC

    Drivers:
    - ds1307: Beginning of a huge cleanup
    - s35390a: handle invalid RTC time
    - sun6i: external oscillator gate support"

    * tag 'rtc-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (40 commits)
    rtc: ds1307: use octal permissions
    rtc: ds1307: fix braces
    rtc: ds1307: fix alignments and blank lines
    rtc: ds1307: use BIT
    rtc: ds1307: use u32
    rtc: ds1307: use sizeof
    rtc: ds1307: remove regs member
    rtc: Add Realtek RTD1295
    dt-bindings: rtc: Add Realtek RTD1295
    rtc: sun6i: Add support for the external oscillator gate
    rtc: goldfish: Add RTC driver for Android emulator
    dt-bindings: Add device tree binding for Goldfish RTC driver
    rtc: ds1307: add basic support for ds1341 chip
    rtc: ds1307: remove member nvram_offset from struct ds1307
    rtc: ds1307: factor out offset to struct chip_desc
    rtc: ds1307: factor out rtc_ops to struct chip_desc
    rtc: ds1307: factor out irq_handler to struct chip_desc
    rtc: ds1307: improve irq setup
    rtc: ds1307: constify struct chip_desc variables
    rtc: ds1307: improve trickle charger initialization
    ...

    Linus Torvalds
     

05 Sep, 2017

7 commits


01 Sep, 2017

10 commits

  • This adds support for reading and writing date/time from/to ds1341 chip.

    ds1341 chip has other features - alarms, input clock (can be used instead
    of intercal oscillator for better accuracy), output clock ("square wave
    generation"). However, not all of that is available at the same time.
    Same chip pins, CLKIN/nINTA and SQW/nINTB, can be used either for
    input/output clocks, or for alarm interrupts. Role of these pins on
    particular board depends on hardware wiring.

    We can add device tree properties that describe if each of pins is wired
    as clock, or as interrupt, or left unconnected, and enable support for
    corresponding functionality based on that. But that is cumbersome, requires
    hardware for testing, and has to deal with bit enabling/disabling output
    clock also affects which pins alarm interrupts are routed to.

    Another factor is that there are hardware setups (i.e. ZII RDU2) that
    power DS1341 from SuperCap, which makes power saving critical. For such
    setups, kernel driver should leave register bits that control mentioned
    pins in the state configured by bootloader.

    Given all that, it was decided to limit support to "only date/time" for
    now. That is enough for common use case. Full (and cumbersome)
    implementation can be added later if ever needed.

    Signed-off-by: Nikita Yushchenko
    Reviewed-by: Linus Walleij
    Tested-by: Aleksander Morgado
    Signed-off-by: Alexandre Belloni

    Nikita Yushchenko
     
  • Remove member nvram_offset from struct ds1307 and use the value stored
    in struct chip_desc directly.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Factor out offset to struct chip_desc and remove it from struct ds1307.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Factor out rtc_ops to struct chip_desc and use ds13xx_rtc_ops as default.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Factor out irq_handler to struct chip_desc and use ds1307_irq as default.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Change the usage of variable want_irq to reflect its name. Don't set
    it to true in case wakeup is enabled but no interrupt number is given.
    In addition set variable ds1307_can_wakeup_device if chip->alarm
    is set only.
    This allows to simplify the code and make it better understandable.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Constify struct chip_desc variables.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Instead of storing the trickle_charger_setup value in struct chip_desc
    we can let function ds1307_trickle_init return it because it's used
    in the probe function only.
    This allows us to constify struct chip_desc variables in a next step.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • Factor out the bbsqi bit to struct chip_desc.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     
  • The irq number is used in the probe function only, so we don't have
    to store it in struct ds1307.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit
     

21 Aug, 2017

1 commit

  • Current max_register setting breaks reading nvram on certain chips and
    also reading the standard registers on RX8130 where register map starts
    at 0x10.

    Signed-off-by: Heiner Kallweit
    Fixes: 11e5890b5342 "rtc: ds1307: convert driver to regmap"
    Signed-off-by: Alexandre Belloni

    Heiner Kallweit