RPi touchscreen as a panel driver again
Subsystems (8)
cover RPi touchscreen as a panel driver again
After splitting the panel driver out into a panel and bridge due to panel review, the feedback from bridge maintainers was that it didn't make sense as a bridge. I completely agree with them. This series returns the driver to being a panel, but this time probing as an i2c client rather than a DSI device (due to review from bridge submission).
Eric Anholt (7):
drm/bridge: Support hotplugging panel-bridge.
drm/vc4: Fix DSI T_INIT timing.
drm/vc4: Fix misleading name of the continuous flag. drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.
dt-bindings: Document the Raspberry Pi Touchscreen nodes. drm/panel: Add support for the Raspberry Pi 7" Touchscreen.
ARM: dts: bcm2835: Enable the Raspberry Pi touchscreen panel.
.../panel/raspberrypi,7inch-touchscreen.txt | 49 ++ arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 5 + arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 5 + arch/arm/boot/dts/bcm2835-rpi-b.dts | 5 + arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 5 + arch/arm/boot/dts/bcm283x.dtsi | 30 +- arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 5 + drivers/gpu/drm/bridge/panel.c | 3 + drivers/gpu/drm/panel/Kconfig | 8 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-raspberrypi-touchscreen.c | 507 +++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_dsi.c | 24 +- 12 files changed, 640 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt create mode 100644 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/7 drm/bridge: Support hotplugging panel-bridge.
If the panel-bridge is being set up after the drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.
--- drivers/gpu/drm/bridge/panel.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/panel.c +3 -0
@@ -82,11 +82,14 @@ static int panel_bridge_attach(struct drm_bridge *bridge)drm_mode_connector_attach_encoder (&panel_bridge->connector, bridge->encoder); +drm_atomic_helper_connector_reset (&panel_bridge->connector); ret =drm_panel_attach (panel_bridge->panel, &panel_bridge->connector);if (ret <0 )return ret; +drm_connector_register (&panel_bridge->connector); +return 0 ; }
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.
Shouldn't the KMS driver make sure the panel-bridge is set up before drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?
All the connectors that have been added are registered automatically when drm_dev_register() is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.
Thanks,
Archit
Quoted 25 lines
Signed-off-by Eric Anholt <[email protected]>--- drivers/gpu/drm/bridge/panel.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/bridge/panel.c +3
-0@@ -82,11 +82,14 @@ static int panel_bridge_attach(struct drm_bridge *bridge)drm_mode_connector_attach_encoder (&panel_bridge->connector, bridge->encoder); +drm_atomic_helper_connector_reset (&panel_bridge->connector); ret =drm_panel_attach (panel_bridge->panel, &panel_bridge->connector);if (ret <0 )return ret; +drm_connector_register (&panel_bridge->connector); +return 0 ; }
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.
Yeah, this is fixing initializing panel_bridge at DSI host_attach time, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be after drm_mode_config_reset() and drm_dev_register().
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.
Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to drm_mode_config_reset() and drm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.
Feedback from others on this would be appreciated, though.
Thanks,
Archit
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Laurent Pinchart
reviewerRe: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Hi Archit,
Quoted 23 lines · On Tuesday 20 Jun 2017 09:18:00 Archit Taneja wrote:
Quoted 17 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 4 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().
Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.
I'd love to see support for a more dynamic approach that would allow registering outputs at runtime. Until that's implemented, however, I agree with your statement, drivers should wait until all components are available before registering the DRM device.
Quoted 1 line
Feedback from others on this would be appreciated, though.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Archit TanejaQuoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().
Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.
The problem, though, is the panel driver needs the MIPI DSI host to exist to call mipi_dsi_device_register_full() during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, but drm_panel doesn't have an attach step.
Another alternative is my original version of the panel driver that was a mipi_dsi_device driver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 38 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.
Quoted 4 lines
Another alternative is my original version of the panel driver that was a
mipi_dsi_devicedriver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
+ Philippe in copy because we have the same probing issue when adding panel-bridge
with the dsi bridge
Quoted 6 lines
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.
I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a panel_attach() callback to make it similar to bridges, but that's just us avoiding the real issue.
Quoted 6 lines
Quoted 5 lines
Another alternative is my original version of the panel driver that was a
mipi_dsi_devicedriver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
This would require you to have a DSI device node in DT, rather than an i2c node, right? I don't know if we should do that because of a limitation in our drm_mipi_dsi and drm_panel frameworks.
Does anyone have better ideas?
Thanks,
Archit
Quoted 10 lines
+ Philippe in copy because we have the same probing issue when adding panel-bridge
with the dsi bridgeQuoted 6 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 40 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja <[email protected]> wrote:
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.
Quoted 4 lines
I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.
How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
That implies moving the drm_brige registration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready at dsi_host->attach() time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register the drm_bridge and wait for the next dsi_host->attach() event.
With this solution, I think we can avoid the chicken&egg problem where the adv7533 dev is waiting for the DSI host to be probed to be able to register a DSI dev with mipi_dsi_device_register_full() and the DSI host needs all devs to be registered to not return -EPROBE_DEFER.
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Another alternative is my original version of the panel driver that was a
mipi_dsi_devicedriver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
Quoted 5 lines
This would require you to have a DSI device node in DT, rather than an i2c node, right? I don't know if we should do that because of a limitation in our
drm_mipi_dsianddrm_panelframeworks.Does anyone have better ideas?
Well, these mixed-bus cases are really unpractical to represent in the DT (and also not easy to deal with the device-model). I understand that the initial solution was to put the device under the control-bus, and not the data-bus, but then it leads to the current situation where we don't know exactly when things are ready to be used.
Theoretically, we should wait for both the i2c and DSI ends to be attached to their respective controller before starting using the device. But that requires representing things with a 3rd DT node aggregating both components:
i2c-bus {
...
adv7533_i2c@xx {
...
adv,adv7533-master = <&adv7533>;
};
};
...
dsi-bus {
...
adv7533_dsi: adv7533_dsi@xx {
...
adv,adv7533-master = <&adv7533>;
};
};
adv7533: adv7533 {
...
adv,adv7533-dsi = <&adv7533_dsi>;
adv,adv7533-i2c = <&adv7533_i2c>;
};I guess this kind of representation has already been discussed and rejected for good reasons (note that we could also use OF graph representation to link adv7533 master and its components).
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja…
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,
2. drm_bridge should be registered only if all required sinks (bridges/panels) are registered.
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source. By the way is there any pipeline with two consecutive external bridges in the mainline?
Regards
Andrzej
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 56 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda…
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja…
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.
Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.
Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 3 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,
Exactly.
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.
That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 3 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Quoted 2 lines
By the way is there any pipeline with two consecutive external bridges in the mainline?
I don't know if it exists in mainline, but I had to do that on my FPGA platform when developing/testing Cadence DSI host driver. I had the following chain and it worked just fine:
CRTC -> DPI encoder -> DPI to DSI bridge -> DSI to DPI bridge -> DPI to HDMI bridge (adv7511) -> HDMI connector
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 71 lines · Boris Brezillon
Quoted 55 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda…
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja…
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 2 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,Exactly.
Quoted 7 lines
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 2 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Since drm_bridge_attach requires encoder to be not null pipeline creation would be painful:
1. Every driver must call drm_of_find_panel_or_bridge on sink(s) before registering bridge and cache the result for later use.
2. After encoder finds directly connected bridge, it can attach it.
3. attach callback of every bridge should attach subsequent bridge.
Quite complicated, maybe bridges should be chained w/o available encoder, and later attached to encoder with other helper, for example drm_bridge_chain_attach.
Regards
Andrzej
Quoted 12 lines
Quoted 3 lines
By the way is there any pipeline with two consecutive external bridges in the mainline?
I don't know if it exists in mainline, but I had to do that on my FPGA platform when developing/testing Cadence DSI host driver. I had the following chain and it worked just fine:
CRTC -> DPI encoder -> DPI to DSI bridge -> DSI to DPI bridge -> DPI to HDMI bridge (adv7511) -> HDMI connector
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 76 lines · On Thu, 22 Jun 2017 15:16:47 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 75 lines · Boris Brezillon
Quoted 55 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja <[email protected]> wrote:
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 2 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,Exactly.
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Since
drm_bridge_attachrequires encoder to be not null pipeline creation would be painful:
1. Every driver must calldrm_of_find_panel_or_bridgeon sink(s) before registering bridge and cache the result for later use.
Shouldn't be hard to do since dsi_host->attach() is called each time a sink is added (and ready to use). All you need to do is retrieve the bridge pointer and put it in a list embedded in the DSI host priv struct. Once you have all sinks added to this list (can be checked by counting the number of endpoints and DSI devs at probe time), you can register the DSI bridge and wait for someone to call ->attach() on it.
In the ->attach() hook of the DSI bridge, you'll have to attach all sinks stored in the list to the DSI bridge. Note that right now you have a 1:1 relationship, which prevents you from having one DSI bridge that can attach to different bridges available on the DSI bus (e.g. DSI -> HDMI bridge on channel 0 and DSI -> LVDS bridge on channel 1).
Quoted 1 line
2. After encoder finds directly connected bridge, it can attach it.
I don't get that one.
Quoted 1 line
3. attach callback of every bridge should attach subsequent bridge.
Yep.
Quoted 2 lines
Quite complicated,
Not sure it's more complicated than what we have right now.
Quoted 3 lines
maybe bridges should be chained w/o available
encoder, and later attached to encoder with other helper, for exampledrm_bridge_chain_attach.
That's also a solution.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 93 lines · Boris Brezillon
Quoted 76 lines · On Thu, 22 Jun 2017 15:16:47 +0200 Andrzej Hajda…
Quoted 75 lines · Boris Brezillon
Quoted 55 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda…
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja…
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 2 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,Exactly.
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Since
drm_bridge_attachrequires encoder to be not null pipeline creation would be painful:
1. Every driver must calldrm_of_find_panel_or_bridgeon sink(s) before registering bridge and cache the result for later use.Shouldn't be hard to do since
dsi_host->attach()is called each time a sink is added (and ready to use). All you need to do is retrieve the bridge pointer and put it in a list embedded in the DSI host priv struct. Once you have all sinks added to this list (can be checked by counting the number of endpoints and DSI devs at probe time), you can register the DSI bridge and wait for someone to call ->attach() on it.
Quoted 8 lines
In the ->attach() hook of the DSI bridge, you'll have to attach all sinks stored in the list to the DSI bridge. Note that right now you have a 1:1 relationship, which prevents you from having one DSI bridge that can attach to different bridges available on the DSI bus (e.g. DSI -> HDMI bridge on channel 0 and DSI -> LVDS bridge on channel 1).
Quoted 1 line
2. After encoder finds directly connected bridge, it can attach it.
I don't get that one.
If you have pipeline:
crtc -> encoder -> bridge1 -> bridge2 -> panel
encoder knows only about bridge1, and must wait till it is registered, before attaching it,
and assuming bridge must wait for its sinks before registration the whole pipeline construction will look like:
0. encoder waits for bridge1, bridge1 waits for bridge2, bridge2 waits for panel, usually by deferring.
1. panel is registered.
2. bridge2 finds panel and is registered.
3. bridge1 finds bridge2 and is registered.
4. encoder finds bridge1 and attach it to encoder,
4a. bridge1->attach() attach bridge2 to encoder after bridge1 4b. bridge2->attach() attach panel to bridge2
This is why it seems for me quite complicated.
Regards
Andrzej
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 121 lines · On Fri, 23 Jun 2017 09:22:15 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 93 lines · Boris Brezillon
Quoted 76 lines · On Thu, 22 Jun 2017 15:16:47 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 75 lines · Boris Brezillon
Quoted 55 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja <[email protected]> wrote:
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the drm_mode_config_reset(),
then the connector's state would never get initialized, and we'd
dereference the NULL in the hotplug path. We also need to register
the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 2 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,Exactly.
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Since
drm_bridge_attachrequires encoder to be not null pipeline creation would be painful:
1. Every driver must calldrm_of_find_panel_or_bridgeon sink(s) before registering bridge and cache the result for later use.Shouldn't be hard to do since
dsi_host->attach()is called each time a sink is added (and ready to use). All you need to do is retrieve the bridge pointer and put it in a list embedded in the DSI host priv struct. Once you have all sinks added to this list (can be checked by counting the number of endpoints and DSI devs at probe time), you can register the DSI bridge and wait for someone to call ->attach() on it.Quoted 8 lines
In the ->attach() hook of the DSI bridge, you'll have to attach all sinks stored in the list to the DSI bridge. Note that right now you have a 1:1 relationship, which prevents you from having one DSI bridge that can attach to different bridges available on the DSI bus (e.g. DSI -> HDMI bridge on channel 0 and DSI -> LVDS bridge on channel 1).
Quoted 1 line
2. After encoder finds directly connected bridge, it can attach it.
I don't get that one.
If you have pipeline:
crtc -> encoder -> bridge1 -> bridge2 -> panel
encoder knows only about bridge1, and must wait till it is registered, before attaching it,
and assuming bridge must wait for its sinks before registration the whole pipeline construction will look like:0. encoder waits for bridge1, bridge1 waits for bridge2, bridge2 waits for panel, usually by deferring.
1. panel is registered.
2. bridge2 finds panel and is registered.
3. bridge1 finds bridge2 and is registered.
4. encoder finds bridge1 and attach it to encoder,
4a.bridge1->attach()attach bridge2 to encoder after bridge1 4b.bridge2->attach()attach panel to bridge2
Quoted 1 line
This is why it seems for me quite complicated.
But that's already what happens in most drivers today (probably because things were designed before connector hotplug was supported). I agree, it's far from ideal, but until we get full-hotplug support, we'll have to rely on such hacks.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Boris BrezillonQuoted 88 lines · Boris Brezillon
Quoted 76 lines · On Thu, 22 Jun 2017 15:16:47 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 75 lines · Boris Brezillon
Quoted 55 lines · On Thu, 22 Jun 2017 14:29:07 +0200 Andrzej Hajda <[email protected]> wrote:
Quoted 47 lines · Boris Brezillon
Quoted 31 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja <[email protected]> wrote:
Quoted 30 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 29 lines
Quoted 27 lines · Archit Taneja
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 8 lines
Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
Quoted 7 lines
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
I guess you assumes that dsi-host knows all devs connected to it, thanks to:
- subnodes of the host - ie. devices controlled via dsi bus,
- graph links from host ports/endpoints - ie. devices controlled by other buses, for example adv7533.Yep, but I think that's already a requirement when populating devices with the OF graph method (if one of the DSI output endpoint does not have a drm_bridge/panel attached to it, the DSI host driver returns -EPROBE_DEFER).
Quoted 2 lines
I would separate both abstractions to make it more clear:
1. MIPI bus should be registered early - to allow create/bind devices on it,Exactly.
Quoted 2 lines
2.
drm_bridgeshould be registered only if all required sinks (bridges/panels) are registered.That's true, until we find a solution to support add DRM bridge hotplug.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
First point seems OK, I am not sure about the 2nd one - if used consistently, it would require building pipeline from sink to source.
Yes.
Since
drm_bridge_attachrequires encoder to be not null pipeline creation would be painful:
1. Every driver must calldrm_of_find_panel_or_bridgeon sink(s) before registering bridge and cache the result for later use.
Quoted 6 lines
Shouldn't be hard to do since
dsi_host->attach()is called each time a sink is added (and ready to use). All you need to do is retrieve the bridge pointer and put it in a list embedded in the DSI host priv struct. Once you have all sinks added to this list (can be checked by counting the number of endpoints and DSI devs at probe time), you can register the DSI bridge and wait for someone to call ->attach() on it.
Some of the kms drivers (including vc4) currently do the bridge registration, and call drm_bridge_attach() in the DSI host driver's probe path itself. I guess some of them would require some restructuring to work with the above approach.
Other kms drivers (msm for example) already have a separate modeset_init path where different drm objects (crtcs, encoders, bridges) are created. That's the one that can defer rather than defer-ing the DSI host driver.
We'd want people be willing to convert their kms drivers to go ahead with the approach.
Thanks for continuing the discussion, it was quite informative.
Regards,
Archit
Quoted 26 lines
In the ->attach() hook of the DSI bridge, you'll have to attach all sinks stored in the list to the DSI bridge. Note that right now you have a 1:1 relationship, which prevents you from having one DSI bridge that can attach to different bridges available on the DSI bus (e.g. DSI -> HDMI bridge on channel 0 and DSI -> LVDS bridge on channel 1).
Quoted 1 line
2. After encoder finds directly connected bridge, it can attach it.
I don't get that one.
Quoted 1 line
3. attach callback of every bridge should attach subsequent bridge.
Yep.
Quoted 2 lines
Quite complicated,
Not sure it's more complicated than what we have right now.
Quoted 3 lines
maybe bridges should be chained w/o available
encoder, and later attached to encoder with other helper, for exampledrm_bridge_chain_attach.That's also a solution.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Boris BrezillonQuoted 61 lines · Boris Brezillon
Quoted 40 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja <[email protected]> wrote:
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.Quoted 4 lines
I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.
Quoted 4 lines
With this solution, I think we can avoid the chicken&egg problem where the adv7533 dev is waiting for the DSI host to be probed to be able to register a DSI dev with
mipi_dsi_device_register_full()and the DSI host needs all devs to be registered to not return -EPROBE_DEFER.
I've now tried having mipi_dsi_device_register_full() succeed early and just do the device-add part when the host shows up. The problem is there's still mipi_dsi_attach(), which needs to be delayed until the panel driver fills in the rest of mipi_dsi_device's fields. Why aren't those part of the info?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
Quoted 68 lines · Eric Anholt
Quoted 61 lines · Boris Brezillon
Quoted 40 lines · On Thu, 22 Jun 2017 13:47:43 +0530 Archit Taneja…
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.Quoted 4 lines
I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.How about making DSI dev registration fully asynchronous, that is, DSI devs declared in the DT under the DSI host node will be registered/attached at probe time, and devs using another control bus (like the adv7533 controller over i2c) will be registered afterwards.
That implies moving the
drm_brigeregistration logic outside of the DSI host ->probe() path. The idea would be to check if all devs connected to the DSI bus are ready atdsi_host->attach()time. If they are, we can finally register the XXX -> DSI bridge. If they're not (because some devs connected to the DSI bus have not been probed yet), then we do not register thedrm_bridgeand wait for the nextdsi_host->attach()event.Quoted 4 lines
With this solution, I think we can avoid the chicken&egg problem where the adv7533 dev is waiting for the DSI host to be probed to be able to register a DSI dev with
mipi_dsi_device_register_full()and the DSI host needs all devs to be registered to not return -EPROBE_DEFER.
Quoted 5 lines
I've now tried having
mipi_dsi_device_register_full()succeed early and just do the device-add part when the host shows up. The problem is there's stillmipi_dsi_attach(), which needs to be delayed until the panel driver fills in the rest of mipi_dsi_device's fields. Why aren't those part of the info?
In the past, the only way to create mipi_dsi_devices was to add them as children DT nodes under the DSI host node. The KMS driver calls mipi_dsi_host_register(), which resulted in the creation of all the children mipi_dsi_devices. The DSI host was still unaware of parameters like number of lanes, mode_flags etc. mipi_dsi_attach() was a way by which the DSI device could share these with its DSI host. Another use of mipi_dsi_attach()/detach() is if the panel driver wants to notify the DSI host an update in one of the device's fields (for example, a change in the number of lanes).
We've recently added another way of creating mipi_dsi_devices (i.e, by making a driver call mipi_dsi_device_register_full) for cases where there isn't a DT representation of the DSI device.
For the second method, the need to call mipi_dsi_attach() separately becomes sort of redundant. We could consider embedding the other mipi_dsi_device fields (lanes etc) in mipi_dsi_device_info itself, and invoke the DSI host's ->attach() callback through mipi_dsi_device_register_full() itself. Would that help resolving your issue?
Archit
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Archit TanejaQuoted 54 lines · Archit Taneja
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.Quoted 6 lines
Quoted 5 lines
Another alternative is my original version of the panel driver that was a
mipi_dsi_devicedriver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
Quoted 13 lines
This would require you to have a DSI device node in DT, rather than an i2c node, right? I don't know if we should do that because of a limitation in our
drm_mipi_dsianddrm_panelframeworks.Does anyone have better ideas?
Thanks,
ArchitQuoted 4 lines
+ Philippe in copy because we have the same probing issue when adding panel-bridge
with the dsi bridge
When adding panel-bridge support to the Synopsys DesignWare DSI bridge, I came to the conclusion that the only solution to make it works properly (without patching drm) was to "add the DSI bridge" at the end of the dw_mipi_dsi_host_attach() (see
https://lists.freedesktop.org/archives/dri-devel/2017-June/144717.html)
ie. defers crtc & encoder probing until the panel-bridge connector is created.
Before that, I spent a lot of time trying different solutions like patching panel-bridge as Eric did (drm_connector_register...), adding bind/unbind() everywhere, debugging around __drm_mode_object_add... Surely DSI Host & device mechanism + panels add complexity to the related connector creation...
After reading this thread, I have no good solution to suggest... and "deferring probing until connector registration" works fine now on my side and seems to be the way others drivers work...
Philippe
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Archit TanejaQuoted 52 lines · Archit Taneja
Quoted 38 lines · Benjamin Gaignard
2017-06-20 19:31 GMT+02:00 Eric Anholt <[email protected]>:
Quoted 37 lines
Quoted 25 lines · Archit Taneja
Quoted 19 lines · Eric Anholt
Quoted 12 lines · Archit Taneja
Quoted 5 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Shouldn't the KMS driver make sure the panel-bridge is set up before
drm_mode_config_reset? Is it the case when we're inserting the panel-bridge driver as a module?Quoted 4 lines
All the connectors that have been added are registered automatically when
drm_dev_register()is called by the KMS driver. Registering a connector in the middle of setting up our driver is prone to race conditions if the userspace decides to use them immediately.Quoted 4 lines
Yeah, this is fixing initializing
panel_bridgeat DSIhost_attachtime, which in the case of a panel module that creates the DSI device (adv7533-style, like you said I should use as a reference) will be afterdrm_mode_config_reset()anddrm_dev_register().Quoted 5 lines
Okay. In the case of the msm kms driver, we defer probe until the adv7533 module is inserted, only then we proceed to
drm_mode_config_reset()anddrm_dev_register(). I assumed this was the general practice followed by most kms drivers. I.,e the kms driver defers probe until all connector related modules are inserted, and only then proceed to create a drm device.The problem, though, is the panel driver needs the MIPI DSI host to exist to call
mipi_dsi_device_register_full()during the probe process. The adv7533 driver gets around this by registering the DSI device in the bridge attach step, butdrm_paneldoesn't have an attach step.I'm not sure how we can get around this. We had discussion about this on irc recently, but couldn't come up with a good conclusion. We could come up with a
panel_attach()callback to make it similar to bridges, but that's just us avoiding the real issue.Quoted 6 lines
Quoted 5 lines
Another alternative is my original version of the panel driver that was a
mipi_dsi_devicedriver that registered the panel during the DSI device probe. That's why vc4's panel lookup is during the MIPI DSI attach phase, currently.
Quoted 3 lines
This would require you to have a DSI device node in DT, rather than an i2c node, right? I don't know if we should do that because of a limitation in our
drm_mipi_dsianddrm_panelframeworks.
All versions of this patch have had one of those, because either that's where you attach the driver (the first, no-core-changes version of the driver) or you need it for the of-graph connections anyway. These later versions just haven't had a compatible string on the DSI device node.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/bridge: Support hotplugging panel-bridge.
In reply to Eric AnholtQuoted 6 lines · Eric Anholt
If the panel-bridge is being set up after the
drm_mode_config_reset(), then the connector's state would never get initialized, and we'd dereference the NULL in the hotplug path. We also need to register the connector, so that userspace can get at it.Signed-off-by Eric Anholt <[email protected]>
I've not read all the details of the discussion here, just a comment on what this implies if we go with this.
drivers/gpu/drm/bridge/panel.c static int panel_bridge_attach(struct drm_bridge *bridge) · line 85
Quoted 13 lines
--- drivers/gpu/drm/bridge/panel.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/bridge/panel.c +1
-0@@ -82,11 +82,14 @@ static int panel_bridge_attach(struct drm_bridge *bridge)drm_mode_connector_attach_encoder (&panel_bridge->connector, bridge->encoder); +drm_atomic_helper_connector_reset (&panel_bridge->connector);
I'm not sure we want to tie the ->reset stuff in with other helpers. One of the design goals I had with all things atomic was to make helpers much more modular, and imo the reset is one such piece - a driver might want to instead reconstruct state from hw using something like i915's hw state readout/compare/verify framework.
If we can solve this init ordering issue without adding a depency on the reset stuff that would be a bit neater imo. But that's just my 2 cents.
Cheers, Daniel
Quoted 17 lines
drivers/gpu/drm/bridge/panel.c +2
-0ret =drm_panel_attach (panel_bridge->panel, &panel_bridge->connector);if (ret <0 )return ret; +drm_connector_register (&panel_bridge->connector); +return 0 ; }Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 drm/vc4: Fix DSI T_INIT timing.
In reply to Eric AnholtThe DPHY spec requires a much larger T_INIT than I was specifying before. In the absence of clear specs from the slave of what their timing is, just use the value that the firmware was using.
--- drivers/gpu/drm/vc4/vc4_dsi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +11 -1
@@ -1035,7 +1035,17 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) DSI_HS_DLT4_TRAIL) | VC4_SET_FIELD(0, DSI_HS_DLT4_ANLAT)); -DSI_PORT_WRITE (HS_DLT5 ,VC4_SET_FIELD (dsi_hs_timing (ui_ns,1000 ,5000 ), +/* T_INIT is how long STOP is driven after power-up to +* indicate to the slave (also coming out of power-up) that +* master init is complete, and should be greater than the +* maximum of two value: T_INIT,MASTER and T_INIT,SLAVE. The +* D-PHY spec gives a minimum 100us for T_INIT,MASTER and +* T_INIT,SLAVE, while allowing protocols on top of it to give +* greater minimums. The vc4 firmware uses an extremely +* conservative 5ms, and we maintain that here. +*/ +DSI_PORT_WRITE (HS_DLT5 ,VC4_SET_FIELD (dsi_hs_timing (ui_ns, +5 *1000 *1000 ,0 ),DSI_HS_DLT5_INIT )); DSI_PORT_WRITE(HS_DLT6,
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/7 drm/vc4: Fix misleading name of the continuous flag.
In reply to Eric AnholtThe logic was all right in the end, the name was just backwards.
--- drivers/gpu/drm/vc4/vc4_dsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +4 -4
@@ -736,18 +736,18 @@ static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch)/* Enters or exits Ultra Low Power State. */ static void vc4_dsi_ulps (struct vc4_dsi *dsi,bool ulps) { -bool continuous = dsi->mode_flags &MIPI_DSI_CLOCK_NON_CONTINUOUS ; -u32 phyc_ulps = ((continuous ?DSI_PORT_BIT (PHYC_CLANE_ULPS ) :0 ) | +bool non_continuous = dsi->mode_flags &MIPI_DSI_CLOCK_NON_CONTINUOUS ; +u32 phyc_ulps = ((non_continuous ?DSI_PORT_BIT (PHYC_CLANE_ULPS ) :0 ) |DSI_PHYC_DLANE0_ULPS | (dsi->lanes >1 ?DSI_PHYC_DLANE1_ULPS :0 ) | (dsi->lanes >2 ?DSI_PHYC_DLANE2_ULPS :0 ) | (dsi->lanes >3 ?DSI_PHYC_DLANE3_ULPS :0 )); -u32 stat_ulps = ((continuous ?DSI1_STAT_PHY_CLOCK_ULPS :0 ) | +u32 stat_ulps = ((non_continuous ?DSI1_STAT_PHY_CLOCK_ULPS :0 ) |DSI1_STAT_PHY_D0_ULPS | (dsi->lanes >1 ?DSI1_STAT_PHY_D1_ULPS :0 ) | (dsi->lanes >2 ?DSI1_STAT_PHY_D2_ULPS :0 ) | (dsi->lanes >3 ?DSI1_STAT_PHY_D3_ULPS :0 )); - u32 stat_stop = ((continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | + u32 stat_stop = ((non_continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | DSI1_STAT_PHY_D0_STOP | (dsi->lanes > 1 ? DSI1_STAT_PHY_D1_STOP : 0) | (dsi->lanes > 2 ? DSI1_STAT_PHY_D2_STOP : 0) |
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.
In reply to Eric AnholtI'm not sure what changed where I started getting vrefresh=0 from the mode to be fixed up.
--- drivers/gpu/drm/vc4/vc4_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +3 -1
@@ -866,7 +866,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, adjusted_mode->clock = pixel_clock_hz /1000 +1 ;/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ - adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal); + adjusted_mode->htotal = pixel_clock_hz / (drm_mode_vrefresh (mode) * + mode->vtotal); + adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal; adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 dt-bindings: Document the Raspberry Pi Touchscreen nodes.
In reply to Eric AnholtThis doesn't yet cover input, but the driver does get the display working when the firmware is disabled from talking to our I2C lines.
--- .../panel/raspberrypi,7inch-touchscreen.txt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt
Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt new file +49 -0
@@ -0,0 +1,49 @@ +This binding covers the official 7" (800x480) Raspberry Pi touchscreen +panel. + +This DSI panel contains: + +- TC358762 DSI->DPI bridge +- Atmel microcontroller on I2C for power sequencing the DSI bridge and + controlling backlight +- Touchscreen controller on I2C for touch input + +and this binding covers the DSI display parts but not its touch input. + +Required properties: +- compatible: Must be "raspberrypi,7inch-touchscreen-panel" +- reg: Must be "45" +- port: See panel-common.txt + +Example: + +dsi1: dsi@7e700000 { + #address-cells = <1>; + #size-cells = <0>; + <...> + + port { + dsi_out_port: endpoint { + remote-endpoint = <&panel_dsi_port>; + }; + }; +}; + +i2c_dsi: i2c { + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + gpios = <&gpio 28 0 + &gpio 29 0>; + + lcd@45 { + compatible = "raspberrypi,7inch-touchscreen-panel"; + reg = <0x45>; + + port { + panel_dsi_port: endpoint { + remote-endpoint = <&dsi_out_port>; + }; + }; + }; +};
Signature · 1 line
2.11.0
Re: [PATCH 5/7] dt-bindings: Document the Raspberry Pi Touchscreen nodes.
Quoted 8 lines · Eric Anholt
This doesn't yet cover input, but the driver does get the display working when the firmware is disabled from talking to our I2C lines.
Signed-off-by Eric Anholt <[email protected]>--- .../panel/raspberrypi,7inch-touchscreen.txt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.txt
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/7 drm/panel: Add support for the Raspberry Pi 7" Touchscreen.
In reply to Eric AnholtThis driver communicates with the Atmel microcontroller for sequencing the poweron of the TC358762 DSI-DPI bridge and controlling the backlight PWM.
v2: Set the same default orientation as the closed source firmware
used, which is the best for viewing angle.
v3: Rewrite as an i2c client driver after bridge driver rejection.
--- drivers/gpu/drm/panel/Kconfig | 8 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-raspberrypi-touchscreen.c | 507 +++++++++++++++++++++ 3 files changed, 516 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
drivers/gpu/drm/panel/Kconfig +8 -0
@@ -62,6 +62,14 @@ config DRM_PANEL_PANASONIC_VVX10F034N00 WUXGA (1920x1200) Novatek NT1397-based DSI panel as found in some Xperia Z2 tablets +config DRM_PANEL_RASPBERRYPI_TOUCHSCREEN + tristate "Raspberry Pi 7-inch touchscreen panel" + depends on DRM_MIPI_DSI + help + Say Y here if you want to enable support for the Raspberry + Pi 7" Touchscreen. To compile this driver as a module, + choose M here. + config DRM_PANEL_SAMSUNG_S6E3HA2 tristate "Samsung S6E3HA2 DSI video mode panel" depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o +obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c new file +507 -0
507 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/7 ARM: dts: bcm2835: Enable the Raspberry Pi touchscreen panel.
In reply to Eric AnholtThis commit is not intended to be merged. Instead we will use overlays to enable the panel, and this commit is just a demo of how things get wired up.
--- arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 5 ++++ arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 5 ++++ arch/arm/boot/dts/bcm2835-rpi-b.dts | 5 ++++ arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 5 ++++ arch/arm/boot/dts/bcm283x.dtsi | 30 +++++++++++++++++++++++- arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 5 ++++ 6 files changed, 54 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +5 -0
@@ -101,3 +101,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; }; + +&i2c_dsi { + gpios = <&gpio 28 0 + &gpio 29 0>; +};
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +5 -0
@@ -94,3 +94,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; }; + +&i2c_dsi { + gpios = <&gpio 2 0 + &gpio 3 0>; +};
arch/arm/boot/dts/bcm2835-rpi-b.dts +5 -0
@@ -89,3 +89,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; }; + +&i2c_dsi { + gpios = <&gpio 0 0 + &gpio 1 0>; +};
arch/arm/boot/dts/bcm2836-rpi-2-b.dts +5 -0
@@ -39,3 +39,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; }; + +&i2c_dsi { + gpios = <&gpio 28 0 + &gpio 29 0>; +};
arch/arm/boot/dts/bcm283x.dtsi +29 -1
@@ -505,7 +505,11 @@ "dsi1_ddr2", "dsi1_ddr"; - status = "disabled"; + port { + dsi_out_port: endpoint { + remote-endpoint = <&panel_dsi_port>; + }; + }; }; i2c1: i2c@7e804000 {
@@ -575,6 +579,30 @@ vc4: gpu { compatible = "brcm,bcm2835-vc4"; }; + + i2c_dsi: i2c { + /* We have to use i2c-gpio because the + * firmware is also polling another device + * using the only hardware I2C bus that could + * connect to these pins. + */ + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + gpios = <&gpio 28 0 + &gpio 29 0>; + + lcd@45 { + compatible = "raspberrypi,7inch-touchscreen-panel"; + reg = <0x45>; + + port { + panel_dsi_port: endpoint { + remote-endpoint = <&dsi_out_port>; + }; + }; + }; + }; }; clocks {
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +5 -0
@@ -22,3 +22,8 @@ &uart1 { status = "okay"; }; + +&i2c_dsi { + gpios = <&gpio 44 0 + &gpio 45 0>; +};
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel