aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/hdmi.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-10 06:58:29 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-18 09:15:05 -0400
commit5274484b821bb2cf34a697624ef14084c31b16ce (patch)
treea5b99b98eb685414b5ff87233da5556ce80ad2f6 /drivers/video/omap2/dss/hdmi.c
parent5eeb55f8703d2af3181599c085b21ce023a0f942 (diff)
OMAPDSS: alloc dssdevs dynamically
We currently create omap_dss_devices statically in board files, and use those devices directly in the omapdss driver. This model prevents us from having the platform data (which the dssdevs in board files practically are) as read-only, and it's also different than what we will use with device tree. This patch changes the model to be in line with DT model: we allocate the dssdevs dynamically, and initialize them according to the data in the board file's dssdev (basically we memcopy the dssdev fields). The allocation and registration is done in the following steps in the output drivers: - Use dss_alloc_and_init_device to allocate and initialize the device. The function uses kalloc and device_initialize to accomplish this. - Call dss_copy_device_pdata to copy the data from the board file's dssdev - Use dss_add_device to register the device. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/hdmi.c')
-rw-r--r--drivers/video/omap2/dss/hdmi.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 3b10e18efa22..23daf7dcf54a 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -931,15 +931,22 @@ static struct omap_dss_device * __init hdmi_find_dssdev(struct platform_device *
931 931
932static void __init hdmi_probe_pdata(struct platform_device *pdev) 932static void __init hdmi_probe_pdata(struct platform_device *pdev)
933{ 933{
934 struct omap_dss_device *plat_dssdev;
934 struct omap_dss_device *dssdev; 935 struct omap_dss_device *dssdev;
935 struct omap_dss_hdmi_data *priv; 936 struct omap_dss_hdmi_data *priv;
936 int r; 937 int r;
937 938
938 dssdev = hdmi_find_dssdev(pdev); 939 plat_dssdev = hdmi_find_dssdev(pdev);
939 940
941 if (!plat_dssdev)
942 return;
943
944 dssdev = dss_alloc_and_init_device(&pdev->dev);
940 if (!dssdev) 945 if (!dssdev)
941 return; 946 return;
942 947
948 dss_copy_device_pdata(dssdev, plat_dssdev);
949
943 priv = dssdev->data; 950 priv = dssdev->data;
944 951
945 hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio; 952 hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio;
@@ -951,12 +958,14 @@ static void __init hdmi_probe_pdata(struct platform_device *pdev)
951 r = hdmi_init_display(dssdev); 958 r = hdmi_init_display(dssdev);
952 if (r) { 959 if (r) {
953 DSSERR("device %s init failed: %d\n", dssdev->name, r); 960 DSSERR("device %s init failed: %d\n", dssdev->name, r);
961 dss_put_device(dssdev);
954 return; 962 return;
955 } 963 }
956 964
957 r = omap_dss_register_device(dssdev, &pdev->dev); 965 r = dss_add_device(dssdev);
958 if (r) { 966 if (r) {
959 DSSERR("device %s register failed: %d\n", dssdev->name, r); 967 DSSERR("device %s register failed: %d\n", dssdev->name, r);
968 dss_put_device(dssdev);
960 return; 969 return;
961 } 970 }
962} 971}
@@ -1020,7 +1029,7 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
1020{ 1029{
1021 device_for_each_child(&pdev->dev, NULL, hdmi_remove_child); 1030 device_for_each_child(&pdev->dev, NULL, hdmi_remove_child);
1022 1031
1023 omap_dss_unregister_child_devices(&pdev->dev); 1032 dss_unregister_child_devices(&pdev->dev);
1024 1033
1025 hdmi_panel_exit(); 1034 hdmi_panel_exit();
1026 1035