[media] cec-gpio: don't generate spurious HPD events
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 25 Sep 2017 08:02:57 +0000 (05:02 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 4 Oct 2017 20:04:18 +0000 (17:04 -0300)
Only send HPD_LOW/HIGH event if the gpio actually changed value.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/cec-gpio/cec-gpio.c

index eb982bc..5debdf0 100644 (file)
@@ -80,9 +80,12 @@ static irqreturn_t cec_hpd_gpio_irq_handler_thread(int irq, void *priv)
 static irqreturn_t cec_hpd_gpio_irq_handler(int irq, void *priv)
 {
        struct cec_gpio *cec = priv;
+       bool is_high = gpiod_get_value(cec->hpd_gpio);
 
+       if (is_high == cec->hpd_is_high)
+               return IRQ_HANDLED;
        cec->hpd_ts = ktime_get();
-       cec->hpd_is_high = gpiod_get_value(cec->hpd_gpio);
+       cec->hpd_is_high = is_high;
        return IRQ_WAKE_THREAD;
 }