diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-03-09 09:07:39 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-11 07:54:41 -0400 |
commit | 11ee9606407031827d43ecde8e62a418ac3b4f83 (patch) | |
tree | ca384f9c195ff7a124b9c0c587231389c98e2f1f /drivers/video | |
parent | 9d8232a77fd55e00f0c519518c0ac5bbff1e477c (diff) |
OMAPDSS: DSI: improve DSI module id handling
We currently use the id of the dsi platform device (dsidev->id) as the
DSI hardware module ID. This works because we assign the ID manually in
arch/arm/mach-omap2/display.c at boot time.
However, with device tree the platform device IDs are automatically
assigned to an arbitrary number, and we can't use it.
Instead of using dsidev->id during operation, this patch stores the
value of dsidev->id to a private field of the dsi driver at probe(). The
future device tree code can thus set the private field with some other
way.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 8cc0b2d53c6f..b882a77911e6 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -256,6 +256,8 @@ struct dsi_data { | |||
256 | struct platform_device *pdev; | 256 | struct platform_device *pdev; |
257 | void __iomem *base; | 257 | void __iomem *base; |
258 | 258 | ||
259 | int module_id; | ||
260 | |||
259 | int irq; | 261 | int irq; |
260 | 262 | ||
261 | struct clk *dss_clk; | 263 | struct clk *dss_clk; |
@@ -358,11 +360,6 @@ struct platform_device *dsi_get_dsidev_from_id(int module) | |||
358 | return dsi_pdev_map[module]; | 360 | return dsi_pdev_map[module]; |
359 | } | 361 | } |
360 | 362 | ||
361 | static inline int dsi_get_dsidev_id(struct platform_device *dsidev) | ||
362 | { | ||
363 | return dsidev->id; | ||
364 | } | ||
365 | |||
366 | static inline void dsi_write_reg(struct platform_device *dsidev, | 363 | static inline void dsi_write_reg(struct platform_device *dsidev, |
367 | const struct dsi_reg idx, u32 val) | 364 | const struct dsi_reg idx, u32 val) |
368 | { | 365 | { |
@@ -1181,10 +1178,9 @@ static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) | |||
1181 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) | 1178 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) |
1182 | { | 1179 | { |
1183 | unsigned long r; | 1180 | unsigned long r; |
1184 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1185 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1181 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1186 | 1182 | ||
1187 | if (dss_get_dsi_clk_source(dsi_module) == OMAP_DSS_CLK_SRC_FCK) { | 1183 | if (dss_get_dsi_clk_source(dsi->module_id) == OMAP_DSS_CLK_SRC_FCK) { |
1188 | /* DSI FCLK source is DSS_CLK_FCK */ | 1184 | /* DSI FCLK source is DSS_CLK_FCK */ |
1189 | r = clk_get_rate(dsi->dss_clk); | 1185 | r = clk_get_rate(dsi->dss_clk); |
1190 | } else { | 1186 | } else { |
@@ -1683,7 +1679,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, | |||
1683 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1679 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1684 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; | 1680 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; |
1685 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; | 1681 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; |
1686 | int dsi_module = dsi_get_dsidev_id(dsidev); | 1682 | int dsi_module = dsi->module_id; |
1687 | 1683 | ||
1688 | dispc_clk_src = dss_get_dispc_clk_source(); | 1684 | dispc_clk_src = dss_get_dispc_clk_source(); |
1689 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); | 1685 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); |
@@ -1755,7 +1751,6 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1755 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1751 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1756 | unsigned long flags; | 1752 | unsigned long flags; |
1757 | struct dsi_irq_stats stats; | 1753 | struct dsi_irq_stats stats; |
1758 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1759 | 1754 | ||
1760 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); | 1755 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); |
1761 | 1756 | ||
@@ -1772,7 +1767,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1772 | #define PIS(x) \ | 1767 | #define PIS(x) \ |
1773 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); | 1768 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); |
1774 | 1769 | ||
1775 | seq_printf(s, "-- DSI%d interrupts --\n", dsi_module + 1); | 1770 | seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); |
1776 | PIS(VC0); | 1771 | PIS(VC0); |
1777 | PIS(VC1); | 1772 | PIS(VC1); |
1778 | PIS(VC2); | 1773 | PIS(VC2); |
@@ -2272,7 +2267,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) | |||
2272 | 2267 | ||
2273 | DSSDBGF(); | 2268 | DSSDBGF(); |
2274 | 2269 | ||
2275 | r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev)); | 2270 | r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2276 | if (r) | 2271 | if (r) |
2277 | return r; | 2272 | return r; |
2278 | 2273 | ||
@@ -2382,20 +2377,21 @@ err_cio_pwr: | |||
2382 | dsi_cio_disable_lane_override(dsidev); | 2377 | dsi_cio_disable_lane_override(dsidev); |
2383 | err_scp_clk_dom: | 2378 | err_scp_clk_dom: |
2384 | dsi_disable_scp_clk(dsidev); | 2379 | dsi_disable_scp_clk(dsidev); |
2385 | dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev)); | 2380 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2386 | return r; | 2381 | return r; |
2387 | } | 2382 | } |
2388 | 2383 | ||
2389 | static void dsi_cio_uninit(struct omap_dss_device *dssdev) | 2384 | static void dsi_cio_uninit(struct omap_dss_device *dssdev) |
2390 | { | 2385 | { |
2391 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 2386 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
2387 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
2392 | 2388 | ||
2393 | /* DDR_CLK_ALWAYS_ON */ | 2389 | /* DDR_CLK_ALWAYS_ON */ |
2394 | REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); | 2390 | REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); |
2395 | 2391 | ||
2396 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); | 2392 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); |
2397 | dsi_disable_scp_clk(dsidev); | 2393 | dsi_disable_scp_clk(dsidev); |
2398 | dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev)); | 2394 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2399 | } | 2395 | } |
2400 | 2396 | ||
2401 | static void dsi_config_tx_fifo(struct platform_device *dsidev, | 2397 | static void dsi_config_tx_fifo(struct platform_device *dsidev, |
@@ -4272,7 +4268,7 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev) | |||
4272 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | 4268 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) |
4273 | { | 4269 | { |
4274 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4270 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4275 | int dsi_module = dsi_get_dsidev_id(dsidev); | 4271 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4276 | int r; | 4272 | int r; |
4277 | 4273 | ||
4278 | r = dsi_pll_init(dsidev, true, true); | 4274 | r = dsi_pll_init(dsidev, true, true); |
@@ -4284,7 +4280,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
4284 | goto err1; | 4280 | goto err1; |
4285 | 4281 | ||
4286 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); | 4282 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
4287 | dss_select_dsi_clk_source(dsi_module, dssdev->clocks.dsi.dsi_fclk_src); | 4283 | dss_select_dsi_clk_source(dsi->module_id, dssdev->clocks.dsi.dsi_fclk_src); |
4288 | dss_select_lcd_clk_source(dssdev->manager->id, | 4284 | dss_select_lcd_clk_source(dssdev->manager->id, |
4289 | dssdev->clocks.dispc.channel.lcd_clk_src); | 4285 | dssdev->clocks.dispc.channel.lcd_clk_src); |
4290 | 4286 | ||
@@ -4323,7 +4319,7 @@ err3: | |||
4323 | dsi_cio_uninit(dssdev); | 4319 | dsi_cio_uninit(dssdev); |
4324 | err2: | 4320 | err2: |
4325 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4321 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4326 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4322 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4327 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4323 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4328 | 4324 | ||
4329 | err1: | 4325 | err1: |
@@ -4337,7 +4333,6 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4337 | { | 4333 | { |
4338 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4334 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4339 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4335 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4340 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
4341 | 4336 | ||
4342 | if (enter_ulps && !dsi->ulps_enabled) | 4337 | if (enter_ulps && !dsi->ulps_enabled) |
4343 | dsi_enter_ulps(dsidev); | 4338 | dsi_enter_ulps(dsidev); |
@@ -4350,7 +4345,7 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4350 | dsi_vc_enable(dsidev, 3, 0); | 4345 | dsi_vc_enable(dsidev, 3, 0); |
4351 | 4346 | ||
4352 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4347 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4353 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4348 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4354 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4349 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4355 | dsi_cio_uninit(dssdev); | 4350 | dsi_cio_uninit(dssdev); |
4356 | dsi_pll_uninit(dsidev, disconnect_lanes); | 4351 | dsi_pll_uninit(dsidev, disconnect_lanes); |
@@ -4611,7 +4606,7 @@ static void dsi_put_clocks(struct platform_device *dsidev) | |||
4611 | static int __init omap_dsihw_probe(struct platform_device *dsidev) | 4606 | static int __init omap_dsihw_probe(struct platform_device *dsidev) |
4612 | { | 4607 | { |
4613 | u32 rev; | 4608 | u32 rev; |
4614 | int r, i, dsi_module = dsi_get_dsidev_id(dsidev); | 4609 | int r, i; |
4615 | struct resource *dsi_mem; | 4610 | struct resource *dsi_mem; |
4616 | struct dsi_data *dsi; | 4611 | struct dsi_data *dsi; |
4617 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; | 4612 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; |
@@ -4620,8 +4615,9 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) | |||
4620 | if (!dsi) | 4615 | if (!dsi) |
4621 | return -ENOMEM; | 4616 | return -ENOMEM; |
4622 | 4617 | ||
4618 | dsi->module_id = dsidev->id; | ||
4623 | dsi->pdev = dsidev; | 4619 | dsi->pdev = dsidev; |
4624 | dsi_pdev_map[dsi_module] = dsidev; | 4620 | dsi_pdev_map[dsi->module_id] = dsidev; |
4625 | dev_set_drvdata(&dsidev->dev, dsi); | 4621 | dev_set_drvdata(&dsidev->dev, dsi); |
4626 | 4622 | ||
4627 | spin_lock_init(&dsi->irq_lock); | 4623 | spin_lock_init(&dsi->irq_lock); |
@@ -4707,7 +4703,7 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) | |||
4707 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) | 4703 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) |
4708 | continue; | 4704 | continue; |
4709 | 4705 | ||
4710 | if (dssdev->phy.dsi.module != dsi_module) | 4706 | if (dssdev->phy.dsi.module != dsi->module_id) |
4711 | continue; | 4707 | continue; |
4712 | 4708 | ||
4713 | r = dsi_init_display(dssdev); | 4709 | r = dsi_init_display(dssdev); |
@@ -4724,15 +4720,15 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) | |||
4724 | 4720 | ||
4725 | dsi_runtime_put(dsidev); | 4721 | dsi_runtime_put(dsidev); |
4726 | 4722 | ||
4727 | if (dsi_module == 0) | 4723 | if (dsi->module_id == 0) |
4728 | dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs); | 4724 | dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs); |
4729 | else if (dsi_module == 1) | 4725 | else if (dsi->module_id == 1) |
4730 | dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs); | 4726 | dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs); |
4731 | 4727 | ||
4732 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 4728 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
4733 | if (dsi_module == 0) | 4729 | if (dsi->module_id == 0) |
4734 | dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs); | 4730 | dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs); |
4735 | else if (dsi_module == 1) | 4731 | else if (dsi->module_id == 1) |
4736 | dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs); | 4732 | dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs); |
4737 | #endif | 4733 | #endif |
4738 | return 0; | 4734 | return 0; |