Currently we are adding all components from the dts, if one of their
drivers been disabled, we would not be able to bring up others.
Refactor component match logic, follow exynos drm.
Signed-off-by: Jeffy Chen <jeffy.chen@xxxxxxxxxxxxxx>
Reviewed-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
Acked-by: Mark Yao <mark.yao@xxxxxxxxxxxxxx>
Tested-by: Heiko Stuebner <heiko@xxxxxxxxx>
---
Changes in v7:
Add Heiko Stuebner <heiko@xxxxxxxxx>'s Tested-by.
Changes in v6:
Add Mark Yao <mark.yao@xxxxxxxxxxxxxx>'s Acked-by.
Changes in v5:
Fix compile error reported by Heiko Stuebner <heiko@xxxxxxxxx>.
Changes in v4:
Use platform_driver helpers to register/unregister drivers.
Fix null pointer error reported by Heiko Stuebner <heiko@xxxxxxxxx>.
Changes in v3:
Address Andrzej Hajda <a.hajda@xxxxxxxxxxx>'s comments.
Changes in v2:
Address Sean Paul <seanpaul@xxxxxxxxxxxx>'s comments.
drivers/gpu/drm/rockchip/Kconfig | 10 +-
drivers/gpu/drm/rockchip/Makefile | 16 +--
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +-
drivers/gpu/drm/rockchip/cdn-dp-core.c | 8 +-
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 8 +-
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 10 +-
drivers/gpu/drm/rockchip/inno_hdmi.c | 10 +-
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 138 +++++++++++++++---------
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 6 ++
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 8 +-
10 files changed, 115 insertions(+), 108 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 0e4eb84..50c41c0 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -13,7 +13,7 @@ config DRM_ROCKCHIP
IP found on the SoC.
config ROCKCHIP_ANALOGIX_DP
- tristate "Rockchip specific extensions for Analogix DP driver"
+ bool "Rockchip specific extensions for Analogix DP driver"
depends on DRM_ROCKCHIP
select DRM_ANALOGIX_DP
help
@@ -22,7 +22,7 @@ config ROCKCHIP_ANALOGIX_DP
on RK3288 based SoC, you should selet this option.
config ROCKCHIP_CDN_DP
- tristate "Rockchip cdn DP"
+ bool "Rockchip cdn DP"
depends on DRM_ROCKCHIP
depends on EXTCON
select SND_SOC_HDMI_CODEC if SND_SOC
@@ -33,7 +33,7 @@ config ROCKCHIP_CDN_DP
option.
config ROCKCHIP_DW_HDMI
- tristate "Rockchip specific extensions for Synopsys DW HDMI"
+ bool "Rockchip specific extensions for Synopsys DW HDMI"
depends on DRM_ROCKCHIP
select DRM_DW_HDMI
help
@@ -43,7 +43,7 @@ config ROCKCHIP_DW_HDMI
option.
config ROCKCHIP_DW_MIPI_DSI
- tristate "Rockchip specific extensions for Synopsys DW MIPI DSI"
+ bool "Rockchip specific extensions for Synopsys DW MIPI DSI"
depends on DRM_ROCKCHIP
select DRM_MIPI_DSI
help
@@ -53,7 +53,7 @@ config ROCKCHIP_DW_MIPI_DSI
option.
config ROCKCHIP_INNO_HDMI
- tristate "Rockchip specific extensions for Innosilicon HDMI"
+ bool "Rockchip specific extensions for Innosilicon HDMI"
depends on DRM_ROCKCHIP
help
This selects support for Rockchip SoC specific extensions
diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile
index c931e2a..fa8dc9d 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -3,14 +3,14 @@
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
- rockchip_drm_gem.o rockchip_drm_psr.o rockchip_drm_vop.o
+ rockchip_drm_gem.o rockchip_drm_psr.o \
+ rockchip_drm_vop.o rockchip_vop_reg.o
rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
-obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
-obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp.o
-cdn-dp-objs := cdn-dp-core.o cdn-dp-reg.o
-obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
-obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
-obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
+rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
+rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
-obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_vop_reg.o
+obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 8548e82..91ebe5c 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -507,7 +507,7 @@ static const struct of_device_id rockchip_dp_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
-static struct platform_driver rockchip_dp_driver = {
+struct platform_driver rockchip_dp_driver = {
.probe = rockchip_dp_probe,
.remove = rockchip_dp_remove,
.driver = {
@@ -516,10 +516,3 @@ static struct platform_driver rockchip_dp_driver = {
.of_match_table = of_match_ptr(rockchip_dp_dt_ids),
},
};
-
-module_platform_driver(rockchip_dp_driver);
-
-MODULE_AUTHOR("Yakir Yang <ykk@xxxxxxxxxxxxxx>");
-MODULE_AUTHOR("Jeff chen <jeff.chen@xxxxxxxxxxxxxx>");
-MODULE_DESCRIPTION("Rockchip Specific Analogix-DP Driver Extension");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index fd79a70..e1796d0 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1243,7 +1243,7 @@ static const struct dev_pm_ops cdn_dp_pm_ops = {
cdn_dp_resume)
};
-static struct platform_driver cdn_dp_driver = {
+struct platform_driver cdn_dp_driver = {
.probe = cdn_dp_probe,
.remove = cdn_dp_remove,
.shutdown = cdn_dp_shutdown,
@@ -1254,9 +1254,3 @@ static struct platform_driver cdn_dp_driver = {
.pm = &cdn_dp_pm_ops,
},
};
-
-module_platform_driver(cdn_dp_driver);
-
-MODULE_AUTHOR("Chris Zhong <zyw@xxxxxxxxxxxxxx>");
-MODULE_DESCRIPTION("cdn DP Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index f84f9ae..9360250 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -1304,7 +1304,7 @@ static int dw_mipi_dsi_remove(struct platform_device *pdev)
return 0;
}
-static struct platform_driver dw_mipi_dsi_driver = {
+struct platform_driver dw_mipi_dsi_driver = {
.probe = dw_mipi_dsi_probe,
.remove = dw_mipi_dsi_remove,
.driver = {
@@ -1312,9 +1312,3 @@ static struct platform_driver dw_mipi_dsi_driver = {
.name = DRIVER_NAME,
},
};
-module_platform_driver(dw_mipi_dsi_driver);
-
-MODULE_DESCRIPTION("ROCKCHIP MIPI DSI host controller driver");
-MODULE_AUTHOR("Chris Zhong <zyw@xxxxxxxxxxxxxx>");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index a6d4a02..976ea79 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -326,7 +326,7 @@ static int dw_hdmi_rockchip_remove(struct platform_device *pdev)
return 0;
}
-static struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
+struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
.probe = dw_hdmi_rockchip_probe,
.remove = dw_hdmi_rockchip_remove,
.driver = {
@@ -334,11 +334,3 @@ static struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
.of_match_table = dw_hdmi_rockchip_dt_ids,
},
};
-
-module_platform_driver(dw_hdmi_rockchip_pltfm_driver);
-
-MODULE_AUTHOR("Andy Yan <andy.yan@xxxxxxxxxxxxxx>");
-MODULE_AUTHOR("Yakir Yang <ykk@xxxxxxxxxxxxxx>");
-MODULE_DESCRIPTION("Rockchip Specific DW-HDMI Driver Extension");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:dwhdmi-rockchip");
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
index 006260d..7d9b75e 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -923,7 +923,7 @@ static const struct of_device_id inno_hdmi_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, inno_hdmi_dt_ids);
-static struct platform_driver inno_hdmi_driver = {
+struct platform_driver inno_hdmi_driver = {
.probe = inno_hdmi_probe,
.remove = inno_hdmi_remove,
.driver = {
@@ -931,11 +931,3 @@ static struct platform_driver inno_hdmi_driver = {
.of_match_table = inno_hdmi_dt_ids,
},
};
-
-module_platform_driver(inno_hdmi_driver);
-
-MODULE_AUTHOR("Zheng Yang <zhengyang@xxxxxxxxxxxxxx>");
-MODULE_AUTHOR("Yakir Yang <ykk@xxxxxxxxxxxxxx>");
-MODULE_DESCRIPTION("Rockchip Specific INNO-HDMI Driver");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:innohdmi-rockchip");
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index ccf4569..c4fd077 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -304,34 +304,42 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = {
rockchip_drm_sys_resume)
};
-static int compare_of(struct device *dev, void *data)
-{
- struct device_node *np = data;
+#define MAX_ROCKCHIP_DRM_DRVS 16
+static struct platform_driver *rockchip_drm_drvs[MAX_ROCKCHIP_DRM_DRVS];
+static int rockchip_drm_drvs_cnt;