Skip to content

Commit 9253d2d

Browse files
committed
Merge branch '3.8/dss-version'
Merge omapdss code to remove cpu_is_* checks from the driver.
2 parents da6c568 + 97fbd0f commit 9253d2d

10 files changed

Lines changed: 162 additions & 59 deletions

File tree

‎arch/arm/mach-omap2/display.c‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,54 @@ static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
284284
return ERR_PTR(r);
285285
}
286286

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+
287316
int __init omap_display_init(struct omap_dss_board_info *board_data)
288317
{
289318
int r = 0;
290319
struct platform_device *pdev;
291320
int i, oh_count;
292321
const struct omap_dss_hwmod_data *curr_dss_hwmod;
293322
struct platform_device *dss_pdev;
323+
enum omapdss_version ver;
294324

295325
/* create omapdss device */
296326

327+
ver = omap_display_get_version();
328+
329+
if (ver == OMAPDSS_VER_UNKNOWN) {
330+
pr_err("DSS not supported on this SoC\n");
331+
return -ENODEV;
332+
}
333+
334+
board_data->version = ver;
297335
board_data->dsi_enable_pads = omap_dsi_enable_pads;
298336
board_data->dsi_disable_pads = omap_dsi_disable_pads;
299337
board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;

‎drivers/video/omap2/dss/Kconfig‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
menuconfig OMAP2_DSS
22
tristate "OMAP2+ Display Subsystem support"
3-
depends on ARCH_OMAP2PLUS
43
help
54
OMAP2+ Display Subsystem support.
65

@@ -72,19 +71,16 @@ config OMAP2_DSS_VENC
7271

7372
config OMAP4_DSS_HDMI
7473
bool "HDMI support"
75-
depends on ARCH_OMAP4
7674
default y
7775
help
7876
HDMI Interface. This adds the High Definition Multimedia Interface.
7977
See http://www.hdmi.org/ for HDMI specification.
8078

8179
config OMAP4_DSS_HDMI_AUDIO
8280
bool
83-
depends on OMAP4_DSS_HDMI
8481

8582
config OMAP2_DSS_SDI
8683
bool "SDI support"
87-
depends on ARCH_OMAP3
8884
default n
8985
help
9086
SDI (Serial Display Interface) support.
@@ -94,7 +90,6 @@ config OMAP2_DSS_SDI
9490

9591
config OMAP2_DSS_DSI
9692
bool "DSI support"
97-
depends on ARCH_OMAP3 || ARCH_OMAP4 || ARCH_OMAP5
9893
default n
9994
help
10095
MIPI DSI (Display Serial Interface) support.

‎drivers/video/omap2/dss/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static int __init omap_dss_probe(struct platform_device *pdev)
232232

233233
core.pdev = pdev;
234234

235-
dss_features_init();
235+
dss_features_init(pdata->version);
236236

237237
dss_apply_init();
238238

‎drivers/video/omap2/dss/dispc.c‎

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
#include <linux/interrupt.h>
3737
#include <linux/platform_device.h>
3838
#include <linux/pm_runtime.h>
39-
40-
#include <plat/cpu.h>
39+
#include <linux/sizes.h>
4140

4241
#include <video/omapdss.h>
4342

@@ -3353,7 +3352,7 @@ static void dispc_dump_regs(struct seq_file *s)
33533352

33543353
#define DISPC_REG(i, name) name(i)
33553354
#define DUMPREG(i, r) seq_printf(s, "%s(%s)%*s %08x\n", #r, p_names[i], \
3356-
48 - strlen(#r) - strlen(p_names[i]), " ", \
3355+
(int)(48 - strlen(#r) - strlen(p_names[i])), " ", \
33573356
dispc_read_reg(DISPC_REG(i, r)))
33583357

33593358
p_names = mgr_names;
@@ -3430,7 +3429,7 @@ static void dispc_dump_regs(struct seq_file *s)
34303429
#define DISPC_REG(plane, name, i) name(plane, i)
34313430
#define DUMPREG(plane, name, i) \
34323431
seq_printf(s, "%s_%d(%s)%*s %08x\n", #name, i, p_names[plane], \
3433-
46 - strlen(#name) - strlen(p_names[plane]), " ", \
3432+
(int)(46 - strlen(#name) - strlen(p_names[plane])), " ", \
34343433
dispc_read_reg(DISPC_REG(plane, name, i)))
34353434

34363435
/* Video pipeline coefficient registers */
@@ -4032,29 +4031,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = {
40324031
.gfx_fifo_workaround = true,
40334032
};
40344033

4035-
static int __init dispc_init_features(struct device *dev)
4034+
static int __init dispc_init_features(struct platform_device *pdev)
40364035
{
4036+
struct omap_dss_board_info *pdata = pdev->dev.platform_data;
40374037
const struct dispc_features *src;
40384038
struct dispc_features *dst;
40394039

4040-
dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
4040+
dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
40414041
if (!dst) {
4042-
dev_err(dev, "Failed to allocate DISPC Features\n");
4042+
dev_err(&pdev->dev, "Failed to allocate DISPC Features\n");
40434043
return -ENOMEM;
40444044
}
40454045

4046-
if (cpu_is_omap24xx()) {
4046+
switch (pdata->version) {
4047+
case OMAPDSS_VER_OMAP24xx:
40474048
src = &omap24xx_dispc_feats;
4048-
} else if (cpu_is_omap34xx()) {
4049-
if (omap_rev() < OMAP3430_REV_ES3_0)
4050-
src = &omap34xx_rev1_0_dispc_feats;
4051-
else
4052-
src = &omap34xx_rev3_0_dispc_feats;
4053-
} else if (cpu_is_omap44xx()) {
4049+
break;
4050+
4051+
case OMAPDSS_VER_OMAP34xx_ES1:
4052+
src = &omap34xx_rev1_0_dispc_feats;
4053+
break;
4054+
4055+
case OMAPDSS_VER_OMAP34xx_ES3:
4056+
case OMAPDSS_VER_OMAP3630:
4057+
case OMAPDSS_VER_AM35xx:
4058+
src = &omap34xx_rev3_0_dispc_feats;
4059+
break;
4060+
4061+
case OMAPDSS_VER_OMAP4430_ES1:
4062+
case OMAPDSS_VER_OMAP4430_ES2:
4063+
case OMAPDSS_VER_OMAP4:
40544064
src = &omap44xx_dispc_feats;
4055-
} else if (soc_is_omap54xx()) {
4065+
break;
4066+
4067+
case OMAPDSS_VER_OMAP5:
40564068
src = &omap44xx_dispc_feats;
4057-
} else {
4069+
break;
4070+
4071+
default:
40584072
return -ENODEV;
40594073
}
40604074

@@ -4074,7 +4088,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev)
40744088

40754089
dispc.pdev = pdev;
40764090

4077-
r = dispc_init_features(&dispc.pdev->dev);
4091+
r = dispc_init_features(dispc.pdev);
40784092
if (r)
40794093
return r;
40804094

‎drivers/video/omap2/dss/dss.c‎

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
#include <linux/platform_device.h>
3333
#include <linux/pm_runtime.h>
3434
#include <linux/gfp.h>
35+
#include <linux/sizes.h>
3536

3637
#include <video/omapdss.h>
3738

38-
#include <plat/cpu.h>
39-
4039
#include "dss.h"
4140
#include "dss_features.h"
4241

@@ -792,29 +791,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
792791
.dpi_select_source = &dss_dpi_select_source_omap5,
793792
};
794793

795-
static int __init dss_init_features(struct device *dev)
794+
static int __init dss_init_features(struct platform_device *pdev)
796795
{
796+
struct omap_dss_board_info *pdata = pdev->dev.platform_data;
797797
const struct dss_features *src;
798798
struct dss_features *dst;
799799

800-
dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
800+
dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
801801
if (!dst) {
802-
dev_err(dev, "Failed to allocate local DSS Features\n");
802+
dev_err(&pdev->dev, "Failed to allocate local DSS Features\n");
803803
return -ENOMEM;
804804
}
805805

806-
if (cpu_is_omap24xx())
806+
switch (pdata->version) {
807+
case OMAPDSS_VER_OMAP24xx:
807808
src = &omap24xx_dss_feats;
808-
else if (cpu_is_omap34xx())
809+
break;
810+
811+
case OMAPDSS_VER_OMAP34xx_ES1:
812+
case OMAPDSS_VER_OMAP34xx_ES3:
813+
case OMAPDSS_VER_AM35xx:
809814
src = &omap34xx_dss_feats;
810-
else if (cpu_is_omap3630())
815+
break;
816+
817+
case OMAPDSS_VER_OMAP3630:
811818
src = &omap3630_dss_feats;
812-
else if (cpu_is_omap44xx())
819+
break;
820+
821+
case OMAPDSS_VER_OMAP4430_ES1:
822+
case OMAPDSS_VER_OMAP4430_ES2:
823+
case OMAPDSS_VER_OMAP4:
813824
src = &omap44xx_dss_feats;
814-
else if (soc_is_omap54xx())
825+
break;
826+
827+
case OMAPDSS_VER_OMAP5:
815828
src = &omap54xx_dss_feats;
816-
else
829+
break;
830+
831+
default:
817832
return -ENODEV;
833+
}
818834

819835
memcpy(dst, src, sizeof(*dst));
820836
dss.feat = dst;
@@ -831,7 +847,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev)
831847

832848
dss.pdev = pdev;
833849

834-
r = dss_init_features(&dss.pdev->dev);
850+
r = dss_init_features(dss.pdev);
835851
if (r)
836852
return r;
837853

‎drivers/video/omap2/dss/dss_features.c‎

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <linux/slab.h>
2424

2525
#include <video/omapdss.h>
26-
#include <plat/cpu.h>
2726

2827
#include "dss.h"
2928
#include "dss_features.h"
@@ -825,10 +824,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
825824

826825
};
827826

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)
829829
{
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:
831834
ip_data->ops = &omap4_hdmi_functions;
835+
break;
836+
default:
837+
ip_data->ops = NULL;
838+
}
839+
840+
WARN_ON(ip_data->ops == NULL);
832841
}
833842
#endif
834843

@@ -929,29 +938,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
929938
return omap_current_dss_features->supported_rotation_types & rot_type;
930939
}
931940

932-
void dss_features_init(void)
941+
void dss_features_init(enum omapdss_version version)
933942
{
934-
if (cpu_is_omap24xx())
943+
switch (version) {
944+
case OMAPDSS_VER_OMAP24xx:
935945
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:
937954
omap_current_dss_features = &omap3630_dss_features;
938-
else if (cpu_is_omap34xx()) {
939-
if (soc_is_am35xx()) {
940-
omap_current_dss_features = &am35xx_dss_features;
941-
} else {
942-
omap_current_dss_features = &omap3430_dss_features;
943-
}
944-
}
945-
else if (omap_rev() == OMAP4430_REV_ES1_0)
955+
break;
956+
957+
case OMAPDSS_VER_OMAP4430_ES1:
946958
omap_current_dss_features = &omap4430_es1_0_dss_features;
947-
else if (omap_rev() == OMAP4430_REV_ES2_0 ||
948-
omap_rev() == OMAP4430_REV_ES2_1 ||
949-
omap_rev() == OMAP4430_REV_ES2_2)
959+
break;
960+
961+
case OMAPDSS_VER_OMAP4430_ES2:
950962
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:
952966
omap_current_dss_features = &omap4_dss_features;
953-
else if (soc_is_omap54xx())
967+
break;
968+
969+
case OMAPDSS_VER_OMAP5:
954970
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:
956978
DSSWARN("Unsupported OMAP version");
979+
break;
980+
}
957981
}

‎drivers/video/omap2/dss/dss_features.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type);
123123

124124
bool dss_has_feature(enum dss_feat_id id);
125125
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);
127127
#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);
129130
#endif
130131
#endif

‎drivers/video/omap2/dss/hdmi.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void)
323323

324324
static int __init hdmi_init_display(struct omap_dss_device *dssdev)
325325
{
326+
struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data;
326327
int r;
327328

328329
struct gpio gpios[] = {
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev)
333334

334335
DSSDBG("init_display\n");
335336

336-
dss_init_hdmi_ip_ops(&hdmi.ip_data);
337+
dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version);
337338

338339
if (hdmi.vdda_hdmi_dac_reg == NULL) {
339340
struct regulator *reg;

0 commit comments

Comments
 (0)