From: Mark Zhang <nvmarkzhang@gmail.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Thierry Reding <thierry.reding@avionic-design.de>,
Stephen Warren <swarren@wwwdotorg.org>,
Mark Zhang <markz@nvidia.com>,
linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
linux-tegra@vger.kernel.org, gnurou@gmail.com
Subject: Re: [RFC 3/4] drm: tegra: use the Common Display Framework
Date: Wed, 30 Jan 2013 14:50:00 +0800 [thread overview]
Message-ID: <5108C298.1000500@gmail.com> (raw)
In-Reply-To: <1359514939-15653-4-git-send-email-acourbot@nvidia.com>
On 01/30/2013 11:02 AM, Alexandre Courbot wrote:
> Make the tegra-drm driver use the Common Display Framework, letting it
> control the panel state according to the DPMS status.
>
> A "nvidia,panel" property is added to the output node of the Tegra DC
> that references the panel connected to a given output.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
[...]
> diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
> index 741b5dc..5e63c56 100644
> --- a/drivers/gpu/drm/tegra/drm.h
> +++ b/drivers/gpu/drm/tegra/drm.h
> @@ -17,6 +17,7 @@
> #include <drm/drm_gem_cma_helper.h>
> #include <drm/drm_fb_cma_helper.h>
> #include <drm/drm_fixed.h>
> +#include <video/display.h>
>
> struct tegra_framebuffer {
> struct drm_framebuffer base;
> @@ -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"... :)
> + struct display_entity_notifier display_notifier;
> };
>
[...]
> +static int display_notify_callback(struct display_entity_notifier *notifier,
> + struct display_entity *entity, int event)
> +{
> + struct tegra_output *output = display_notifier_to_output(notifier);
> + struct device_node *pnode;
> +
> + switch (event) {
> + case DISPLAY_ENTITY_NOTIFIER_CONNECT:
> + if (output->output)
> + break;
> +
> + pnode = of_parse_phandle(output->of_node, "nvidia,panel", 0);
> + if (!pnode)
> + break;
> +
> + 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.
Only when you have "display_entity_get", use "display_entity_put" to
release.
> +
> + break;
> +
> + default:
> + dev_dbg(output->dev, "unhandled display event\n");
> + break;
> + }
> +
> + return 0;
> +}
> +
[...]
> int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
> {
> int connector, encoder, err;
> @@ -250,6 +341,23 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
>
> output->encoder.possible_crtcs = 0x3;
>
> + /* 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...).
> + output->this.ops.video = &tegra_output_video_ops;
> + err = display_entity_register(&output->this);
> + if (err) {
> + dev_err(output->dev, "cannot register display entity\n");
> + return err;
> + }
> +
> + /* 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".
> + output->display_notifier.notify = display_notify_callback;
> + err = display_entity_register_notifier(&output->display_notifier);
> + if (err)
> + return err;
> +
> return 0;
>
> free_hpd:
> @@ -260,6 +368,12 @@ free_hpd:
>
> int tegra_output_exit(struct tegra_output *output)
> {
> + if (output->output)
> + display_entity_put(output->output);
> +
> + display_entity_unregister_notifier(&output->display_notifier);
> + display_entity_unregister(&output->this);
> +
> if (gpio_is_valid(output->hpd_gpio)) {
> free_irq(output->hpd_irq, output);
> gpio_free(output->hpd_gpio);
>
next prev parent reply other threads:[~2013-01-30 6:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 3:02 [RFC 0/4] Use the Common Display Framework in tegra-drm Alexandre Courbot
2013-01-30 3:02 ` [RFC 1/4] video: panel: add CLAA101WA01A panel support Alexandre Courbot
2013-01-30 7:20 ` Mark Zhang
2013-01-30 7:27 ` Alex Courbot
2013-01-30 7:48 ` Thierry Reding
2013-01-30 8:08 ` Mark Zhang
2013-01-30 8:28 ` Alex Courbot
2013-01-30 20:19 ` Stephen Warren
2013-01-31 3:51 ` Mark Zhang
2013-01-31 4:24 ` Alexandre Courbot
2013-01-31 4:54 ` Mark Zhang
2013-01-31 6:36 ` Alexandre Courbot
2013-01-31 7:30 ` Mark Zhang
2013-01-31 17:25 ` Stephen Warren
2013-01-31 17:20 ` Stephen Warren
2013-02-01 4:19 ` Mark Zhang
2013-01-30 20:27 ` Stephen Warren
2013-01-31 4:14 ` Alexandre Courbot
2013-01-31 17:23 ` Stephen Warren
2013-01-30 20:30 ` Stephen Warren
2013-01-30 3:02 ` [RFC 2/4] tegra: ventana: add display and backlight DT nodes Alexandre Courbot
2013-01-30 3:02 ` [RFC 3/4] drm: tegra: use the Common Display Framework Alexandre Courbot
2013-01-30 6:50 ` Mark Zhang [this message]
2013-01-30 7:01 ` Alex Courbot
2013-01-30 7:24 ` Thierry Reding
2013-01-30 7:30 ` Alex Courbot
2013-01-30 7:46 ` Mark Zhang
2013-01-30 3:02 ` [RFC 4/4] tegra: enable CDF and claa101 panel Alexandre Courbot
2013-01-30 7:40 ` [RFC 0/4] Use the Common Display Framework in tegra-drm Thierry Reding
2013-01-30 8:23 ` Alex Courbot
2013-01-30 8:38 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5108C298.1000500@gmail.com \
--to=nvmarkzhang@gmail.com \
--cc=acourbot@nvidia.com \
--cc=gnurou@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=markz@nvidia.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@avionic-design.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).