08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

26 Feb, 2020

1 commit

  • The imx SC api strongly assumes that messages are composed out of
    4-bytes words but some of our message structs have sizeof "6" and "7".

    This produces many oopses with CONFIG_KASAN=y:

    BUG: KASAN: stack-out-of-bounds in imx_mu_send_data+0x108/0x1f0

    It shouldn't cause an issues in normal use because these structs are
    always allocated on the stack.

    Also upstream: https://patchwork.kernel.org/patch/11376909/

    Reported-by: Iuliana Prodan
    Signed-off-by: Leonard Crestez
    Reviewed-by: Jason Liu
    Reviewed-by: Aisheng Dong
    Signed-off-by: Dong Aisheng
    (cherry picked from commit 8ca6d9eb2725152404a5764fc8916f77ee82aa29)

    Leonard Crestez
     

24 Feb, 2020

2 commits

  • [ Upstream commit 578c2b661e2b1b474ea3571a3c3c6d57bae89e8d ]

    Some i2c RTC drivers are using regmap but are not selecting REGMAP_I2C
    which may lead to build failures.

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

    Alexandre Belloni
     
  • [ Upstream commit 34719de919af07682861cb0fa2bcf64da33ecf44 ]

    Merely enabling I2C and RTC selects REGMAP_I2C and REGMAP_SPI, even when
    no driver needs it. While the former can be moduler, the latter cannot,
    and thus becomes built-in.

    Fix this by moving the select statements for REGMAP_I2C and REGMAP_SPI
    from the RTC_I2C_AND_SPI helper to the individual drivers that depend on
    it.

    Note that the comment for RTC_I2C_AND_SPI refers to SND_SOC_I2C_AND_SPI
    for more information, but the latter does not select REGMAP_{I2C,SPI}
    itself, and defers that to the individual drivers, too.

    Fixes: 080481f54ef62121 ("rtc: merge ds3232 and ds3234")
    Signed-off-by: Geert Uytterhoeven
    Reported-by: kbuild test robot
    Reported-by: kbuild test robot
    Link: https://lore.kernel.org/r/20200112171349.22268-1-geert@linux-m68k.org
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     

15 Feb, 2020

2 commits

  • commit b6da197a2e9670df6f07e6698629e9ce95ab614e upstream.

    As reported by Guilherme G. Piccoli:

    ---8300 calls to hpet_rtc_interrupt() when "irqpoll" was set, whereas without
    sharing interrupts this number reduced to 1 interrupt. Machines with more
    hardware than a VM should generate even more unnecessary HPET interrupts
    in this scenario.

    ---8
    Cc: Hans de Goede
    Signed-off-by: Andy Shevchenko
    Tested-by: Guilherme G. Piccoli
    Reviewed-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200123131437.28157-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • commit f236a2a2ebabad0848ad0995af7ad1dc7029e895 upstream.

    The current code returns -EPERM when the voltage loss bit is set.
    Since the bit indicates that the time value is not valid, return
    -EINVAL instead, which is the appropriate error code for this
    situation.

    Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
    Signed-off-by: Paul Kocialkowski
    Link: https://lore.kernel.org/r/20191212153111.966923-1-paul.kocialkowski@bootlin.com
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Paul Kocialkowski
     

26 Jan, 2020

1 commit

  • [ Upstream commit afe19a7ae8b6b6032d04d3895ebd5bbac7fe9f30 ]

    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
    Signed-off-by: Sasha Levin

    Colin Ian King
     

18 Jan, 2020

4 commits

  • commit c3e12e66b14a043daac6b3d0559df80b9ed7679c upstream.

    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
    Signed-off-by: Greg Kroah-Hartman

    Matti Vaittinen
     
  • commit 94303f8930ed78aea0f189b703c9d79fff9555d7 upstream.

    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
    Signed-off-by: Greg Kroah-Hartman

    Chuhong Yuan
     
  • commit e34494c8df0cd96fc432efae121db3212c46ae48 upstream.

    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
    Signed-off-by: Greg Kroah-Hartman

    Kars de Jong
     
  • commit 653997eeecef95c3ead4fba1b2d27e6a5854d6cd upstream.

    Alarm registers high byte was reserved for other functions.
    This add mask in alarm registers operation functions.
    This also fix error condition in interrupt handler.

    Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver")

    Signed-off-by: Ran Bi
    Signed-off-by: Hsin-Hsiung Wang
    Link: https://lore.kernel.org/r/1576057435-3561-6-git-send-email-hsin-hsiung.wang@mediatek.com
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Ran Bi
     

15 Jan, 2020

1 commit

  • commit 111bf02b8f544f98de53ea1f912ae01f598b161b upstream.

    When support for the R40 in the rtc-sun6i driver was split out for a
    separate compatible string, only the RTC half was covered, and not the
    clock half. Unfortunately this results in the whole driver not working,
    as the RTC half expects the clock half to have been initialized.

    Add support for the clock part as well. The clock part is like the H3,
    but does not need to export the internal oscillator, nor does it have
    a gateable LOSC external output.

    This fixes issues with WiFi and Bluetooth not working on the BPI M2U.

    Fixes: d6624cc75021 ("rtc: sun6i: Add R40 compatible")
    Cc: # 5.3.x
    Signed-off-by: Chen-Yu Tsai
    Acked-by: Maxime Ripard
    Link: https://lore.kernel.org/r/20191205085054.6049-1-wens@kernel.org
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Chen-Yu Tsai
     

18 Dec, 2019

1 commit

  • commit 7e7c005b4b1f1f169bcc4b2c3a40085ecc663df2 upstream.

    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
    Signed-off-by: Greg Kroah-Hartman

    Alexandre Belloni
     

25 Nov, 2019

2 commits


23 Sep, 2019

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "Two new drivers and the new pcf2127 feature make the bulk of the
    additions. The rest are the usual fixes and new features.

    Subsystem:
    - add debug message when registration fails

    New drivers:
    - Amlogic Virtual Wake
    - Freescale FlexTimer Module alarm

    Drivers:
    - remove superfluous error messages
    - convert to i2c_new_dummy_device and devm_i2c_new_dummy_device
    - Remove dev_err() usage after platform_get_irq()
    - Set RTC range for: pcf2123, pcf8563, snvs.
    - pcf2127: tamper detection and watchdog support
    - pcf85363: fix regmap issue
    - sun6i: H6 support
    - remove w90x900/nuc900 driver"

    * tag 'rtc-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits)
    rtc: meson: mark PM functions as __maybe_unused
    rtc: sc27xx: Remove clearing SPRD_RTC_POWEROFF_ALM_FLAG flag
    dt-bindings: rtc: ds1307: add rx8130 compatible
    rtc: sun6i: Allow using as wakeup source from suspend
    rtc: pcf8563: let the core handle range offsetting
    rtc: pcf8563: remove useless indirection
    rtc: pcf8563: convert to devm_rtc_allocate_device
    rtc: pcf8563: add Microcrystal RV8564 compatible
    rtc: pcf8563: add Epson RTC8564 compatible
    rtc: s35390a: convert to devm_i2c_new_dummy_device()
    rtc: max77686: convert to devm_i2c_new_dummy_device()
    rtc: pcf85363/pcf85263: fix regmap error in set_time
    rtc: snvs: switch to rtc_time64_to_tm/rtc_tm_to_time64
    rtc: snvs: set range
    rtc: snvs: fix possible race condition
    rtc: pcf2127: bugfix: watchdog build dependency
    rtc: pcf2127: add tamper detection support
    rtc: pcf2127: add watchdog feature support
    rtc: pcf2127: bugfix: read rtc disables watchdog
    rtc: pcf2127: cleanup register and bit defines
    ...

    Linus Torvalds
     

21 Sep, 2019

1 commit

  • Pull clk updates from Stephen Boyd:
    "We have a small collection of core framework updates this time, mostly
    around clk registration by clk providers and debugfs "nice to haves"
    for rate constraints. I'll highlight that we're now setting the
    clk_init_data pointer inside struct clk_hw to NULL during
    clk_register(), which may break some drivers that thought they could
    use that pointer during normal operations. That change has been
    sitting in next for a while now but maybe something is still broken.
    We'l see. Other than that the core framework changes aren't invasive
    and they're fixing bugs, simplifying, and making things better.

    On the clk driver side we got the usual addition of new SoC support,
    new features for existing drivers, and bug fixes scattered throughout.
    The biggest diffstat is the Amlogic driver that gained CPU clk support
    in addition to migrating to the new way of specifying clk parents.
    After that the Qualcomm, i.MX, Mediatek, and Rockchip clk drivers got
    support for various new SoCs and clock controllers from those vendors.

    Core:
    - Drop NULL checks in clk debugfs
    - Add min/max rates to clk debugfs
    - Set clk_init_data pointer inside clk_hw to NULL after registration
    - Make clk_bulk_get_all() return an 'id' corresponding to clock-names
    - Evict parents from parent cache when they're unregistered

    New Drivers:
    - Add clock driver for i.MX8MN SoCs
    - Support aspeed AST2600 SoCs
    - Support for Mediatek MT6779 SoCs
    - Support qcom SM8150 GCC and RPMh clks
    - Support qcom QCS404 WCSS clks
    - Add CPU clock support for Armada 7K/8K (specifically AP806 and AP807)
    - Addition of clock driver for Rockchip rk3308 SoCs

    Updates:
    - Add regulator support to the cdce925 clk driver
    - Add support for Raspberry Pi 4 bcm2711 SoCs
    - Add SDIO gate support to aspeed driver
    - Add missing of_node_put() calls in various clk drivers
    - Migrate Amlogic driver to new clock parent description method
    - Add DVFS support to Amlogic Meson g12
    - Add Amlogic Meson g12a reset support to the axg audio clock controller
    - Add sm1 support to the Amlogic Meson g12a clock controller
    - Switch i.MX8MM clock driver to platform driver
    - Add Hifi4 DSP related clocks for i.MX8QXP SoC
    - Fix Audio PLL setting and parent clock for USB
    - Misc i.MX8 clock driver improvements and corrections
    - Set floor ops for Qualcomm SD clks so that rounding works
    - Fix "always-on" Clock Domains on Renesas R-Car M1A, RZ/A1, RZ/A2, and RZ/N1
    - Enable the Allwinner V3 SoC and fix the i2s clock for H6"

    * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (137 commits)
    clk: Drop !clk checks in debugfs dumping
    clk: imx: imx8mn: fix pll mux bit
    clk: imx: imx8mm: fix pll mux bit
    clk: imx: clk-pll14xx: unbypass PLL by default
    clk: imx: pll14xx: avoid glitch when set rate
    clk: mvebu: ap80x: add AP807 clock support
    clk: mvebu: ap806: Prepare the introduction of AP807 clock support
    clk: mvebu: ap806: add AP-DCLK (hclk) to system controller driver
    clk: mvebu: ap806: be more explicit on what SaR is
    clk: mvebu: ap80x-cpu: add AP807 CPU clock support
    clk: mvebu: ap806-cpu: prepare mapping of AP807 CPU clock
    dt-bindings: ap806: Document AP807 clock compatible
    dt-bindings: ap80x: Document AP807 CPU clock compatible
    clk: sprd: add missing kfree
    clk: at91: allow 24 Mhz clock as input for PLL
    clk: Make clk_bulk_get_all() return a valid "id"
    clk: actions: Fix factor clk struct member access
    clk: qcom: rcg: Return failure for RCG update
    clk: remove extra ---help--- tags in Kconfig
    clk: add include guard to clk-conf.h
    ...

    Linus Torvalds
     

20 Sep, 2019

1 commit

  • …ernel/git/chrome-platform/linux

    Pull chrome platform updates from Benson Leung:
    "CrOS EC / MFD Migration:
    - Move cros_ec core driver from mfd into chrome platform.

    Wilco EC:
    - Add batt_ppid_info command to Wilco telemetry driver.

    CrOS EC:
    - cros_ec_rpmsg : Add support to inform EC of suspend/resume status
    - cros_ec_rpmsg : Fix race condition on probe failed
    - cros_ec_chardev : Add a poll handler to receive MKBP events

    Misc:
    - bugfixes in cros_usbpd_logger and cros_ec_ishtp"

    * tag 'tag-chrome-platform-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
    platform/chrome: cros_usbpd_logger: null check create_singlethread_workqueue
    platform/chrome: cros_ec_chardev: Add a poll handler to receive MKBP events
    platform/chrome: cros_ec_rpmsg: Fix race with host command when probe failed
    platform/chrome: chromeos_tbmc: Report wake events
    mfd: cros_ec: Use mfd_add_hotplug_devices() helper
    mfd: cros_ec: Add convenience struct to define autodetectable CrOS EC subdevices
    mfd: cros_ec: Add convenience struct to define dedicated CrOS EC MCUs
    mfd: cros_ec: Use kzalloc and cros_ec_cmd_xfer_status helper
    mfd / platform: cros_ec: Reorganize platform and mfd includes
    mfd / platform: cros_ec: Rename config to a better name
    mfd: cros_ec: Switch to use the new cros-ec-chardev driver
    mfd / platform: cros_ec: Miscellaneous character device to talk with the EC
    mfd / platform: cros_ec: Move cros-ec core driver out from MFD
    mfd / platform: cros_ec: Handle chained ECs as platform devices
    platform/chrome: cros_ec_rpmsg: Add host command AP sleep state support
    platform/chrome: chromeos_laptop: drop checks of NULL-safe functions
    platform/chrome: wilco_ec: Add batt_ppid_info command to telemetry driver

    Linus Torvalds
     

18 Sep, 2019

1 commit

  • …anaszewski/linux-leds

    Pull LED updates from Jacek Anaszewski:
    "In this cycle we've finally managed to contribute the patch set
    sorting out LED naming issues. Besides that there are many changes
    scattered among various LED class drivers and triggers.

    LED naming related improvements:

    - add new 'function' and 'color' fwnode properties and deprecate
    'label' property which has been frequently abused for conveying
    vendor specific names that have been available in sysfs anyway

    - introduce a set of standard LED_FUNCTION* definitions

    - introduce a set of standard LED_COLOR_ID* definitions

    - add a new {devm_}led_classdev_register_ext() API with the
    capability of automatic LED name composition basing on the
    properties available in the passed fwnode; the function is
    backwards compatible in a sense that it uses 'label' data, if
    present in the fwnode, for creating LED name

    - add tools/leds/get_led_device_info.sh script for retrieving LED
    vendor, product and bus names, if applicable; it also performs
    basic validation of an LED name

    - update following drivers and their DT bindings to use the new LED
    registration API:

    - leds-an30259a, leds-gpio, leds-as3645a, leds-aat1290, leds-cr0014114,
    leds-lm3601x, leds-lm3692x, leds-lp8860, leds-lt3593, leds-sc27xx-blt

    Other LED class improvements:

    - replace {devm_}led_classdev_register() macros with inlines

    - allow to call led_classdev_unregister() unconditionally

    - switch to use fwnode instead of be stuck with OF one

    LED triggers improvements:

    - led-triggers:
    - fix dereferencing of null pointer
    - fix a memory leak bug

    - ledtrig-gpio:
    - GPIO 0 is valid

    Drop superseeded apu2/3 support from leds-apu since for apu2+ a newer,
    more complete driver exists, based on a generic driver for the AMD
    SOCs gpio-controller, supporting LEDs as well other devices:

    - drop profile field from priv data

    - drop iosize field from priv data

    - drop enum_apu_led_platform_types

    - drop superseeded apu2/3 led support

    - add pr_fmt prefix for better log output

    - fix error message on probing failure

    Other misc fixes and improvements to existing LED class drivers:

    - leds-ns2, leds-max77650:
    - add of_node_put() before return

    - leds-pwm, leds-is31fl32xx:
    - use struct_size() helper

    - leds-lm3697, leds-lm36274, leds-lm3532:
    - switch to use fwnode_property_count_uXX()

    - leds-lm3532:
    - fix brightness control for i2c mode
    - change the define for the fs current register
    - fixes for the driver for stability
    - add full scale current configuration
    - dt: Add property for full scale current.
    - avoid potentially unpaired regulator calls
    - move static keyword to the front of declarations
    - fix optional led-max-microamp prop error handling

    - leds-max77650:
    - add of_node_put() before return
    - add MODULE_ALIAS()
    - Switch to fwnode property API

    - leds-as3645a:
    - fix misuse of strlcpy

    - leds-netxbig:
    - add of_node_put() in netxbig_leds_get_of_pdata()
    - remove legacy board-file support

    - leds-is31fl319x:
    - simplify getting the adapter of a client

    - leds-ti-lmu-common:
    - fix coccinelle issue
    - move static keyword to the front of declaration

    - leds-syscon:
    - use resource managed variant of device register

    - leds-ktd2692:
    - fix a typo in the name of a constant

    - leds-lp5562:
    - allow firmware files up to the maximum length

    - leds-an30259a:
    - fix typo

    - leds-pca953x:
    - include the right header"

    * tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: (72 commits)
    leds: lm3532: Fix optional led-max-microamp prop error handling
    led: triggers: Fix dereferencing of null pointer
    leds: ti-lmu-common: Move static keyword to the front of declaration
    leds: lm3532: Move static keyword to the front of declarations
    leds: trigger: gpio: GPIO 0 is valid
    leds: pwm: Use struct_size() helper
    leds: is31fl32xx: Use struct_size() helper
    leds: ti-lmu-common: Fix coccinelle issue in TI LMU
    leds: lm3532: Avoid potentially unpaired regulator calls
    leds: syscon: Use resource managed variant of device register
    leds: Replace {devm_}led_classdev_register() macros with inlines
    leds: Allow to call led_classdev_unregister() unconditionally
    leds: lm3532: Add full scale current configuration
    dt: lm3532: Add property for full scale current.
    leds: lm3532: Fixes for the driver for stability
    leds: lm3532: Change the define for the fs current register
    leds: lm3532: Fix brightness control for i2c mode
    leds: Switch to use fwnode instead of be stuck with OF one
    leds: max77650: Switch to fwnode property API
    led: triggers: Fix a memory leak bug
    ...

    Linus Torvalds
     

10 Sep, 2019

2 commits

  • The meson_vrtc_set_wakeup_time() function is only used by
    the PM functions and causes a warning when they are disabled:

    drivers/rtc/rtc-meson-vrtc.c:32:13: error: unused function 'meson_vrtc_set_wakeup_time' [-Werror,-Wunused-function]

    Remove the #ifdef around the callers and add a __maybe_unused
    annotation as a more reliable way to avoid these warnings.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Kevin Hilman
    Link: https://lore.kernel.org/r/20190906152438.1533833-1-arnd@arndb.de
    Signed-off-by: Alexandre Belloni

    Arnd Bergmann
     
  • The SPRD_RTC_POWEROFF_ALM_FLAG flag is used to indicate if a poweroff alarm
    is set, which can power on the system when system in power-off status.

    And the bootloader will validate this flag to check if the booting mode is
    alarm booting mode, thus we should not clear this flag in kernel, instead
    bootloader will clear this flag after checking the booting mode.

    Signed-off-by: Baolin Wang
    Link: https://lore.kernel.org/r/1f75310242de75b14d8973538bf96efffb395daf.1567666894.git.baolin.wang@linaro.org
    Signed-off-by: Alexandre Belloni

    Baolin Wang
     

02 Sep, 2019

2 commits

  • There is a bit of mess between cros-ec mfd includes and platform
    includes. For example, we have a linux/mfd/cros_ec.h include that
    exports the interface implemented in platform/chrome/cros_ec_proto.c. Or
    we have a linux/mfd/cros_ec_commands.h file that is non related to the
    multifunction device (in the sense that is not exporting any function of
    the mfd device). This causes crossed includes between mfd and
    platform/chrome subsystems and makes the code difficult to read, apart
    from creating 'curious' situations where a platform/chrome driver includes
    a linux/mfd/cros_ec.h file just to get the exported functions that are
    implemented in another platform/chrome driver.

    In order to have a better separation on what the cros-ec multifunction
    driver does and what the cros-ec core provides move and rework the
    affected includes doing:

    - Move cros_ec_commands.h to include/linux/platform_data/cros_ec_commands.h
    - Get rid of the parts that are implemented in the platform/chrome/cros_ec_proto.c
    driver from include/linux/mfd/cros_ec.h to a new file
    include/linux/platform_data/cros_ec_proto.h
    - Update all the drivers with the new includes, so
    - Drivers that only need to know about the protocol include
    - linux/platform_data/cros_ec_proto.h
    - linux/platform_data/cros_ec_commands.h
    - Drivers that need to know about the cros-ec mfd device also include
    - linux/mfd/cros_ec.h

    Signed-off-by: Enric Balletbo i Serra
    Acked-by: Andy Shevchenko
    Acked-by: Mark Brown
    Acked-by: Wolfram Sang
    Acked-by: Neil Armstrong
    Acked-by: Alexandre Belloni
    Acked-by: Jonathan Cameron
    Acked-by: Benjamin Tissoires
    Acked-by: Dmitry Torokhov
    Acked-by: Sebastian Reichel
    Acked-by: Chanwoo Choi
    Reviewed-by: Gwendal Grignou
    Tested-by: Gwendal Grignou
    Series changes: 3
    - Fix dereferencing pointer to incomplete type 'struct cros_ec_dev' (lkp)
    Signed-off-by: Lee Jones

    Enric Balletbo i Serra
     
  • Now, the ChromeOS EC core driver has nothing related to an MFD device, so
    move that driver from the MFD subsystem to the platform/chrome subsystem.

    Signed-off-by: Enric Balletbo i Serra
    Acked-by: Andy Shevchenko
    Acked-by: Thierry Reding
    Acked-by: Mark Brown
    Acked-by: Wolfram Sang
    Acked-by: Neil Armstrong
    Acked-by: Alexandre Belloni
    Acked-by: Jonathan Cameron
    Acked-by: Benjamin Tissoires
    Acked-by: Dmitry Torokhov
    Acked-by: Sebastian Reichel
    Acked-by: Chanwoo Choi
    Reviewed-by: Gwendal Grignou
    Tested-by: Gwendal Grignou
    Signed-off-by: Lee Jones

    Enric Balletbo i Serra
     

01 Sep, 2019

11 commits

  • This patch allows userspace to set up wakeup alarms on any RTC handled by the
    sun6i driver, and adds the necessary PM operations to allow resuming from
    suspend when the configured wakeup alarm fires a IRQ. Of course, that the
    device actually resumes depends on the suspend state and how a particular
    hardware reacts to it, but that is out of scope for this patch.

    I've tested these changes on a Pine H64 model B, which contains a
    Allwinner H6 SoC, with the help of CONFIG_PM_TEST_SUSPEND kernel option.
    These are the interesting outputs from the kernel and commands which
    show that it works. As every RTC handled by this driver is largely the
    same, I think that it shouldn't introduce any regression on other SoCs,
    but I may be wrong.

    [ 1.092705] PM: test RTC wakeup from 'freeze' suspend
    [ 1.098230] PM: suspend entry (s2idle)
    [ 1.212907] PM: suspend devices took 0.080 seconds
    (The SoC freezes for some seconds)
    [ 3.197604] PM: resume devices took 0.104 seconds
    [ 3.215937] PM: suspend exit

    [ 1.092812] PM: test RTC wakeup from 'mem' suspend
    [ 1.098089] PM: suspend entry (deep)
    [ 1.102033] PM: suspend exit
    [ 1.105205] PM: suspend test failed, error -22

    In any case, the RTC alarm interrupt gets fired as exptected:

    $ echo +5 > /sys/class/rtc/rtc0/wakealarm && sleep 5 && grep rtc /proc/interrupts
    29: 1 0 0 0 GICv2 133 Level 7000000.rtc

    Signed-off-by: Alejandro González
    Acked-by: Chen-Yu Tsai
    Link: https://lore.kernel.org/r/20190821210056.11995-1-alejandro.gonzalez.correo@gmail.com
    Signed-off-by: Alexandre Belloni

    Alejandro González
     
  • Set the RTC range properly and use the core windowing and offsetting to
    (unfortunately) map back to a 1970-2069 range.

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

    Alexandre Belloni
     
  • pcf8563_rtc_read_time and pcf8563_set_datetime are only used after casting
    dev to an i2c_client. Remove that useless indirection.

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

    Alexandre Belloni
     
  • This allows further improvement of the driver.

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

    Alexandre Belloni
     
  • Add a compatible string for the Microcrystal RV8564.

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

    Alexandre Belloni
     
  • Add a compatible string for the Epson RTC8564.

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

    Alexandre Belloni
     
  • I was about to simplify the call to i2c_unregister_device() when I
    realized that converting to devm_i2c_new_dummy_device() will simplify
    the driver a lot. So I took this approach.

    Signed-off-by: Wolfram Sang
    Link: https://lore.kernel.org/r/20190830133124.21633-3-wsa+renesas@sang-engineering.com
    Signed-off-by: Alexandre Belloni

    Wolfram Sang
     
  • I was about to simplify the call to i2c_unregister_device() when I
    realized that converting to devm_i2c_new_dummy_device() will simplify
    the driver a lot. So I took this approach.

    Signed-off-by: Wolfram Sang
    Link: https://lore.kernel.org/r/20190830133124.21633-2-wsa+renesas@sang-engineering.com
    Signed-off-by: Alexandre Belloni

    Wolfram Sang
     
  • Issue:
    - # hwclock -w
    hwclock: RTC_SET_TIME: Invalid argument

    Why:
    - Relative commit: 8b9f9d4dc511 ("regmap: verify if register is
    writeable before writing operations"), this patch
    will always check for unwritable registers, it will compare reg
    with max_register in regmap_writeable.

    - The pcf85363/pcf85263 has the capability of address wrapping
    which means if you access an address outside the allowed range
    (0x00-0x2f) hardware actually wraps the access to a lower address.
    The rtc-pcf85363 driver will use this feature to configure the time
    and execute 2 actions in the same i2c write operation (stopping the
    clock and configure the time). However the driver has also
    configured the `regmap maxregister` protection mechanism that will
    block accessing addresses outside valid range (0x00-0x2f).

    How:
    - Split of writing regs to two parts, first part writes control
    registers about stop_enable and resets, second part writes
    RTC time and date registers.

    Signed-off-by: Biwen Li
    Link: https://lore.kernel.org/r/20190829021418.4607-1-biwen.li@nxp.com
    Signed-off-by: Alexandre Belloni

    Biwen Li
     
  • Call the 64bit versions of rtc_tm time conversion now that the range is
    enforced by the core.

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

    Alexandre Belloni
     
  • The SNVS is a 47-bit counter incremented at 32768Hz, it is then a 32-bit
    second counter.

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

    Alexandre Belloni
     

29 Aug, 2019

1 commit

  • The RTC IRQ is requested before the struct rtc_device is allocated,
    this may lead to a NULL pointer dereference in IRQ handler.

    To fix this issue, allocating the rtc_device struct before requesting
    the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
    to register the RTC device.

    Signed-off-by: Anson Huang
    Reviewed-by: Dong Aisheng
    Link: https://lore.kernel.org/r/20190716071858.36750-1-Anson.Huang@nxp.com
    Signed-off-by: Alexandre Belloni

    Anson Huang
     

28 Aug, 2019

3 commits

  • Disable watchdog registation when kernel is build without
    watchdog functionality, and enable watchdog core otherwise.
    This removes compile errors like the one below:

    drivers/rtc/rtc-pcf2127.o: in function `pcf2127_probe.constprop.3':
    rtc-pcf2127.c:(.text.unlikely+0x2c8): undefined reference to
    `devm_watchdog_register_device'

    Watchdog feature in chip will always be configured as
    this is safe to do in both cases and minimize code churn.

    Reported-by: Hulk Robot
    Reported-by: YueHaibing
    Fixes: bbc597561ce1 ("rtc: pcf2127: add watchdog feature support")
    Signed-off-by: Bruno Thomsen
    Link: https://lore.kernel.org/r/20190827143656.4734-1-bruno.thomsen@gmail.com
    Signed-off-by: Alexandre Belloni

    Bruno Thomsen
     
  • Add support for integrated tamper detection function in both PCF2127 and
    PCF2129 chips. This patch implements the feature by adding an additional
    timestamp0 file to sysfs device path. This file contains seconds since
    epoch, if an event occurred, or is empty, if none occurred.
    Interface should match ISL1208 and RV3028 RTC drivers.

    Signed-off-by: Bruno Thomsen
    Link: https://lore.kernel.org/r/20190822131936.18772-5-bruno.thomsen@gmail.com
    Signed-off-by: Alexandre Belloni

    Bruno Thomsen
     
  • Add partial support for the watchdog functionality of
    both PCF2127 and PCF2129 chips.

    The programmable watchdog timer is currently using a fixed
    clock source of 1Hz. This result in a selectable range of
    1-255 seconds, which covers most embedded Linux use-cases.

    Clock sources of 4096Hz, 64Hz and 1/60Hz is mostly useful
    in MCU use-cases.

    Countdown timer not available when using watchdog feature.

    Signed-off-by: Bruno Thomsen
    Acked-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190822131936.18772-4-bruno.thomsen@gmail.com
    Signed-off-by: Alexandre Belloni

    Bruno Thomsen
     

23 Aug, 2019

2 commits

  • The previous fix listed bulk read of registers as root cause of
    accendential disabling of watchdog, since the watchdog counter
    register (WD_VAL) was zeroed.

    Fixes: 3769a375ab83 rtc: pcf2127: bulk read only date and time registers.

    Tested with the same PCF2127 chip as Sean reveled root cause
    of WD_VAL register value zeroing was caused by reading CTRL2
    register which is one of the watchdog feature control registers.

    So the solution is to not read the first two control registers
    (CTRL1 and CTRL2) in pcf2127_rtc_read_time as they are not
    needed anyway. Size of local buf variable is kept to allow
    easy usage of register defines to improve readability of code.

    Debug trace line was updated after CTRL1 and CTRL2 are no longer
    read from the chip. Also replaced magic numbers in buf access
    with register defines.

    Signed-off-by: Bruno Thomsen
    Link: https://lore.kernel.org/r/20190822131936.18772-3-bruno.thomsen@gmail.com
    Signed-off-by: Alexandre Belloni

    Bruno Thomsen
     
  • Cleanup of defines to follow kernel coding style and increase code
    readability by using same register and bit define style.

    Change PCF2127_REG_RAM_{addr_MSB,wrt_cmd,rd_cmd} to upper case as
    kernel coding guide section 12 'Macros, Enums and RTL' states
    "Names of macros defining constants and labels in enums are capitalized".

    Improve readability of RAM register comment by making whole sentences.

    Remove parentheses from register defines as they are only used
    for expressions and not constants.

    As there are no clear style for name of registers and bits in the
    kernel drivers, I suggest the following for at least this driver,
    but hopefully also other RTC drivers.

    Register name should follow this convention:
    [chip]_REG_[reg name] 0xXX

    Bit name should follow this convention, so it clearly states which
    chip register it's part of:
    [chip]_BIT_[reg name]_[bit name] BIT(X)

    Additionally I suggest bit defines are always placed right below
    its corresponding register define and using an extra tab indentation
    for the BIT(X) part. This will visually make it easy to see that bit
    defines are part of the complete register definition.

    Rename PCF2127_OSF to PCF2127_BIT_SC_OSF and move it right below
    PCF2127_REG_SC. This will improve readability of bit checks as it's
    easy to verify that it uses the correct register.

    Move end of line comments above register defines as it's more like
    a heading for 1 register define and up to 8 bit defines or a
    collection of registers that are close related like timestamp
    split across 6 registers.

    Signed-off-by: Bruno Thomsen
    Link: https://lore.kernel.org/r/20190822131936.18772-2-bruno.thomsen@gmail.com
    Signed-off-by: Alexandre Belloni

    Bruno Thomsen