aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/s3c-fb.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-27 09:16:07 -0500
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-01-03 11:00:04 -0500
commitfe05f8b1c3d28e6204a9ec54dec0d68af6cbf4c8 (patch)
tree555461116bd970354ec7bc129dc832fcbef7ba2f /drivers/video/s3c-fb.c
parent05342c0bdfd519873462e04ad81be07c9cd3c1e1 (diff)
video: s3c-fb: Make runtime PM functional again
The change in "video: s3c-fb: modify runtime pm functions" (commit 35784b) renders the runtime power management for the device completely ineffectual as while it leaves runtime power management notionally enabled a runtime power reference is held for the entire time the device is registered meaning it will never actually do anything. A further issue is introduced as runtime power management is added during the system suspend path which is not something which drivers are supposed to do and would interact poorly if there were any operations done in the runtime power management callbacks. While this does make things simpler (the main motivation for the original change) it will not only cause us to use more power in the framebuffer controller but will also prevent us entering lower power domain and SoC wide states as we can never power down the domain containing the device. Since neither of these things is desirable revert the change. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-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.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index a0b3fd670f71..b1a75a024a2c 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1038,8 +1038,30 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd,
1038 return ret; 1038 return ret;
1039} 1039}
1040 1040
1041static int s3c_fb_open(struct fb_info *info, int user)
1042{
1043 struct s3c_fb_win *win = info->par;
1044 struct s3c_fb *sfb = win->parent;
1045
1046 pm_runtime_get_sync(sfb->dev);
1047
1048 return 0;
1049}
1050
1051static int s3c_fb_release(struct fb_info *info, int user)
1052{
1053 struct s3c_fb_win *win = info->par;
1054 struct s3c_fb *sfb = win->parent;
1055
1056 pm_runtime_put_sync(sfb->dev);
1057
1058 return 0;
1059}
1060
1041static struct fb_ops s3c_fb_ops = { 1061static struct fb_ops s3c_fb_ops = {
1042 .owner = THIS_MODULE, 1062 .owner = THIS_MODULE,
1063 .fb_open = s3c_fb_open,
1064 .fb_release = s3c_fb_release,
1043 .fb_check_var = s3c_fb_check_var, 1065 .fb_check_var = s3c_fb_check_var,
1044 .fb_set_par = s3c_fb_set_par, 1066 .fb_set_par = s3c_fb_set_par,
1045 .fb_blank = s3c_fb_blank, 1067 .fb_blank = s3c_fb_blank,
@@ -1446,6 +1468,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
1446 } 1468 }
1447 1469
1448 platform_set_drvdata(pdev, sfb); 1470 platform_set_drvdata(pdev, sfb);
1471 pm_runtime_put_sync(sfb->dev);
1449 1472
1450 return 0; 1473 return 0;
1451 1474
@@ -1485,6 +1508,8 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
1485 struct s3c_fb *sfb = platform_get_drvdata(pdev); 1508 struct s3c_fb *sfb = platform_get_drvdata(pdev);
1486 int win; 1509 int win;
1487 1510
1511 pm_runtime_get_sync(sfb->dev);
1512
1488 for (win = 0; win < S3C_FB_MAX_WIN; win++) 1513 for (win = 0; win < S3C_FB_MAX_WIN; win++)
1489 if (sfb->windows[win]) 1514 if (sfb->windows[win])
1490 s3c_fb_release_win(sfb, sfb->windows[win]); 1515 s3c_fb_release_win(sfb, sfb->windows[win]);
@@ -1510,7 +1535,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
1510 return 0; 1535 return 0;
1511} 1536}
1512 1537
1513#ifdef CONFIG_PM_SLEEP 1538#ifdef CONFIG_PM
1514static int s3c_fb_suspend(struct device *dev) 1539static int s3c_fb_suspend(struct device *dev)
1515{ 1540{
1516 struct platform_device *pdev = to_platform_device(dev); 1541 struct platform_device *pdev = to_platform_device(dev);
@@ -1531,8 +1556,6 @@ static int s3c_fb_suspend(struct device *dev)
1531 clk_disable(sfb->lcd_clk); 1556 clk_disable(sfb->lcd_clk);
1532 1557
1533 clk_disable(sfb->bus_clk); 1558 clk_disable(sfb->bus_clk);
1534 pm_runtime_put_sync(sfb->dev);
1535
1536 return 0; 1559 return 0;
1537} 1560}
1538 1561
@@ -1544,7 +1567,6 @@ static int s3c_fb_resume(struct device *dev)
1544 struct s3c_fb_win *win; 1567 struct s3c_fb_win *win;
1545 int win_no; 1568 int win_no;
1546 1569
1547 pm_runtime_get_sync(sfb->dev);
1548 clk_enable(sfb->bus_clk); 1570 clk_enable(sfb->bus_clk);
1549 1571
1550 if (!sfb->variant.has_clksel) 1572 if (!sfb->variant.has_clksel)
@@ -1583,19 +1605,11 @@ static int s3c_fb_resume(struct device *dev)
1583 1605
1584 return 0; 1606 return 0;
1585} 1607}
1608#else
1609#define s3c_fb_suspend NULL
1610#define s3c_fb_resume NULL
1586#endif 1611#endif
1587 1612
1588#ifdef CONFIG_PM_RUNTIME
1589static int s3c_fb_runtime_suspend(struct device *dev)
1590{
1591 return 0;
1592}
1593
1594static int s3c_fb_runtime_resume(struct device *dev)
1595{
1596 return 0;
1597}
1598#endif
1599 1613
1600#define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4)) 1614#define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
1601#define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8)) 1615#define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
@@ -1918,10 +1932,7 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
1918}; 1932};
1919MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids); 1933MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
1920 1934
1921static const struct dev_pm_ops s3c_fb_pm_ops = { 1935static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
1922 SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
1923 SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, NULL)
1924};
1925 1936
1926static struct platform_driver s3c_fb_driver = { 1937static struct platform_driver s3c_fb_driver = {
1927 .probe = s3c_fb_probe, 1938 .probe = s3c_fb_probe,
@@ -1930,7 +1941,7 @@ static struct platform_driver s3c_fb_driver = {
1930 .driver = { 1941 .driver = {
1931 .name = "s3c-fb", 1942 .name = "s3c-fb",
1932 .owner = THIS_MODULE, 1943 .owner = THIS_MODULE,
1933 .pm = &s3c_fb_pm_ops, 1944 .pm = &s3cfb_pm_ops,
1934 }, 1945 },
1935}; 1946};
1936 1947