aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2014-06-02 04:41:51 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-11-12 06:39:57 -0500
commit80eb6751b7cde41cee766230fe07d982d13c1486 (patch)
tree59c72ee13aa9dd765373fb15cbea26bd60e7e64d /drivers/video
parent2ac6a1aae8f038662b09f2755827dfbe9456894d (diff)
OMAPDSS: DPI: Store dpi_data pointer in the DT port's data
DPI and SDI ports are backed by only one parent DSS device. We don't have a corresponding platform_device for ports under DSS. In order to support multiple instances of DPI, we need to pass the driver data pointer through the DPI port's private data ('data' member in device_node struct). dpi_init_output/dpi_uninit_output are untouched and only used for non-DT case, these are called when the DPI platform device probed/removed. These funcs will be removed when non-DT mode is removed. dpi_init_output_port/dpi_uninit_output_port are created and used for the DT path, called when DSS inits/uninits it's ports. These new functions retrieve the dpi_data pointer from 'port->data', and not from the platform device's data(pdev->dev) like in the non-DT path. We add some code in dss_uninit_ports() to pass a pointer to the DPI port in dpi_uninit_port(). Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/dss/dpi.c36
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.c12
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.h2
3 files changed, 42 insertions, 8 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c
index c9face608b2a..224d7885eeeb 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -59,6 +59,7 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
59 return container_of(dssdev, struct dpi_data, output); 59 return container_of(dssdev, struct dpi_data, output);
60} 60}
61 61
62/* only used in non-DT mode */
62static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev) 63static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev)
63{ 64{
64 return dev_get_drvdata(&pdev->dev); 65 return dev_get_drvdata(&pdev->dev);
@@ -724,6 +725,30 @@ static void __exit dpi_uninit_output(struct platform_device *pdev)
724 omapdss_unregister_output(out); 725 omapdss_unregister_output(out);
725} 726}
726 727
728static void dpi_init_output_port(struct platform_device *pdev,
729 struct device_node *port)
730{
731 struct dpi_data *dpi = port->data;
732 struct omap_dss_device *out = &dpi->output;
733
734 out->dev = &pdev->dev;
735 out->id = OMAP_DSS_OUTPUT_DPI;
736 out->output_type = OMAP_DISPLAY_TYPE_DPI;
737 out->dispc_channel = dpi_get_channel();
738 out->ops.dpi = &dpi_ops;
739 out->owner = THIS_MODULE;
740
741 omapdss_register_output(out);
742}
743
744static void __exit dpi_uninit_output_port(struct device_node *port)
745{
746 struct dpi_data *dpi = port->data;
747 struct omap_dss_device *out = &dpi->output;
748
749 omapdss_unregister_output(out);
750}
751
727static int omap_dpi_probe(struct platform_device *pdev) 752static int omap_dpi_probe(struct platform_device *pdev)
728{ 753{
729 struct dpi_data *dpi; 754 struct dpi_data *dpi;
@@ -796,15 +821,14 @@ int __init dpi_init_port(struct platform_device *pdev, struct device_node *port)
796 of_node_put(ep); 821 of_node_put(ep);
797 822
798 dpi->pdev = pdev; 823 dpi->pdev = pdev;
824 port->data = dpi;
799 825
800 mutex_init(&dpi->lock); 826 mutex_init(&dpi->lock);
801 827
802 dpi_init_output(pdev); 828 dpi_init_output_port(pdev, port);
803 829
804 dpi->port_initialized = true; 830 dpi->port_initialized = true;
805 831
806 dev_set_drvdata(&pdev->dev, dpi);
807
808 return 0; 832 return 0;
809 833
810err_datalines: 834err_datalines:
@@ -813,12 +837,12 @@ err_datalines:
813 return r; 837 return r;
814} 838}
815 839
816void __exit dpi_uninit_port(struct platform_device *pdev) 840void __exit dpi_uninit_port(struct device_node *port)
817{ 841{
818 struct dpi_data *dpi = dpi_get_data_from_pdev(pdev); 842 struct dpi_data *dpi = port->data;
819 843
820 if (!dpi->port_initialized) 844 if (!dpi->port_initialized)
821 return; 845 return;
822 846
823 dpi_uninit_output(dpi->pdev); 847 dpi_uninit_output_port(port);
824} 848}
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c
index 8a4a6d2d1edf..391a6da55e8d 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -822,8 +822,18 @@ static int __init dss_init_ports(struct platform_device *pdev)
822 822
823static void __exit dss_uninit_ports(struct platform_device *pdev) 823static void __exit dss_uninit_ports(struct platform_device *pdev)
824{ 824{
825 struct device_node *parent = pdev->dev.of_node;
826 struct device_node *port;
827
828 if (parent == NULL)
829 return;
830
831 port = omapdss_of_get_next_port(parent, NULL);
832 if (!port)
833 return;
834
825#ifdef CONFIG_OMAP2_DSS_DPI 835#ifdef CONFIG_OMAP2_DSS_DPI
826 dpi_uninit_port(pdev); 836 dpi_uninit_port(port);
827#endif 837#endif
828 838
829#ifdef CONFIG_OMAP2_DSS_SDI 839#ifdef CONFIG_OMAP2_DSS_SDI
diff --git a/drivers/video/fbdev/omap2/dss/dss.h b/drivers/video/fbdev/omap2/dss/dss.h
index da7f5f9bc270..5b9db95533bd 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -359,7 +359,7 @@ int dpi_init_platform_driver(void) __init;
359void dpi_uninit_platform_driver(void) __exit; 359void dpi_uninit_platform_driver(void) __exit;
360 360
361int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; 361int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init;
362void dpi_uninit_port(struct platform_device *pdev) __exit; 362void dpi_uninit_port(struct device_node *port) __exit;
363 363
364/* DISPC */ 364/* DISPC */
365int dispc_init_platform_driver(void) __init; 365int dispc_init_platform_driver(void) __init;