From: Eric Anholt <eric@anholt.net>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Yannick Fertre <yannick.fertre@st.com>
Subject: Re: [PATCH 1/2] drm/bridge: Refactor out the panel wrapper from the lvds-encoder bridge.
Date: Thu, 27 Apr 2017 10:27:38 -0700 [thread overview]
Message-ID: <87inlphib9.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <20170427163601.7313-1-eric@anholt.net>
[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]
Eric Anholt <eric@anholt.net> writes:
> Many DRM drivers have common code to make a stub connector
> implementation that wraps a drm_panel. By wrapping the panel in a DRM
> bridge, all of the connector code (including calls during encoder
> enable/disable) goes away.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> +/**
> + * drm_panel_bridge_add - Creates a drm_bridge and drm_connector that
> + * just call the appropriate functions from drm_panel.
> + *
> + * @dev: The struct device of the panel device. This is used for
> + * registering the drm_bridge.
> + * @panel: The drm_panel being wrapped. Must be non-NULL.
> + * @connector_type: The DRM_MODE_CONNECTOR_* for the connector to be
> + * created.
> + *
> + * For drivers converting from directly using drm_panel: The expected
> + * usage pattern is that during either encoder module probe or DSI
> + * host attach, a drm_panel will be looked up through
> + * drm_of_find_panel_or_bridge(). drm_panel_bridge_add() is used to
> + * wrap that panel in the new bridge, and the result can then be
> + * passed to drm_bridge_attach(). The drm_panel_prepare() and related
> + * functions can be dropped from the encoder driver (they're now
> + * called by the KMS helpers before calling into the encoder), along
> + * with connector creation.
> + */
> +struct drm_bridge *drm_panel_bridge_add(struct device *dev,
> + struct drm_panel *panel,
> + u32 connector_type)
> +{
> + struct panel_bridge *panel_bridge =
> + devm_kzalloc(dev, sizeof(*panel_bridge), GFP_KERNEL);
> + int ret;
> +
> + if (!dev || !panel)
> + return ERR_PTR(EINVAL);
> +
> + panel_bridge->dev = dev;
> + panel_bridge->connector_type = connector_type;
> + panel_bridge->panel = panel;
> +
> + panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs;
> + panel_bridge->bridge.of_node = dev->of_node;
> +
> + ret = drm_bridge_add(&panel_bridge->bridge);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + return &panel_bridge->bridge;
> +}
> +EXPORT_SYMBOL(drm_panel_bridge_add);
> +
> +void drm_panel_bridge_remove(struct device *dev, struct drm_bridge *bridge)
> +{
> + drm_bridge_remove(bridge);
> + devm_kfree(dev, bridge);
> +}
> +EXPORT_SYMBOL(drm_panel_bridge_remove);
Working with this interface in another driver, I want to drop the
"struct device" argument, since we can get the struct device from
panel->dev. It keeps the user of the driver from needing to keep track
of the panel/device it needs to hand to drm_panel_bridge_remove().
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-04-27 17:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 16:36 Eric Anholt
2017-04-27 16:36 ` [PATCH 2/2] drm/vc4: Switch to using the panel-bridge layer, and support bridges Eric Anholt
2017-04-27 17:27 ` Eric Anholt [this message]
2017-05-03 9:23 ` [PATCH 1/2] drm/bridge: Refactor out the panel wrapper from the lvds-encoder bridge Archit Taneja
2017-05-03 9:32 ` Laurent Pinchart
2017-05-03 9:32 ` Daniel Vetter
2017-05-03 9:36 ` Laurent Pinchart
2017-05-03 14:28 ` Daniel Vetter
2017-05-03 14:44 ` Laurent Pinchart
2017-05-03 16:17 ` Eric Anholt
2017-05-04 5:44 ` Daniel Vetter
2017-05-04 12:35 ` Thierry Reding
2017-05-05 6:22 ` Andrzej Hajda
2017-05-03 16:30 ` Eric Anholt
2017-05-04 8:58 ` Archit Taneja
2017-05-03 9:36 ` Daniel Vetter
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=87inlphib9.fsf@eliezer.anholt.net \
--to=eric@anholt.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yannick.fertre@st.com \
/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
all inboxes | Powered by JetHome®