25 Jun, 2015

29 commits

  • Use resource_size function on resource object instead of explicit
    computation.

    No need to set .owner here. The core will do it.
    Remove .owner field if calls are used which set it automatically

    Signed-off-by: Fengguang Wu
    Acked-by: Hans Ulli Kroll
    Signed-off-by: Alexandre Belloni

    kbuild test robot
     
  • The driver can't accommodate the 12 hour mode but the error message states
    that the 24 hour mode is not supported.
    Also fix the typos (hour vs hours).

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Use bit instead of hand coding the shift and correct the 24 hour vs 24
    hours typo.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The rtc-efi driver declares that the EFI 'epoch' is 1/1/1998, but
    the UEFI spec does not define it at all. It does define a range of
    [1900, 9999] for the 'Year' member of the EFI_TIME struct, so let's
    use 1900 as the minimum year and not 1998.
    Also, move the validation of the year to the convert_from_efi_time()
    routine where all other EFI_TIME fields are validated as well.

    This prevents rtc_read_time() failures when the RTC that backs the
    EFI time services is set to a date before 1998, e.g., when it has
    lost power.

    This also optimizes the compute_wday() routine, by replacing the for
    loop with a simple arithmetic expression, and by reusing the yearday
    value that we need to compute anyway when populating the
    rtc_time::tm_yday field.

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

    Ard Biesheuvel
     
  • Now rtc_set_mmss() has no users, just remove it.

    We still have rtc_set_time() doing similar things.

    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • On Sparc systems, update_persistent_clock() uses RTC drivers to do
    the job, it makes more sense to hand it over to CONFIG_RTC_SYSTOHC.

    In the long run, all the update_persistent_clock() should migrate to
    proper class RTC drivers if any and use CONFIG_RTC_SYSTOHC instead.

    Signed-off-by: Xunlei Pang
    Acked-by: David S. Miller
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
    is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
    some limiations, for example, it must be battery-backed, be able
    to work with irq off and through system suspension, etc.

    So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
    it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
    be assigned any available RTC in the system.

    Default value is CONFIG_RTC_HCTOSYS_DEVICE which is "rtc0" by default.
    After this patch, NTP will sync up "rtc0" by default.

    Cc: Paul Bolle
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • sunxi_rtc_setalarm() uses deprecated rtc_tm_to_time(),
    which will overflow in year 2106 on 32-bit machines.

    This patch solves this by:
    - Replacing rtc_tm_to_time() with rtc_tm_sub()

    Also remove the unnecessary initial zeroing of some
    local variables in sunxi_rtc_setalarm().

    Cc: Carlo Caione
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • isl1208_i2c_set_alarm() uses deprecated rtc_tm_to_time(),
    which will overflow in year 2106 on 32-bit machines.

    This patch solves this by:
    - Replacing rtc_tm_to_time() with rtc_tm_sub()

    Cc: Herbert Valerio Riedel
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • There're many sites need comparing the two rtc_time variants for many
    rtc drivers, especially in the instances of rtc_class_ops::set_alarm().

    So add this common helper function to make things easy.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • pcf8563_rtc_set_alarm() uses deprecated rtc_tm_to_time()
    and rtc_time_to_tm(), which will overflow in year 2106
    on 32-bit machines.

    This patch solves this by:
    - Replacing rtc_time_to_tm() with rtc_time64_to_tm()
    - Replacing rtc_tm_to_time() with rtc_tm_to_time64()

    Acked-by: Arnd Bergmann
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     
  • Initialise the variable high_bb_charging before using it to avoid
    configuring wrong value and fix following compilation warning:

    /*
    rtc-palmas.c: In function ‘palmas_rtc_probe’:
    rtc-palmas.c:242:7: warning: ‘high_bb_charging’ may be used
    uninitialized in this function
    */

    Signed-off-by: Laxman Dewangan
    Signed-off-by: Alexandre Belloni

    Laxman Dewangan
     
  • Remove unneeded error handling on the result of a call to
    platform_get_resource when the value is passed to devm_ioremap_resource.

    Move the call to platform_get_resource adjacent to the call to
    devm_ioremap_resource to make the connection between them more clear.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression pdev,res,n,e,e1;
    expression ret != 0;
    identifier l;
    @@

    - res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    ... when != res
    - if (res == NULL) { ... \(goto l;\|return ret;\) }
    ... when != res
    + res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    e = devm_ioremap_resource(e1, res);
    //

    Signed-off-by: Julia Lawall
    [viresh.kumar@linaro.org: acked rtc-spear]
    Acked-by: Viresh Kumar
    Signed-off-by: Alexandre Belloni

    Julia Lawall
     
  • Return -EINVAL if the voltage low bit is set to avoid getting a bogus
    time at boot.
    There was a comment stating that util-linux hwclock refuses to set a
    new time if we return an error code on read, but at least the current
    version do set the time as expected. Remove the comment and the check
    for valid time, and let the rtc core check it for us.

    Signed-off-by: Jan Kardell
    Signed-off-by: Alexandre Belloni

    Jan Kardell
     
  • Driver for the on chip RTC found on Cortina's SoC Gemini.

    Signed-off-by: Hans Ulli Kroll
    [alexandre.belloni@free-electrons.com: use devm_request_irq() and remove
    useless goto]
    Signed-off-by: Alexandre Belloni

    Hans Ulli Kroll
     
  • rtc-stmp3xxx depends on lib/stmp_device, select it.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • When entering suspend while an wakeup alarm is set, enable_set_wake
    should make sure that the RTC interrupt keep being enabled and the
    .irq_set_wake for the RTC interrupt get called. However, since the
    driver uses the suspend_noirq callback, the call to enable_irq_wake
    has been made after disabling the interrupts. While .irq_set_wake
    has been called properly, the interrupt remained disabled.

    Use the suspend callback to call enable_irq_wake early enough to
    ensure the RTC interrupt remains enabled.

    Fixes: 7654e9d4fd8f ("drivers/rtc/rtc-snvs: fix suspend/resume")
    Cc: # 3.19
    Signed-off-by: Stefan Agner
    Signed-off-by: Alexandre Belloni

    Stefan Agner
     
  • Using gpio_request_array()/gpio_free_array() can make the code
    simpler because it can set the direction and initial value
    in one shot and the for loop is unnecessary.

    Also, struct v3020_gpio is removed, because the struct v3020_gpio
    is replaced with struct gpio.

    Signed-off-by: Jingoo Han
    Signed-off-by: Alexandre Belloni

    Jingoo Han
     
  • Drivers should not be using the __raw_* io accessors.

    Signed-off-by: H Hartley Sweeten
    Cc: Alessandro Zummo
    Signed-off-by: Alexandre Belloni

    H Hartley Sweeten
     
  • If the rtc-max77802 driver is built as a module, modalias information is
    not filled so the module is not autoloaded. Use the MODULE_DEVICE_TABLE()
    macro to export the platform ID table so the module contains that data.

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

    Javier Martinez Canillas
     
  • If the rtc-max77686 driver is built as a module, modalias information is
    not filled so the module is not autoloaded. Use the MODULE_DEVICE_TABLE()
    macro to export the platform ID table so the module contains that data.

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

    Javier Martinez Canillas
     
  • The device table is required to load modules based on modaliases.
    After adding MODULE_DEVICE_TABLE, below entries will be added to
    modules.alias:

    alias i2c:ds1672 rtc_ds1672
    alias i2c:max6900 rtc_max6900
    alias platform:lp3974-rtc rtc_max8998
    alias platform:max8998-rtc rtc_max8998

    Signed-off-by: Axel Lin
    Cc: Alessandro Zummo
    Cc: Dale Farnsworth
    Cc: Minkyu Kang
    Cc: Joonyoung Shim
    Signed-off-by: Alexandre Belloni

    Axel Lin
     
  • On some !ARM 32bits platforms, the following compilation error happens
    because of the division on a 64bits value in mtk_rtc_read_time():

    drivers/built-in.o: In function `mtk_rtc_read_time':
    rtc-mt6397.c:(.text+0x265d13f): undefined reference to `__divdi3'
    rtc-mt6397.c:(.text+0x265d150): undefined reference to `__moddi3'

    Use div_s64() as done in rtc_time64_to_tm() to solve that.

    Reported-by: kbuild test robot
    Acked-by: Eddie Huang
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • According to C99, %2.s means 'print two spaces' (a precision of
    . without following digits or * means 0). The kernel's printf
    implementation, however, treats that case as if no precision was
    given, but relying on that quirk is rather silly. Also, since no -
    (aka left-justify) flag is given, the field with of 2 would then cause
    the alarm->enabled case to come out as "o n". Deobfuscate it.

    Signed-off-by: Rasmus Villemoes
    Signed-off-by: Alexandre Belloni

    Rasmus Villemoes
     
  • Add Mediatek RTC driver to maintainer entry.

    Signed-off-by: Eddie Huang
    Signed-off-by: Alexandre Belloni

    Eddie Huang
     
  • Add Mediatek MT6397 RTC driver

    Signed-off-by: Tianping Fang
    Signed-off-by: Eddie Huang
    Signed-off-by: Alexandre Belloni

    Tianping Fang
     
  • Provide MT6397 RTC interrupt, base address, and register in
    MT6397 MFD.

    Signed-off-by: Eddie Huang
    Acked-by: Lee Jones
    Signed-off-by: Alexandre Belloni

    Eddie Huang
     
  • The rtc-xgene driver is only useful on X-Gene SoC.

    Signed-off-by: Jean Delvare
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: Iyappan Subramanian
    Cc: Keyur Chudgar
    Signed-off-by: Alexandre Belloni

    Jean Delvare
     
  • This patch updates the email address of the rtc-at32ap700x driver supported by
    me to an email account I will use on a more regular basis in the future.

    Signed-off-by: Hans-Christian Egtvedt
    Signed-off-by: Alexandre Belloni

    Hans-Christian Egtvedt
     

20 Jun, 2015

11 commits