02 Sep, 2019

1 commit

  • 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
     

20 Mar, 2019

1 commit

  • If we encounter a failure during suspend where this RTC was programmed
    to wakeup the system from suspend, but that wakeup couldn't be
    configured because the system didn't support wakeup interrupts, we'll
    run into the following warning:

    Unbalanced IRQ 166 wake disable
    WARNING: CPU: 7 PID: 3071 at kernel/irq/manage.c:669 irq_set_irq_wake+0x108/0x278

    This happens because the suspend process isn't aborted when the RTC
    fails to configure the wakeup IRQ. Instead, we continue suspending the
    system and then another suspend callback fails the suspend process and
    "unwinds" the previously suspended drivers by calling their resume
    callbacks. When we get back to resuming this RTC driver, we'll call
    disable_irq_wake() on an IRQ that hasn't been configured for wake.

    Let's just fail suspend/resume here if we can't configure the system to
    wake and the user has chosen to wakeup with this device. This fixes this
    warning and makes the code more robust in case there are systems out
    there that can't wakeup from suspend on this line but the user has
    chosen to do so.

    Cc: Enric Balletbo i Serra
    Cc: Evan Green
    Cc: Benson Leung
    Cc: Guenter Roeck
    Signed-off-by: Stephen Boyd
    Acked-By: Benson Leung
    Signed-off-by: Alexandre Belloni

    Stephen Boyd
     

08 Jun, 2018

2 commits


17 Mar, 2018

1 commit

  • Since accessing a Chrome OS EC based rtc is a slow operation, there is a
    race window where if the alarm is set for the next second and the second
    ticks over right before calculating the alarm offset.

    In this case the current driver is setting a 0-second alarm, which would
    be considered as disabling alarms by the EC(EC_RTC_ALARM_CLEAR).

    This breaks, e.g., hwclock which relies on RTC_UIE_ON ->
    rtc_update_irq_enable(), which sets a 1-second alarm and expects it to
    fire an interrupt.

    So return -ETIME when the alarm is in the past, follow __rtc_set_alarm().

    Signed-off-by: Jeffy Chen
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Signed-off-by: Alexandre Belloni

    Jeffy Chen
     

19 Dec, 2017

1 commit

  • On platforms with a Chrome OS EC, the EC can function as a simple RTC.
    Add a basic driver with this functionality.

    Signed-off-by: Stephen Barber
    Signed-off-by: Enric Balletbo i Serra
    Acked-by: Alexandre Belloni
    Acked-by: Benson Leung
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Signed-off-by: Alexandre Belloni

    Stephen Barber