diff options
author | Archit Taneja <archit@ti.com> | 2011-05-12 07:56:29 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-05-12 12:30:27 -0400 |
commit | 5a8b572d832772722c3b3b7578e7fb968560fcf3 (patch) | |
tree | 1d99897d89fcc0f5743cf7503a28a2f6793eed03 /drivers/video/omap2/dss/dsi.c | |
parent | 2e868dbe1d24a908fcb4dee0733500fd0aab0bce (diff) |
OMAP4: DSS2: DSI: Changes for DSI2 on OMAP4
Introduce DSI2 PLL clock sources needed by LCD2 channel and DSI2 Protocol
engine and DISPC Functional clock. Do the following:
- Modify dss_get_dsi_clk_source() and dss_select_dsi_clk_source() to take the
dsi module number as an argument.
- Create debugfs files for dsi2, split the corresponding debugfs functions.
- Allow DPI to use these new clock sources.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 117 |
1 files changed, 101 insertions, 16 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 762b0fe1dc19..85ec3d63a897 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/workqueue.h> | 35 | #include <linux/workqueue.h> |
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/debugfs.h> | ||
38 | 39 | ||
39 | #include <video/omapdss.h> | 40 | #include <video/omapdss.h> |
40 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
@@ -1143,8 +1144,9 @@ static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) | |||
1143 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) | 1144 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) |
1144 | { | 1145 | { |
1145 | unsigned long r; | 1146 | unsigned long r; |
1147 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1146 | 1148 | ||
1147 | if (dss_get_dsi_clk_source() == OMAP_DSS_CLK_SRC_FCK) { | 1149 | if (dss_get_dsi_clk_source(dsi_module) == OMAP_DSS_CLK_SRC_FCK) { |
1148 | /* DSI FCLK source is DSS_CLK_FCK */ | 1150 | /* DSI FCLK source is DSS_CLK_FCK */ |
1149 | r = dss_clk_get_rate(DSS_CLK_FCK); | 1151 | r = dss_clk_get_rate(DSS_CLK_FCK); |
1150 | } else { | 1152 | } else { |
@@ -1670,19 +1672,20 @@ void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes) | |||
1670 | DSSDBG("PLL uninit done\n"); | 1672 | DSSDBG("PLL uninit done\n"); |
1671 | } | 1673 | } |
1672 | 1674 | ||
1673 | void dsi_dump_clocks(struct seq_file *s) | 1675 | static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, |
1676 | struct seq_file *s) | ||
1674 | { | 1677 | { |
1675 | struct platform_device *dsidev = dsi_get_dsidev_from_id(0); | ||
1676 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1678 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1677 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; | 1679 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; |
1678 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; | 1680 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; |
1681 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1679 | 1682 | ||
1680 | dispc_clk_src = dss_get_dispc_clk_source(); | 1683 | dispc_clk_src = dss_get_dispc_clk_source(); |
1681 | dsi_clk_src = dss_get_dsi_clk_source(); | 1684 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); |
1682 | 1685 | ||
1683 | enable_clocks(1); | 1686 | enable_clocks(1); |
1684 | 1687 | ||
1685 | seq_printf(s, "- DSI PLL -\n"); | 1688 | seq_printf(s, "- DSI%d PLL -\n", dsi_module + 1); |
1686 | 1689 | ||
1687 | seq_printf(s, "dsi pll source = %s\n", | 1690 | seq_printf(s, "dsi pll source = %s\n", |
1688 | cinfo->use_sys_clk ? "dss_sys_clk" : "pclkfree"); | 1691 | cinfo->use_sys_clk ? "dss_sys_clk" : "pclkfree"); |
@@ -1708,7 +1711,7 @@ void dsi_dump_clocks(struct seq_file *s) | |||
1708 | dsi_clk_src == OMAP_DSS_CLK_SRC_FCK ? | 1711 | dsi_clk_src == OMAP_DSS_CLK_SRC_FCK ? |
1709 | "off" : "on"); | 1712 | "off" : "on"); |
1710 | 1713 | ||
1711 | seq_printf(s, "- DSI -\n"); | 1714 | seq_printf(s, "- DSI%d -\n", dsi_module + 1); |
1712 | 1715 | ||
1713 | seq_printf(s, "dsi fclk source = %s (%s)\n", | 1716 | seq_printf(s, "dsi fclk source = %s (%s)\n", |
1714 | dss_get_generic_clk_source_name(dsi_clk_src), | 1717 | dss_get_generic_clk_source_name(dsi_clk_src), |
@@ -1731,13 +1734,26 @@ void dsi_dump_clocks(struct seq_file *s) | |||
1731 | enable_clocks(0); | 1734 | enable_clocks(0); |
1732 | } | 1735 | } |
1733 | 1736 | ||
1737 | void dsi_dump_clocks(struct seq_file *s) | ||
1738 | { | ||
1739 | struct platform_device *dsidev; | ||
1740 | int i; | ||
1741 | |||
1742 | for (i = 0; i < MAX_NUM_DSI; i++) { | ||
1743 | dsidev = dsi_get_dsidev_from_id(i); | ||
1744 | if (dsidev) | ||
1745 | dsi_dump_dsidev_clocks(dsidev, s); | ||
1746 | } | ||
1747 | } | ||
1748 | |||
1734 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 1749 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
1735 | void dsi_dump_irqs(struct seq_file *s) | 1750 | static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, |
1751 | struct seq_file *s) | ||
1736 | { | 1752 | { |
1737 | struct platform_device *dsidev = dsi_get_dsidev_from_id(0); | ||
1738 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1753 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1739 | unsigned long flags; | 1754 | unsigned long flags; |
1740 | struct dsi_irq_stats stats; | 1755 | struct dsi_irq_stats stats; |
1756 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1741 | 1757 | ||
1742 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); | 1758 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); |
1743 | 1759 | ||
@@ -1754,7 +1770,7 @@ void dsi_dump_irqs(struct seq_file *s) | |||
1754 | #define PIS(x) \ | 1770 | #define PIS(x) \ |
1755 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); | 1771 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); |
1756 | 1772 | ||
1757 | seq_printf(s, "-- DSI interrupts --\n"); | 1773 | seq_printf(s, "-- DSI%d interrupts --\n", dsi_module + 1); |
1758 | PIS(VC0); | 1774 | PIS(VC0); |
1759 | PIS(VC1); | 1775 | PIS(VC1); |
1760 | PIS(VC2); | 1776 | PIS(VC2); |
@@ -1820,12 +1836,41 @@ void dsi_dump_irqs(struct seq_file *s) | |||
1820 | PIS(ULPSACTIVENOT_ALL1); | 1836 | PIS(ULPSACTIVENOT_ALL1); |
1821 | #undef PIS | 1837 | #undef PIS |
1822 | } | 1838 | } |
1823 | #endif | ||
1824 | 1839 | ||
1825 | void dsi_dump_regs(struct seq_file *s) | 1840 | static void dsi1_dump_irqs(struct seq_file *s) |
1826 | { | 1841 | { |
1827 | struct platform_device *dsidev = dsi_get_dsidev_from_id(0); | 1842 | struct platform_device *dsidev = dsi_get_dsidev_from_id(0); |
1828 | 1843 | ||
1844 | dsi_dump_dsidev_irqs(dsidev, s); | ||
1845 | } | ||
1846 | |||
1847 | static void dsi2_dump_irqs(struct seq_file *s) | ||
1848 | { | ||
1849 | struct platform_device *dsidev = dsi_get_dsidev_from_id(1); | ||
1850 | |||
1851 | dsi_dump_dsidev_irqs(dsidev, s); | ||
1852 | } | ||
1853 | |||
1854 | void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir, | ||
1855 | const struct file_operations *debug_fops) | ||
1856 | { | ||
1857 | struct platform_device *dsidev; | ||
1858 | |||
1859 | dsidev = dsi_get_dsidev_from_id(0); | ||
1860 | if (dsidev) | ||
1861 | debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir, | ||
1862 | &dsi1_dump_irqs, debug_fops); | ||
1863 | |||
1864 | dsidev = dsi_get_dsidev_from_id(1); | ||
1865 | if (dsidev) | ||
1866 | debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir, | ||
1867 | &dsi2_dump_irqs, debug_fops); | ||
1868 | } | ||
1869 | #endif | ||
1870 | |||
1871 | static void dsi_dump_dsidev_regs(struct platform_device *dsidev, | ||
1872 | struct seq_file *s) | ||
1873 | { | ||
1829 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) | 1874 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) |
1830 | 1875 | ||
1831 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); | 1876 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); |
@@ -1906,6 +1951,35 @@ void dsi_dump_regs(struct seq_file *s) | |||
1906 | #undef DUMPREG | 1951 | #undef DUMPREG |
1907 | } | 1952 | } |
1908 | 1953 | ||
1954 | static void dsi1_dump_regs(struct seq_file *s) | ||
1955 | { | ||
1956 | struct platform_device *dsidev = dsi_get_dsidev_from_id(0); | ||
1957 | |||
1958 | dsi_dump_dsidev_regs(dsidev, s); | ||
1959 | } | ||
1960 | |||
1961 | static void dsi2_dump_regs(struct seq_file *s) | ||
1962 | { | ||
1963 | struct platform_device *dsidev = dsi_get_dsidev_from_id(1); | ||
1964 | |||
1965 | dsi_dump_dsidev_regs(dsidev, s); | ||
1966 | } | ||
1967 | |||
1968 | void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir, | ||
1969 | const struct file_operations *debug_fops) | ||
1970 | { | ||
1971 | struct platform_device *dsidev; | ||
1972 | |||
1973 | dsidev = dsi_get_dsidev_from_id(0); | ||
1974 | if (dsidev) | ||
1975 | debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir, | ||
1976 | &dsi1_dump_regs, debug_fops); | ||
1977 | |||
1978 | dsidev = dsi_get_dsidev_from_id(1); | ||
1979 | if (dsidev) | ||
1980 | debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir, | ||
1981 | &dsi2_dump_regs, debug_fops); | ||
1982 | } | ||
1909 | enum dsi_cio_power_state { | 1983 | enum dsi_cio_power_state { |
1910 | DSI_COMPLEXIO_POWER_OFF = 0x0, | 1984 | DSI_COMPLEXIO_POWER_OFF = 0x0, |
1911 | DSI_COMPLEXIO_POWER_ON = 0x1, | 1985 | DSI_COMPLEXIO_POWER_ON = 0x1, |
@@ -3847,9 +3921,13 @@ EXPORT_SYMBOL(omap_dsi_update); | |||
3847 | static int dsi_display_init_dispc(struct omap_dss_device *dssdev) | 3921 | static int dsi_display_init_dispc(struct omap_dss_device *dssdev) |
3848 | { | 3922 | { |
3849 | int r; | 3923 | int r; |
3924 | u32 irq; | ||
3925 | |||
3926 | irq = dssdev->manager->id == OMAP_DSS_CHANNEL_LCD ? | ||
3927 | DISPC_IRQ_FRAMEDONE : DISPC_IRQ_FRAMEDONE2; | ||
3850 | 3928 | ||
3851 | r = omap_dispc_register_isr(dsi_framedone_irq_callback, (void *) dssdev, | 3929 | r = omap_dispc_register_isr(dsi_framedone_irq_callback, (void *) dssdev, |
3852 | DISPC_IRQ_FRAMEDONE); | 3930 | irq); |
3853 | if (r) { | 3931 | if (r) { |
3854 | DSSERR("can't get FRAMEDONE irq\n"); | 3932 | DSSERR("can't get FRAMEDONE irq\n"); |
3855 | return r; | 3933 | return r; |
@@ -3882,8 +3960,13 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) | |||
3882 | 3960 | ||
3883 | static void dsi_display_uninit_dispc(struct omap_dss_device *dssdev) | 3961 | static void dsi_display_uninit_dispc(struct omap_dss_device *dssdev) |
3884 | { | 3962 | { |
3963 | u32 irq; | ||
3964 | |||
3965 | irq = dssdev->manager->id == OMAP_DSS_CHANNEL_LCD ? | ||
3966 | DISPC_IRQ_FRAMEDONE : DISPC_IRQ_FRAMEDONE2; | ||
3967 | |||
3885 | omap_dispc_unregister_isr(dsi_framedone_irq_callback, (void *) dssdev, | 3968 | omap_dispc_unregister_isr(dsi_framedone_irq_callback, (void *) dssdev, |
3886 | DISPC_IRQ_FRAMEDONE); | 3969 | irq); |
3887 | } | 3970 | } |
3888 | 3971 | ||
3889 | static int dsi_configure_dsi_clocks(struct omap_dss_device *dssdev) | 3972 | static int dsi_configure_dsi_clocks(struct omap_dss_device *dssdev) |
@@ -3943,6 +4026,7 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev) | |||
3943 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | 4026 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) |
3944 | { | 4027 | { |
3945 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4028 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4029 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
3946 | int r; | 4030 | int r; |
3947 | 4031 | ||
3948 | r = dsi_pll_init(dsidev, true, true); | 4032 | r = dsi_pll_init(dsidev, true, true); |
@@ -3954,7 +4038,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
3954 | goto err1; | 4038 | goto err1; |
3955 | 4039 | ||
3956 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); | 4040 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
3957 | dss_select_dsi_clk_source(dssdev->clocks.dsi.dsi_fclk_src); | 4041 | dss_select_dsi_clk_source(dsi_module, dssdev->clocks.dsi.dsi_fclk_src); |
3958 | dss_select_lcd_clk_source(dssdev->manager->id, | 4042 | dss_select_lcd_clk_source(dssdev->manager->id, |
3959 | dssdev->clocks.dispc.channel.lcd_clk_src); | 4043 | dssdev->clocks.dispc.channel.lcd_clk_src); |
3960 | 4044 | ||
@@ -3993,7 +4077,7 @@ err3: | |||
3993 | dsi_cio_uninit(dsidev); | 4077 | dsi_cio_uninit(dsidev); |
3994 | err2: | 4078 | err2: |
3995 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4079 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
3996 | dss_select_dsi_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4080 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); |
3997 | err1: | 4081 | err1: |
3998 | dsi_pll_uninit(dsidev, true); | 4082 | dsi_pll_uninit(dsidev, true); |
3999 | err0: | 4083 | err0: |
@@ -4005,6 +4089,7 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4005 | { | 4089 | { |
4006 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4090 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4007 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4091 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4092 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
4008 | 4093 | ||
4009 | if (enter_ulps && !dsi->ulps_enabled) | 4094 | if (enter_ulps && !dsi->ulps_enabled) |
4010 | dsi_enter_ulps(dsidev); | 4095 | dsi_enter_ulps(dsidev); |
@@ -4017,7 +4102,7 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4017 | dsi_vc_enable(dsidev, 3, 0); | 4102 | dsi_vc_enable(dsidev, 3, 0); |
4018 | 4103 | ||
4019 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4104 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4020 | dss_select_dsi_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4105 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); |
4021 | dsi_cio_uninit(dsidev); | 4106 | dsi_cio_uninit(dsidev); |
4022 | dsi_pll_uninit(dsidev, disconnect_lanes); | 4107 | dsi_pll_uninit(dsidev, disconnect_lanes); |
4023 | } | 4108 | } |