Skip to content

Commit

Permalink
[media] s5p-fimc: Add runtime PM support in the mem-to-mem driver
Browse files Browse the repository at this point in the history
Add runtime PM and system sleep support in the memory-to-memory
driver. It's required to enable the FIMC operation on Exynos4
SoCs. This patch prevents system boot failure when the driver
is compiled in, as it now tries to access its I/O memory without
first enabling the corresponding power domain.

The camera capture device suspend/resume is not fully covered,
the capture device is just powered on/off during the video
node open/close. However this enables it's normal operation
on Exynos4 SoCs.

[mchehab@redhat.com: fix a small checkpatch error]
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Sep 6, 2011
1 parent bd323e2 commit e9e2108
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 80 deletions.
2 changes: 1 addition & 1 deletion drivers/media/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ config VIDEO_MX2

config VIDEO_SAMSUNG_S5P_FIMC
tristate "Samsung S5P and EXYNOS4 camera host interface driver"
depends on VIDEO_DEV && VIDEO_V4L2 && PLAT_S5P
depends on VIDEO_V4L2 && PLAT_S5P && PM_RUNTIME
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
---help---
Expand Down
18 changes: 18 additions & 0 deletions drivers/media/video/s5p-fimc/fimc-capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/clk.h>
Expand Down Expand Up @@ -271,6 +272,16 @@ static int stop_streaming(struct vb2_queue *q)
return fimc_stop_capture(fimc);
}

int fimc_capture_suspend(struct fimc_dev *fimc)
{
return -EBUSY;
}

int fimc_capture_resume(struct fimc_dev *fimc)
{
return 0;
}

static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane)
{
if (!fr || plane >= fr->fmt->memplanes)
Expand Down Expand Up @@ -396,9 +407,14 @@ static int fimc_capture_open(struct file *file)
if (fimc_m2m_active(fimc))
return -EBUSY;

ret = pm_runtime_get_sync(&fimc->pdev->dev);
if (ret)
return ret;

if (++fimc->vid_cap.refcnt == 1) {
ret = fimc_isp_subdev_init(fimc, 0);
if (ret) {
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->vid_cap.refcnt--;
return -EIO;
}
Expand Down Expand Up @@ -426,6 +442,8 @@ static int fimc_capture_close(struct file *file)
fimc_subdev_unregister(fimc);
}

pm_runtime_put(&fimc->pdev->dev);

return 0;
}

Expand Down
Loading

0 comments on commit e9e2108

Please sign in to comment.