summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/bridge/ite-it6505.c
diff options
context:
space:
mode:
authorPin-yen Lin <treapking@chromium.org>2022-11-09 17:52:27 +0800
committerRobert Foss <robert.foss@linaro.org>2022-12-14 17:03:02 +0100
commit5eb9a4314053bda7642643f70f49a2b415920812 (patch)
tree6637f446c8fd6d2617fbeba8a74af3836e225ae3 /drivers/gpu/drm/bridge/ite-it6505.c
parent94914b8594a4e471f688f276fe583dbea17209ba (diff)
drm/bridge: it6505: Guard bridge power in IRQ handler
Add a pair of pm_runtime_get_if_in_use and pm_runtime_put_sync in the interrupt handler to make sure the bridge won't be powered off during the interrupt handlings. Also remove the irq_lock mutex because it's not guarding anything now. Fixes: ab28896f1a83 ("drm/bridge: it6505: Improve synchronization between extcon subsystem") Signed-off-by: Pin-yen Lin <treapking@chromium.org> Reviewed-by: Robert Foss <robert.foss@linaro.org> Signed-off-by: Robert Foss <robert.foss@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20221109095227.3320919-1-treapking@chromium.org
Diffstat (limited to 'drivers/gpu/drm/bridge/ite-it6505.c')
-rw-r--r--drivers/gpu/drm/bridge/ite-it6505.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index fea2b4279c31..5702569600e6 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -412,7 +412,6 @@ struct it6505 {
* Mutex protects extcon and interrupt functions from interfering
* each other.
*/
- struct mutex irq_lock;
struct mutex extcon_lock;
struct mutex mode_lock; /* used to bridge_detect */
struct mutex aux_lock; /* used to aux data transfers */
@@ -2494,10 +2493,8 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
};
int int_status[3], i;
- mutex_lock(&it6505->irq_lock);
-
- if (it6505->enable_drv_hold || !it6505->powered)
- goto unlock;
+ if (it6505->enable_drv_hold || pm_runtime_get_if_in_use(dev) <= 0)
+ return IRQ_HANDLED;
int_status[0] = it6505_read(it6505, INT_STATUS_01);
int_status[1] = it6505_read(it6505, INT_STATUS_02);
@@ -2515,16 +2512,14 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
if (it6505_test_bit(irq_vec[0].bit, (unsigned int *)int_status))
irq_vec[0].handler(it6505);
- if (!it6505->hpd_state)
- goto unlock;
-
- for (i = 1; i < ARRAY_SIZE(irq_vec); i++) {
- if (it6505_test_bit(irq_vec[i].bit, (unsigned int *)int_status))
- irq_vec[i].handler(it6505);
+ if (it6505->hpd_state) {
+ for (i = 1; i < ARRAY_SIZE(irq_vec); i++) {
+ if (it6505_test_bit(irq_vec[i].bit, (unsigned int *)int_status))
+ irq_vec[i].handler(it6505);
+ }
}
-unlock:
- mutex_unlock(&it6505->irq_lock);
+ pm_runtime_put_sync(dev);
return IRQ_HANDLED;
}
@@ -3276,7 +3271,6 @@ static int it6505_i2c_probe(struct i2c_client *client)
if (!it6505)
return -ENOMEM;
- mutex_init(&it6505->irq_lock);
mutex_init(&it6505->extcon_lock);
mutex_init(&it6505->mode_lock);
mutex_init(&it6505->aux_lock);