• Jonathan Hunter's avatar
    mfd: tps6586x: Handle interrupts on suspend · ac4ca4b9
    Jonathan Hunter authored
    The tps6586x driver creates an irqchip that is used by its various child
    devices for managing interrupts. The tps6586x-rtc device is one of its
    children that uses the tps6586x irqchip. When using the tps6586x-rtc as
    a wake-up device from suspend, the following is seen:
    
     PM: Syncing filesystems ... done.
     Freezing user space processes ... (elapsed 0.001 seconds) done.
     OOM killer disabled.
     Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done.
     Disabling non-boot CPUs ...
     Entering suspend state LP1
     Enabling non-boot CPUs ...
     CPU1 is up
     tps6586x 3-0034: failed to read interrupt status
     tps6586x 3-0034: failed to read interrupt status
    
    The reason why the tps6586x interrupt status cannot be read is because
    the tps6586x interrupt is not masked during suspend and when the
    tps6586x-rtc interrupt occurs, to wake-up the device, the interrupt is
    seen before the i2c controller has been resumed in order to read the
    tps6586x interrupt status.
    
    The tps6586x-rtc driver sets it's interrupt as a wake-up source during
    suspend, which gets propagated to the parent tps6586x interrupt.
    However, the tps6586x-rtc driver cannot disable it's interrupt during
    suspend otherwise we would never be woken up and so the tps6586x must
    disable it's interrupt instead.
    
    Prevent the tps6586x interrupt handler from executing on exiting suspend
    before the i2c controller has been resumed by disabling the tps6586x
    interrupt on entering suspend and re-enabling it on resuming from
    suspend.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
    Reviewed-by: default avatarDmitry Osipenko <digetx@gmail.com>
    Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
    Acked-by: default avatarThierry Reding <treding@nvidia.com>
    Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
    ac4ca4b9
tps6586x.c 15.9 KB