diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 11:06:24 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 11:06:24 -0500 |
commit | 9265c6a186ca19a57ab6ddd0b0f3644f85c6f2f1 (patch) | |
tree | d8c434ea98ee541ee17f4df87bb8e9020ce29b98 /drivers/video | |
parent | 49ea7fc094162fcaa83f5876b2090c816cc4498c (diff) | |
parent | 6ba54ab4a49bbad736b0254aa6bdf0cb83013815 (diff) |
Merge branch 'omap/headers4' into next/cleanup
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap/lcd_inn1510.c | 7 | ||||
-rw-r--r-- | drivers/video/omap/lcdc.c | 2 | ||||
-rw-r--r-- | drivers/video/omap/omapfb_main.c | 2 | ||||
-rw-r--r-- | drivers/video/omap/sossi.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/dss/core.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 43 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.c | 39 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss_features.c | 64 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss_features.h | 5 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 3 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-ioctl.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 8 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/vrfb.c | 142 |
14 files changed, 237 insertions, 86 deletions
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/omap/lcd_inn1510.c index b38b1dd15ce3..2ee423279e35 100644 --- a/drivers/video/omap/lcd_inn1510.c +++ b/drivers/video/omap/lcd_inn1510.c | |||
@@ -23,7 +23,8 @@ | |||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | 25 | ||
26 | #include <plat/fpga.h> | 26 | #include <mach/hardware.h> |
27 | |||
27 | #include "omapfb.h" | 28 | #include "omapfb.h" |
28 | 29 | ||
29 | static int innovator1510_panel_init(struct lcd_panel *panel, | 30 | static int innovator1510_panel_init(struct lcd_panel *panel, |
@@ -38,13 +39,13 @@ static void innovator1510_panel_cleanup(struct lcd_panel *panel) | |||
38 | 39 | ||
39 | static int innovator1510_panel_enable(struct lcd_panel *panel) | 40 | static int innovator1510_panel_enable(struct lcd_panel *panel) |
40 | { | 41 | { |
41 | fpga_write(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL); | 42 | __raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL); |
42 | return 0; | 43 | return 0; |
43 | } | 44 | } |
44 | 45 | ||
45 | static void innovator1510_panel_disable(struct lcd_panel *panel) | 46 | static void innovator1510_panel_disable(struct lcd_panel *panel) |
46 | { | 47 | { |
47 | fpga_write(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL); | 48 | __raw_writeb(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL); |
48 | } | 49 | } |
49 | 50 | ||
50 | static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel) | 51 | static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel) |
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c index 7767338f8b14..c39d6e46f8c5 100644 --- a/drivers/video/omap/lcdc.c +++ b/drivers/video/omap/lcdc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/gfp.h> | 31 | #include <linux/gfp.h> |
32 | 32 | ||
33 | #include <mach/lcdc.h> | 33 | #include <mach/lcdc.h> |
34 | #include <plat/dma.h> | 34 | #include <plat-omap/dma-omap.h> |
35 | 35 | ||
36 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
37 | 37 | ||
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 4351c438b76f..1b5ee8ec192a 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | 32 | ||
33 | #include <plat/dma.h> | 33 | #include <plat-omap/dma-omap.h> |
34 | 34 | ||
35 | #include "omapfb.h" | 35 | #include "omapfb.h" |
36 | #include "lcdc.h" | 36 | #include "lcdc.h" |
diff --git a/drivers/video/omap/sossi.c b/drivers/video/omap/sossi.c index f79c137753d7..c510a4457398 100644 --- a/drivers/video/omap/sossi.c +++ b/drivers/video/omap/sossi.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | 27 | ||
28 | #include <plat/dma.h> | 28 | #include <plat-omap/dma-omap.h> |
29 | 29 | ||
30 | #include "omapfb.h" | 30 | #include "omapfb.h" |
31 | #include "lcdc.h" | 31 | #include "lcdc.h" |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index b2af72dc20bd..d94ef9e31a35 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -237,7 +237,7 @@ static int __init omap_dss_probe(struct platform_device *pdev) | |||
237 | 237 | ||
238 | core.pdev = pdev; | 238 | core.pdev = pdev; |
239 | 239 | ||
240 | dss_features_init(); | 240 | dss_features_init(pdata->version); |
241 | 241 | ||
242 | dss_apply_init(); | 242 | dss_apply_init(); |
243 | 243 | ||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index b43477a5fae8..a5ab354f267a 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/pm_runtime.h> | 38 | #include <linux/pm_runtime.h> |
39 | 39 | ||
40 | #include <plat/cpu.h> | ||
41 | |||
42 | #include <video/omapdss.h> | 40 | #include <video/omapdss.h> |
43 | 41 | ||
44 | #include "dss.h" | 42 | #include "dss.h" |
@@ -4042,29 +4040,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = { | |||
4042 | .gfx_fifo_workaround = true, | 4040 | .gfx_fifo_workaround = true, |
4043 | }; | 4041 | }; |
4044 | 4042 | ||
4045 | static int __init dispc_init_features(struct device *dev) | 4043 | static int __init dispc_init_features(struct platform_device *pdev) |
4046 | { | 4044 | { |
4045 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
4047 | const struct dispc_features *src; | 4046 | const struct dispc_features *src; |
4048 | struct dispc_features *dst; | 4047 | struct dispc_features *dst; |
4049 | 4048 | ||
4050 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 4049 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
4051 | if (!dst) { | 4050 | if (!dst) { |
4052 | dev_err(dev, "Failed to allocate DISPC Features\n"); | 4051 | dev_err(&pdev->dev, "Failed to allocate DISPC Features\n"); |
4053 | return -ENOMEM; | 4052 | return -ENOMEM; |
4054 | } | 4053 | } |
4055 | 4054 | ||
4056 | if (cpu_is_omap24xx()) { | 4055 | switch (pdata->version) { |
4056 | case OMAPDSS_VER_OMAP24xx: | ||
4057 | src = &omap24xx_dispc_feats; | 4057 | src = &omap24xx_dispc_feats; |
4058 | } else if (cpu_is_omap34xx()) { | 4058 | break; |
4059 | if (omap_rev() < OMAP3430_REV_ES3_0) | 4059 | |
4060 | src = &omap34xx_rev1_0_dispc_feats; | 4060 | case OMAPDSS_VER_OMAP34xx_ES1: |
4061 | else | 4061 | src = &omap34xx_rev1_0_dispc_feats; |
4062 | src = &omap34xx_rev3_0_dispc_feats; | 4062 | break; |
4063 | } else if (cpu_is_omap44xx()) { | 4063 | |
4064 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
4065 | case OMAPDSS_VER_OMAP3630: | ||
4066 | case OMAPDSS_VER_AM35xx: | ||
4067 | src = &omap34xx_rev3_0_dispc_feats; | ||
4068 | break; | ||
4069 | |||
4070 | case OMAPDSS_VER_OMAP4430_ES1: | ||
4071 | case OMAPDSS_VER_OMAP4430_ES2: | ||
4072 | case OMAPDSS_VER_OMAP4: | ||
4064 | src = &omap44xx_dispc_feats; | 4073 | src = &omap44xx_dispc_feats; |
4065 | } else if (soc_is_omap54xx()) { | 4074 | break; |
4075 | |||
4076 | case OMAPDSS_VER_OMAP5: | ||
4066 | src = &omap44xx_dispc_feats; | 4077 | src = &omap44xx_dispc_feats; |
4067 | } else { | 4078 | break; |
4079 | |||
4080 | default: | ||
4068 | return -ENODEV; | 4081 | return -ENODEV; |
4069 | } | 4082 | } |
4070 | 4083 | ||
@@ -4084,7 +4097,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev) | |||
4084 | 4097 | ||
4085 | dispc.pdev = pdev; | 4098 | dispc.pdev = pdev; |
4086 | 4099 | ||
4087 | r = dispc_init_features(&dispc.pdev->dev); | 4100 | r = dispc_init_features(dispc.pdev); |
4088 | if (r) | 4101 | if (r) |
4089 | return r; | 4102 | return r; |
4090 | 4103 | ||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 2ab1c3e96553..363852a0f764 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | 37 | ||
38 | #include <plat/cpu.h> | ||
39 | |||
40 | #include "dss.h" | 38 | #include "dss.h" |
41 | #include "dss_features.h" | 39 | #include "dss_features.h" |
42 | 40 | ||
@@ -792,29 +790,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = { | |||
792 | .dpi_select_source = &dss_dpi_select_source_omap5, | 790 | .dpi_select_source = &dss_dpi_select_source_omap5, |
793 | }; | 791 | }; |
794 | 792 | ||
795 | static int __init dss_init_features(struct device *dev) | 793 | static int __init dss_init_features(struct platform_device *pdev) |
796 | { | 794 | { |
795 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
797 | const struct dss_features *src; | 796 | const struct dss_features *src; |
798 | struct dss_features *dst; | 797 | struct dss_features *dst; |
799 | 798 | ||
800 | dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); | 799 | dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); |
801 | if (!dst) { | 800 | if (!dst) { |
802 | dev_err(dev, "Failed to allocate local DSS Features\n"); | 801 | dev_err(&pdev->dev, "Failed to allocate local DSS Features\n"); |
803 | return -ENOMEM; | 802 | return -ENOMEM; |
804 | } | 803 | } |
805 | 804 | ||
806 | if (cpu_is_omap24xx()) | 805 | switch (pdata->version) { |
806 | case OMAPDSS_VER_OMAP24xx: | ||
807 | src = &omap24xx_dss_feats; | 807 | src = &omap24xx_dss_feats; |
808 | else if (cpu_is_omap34xx()) | 808 | break; |
809 | |||
810 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
811 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
812 | case OMAPDSS_VER_AM35xx: | ||
809 | src = &omap34xx_dss_feats; | 813 | src = &omap34xx_dss_feats; |
810 | else if (cpu_is_omap3630()) | 814 | break; |
815 | |||
816 | case OMAPDSS_VER_OMAP3630: | ||
811 | src = &omap3630_dss_feats; | 817 | src = &omap3630_dss_feats; |
812 | else if (cpu_is_omap44xx()) | 818 | break; |
819 | |||
820 | case OMAPDSS_VER_OMAP4430_ES1: | ||
821 | case OMAPDSS_VER_OMAP4430_ES2: | ||
822 | case OMAPDSS_VER_OMAP4: | ||
813 | src = &omap44xx_dss_feats; | 823 | src = &omap44xx_dss_feats; |
814 | else if (soc_is_omap54xx()) | 824 | break; |
825 | |||
826 | case OMAPDSS_VER_OMAP5: | ||
815 | src = &omap54xx_dss_feats; | 827 | src = &omap54xx_dss_feats; |
816 | else | 828 | break; |
829 | |||
830 | default: | ||
817 | return -ENODEV; | 831 | return -ENODEV; |
832 | } | ||
818 | 833 | ||
819 | memcpy(dst, src, sizeof(*dst)); | 834 | memcpy(dst, src, sizeof(*dst)); |
820 | dss.feat = dst; | 835 | dss.feat = dst; |
@@ -831,7 +846,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev) | |||
831 | 846 | ||
832 | dss.pdev = pdev; | 847 | dss.pdev = pdev; |
833 | 848 | ||
834 | r = dss_init_features(&dss.pdev->dev); | 849 | r = dss_init_features(dss.pdev); |
835 | if (r) | 850 | if (r) |
836 | return r; | 851 | return r; |
837 | 852 | ||
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index acbc1e1efba3..3e8287c8709d 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | 24 | ||
25 | #include <video/omapdss.h> | 25 | #include <video/omapdss.h> |
26 | #include <plat/cpu.h> | ||
27 | 26 | ||
28 | #include "dss.h" | 27 | #include "dss.h" |
29 | #include "dss_features.h" | 28 | #include "dss_features.h" |
@@ -825,10 +824,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { | |||
825 | 824 | ||
826 | }; | 825 | }; |
827 | 826 | ||
828 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data) | 827 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
828 | enum omapdss_version version) | ||
829 | { | 829 | { |
830 | if (cpu_is_omap44xx()) | 830 | switch (version) { |
831 | case OMAPDSS_VER_OMAP4430_ES1: | ||
832 | case OMAPDSS_VER_OMAP4430_ES2: | ||
833 | case OMAPDSS_VER_OMAP4: | ||
831 | ip_data->ops = &omap4_hdmi_functions; | 834 | ip_data->ops = &omap4_hdmi_functions; |
835 | break; | ||
836 | default: | ||
837 | ip_data->ops = NULL; | ||
838 | } | ||
839 | |||
840 | WARN_ON(ip_data->ops == NULL); | ||
832 | } | 841 | } |
833 | #endif | 842 | #endif |
834 | 843 | ||
@@ -929,29 +938,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type) | |||
929 | return omap_current_dss_features->supported_rotation_types & rot_type; | 938 | return omap_current_dss_features->supported_rotation_types & rot_type; |
930 | } | 939 | } |
931 | 940 | ||
932 | void dss_features_init(void) | 941 | void dss_features_init(enum omapdss_version version) |
933 | { | 942 | { |
934 | if (cpu_is_omap24xx()) | 943 | switch (version) { |
944 | case OMAPDSS_VER_OMAP24xx: | ||
935 | omap_current_dss_features = &omap2_dss_features; | 945 | omap_current_dss_features = &omap2_dss_features; |
936 | else if (cpu_is_omap3630()) | 946 | break; |
947 | |||
948 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
949 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
950 | omap_current_dss_features = &omap3430_dss_features; | ||
951 | break; | ||
952 | |||
953 | case OMAPDSS_VER_OMAP3630: | ||
937 | omap_current_dss_features = &omap3630_dss_features; | 954 | omap_current_dss_features = &omap3630_dss_features; |
938 | else if (cpu_is_omap34xx()) { | 955 | break; |
939 | if (soc_is_am35xx()) { | 956 | |
940 | omap_current_dss_features = &am35xx_dss_features; | 957 | case OMAPDSS_VER_OMAP4430_ES1: |
941 | } else { | ||
942 | omap_current_dss_features = &omap3430_dss_features; | ||
943 | } | ||
944 | } | ||
945 | else if (omap_rev() == OMAP4430_REV_ES1_0) | ||
946 | omap_current_dss_features = &omap4430_es1_0_dss_features; | 958 | omap_current_dss_features = &omap4430_es1_0_dss_features; |
947 | else if (omap_rev() == OMAP4430_REV_ES2_0 || | 959 | break; |
948 | omap_rev() == OMAP4430_REV_ES2_1 || | 960 | |
949 | omap_rev() == OMAP4430_REV_ES2_2) | 961 | case OMAPDSS_VER_OMAP4430_ES2: |
950 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; | 962 | omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; |
951 | else if (cpu_is_omap44xx()) | 963 | break; |
964 | |||
965 | case OMAPDSS_VER_OMAP4: | ||
952 | omap_current_dss_features = &omap4_dss_features; | 966 | omap_current_dss_features = &omap4_dss_features; |
953 | else if (soc_is_omap54xx()) | 967 | break; |
968 | |||
969 | case OMAPDSS_VER_OMAP5: | ||
954 | omap_current_dss_features = &omap5_dss_features; | 970 | omap_current_dss_features = &omap5_dss_features; |
955 | else | 971 | break; |
972 | |||
973 | case OMAPDSS_VER_AM35xx: | ||
974 | omap_current_dss_features = &am35xx_dss_features; | ||
975 | break; | ||
976 | |||
977 | default: | ||
956 | DSSWARN("Unsupported OMAP version"); | 978 | DSSWARN("Unsupported OMAP version"); |
979 | break; | ||
980 | } | ||
957 | } | 981 | } |
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index 9218113b5e88..fc492ef72a51 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h | |||
@@ -123,8 +123,9 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type); | |||
123 | 123 | ||
124 | bool dss_has_feature(enum dss_feat_id id); | 124 | bool dss_has_feature(enum dss_feat_id id); |
125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); | 125 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); |
126 | void dss_features_init(void); | 126 | void dss_features_init(enum omapdss_version version); |
127 | #if defined(CONFIG_OMAP4_DSS_HDMI) | 127 | #if defined(CONFIG_OMAP4_DSS_HDMI) |
128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data); | 128 | void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, |
129 | enum omapdss_version version); | ||
129 | #endif | 130 | #endif |
130 | #endif | 131 | #endif |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index a48a7dd75b33..adcc906d12f8 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void) | |||
323 | 323 | ||
324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) | 324 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
325 | { | 325 | { |
326 | struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data; | ||
326 | int r; | 327 | int r; |
327 | 328 | ||
328 | struct gpio gpios[] = { | 329 | struct gpio gpios[] = { |
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev) | |||
333 | 334 | ||
334 | DSSDBG("init_display\n"); | 335 | DSSDBG("init_display\n"); |
335 | 336 | ||
336 | dss_init_hdmi_ip_ops(&hdmi.ip_data); | 337 | dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version); |
337 | 338 | ||
338 | if (hdmi.vdda_hdmi_dac_reg == NULL) { | 339 | if (hdmi.vdda_hdmi_dac_reg == NULL) { |
339 | struct regulator *reg; | 340 | struct regulator *reg; |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 606b89f12351..55a39be694a5 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
35 | 35 | ||
36 | #include "omapfb.h" | 36 | #include "omapfb.h" |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 16db1589bd91..bc225e46fdd2 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -31,9 +31,8 @@ | |||
31 | #include <linux/omapfb.h> | 31 | #include <linux/omapfb.h> |
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <plat/cpu.h> | ||
35 | #include <plat/vram.h> | 34 | #include <plat/vram.h> |
36 | #include <plat/vrfb.h> | 35 | #include <video/omapvrfb.h> |
37 | 36 | ||
38 | #include "omapfb.h" | 37 | #include "omapfb.h" |
39 | 38 | ||
@@ -2396,10 +2395,7 @@ static int __init omapfb_probe(struct platform_device *pdev) | |||
2396 | goto err0; | 2395 | goto err0; |
2397 | } | 2396 | } |
2398 | 2397 | ||
2399 | /* TODO : Replace cpu check with omap_has_vrfb once HAS_FEATURE | 2398 | if (def_vrfb && !omap_vrfb_supported()) { |
2400 | * available for OMAP2 and OMAP3 | ||
2401 | */ | ||
2402 | if (def_vrfb && !cpu_is_omap24xx() && !cpu_is_omap34xx()) { | ||
2403 | def_vrfb = 0; | 2399 | def_vrfb = 0; |
2404 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " | 2400 | dev_warn(&pdev->dev, "VRFB is not supported on this hardware, " |
2405 | "ignoring the module parameter vrfb=y\n"); | 2401 | "ignoring the module parameter vrfb=y\n"); |
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c index e8d8cc76a435..17aa174e187c 100644 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/omapfb.h> | 30 | #include <linux/omapfb.h> |
31 | 31 | ||
32 | #include <video/omapdss.h> | 32 | #include <video/omapdss.h> |
33 | #include <plat/vrfb.h> | 33 | #include <video/omapvrfb.h> |
34 | 34 | ||
35 | #include "omapfb.h" | 35 | #include "omapfb.h" |
36 | 36 | ||
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 7e990220ad2a..5d8fdac3b800 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/bitops.h> | 27 | #include <linux/bitops.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include <plat/vrfb.h> | 31 | #include <video/omapvrfb.h> |
31 | #include <plat/sdrc.h> | ||
32 | 32 | ||
33 | #ifdef DEBUG | 33 | #ifdef DEBUG |
34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) | 34 | #define DBG(format, ...) pr_debug("VRFB: " format, ## __VA_ARGS__) |
@@ -36,10 +36,10 @@ | |||
36 | #define DBG(format, ...) | 36 | #define DBG(format, ...) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define SMS_ROT_VIRT_BASE(context, rot) \ | 39 | #define SMS_ROT_CONTROL(context) (0x0 + 0x10 * context) |
40 | (((context >= 4) ? 0xD0000000 : 0x70000000) \ | 40 | #define SMS_ROT_SIZE(context) (0x4 + 0x10 * context) |
41 | + (0x4000000 * (context)) \ | 41 | #define SMS_ROT_PHYSICAL_BA(context) (0x8 + 0x10 * context) |
42 | + (0x1000000 * (rot))) | 42 | #define SMS_ROT_VIRT_BASE(rot) (0x1000000 * (rot)) |
43 | 43 | ||
44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) | 44 | #define OMAP_VRFB_SIZE (2048 * 2048 * 4) |
45 | 45 | ||
@@ -53,10 +53,16 @@ | |||
53 | #define SMS_PW_OFFSET 4 | 53 | #define SMS_PW_OFFSET 4 |
54 | #define SMS_PS_OFFSET 0 | 54 | #define SMS_PS_OFFSET 0 |
55 | 55 | ||
56 | #define VRFB_NUM_CTXS 12 | ||
57 | /* bitmap of reserved contexts */ | 56 | /* bitmap of reserved contexts */ |
58 | static unsigned long ctx_map; | 57 | static unsigned long ctx_map; |
59 | 58 | ||
59 | struct vrfb_ctx { | ||
60 | u32 base; | ||
61 | u32 physical_ba; | ||
62 | u32 control; | ||
63 | u32 size; | ||
64 | }; | ||
65 | |||
60 | static DEFINE_MUTEX(ctx_lock); | 66 | static DEFINE_MUTEX(ctx_lock); |
61 | 67 | ||
62 | /* | 68 | /* |
@@ -65,17 +71,34 @@ static DEFINE_MUTEX(ctx_lock); | |||
65 | * we don't need locking, since no drivers will run until after the wake-up | 71 | * we don't need locking, since no drivers will run until after the wake-up |
66 | * has finished. | 72 | * has finished. |
67 | */ | 73 | */ |
68 | static struct { | 74 | |
69 | u32 physical_ba; | 75 | static void __iomem *vrfb_base; |
70 | u32 control; | 76 | |
71 | u32 size; | 77 | static int num_ctxs; |
72 | } vrfb_hw_context[VRFB_NUM_CTXS]; | 78 | static struct vrfb_ctx *ctxs; |
79 | |||
80 | static bool vrfb_loaded; | ||
81 | |||
82 | static void omap2_sms_write_rot_control(u32 val, unsigned ctx) | ||
83 | { | ||
84 | __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); | ||
85 | } | ||
86 | |||
87 | static void omap2_sms_write_rot_size(u32 val, unsigned ctx) | ||
88 | { | ||
89 | __raw_writel(val, vrfb_base + SMS_ROT_SIZE(ctx)); | ||
90 | } | ||
91 | |||
92 | static void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) | ||
93 | { | ||
94 | __raw_writel(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx)); | ||
95 | } | ||
73 | 96 | ||
74 | static inline void restore_hw_context(int ctx) | 97 | static inline void restore_hw_context(int ctx) |
75 | { | 98 | { |
76 | omap2_sms_write_rot_control(vrfb_hw_context[ctx].control, ctx); | 99 | omap2_sms_write_rot_control(ctxs[ctx].control, ctx); |
77 | omap2_sms_write_rot_size(vrfb_hw_context[ctx].size, ctx); | 100 | omap2_sms_write_rot_size(ctxs[ctx].size, ctx); |
78 | omap2_sms_write_rot_physical_ba(vrfb_hw_context[ctx].physical_ba, ctx); | 101 | omap2_sms_write_rot_physical_ba(ctxs[ctx].physical_ba, ctx); |
79 | } | 102 | } |
80 | 103 | ||
81 | static u32 get_image_width_roundup(u16 width, u8 bytespp) | 104 | static u32 get_image_width_roundup(u16 width, u8 bytespp) |
@@ -196,9 +219,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | |||
196 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; | 219 | control |= VRFB_PAGE_WIDTH_EXP << SMS_PW_OFFSET; |
197 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; | 220 | control |= VRFB_PAGE_HEIGHT_EXP << SMS_PH_OFFSET; |
198 | 221 | ||
199 | vrfb_hw_context[ctx].physical_ba = paddr; | 222 | ctxs[ctx].physical_ba = paddr; |
200 | vrfb_hw_context[ctx].size = size; | 223 | ctxs[ctx].size = size; |
201 | vrfb_hw_context[ctx].control = control; | 224 | ctxs[ctx].control = control; |
202 | 225 | ||
203 | omap2_sms_write_rot_physical_ba(paddr, ctx); | 226 | omap2_sms_write_rot_physical_ba(paddr, ctx); |
204 | omap2_sms_write_rot_size(size, ctx); | 227 | omap2_sms_write_rot_size(size, ctx); |
@@ -274,11 +297,11 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
274 | 297 | ||
275 | mutex_lock(&ctx_lock); | 298 | mutex_lock(&ctx_lock); |
276 | 299 | ||
277 | for (ctx = 0; ctx < VRFB_NUM_CTXS; ++ctx) | 300 | for (ctx = 0; ctx < num_ctxs; ++ctx) |
278 | if ((ctx_map & (1 << ctx)) == 0) | 301 | if ((ctx_map & (1 << ctx)) == 0) |
279 | break; | 302 | break; |
280 | 303 | ||
281 | if (ctx == VRFB_NUM_CTXS) { | 304 | if (ctx == num_ctxs) { |
282 | pr_err("vrfb: no free contexts\n"); | 305 | pr_err("vrfb: no free contexts\n"); |
283 | r = -EBUSY; | 306 | r = -EBUSY; |
284 | goto out; | 307 | goto out; |
@@ -293,7 +316,7 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb) | |||
293 | vrfb->context = ctx; | 316 | vrfb->context = ctx; |
294 | 317 | ||
295 | for (rot = 0; rot < 4; ++rot) { | 318 | for (rot = 0; rot < 4; ++rot) { |
296 | paddr = SMS_ROT_VIRT_BASE(ctx, rot); | 319 | paddr = ctxs[ctx].base + SMS_ROT_VIRT_BASE(rot); |
297 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { | 320 | if (!request_mem_region(paddr, OMAP_VRFB_SIZE, "vrfb")) { |
298 | pr_err("vrfb: failed to reserve VRFB " | 321 | pr_err("vrfb: failed to reserve VRFB " |
299 | "area for ctx %d, rotation %d\n", | 322 | "area for ctx %d, rotation %d\n", |
@@ -314,3 +337,80 @@ out: | |||
314 | return r; | 337 | return r; |
315 | } | 338 | } |
316 | EXPORT_SYMBOL(omap_vrfb_request_ctx); | 339 | EXPORT_SYMBOL(omap_vrfb_request_ctx); |
340 | |||
341 | bool omap_vrfb_supported(void) | ||
342 | { | ||
343 | return vrfb_loaded; | ||
344 | } | ||
345 | EXPORT_SYMBOL(omap_vrfb_supported); | ||
346 | |||
347 | static int __init vrfb_probe(struct platform_device *pdev) | ||
348 | { | ||
349 | struct resource *mem; | ||
350 | int i; | ||
351 | |||
352 | /* first resource is the register res, the rest are vrfb contexts */ | ||
353 | |||
354 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
355 | if (!mem) { | ||
356 | dev_err(&pdev->dev, "can't get vrfb base address\n"); | ||
357 | return -EINVAL; | ||
358 | } | ||
359 | |||
360 | vrfb_base = devm_request_and_ioremap(&pdev->dev, mem); | ||
361 | if (!vrfb_base) { | ||
362 | dev_err(&pdev->dev, "can't ioremap vrfb memory\n"); | ||
363 | return -ENOMEM; | ||
364 | } | ||
365 | |||
366 | num_ctxs = pdev->num_resources - 1; | ||
367 | |||
368 | ctxs = devm_kzalloc(&pdev->dev, | ||
369 | sizeof(struct vrfb_ctx) * num_ctxs, | ||
370 | GFP_KERNEL); | ||
371 | |||
372 | if (!ctxs) | ||
373 | return -ENOMEM; | ||
374 | |||
375 | for (i = 0; i < num_ctxs; ++i) { | ||
376 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); | ||
377 | if (!mem) { | ||
378 | dev_err(&pdev->dev, "can't get vrfb ctx %d address\n", | ||
379 | i); | ||
380 | return -EINVAL; | ||
381 | } | ||
382 | |||
383 | ctxs[i].base = mem->start; | ||
384 | } | ||
385 | |||
386 | vrfb_loaded = true; | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static void __exit vrfb_remove(struct platform_device *pdev) | ||
392 | { | ||
393 | vrfb_loaded = false; | ||
394 | } | ||
395 | |||
396 | static struct platform_driver vrfb_driver = { | ||
397 | .driver.name = "omapvrfb", | ||
398 | .remove = __exit_p(vrfb_remove), | ||
399 | }; | ||
400 | |||
401 | static int __init vrfb_init(void) | ||
402 | { | ||
403 | return platform_driver_probe(&vrfb_driver, &vrfb_probe); | ||
404 | } | ||
405 | |||
406 | static void __exit vrfb_exit(void) | ||
407 | { | ||
408 | platform_driver_unregister(&vrfb_driver); | ||
409 | } | ||
410 | |||
411 | module_init(vrfb_init); | ||
412 | module_exit(vrfb_exit); | ||
413 | |||
414 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); | ||
415 | MODULE_DESCRIPTION("OMAP VRFB"); | ||
416 | MODULE_LICENSE("GPL v2"); | ||