diff options
author | Jingoo Han <jg1.han@samsung.com> | 2011-12-04 21:42:46 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-12-19 15:06:04 -0500 |
commit | 35784b4315d949e431df9a0ffef721a4801b1588 (patch) | |
tree | 72cc35fc04a2f0e26609123ff016c6ba1dec87ee /drivers/video/s3c-fb.c | |
parent | ddd3d905436b572ebadc09dcf2d12ca5b37020a0 (diff) |
video: s3c-fb: modify runtime pm functions
Runtime suspend and runtime resume are modified in order to
reduce the complexity and improve the usability of runtime pm.
After probe function, s3c-fb driver is not suspended until
suspend or remove is called.
The scheme is changed as follows:
runtime_get is only called in probe and resume.
runtime_put is only called in remove and suspend.
open/close cannot call the runtime_get/put.
Also, runtime_susepnd/resume are just called by runtime pm,
not doing suspend/resume routine any longer. This is because
open/close cannot call the runtime_get/put; the suspend/resume
routine in runtime_suspend/resume were previously used when
open and close were called.
The name of s3c-fb dev_pm_ops is changed from s3cfb_pm_ops to
s3c_fb_pm_ops in order to use more consistent naming.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/s3c-fb.c')
-rw-r--r-- | drivers/video/s3c-fb.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 7a840d52474d..25a5c7665855 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -1029,30 +1029,8 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1029 | return ret; | 1029 | return ret; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static int s3c_fb_open(struct fb_info *info, int user) | ||
1033 | { | ||
1034 | struct s3c_fb_win *win = info->par; | ||
1035 | struct s3c_fb *sfb = win->parent; | ||
1036 | |||
1037 | pm_runtime_get_sync(sfb->dev); | ||
1038 | |||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1042 | static int s3c_fb_release(struct fb_info *info, int user) | ||
1043 | { | ||
1044 | struct s3c_fb_win *win = info->par; | ||
1045 | struct s3c_fb *sfb = win->parent; | ||
1046 | |||
1047 | pm_runtime_put_sync(sfb->dev); | ||
1048 | |||
1049 | return 0; | ||
1050 | } | ||
1051 | |||
1052 | static struct fb_ops s3c_fb_ops = { | 1032 | static struct fb_ops s3c_fb_ops = { |
1053 | .owner = THIS_MODULE, | 1033 | .owner = THIS_MODULE, |
1054 | .fb_open = s3c_fb_open, | ||
1055 | .fb_release = s3c_fb_release, | ||
1056 | .fb_check_var = s3c_fb_check_var, | 1034 | .fb_check_var = s3c_fb_check_var, |
1057 | .fb_set_par = s3c_fb_set_par, | 1035 | .fb_set_par = s3c_fb_set_par, |
1058 | .fb_blank = s3c_fb_blank, | 1036 | .fb_blank = s3c_fb_blank, |
@@ -1459,7 +1437,6 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev) | |||
1459 | } | 1437 | } |
1460 | 1438 | ||
1461 | platform_set_drvdata(pdev, sfb); | 1439 | platform_set_drvdata(pdev, sfb); |
1462 | pm_runtime_put_sync(sfb->dev); | ||
1463 | 1440 | ||
1464 | return 0; | 1441 | return 0; |
1465 | 1442 | ||
@@ -1499,8 +1476,6 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) | |||
1499 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | 1476 | struct s3c_fb *sfb = platform_get_drvdata(pdev); |
1500 | int win; | 1477 | int win; |
1501 | 1478 | ||
1502 | pm_runtime_get_sync(sfb->dev); | ||
1503 | |||
1504 | for (win = 0; win < S3C_FB_MAX_WIN; win++) | 1479 | for (win = 0; win < S3C_FB_MAX_WIN; win++) |
1505 | if (sfb->windows[win]) | 1480 | if (sfb->windows[win]) |
1506 | s3c_fb_release_win(sfb, sfb->windows[win]); | 1481 | s3c_fb_release_win(sfb, sfb->windows[win]); |
@@ -1526,7 +1501,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) | |||
1526 | return 0; | 1501 | return 0; |
1527 | } | 1502 | } |
1528 | 1503 | ||
1529 | #ifdef CONFIG_PM | 1504 | #ifdef CONFIG_PM_SLEEP |
1530 | static int s3c_fb_suspend(struct device *dev) | 1505 | static int s3c_fb_suspend(struct device *dev) |
1531 | { | 1506 | { |
1532 | struct platform_device *pdev = to_platform_device(dev); | 1507 | struct platform_device *pdev = to_platform_device(dev); |
@@ -1547,6 +1522,8 @@ static int s3c_fb_suspend(struct device *dev) | |||
1547 | clk_disable(sfb->lcd_clk); | 1522 | clk_disable(sfb->lcd_clk); |
1548 | 1523 | ||
1549 | clk_disable(sfb->bus_clk); | 1524 | clk_disable(sfb->bus_clk); |
1525 | pm_runtime_put_sync(sfb->dev); | ||
1526 | |||
1550 | return 0; | 1527 | return 0; |
1551 | } | 1528 | } |
1552 | 1529 | ||
@@ -1558,6 +1535,7 @@ static int s3c_fb_resume(struct device *dev) | |||
1558 | struct s3c_fb_win *win; | 1535 | struct s3c_fb_win *win; |
1559 | int win_no; | 1536 | int win_no; |
1560 | 1537 | ||
1538 | pm_runtime_get_sync(sfb->dev); | ||
1561 | clk_enable(sfb->bus_clk); | 1539 | clk_enable(sfb->bus_clk); |
1562 | 1540 | ||
1563 | if (!sfb->variant.has_clksel) | 1541 | if (!sfb->variant.has_clksel) |
@@ -1591,11 +1569,19 @@ static int s3c_fb_resume(struct device *dev) | |||
1591 | 1569 | ||
1592 | return 0; | 1570 | return 0; |
1593 | } | 1571 | } |
1594 | #else | ||
1595 | #define s3c_fb_suspend NULL | ||
1596 | #define s3c_fb_resume NULL | ||
1597 | #endif | 1572 | #endif |
1598 | 1573 | ||
1574 | #ifdef CONFIG_PM_RUNTIME | ||
1575 | static int s3c_fb_runtime_suspend(struct device *dev) | ||
1576 | { | ||
1577 | return 0; | ||
1578 | } | ||
1579 | |||
1580 | static int s3c_fb_runtime_resume(struct device *dev) | ||
1581 | { | ||
1582 | return 0; | ||
1583 | } | ||
1584 | #endif | ||
1599 | 1585 | ||
1600 | #define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4)) | 1586 | #define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4)) |
1601 | #define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8)) | 1587 | #define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8)) |
@@ -1918,7 +1904,10 @@ static struct platform_device_id s3c_fb_driver_ids[] = { | |||
1918 | }; | 1904 | }; |
1919 | MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids); | 1905 | MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids); |
1920 | 1906 | ||
1921 | static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL); | 1907 | static const struct dev_pm_ops s3c_fb_pm_ops = { |
1908 | SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume) | ||
1909 | SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, NULL) | ||
1910 | }; | ||
1922 | 1911 | ||
1923 | static struct platform_driver s3c_fb_driver = { | 1912 | static struct platform_driver s3c_fb_driver = { |
1924 | .probe = s3c_fb_probe, | 1913 | .probe = s3c_fb_probe, |
@@ -1927,7 +1916,7 @@ static struct platform_driver s3c_fb_driver = { | |||
1927 | .driver = { | 1916 | .driver = { |
1928 | .name = "s3c-fb", | 1917 | .name = "s3c-fb", |
1929 | .owner = THIS_MODULE, | 1918 | .owner = THIS_MODULE, |
1930 | .pm = &s3cfb_pm_ops, | 1919 | .pm = &s3c_fb_pm_ops, |
1931 | }, | 1920 | }, |
1932 | }; | 1921 | }; |
1933 | 1922 | ||