diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-02 07:55:12 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-11 08:09:24 -0400 |
commit | 38f3daf678d909e8ee5638f21a34f35c01343420 (patch) | |
tree | 0e0ea8fa43e038980632906186f1e9d0021f82a7 /drivers | |
parent | 11ee9606407031827d43ecde8e62a418ac3b4f83 (diff) |
OMAPDSS: separate pdata based initialization
Move the platform-data based display device initialization into a
separate function, so that we may later add of-based initialization.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 7 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 50 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 45 | ||||
-rw-r--r-- | drivers/video/omap2/dss/rfbi.c | 45 | ||||
-rw-r--r-- | drivers/video/omap2/dss/sdi.c | 7 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 45 |
6 files changed, 119 insertions, 80 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index de3454b91497..8c2056c9537b 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -365,7 +365,7 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev) | |||
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | static int __init omap_dpi_probe(struct platform_device *pdev) | 368 | static void __init dpi_probe_pdata(struct platform_device *pdev) |
369 | { | 369 | { |
370 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 370 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
371 | int i, r; | 371 | int i, r; |
@@ -387,6 +387,11 @@ static int __init omap_dpi_probe(struct platform_device *pdev) | |||
387 | DSSERR("device %s register failed: %d\n", | 387 | DSSERR("device %s register failed: %d\n", |
388 | dssdev->name, r); | 388 | dssdev->name, r); |
389 | } | 389 | } |
390 | } | ||
391 | |||
392 | static int __init omap_dpi_probe(struct platform_device *pdev) | ||
393 | { | ||
394 | dpi_probe_pdata(pdev); | ||
390 | 395 | ||
391 | return 0; | 396 | return 0; |
392 | } | 397 | } |
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index b882a77911e6..e2aaf5a167fa 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -4602,6 +4602,34 @@ static void dsi_put_clocks(struct platform_device *dsidev) | |||
4602 | clk_put(dsi->sys_clk); | 4602 | clk_put(dsi->sys_clk); |
4603 | } | 4603 | } |
4604 | 4604 | ||
4605 | static void __init dsi_probe_pdata(struct platform_device *dsidev) | ||
4606 | { | ||
4607 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
4608 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; | ||
4609 | int i, r; | ||
4610 | |||
4611 | for (i = 0; i < pdata->num_devices; ++i) { | ||
4612 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
4613 | |||
4614 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) | ||
4615 | continue; | ||
4616 | |||
4617 | if (dssdev->phy.dsi.module != dsi->module_id) | ||
4618 | continue; | ||
4619 | |||
4620 | r = dsi_init_display(dssdev); | ||
4621 | if (r) { | ||
4622 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
4623 | continue; | ||
4624 | } | ||
4625 | |||
4626 | r = omap_dss_register_device(dssdev, &dsidev->dev, i); | ||
4627 | if (r) | ||
4628 | DSSERR("device %s register failed: %d\n", | ||
4629 | dssdev->name, r); | ||
4630 | } | ||
4631 | } | ||
4632 | |||
4605 | /* DSI1 HW IP initialisation */ | 4633 | /* DSI1 HW IP initialisation */ |
4606 | static int __init omap_dsihw_probe(struct platform_device *dsidev) | 4634 | static int __init omap_dsihw_probe(struct platform_device *dsidev) |
4607 | { | 4635 | { |
@@ -4609,7 +4637,6 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) | |||
4609 | int r, i; | 4637 | int r, i; |
4610 | struct resource *dsi_mem; | 4638 | struct resource *dsi_mem; |
4611 | struct dsi_data *dsi; | 4639 | struct dsi_data *dsi; |
4612 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; | ||
4613 | 4640 | ||
4614 | dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); | 4641 | dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); |
4615 | if (!dsi) | 4642 | if (!dsi) |
@@ -4697,26 +4724,7 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) | |||
4697 | else | 4724 | else |
4698 | dsi->num_lanes_supported = 3; | 4725 | dsi->num_lanes_supported = 3; |
4699 | 4726 | ||
4700 | for (i = 0; i < pdata->num_devices; ++i) { | 4727 | dsi_probe_pdata(dsidev); |
4701 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
4702 | |||
4703 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) | ||
4704 | continue; | ||
4705 | |||
4706 | if (dssdev->phy.dsi.module != dsi->module_id) | ||
4707 | continue; | ||
4708 | |||
4709 | r = dsi_init_display(dssdev); | ||
4710 | if (r) { | ||
4711 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
4712 | continue; | ||
4713 | } | ||
4714 | |||
4715 | r = omap_dss_register_device(dssdev, &dsidev->dev, i); | ||
4716 | if (r) | ||
4717 | DSSERR("device %s register failed: %d\n", | ||
4718 | dssdev->name, r); | ||
4719 | } | ||
4720 | 4728 | ||
4721 | dsi_runtime_put(dsidev); | 4729 | dsi_runtime_put(dsidev); |
4722 | 4730 | ||
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index fa1a054bb03b..5f2e2f677bef 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -771,12 +771,35 @@ static void hdmi_put_clocks(void) | |||
771 | clk_put(hdmi.sys_clk); | 771 | clk_put(hdmi.sys_clk); |
772 | } | 772 | } |
773 | 773 | ||
774 | static void __init hdmi_probe_pdata(struct platform_device *pdev) | ||
775 | { | ||
776 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
777 | int r, i; | ||
778 | |||
779 | for (i = 0; i < pdata->num_devices; ++i) { | ||
780 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
781 | |||
782 | if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI) | ||
783 | continue; | ||
784 | |||
785 | r = hdmi_init_display(dssdev); | ||
786 | if (r) { | ||
787 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
788 | continue; | ||
789 | } | ||
790 | |||
791 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
792 | if (r) | ||
793 | DSSERR("device %s register failed: %d\n", | ||
794 | dssdev->name, r); | ||
795 | } | ||
796 | } | ||
797 | |||
774 | /* HDMI HW IP initialisation */ | 798 | /* HDMI HW IP initialisation */ |
775 | static int __init omapdss_hdmihw_probe(struct platform_device *pdev) | 799 | static int __init omapdss_hdmihw_probe(struct platform_device *pdev) |
776 | { | 800 | { |
777 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
778 | struct resource *hdmi_mem; | 801 | struct resource *hdmi_mem; |
779 | int r, i; | 802 | int r; |
780 | 803 | ||
781 | hdmi.pdev = pdev; | 804 | hdmi.pdev = pdev; |
782 | 805 | ||
@@ -813,23 +836,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) | |||
813 | 836 | ||
814 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); | 837 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); |
815 | 838 | ||
816 | for (i = 0; i < pdata->num_devices; ++i) { | 839 | hdmi_probe_pdata(pdev); |
817 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
818 | |||
819 | if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI) | ||
820 | continue; | ||
821 | |||
822 | r = hdmi_init_display(dssdev); | ||
823 | if (r) { | ||
824 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
825 | continue; | ||
826 | } | ||
827 | |||
828 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
829 | if (r) | ||
830 | DSSERR("device %s register failed: %d\n", | ||
831 | dssdev->name, r); | ||
832 | } | ||
833 | 840 | ||
834 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 841 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ |
835 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 842 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index f081f01b0b7d..3d8c206e90e5 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -927,14 +927,37 @@ static int __init rfbi_init_display(struct omap_dss_device *dssdev) | |||
927 | return 0; | 927 | return 0; |
928 | } | 928 | } |
929 | 929 | ||
930 | static void __init rfbi_probe_pdata(struct platform_device *pdev) | ||
931 | { | ||
932 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
933 | int i, r; | ||
934 | |||
935 | for (i = 0; i < pdata->num_devices; ++i) { | ||
936 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
937 | |||
938 | if (dssdev->type != OMAP_DISPLAY_TYPE_DBI) | ||
939 | continue; | ||
940 | |||
941 | r = rfbi_init_display(dssdev); | ||
942 | if (r) { | ||
943 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
944 | continue; | ||
945 | } | ||
946 | |||
947 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
948 | if (r) | ||
949 | DSSERR("device %s register failed: %d\n", | ||
950 | dssdev->name, r); | ||
951 | } | ||
952 | } | ||
953 | |||
930 | /* RFBI HW IP initialisation */ | 954 | /* RFBI HW IP initialisation */ |
931 | static int __init omap_rfbihw_probe(struct platform_device *pdev) | 955 | static int __init omap_rfbihw_probe(struct platform_device *pdev) |
932 | { | 956 | { |
933 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
934 | u32 rev; | 957 | u32 rev; |
935 | struct resource *rfbi_mem; | 958 | struct resource *rfbi_mem; |
936 | struct clk *clk; | 959 | struct clk *clk; |
937 | int r, i; | 960 | int r; |
938 | 961 | ||
939 | rfbi.pdev = pdev; | 962 | rfbi.pdev = pdev; |
940 | 963 | ||
@@ -979,23 +1002,7 @@ static int __init omap_rfbihw_probe(struct platform_device *pdev) | |||
979 | 1002 | ||
980 | dss_debugfs_create_file("rfbi", rfbi_dump_regs); | 1003 | dss_debugfs_create_file("rfbi", rfbi_dump_regs); |
981 | 1004 | ||
982 | for (i = 0; i < pdata->num_devices; ++i) { | 1005 | rfbi_probe_pdata(pdev); |
983 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
984 | |||
985 | if (dssdev->type != OMAP_DISPLAY_TYPE_DBI) | ||
986 | continue; | ||
987 | |||
988 | r = rfbi_init_display(dssdev); | ||
989 | if (r) { | ||
990 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
991 | continue; | ||
992 | } | ||
993 | |||
994 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
995 | if (r) | ||
996 | DSSERR("device %s register failed: %d\n", | ||
997 | dssdev->name, r); | ||
998 | } | ||
999 | 1006 | ||
1000 | return 0; | 1007 | return 0; |
1001 | 1008 | ||
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 2641a768f316..3a43dc2a9b46 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c | |||
@@ -176,7 +176,7 @@ static int __init sdi_init_display(struct omap_dss_device *dssdev) | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int __init omap_sdi_probe(struct platform_device *pdev) | 179 | static void __init sdi_probe_pdata(struct platform_device *pdev) |
180 | { | 180 | { |
181 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 181 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
182 | int i, r; | 182 | int i, r; |
@@ -198,6 +198,11 @@ static int __init omap_sdi_probe(struct platform_device *pdev) | |||
198 | DSSERR("device %s register failed: %d\n", | 198 | DSSERR("device %s register failed: %d\n", |
199 | dssdev->name, r); | 199 | dssdev->name, r); |
200 | } | 200 | } |
201 | } | ||
202 | |||
203 | static int __init omap_sdi_probe(struct platform_device *pdev) | ||
204 | { | ||
205 | sdi_probe_pdata(pdev); | ||
201 | 206 | ||
202 | return 0; | 207 | return 0; |
203 | } | 208 | } |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 005fdaa2cf7d..178c40d3312e 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -829,13 +829,36 @@ static void venc_put_clocks(void) | |||
829 | clk_put(venc.tv_dac_clk); | 829 | clk_put(venc.tv_dac_clk); |
830 | } | 830 | } |
831 | 831 | ||
832 | static void __init venc_probe_pdata(struct platform_device *pdev) | ||
833 | { | ||
834 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
835 | int r, i; | ||
836 | |||
837 | for (i = 0; i < pdata->num_devices; ++i) { | ||
838 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
839 | |||
840 | if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) | ||
841 | continue; | ||
842 | |||
843 | r = venc_init_display(dssdev); | ||
844 | if (r) { | ||
845 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
846 | continue; | ||
847 | } | ||
848 | |||
849 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
850 | if (r) | ||
851 | DSSERR("device %s register failed: %d\n", | ||
852 | dssdev->name, r); | ||
853 | } | ||
854 | } | ||
855 | |||
832 | /* VENC HW IP initialisation */ | 856 | /* VENC HW IP initialisation */ |
833 | static int __init omap_venchw_probe(struct platform_device *pdev) | 857 | static int __init omap_venchw_probe(struct platform_device *pdev) |
834 | { | 858 | { |
835 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
836 | u8 rev_id; | 859 | u8 rev_id; |
837 | struct resource *venc_mem; | 860 | struct resource *venc_mem; |
838 | int r, i; | 861 | int r; |
839 | 862 | ||
840 | venc.pdev = pdev; | 863 | venc.pdev = pdev; |
841 | 864 | ||
@@ -877,23 +900,7 @@ static int __init omap_venchw_probe(struct platform_device *pdev) | |||
877 | 900 | ||
878 | dss_debugfs_create_file("venc", venc_dump_regs); | 901 | dss_debugfs_create_file("venc", venc_dump_regs); |
879 | 902 | ||
880 | for (i = 0; i < pdata->num_devices; ++i) { | 903 | venc_probe_pdata(pdev); |
881 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
882 | |||
883 | if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) | ||
884 | continue; | ||
885 | |||
886 | r = venc_init_display(dssdev); | ||
887 | if (r) { | ||
888 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
889 | continue; | ||
890 | } | ||
891 | |||
892 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
893 | if (r) | ||
894 | DSSERR("device %s register failed: %d\n", | ||
895 | dssdev->name, r); | ||
896 | } | ||
897 | 904 | ||
898 | return 0; | 905 | return 0; |
899 | 906 | ||