Commit 4d5b7daa authored by Hsin-Yi Wang's avatar Hsin-Yi Wang Committed by Douglas Anderson

drm/bridge: anx7625: Ensure bridge is suspended in disable()

Similar to commit 26db46bc ("drm/bridge: parade-ps8640: Ensure bridge
is suspended in .post_disable()"). Add a mutex to ensure that aux transfer
won't race with atomic_disable by holding the PM reference and prevent
the bridge from suspend.

Also we need to use pm_runtime_put_sync_suspend() to suspend the bridge
instead of idle with pm_runtime_put_sync().

Fixes: 3203e497 ("drm/bridge: anx7625: Synchronously run runtime suspend.")
Fixes: adca62ec ("drm/bridge: anx7625: Support reading edid through aux channel")
Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
Tested-by: default avatarXuxin Xiong <xuxinxiong@huaqin.corp-partner.google.com>
Reviewed-by: default avatarPin-yen Lin <treapking@chromium.org>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240118015916.2296741-1-hsinyi@chromium.org
parent 4b5581f1
...@@ -1762,6 +1762,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, ...@@ -1762,6 +1762,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,
u8 request = msg->request & ~DP_AUX_I2C_MOT; u8 request = msg->request & ~DP_AUX_I2C_MOT;
int ret = 0; int ret = 0;
mutex_lock(&ctx->aux_lock);
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
msg->reply = 0; msg->reply = 0;
switch (request) { switch (request) {
...@@ -1778,6 +1779,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, ...@@ -1778,6 +1779,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,
msg->size, msg->buffer); msg->size, msg->buffer);
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev); pm_runtime_put_autosuspend(dev);
mutex_unlock(&ctx->aux_lock);
return ret; return ret;
} }
...@@ -2474,7 +2476,9 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge, ...@@ -2474,7 +2476,9 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,
ctx->connector = NULL; ctx->connector = NULL;
anx7625_dp_stop(ctx); anx7625_dp_stop(ctx);
pm_runtime_put_sync(dev); mutex_lock(&ctx->aux_lock);
pm_runtime_put_sync_suspend(dev);
mutex_unlock(&ctx->aux_lock);
} }
static enum drm_connector_status static enum drm_connector_status
...@@ -2668,6 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *client) ...@@ -2668,6 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *client)
mutex_init(&platform->lock); mutex_init(&platform->lock);
mutex_init(&platform->hdcp_wq_lock); mutex_init(&platform->hdcp_wq_lock);
mutex_init(&platform->aux_lock);
INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func);
platform->hdcp_workqueue = create_workqueue("hdcp workqueue"); platform->hdcp_workqueue = create_workqueue("hdcp workqueue");
......
...@@ -475,6 +475,8 @@ struct anx7625_data { ...@@ -475,6 +475,8 @@ struct anx7625_data {
struct workqueue_struct *hdcp_workqueue; struct workqueue_struct *hdcp_workqueue;
/* Lock for hdcp work queue */ /* Lock for hdcp work queue */
struct mutex hdcp_wq_lock; struct mutex hdcp_wq_lock;
/* Lock for aux transfer and disable */
struct mutex aux_lock;
char edid_block; char edid_block;
struct display_timing dt; struct display_timing dt;
u8 display_timing_valid; u8 display_timing_valid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment