LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
@ 2018-04-09 23:00 Eric Anholt
2018-04-09 23:00 ` [PATCH 2/3] ARM: dts: bcm283x: Remove the vc4 GPU subsystem node Eric Anholt
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Eric Anholt @ 2018-04-09 23:00 UTC (permalink / raw)
To: dri-devel, Rob Herring, Mark Rutland, Ray Jui, Scott Branden,
Jon Mason, bcm-kernel-feedback-list, Florian Fainelli,
linux-arm-kernel, linux-kernel, devicetree, Stefan Wahren,
linux-rpi-kernel
Cc: Eric Anholt
The GPU subsystem node was a workaround to have a central device to
bind V3D and display to. Following the lead of 246774d17fc0
("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
the subsystem node usage and just create a platform device for the DRM
device to attach to if any of the subsystem devices are present.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
.../bindings/display/brcm,bcm-vc4.txt | 7 ----
drivers/gpu/drm/vc4/vc4_drv.c | 33 ++++++++++++++-----
drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
4 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
index 284e2b14cfbe..5fd4717101d6 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
+++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
@@ -4,9 +4,6 @@ The VC4 device present on the Raspberry Pi includes a display system
with HDMI output and the HVS (Hardware Video Scaler) for compositing
display planes.
-Required properties for VC4:
-- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4"
-
Required properties for Pixel Valve:
- compatible: Should be one of "brcm,bcm2835-pixelvalve0",
"brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
@@ -153,10 +150,6 @@ v3d: v3d@7ec00000 {
interrupts = <1 10>;
};
-vc4: gpu {
- compatible = "brcm,bcm2835-vc4";
-};
-
panel: panel {
compatible = "ontat,yx700wv03", "simple-panel";
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 7c95ed5c5cac..d282ab7de03a 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -364,22 +364,34 @@ static int vc4_platform_drm_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id vc4_of_match[] = {
- { .compatible = "brcm,bcm2835-vc4", },
- { .compatible = "brcm,cygnus-vc4", },
- {},
-};
-MODULE_DEVICE_TABLE(of, vc4_of_match);
-
static struct platform_driver vc4_platform_driver = {
.probe = vc4_platform_drm_probe,
.remove = vc4_platform_drm_remove,
.driver = {
.name = "vc4-drm",
- .of_match_table = vc4_of_match,
},
};
+static bool
+driver_of_table_has_a_match(const struct platform_driver *driver)
+{
+ int i;
+
+ for (i = 0; driver->driver.of_match_table[i].compatible; i++) {
+ const char *compat = driver->driver.of_match_table[i].compatible;
+ struct device_node *node;
+
+ while ((node = of_find_compatible_node(node, NULL, compat))) {
+ if (of_device_is_available(node)) {
+ of_node_put(node);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
static int __init vc4_drm_register(void)
{
int ret;
@@ -389,6 +401,11 @@ static int __init vc4_drm_register(void)
if (ret)
return ret;
+ if (driver_of_table_has_a_match(&vc4_v3d_driver) ||
+ driver_of_table_has_a_match(&vc4_hvs_driver)) {
+ platform_device_register_simple("vc4-drm", -1, NULL, 0);
+ }
+
return platform_driver_register(&vc4_platform_driver);
}
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index 2b62fc5b8d85..730813ee74ae 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -262,6 +262,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = {
{ .compatible = "brcm,bcm2835-hvs" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_hvs_dt_match);
struct platform_driver vc4_hvs_driver = {
.probe = vc4_hvs_dev_probe,
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index bfc2fa73d2ae..e77e9ebbab4b 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -459,6 +459,7 @@ static const struct of_device_id vc4_v3d_dt_match[] = {
{ .compatible = "brcm,vc4-v3d" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_v3d_dt_match);
struct platform_driver vc4_v3d_driver = {
.probe = vc4_v3d_dev_probe,
--
2.17.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] ARM: dts: bcm283x: Remove the vc4 GPU subsystem node.
2018-04-09 23:00 [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Eric Anholt
@ 2018-04-09 23:00 ` Eric Anholt
2018-04-09 23:00 ` [PATCH 3/3] ARM: dts: cygnus: " Eric Anholt
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Eric Anholt @ 2018-04-09 23:00 UTC (permalink / raw)
To: dri-devel, Rob Herring, Mark Rutland, Ray Jui, Scott Branden,
Jon Mason, bcm-kernel-feedback-list, Florian Fainelli,
linux-arm-kernel, linux-kernel, devicetree, Stefan Wahren,
linux-rpi-kernel
Cc: Eric Anholt
This is no longer required by the DRM driver, and was just a temporary
hack for it.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
arch/arm/boot/dts/bcm283x.dtsi | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 9d293decf8d3..869bf350d426 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -609,10 +609,6 @@
reg = <0x7ec00000 0x1000>;
interrupts = <1 10>;
};
-
- vc4: gpu {
- compatible = "brcm,bcm2835-vc4";
- };
};
clocks {
--
2.17.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] ARM: dts: cygnus: Remove the vc4 GPU subsystem node.
2018-04-09 23:00 [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Eric Anholt
2018-04-09 23:00 ` [PATCH 2/3] ARM: dts: bcm283x: Remove the vc4 GPU subsystem node Eric Anholt
@ 2018-04-09 23:00 ` Eric Anholt
2018-04-10 18:28 ` [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Stefan Wahren
2018-04-13 17:56 ` Rob Herring
3 siblings, 0 replies; 11+ messages in thread
From: Eric Anholt @ 2018-04-09 23:00 UTC (permalink / raw)
To: dri-devel, Rob Herring, Mark Rutland, Ray Jui, Scott Branden,
Jon Mason, bcm-kernel-feedback-list, Florian Fainelli,
linux-arm-kernel, linux-kernel, devicetree, Stefan Wahren,
linux-rpi-kernel
Cc: Eric Anholt
This is no longer required by the DRM driver, and was just a temporary
hack for it.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
arch/arm/boot/dts/bcm-cygnus.dtsi | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi
index 699fdf94d139..258bb3d61582 100644
--- a/arch/arm/boot/dts/bcm-cygnus.dtsi
+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
@@ -492,10 +492,6 @@
status = "disabled";
};
- vc4: gpu {
- compatible = "brcm,cygnus-vc4";
- };
-
gpio_asiu: gpio@180a5000 {
compatible = "brcm,cygnus-asiu-gpio";
reg = <0x180a5000 0x668>;
--
2.17.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-09 23:00 [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Eric Anholt
2018-04-09 23:00 ` [PATCH 2/3] ARM: dts: bcm283x: Remove the vc4 GPU subsystem node Eric Anholt
2018-04-09 23:00 ` [PATCH 3/3] ARM: dts: cygnus: " Eric Anholt
@ 2018-04-10 18:28 ` Stefan Wahren
2018-04-10 19:39 ` Eric Anholt
2018-04-13 17:56 ` Rob Herring
3 siblings, 1 reply; 11+ messages in thread
From: Stefan Wahren @ 2018-04-10 18:28 UTC (permalink / raw)
To: Rob Herring, Eric Anholt, bcm-kernel-feedback-list, devicetree,
linux-kernel, Ray Jui, Scott Branden, Florian Fainelli,
linux-rpi-kernel, Mark Rutland, Jon Mason, dri-devel,
linux-arm-kernel
Hi Eric,
> Eric Anholt <eric@anholt.net> hat am 10. April 2018 um 01:00 geschrieben:
>
>
> The GPU subsystem node was a workaround to have a central device to
> bind V3D and display to. Following the lead of 246774d17fc0
> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
> the subsystem node usage and just create a platform device for the DRM
> device to attach to if any of the subsystem devices are present.
i didn't test it. Does the code change keep the backward compatibility with older DT?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-10 18:28 ` [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Stefan Wahren
@ 2018-04-10 19:39 ` Eric Anholt
0 siblings, 0 replies; 11+ messages in thread
From: Eric Anholt @ 2018-04-10 19:39 UTC (permalink / raw)
To: Stefan Wahren, Rob Herring, bcm-kernel-feedback-list, devicetree,
linux-kernel, Ray Jui, Scott Branden, Florian Fainelli,
linux-rpi-kernel, Mark Rutland, Jon Mason, dri-devel,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
Stefan Wahren <stefan.wahren@i2se.com> writes:
> Hi Eric,
>
>> Eric Anholt <eric@anholt.net> hat am 10. April 2018 um 01:00 geschrieben:
>>
>>
>> The GPU subsystem node was a workaround to have a central device to
>> bind V3D and display to. Following the lead of 246774d17fc0
>> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
>> the subsystem node usage and just create a platform device for the DRM
>> device to attach to if any of the subsystem devices are present.
>
> i didn't test it. Does the code change keep the backward compatibility with older DT?
Yes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-09 23:00 [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Eric Anholt
` (2 preceding siblings ...)
2018-04-10 18:28 ` [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Stefan Wahren
@ 2018-04-13 17:56 ` Rob Herring
2018-04-16 17:25 ` [PATCH v2 " Eric Anholt
3 siblings, 1 reply; 11+ messages in thread
From: Rob Herring @ 2018-04-13 17:56 UTC (permalink / raw)
To: Eric Anholt
Cc: dri-devel, Mark Rutland, Ray Jui, Scott Branden, Jon Mason,
bcm-kernel-feedback-list, Florian Fainelli, linux-arm-kernel,
linux-kernel, devicetree, Stefan Wahren, linux-rpi-kernel
On Mon, Apr 09, 2018 at 04:00:38PM -0700, Eric Anholt wrote:
> The GPU subsystem node was a workaround to have a central device to
> bind V3D and display to. Following the lead of 246774d17fc0
> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
> the subsystem node usage and just create a platform device for the DRM
> device to attach to if any of the subsystem devices are present.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
> .../bindings/display/brcm,bcm-vc4.txt | 7 ----
> drivers/gpu/drm/vc4/vc4_drv.c | 33 ++++++++++++++-----
> drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
> drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
> 4 files changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> index 284e2b14cfbe..5fd4717101d6 100644
> --- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> +++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
> @@ -4,9 +4,6 @@ The VC4 device present on the Raspberry Pi includes a display system
> with HDMI output and the HVS (Hardware Video Scaler) for compositing
> display planes.
>
> -Required properties for VC4:
> -- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4"
> -
> Required properties for Pixel Valve:
> - compatible: Should be one of "brcm,bcm2835-pixelvalve0",
> "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
> @@ -153,10 +150,6 @@ v3d: v3d@7ec00000 {
> interrupts = <1 10>;
> };
>
> -vc4: gpu {
> - compatible = "brcm,bcm2835-vc4";
> -};
> -
> panel: panel {
> compatible = "ontat,yx700wv03", "simple-panel";
>
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 7c95ed5c5cac..d282ab7de03a 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -364,22 +364,34 @@ static int vc4_platform_drm_remove(struct platform_device *pdev)
> return 0;
> }
>
> -static const struct of_device_id vc4_of_match[] = {
> - { .compatible = "brcm,bcm2835-vc4", },
> - { .compatible = "brcm,cygnus-vc4", },
> - {},
> -};
> -MODULE_DEVICE_TABLE(of, vc4_of_match);
> -
> static struct platform_driver vc4_platform_driver = {
> .probe = vc4_platform_drm_probe,
> .remove = vc4_platform_drm_remove,
> .driver = {
> .name = "vc4-drm",
> - .of_match_table = vc4_of_match,
> },
> };
>
> +static bool
> +driver_of_table_has_a_match(const struct platform_driver *driver)
> +{
> + int i;
> +
> + for (i = 0; driver->driver.of_match_table[i].compatible; i++) {
> + const char *compat = driver->driver.of_match_table[i].compatible;
> + struct device_node *node;
> +
> + while ((node = of_find_compatible_node(node, NULL, compat))) {
> + if (of_device_is_available(node)) {
> + of_node_put(node);
> + return true;
> + }
> + }
> + }
All this can be replaced with:
node = of_find_matching_node_and_match(NULL, driver->driver.of_match_table, NULL);
if (of_device_is_available(node)) {
of_node_put(node);
return true;
}
> +
> + return false;
> +}
> +
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-13 17:56 ` Rob Herring
@ 2018-04-16 17:25 ` Eric Anholt
2018-04-16 20:33 ` Rob Herring
0 siblings, 1 reply; 11+ messages in thread
From: Eric Anholt @ 2018-04-16 17:25 UTC (permalink / raw)
To: dri-devel, Rob Herring, Mark Rutland, Ray Jui, Scott Branden,
Jon Mason, bcm-kernel-feedback-list, Florian Fainelli,
linux-arm-kernel, linux-kernel, devicetree, Stefan Wahren,
linux-rpi-kernel
Cc: Eric Anholt
The GPU subsystem node was a workaround to have a central device to
bind V3D and display to. Following the lead of 246774d17fc0
("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
the subsystem node usage and just create a platform device for the DRM
device to attach to if any of the subsystem devices are present.
v2: Simplify the DT walking code.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
.../bindings/display/brcm,bcm-vc4.txt | 7 -----
drivers/gpu/drm/vc4/vc4_drv.c | 29 ++++++++++++++-----
drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
4 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
index 284e2b14cfbe..5fd4717101d6 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
+++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
@@ -4,9 +4,6 @@ The VC4 device present on the Raspberry Pi includes a display system
with HDMI output and the HVS (Hardware Video Scaler) for compositing
display planes.
-Required properties for VC4:
-- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4"
-
Required properties for Pixel Valve:
- compatible: Should be one of "brcm,bcm2835-pixelvalve0",
"brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
@@ -153,10 +150,6 @@ v3d: v3d@7ec00000 {
interrupts = <1 10>;
};
-vc4: gpu {
- compatible = "brcm,bcm2835-vc4";
-};
-
panel: panel {
compatible = "ontat,yx700wv03", "simple-panel";
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 7c95ed5c5cac..13b840b534b8 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -364,22 +364,30 @@ static int vc4_platform_drm_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id vc4_of_match[] = {
- { .compatible = "brcm,bcm2835-vc4", },
- { .compatible = "brcm,cygnus-vc4", },
- {},
-};
-MODULE_DEVICE_TABLE(of, vc4_of_match);
-
static struct platform_driver vc4_platform_driver = {
.probe = vc4_platform_drm_probe,
.remove = vc4_platform_drm_remove,
.driver = {
.name = "vc4-drm",
- .of_match_table = vc4_of_match,
},
};
+static bool
+driver_of_table_has_a_match(const struct platform_driver *driver)
+{
+ struct device_node *node;
+
+ node = of_find_matching_node_and_match(NULL,
+ driver->driver.of_match_table,
+ NULL);
+ if (of_device_is_available(node)) {
+ of_node_put(node);
+ return true;
+ }
+
+ return false;
+}
+
static int __init vc4_drm_register(void)
{
int ret;
@@ -389,6 +397,11 @@ static int __init vc4_drm_register(void)
if (ret)
return ret;
+ if (driver_of_table_has_a_match(&vc4_v3d_driver) ||
+ driver_of_table_has_a_match(&vc4_hvs_driver)) {
+ platform_device_register_simple("vc4-drm", -1, NULL, 0);
+ }
+
return platform_driver_register(&vc4_platform_driver);
}
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index 2b62fc5b8d85..730813ee74ae 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -262,6 +262,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = {
{ .compatible = "brcm,bcm2835-hvs" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_hvs_dt_match);
struct platform_driver vc4_hvs_driver = {
.probe = vc4_hvs_dev_probe,
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index bfc2fa73d2ae..e77e9ebbab4b 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -459,6 +459,7 @@ static const struct of_device_id vc4_v3d_dt_match[] = {
{ .compatible = "brcm,vc4-v3d" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_v3d_dt_match);
struct platform_driver vc4_v3d_driver = {
.probe = vc4_v3d_dev_probe,
--
2.17.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-16 17:25 ` [PATCH v2 " Eric Anholt
@ 2018-04-16 20:33 ` Rob Herring
2018-04-16 22:52 ` [PATCH v3 " Eric Anholt
0 siblings, 1 reply; 11+ messages in thread
From: Rob Herring @ 2018-04-16 20:33 UTC (permalink / raw)
To: Eric Anholt
Cc: dri-devel, Mark Rutland, Ray Jui, Scott Branden, Jon Mason,
bcm-kernel-feedback-list, Florian Fainelli,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, devicetree, Stefan Wahren,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
On Mon, Apr 16, 2018 at 12:25 PM, Eric Anholt <eric@anholt.net> wrote:
> The GPU subsystem node was a workaround to have a central device to
> bind V3D and display to. Following the lead of 246774d17fc0
> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
> the subsystem node usage and just create a platform device for the DRM
> device to attach to if any of the subsystem devices are present.
>
> v2: Simplify the DT walking code.
> +static bool
> +driver_of_table_has_a_match(const struct platform_driver *driver)
> +{
> + struct device_node *node;
> +
> + node = of_find_matching_node_and_match(NULL,
> + driver->driver.of_match_table,
> + NULL);
> + if (of_device_is_available(node)) {
> + of_node_put(node);
You need to put the node regardless.
> + return true;
> + }
> +
> + return false;
> +}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-16 20:33 ` Rob Herring
@ 2018-04-16 22:52 ` Eric Anholt
2018-04-17 13:09 ` Rob Herring
0 siblings, 1 reply; 11+ messages in thread
From: Eric Anholt @ 2018-04-16 22:52 UTC (permalink / raw)
To: dri-devel, Rob Herring, Mark Rutland, Ray Jui, Scott Branden,
Jon Mason, bcm-kernel-feedback-list, Florian Fainelli,
linux-arm-kernel, linux-kernel, devicetree, Stefan Wahren,
linux-rpi-kernel
Cc: Eric Anholt
The GPU subsystem node was a workaround to have a central device to
bind V3D and display to. Following the lead of 246774d17fc0
("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
the subsystem node usage and just create a platform device for the DRM
device to attach to if any of the subsystem devices are present.
v2: Simplify the DT walking code.
v3: Always put the node.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
.../bindings/display/brcm,bcm-vc4.txt | 7 -----
drivers/gpu/drm/vc4/vc4_drv.c | 28 +++++++++++++------
drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
4 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
index 284e2b14cfbe..5fd4717101d6 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
+++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
@@ -4,9 +4,6 @@ The VC4 device present on the Raspberry Pi includes a display system
with HDMI output and the HVS (Hardware Video Scaler) for compositing
display planes.
-Required properties for VC4:
-- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4"
-
Required properties for Pixel Valve:
- compatible: Should be one of "brcm,bcm2835-pixelvalve0",
"brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
@@ -153,10 +150,6 @@ v3d: v3d@7ec00000 {
interrupts = <1 10>;
};
-vc4: gpu {
- compatible = "brcm,bcm2835-vc4";
-};
-
panel: panel {
compatible = "ontat,yx700wv03", "simple-panel";
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 7c95ed5c5cac..e8ba9e7c71d2 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -364,22 +364,29 @@ static int vc4_platform_drm_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id vc4_of_match[] = {
- { .compatible = "brcm,bcm2835-vc4", },
- { .compatible = "brcm,cygnus-vc4", },
- {},
-};
-MODULE_DEVICE_TABLE(of, vc4_of_match);
-
static struct platform_driver vc4_platform_driver = {
.probe = vc4_platform_drm_probe,
.remove = vc4_platform_drm_remove,
.driver = {
.name = "vc4-drm",
- .of_match_table = vc4_of_match,
},
};
+static bool
+driver_of_table_has_a_match(const struct platform_driver *driver)
+{
+ struct device_node *node;
+ bool ret;
+
+ node = of_find_matching_node_and_match(NULL,
+ driver->driver.of_match_table,
+ NULL);
+ ret = of_device_is_available(node);
+ of_node_put(node);
+
+ return ret;
+}
+
static int __init vc4_drm_register(void)
{
int ret;
@@ -389,6 +396,11 @@ static int __init vc4_drm_register(void)
if (ret)
return ret;
+ if (driver_of_table_has_a_match(&vc4_v3d_driver) ||
+ driver_of_table_has_a_match(&vc4_hvs_driver)) {
+ platform_device_register_simple("vc4-drm", -1, NULL, 0);
+ }
+
return platform_driver_register(&vc4_platform_driver);
}
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index 2b62fc5b8d85..730813ee74ae 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -262,6 +262,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = {
{ .compatible = "brcm,bcm2835-hvs" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_hvs_dt_match);
struct platform_driver vc4_hvs_driver = {
.probe = vc4_hvs_dev_probe,
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index bfc2fa73d2ae..e77e9ebbab4b 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -459,6 +459,7 @@ static const struct of_device_id vc4_v3d_dt_match[] = {
{ .compatible = "brcm,vc4-v3d" },
{}
};
+MODULE_DEVICE_TABLE(of, vc4_v3d_dt_match);
struct platform_driver vc4_v3d_driver = {
.probe = vc4_v3d_dev_probe,
--
2.17.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-16 22:52 ` [PATCH v3 " Eric Anholt
@ 2018-04-17 13:09 ` Rob Herring
2018-04-17 21:48 ` Eric Anholt
0 siblings, 1 reply; 11+ messages in thread
From: Rob Herring @ 2018-04-17 13:09 UTC (permalink / raw)
To: Eric Anholt
Cc: dri-devel, Mark Rutland, Ray Jui, Scott Branden, Jon Mason,
bcm-kernel-feedback-list, Florian Fainelli,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, devicetree, Stefan Wahren,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
On Mon, Apr 16, 2018 at 5:52 PM, Eric Anholt <eric@anholt.net> wrote:
> The GPU subsystem node was a workaround to have a central device to
> bind V3D and display to. Following the lead of 246774d17fc0
> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
> the subsystem node usage and just create a platform device for the DRM
> device to attach to if any of the subsystem devices are present.
>
> v2: Simplify the DT walking code.
> v3: Always put the node.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
> .../bindings/display/brcm,bcm-vc4.txt | 7 -----
> drivers/gpu/drm/vc4/vc4_drv.c | 28 +++++++++++++------
> drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
> drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
> 4 files changed, 22 insertions(+), 15 deletions(-)
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node.
2018-04-17 13:09 ` Rob Herring
@ 2018-04-17 21:48 ` Eric Anholt
0 siblings, 0 replies; 11+ messages in thread
From: Eric Anholt @ 2018-04-17 21:48 UTC (permalink / raw)
To: Rob Herring
Cc: dri-devel, Mark Rutland, Ray Jui, Scott Branden, Jon Mason,
bcm-kernel-feedback-list, Florian Fainelli,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, devicetree, Stefan Wahren,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]
Rob Herring <robh+dt@kernel.org> writes:
> On Mon, Apr 16, 2018 at 5:52 PM, Eric Anholt <eric@anholt.net> wrote:
>> The GPU subsystem node was a workaround to have a central device to
>> bind V3D and display to. Following the lead of 246774d17fc0
>> ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove
>> the subsystem node usage and just create a platform device for the DRM
>> device to attach to if any of the subsystem devices are present.
>>
>> v2: Simplify the DT walking code.
>> v3: Always put the node.
>>
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>> ---
>> .../bindings/display/brcm,bcm-vc4.txt | 7 -----
>> drivers/gpu/drm/vc4/vc4_drv.c | 28 +++++++++++++------
>> drivers/gpu/drm/vc4/vc4_hvs.c | 1 +
>> drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
>> 4 files changed, 22 insertions(+), 15 deletions(-)
>
> Reviewed-by: Rob Herring <robh@kernel.org>
Unfortunately, on further testing, this ends up broken. My guess is
that our new platform device isn't on the same bus, so we don't get our
dma-ranges translation when we use drm->dev, and that breaks caching
behavior.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-04-17 21:48 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09 23:00 [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Eric Anholt
2018-04-09 23:00 ` [PATCH 2/3] ARM: dts: bcm283x: Remove the vc4 GPU subsystem node Eric Anholt
2018-04-09 23:00 ` [PATCH 3/3] ARM: dts: cygnus: " Eric Anholt
2018-04-10 18:28 ` [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node Stefan Wahren
2018-04-10 19:39 ` Eric Anholt
2018-04-13 17:56 ` Rob Herring
2018-04-16 17:25 ` [PATCH v2 " Eric Anholt
2018-04-16 20:33 ` Rob Herring
2018-04-16 22:52 ` [PATCH v3 " Eric Anholt
2018-04-17 13:09 ` Rob Herring
2018-04-17 21:48 ` Eric Anholt
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).