* [PATCH 0/3] Finish Armada DRM DT support @ 2018-07-10 10:23 Russell King - ARM Linux 2018-07-10 10:24 ` [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers Russell King ` (3 more replies) 0 siblings, 4 replies; 7+ messages in thread From: Russell King - ARM Linux @ 2018-07-10 10:23 UTC (permalink / raw) To: linux-arm-kernel Finish Armada DRM support for DT, finally allowing mainline kernels to use this driver unimpeded. arch/arm/boot/dts/dove-cubox.dts | 43 +++++++++++++++++++++++++++++++ drivers/gpu/drm/armada/Makefile | 3 +++ drivers/gpu/drm/armada/armada_drv.c | 29 ++++++++++++++++++--- drivers/gpu/drm/armada/armada_rmem.c | 49 ++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 3 deletions(-) -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up According to speedtest.net: 13Mbps down 490kbps up ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers 2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux @ 2018-07-10 10:24 ` Russell King 2018-07-10 10:24 ` [PATCH 2/3] drm/armada: add OF reserved memory support Russell King ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Russell King @ 2018-07-10 10:24 UTC (permalink / raw) To: linux-arm-kernel The DT node passed for LCD controllers is the "port" node within the parent device. Detect this and compare the parent node. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- drivers/gpu/drm/armada/armada_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index d1705d298a39..217f0590fd61 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -205,7 +205,10 @@ static void armada_drm_unbind(struct device *dev) static int compare_of(struct device *dev, void *data) { - return dev->of_node == data; + struct device_node *np = data; + if (of_node_cmp(np->name, "port") == 0) + np = np->parent; + return dev->of_node == np; } static int compare_dev_name(struct device *dev, void *data) -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] drm/armada: add OF reserved memory support 2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux 2018-07-10 10:24 ` [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers Russell King @ 2018-07-10 10:24 ` Russell King 2018-12-18 15:18 ` Lubomir Rintel 2018-07-10 10:24 ` [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration Russell King 2018-12-18 15:21 ` [PATCH 0/3] Finish Armada DRM DT support Lubomir Rintel 3 siblings, 1 reply; 7+ messages in thread From: Russell King @ 2018-07-10 10:24 UTC (permalink / raw) To: linux-arm-kernel Existing Armada DRM makes use of reserved memory for allocating contiguous screen buffers, which currently prevents its use with DT systems. Add support for this for DT systems. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- drivers/gpu/drm/armada/Makefile | 3 +++ drivers/gpu/drm/armada/armada_drv.c | 24 ++++++++++++++++-- drivers/gpu/drm/armada/armada_rmem.c | 49 ++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/armada/armada_rmem.c diff --git a/drivers/gpu/drm/armada/Makefile b/drivers/gpu/drm/armada/Makefile index ecf25cf9f9f5..0b8bf3b8aa6a 100644 --- a/drivers/gpu/drm/armada/Makefile +++ b/drivers/gpu/drm/armada/Makefile @@ -5,3 +5,6 @@ armada-y += armada_510.o armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o obj-$(CONFIG_DRM_ARMADA) := armada.o + +armada-rmem-$(CONFIG_DRM_ARMADA) += armada_rmem.o +obj-y += $(armada-rmem-y) $(armada-rmem-m) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 217f0590fd61..a9ee492a2810 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -9,6 +9,7 @@ #include <linux/component.h> #include <linux/module.h> #include <linux/of_graph.h> +#include <linux/of_reserved_mem.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_of.h> @@ -96,6 +97,9 @@ static int armada_drm_bind(struct device *dev) return -EINVAL; } + if (!mem && dev->of_node) + mem = dev->platform_data; + if (!mem) return -ENXIO; @@ -250,9 +254,17 @@ static int armada_drm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - ret = drm_of_component_probe(dev, compare_dev_name, &armada_master_ops); - if (ret != -EINVAL) + if (dev->of_node) { + ret = of_reserved_mem_device_init(dev); + if (ret && ret != -ENODEV) + return ret; + + ret = drm_of_component_probe(dev, compare_of, + &armada_master_ops); + if (ret) + of_reserved_mem_device_release(dev); return ret; + } if (dev->platform_data) { char **devices = dev->platform_data; @@ -287,6 +299,7 @@ static int armada_drm_probe(struct platform_device *pdev) static int armada_drm_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &armada_master_ops); + of_reserved_mem_device_release(&pdev->dev); return 0; } @@ -300,11 +313,18 @@ static const struct platform_device_id armada_drm_platform_ids[] = { }; MODULE_DEVICE_TABLE(platform, armada_drm_platform_ids); +static const struct of_device_id armada_drm_dt_ids[] = { + { .compatible = "marvell,dove-display-subsystem", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, armada_drm_dt_ids); + static struct platform_driver armada_drm_platform_driver = { .probe = armada_drm_probe, .remove = armada_drm_remove, .driver = { .name = "armada-drm", + .of_match_table = armada_drm_dt_ids, }, .id_table = armada_drm_platform_ids, }; diff --git a/drivers/gpu/drm/armada/armada_rmem.c b/drivers/gpu/drm/armada/armada_rmem.c new file mode 100644 index 000000000000..36bb20e426b6 --- /dev/null +++ b/drivers/gpu/drm/armada/armada_rmem.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2017 Russell King +#include <linux/errno.h> +#include <linux/of.h> +#include <linux/of_reserved_mem.h> +#include <linux/slab.h> + +static int armada_rmem_dev_init(struct reserved_mem *rmem, struct device *dev) +{ + struct resource *r; + + if (dev->platform_data) + return -EBUSY; + + r = kzalloc(sizeof(*r), GFP_KERNEL); + if (!r) + return -ENOMEM; + + r->start = rmem->base; + r->end = rmem->base + rmem->size - 1; + r->flags = IORESOURCE_MEM; + + rmem->priv = r; + dev->platform_data = r; + + return 0; +} + +static void armada_rmem_dev_release(struct reserved_mem *rmem, + struct device *dev) +{ + kfree(rmem->priv); + rmem->priv = NULL; + dev->platform_data = NULL; +} + +static const struct reserved_mem_ops armada_rmem_ops = { + .device_init = armada_rmem_dev_init, + .device_release = armada_rmem_dev_release, +}; + +static int __init armada_rmem_init(struct reserved_mem *rmem) +{ + rmem->ops = &armada_rmem_ops; + return 0; +} + +RESERVEDMEM_OF_DECLARE(armada_rmem, "marvell,dove-framebuffer", + armada_rmem_init); -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] drm/armada: add OF reserved memory support 2018-07-10 10:24 ` [PATCH 2/3] drm/armada: add OF reserved memory support Russell King @ 2018-12-18 15:18 ` Lubomir Rintel 0 siblings, 0 replies; 7+ messages in thread From: Lubomir Rintel @ 2018-12-18 15:18 UTC (permalink / raw) To: Russell King; +Cc: devicetree, linux-arm-kernel, dri-devel On Tue, 2018-07-10 at 11:24 +0100, Russell King wrote: > Existing Armada DRM makes use of reserved memory for allocating > contiguous screen buffers, which currently prevents its use with > DT systems. Add support for this for DT systems. > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > --- > drivers/gpu/drm/armada/Makefile | 3 +++ > drivers/gpu/drm/armada/armada_drv.c | 24 ++++++++++++++++-- > drivers/gpu/drm/armada/armada_rmem.c | 49 > ++++++++++++++++++++++++++++++++++++ > 3 files changed, 74 insertions(+), 2 deletions(-) > create mode 100644 drivers/gpu/drm/armada/armada_rmem.c > > diff --git a/drivers/gpu/drm/armada/Makefile > b/drivers/gpu/drm/armada/Makefile > index ecf25cf9f9f5..0b8bf3b8aa6a 100644 > --- a/drivers/gpu/drm/armada/Makefile > +++ b/drivers/gpu/drm/armada/Makefile > @@ -5,3 +5,6 @@ armada-y += armada_510.o > armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o > > obj-$(CONFIG_DRM_ARMADA) := armada.o > + > +armada-rmem-$(CONFIG_DRM_ARMADA) += armada_rmem.o > +obj-y += $(armada-rmem-y) $(armada-rmem-m) > diff --git a/drivers/gpu/drm/armada/armada_drv.c > b/drivers/gpu/drm/armada/armada_drv.c > index 217f0590fd61..a9ee492a2810 100644 > --- a/drivers/gpu/drm/armada/armada_drv.c > +++ b/drivers/gpu/drm/armada/armada_drv.c > @@ -9,6 +9,7 @@ > #include <linux/component.h> > #include <linux/module.h> > #include <linux/of_graph.h> > +#include <linux/of_reserved_mem.h> > #include <drm/drm_crtc_helper.h> > #include <drm/drm_fb_helper.h> > #include <drm/drm_of.h> > @@ -96,6 +97,9 @@ static int armada_drm_bind(struct device *dev) > return -EINVAL; > } > > + if (!mem && dev->of_node) > + mem = dev->platform_data; > + > if (!mem) > return -ENXIO; > > @@ -250,9 +254,17 @@ static int armada_drm_probe(struct > platform_device *pdev) > struct device *dev = &pdev->dev; > int ret; > > - ret = drm_of_component_probe(dev, compare_dev_name, > &armada_master_ops); > - if (ret != -EINVAL) > + if (dev->of_node) { > + ret = of_reserved_mem_device_init(dev); > + if (ret && ret != -ENODEV) > + return ret; > + > + ret = drm_of_component_probe(dev, compare_of, > + &armada_master_ops); > + if (ret) > + of_reserved_mem_device_release(dev); > return ret; > + } > > if (dev->platform_data) { > char **devices = dev->platform_data; > @@ -287,6 +299,7 @@ static int armada_drm_probe(struct > platform_device *pdev) > static int armada_drm_remove(struct platform_device *pdev) > { > component_master_del(&pdev->dev, &armada_master_ops); > + of_reserved_mem_device_release(&pdev->dev); > return 0; > } > > @@ -300,11 +313,18 @@ static const struct platform_device_id > armada_drm_platform_ids[] = { > }; > MODULE_DEVICE_TABLE(platform, armada_drm_platform_ids); > > +static const struct of_device_id armada_drm_dt_ids[] = { > + { .compatible = "marvell,dove-display-subsystem", }, > + { /* sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(of, armada_drm_dt_ids); > + > static struct platform_driver armada_drm_platform_driver = { > .probe = armada_drm_probe, > .remove = armada_drm_remove, > .driver = { > .name = "armada-drm", > + .of_match_table = armada_drm_dt_ids, > }, > .id_table = armada_drm_platform_ids, > }; > diff --git a/drivers/gpu/drm/armada/armada_rmem.c > b/drivers/gpu/drm/armada/armada_rmem.c > new file mode 100644 > index 000000000000..36bb20e426b6 > --- /dev/null > +++ b/drivers/gpu/drm/armada/armada_rmem.c > @@ -0,0 +1,49 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2017 Russell King > +#include <linux/errno.h> > +#include <linux/of.h> > +#include <linux/of_reserved_mem.h> > +#include <linux/slab.h> > + > +static int armada_rmem_dev_init(struct reserved_mem *rmem, struct > device *dev) > +{ > + struct resource *r; > + > + if (dev->platform_data) > + return -EBUSY; > + > + r = kzalloc(sizeof(*r), GFP_KERNEL); > + if (!r) > + return -ENOMEM; > + > + r->start = rmem->base; > + r->end = rmem->base + rmem->size - 1; > + r->flags = IORESOURCE_MEM; > + > + rmem->priv = r; > + dev->platform_data = r; > + > + return 0; > +} > + > +static void armada_rmem_dev_release(struct reserved_mem *rmem, > + struct device *dev) > +{ > + kfree(rmem->priv); > + rmem->priv = NULL; > + dev->platform_data = NULL; > +} > + > +static const struct reserved_mem_ops armada_rmem_ops = { > + .device_init = armada_rmem_dev_init, > + .device_release = armada_rmem_dev_release, > +}; > + > +static int __init armada_rmem_init(struct reserved_mem *rmem) > +{ > + rmem->ops = &armada_rmem_ops; > + return 0; > +} > + > +RESERVEDMEM_OF_DECLARE(armada_rmem, "marvell,dove-framebuffer", > + armada_rmem_init); Hi, wouldn't "marvell,armada-framebuffer" make more sense here? The driver will do just well for MMP2 and perhaps more hardware that is not Dove; the DTs could just say: compatible = "marvell,dove-framebuffer", "marvell,armada-framebuffer"; compatible = "marvell,mmp2-framebuffer", "marvell,armada-framebuffer"; Lubo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration 2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux 2018-07-10 10:24 ` [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers Russell King 2018-07-10 10:24 ` [PATCH 2/3] drm/armada: add OF reserved memory support Russell King @ 2018-07-10 10:24 ` Russell King 2018-07-18 14:53 ` Gregory CLEMENT 2018-12-18 15:21 ` [PATCH 0/3] Finish Armada DRM DT support Lubomir Rintel 3 siblings, 1 reply; 7+ messages in thread From: Russell King @ 2018-07-10 10:24 UTC (permalink / raw) To: linux-arm-kernel Add DT configuration for the HDMI display output on the Dove Cubox. This adds support for the LCD0 controller which is connected to a TDA19988 HDMI encoder. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/boot/dts/dove-cubox.dts | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts index 580e3cbcfbf7..f6dd56f63d09 100644 --- a/arch/arm/boot/dts/dove-cubox.dts +++ b/arch/arm/boot/dts/dove-cubox.dts @@ -67,6 +67,25 @@ gpu-subsystem { status = "okay"; }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + display_reserved: framebuffer { + compatible = "marvell,dove-framebuffer"; + size = <0x02000000>; + alignment = <0x02000000>; + no-map; + }; + }; + + display-subsystem { + compatible = "marvell,dove-display-subsystem"; + memory-region = <&display_reserved>; + ports = <&lcd0_port>; + }; }; &uart0 { status = "okay"; }; @@ -117,6 +136,30 @@ silabs,pll-master; }; }; + + tda998x: hdmi-encoder { + compatible = "nxp,tda998x"; + reg = <0x70>; + video-ports = <0x234501>; + interrupts-extended = <&gpio0 27 IRQ_TYPE_LEVEL_LOW>; + + port { + tda998x_video: endpoint { + remote-endpoint = <&lcd0_rgb>; + }; + }; + }; +}; + +&lcd0 { + status = "okay"; + clocks = <&si5351 0>; + clock-names = "ext_ref_clk1"; + lcd0_port: port { + lcd0_rgb: endpoint { + remote-endpoint = <&tda998x_video>; + }; + }; }; &sdio0 { -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration 2018-07-10 10:24 ` [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration Russell King @ 2018-07-18 14:53 ` Gregory CLEMENT 0 siblings, 0 replies; 7+ messages in thread From: Gregory CLEMENT @ 2018-07-18 14:53 UTC (permalink / raw) To: linux-arm-kernel Hi Russell, On mar., juil. 10 2018, Russell King <rmk+kernel@arm.linux.org.uk> wrote: > Add DT configuration for the HDMI display output on the Dove Cubox. > This adds support for the LCD0 controller which is connected to a > TDA19988 HDMI encoder. > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> > --- > arch/arm/boot/dts/dove-cubox.dts | 43 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts > index 580e3cbcfbf7..f6dd56f63d09 100644 > --- a/arch/arm/boot/dts/dove-cubox.dts > +++ b/arch/arm/boot/dts/dove-cubox.dts > @@ -67,6 +67,25 @@ > gpu-subsystem { > status = "okay"; > }; > + > + reserved-memory { > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + display_reserved: framebuffer { > + compatible = "marvell,dove-framebuffer"; I didn't find the binding documentation associated to "marvell,dove-framebuffer". Could you point me on the accurate file? > + size = <0x02000000>; > + alignment = <0x02000000>; > + no-map; > + }; > + }; > + > + display-subsystem { > + compatible = "marvell,dove-display-subsystem"; Same for this one. Thanks, Gregory > + memory-region = <&display_reserved>; > + ports = <&lcd0_port>; > + }; > }; > > &uart0 { status = "okay"; }; > @@ -117,6 +136,30 @@ > silabs,pll-master; > }; > }; > + > + tda998x: hdmi-encoder { > + compatible = "nxp,tda998x"; > + reg = <0x70>; > + video-ports = <0x234501>; > + interrupts-extended = <&gpio0 27 IRQ_TYPE_LEVEL_LOW>; > + > + port { > + tda998x_video: endpoint { > + remote-endpoint = <&lcd0_rgb>; > + }; > + }; > + }; > +}; > + > +&lcd0 { > + status = "okay"; > + clocks = <&si5351 0>; > + clock-names = "ext_ref_clk1"; > + lcd0_port: port { > + lcd0_rgb: endpoint { > + remote-endpoint = <&tda998x_video>; > + }; > + }; > }; > > &sdio0 { > -- > 2.7.4 > -- Gregory Clement, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Finish Armada DRM DT support 2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux ` (2 preceding siblings ...) 2018-07-10 10:24 ` [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration Russell King @ 2018-12-18 15:21 ` Lubomir Rintel 3 siblings, 0 replies; 7+ messages in thread From: Lubomir Rintel @ 2018-12-18 15:21 UTC (permalink / raw) To: Russell King - ARM Linux; +Cc: devicetree, linux-arm-kernel, dri-devel On Tue, 2018-07-10 at 11:23 +0100, Russell King - ARM Linux wrote: > Finish Armada DRM support for DT, finally allowing mainline kernels to > use this driver unimpeded. > > arch/arm/boot/dts/dove-cubox.dts | 43 +++++++++++++++++++++++++++++++ > drivers/gpu/drm/armada/Makefile | 3 +++ > drivers/gpu/drm/armada/armada_drv.c | 29 ++++++++++++++++++--- > drivers/gpu/drm/armada/armada_rmem.c | 49 ++++++++++++++++++++++++++++++++++++ > 4 files changed, 121 insertions(+), 3 deletions(-) Hi, thank you for these patches. I've found them while figuring out how to make the Armada DRM driver work on an OLPC XO-1.75. Seems like they slipped through the cracks and were never applied. With a little more work they indeed seem to work well on my laptop. Feel free to slap in my Tested-by tag (and Reviewed-by, if one from me is any worth in the DRM land): Tested-by: Lubomir Rintel <lkundrak@v3.sk> Reviewed-by: Lubomir Rintel <lkundrak@v3.sk> The testing essentially consisted of checking that framebuffer emulation, console and "weston --use-pixman" work. I'll post the XO-1.75 patches that build on top of this soonish. I'm fairly new to DRM and they would certainly require significant changes before they could be integrated though. Thanks, Lubo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-18 15:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-10 10:23 [PATCH 0/3] Finish Armada DRM DT support Russell King - ARM Linux 2018-07-10 10:24 ` [PATCH 1/3] drm/armada: fix compare_of() for LCD controllers Russell King 2018-07-10 10:24 ` [PATCH 2/3] drm/armada: add OF reserved memory support Russell King 2018-12-18 15:18 ` Lubomir Rintel 2018-07-10 10:24 ` [PATCH 3/3] ARM: dts: cubox: add LCD controller and TDA998x configuration Russell King 2018-07-18 14:53 ` Gregory CLEMENT 2018-12-18 15:21 ` [PATCH 0/3] Finish Armada DRM DT support Lubomir Rintel
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).