Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Archit Taneja and committed by
Tomi Valkeinen
80eb6751 2ac6a1aa

+42 -8
+30 -6
drivers/video/fbdev/omap2/dss/dpi.c
··· 59 59 return container_of(dssdev, struct dpi_data, output); 60 60 } 61 61 62 + /* only used in non-DT mode */ 62 63 static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev) 63 64 { 64 65 return dev_get_drvdata(&pdev->dev); ··· 725 724 omapdss_unregister_output(out); 726 725 } 727 726 727 + static void dpi_init_output_port(struct platform_device *pdev, 728 + struct device_node *port) 729 + { 730 + struct dpi_data *dpi = port->data; 731 + struct omap_dss_device *out = &dpi->output; 732 + 733 + out->dev = &pdev->dev; 734 + out->id = OMAP_DSS_OUTPUT_DPI; 735 + out->output_type = OMAP_DISPLAY_TYPE_DPI; 736 + out->dispc_channel = dpi_get_channel(); 737 + out->ops.dpi = &dpi_ops; 738 + out->owner = THIS_MODULE; 739 + 740 + omapdss_register_output(out); 741 + } 742 + 743 + static void __exit dpi_uninit_output_port(struct device_node *port) 744 + { 745 + struct dpi_data *dpi = port->data; 746 + struct omap_dss_device *out = &dpi->output; 747 + 748 + omapdss_unregister_output(out); 749 + } 750 + 728 751 static int omap_dpi_probe(struct platform_device *pdev) 729 752 { 730 753 struct dpi_data *dpi; ··· 821 796 of_node_put(ep); 822 797 823 798 dpi->pdev = pdev; 799 + port->data = dpi; 824 800 825 801 mutex_init(&dpi->lock); 826 802 827 - dpi_init_output(pdev); 803 + dpi_init_output_port(pdev, port); 828 804 829 805 dpi->port_initialized = true; 830 - 831 - dev_set_drvdata(&pdev->dev, dpi); 832 806 833 807 return 0; 834 808 ··· 837 813 return r; 838 814 } 839 815 840 - void __exit dpi_uninit_port(struct platform_device *pdev) 816 + void __exit dpi_uninit_port(struct device_node *port) 841 817 { 842 - struct dpi_data *dpi = dpi_get_data_from_pdev(pdev); 818 + struct dpi_data *dpi = port->data; 843 819 844 820 if (!dpi->port_initialized) 845 821 return; 846 822 847 - dpi_uninit_output(dpi->pdev); 823 + dpi_uninit_output_port(port); 848 824 }
+11 -1
drivers/video/fbdev/omap2/dss/dss.c
··· 822 822 823 823 static 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 835 #ifdef CONFIG_OMAP2_DSS_DPI 826 - dpi_uninit_port(pdev); 836 + dpi_uninit_port(port); 827 837 #endif 828 838 829 839 #ifdef CONFIG_OMAP2_DSS_SDI
+1 -1
drivers/video/fbdev/omap2/dss/dss.h
··· 359 359 void dpi_uninit_platform_driver(void) __exit; 360 360 361 361 int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; 362 - void dpi_uninit_port(struct platform_device *pdev) __exit; 362 + void dpi_uninit_port(struct device_node *port) __exit; 363 363 364 364 /* DISPC */ 365 365 int dispc_init_platform_driver(void) __init;