Skip to content

xiaomi-vince: power management issues (supend transitions, i2c/smbus, synaptic rmi4) #167

@spongy-deluxe

Description

@spongy-deluxe

Hi,

currently I am experiencing issues with postmarket OS on my Xiaomi Redmi 5 Plus. I am using a dual-boot configuration with lk2nd flashed to recovery and postmarket OS flashed on an external SD card.

The issues are most likely power management related. When they set in, the phone turns the screen on, shows the lockscreen and then turns off again after a while. The dmesg output (obtained via ssh) shows [ 8324.012680] ltrf216a 0-0053: failed to resume runtime PM: -22 repeatedly (with a frequency of 3 to 5 times per second). Finally the touchscreen becomes unresponsive and cannot be used anymore - hardware buttons still work.

I assume these issues occur because some problems with the power management. At first I suspected the bit banging of the I2C bus might be responsible but idk.

I have tested the kernels 6.6.10 and 6.7.0 (head) both yield the same behavior.

(I am not sure but the issue often occurred after I unplugged the phone from my computer's USB. Yet the issue also occurs after just setting the phone to standby.)

Do you have any clues what the underlying issue might be?

EDIT-1: Added dmesg log on linux 6.7.0. Pattern repeats at regular intervals. Only CPU failure differs.

postmarketos-xiaomi-vince-linux-6.7.0-86d576e1465a5216cb2f1bb420fa39d5f85cf52c.txt

EDIT-2: Added dmesg log on linux 6.7.0. Pattern occurs when standby button is pressed for a short time.

postmarketos-xiaomi-vince-linux-6.7.0-86d576e1465a5216cb2f1bb420fa39d5f85cf52c-short_power_button_press.txt

EDIT-3: I have verified that the problems persist in version 6.7.2-r0 (with modification CONFIG_RT_GROUP_SCHED=n).

The line [ 8324.012680] ltrf216a 0-0053: failed to resume runtime PM: -22 now only shows when the device is woken up. Pressing hardware buttons does not seem to result in errors anymore.

There is still the wake up behavior where the display randomly turns on and runs down the battery.

postmarketos-xiaomi-vince-linux-6.7.2-r0__standby_button_on_and_off.txt

EDIT-4: The issues usually start when the phone tries to go into power saving mode (as set up in the energy settings, for me after approx. 15 minutes on battery or connected to mains).

EDIT-5: In the following log the above described issue start [ 1752.862237] PM: suspend entry (s2idle).

xiaomi-6.7.2-r0_dmesg_when_auto_standby_kicks_in_after_15min.txt

The most important lines (before the suspend is stopped and then retried again):

[ 1752.899606] wcn36xx: ERROR SMD_EVENT (312) not supported
[ 1753.049071] rmi4_f01 rmi4-00.fn01: Failed to write sleep mode: -6.
[ 1753.049095] rmi4_f01 rmi4-00.fn01: Suspend failed with code -6.
[ 1753.049106] rmi4_physical rmi4-00: Failed to suspend functions: -6
[ 1753.049128] rmi4_i2c 2-0020: Failed to resume device: -6
[ 1753.049147] rmi4_i2c 2-0020: PM: dpm_run_callback(): rmi_i2c_suspend+0x0/0x6c [rmi_i2c] returns -6
[ 1753.049192] rmi4_i2c 2-0020: PM: failed to suspend async: error -6
[ 1753.049494] PM: Some devices failed to suspend, or early wake event detected

Related:


EDIT-6: Okay, after digging through the kernel mailing list, this seems to be a long standing issue of the RMI4 driver. It seems not to model parent child relations properly, so that the power management suspends certain parts of the platform that are still needed (as far as I understood the child relationship to the I2C device is modeled properly but there are other undiscovered dependencies).

  • The asynchronous suspend mechanism might trigger this issue because RMI4 might be suspended earlier or later than defined by the hardware declaration order.
    • Disabling async suspend, might help if the declaration order was working before async suspend was enabled.

Related discussions:

Kernel discussion

Issue related commits:

  • 5b6164d ("driver core: Reorder devices on successful probe")
  • 172d931 ("i2c: enable async suspend/resume on i2c client devices")

Collection of magical workarounds (mostly hiding the issues with some likelihood):

  • Sometimes suggested but ineffective for vince (no psmouse module): Add psmouse.synaptics_intertouch=0 to kernel boot cmdline
  • Add fw_devlink=on to kernel boot cmdline
  • Revert ("driver core: Reorder devices on successful probe")
  • Revert ("i2c: enable async suspend/resume on i2c client devices")

Workaround for pmos:

  • Go to energy settings and disable "automatic suspend after x minutes" for both "on battery" and "connected to AC"
  • Locking the device via hardware button seems to work for vince (I guess only the screen is turned off and the screen locked)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions