aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/s3c-fb.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2011-12-05 11:42:46 +0900
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-12-19 20:06:04 +0000
commit35784b4315d949e431df9a0ffef721a4801b1588 (patch)
tree72cc35fc04a2f0e26609123ff016c6ba1dec87ee /drivers/video/s3c-fb.c
parentddd3d905436b572ebadc09dcf2d12ca5b37020a0 (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.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 7a840d52474..25a5c766585 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,
return ret;
}
-static int s3c_fb_open(struct fb_info *info, int user)
-{
- struct s3c_fb_win *win = info->par;
- struct s3c_fb *sfb = win->parent;
-
- pm_runtime_get_sync(sfb->dev);
-
- return 0;
-}
-
-static int s3c_fb_release(struct fb_info *info, int user)
-{
- struct s3c_fb_win *win = info->par;
- struct s3c_fb *sfb = win->parent;
-
- pm_runtime_put_sync(sfb->dev);
-
- return 0;
-}
-
static struct fb_ops s3c_fb_ops = {
.owner = THIS_MODULE,
- .fb_open = s3c_fb_open,
- .fb_release = s3c_fb_release,
.fb_check_var = s3c_fb_check_var,
.fb_set_par = s3c_fb_set_par,
.fb_blank = s3c_fb_blank,
@@ -1459,7 +1437,6 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, sfb);
- pm_runtime_put_sync(sfb->dev);
return 0;
@@ -1499,8 +1476,6 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
struct s3c_fb *sfb = platform_get_drvdata(pdev);
int win;
- pm_runtime_get_sync(sfb->dev);
-
for (win = 0; win < S3C_FB_MAX_WIN; win++)
if (sfb->windows[win])
s3c_fb_release_win(sfb, sfb->windows[win]);
@@ -1526,7 +1501,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int s3c_fb_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -1547,6 +1522,8 @@ static int s3c_fb_suspend(struct device *dev)
clk_disable(sfb->lcd_clk);
clk_disable(sfb->bus_clk);
+ pm_runtime_put_sync(sfb->dev);
+
return 0;
}
@@ -1558,6 +1535,7 @@ static int s3c_fb_resume(struct device *dev)
struct s3c_fb_win *win;
int win_no;
+ pm_runtime_get_sync(sfb->dev);
clk_enable(sfb->bus_clk);
if (!sfb->variant.has_clksel)
@@ -1591,11 +1569,19 @@ static int s3c_fb_resume(struct device *dev)
return 0;
}
-#else
-#define s3c_fb_suspend NULL
-#define s3c_fb_resume NULL
#endif
+#ifdef CONFIG_PM_RUNTIME
+static int s3c_fb_runtime_suspend(struct device *dev)
+{
+ return 0;
+}
+
+static int s3c_fb_runtime_resume(struct device *dev)
+{
+ return 0;
+}
+#endif
#define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4))
#define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8))
@@ -1918,7 +1904,10 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
};
MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids);
-static UNIVERSAL_DEV_PM_OPS(s3cfb_pm_ops, s3c_fb_suspend, s3c_fb_resume, NULL);
+static const struct dev_pm_ops s3c_fb_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume)
+ SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, NULL)
+};
static struct platform_driver s3c_fb_driver = {
.probe = s3c_fb_probe,
@@ -1927,7 +1916,7 @@ static struct platform_driver s3c_fb_driver = {
.driver = {
.name = "s3c-fb",
.owner = THIS_MODULE,
- .pm = &s3cfb_pm_ops,
+ .pm = &s3c_fb_pm_ops,
},
};