soc: qcom: pmic_glink_altmode: use a freezable workqueue
Subsystems (3)
PATCH 1/1 soc: qcom: pmic_glink_altmode: use a freezable workqueue
On suspend wake, the DisplayPort altmode setup often executes before devices have compeleted resuming; this triggers a legitimate warning:
i2c i2c-2: Transfer while suspended
WARNING: drivers/i2c/i2c-core.h:57 at __i2c_transfer+0xc0/0x9a8 Workqueue: events pmic_glink_altmode_worker Call trace: __i2c_transfer i2c_transfer regmap_i2c_read ... ps883x_sw_set typec_switch_set pmic_glink_altmode_worker
The setup doesn't succeed, leaving the DP-alt monitor non-working.
Fix this by queuing the work on the freezable workqueue instead, deferring the setup until devices have resumed.
Observed and validated on a Lenovo Yoga Slim 7x X1E80100 when waking from suspend with a USB-C DisplayPort monitor.
--- drivers/soc/qcom/pmic_glink_altmode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/qcom/pmic_glink_altmode.c +2 -2
@@ -450,7 +450,7 @@ static void pmic_glink_altmode_sc8180xp_notify(struct pmic_glink_altmode *altmod alt_port->mode = mode; alt_port->hpd_state = hpd_state; alt_port->hpd_irq = hpd_irq; -schedule_work (&alt_port->work); +queue_work (system_freezable_wq, &alt_port->work); }#define SC8280XP_DPAM_MASK 0x3f
@@ -501,7 +501,7 @@ static void pmic_glink_altmode_sc8280xp_notify(struct pmic_glink_altmode *altmod alt_port->tbt_data = *tbt; } -schedule_work (&alt_port->work); +queue_work (system_freezable_wq, &alt_port->work); }static void pmic_glink_altmode_callback (const void *data,size_t len,void *priv)
Signature · 1 line
2.53.0
Quoted 44 lines · Daniel J Blueman
On suspend wake, the DisplayPort altmode setup often executes before devices have compeleted resuming; this triggers a legitimate warning:
i2c i2c-2: Transfer while suspended WARNING: drivers/i2c/i2c-core.h:57 at __i2c_transfer+0xc0/0x9a8 Workqueue: events pmic_glink_altmode_worker Call trace: __i2c_transfer i2c_transfer regmap_i2c_read ... ps883x_sw_set typec_switch_set pmic_glink_altmode_workerThe setup doesn't succeed, leaving the DP-alt monitor non-working.
Fix this by queuing the work on the freezable workqueue instead, deferring the setup until devices have resumed.
Observed and validated on a Lenovo Yoga Slim 7x X1E80100 when waking from suspend with a USB-C DisplayPort monitor.
Fixes 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")Signed-off-by Daniel J Blueman <[email protected]>--- drivers/soc/qcom/pmic_glink_altmode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soc/qcom/pmic_glink_altmode.c +1
-1@@ -450,7 +450,7 @@ static void pmic_glink_altmode_sc8180xp_notify(struct pmic_glink_altmode *altmod alt_port->mode = mode; alt_port->hpd_state = hpd_state; alt_port->hpd_irq = hpd_irq; -schedule_work (&alt_port->work); +queue_work (system_freezable_wq, &alt_port->work); }#define SC8280XP_DPAM_MASK 0x3f
drivers/soc/qcom/pmic_glink_altmode.c static void pmic_glink_altmode_sc8280xp_notify(struct pmic_glink_altmode *altmod · line 507
Quoted 8 lines
drivers/soc/qcom/pmic_glink_altmode.c +1
-1@@ -501,7 +501,7 @@ static void pmic_glink_altmode_sc8280xp_notify(struct pmic_glink_altmode *altmod alt_port->tbt_data = *tbt; } -schedule_work (&alt_port->work); +queue_work (system_freezable_wq, &alt_port->work); }static void pmic_glink_altmode_callback (const void *data,size_t len,void *priv)
BTW exactly this has been proposed previously:
It was concluded that this is a stop-gap solution until the notifications are fixed to not be sent at all while suspended… and of course neither the "real fix" nor this has landed :(
~val