04 Dec, 2019

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "A lot of unnecessary code removal in here that ends up decreasing the
    number of lines in the subsystem. The ds1343 and ds1347 drivers got
    cleaned up. The rest are the usual fixes and new features.

    Subsystem:
    - fix warnings and errors with make W=1
    - UIE are now disabled while setting the RTC time
    - UIE are now disallowed when the RTC time is not set.

    Drivers:
    - remove unecessary .remove callbacks
    - Set RTC range for cros-ec, ds1343, ds1347, m41t80, s35390a, vt8500
    - Use devm_platform_ioremap_resource where applicable
    - rv3028: add clock out support"

    * tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (81 commits)
    rtc: Fix Kconfig indentation
    rtc: xgene: Remove unused struct device in struct xgene_rtc_dev
    rtc: sun6i: Remove struct device from sun6i_rtc_dev
    rtc: st-lpc: Remove struct resource from struct st_rtc
    rtc: pcf8523: Remove struct pcf8523
    rtc: meson: remove redundant assignment to variable retries
    rtc: v3020: remove set but unused variable
    rtc: tegra: remove set but unused variable
    rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc
    rtc: m41t80: remove excess kerneldoc
    rtc: ds1685: fix build error with make W=1
    rtc: ds1685: remove set but unused variables
    rtc: ds1374: remove unused variable
    rtc: sysfs: fix hctosys_show kerneldoc
    rtc: interface: fix kerneldoc comments
    rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions
    rtc: msm6242: Fix reading of 10-hour digit
    rtc: tps65910: allow using RTC without alarm interrupt
    rtc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig
    rtc: pcf8563: Constify clkout_rates
    ...

    Linus Torvalds
     

02 Dec, 2019

1 commit

  • Pull MFD updates from Lee Jones:
    "Core Frameworks:
    - Add support for a "resource managed strongly uncachable ioremap"
    call
    - Provide a collection of MFD helper macros
    - Remove mfd_clone_cell() from MFD core
    - Add NULL de-reference protection in MFD core
    - Remove superfluous function fd_platform_add_cell() from MFD core
    - Honour Device Tree's request to disable a device

    New Drivers:
    - Add support for MediaTek MT6323 PMIC

    New Device Support:
    - Add support for Gemini Lake to Intel LPSS PCI
    - Add support for Cherry Trail Crystal Cover PMIC to Intel SoC PMIC
    CRC
    - Add support for PM{I}8950 to Qualcomm SPMI PMIC
    - Add support for U8420 to ST-Ericsson DB8500
    - Add support for Comet Lake PCH-H to Intel LPSS PCI

    New Functionality:
    - Add support for requested supply clocks; madera-core

    Fix-ups:
    - Lower interrupt priority; rk808
    - Use provided helpers (macros, group functions, defines); rk808,
    ipaq-micro, ab8500-core, db8500-prcmu, mt6397-core, cs5535-mfd
    - Only allocate IRQs on request; max77620
    - Use simplified API; arizona-core
    - Remove redundant and/or duplicated code; wm8998-tables, arizona,
    syscon
    - Device Tree binding fix-ups; madera, max77650, max77693
    - Remove mfd_cell->id abuse hack; cs5535-mfd
    - Remove only user of mfd_clone_cell(); cs5535-mfd
    - Make resources static; rohm-bd70528

    Bug Fixes:
    - Fix product ID for RK818; rk808
    - Fix Power Key; rk808
    - Fix booting on the BananaPi; mt6397-core
    - Endian fix-ups; twl.h
    - Fix static error checker warnings; ti_am335x_tscadc"

    * tag 'mfd-next-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (47 commits)
    Revert "mfd: syscon: Set name of regmap_config"
    mfd: ti_am335x_tscadc: Fix static checker warning
    mfd: bd70528: Staticize bit value definitions
    mfd: mfd-core: Honour Device Tree's request to disable a child-device
    dt-bindings: mfd: max77693: Fix missing curly brace
    mfd: intel-lpss: Add Intel Comet Lake PCH-H PCI IDs
    mfd: db8500-prcmu: Support U8420-sysclk firmware
    dt-bindings: mfd: max77650: Convert the binding document to yaml
    mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device()
    mfd: mfd-core: Remove usage counting for .{en,dis}able() call-backs
    x86: olpc-xo1-sci: Remove invocation of MFD's .enable()/.disable() call-backs
    x86: olpc-xo1-pm: Remove invocation of MFD's .enable()/.disable() call-backs
    mfd: mfd-core: Remove mfd_clone_cell()
    mfd: mfd-core: Protect against NULL call-back function pointer
    mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries
    mfd: cs5535-mfd: Request shared IO regions centrally
    mfd: cs5535-mfd: Remove mfd_cell->id hack
    mfd: cs5535-mfd: Use PLATFORM_DEVID_* defines and tidy error message
    mfd: intel_soc_pmic_crc: Add "cht_crystal_cove_pmic" cell to CHT cells
    mfd: madera: Add support for requesting the supply clocks
    ...

    Linus Torvalds
     

27 Nov, 2019

15 commits

  • Adjust indentation from spaces to tab (+optional two spaces) as in
    coding style with command like:
    $ sed -e 's/^ /\t/' -i */Kconfig

    Signed-off-by: Krzysztof Kozlowski
    Link: https://lore.kernel.org/r/20191120133940.13881-1-krzk@kernel.org
    Signed-off-by: Alexandre Belloni

    Krzysztof Kozlowski
     
  • struct device in struct xgene_rtc_dev is not used, remove it.

    Signed-off-by: Nobuhiro Iwamatsu
    Link: https://lore.kernel.org/r/20191123090234.32180-1-nobuhiro1.iwamatsu@toshiba.co.jp
    Signed-off-by: Alexandre Belloni

    Nobuhiro Iwamatsu
     
  • struct device in struct sun6i_rtc_dev is not used, remove it.

    Signed-off-by: Nobuhiro Iwamatsu
    Link: https://lore.kernel.org/r/20191123090538.32364-1-nobuhiro1.iwamatsu@toshiba.co.jp
    Signed-off-by: Alexandre Belloni

    Nobuhiro Iwamatsu
     
  • struct resource in struct st_rtc is not used, remove it.

    Signed-off-by: Nobuhiro Iwamatsu
    Link: https://lore.kernel.org/r/20191123091241.1905-1-nobuhiro1.iwamatsu@toshiba.co.jp
    Signed-off-by: Alexandre Belloni

    Nobuhiro Iwamatsu
     
  • struct pcf8523 is referenced only by pcf8523_probe(). And member variable in
    this is not referenced by any function. Remove struct pcf8523.

    Signed-off-by: Nobuhiro Iwamatsu
    Link: https://lore.kernel.org/r/20191123090838.1619-1-nobuhiro1.iwamatsu@toshiba.co.jp
    Signed-off-by: Alexandre Belloni

    Nobuhiro Iwamatsu
     
  • The variable retries is being initialized with a value that is never
    read and it is being updated later with a new value in a for-loop.
    The initialization is redundant and can be removed.

    Addresses-Coverity: ("Unused value")
    Signed-off-by: Colin Ian King
    Reviewed-by: Martin Blumenstingl
    Link: https://lore.kernel.org/r/20191122225210.109172-1-colin.king@canonical.com
    Signed-off-by: Alexandre Belloni

    Colin Ian King
     
  • Fix the following warning:
    drivers/rtc/rtc-v3020.c: In function ‘rtc_probe’:
    drivers/rtc/rtc-v3020.c:287:6: warning: variable ‘temp’ set but not used [-Wunused-but-set-variable]

    Link: https://lore.kernel.org/r/20191122102212.400158-9-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix the following warning:
    drivers/rtc/rtc-tegra.c: In function ‘tegra_rtc_read_time’:
    drivers/rtc/rtc-tegra.c:106:11: warning: variable ‘msec’ set but not used [-Wunused-but-set-variable]

    Cc: Thierry Reding
    Cc: Jonathan Hunter
    Acked-by: Thierry Reding
    Link: https://lore.kernel.org/r/20191122102212.400158-8-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The change from u8 ctrl_reg to const struct pm8xxx_rtc_regs *regs; did not
    properly update the kerneldoc comment. Fixes:

    drivers/rtc/rtc-pm8xxx.c:64: warning: Function parameter or member 'regs' not described in 'pm8xxx_rtc'

    Fixes: c8d523a4b053 ("drivers/rtc/rtc-pm8xxx.c: rework to support pm8941 rtc")
    Link: https://lore.kernel.org/r/20191122102212.400158-7-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix the following warning:
    drivers/rtc/rtc-m41t80.c:716: warning: Excess function parameter 'inode' description in 'wdt_ioctl'

    Link: https://lore.kernel.org/r/20191122102212.400158-6-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix the following parsing errors when building with W=1:
    drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!
    drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!
    drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'struct platform_driver ds1685_rtc_driver = '

    Cc: Joshua Kinard
    Link: https://lore.kernel.org/r/20191122102212.400158-5-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix the following warnings:
    drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_read_time’:
    drivers/rtc/rtc-ds1685.c:264:5: warning: variable ‘ctrlb’ set but not used [-Wunused-but-set-variable]
    264 | u8 ctrlb, century;
    | ^~~~~
    drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_proc’:
    drivers/rtc/rtc-ds1685.c:758:19: warning: variable ‘ctrlc’ set but not used [-Wunused-but-set-variable]
    758 | u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
    | ^~~~~
    Cc: Joshua Kinard
    Acked-By: Joshua Kinard
    Link: https://lore.kernel.org/r/20191122102212.400158-4-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix warning:

    drivers/rtc/rtc-ds1374.c: In function ‘ds1374_wdt_disable’:
    drivers/rtc/rtc-ds1374.c:442:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

    Link: https://lore.kernel.org/r/20191122102212.400158-3-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix undocumented function parameters:
    drivers/rtc/sysfs.c:112: warning: Function parameter or member 'dev' not described in 'hctosys_show'
    drivers/rtc/sysfs.c:112: warning: Function parameter or member 'attr' not described in 'hctosys_show'
    drivers/rtc/sysfs.c:112: warning: Function parameter or member 'buf' not described in 'hctosys_show'

    Link: https://lore.kernel.org/r/20191122102212.400158-2-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix kerneldoc warnings:

    drivers/rtc/interface.c:619: warning: Function parameter or member 'num' not described in 'rtc_handle_legacy_irq'
    drivers/rtc/interface.c:619: warning: Function parameter or member 'mode' not described in 'rtc_handle_legacy_irq'
    drivers/rtc/interface.c:804: warning: Function parameter or member 'rtc' not described in 'rtc_timer_enqueue'
    drivers/rtc/interface.c:804: warning: Function parameter or member 'timer' not described in 'rtc_timer_enqueue'
    drivers/rtc/interface.c:864: warning: Function parameter or member 'rtc' not described in 'rtc_timer_remove'
    drivers/rtc/interface.c:864: warning: Function parameter or member 'timer' not described in 'rtc_timer_remove'
    drivers/rtc/interface.c:900: warning: Function parameter or member 'work' not described in 'rtc_timer_do_work'
    drivers/rtc/interface.c:1035: warning: Function parameter or member 'rtc' not described in 'rtc_read_offset'
    drivers/rtc/interface.c:1035: warning: Function parameter or member 'offset' not described in 'rtc_read_offset'
    drivers/rtc/interface.c:1070: warning: Function parameter or member 'rtc' not described in 'rtc_set_offset'
    drivers/rtc/interface.c:1070: warning: Function parameter or member 'offset' not described in 'rtc_set_offset'

    Link: https://lore.kernel.org/r/20191127082932.666869-1-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

18 Nov, 2019

3 commits

  • The msm6242_set()/msm6242_clear() functions are used when writing to Control
    Register D to set or clear the HOLD bit when reading the current time from
    the RTC.

    Doing this with a read-modify-write cycle will potentially clear an
    interrupt condition which occurs between the read and the write.

    The datasheet states the following about this:

    When writing the HOLD or 30 second adjust bits of register D, it is
    necessary to write the IRQ FLAG bit to a "1".

    Since the only other bits in the register are the 30 second adjust bit
    (which is not used) and the BUSY bit (which is read-only), the
    read-modify-write cycle can be replaced by a simple write with the IRQ FLAG
    bit set to 1 and the other bits (except HOLD) set to 0.

    Tested-by: Kars de Jong
    Signed-off-by: Kars de Jong
    Link: https://lore.kernel.org/r/20191116114620.9193-1-jongk@linux-m68k.org
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Alexandre Belloni

    Kars de Jong
     
  • The driver was reading the wrong register as the 10-hour digit due to
    a misplaced ')'. It was in fact reading the 1-second digit register due
    to this bug.

    Also remove the use of a magic number for the hour mask and use the define
    for it which was already present.

    Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242")
    Tested-by: Kars de Jong
    Signed-off-by: Kars de Jong
    Link: https://lore.kernel.org/r/20191116110548.8562-1-jongk@linux-m68k.org
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Alexandre Belloni

    Kars de Jong
     
  • If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller,
    then it can't be used as system wakeup/alarm source,
    but it is still possible to read/write time from/to RTC.

    Signed-off-by: Andrey Skvortsov
    Link: https://lore.kernel.org/r/20191116203748.27166-1-andrej.skvortzov@gmail.com
    Signed-off-by: Alexandre Belloni

    Andrey Skvortsov
     

15 Nov, 2019

5 commits


08 Nov, 2019

15 commits

  • When using following operations:
    date -s "21190910 19:20:00"
    hwclock -w
    to change date from 2019 to 2119 for test, it will fail on Hygon
    Dhyana and AMD Zen CPUs, while the same operations run ok on Intel i7
    platform.

    MC146818 driver use function mc146818_set_time() to set register
    RTC_FREQ_SELECT(RTC_REG_A)'s bit4-bit6 field which means divider stage
    reset value on Intel platform to 0x7.

    While AMD/Hygon RTC_REG_A(0Ah)'s bit4 is defined as DV0 [Reference]:
    DV0 = 0 selects Bank 0, DV0 = 1 selects Bank 1. Bit5-bit6 is defined
    as reserved.

    DV0 is set to 1, it will select Bank 1, which will disable AltCentury
    register(0x32) access. As UEFI pass acpi_gbl_FADT.century 0x32
    (AltCentury), the CMOS write will be failed on code:
    CMOS_WRITE(century, acpi_gbl_FADT.century).

    Correct RTC_REG_A bank select bit(DV0) to 0 on AMD/Hygon CPUs, it will
    enable AltCentury(0x32) register writing and finally setup century as
    expected.

    Test results on Intel i7, AMD EPYC(17h) and Hygon machine show that it
    works as expected.
    Compiling for sparc64 and alpha architectures are passed.

    Reference:
    https://www.amd.com/system/files/TechDocs/51192_Bolton_FCH_RRG.pdf
    section: 3.13 Real Time Clock (RTC)

    Reported-by: kbuild test robot
    Signed-off-by: Jinke Fan
    Link: https://lore.kernel.org/r/20191105083943.115320-1-fanjinke@hygon.cn
    Signed-off-by: Alexandre Belloni

    Jinke Fan
     
  • The module alias platform tag contains a spelling mistake. Fix it.

    Fixes: f33506abbcdd ("rtc: bd70528: Add MODULE ALIAS to autoload module")
    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/r/20191106083418.159045-1-colin.king@canonical.com
    Signed-off-by: Alexandre Belloni

    Colin Ian King
     
  • The bd70528 RTC driver is probed by MFD driver. Add MODULE_ALIAS
    in order to allow udev to load the module when MFD sub-device cell
    for RTC is added.

    I'm not sure if this is a bugfix or feature addition but I guess
    fixes tag won't harm in this case.

    Fixes: 32a4a4ebf768 ("rtc: bd70528: Initial support for ROHM bd70528 RTC")
    Signed-off-by: Matti Vaittinen
    Link: https://lore.kernel.org/r/20191023114711.GA13954@localhost.localdomain
    Signed-off-by: Alexandre Belloni

    Matti Vaittinen
     
  • 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: Ilya Ledvich
    Reviewed-by: Nobuhiro Iwamatsu
    Link: https://lore.kernel.org/r/20191101095422.14787-1-ilya@compulab.co.il
    Signed-off-by: Alexandre Belloni

    Ilya Ledvich
     
  • This driver forgets to disable and unprepare clock when remove.
    Add a call to clk_disable_unprepare to fix it.

    Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer")
    Signed-off-by: Chuhong Yuan
    Acked-by: Florian Fainelli
    Link: https://lore.kernel.org/r/20191105160043.20018-1-hslester96@gmail.com
    Signed-off-by: Alexandre Belloni

    Chuhong Yuan
     
  • Let the rtc core check the date/time against the RTC range.

    Reviewed-by: Enric Balletbo i Serra
    Link: https://lore.kernel.org/r/20191016201414.30934-2-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The RTC core now has error messages in case of registration failure, there
    is no need to have other messages in the drivers.

    Reviewed-by: Enric Balletbo i Serra
    Link: https://lore.kernel.org/r/20191016201414.30934-1-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • dpm_sysfs_remove() and device_pm_remove() are already called by
    device_del() on device removal so there is no need to call
    device_init_wakeup(dev, false) from the driver and it allows to remove the
    .remove callback.

    Link: https://lore.kernel.org/r/20191021155806.3625-3-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • dpm_sysfs_remove() and device_pm_remove() are already called by
    device_del() on device removal so there is no need to call
    device_init_wakeup(dev, false) from the driver and it allows to remove the
    .remove callback.

    Link: https://lore.kernel.org/r/20191021155806.3625-4-alexandre.belloni@bootlin.com
    Reviewed-by: Baolin Wang
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • dpm_sysfs_remove() and device_pm_remove() are already called by
    device_del() on device removal so there is no need to call
    device_init_wakeup(dev, false) from the driver and it allows to remove the
    .remove callback.

    Link: https://lore.kernel.org/r/20191021155806.3625-2-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • dpm_sysfs_remove() and device_pm_remove() are already called by
    device_del() on device removal so there is no need to call
    device_init_wakeup(dev, false) from the driver and it allows to remove the
    .remove callback.

    Link: https://lore.kernel.org/r/20191021155806.3625-1-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Never enable update interrupts when the time set on the rtc is invalid.
    In that case, also avoid enabling the emulation because it will fail for
    the same reason.

    Link: https://lore.kernel.org/r/20191021155631.3342-2-alexandre.belloni@bootlin.com
    Link: https://lore.kernel.org/r/CA+ASDXMarBG5C1Kz42B9i_iVZ1=i6GgH9Yja2cdmSueKD_As_g@mail.gmail.com
    Reported-by: Jeffy Chen
    Reported-by: Brian Norris
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • When setting the time in the future with the uie timer enabled,
    rtc_timer_do_work will loop for a while because the expiration of the uie
    timer was way before the current RTC time and a new timer will be enqueued
    until the current rtc time is reached.

    If the uie timer is enabled, disable it before setting the time and enable
    it after expiring current timers (which may actually be an alarm).

    This is the safest thing to do to ensure the uie timer is still
    synchronized with the RTC, especially in the UIE emulation case.

    Reported-by: syzbot+08116743f8ad6f9a6de7@syzkaller.appspotmail.com
    Fixes: 6610e0893b8b ("RTC: Rework RTC code to use timerqueue for events")
    Link: https://lore.kernel.org/r/20191020231320.8191-1-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Directly call ktime_get_real_seconds instead of converting the result to a
    struct rtc_time and then back to a time64_t.

    Link: https://lore.kernel.org/r/20191016201223.30568-4-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue.

    Link: https://lore.kernel.org/r/20191016201223.30568-3-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni