Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311880
b: refs/heads/master
c: e3fc82e
h: refs/heads/master
v: v3
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Jun 25, 2012
1 parent 4cdb65a commit c28d83a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 44 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b4b1f199d367762ddb68cb3303431fa6c84a7d6
refs/heads/master: e3fc82e8b9f550d28f05600b98bcc8c26beef2ef
46 changes: 24 additions & 22 deletions trunk/drivers/media/video/s5p-fimc/fimc-capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,37 +480,39 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc);
static int fimc_capture_open(struct file *file)
{
struct fimc_dev *fimc = video_drvdata(file);
int ret = v4l2_fh_open(file);

if (ret)
return ret;
int ret;

dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);

/* Return if the corresponding video mem2mem node is already opened. */
if (fimc_m2m_active(fimc))
return -EBUSY;

set_bit(ST_CAPT_BUSY, &fimc->state);
pm_runtime_get_sync(&fimc->pdev->dev);

if (++fimc->vid_cap.refcnt == 1) {
ret = fimc_pipeline_initialize(&fimc->pipeline,
&fimc->vid_cap.vfd->entity, true);
if (ret < 0) {
dev_err(&fimc->pdev->dev,
"Video pipeline initialization failed\n");
clear_bit(ST_CAPT_BUSY, &fimc->state);
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->vid_cap.refcnt--;
v4l2_fh_release(file);
return ret;
}
ret = fimc_capture_ctrls_create(fimc);
ret = pm_runtime_get_sync(&fimc->pdev->dev);
if (ret < 0)
return ret;

ret = v4l2_fh_open(file);
if (ret)
return ret;

if (++fimc->vid_cap.refcnt != 1)
return 0;

if (!ret && !fimc->vid_cap.user_subdev_api)
ret = fimc_capture_set_default_format(fimc);
ret = fimc_pipeline_initialize(&fimc->pipeline,
&fimc->vid_cap.vfd->entity, true);
if (ret < 0) {
clear_bit(ST_CAPT_BUSY, &fimc->state);
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->vid_cap.refcnt--;
v4l2_fh_release(file);
return ret;
}
ret = fimc_capture_ctrls_create(fimc);

if (!ret && !fimc->vid_cap.user_subdev_api)
ret = fimc_capture_set_default_format(fimc);

return ret;
}

Expand Down
14 changes: 8 additions & 6 deletions trunk/drivers/media/video/s5p-fimc/fimc-lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,21 +451,23 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc)
static int fimc_lite_open(struct file *file)
{
struct fimc_lite *fimc = video_drvdata(file);
int ret = v4l2_fh_open(file);

if (ret)
return ret;
int ret;

set_bit(ST_FLITE_IN_USE, &fimc->state);
pm_runtime_get_sync(&fimc->pdev->dev);
ret = pm_runtime_get_sync(&fimc->pdev->dev);
if (ret < 0)
return ret;

if (++fimc->ref_count != 1 || fimc->out_path != FIMC_IO_DMA)
return 0;

ret = v4l2_fh_open(file);
if (ret < 0)
return ret;

ret = fimc_pipeline_initialize(&fimc->pipeline, &fimc->vfd->entity,
true);
if (ret < 0) {
v4l2_err(fimc->vfd, "Video pipeline initialization failed\n");
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->ref_count--;
v4l2_fh_release(file);
Expand Down
19 changes: 6 additions & 13 deletions trunk/drivers/media/video/s5p-fimc/fimc-mdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,8 @@ static void fimc_md_put_clocks(struct fimc_md *fmd)
}

static int __fimc_md_set_camclk(struct fimc_md *fmd,
struct fimc_sensor_info *s_info,
bool on)
struct fimc_sensor_info *s_info,
bool on)
{
struct s5p_fimc_isp_info *pdata = s_info->pdata;
struct fimc_camclk_info *camclk;
Expand All @@ -751,12 +751,10 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL)
return -EINVAL;

if (s_info->clk_on == on)
return 0;
camclk = &fmd->camclk[pdata->clk_id];

dbg("camclk %d, f: %lu, clk: %p, on: %d",
pdata->clk_id, pdata->clk_frequency, camclk, on);
dbg("camclk %d, f: %lu, use_count: %d, on: %d",
pdata->clk_id, pdata->clk_frequency, camclk->use_count, on);

if (on) {
if (camclk->use_count > 0 &&
Expand All @@ -767,11 +765,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
clk_set_rate(camclk->clock, pdata->clk_frequency);
camclk->frequency = pdata->clk_frequency;
ret = clk_enable(camclk->clock);
dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
clk_get_rate(camclk->clock));
}
s_info->clk_on = 1;
dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
clk_get_rate(camclk->clock));

return ret;
}

Expand All @@ -780,7 +776,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,

if (--camclk->use_count == 0) {
clk_disable(camclk->clock);
s_info->clk_on = 0;
dbg("Disabled camclk %d", pdata->clk_id);
}
return ret;
Expand All @@ -796,8 +791,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
* devices to which sensors can be attached, either directly or through
* the MIPI CSI receiver. The clock is allowed here to be used by
* multiple sensors concurrently if they use same frequency.
* The per sensor subdev clk_on attribute helps to synchronize accesses
* to the sclk_cam clocks from the video and media device nodes.
* This function should only be called when the graph mutex is held.
*/
int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on)
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/media/video/s5p-fimc/fimc-mdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ struct fimc_camclk_info {
* @pdata: sensor's atrributes passed as media device's platform data
* @subdev: image sensor v4l2 subdev
* @host: fimc device the sensor is currently linked to
* @clk_on: sclk_cam clock's state associated with this subdev
*
* This data structure applies to image sensor and the writeback subdevs.
*/
struct fimc_sensor_info {
struct s5p_fimc_isp_info *pdata;
struct v4l2_subdev *subdev;
struct fimc_dev *host;
bool clk_on;
};

/**
Expand Down

0 comments on commit c28d83a

Please sign in to comment.