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

Merge branch '3.8/dss-version'

Merge omapdss code to remove cpu_is_* checks from the driver.

+162 -59
+38
arch/arm/mach-omap2/display.c
··· 284 284 return ERR_PTR(r); 285 285 } 286 286 287 + static enum omapdss_version __init omap_display_get_version(void) 288 + { 289 + if (cpu_is_omap24xx()) 290 + return OMAPDSS_VER_OMAP24xx; 291 + else if (cpu_is_omap3630()) 292 + return OMAPDSS_VER_OMAP3630; 293 + else if (cpu_is_omap34xx()) { 294 + if (soc_is_am35xx()) { 295 + return OMAPDSS_VER_AM35xx; 296 + } else { 297 + if (omap_rev() < OMAP3430_REV_ES3_0) 298 + return OMAPDSS_VER_OMAP34xx_ES1; 299 + else 300 + return OMAPDSS_VER_OMAP34xx_ES3; 301 + } 302 + } else if (omap_rev() == OMAP4430_REV_ES1_0) 303 + return OMAPDSS_VER_OMAP4430_ES1; 304 + else if (omap_rev() == OMAP4430_REV_ES2_0 || 305 + omap_rev() == OMAP4430_REV_ES2_1 || 306 + omap_rev() == OMAP4430_REV_ES2_2) 307 + return OMAPDSS_VER_OMAP4430_ES2; 308 + else if (cpu_is_omap44xx()) 309 + return OMAPDSS_VER_OMAP4; 310 + else if (soc_is_omap54xx()) 311 + return OMAPDSS_VER_OMAP5; 312 + else 313 + return OMAPDSS_VER_UNKNOWN; 314 + } 315 + 287 316 int __init omap_display_init(struct omap_dss_board_info *board_data) 288 317 { 289 318 int r = 0; ··· 320 291 int i, oh_count; 321 292 const struct omap_dss_hwmod_data *curr_dss_hwmod; 322 293 struct platform_device *dss_pdev; 294 + enum omapdss_version ver; 323 295 324 296 /* create omapdss device */ 325 297 298 + ver = omap_display_get_version(); 299 + 300 + if (ver == OMAPDSS_VER_UNKNOWN) { 301 + pr_err("DSS not supported on this SoC\n"); 302 + return -ENODEV; 303 + } 304 + 305 + board_data->version = ver; 326 306 board_data->dsi_enable_pads = omap_dsi_enable_pads; 327 307 board_data->dsi_disable_pads = omap_dsi_disable_pads; 328 308 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-5
drivers/video/omap2/dss/Kconfig
··· 1 1 menuconfig OMAP2_DSS 2 2 tristate "OMAP2+ Display Subsystem support" 3 - depends on ARCH_OMAP2PLUS 4 3 help 5 4 OMAP2+ Display Subsystem support. 6 5 ··· 71 72 72 73 config OMAP4_DSS_HDMI 73 74 bool "HDMI support" 74 - depends on ARCH_OMAP4 75 75 default y 76 76 help 77 77 HDMI Interface. This adds the High Definition Multimedia Interface. ··· 78 80 79 81 config OMAP4_DSS_HDMI_AUDIO 80 82 bool 81 - depends on OMAP4_DSS_HDMI 82 83 83 84 config OMAP2_DSS_SDI 84 85 bool "SDI support" 85 - depends on ARCH_OMAP3 86 86 default n 87 87 help 88 88 SDI (Serial Display Interface) support. ··· 90 94 91 95 config OMAP2_DSS_DSI 92 96 bool "DSI support" 93 - depends on ARCH_OMAP3 || ARCH_OMAP4 || ARCH_OMAP5 94 97 default n 95 98 help 96 99 MIPI DSI (Display Serial Interface) support.
+1 -1
drivers/video/omap2/dss/core.c
··· 232 232 233 233 core.pdev = pdev; 234 234 235 - dss_features_init(); 235 + dss_features_init(pdata->version); 236 236 237 237 dss_apply_init(); 238 238
+31 -17
drivers/video/omap2/dss/dispc.c
··· 36 36 #include <linux/interrupt.h> 37 37 #include <linux/platform_device.h> 38 38 #include <linux/pm_runtime.h> 39 - 40 - #include <plat/cpu.h> 39 + #include <linux/sizes.h> 41 40 42 41 #include <video/omapdss.h> 43 42 ··· 3352 3353 3353 3354 #define DISPC_REG(i, name) name(i) 3354 3355 #define DUMPREG(i, r) seq_printf(s, "%s(%s)%*s %08x\n", #r, p_names[i], \ 3355 - 48 - strlen(#r) - strlen(p_names[i]), " ", \ 3356 + (int)(48 - strlen(#r) - strlen(p_names[i])), " ", \ 3356 3357 dispc_read_reg(DISPC_REG(i, r))) 3357 3358 3358 3359 p_names = mgr_names; ··· 3429 3430 #define DISPC_REG(plane, name, i) name(plane, i) 3430 3431 #define DUMPREG(plane, name, i) \ 3431 3432 seq_printf(s, "%s_%d(%s)%*s %08x\n", #name, i, p_names[plane], \ 3432 - 46 - strlen(#name) - strlen(p_names[plane]), " ", \ 3433 + (int)(46 - strlen(#name) - strlen(p_names[plane])), " ", \ 3433 3434 dispc_read_reg(DISPC_REG(plane, name, i))) 3434 3435 3435 3436 /* Video pipeline coefficient registers */ ··· 4031 4032 .gfx_fifo_workaround = true, 4032 4033 }; 4033 4034 4034 - static int __init dispc_init_features(struct device *dev) 4035 + static int __init dispc_init_features(struct platform_device *pdev) 4035 4036 { 4037 + struct omap_dss_board_info *pdata = pdev->dev.platform_data; 4036 4038 const struct dispc_features *src; 4037 4039 struct dispc_features *dst; 4038 4040 4039 - dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); 4041 + dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); 4040 4042 if (!dst) { 4041 - dev_err(dev, "Failed to allocate DISPC Features\n"); 4043 + dev_err(&pdev->dev, "Failed to allocate DISPC Features\n"); 4042 4044 return -ENOMEM; 4043 4045 } 4044 4046 4045 - if (cpu_is_omap24xx()) { 4047 + switch (pdata->version) { 4048 + case OMAPDSS_VER_OMAP24xx: 4046 4049 src = &omap24xx_dispc_feats; 4047 - } else if (cpu_is_omap34xx()) { 4048 - if (omap_rev() < OMAP3430_REV_ES3_0) 4049 - src = &omap34xx_rev1_0_dispc_feats; 4050 - else 4051 - src = &omap34xx_rev3_0_dispc_feats; 4052 - } else if (cpu_is_omap44xx()) { 4050 + break; 4051 + 4052 + case OMAPDSS_VER_OMAP34xx_ES1: 4053 + src = &omap34xx_rev1_0_dispc_feats; 4054 + break; 4055 + 4056 + case OMAPDSS_VER_OMAP34xx_ES3: 4057 + case OMAPDSS_VER_OMAP3630: 4058 + case OMAPDSS_VER_AM35xx: 4059 + src = &omap34xx_rev3_0_dispc_feats; 4060 + break; 4061 + 4062 + case OMAPDSS_VER_OMAP4430_ES1: 4063 + case OMAPDSS_VER_OMAP4430_ES2: 4064 + case OMAPDSS_VER_OMAP4: 4053 4065 src = &omap44xx_dispc_feats; 4054 - } else if (soc_is_omap54xx()) { 4066 + break; 4067 + 4068 + case OMAPDSS_VER_OMAP5: 4055 4069 src = &omap44xx_dispc_feats; 4056 - } else { 4070 + break; 4071 + 4072 + default: 4057 4073 return -ENODEV; 4058 4074 } 4059 4075 ··· 4088 4074 4089 4075 dispc.pdev = pdev; 4090 4076 4091 - r = dispc_init_features(&dispc.pdev->dev); 4077 + r = dispc_init_features(dispc.pdev); 4092 4078 if (r) 4093 4079 return r; 4094 4080
+28 -12
drivers/video/omap2/dss/dss.c
··· 32 32 #include <linux/platform_device.h> 33 33 #include <linux/pm_runtime.h> 34 34 #include <linux/gfp.h> 35 + #include <linux/sizes.h> 35 36 36 37 #include <video/omapdss.h> 37 - 38 - #include <plat/cpu.h> 39 38 40 39 #include "dss.h" 41 40 #include "dss_features.h" ··· 791 792 .dpi_select_source = &dss_dpi_select_source_omap5, 792 793 }; 793 794 794 - static int __init dss_init_features(struct device *dev) 795 + static int __init dss_init_features(struct platform_device *pdev) 795 796 { 797 + struct omap_dss_board_info *pdata = pdev->dev.platform_data; 796 798 const struct dss_features *src; 797 799 struct dss_features *dst; 798 800 799 - dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL); 801 + dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); 800 802 if (!dst) { 801 - dev_err(dev, "Failed to allocate local DSS Features\n"); 803 + dev_err(&pdev->dev, "Failed to allocate local DSS Features\n"); 802 804 return -ENOMEM; 803 805 } 804 806 805 - if (cpu_is_omap24xx()) 807 + switch (pdata->version) { 808 + case OMAPDSS_VER_OMAP24xx: 806 809 src = &omap24xx_dss_feats; 807 - else if (cpu_is_omap34xx()) 810 + break; 811 + 812 + case OMAPDSS_VER_OMAP34xx_ES1: 813 + case OMAPDSS_VER_OMAP34xx_ES3: 814 + case OMAPDSS_VER_AM35xx: 808 815 src = &omap34xx_dss_feats; 809 - else if (cpu_is_omap3630()) 816 + break; 817 + 818 + case OMAPDSS_VER_OMAP3630: 810 819 src = &omap3630_dss_feats; 811 - else if (cpu_is_omap44xx()) 820 + break; 821 + 822 + case OMAPDSS_VER_OMAP4430_ES1: 823 + case OMAPDSS_VER_OMAP4430_ES2: 824 + case OMAPDSS_VER_OMAP4: 812 825 src = &omap44xx_dss_feats; 813 - else if (soc_is_omap54xx()) 826 + break; 827 + 828 + case OMAPDSS_VER_OMAP5: 814 829 src = &omap54xx_dss_feats; 815 - else 830 + break; 831 + 832 + default: 816 833 return -ENODEV; 834 + } 817 835 818 836 memcpy(dst, src, sizeof(*dst)); 819 837 dss.feat = dst; ··· 847 831 848 832 dss.pdev = pdev; 849 833 850 - r = dss_init_features(&dss.pdev->dev); 834 + r = dss_init_features(dss.pdev); 851 835 if (r) 852 836 return r; 853 837
+44 -20
drivers/video/omap2/dss/dss_features.c
··· 23 23 #include <linux/slab.h> 24 24 25 25 #include <video/omapdss.h> 26 - #include <plat/cpu.h> 27 26 28 27 #include "dss.h" 29 28 #include "dss_features.h" ··· 824 825 825 826 }; 826 827 827 - void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data) 828 + void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, 829 + enum omapdss_version version) 828 830 { 829 - if (cpu_is_omap44xx()) 831 + switch (version) { 832 + case OMAPDSS_VER_OMAP4430_ES1: 833 + case OMAPDSS_VER_OMAP4430_ES2: 834 + case OMAPDSS_VER_OMAP4: 830 835 ip_data->ops = &omap4_hdmi_functions; 836 + break; 837 + default: 838 + ip_data->ops = NULL; 839 + } 840 + 841 + WARN_ON(ip_data->ops == NULL); 831 842 } 832 843 #endif 833 844 ··· 938 929 return omap_current_dss_features->supported_rotation_types & rot_type; 939 930 } 940 931 941 - void dss_features_init(void) 932 + void dss_features_init(enum omapdss_version version) 942 933 { 943 - if (cpu_is_omap24xx()) 934 + switch (version) { 935 + case OMAPDSS_VER_OMAP24xx: 944 936 omap_current_dss_features = &omap2_dss_features; 945 - else if (cpu_is_omap3630()) 937 + break; 938 + 939 + case OMAPDSS_VER_OMAP34xx_ES1: 940 + case OMAPDSS_VER_OMAP34xx_ES3: 941 + omap_current_dss_features = &omap3430_dss_features; 942 + break; 943 + 944 + case OMAPDSS_VER_OMAP3630: 946 945 omap_current_dss_features = &omap3630_dss_features; 947 - else if (cpu_is_omap34xx()) { 948 - if (soc_is_am35xx()) { 949 - omap_current_dss_features = &am35xx_dss_features; 950 - } else { 951 - omap_current_dss_features = &omap3430_dss_features; 952 - } 953 - } 954 - else if (omap_rev() == OMAP4430_REV_ES1_0) 946 + break; 947 + 948 + case OMAPDSS_VER_OMAP4430_ES1: 955 949 omap_current_dss_features = &omap4430_es1_0_dss_features; 956 - else if (omap_rev() == OMAP4430_REV_ES2_0 || 957 - omap_rev() == OMAP4430_REV_ES2_1 || 958 - omap_rev() == OMAP4430_REV_ES2_2) 950 + break; 951 + 952 + case OMAPDSS_VER_OMAP4430_ES2: 959 953 omap_current_dss_features = &omap4430_es2_0_1_2_dss_features; 960 - else if (cpu_is_omap44xx()) 954 + break; 955 + 956 + case OMAPDSS_VER_OMAP4: 961 957 omap_current_dss_features = &omap4_dss_features; 962 - else if (soc_is_omap54xx()) 958 + break; 959 + 960 + case OMAPDSS_VER_OMAP5: 963 961 omap_current_dss_features = &omap5_dss_features; 964 - else 962 + break; 963 + 964 + case OMAPDSS_VER_AM35xx: 965 + omap_current_dss_features = &am35xx_dss_features; 966 + break; 967 + 968 + default: 965 969 DSSWARN("Unsupported OMAP version"); 970 + break; 971 + } 966 972 }
+3 -2
drivers/video/omap2/dss/dss_features.h
··· 123 123 124 124 bool dss_has_feature(enum dss_feat_id id); 125 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 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 130 #endif 130 131 #endif
+2 -1
drivers/video/omap2/dss/hdmi.c
··· 323 323 324 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 327 int r; 327 328 328 329 struct gpio gpios[] = { ··· 334 333 335 334 DSSDBG("init_display\n"); 336 335 337 - dss_init_hdmi_ip_ops(&hdmi.ip_data); 336 + dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version); 338 337 339 338 if (hdmi.vdda_hdmi_dac_reg == NULL) { 340 339 struct regulator *reg;
+1 -1
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
··· 899 899 #define DUMPCOREAV(r) seq_printf(s, "%-35s %08x\n", #r,\ 900 900 hdmi_read_reg(hdmi_av_base(ip_data), r)) 901 901 #define DUMPCOREAV2(i, r) seq_printf(s, "%s[%d]%*s %08x\n", #r, i, \ 902 - (i < 10) ? 32 - strlen(#r) : 31 - strlen(#r), " ", \ 902 + (i < 10) ? 32 - (int)strlen(#r) : 31 - (int)strlen(#r), " ", \ 903 903 hdmi_read_reg(hdmi_av_base(ip_data), CORE_REG(i, r))) 904 904 905 905 DUMPCORE(HDMI_CORE_SYS_VND_IDL);
+14
include/video/omapdss.h
··· 314 314 int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel); 315 315 void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel); 316 316 317 + enum omapdss_version { 318 + OMAPDSS_VER_UNKNOWN = 0, 319 + OMAPDSS_VER_OMAP24xx, 320 + OMAPDSS_VER_OMAP34xx_ES1, /* OMAP3430 ES1.0, 2.0 */ 321 + OMAPDSS_VER_OMAP34xx_ES3, /* OMAP3430 ES3.0+ */ 322 + OMAPDSS_VER_OMAP3630, 323 + OMAPDSS_VER_AM35xx, 324 + OMAPDSS_VER_OMAP4430_ES1, /* OMAP4430 ES1.0 */ 325 + OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */ 326 + OMAPDSS_VER_OMAP4, /* All other OMAP4s */ 327 + OMAPDSS_VER_OMAP5, 328 + }; 329 + 317 330 /* Board specific data */ 318 331 struct omap_dss_board_info { 319 332 int (*get_context_loss_count)(struct device *dev); ··· 336 323 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); 337 324 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); 338 325 int (*set_min_bus_tput)(struct device *dev, unsigned long r); 326 + enum omapdss_version version; 339 327 }; 340 328 341 329 /* Init with the board info */