@@ -147,6 +148,9 @@ struct tegra_output {
struct drm_encoder encoder;
struct drm_connector connector;
+ struct display_entity this;
+ struct display_entity *output;
Could you pick up a somewhat meaningful name? You know, there are too
many variables with name "drm/connector/output/encoder"... :)
+ if (entity->dev && entity->dev->of_node == pnode) {
+ dev_dbg(output->dev, "connecting panel\n");
+ output->output = display_entity_get(entity);
+ display_entity_connect(&output->this, output->output);
+ }
+ of_node_put(pnode);
+
+ break;
+
+ case DISPLAY_ENTITY_NOTIFIER_DISCONNECT:
+ if (!output->output || output->output != entity)
+ break;
+
+ dev_dbg(output->dev, "disconnecting panel\n");
+ display_entity_disconnect(&output->this, output->output);
+ output->output = NULL;
+ display_entity_put(&output->this);
No "display_entity_get" for "output->this", so I don't think we need
"display_entity_put" here. If you register this entity with "release"
callback and you wanna release "output->this", call the "release"
function manually.
+ /* register display entity */
+ memset(&output->this, 0, sizeof(output->this));
+ output->this.dev = drm->dev;
Use "output->dev" here. Actually the device you wanna register it to
display entity is the "encoder"(in drm terms), not "drm->dev". If we use
"drm->dev" here, we will have all same device for all encoders(HDMI,
DSI...).
+ /* register display notifier */
+ output->display_notifier.dev = NULL;
Set "display_notifier.dev" to NULL makes we have to compare with every
display entity, just like what you do in "display_notify_callback":
entity->dev && entity->dev->of_node == pnode
So can we get the "struct device *" of panel here? Seems currently the
"of" framework doesn't allow "device_node -> device".