diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-12-27 05:23:05 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-05 03:16:05 -0500 |
commit | 236782a5f3674d06865d822092b8a1ea65a44f96 (patch) | |
tree | 547b8376a220e2b853a197e23ab57a6a7dca9082 /drivers/video/sh_mipi_dsi.c | |
parent | 6722a4016d7f5f107a82ad71a3ee1ccec105532f (diff) |
fbdev: sh-mobile: implement MIPI DSI runtime PM support
On SH-Mobile platforms using runtime PM with the MIPI DSI driver switches the
DSI Tx link clock on PM events.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sh_mipi_dsi.c')
-rw-r--r-- | drivers/video/sh_mipi_dsi.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index b40dc423cbdf..23231279c387 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/pm_runtime.h> | ||
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
@@ -50,9 +51,11 @@ struct sh_mipi { | |||
50 | void __iomem *linkbase; | 51 | void __iomem *linkbase; |
51 | struct clk *dsit_clk; | 52 | struct clk *dsit_clk; |
52 | struct clk *dsip_clk; | 53 | struct clk *dsip_clk; |
53 | void *next_board_data; | 54 | struct device *dev; |
54 | void (*next_display_on)(void *board_data, struct fb_info *info); | 55 | |
55 | void (*next_display_off)(void *board_data); | 56 | void *next_board_data; |
57 | void (*next_display_on)(void *board_data, struct fb_info *info); | ||
58 | void (*next_display_off)(void *board_data); | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI]; | 61 | static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI]; |
@@ -124,6 +127,7 @@ static void mipi_display_on(void *arg, struct fb_info *info) | |||
124 | { | 127 | { |
125 | struct sh_mipi *mipi = arg; | 128 | struct sh_mipi *mipi = arg; |
126 | 129 | ||
130 | pm_runtime_get_sync(mipi->dev); | ||
127 | sh_mipi_dsi_enable(mipi, true); | 131 | sh_mipi_dsi_enable(mipi, true); |
128 | 132 | ||
129 | if (mipi->next_display_on) | 133 | if (mipi->next_display_on) |
@@ -138,6 +142,7 @@ static void mipi_display_off(void *arg) | |||
138 | mipi->next_display_off(mipi->next_board_data); | 142 | mipi->next_display_off(mipi->next_board_data); |
139 | 143 | ||
140 | sh_mipi_dsi_enable(mipi, false); | 144 | sh_mipi_dsi_enable(mipi, false); |
145 | pm_runtime_put(mipi->dev); | ||
141 | } | 146 | } |
142 | 147 | ||
143 | static int __init sh_mipi_setup(struct sh_mipi *mipi, | 148 | static int __init sh_mipi_setup(struct sh_mipi *mipi, |
@@ -396,6 +401,8 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
396 | goto emap2; | 401 | goto emap2; |
397 | } | 402 | } |
398 | 403 | ||
404 | mipi->dev = &pdev->dev; | ||
405 | |||
399 | mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); | 406 | mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); |
400 | if (IS_ERR(mipi->dsit_clk)) { | 407 | if (IS_ERR(mipi->dsit_clk)) { |
401 | ret = PTR_ERR(mipi->dsit_clk); | 408 | ret = PTR_ERR(mipi->dsit_clk); |
@@ -445,6 +452,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
445 | 452 | ||
446 | mipi_dsi[idx] = mipi; | 453 | mipi_dsi[idx] = mipi; |
447 | 454 | ||
455 | pm_runtime_enable(&pdev->dev); | ||
456 | pm_runtime_resume(&pdev->dev); | ||
457 | |||
448 | ret = sh_mipi_setup(mipi, pdata); | 458 | ret = sh_mipi_setup(mipi, pdata); |
449 | if (ret < 0) | 459 | if (ret < 0) |
450 | goto emipisetup; | 460 | goto emipisetup; |
@@ -461,11 +471,13 @@ static int __init sh_mipi_probe(struct platform_device *pdev) | |||
461 | pdata->lcd_chan->board_cfg.board_data = mipi; | 471 | pdata->lcd_chan->board_cfg.board_data = mipi; |
462 | pdata->lcd_chan->board_cfg.display_on = mipi_display_on; | 472 | pdata->lcd_chan->board_cfg.display_on = mipi_display_on; |
463 | pdata->lcd_chan->board_cfg.display_off = mipi_display_off; | 473 | pdata->lcd_chan->board_cfg.display_off = mipi_display_off; |
474 | pdata->lcd_chan->board_cfg.owner = THIS_MODULE; | ||
464 | 475 | ||
465 | return 0; | 476 | return 0; |
466 | 477 | ||
467 | emipisetup: | 478 | emipisetup: |
468 | mipi_dsi[idx] = NULL; | 479 | mipi_dsi[idx] = NULL; |
480 | pm_runtime_disable(&pdev->dev); | ||
469 | clk_disable(mipi->dsip_clk); | 481 | clk_disable(mipi->dsip_clk); |
470 | eclkpon: | 482 | eclkpon: |
471 | clk_disable(mipi->dsit_clk); | 483 | clk_disable(mipi->dsit_clk); |
@@ -517,10 +529,12 @@ static int __exit sh_mipi_remove(struct platform_device *pdev) | |||
517 | if (ret < 0) | 529 | if (ret < 0) |
518 | return ret; | 530 | return ret; |
519 | 531 | ||
532 | pdata->lcd_chan->board_cfg.owner = NULL; | ||
520 | pdata->lcd_chan->board_cfg.display_on = NULL; | 533 | pdata->lcd_chan->board_cfg.display_on = NULL; |
521 | pdata->lcd_chan->board_cfg.display_off = NULL; | 534 | pdata->lcd_chan->board_cfg.display_off = NULL; |
522 | pdata->lcd_chan->board_cfg.board_data = NULL; | 535 | pdata->lcd_chan->board_cfg.board_data = NULL; |
523 | 536 | ||
537 | pm_runtime_disable(&pdev->dev); | ||
524 | clk_disable(mipi->dsip_clk); | 538 | clk_disable(mipi->dsip_clk); |
525 | clk_disable(mipi->dsit_clk); | 539 | clk_disable(mipi->dsit_clk); |
526 | clk_put(mipi->dsit_clk); | 540 | clk_put(mipi->dsit_clk); |