aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-10-13 04:22:06 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-12-02 01:54:15 -0500
commit739a7f46cbf6dc3d4f899e4b566196d99403457a (patch)
treebe125c332f0abf7ea18da3d13cb7f346e0526c8f /drivers/video/omap2
parentd982085050e67da24a57ec04eb3701eb4805118a (diff)
OMAPDSS: DSI: Parse lane config
Parse the lane configuration from the device data into internal lane config format. This will be used in the following patches to clean up the lane handling. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/dss/dsi.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 6a110b2bca4f..aea110c9d638 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -203,6 +203,21 @@ struct dsi_reg { u16 idx; };
203typedef void (*omap_dsi_isr_t) (void *arg, u32 mask); 203typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
204 204
205#define DSI_MAX_NR_ISRS 2 205#define DSI_MAX_NR_ISRS 2
206#define DSI_MAX_NR_LANES 5
207
208enum dsi_lane_function {
209 DSI_LANE_UNUSED = 0,
210 DSI_LANE_CLK,
211 DSI_LANE_DATA1,
212 DSI_LANE_DATA2,
213 DSI_LANE_DATA3,
214 DSI_LANE_DATA4,
215};
216
217struct dsi_lane_config {
218 enum dsi_lane_function function;
219 u8 polarity;
220};
206 221
207struct dsi_isr_data { 222struct dsi_isr_data {
208 omap_dsi_isr_t isr; 223 omap_dsi_isr_t isr;
@@ -329,6 +344,9 @@ struct dsi_data {
329 344
330 unsigned num_lanes_supported; 345 unsigned num_lanes_supported;
331 346
347 struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
348 unsigned num_lanes_used;
349
332 unsigned scp_clk_refcount; 350 unsigned scp_clk_refcount;
333}; 351};
334 352
@@ -2077,6 +2095,65 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev)
2077 } 2095 }
2078} 2096}
2079 2097
2098static int dsi_parse_lane_config(struct omap_dss_device *dssdev)
2099{
2100 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
2101 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
2102 u8 lanes[DSI_MAX_NR_LANES];
2103 u8 polarities[DSI_MAX_NR_LANES];
2104 int num_lanes, i;
2105
2106 static const enum dsi_lane_function functions[] = {
2107 DSI_LANE_CLK,
2108 DSI_LANE_DATA1,
2109 DSI_LANE_DATA2,
2110 DSI_LANE_DATA3,
2111 DSI_LANE_DATA4,
2112 };
2113
2114 lanes[0] = dssdev->phy.dsi.clk_lane;
2115 lanes[1] = dssdev->phy.dsi.data1_lane;
2116 lanes[2] = dssdev->phy.dsi.data2_lane;
2117 lanes[3] = dssdev->phy.dsi.data3_lane;
2118 lanes[4] = dssdev->phy.dsi.data4_lane;
2119 polarities[0] = dssdev->phy.dsi.clk_pol;
2120 polarities[1] = dssdev->phy.dsi.data1_pol;
2121 polarities[2] = dssdev->phy.dsi.data2_pol;
2122 polarities[3] = dssdev->phy.dsi.data3_pol;
2123 polarities[4] = dssdev->phy.dsi.data4_pol;
2124
2125 num_lanes = 0;
2126
2127 for (i = 0; i < dsi->num_lanes_supported; ++i)
2128 dsi->lanes[i].function = DSI_LANE_UNUSED;
2129
2130 for (i = 0; i < dsi->num_lanes_supported; ++i) {
2131 int num;
2132
2133 if (lanes[i] == DSI_LANE_UNUSED)
2134 break;
2135
2136 num = lanes[i] - 1;
2137
2138 if (num >= dsi->num_lanes_supported)
2139 return -EINVAL;
2140
2141 if (dsi->lanes[num].function != DSI_LANE_UNUSED)
2142 return -EINVAL;
2143
2144 dsi->lanes[num].function = functions[i];
2145 dsi->lanes[num].polarity = polarities[i];
2146 num_lanes++;
2147 }
2148
2149 if (num_lanes < 2 || num_lanes > dsi->num_lanes_supported)
2150 return -EINVAL;
2151
2152 dsi->num_lanes_used = num_lanes;
2153
2154 return 0;
2155}
2156
2080static void dsi_set_lane_config(struct omap_dss_device *dssdev) 2157static void dsi_set_lane_config(struct omap_dss_device *dssdev)
2081{ 2158{
2082 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 2159 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4328,6 +4405,12 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
4328 int dsi_module = dsi_get_dsidev_id(dsidev); 4405 int dsi_module = dsi_get_dsidev_id(dsidev);
4329 int r; 4406 int r;
4330 4407
4408 r = dsi_parse_lane_config(dssdev);
4409 if (r) {
4410 DSSERR("illegal lane config");
4411 goto err0;
4412 }
4413
4331 r = dsi_pll_init(dsidev, true, true); 4414 r = dsi_pll_init(dsidev, true, true);
4332 if (r) 4415 if (r)
4333 goto err0; 4416 goto err0;