drm/bridge: adv7511: Allow IRQ to share GPIO pins
Subsystems (5)
PATCH v2 1/2 drm/bridge: adv7511: Allow IRQ to share GPIO pins
The IRQ registration currently assumes that the GPIO is dedicated to it, but that may not necessarily be the case. If the board has another device sharing the GPIO, it won't be registered and the hot-plug detect fails to function.
Currently, the handler reads two registers and blindly assumes one of them caused the interrupt and returns IRQ_HANDLED unless there is an error. In order to properly do this, the IRQ handler needs to check if it needs to handle the IRQ and return IRQ_NONE if there is nothing to handle. With the check added and the return code properly indicating whether or not it there was an IRQ, the IRQF_SHARED can be set to share a GPIO IRQ.
---
V2: Add check to see if there is IRQ data to handle
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +7 -1
@@ -477,6 +477,11 @@ static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)if (ret <0 )return ret; +/* If there is no IRQ to handle, exit indicating no IRQ data */ +if (!(irq0 & (ADV7511_INT0_HPD |ADV7511_INT0_EDID_READY )) && + !(irq1 &ADV7511_INT1_DDC_ERROR )) +return -ENODATA ; +regmap_write (adv7511->regmap,ADV7511_REG_INT (0 ), irq0);regmap_write (adv7511->regmap,ADV7511_REG_INT (1 ), irq1);
@@ -1318,7 +1323,8 @@ static int adv7511_probe(struct i2c_client *i2c) ret =devm_request_threaded_irq (dev, i2c->irq,NULL , adv7511_irq_handler, -IRQF_ONESHOT ,dev_name (dev), +IRQF_ONESHOT |IRQF_SHARED , +dev_name (dev), adv7511);if (ret) goto err_unregister_audio;
Signature · 1 line
2.43.0
PATCH v2 2/2 arm64: dts: imx8mp-beacon-kit: Enable HDMI bridge HPD
The DSI to HDMI bridge supports hot-plut-detect, but the driver didn't previously support a shared IRQ GPIO. With the driver updated, the interrupt can be added to the bridge.
---
V2: No Change
arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +2 -0
@@ -304,6 +304,8 @@ adv_bridge: hdmi@3d { compatible = "adi,adv7535"; reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>; reg-names = "main", "cec", "edid", "packet"; + interrupt-parent = <&gpio4>; + interrupts = <27 IRQ_TYPE_EDGE_FALLING>; adi,dsi-lanes = <4>; #sound-dai-cells = <0>;
Signature · 1 line
2.43.0
Re: [PATCH V2 2/2] arm64: dts: imx8mp-beacon-kit: Enable HDMI bridge HPD
Quoted 7 lines · Adam Ford
The DSI to HDMI bridge supports hot-plut-detect, but the driver didn't previously support a shared IRQ GPIO. With the driver updated, the interrupt can be added to the bridge.
Signed-off-by Adam Ford <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
Shawn,
Patch 1/2 has been applied and sits in linux-next. Are you OK to apply this to the IMX branch so the hot-plug detection can work?
Thank you,
adam
adam
Quoted 19 lines
---
V2: No Changearch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +2
-1@@ -304,6 +304,8 @@ adv_bridge: hdmi@3d { compatible = "adi,adv7535"; reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>; reg-names = "main", "cec", "edid", "packet"; + interrupt-parent = <&gpio4>; + interrupts = <27 IRQ_TYPE_EDGE_FALLING>; adi,dsi-lanes = <4>; #sound-dai-cells = <0>; --2.43.0
Re: [PATCH V2 2/2] arm64: dts: imx8mp-beacon-kit: Enable HDMI bridge HPD
Quoted 7 lines · Adam Ford
Quoted 5 lines · Adam Ford
The DSI to HDMI bridge supports hot-plut-detect, but the driver didn't previously support a shared IRQ GPIO. With the driver updated, the interrupt can be added to the bridge.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Adam Ford <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Shawn,
Patch 1/2 has been applied and sits in linux-next. Are you OK to apply this to the IMX branch so the hot-plug detection can work?
Shawn,
Do you want me to repost this patch separately since patch 1/2 has already been applied?
adam
Quoted 25 lines
Thank you,
adam
adam
Quoted 19 lines
---
V2: No Changearch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +2
-1@@ -304,6 +304,8 @@ adv_bridge: hdmi@3d { compatible = "adi,adv7535"; reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>; reg-names = "main", "cec", "edid", "packet"; + interrupt-parent = <&gpio4>; + interrupts = <27 IRQ_TYPE_EDGE_FALLING>; adi,dsi-lanes = <4>; #sound-dai-cells = <0>; --2.43.0
Shawn Guo
AppliedRe: [PATCH V2 2/2] arm64: dts: imx8mp-beacon-kit: Enable HDMI bridge HPD
In reply to Adam FordQuoted 6 lines · Adam Ford
The DSI to HDMI bridge supports hot-plut-detect, but the driver didn't previously support a shared IRQ GPIO. With the driver updated, the interrupt can be added to the bridge.
Signed-off-by Adam Ford <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
Applied, thanks!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hello Adam,
Thank you for the patch.
Quoted 13 lines · Adam Ford
The IRQ registration currently assumes that the GPIO is dedicated to it, but that may not necessarily be the case. If the board has another device sharing the GPIO, it won't be registered and the hot-plug detect fails to function.
Currently, the handler reads two registers and blindly assumes one of them caused the interrupt and returns
IRQ_HANDLEDunless there is an error. In order to properly do this, the IRQ handler needs to check if it needs to handle the IRQ and returnIRQ_NONEif there is nothing to handle. With the check added and the return code properly indicating whether or not it there was an IRQ, theIRQF_SHAREDcan be set to share a GPIO IRQ.
Quoted 1 line
Signed-off-by Adam Ford <[email protected]>
Quoted 29 lines
---
V2: Add check to see if there is IRQ data to handledrivers/gpu/drm/bridge/adv7511/adv7511_drv.c +7
-1@@ -477,6 +477,11 @@ static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)if (ret <0 )return ret; +/* If there is no IRQ to handle, exit indicating no IRQ data */ +if (!(irq0 & (ADV7511_INT0_HPD |ADV7511_INT0_EDID_READY )) && + !(irq1 &ADV7511_INT1_DDC_ERROR )) +return -ENODATA ; +regmap_write (adv7511->regmap,ADV7511_REG_INT (0 ), irq0);regmap_write (adv7511->regmap,ADV7511_REG_INT (1 ), irq1);@@ -1318,7 +1323,8 @@ static int adv7511_probe(struct i2c_client *i2c) ret =devm_request_threaded_irq (dev, i2c->irq,NULL , adv7511_irq_handler, -IRQF_ONESHOT ,dev_name (dev), +IRQF_ONESHOT |IRQF_SHARED , +dev_name (dev), adv7511);if (ret) goto err_unregister_audio;
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 19 lines · Laurent Pinchart
Hello Adam,
Thank you for the patch.
Quoted 13 lines · Adam Ford
The IRQ registration currently assumes that the GPIO is dedicated to it, but that may not necessarily be the case. If the board has another device sharing the GPIO, it won't be registered and the hot-plug detect fails to function.
Currently, the handler reads two registers and blindly assumes one of them caused the interrupt and returns
IRQ_HANDLEDunless there is an error. In order to properly do this, the IRQ handler needs to check if it needs to handle the IRQ and returnIRQ_NONEif there is nothing to handle. With the check added and the return code properly indicating whether or not it there was an IRQ, theIRQF_SHAREDcan be set to share a GPIO IRQ.
Quoted 3 lines
Quoted 1 line
Signed-off-by Adam Ford <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
Gentle nudge on this one. It's been about a month, and without it,
it is preventing hot-plug detection on one board for me.
Thanks
adam
Quoted 35 lines
Quoted 21 lines
---
V2: Add check to see if there is IRQ data to handledrivers/gpu/drm/bridge/adv7511/adv7511_drv.c +5
-0@@ -477,6 +477,11 @@ static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)if (ret <0 )return ret; +/* If there is no IRQ to handle, exit indicating no IRQ data */ +if (!(irq0 & (ADV7511_INT0_HPD |ADV7511_INT0_EDID_READY )) && + !(irq1 &ADV7511_INT1_DDC_ERROR )) +return -ENODATA ; +regmap_write (adv7511->regmap,ADV7511_REG_INT (0 ), irq0);regmap_write (adv7511->regmap,ADV7511_REG_INT (1 ), irq1);drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_probe(struct i2c_client *i2c) · line 1330
Quoted 9 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2
-1@@ -1318,7 +1323,8 @@ static int adv7511_probe(struct i2c_client *i2c) ret =devm_request_threaded_irq (dev, i2c->irq,NULL , adv7511_irq_handler, -IRQF_ONESHOT ,dev_name (dev), +IRQF_ONESHOT |IRQF_SHARED , +dev_name (dev), adv7511);if (ret) goto err_unregister_audio;--
Regards,Laurent Pinchart
Quoted 13 lines · Adam Ford
The IRQ registration currently assumes that the GPIO is dedicated to it, but that may not necessarily be the case. If the board has another device sharing the GPIO, it won't be registered and the hot-plug detect fails to function.
Currently, the handler reads two registers and blindly assumes one of them caused the interrupt and returns
IRQ_HANDLEDunless there is an error. In order to properly do this, the IRQ handler needs to check if it needs to handle the IRQ and returnIRQ_NONEif there is nothing to handle. With the check added and the return code properly indicating whether or not it there was an IRQ, theIRQF_SHAREDcan be set to share a GPIO IRQ.
Quoted 4 lines
Signed-off-by Adam Ford <[email protected]>---
V2: Add check to see if there is IRQ data to handle
Signature · 2 lines
With best wishes Dmitry
Dmitry Baryshkov
AppliedRe: (subset) [PATCH V2 1/2] drm/bridge: adv7511: Allow IRQ to share GPIO pins
In reply to Adam FordQuoted 13 lines · Adam Ford
The IRQ registration currently assumes that the GPIO is dedicated to it, but that may not necessarily be the case. If the board has another device sharing the GPIO, it won't be registered and the hot-plug detect fails to function.
Currently, the handler reads two registers and blindly assumes one of them caused the interrupt and returns
IRQ_HANDLEDunless there is an error. In order to properly do this, the IRQ handler needs to check if it needs to handle the IRQ and returnIRQ_NONEif there is nothing to handle. With the check added and the return code properly indicating whether or not it there was an IRQ, theIRQF_SHAREDcan be set to share a GPIO IRQ.
Quoted 1 line
[...]
Applied to drm-misc-next, thanks!
[1/2] drm/bridge: adv7511: Allow IRQ to share GPIO pins
commit: f3d9683346d6b1d6e24f57e954385995601594d4
Best regards,
Signature · 2 lines
With best wishes Dmitry