LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se> To: linux-kernel@vger.kernel.org Cc: Peter Rosin <peda@axentia.se>, David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Boris Brezillon <boris.brezillon@free-electrons.com>, Daniel Vetter <daniel.vetter@intel.com>, Gustavo Padovan <gustavo@padovan.org>, Sean Paul <seanpaul@chromium.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Russell King - ARM Linux <linux@armlinux.org.uk>, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/6] drm: of: introduce drm_of_media_bus_fmt Date: Tue, 17 Apr 2018 15:10:49 +0200 [thread overview] Message-ID: <20180417131052.16336-4-peda@axentia.se> (raw) In-Reply-To: <20180417131052.16336-1-peda@axentia.se> Add a central function to parse a node according to the video interface binding and get a media bus format. Start with only supporting a very limited set of a few basic media bus formats. Signed-off-by: Peter Rosin <peda@axentia.se> --- drivers/gpu/drm/drm_of.c | 38 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_of.h | 7 +++++++ 2 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 4c191c050e7d..f9473edb60a7 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -212,6 +212,44 @@ int drm_of_encoder_active_endpoint(struct device_node *node, EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); /* + * drm_of_media_bus_fmt - return the media bus format described in the node + * @node: device tree node containing the media bus format + * + * @node is presumably an of-graph endpoint node. + * + * Return the media bus format, or zero if none is described. Or one of the + * standard error codes. + */ +int drm_of_media_bus_fmt(struct device_node *node) +{ + s32 bus_type; + u32 bus_width = 0; + + if (!node) + return -EINVAL; + + if (of_property_read_u32(node, "bus-type", &bus_type)) + return 0; + if (bus_type != 0) + return -EINVAL; + + of_property_read_u32(node, "bus-width", &bus_width); + switch (bus_width) { + case 12: + return MEDIA_BUS_FMT_RGB444_1X12; + case 16: + return MEDIA_BUS_FMT_RGB565_1X16; + case 18: + return MEDIA_BUS_FMT_RGB666_1X18; + case 24: + return MEDIA_BUS_FMT_RGB888_1X24; + default: + return -EINVAL; + } +} +EXPORT_SYMBOL_GPL(drm_of_media_bus_fmt); + +/* * drm_of_find_panel_or_bridge - return connected panel or bridge device * @np: device tree node containing encoder output ports * @panel: pointer to hold returned drm_panel diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index b93c239afb60..f86f0098b21e 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -29,6 +29,7 @@ int drm_of_component_probe(struct device *dev, int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); +int drm_of_media_bus_fmt(struct device_node *node); int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, @@ -62,6 +63,12 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node, { return -EINVAL; } + +static inline int drm_of_media_bus_fmt(struct device_node *node) +{ + return -EINVAL; +} + static inline int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, -- 2.11.0
next prev parent reply other threads:[~2018-04-17 13:11 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-17 13:10 [PATCH v2 0/6] Add tda998x (HDMI) support to atmel-hlcdc Peter Rosin 2018-04-17 13:10 ` [PATCH v2 1/6] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin 2018-04-17 13:10 ` [PATCH v2 2/6] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin 2018-04-18 7:16 ` Boris Brezillon 2018-04-18 7:31 ` Peter Rosin 2018-04-18 8:29 ` Boris Brezillon 2018-04-17 13:10 ` Peter Rosin [this message] 2018-04-19 16:22 ` [PATCH v2 3/6] drm: of: introduce drm_of_media_bus_fmt Rob Herring 2018-04-19 16:40 ` Peter Rosin 2018-04-17 13:10 ` [PATCH v2 4/6] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin 2018-04-18 7:29 ` Boris Brezillon 2018-04-18 7:46 ` Peter Rosin 2018-04-18 8:27 ` Boris Brezillon 2018-04-17 13:10 ` [PATCH v2 5/6] drm/atmel-hlcdc: add support for connecting to tda998x HDMI encoder Peter Rosin 2018-04-18 7:36 ` Boris Brezillon 2018-04-18 8:02 ` Peter Rosin 2018-04-18 8:41 ` Boris Brezillon 2018-04-17 13:10 ` [PATCH v2 6/6] drm/atmel-hlcdc: fix broken release date Peter Rosin 2018-04-18 7:44 ` Boris Brezillon 2018-04-18 8:09 ` Peter Rosin
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=20180417131052.16336-4-peda@axentia.se \ --to=peda@axentia.se \ --cc=airlied@linux.ie \ --cc=alexandre.belloni@bootlin.com \ --cc=boris.brezillon@free-electrons.com \ --cc=daniel.vetter@intel.com \ --cc=devicetree@vger.kernel.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=gustavo@padovan.org \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=mark.rutland@arm.com \ --cc=nicolas.ferre@microchip.com \ --cc=robh+dt@kernel.org \ --cc=seanpaul@chromium.org \ /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: linkBe 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).