aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c21
-rw-r--r--drivers/video/omap2/displays/panel-taal.c7
-rw-r--r--drivers/video/omap2/dss/dsi.c133
-rw-r--r--include/video/omap-panel-nokia-dsi.h3
-rw-r--r--include/video/omapdss.h28
5 files changed, 103 insertions, 89 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 6cbb16fb3817..b4ad706c145a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -666,6 +666,10 @@ static struct nokia_dsi_panel_data dsi1_panel = {
666 .use_ext_te = false, 666 .use_ext_te = false,
667 .ext_te_gpio = 101, 667 .ext_te_gpio = 101,
668 .esd_interval = 0, 668 .esd_interval = 0,
669 .pin_config = {
670 .num_pins = 6,
671 .pins = { 0, 1, 2, 3, 4, 5 },
672 },
669}; 673};
670 674
671static struct omap_dss_device sdp4430_lcd_device = { 675static struct omap_dss_device sdp4430_lcd_device = {
@@ -674,13 +678,6 @@ static struct omap_dss_device sdp4430_lcd_device = {
674 .type = OMAP_DISPLAY_TYPE_DSI, 678 .type = OMAP_DISPLAY_TYPE_DSI,
675 .data = &dsi1_panel, 679 .data = &dsi1_panel,
676 .phy.dsi = { 680 .phy.dsi = {
677 .clk_lane = 1,
678 .clk_pol = 0,
679 .data1_lane = 2,
680 .data1_pol = 0,
681 .data2_lane = 3,
682 .data2_pol = 0,
683
684 .module = 0, 681 .module = 0,
685 }, 682 },
686 683
@@ -715,6 +712,10 @@ static struct nokia_dsi_panel_data dsi2_panel = {
715 .use_ext_te = false, 712 .use_ext_te = false,
716 .ext_te_gpio = 103, 713 .ext_te_gpio = 103,
717 .esd_interval = 0, 714 .esd_interval = 0,
715 .pin_config = {
716 .num_pins = 6,
717 .pins = { 0, 1, 2, 3, 4, 5 },
718 },
718}; 719};
719 720
720static struct omap_dss_device sdp4430_lcd2_device = { 721static struct omap_dss_device sdp4430_lcd2_device = {
@@ -723,12 +724,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
723 .type = OMAP_DISPLAY_TYPE_DSI, 724 .type = OMAP_DISPLAY_TYPE_DSI,
724 .data = &dsi2_panel, 725 .data = &dsi2_panel,
725 .phy.dsi = { 726 .phy.dsi = {
726 .clk_lane = 1,
727 .clk_pol = 0,
728 .data1_lane = 2,
729 .data1_pol = 0,
730 .data2_lane = 3,
731 .data2_pol = 0,
732 727
733 .module = 1, 728 .module = 1,
734 }, 729 },
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 0888162e9ce9..b2dd88b48420 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1137,9 +1137,16 @@ static void __exit taal_remove(struct omap_dss_device *dssdev)
1137static int taal_power_on(struct omap_dss_device *dssdev) 1137static int taal_power_on(struct omap_dss_device *dssdev)
1138{ 1138{
1139 struct taal_data *td = dev_get_drvdata(&dssdev->dev); 1139 struct taal_data *td = dev_get_drvdata(&dssdev->dev);
1140 struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
1140 u8 id1, id2, id3; 1141 u8 id1, id2, id3;
1141 int r; 1142 int r;
1142 1143
1144 r = omapdss_dsi_configure_pins(dssdev, &panel_data->pin_config);
1145 if (r) {
1146 dev_err(&dssdev->dev, "failed to configure DSI pins\n");
1147 goto err0;
1148 };
1149
1143 r = omapdss_dsi_display_enable(dssdev); 1150 r = omapdss_dsi_display_enable(dssdev);
1144 if (r) { 1151 if (r) {
1145 dev_err(&dssdev->dev, "failed to enable DSI\n"); 1152 dev_err(&dssdev->dev, "failed to enable DSI\n");
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 662d14f8c2c3..210a3c4f6150 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2076,65 +2076,6 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev)
2076 } 2076 }
2077} 2077}
2078 2078
2079static int dsi_parse_lane_config(struct omap_dss_device *dssdev)
2080{
2081 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
2082 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
2083 u8 lanes[DSI_MAX_NR_LANES];
2084 u8 polarities[DSI_MAX_NR_LANES];
2085 int num_lanes, i;
2086
2087 static const enum dsi_lane_function functions[] = {
2088 DSI_LANE_CLK,
2089 DSI_LANE_DATA1,
2090 DSI_LANE_DATA2,
2091 DSI_LANE_DATA3,
2092 DSI_LANE_DATA4,
2093 };
2094
2095 lanes[0] = dssdev->phy.dsi.clk_lane;
2096 lanes[1] = dssdev->phy.dsi.data1_lane;
2097 lanes[2] = dssdev->phy.dsi.data2_lane;
2098 lanes[3] = dssdev->phy.dsi.data3_lane;
2099 lanes[4] = dssdev->phy.dsi.data4_lane;
2100 polarities[0] = dssdev->phy.dsi.clk_pol;
2101 polarities[1] = dssdev->phy.dsi.data1_pol;
2102 polarities[2] = dssdev->phy.dsi.data2_pol;
2103 polarities[3] = dssdev->phy.dsi.data3_pol;
2104 polarities[4] = dssdev->phy.dsi.data4_pol;
2105
2106 num_lanes = 0;
2107
2108 for (i = 0; i < dsi->num_lanes_supported; ++i)
2109 dsi->lanes[i].function = DSI_LANE_UNUSED;
2110
2111 for (i = 0; i < dsi->num_lanes_supported; ++i) {
2112 int num;
2113
2114 if (lanes[i] == DSI_LANE_UNUSED)
2115 break;
2116
2117 num = lanes[i] - 1;
2118
2119 if (num >= dsi->num_lanes_supported)
2120 return -EINVAL;
2121
2122 if (dsi->lanes[num].function != DSI_LANE_UNUSED)
2123 return -EINVAL;
2124
2125 dsi->lanes[num].function = functions[i];
2126 dsi->lanes[num].polarity = polarities[i];
2127 num_lanes++;
2128 }
2129
2130 if (num_lanes < 2 || num_lanes > dsi->num_lanes_supported)
2131 return -EINVAL;
2132
2133 dsi->num_lanes_used = num_lanes;
2134
2135 return 0;
2136}
2137
2138static int dsi_set_lane_config(struct omap_dss_device *dssdev) 2079static int dsi_set_lane_config(struct omap_dss_device *dssdev)
2139{ 2080{
2140 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 2081 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3975,6 +3916,74 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev)
3975 } 3916 }
3976} 3917}
3977 3918
3919int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
3920 const struct omap_dsi_pin_config *pin_cfg)
3921{
3922 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
3923 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
3924 int num_pins;
3925 const int *pins;
3926 struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
3927 int num_lanes;
3928 int i;
3929
3930 static const enum dsi_lane_function functions[] = {
3931 DSI_LANE_CLK,
3932 DSI_LANE_DATA1,
3933 DSI_LANE_DATA2,
3934 DSI_LANE_DATA3,
3935 DSI_LANE_DATA4,
3936 };
3937
3938 num_pins = pin_cfg->num_pins;
3939 pins = pin_cfg->pins;
3940
3941 if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
3942 || num_pins % 2 != 0)
3943 return -EINVAL;
3944
3945 for (i = 0; i < DSI_MAX_NR_LANES; ++i)
3946 lanes[i].function = DSI_LANE_UNUSED;
3947
3948 num_lanes = 0;
3949
3950 for (i = 0; i < num_pins; i += 2) {
3951 u8 lane, pol;
3952 int dx, dy;
3953
3954 dx = pins[i];
3955 dy = pins[i + 1];
3956
3957 if (dx < 0 || dx >= dsi->num_lanes_supported * 2)
3958 return -EINVAL;
3959
3960 if (dy < 0 || dy >= dsi->num_lanes_supported * 2)
3961 return -EINVAL;
3962
3963 if (dx & 1) {
3964 if (dy != dx - 1)
3965 return -EINVAL;
3966 pol = 1;
3967 } else {
3968 if (dy != dx + 1)
3969 return -EINVAL;
3970 pol = 0;
3971 }
3972
3973 lane = dx / 2;
3974
3975 lanes[lane].function = functions[i / 2];
3976 lanes[lane].polarity = pol;
3977 num_lanes++;
3978 }
3979
3980 memcpy(dsi->lanes, lanes, sizeof(dsi->lanes));
3981 dsi->num_lanes_used = num_lanes;
3982
3983 return 0;
3984}
3985EXPORT_SYMBOL(omapdss_dsi_configure_pins);
3986
3978int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) 3987int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
3979{ 3988{
3980 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3989 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4339,12 +4348,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
4339 int dsi_module = dsi_get_dsidev_id(dsidev); 4348 int dsi_module = dsi_get_dsidev_id(dsidev);
4340 int r; 4349 int r;
4341 4350
4342 r = dsi_parse_lane_config(dssdev);
4343 if (r) {
4344 DSSERR("illegal lane config");
4345 goto err0;
4346 }
4347
4348 r = dsi_pll_init(dsidev, true, true); 4351 r = dsi_pll_init(dsidev, true, true);
4349 if (r) 4352 if (r)
4350 goto err0; 4353 goto err0;
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h
index 7dc71f9c13e6..04219a295539 100644
--- a/include/video/omap-panel-nokia-dsi.h
+++ b/include/video/omap-panel-nokia-dsi.h
@@ -11,6 +11,7 @@ struct omap_dss_device;
11 * @esd_interval: interval of ESD checks, 0 = disabled (ms) 11 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) 12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
13 * @use_dsi_backlight: true if panel uses DSI command to control backlight 13 * @use_dsi_backlight: true if panel uses DSI command to control backlight
14 * @pin_config: DSI pin configuration
14 */ 15 */
15struct nokia_dsi_panel_data { 16struct nokia_dsi_panel_data {
16 const char *name; 17 const char *name;
@@ -24,6 +25,8 @@ struct nokia_dsi_panel_data {
24 unsigned ulps_timeout; 25 unsigned ulps_timeout;
25 26
26 bool use_dsi_backlight; 27 bool use_dsi_backlight;
28
29 struct omap_dsi_pin_config pin_config;
27}; 30};
28 31
29#endif /* __OMAP_NOKIA_DSI_PANEL_H */ 32#endif /* __OMAP_NOKIA_DSI_PANEL_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 483f67caa7ad..1c46a14341dd 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -468,6 +468,21 @@ struct omap_overlay_manager {
468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
469}; 469};
470 470
471/* 22 pins means 1 clk lane and 10 data lanes */
472#define OMAP_DSS_MAX_DSI_PINS 22
473
474struct omap_dsi_pin_config {
475 int num_pins;
476 /*
477 * pin numbers in the following order:
478 * clk+, clk-
479 * data1+, data1-
480 * data2+, data2-
481 * ...
482 */
483 int pins[OMAP_DSS_MAX_DSI_PINS];
484};
485
471struct omap_dss_device { 486struct omap_dss_device {
472 struct device dev; 487 struct device dev;
473 488
@@ -490,17 +505,6 @@ struct omap_dss_device {
490 } sdi; 505 } sdi;
491 506
492 struct { 507 struct {
493 u8 clk_lane;
494 u8 clk_pol;
495 u8 data1_lane;
496 u8 data1_pol;
497 u8 data2_lane;
498 u8 data2_pol;
499 u8 data3_lane;
500 u8 data3_pol;
501 u8 data4_lane;
502 u8 data4_pol;
503
504 int module; 508 int module;
505 509
506 bool ext_te; 510 bool ext_te;
@@ -687,6 +691,8 @@ int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
687int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); 691int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
688int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); 692int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
689void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 693void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
694int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
695 const struct omap_dsi_pin_config *pin_cfg);
690 696
691int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 697int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
692void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 698void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,