[PATCH v2 11/50] drm/bridge: Add bridge driver for display connectors
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Aug 22 16:39:35 UTC 2019
Hi Boris,
On Thu, Aug 22, 2019 at 06:05:20PM +0200, Boris Brezillon wrote:
> On Tue, 20 Aug 2019 04:16:42 +0300 Laurent Pinchart wrote:
>
> > + /*
> > + * Get the HPD GPIO for DVI and HDMI connectors. If the GPIO can provide
> > + * interrupts, register an interrupt handler.
> > + */
> > + if (type == DRM_MODE_CONNECTOR_DVII ||
> > + type == DRM_MODE_CONNECTOR_HDMIA) {
> > + conn->hpd_gpio = devm_gpiod_get_optional(&pdev->dev, "hpd",
> > + GPIOD_IN);
> > + if (IS_ERR(conn->hpd_gpio)) {
> > + if (PTR_ERR(conn->hpd_gpio) != -EPROBE_DEFER)
> > + dev_err(&pdev->dev,
> > + "Unable to retrieve HPD GPIO\n");
> > + return PTR_ERR(conn->hpd_gpio);
> > + }
> > +
> > + conn->hpd_irq = gpiod_to_irq(conn->hpd_gpio);
> > + } else {
> > + conn->hpd_irq = -EINVAL;
> > + }
> > +
> > + if (conn->hpd_irq >= 0) {
> > + ret = devm_request_threaded_irq(&pdev->dev, conn->hpd_irq,
> > + NULL, display_connector_hpd_irq,
> > + IRQF_TRIGGER_RISING |
> > + IRQF_TRIGGER_FALLING |
> > + IRQF_ONESHOT,
> > + "HPD", conn);
> > + if (ret) {
> > + dev_err(&pdev->dev,
> > + "Failed to request HPD interrupt\n");
> > + return ret;
>
> Is there anything that mandates support of edge events on GPIO chips?
> I know it's quite common, but maybe we should fallback to polling
> mode when devm_request_threaded_irq() fails.
That's a good point, I'll change this.
> > + }
> > + }
> > +
> > + /* Retrieve the DDC I2C adapter for DVI, HDMI and VGA connectors. */
> > + if (type == DRM_MODE_CONNECTOR_DVII ||
> > + type == DRM_MODE_CONNECTOR_HDMIA ||
> > + type == DRM_MODE_CONNECTOR_VGA) {
> > + struct device_node *phandle;
> > +
> > + phandle = of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0);
> > + if (phandle) {
> > + conn->bridge.ddc = of_get_i2c_adapter_by_node(phandle);
> > + of_node_put(phandle);
> > + if (!conn->bridge.ddc)
> > + return -EPROBE_DEFER;
> > + } else {
> > + dev_dbg(&pdev->dev,
> > + "No I2C bus specified, disabling EDID readout\n");
> > + }
> > + }
> > +
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list