From: Andrzej Hajda <a.hajda@samsung.com> To: Jacopo Mondi <jacopo+renesas@jmondi.org>, architt@codeaurora.org, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, horms@verge.net.au, magnus.damm@gmail.com, geert@linux-m68k.org, niklas.soderlund@ragnatech.se, sergei.shtylyov@cogentembedded.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] drm: bridge: Add LVDS decoder driver Date: Mon, 12 Mar 2018 09:26:33 +0100 [thread overview] Message-ID: <c698987c-5fec-da8a-c2a0-80bf11b579a8@samsung.com> (raw) In-Reply-To: <1520603500-15218-3-git-send-email-jacopo+renesas@jmondi.org> On 09.03.2018 14:51, Jacopo Mondi wrote: > Add transparent LVDS decoder driver. > > A transparent LVDS decoder is a DRM bridge device that does not require > any configuration and converts LVDS input to digital CMOS/TTL parallel > data output. Neither code, neither bindings are LVDS specific, this is driver for any bridge w/o configuration. I am not sure how many bridges does not need configuration, usually they need to be powered at least. I guess in many cases power line is always on, but this is board specific not device specific. Looking at previous version of the patchset it looks little bit as a hack, and certainly it will be a hack in case of R-Car Gen3 V3M Eagle, which I guess you want to use it. > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> > --- > drivers/gpu/drm/bridge/Kconfig | 8 +++ > drivers/gpu/drm/bridge/Makefile | 1 + > drivers/gpu/drm/bridge/lvds-decoder.c | 129 ++++++++++++++++++++++++++++++++++ > 3 files changed, 138 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/lvds-decoder.c > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > index 3b99d5a..e52a5af 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -32,6 +32,14 @@ config DRM_DUMB_VGA_DAC > help > Support for RGB to VGA DAC based bridges > > +config DRM_LVDS_DECODER > + tristate "Transparent LVDS to parallel decoder support" > + depends on OF > + select DRM_PANEL_BRIDGE > + help > + Support for transparent LVDS to parallel decoders that don't require > + any configuration. > + > config DRM_LVDS_ENCODER > tristate "Transparent parallel to LVDS encoder support" > depends on OF > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > index 373eb28..edc2332 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -1,6 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o > obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o > +obj-$(CONFIG_DRM_LVDS_DECODER) += lvds-decoder.o > obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o > obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o > obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o > diff --git a/drivers/gpu/drm/bridge/lvds-decoder.c b/drivers/gpu/drm/bridge/lvds-decoder.c > new file mode 100644 > index 0000000..319f4d5 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/lvds-decoder.c > @@ -0,0 +1,129 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * LVDS to parallel data DRM bridge driver. > + * > + * Copyright (C) 2018 Jacopo Mondi <jacopo+renesas@jmondi.org> > + */ > + > +#include <drm/drmP.h> > +#include <drm/drm_bridge.h> > +#include <drm/drm_panel.h> > + > +#include <linux/of_graph.h> > + > +struct lvds_decoder { > + struct device *dev; > + > + struct drm_bridge bridge; > + struct drm_bridge *next; > + struct drm_encoder *bridge_encoder; Unused field. Regards Andrzej > +}; > + > +static inline struct lvds_decoder *to_lvds_decoder(struct drm_bridge *bridge) > +{ > + return container_of(bridge, struct lvds_decoder, bridge); > +} > + > +static int lvds_decoder_attach(struct drm_bridge *bridge) > +{ > + struct lvds_decoder *lvds = to_lvds_decoder(bridge); > + > + return drm_bridge_attach(bridge->encoder, lvds->next, bridge); > +} > + > +struct drm_bridge_funcs lvds_dec_bridge_func = { > + .attach = lvds_decoder_attach, > +}; > + > +static int lvds_decoder_parse_dt(struct lvds_decoder *lvds) > +{ > + struct device_node *lvds_output; > + struct device_node *remote; > + int ret = 0; > + > + lvds_output = of_graph_get_endpoint_by_regs(lvds->dev->of_node, 1, -1); > + if (!lvds_output) { > + dev_err(lvds->dev, "Missing endpoint in Port@1\n"); > + return -ENODEV; > + } > + > + remote = of_graph_get_remote_port_parent(lvds_output); > + if (!remote) { > + dev_err(lvds->dev, "Endpoint in Port@1 unconnected\n"); > + ret = -ENODEV; > + goto error_put_lvds_node; > + } > + > + if (!of_device_is_available(remote)) { > + dev_err(lvds->dev, "Port@1 remote endpoint is disabled\n"); > + ret = -ENODEV; > + goto error_put_remote_node; > + } > + > + lvds->next = of_drm_find_bridge(remote); > + if (!lvds->next) > + ret = -EPROBE_DEFER; > + > +error_put_remote_node: > + of_node_put(remote); > +error_put_lvds_node: > + of_node_put(lvds_output); > + > + return ret; > +} > + > +static int lvds_decoder_probe(struct platform_device *pdev) > +{ > + struct lvds_decoder *lvds; > + int ret; > + > + lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); > + if (!lvds) > + return -ENOMEM; > + > + lvds->dev = &pdev->dev; > + platform_set_drvdata(pdev, lvds); > + > + ret = lvds_decoder_parse_dt(lvds); > + if (ret) > + return ret; > + > + lvds->bridge.driver_private = lvds; > + lvds->bridge.of_node = pdev->dev.of_node; > + lvds->bridge.funcs = &lvds_dec_bridge_func; > + > + drm_bridge_add(&lvds->bridge); > + > + return 0; > +} > + > +static int lvds_decoder_remove(struct platform_device *pdev) > +{ > + struct lvds_decoder *lvds = platform_get_drvdata(pdev); > + > + drm_bridge_remove(&lvds->bridge); > + > + return 0; > +} > + > +#ifdef CONFIG_OF > +static const struct of_device_id lvds_decoder_match[] = { > + { .compatible = "lvds-decoder", }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, lvds_decoder_match); > +#endif > + > +static struct platform_driver lvds_decoder_driver = { > + .probe = lvds_decoder_probe, > + .remove = lvds_decoder_remove, > + .driver = { > + .name = "lvds_decoder", > + .of_match_table = lvds_decoder_match, > + }, > +}; > +module_platform_driver(lvds_decoder_driver); > + > +MODULE_AUTHOR("Jacopo Mondi <jacopo@jmondi.org>"); > +MODULE_DESCRIPTION("Transparent LVDS to parallel data decoder"); > +MODULE_LICENSE("GPL v2"); > -- > 2.7.4 > > > >
WARNING: multiple messages have this Message-ID (diff)
From: Andrzej Hajda <a.hajda@samsung.com> To: Jacopo Mondi <jacopo+renesas@jmondi.org>, architt@codeaurora.org, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, horms@verge.net.au, magnus.damm@gmail.com, geert@linux-m68k.org, niklas.soderlund@ragnatech.se, sergei.shtylyov@cogentembedded.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 2/3] drm: bridge: Add LVDS decoder driver Date: Mon, 12 Mar 2018 09:26:33 +0100 [thread overview] Message-ID: <c698987c-5fec-da8a-c2a0-80bf11b579a8@samsung.com> (raw) In-Reply-To: <1520603500-15218-3-git-send-email-jacopo+renesas@jmondi.org> On 09.03.2018 14:51, Jacopo Mondi wrote: > Add transparent LVDS decoder driver. > > A transparent LVDS decoder is a DRM bridge device that does not require > any configuration and converts LVDS input to digital CMOS/TTL parallel > data output. Neither code, neither bindings are LVDS specific, this is driver for any bridge w/o configuration. I am not sure how many bridges does not need configuration, usually they need to be powered at least. I guess in many cases power line is always on, but this is board specific not device specific. Looking at previous version of the patchset it looks little bit as a hack, and certainly it will be a hack in case of R-Car Gen3 V3M Eagle, which I guess you want to use it. > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> > --- > drivers/gpu/drm/bridge/Kconfig | 8 +++ > drivers/gpu/drm/bridge/Makefile | 1 + > drivers/gpu/drm/bridge/lvds-decoder.c | 129 ++++++++++++++++++++++++++++++++++ > 3 files changed, 138 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/lvds-decoder.c > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > index 3b99d5a..e52a5af 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -32,6 +32,14 @@ config DRM_DUMB_VGA_DAC > help > Support for RGB to VGA DAC based bridges > > +config DRM_LVDS_DECODER > + tristate "Transparent LVDS to parallel decoder support" > + depends on OF > + select DRM_PANEL_BRIDGE > + help > + Support for transparent LVDS to parallel decoders that don't require > + any configuration. > + > config DRM_LVDS_ENCODER > tristate "Transparent parallel to LVDS encoder support" > depends on OF > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > index 373eb28..edc2332 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -1,6 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o > obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o > +obj-$(CONFIG_DRM_LVDS_DECODER) += lvds-decoder.o > obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o > obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o > obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o > diff --git a/drivers/gpu/drm/bridge/lvds-decoder.c b/drivers/gpu/drm/bridge/lvds-decoder.c > new file mode 100644 > index 0000000..319f4d5 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/lvds-decoder.c > @@ -0,0 +1,129 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * LVDS to parallel data DRM bridge driver. > + * > + * Copyright (C) 2018 Jacopo Mondi <jacopo+renesas@jmondi.org> > + */ > + > +#include <drm/drmP.h> > +#include <drm/drm_bridge.h> > +#include <drm/drm_panel.h> > + > +#include <linux/of_graph.h> > + > +struct lvds_decoder { > + struct device *dev; > + > + struct drm_bridge bridge; > + struct drm_bridge *next; > + struct drm_encoder *bridge_encoder; Unused field. Regards Andrzej > +}; > + > +static inline struct lvds_decoder *to_lvds_decoder(struct drm_bridge *bridge) > +{ > + return container_of(bridge, struct lvds_decoder, bridge); > +} > + > +static int lvds_decoder_attach(struct drm_bridge *bridge) > +{ > + struct lvds_decoder *lvds = to_lvds_decoder(bridge); > + > + return drm_bridge_attach(bridge->encoder, lvds->next, bridge); > +} > + > +struct drm_bridge_funcs lvds_dec_bridge_func = { > + .attach = lvds_decoder_attach, > +}; > + > +static int lvds_decoder_parse_dt(struct lvds_decoder *lvds) > +{ > + struct device_node *lvds_output; > + struct device_node *remote; > + int ret = 0; > + > + lvds_output = of_graph_get_endpoint_by_regs(lvds->dev->of_node, 1, -1); > + if (!lvds_output) { > + dev_err(lvds->dev, "Missing endpoint in Port@1\n"); > + return -ENODEV; > + } > + > + remote = of_graph_get_remote_port_parent(lvds_output); > + if (!remote) { > + dev_err(lvds->dev, "Endpoint in Port@1 unconnected\n"); > + ret = -ENODEV; > + goto error_put_lvds_node; > + } > + > + if (!of_device_is_available(remote)) { > + dev_err(lvds->dev, "Port@1 remote endpoint is disabled\n"); > + ret = -ENODEV; > + goto error_put_remote_node; > + } > + > + lvds->next = of_drm_find_bridge(remote); > + if (!lvds->next) > + ret = -EPROBE_DEFER; > + > +error_put_remote_node: > + of_node_put(remote); > +error_put_lvds_node: > + of_node_put(lvds_output); > + > + return ret; > +} > + > +static int lvds_decoder_probe(struct platform_device *pdev) > +{ > + struct lvds_decoder *lvds; > + int ret; > + > + lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); > + if (!lvds) > + return -ENOMEM; > + > + lvds->dev = &pdev->dev; > + platform_set_drvdata(pdev, lvds); > + > + ret = lvds_decoder_parse_dt(lvds); > + if (ret) > + return ret; > + > + lvds->bridge.driver_private = lvds; > + lvds->bridge.of_node = pdev->dev.of_node; > + lvds->bridge.funcs = &lvds_dec_bridge_func; > + > + drm_bridge_add(&lvds->bridge); > + > + return 0; > +} > + > +static int lvds_decoder_remove(struct platform_device *pdev) > +{ > + struct lvds_decoder *lvds = platform_get_drvdata(pdev); > + > + drm_bridge_remove(&lvds->bridge); > + > + return 0; > +} > + > +#ifdef CONFIG_OF > +static const struct of_device_id lvds_decoder_match[] = { > + { .compatible = "lvds-decoder", }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, lvds_decoder_match); > +#endif > + > +static struct platform_driver lvds_decoder_driver = { > + .probe = lvds_decoder_probe, > + .remove = lvds_decoder_remove, > + .driver = { > + .name = "lvds_decoder", > + .of_match_table = lvds_decoder_match, > + }, > +}; > +module_platform_driver(lvds_decoder_driver); > + > +MODULE_AUTHOR("Jacopo Mondi <jacopo@jmondi.org>"); > +MODULE_DESCRIPTION("Transparent LVDS to parallel data decoder"); > +MODULE_LICENSE("GPL v2"); > -- > 2.7.4 > > > > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-03-12 8:26 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20180309135207epcas3p32a7d3a0e9c9dae5af8fc855ff3c0e03b@epcas3p3.samsung.com> 2018-03-09 13:51 ` [PATCH v2 0/3] drm: Add LVDS decoder bridge Jacopo Mondi 2018-03-09 13:51 ` [PATCH v2 1/3] dt-bindings: display: bridge: Document LVDS to parallel decoder Jacopo Mondi 2018-03-09 13:51 ` [PATCH v2 2/3] drm: bridge: Add LVDS decoder driver Jacopo Mondi 2018-03-12 8:26 ` Andrzej Hajda [this message] 2018-03-12 8:26 ` Andrzej Hajda 2018-03-20 15:42 ` Vladimir Zapolskiy 2018-03-20 15:42 ` Vladimir Zapolskiy 2018-03-09 13:51 ` [PATCH v2 3/3] arm64: dts: renesas: Add LVDS decoder to R-Car V3M Eagle Jacopo Mondi 2018-03-09 14:49 ` Simon Horman 2018-03-09 17:30 ` Sergei Shtylyov 2018-03-09 17:30 ` Sergei Shtylyov 2018-03-10 17:22 ` jacopo mondi 2018-03-10 17:22 ` jacopo mondi 2018-03-10 5:53 ` [PATCH v2 0/3] drm: Add LVDS decoder bridge Archit Taneja 2018-03-10 5:53 ` Archit Taneja 2018-03-10 18:00 ` jacopo mondi 2018-03-10 18:00 ` jacopo mondi 2018-03-20 12:19 ` Laurent Pinchart 2018-03-20 12:19 ` Laurent Pinchart 2018-03-12 9:07 ` Andrzej Hajda 2018-03-12 9:07 ` Andrzej Hajda 2018-03-12 12:30 ` jacopo mondi 2018-03-12 13:47 ` Andrzej Hajda 2018-03-12 13:47 ` Andrzej Hajda 2018-03-12 14:11 ` jacopo mondi 2018-03-12 14:11 ` jacopo mondi
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=c698987c-5fec-da8a-c2a0-80bf11b579a8@samsung.com \ --to=a.hajda@samsung.com \ --cc=Laurent.pinchart@ideasonboard.com \ --cc=airlied@linux.ie \ --cc=architt@codeaurora.org \ --cc=devicetree@vger.kernel.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=geert@linux-m68k.org \ --cc=horms@verge.net.au \ --cc=jacopo+renesas@jmondi.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=magnus.damm@gmail.com \ --cc=mark.rutland@arm.com \ --cc=niklas.soderlund@ragnatech.se \ --cc=robh+dt@kernel.org \ --cc=sergei.shtylyov@cogentembedded.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.