• Geert Uytterhoeven's avatar
    i2c: rcar: Fix clients using i2c from suspend callback · 81d696c7
    Geert Uytterhoeven authored
    When doing s2idle/s2ram on Salvator-X(S):
    
        WARNING: CPU: 2 PID: 971 at drivers/i2c/i2c-core-base.c:1869 __i2c_transfer+0x608/0x910
    [...]
        Call trace:
         __i2c_transfer+0x608/0x910
         i2c_smbus_xfer_emulated+0x158/0x5b0
         __i2c_smbus_xfer+0x17c/0x818
         i2c_smbus_xfer+0x64/0x98
         i2c_smbus_read_byte_data+0x40/0x70
         cs2000_bset.isra.1+0x2c/0x68
         __cs2000_set_rate.constprop.7+0x80/0x148
         cs2000_resume+0x18/0x20
         dpm_run_callback+0x74/0x330
         device_resume_early+0xd4/0x120
         dpm_resume_early+0x158/0x4f8
         suspend_devices_and_enter+0x36c/0xd98
    [...]
    
    On second resume, the sound driver fails with:
    
        cs2000-cp 2-004f: pll lock failed
        rcar_sound ec500000.sound: can't use clk 1
    
    As the CS2000 clock driver needs to send I2C messages during suspend,
    the I2C controller driver should be suspended later, and resumed
    earlier.  Fix this by using the noirq sleep ops instead of the normal
    sleep ops, which are called after the late sleep ops, as used by the
    CS2000 clock driver.
    
    Fixes: 18569fa8 ("i2c: rcar: add suspend/resume support")
    Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
    81d696c7
i2c-rcar.c 26.5 KB