diff mbox series

[v2,10/19] video: sunxi: dw-hdmi: probe driver by compatible

Message ID 20210306195437.9740-11-jernej.skrabec@siol.net
State Under Review
Delegated to: Andre Przywara
Headers show
Series video: sunxi: rework DE2 driver | expand

Commit Message

Jernej Škrabec March 6, 2021, 7:54 p.m. UTC
Currently sunxi dw-hdmi driver is probed unconditionally, even if there
is no such device.

Switch driver to probing via compatible string. This brings many
benefits - driver can read DT node and allows driver to be always
enabled.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
 drivers/video/sunxi/sunxi_dw_hdmi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Andre Przywara March 7, 2021, 1:33 a.m. UTC | #1
On Sat,  6 Mar 2021 20:54:28 +0100
Jernej Skrabec <jernej.skrabec@siol.net> wrote:

> Currently sunxi dw-hdmi driver is probed unconditionally, even if there
> is no such device.
> 
> Switch driver to probing via compatible string. This brings many
> benefits - driver can read DT node and allows driver to be always
> enabled.

Confirmed that this the one compatible string that all supported SoCs
use.

> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks!
Andre

> ---
>  drivers/video/sunxi/sunxi_dw_hdmi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c
> index 6d2bc206fc2c..6f77b2a43b40 100644
> --- a/drivers/video/sunxi/sunxi_dw_hdmi.c
> +++ b/drivers/video/sunxi/sunxi_dw_hdmi.c
> @@ -372,14 +372,16 @@ static const struct dm_display_ops sunxi_dw_hdmi_ops = {
>  	.mode_valid = sunxi_dw_hdmi_mode_valid,
>  };
>  
> +static const struct udevice_id sunxi_dw_hdmi_ids[] = {
> +	{ .compatible = "allwinner,sun8i-a83t-dw-hdmi" },
> +	{ }
> +};
> +
>  U_BOOT_DRIVER(sunxi_dw_hdmi) = {
>  	.name	= "sunxi_dw_hdmi",
>  	.id	= UCLASS_DISPLAY,
> +	.of_match = sunxi_dw_hdmi_ids,
>  	.ops	= &sunxi_dw_hdmi_ops,
>  	.probe	= sunxi_dw_hdmi_probe,
>  	.priv_auto	= sizeof(struct sunxi_dw_hdmi_priv),
>  };
> -
> -U_BOOT_DRVINFO(sunxi_dw_hdmi) = {
> -	.name = "sunxi_dw_hdmi"
> -};
diff mbox series

Patch

diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c
index 6d2bc206fc2c..6f77b2a43b40 100644
--- a/drivers/video/sunxi/sunxi_dw_hdmi.c
+++ b/drivers/video/sunxi/sunxi_dw_hdmi.c
@@ -372,14 +372,16 @@  static const struct dm_display_ops sunxi_dw_hdmi_ops = {
 	.mode_valid = sunxi_dw_hdmi_mode_valid,
 };
 
+static const struct udevice_id sunxi_dw_hdmi_ids[] = {
+	{ .compatible = "allwinner,sun8i-a83t-dw-hdmi" },
+	{ }
+};
+
 U_BOOT_DRIVER(sunxi_dw_hdmi) = {
 	.name	= "sunxi_dw_hdmi",
 	.id	= UCLASS_DISPLAY,
+	.of_match = sunxi_dw_hdmi_ids,
 	.ops	= &sunxi_dw_hdmi_ops,
 	.probe	= sunxi_dw_hdmi_probe,
 	.priv_auto	= sizeof(struct sunxi_dw_hdmi_priv),
 };
-
-U_BOOT_DRVINFO(sunxi_dw_hdmi) = {
-	.name = "sunxi_dw_hdmi"
-};