Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306247
b: refs/heads/master
c: 1567bb7
h: refs/heads/master
i:
  306245: f3e2e61
  306243: 005842f
  306239: 1db134b
v: v3
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed May 8, 2012
1 parent ff0a4d2 commit 663eebc
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 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: 4742c82ed90d0f8c82639750dcfe481e61d883a4
refs/heads/master: 1567bb7dcc6a232693143fdbe3b89791f20890ac
27 changes: 21 additions & 6 deletions trunk/drivers/media/video/omap3isp/isp.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,17 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
unsigned long flags;
int ret;

/* If the preview engine crashed it might not respond to read/write
* operations on the L4 bus. This would result in a bus fault and a
* kernel oops. Refuse to start streaming in that case. This check must
* be performed before the loop below to avoid starting entities if the
* pipeline won't start anyway (those entities would then likely fail to
* stop, making the problem worse).
*/
if ((pipe->entities & isp->crashed) &
(1U << isp->isp_prev.subdev.entity.id))
return -EIO;

spin_lock_irqsave(&pipe->lock, flags);
pipe->state &= ~(ISP_PIPELINE_IDLE_INPUT | ISP_PIPELINE_IDLE_OUTPUT);
spin_unlock_irqrestore(&pipe->lock, flags);
Expand Down Expand Up @@ -879,13 +890,15 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)

if (ret) {
dev_info(isp->dev, "Unable to stop %s\n", subdev->name);
/* If the entity failed to stopped, assume it has
* crashed. Mark it as such, the ISP will be reset when
* applications will release it.
*/
isp->crashed |= 1U << subdev->entity.id;
failure = -ETIMEDOUT;
}
}

if (failure < 0)
isp->needs_reset = true;

return failure;
}

Expand Down Expand Up @@ -1069,6 +1082,7 @@ static int isp_reset(struct isp_device *isp)
udelay(1);
}

isp->crashed = 0;
return 0;
}

Expand Down Expand Up @@ -1496,10 +1510,11 @@ void omap3isp_put(struct isp_device *isp)
if (--isp->ref_count == 0) {
isp_disable_interrupts(isp);
isp_save_ctx(isp);
if (isp->needs_reset) {
/* Reset the ISP if an entity has failed to stop. This is the
* only way to recover from such conditions.
*/
if (isp->crashed)
isp_reset(isp);
isp->needs_reset = false;
}
isp_disable_clocks(isp);
}
mutex_unlock(&isp->isp_mutex);
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/media/video/omap3isp/isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct isp_platform_callback {
* @raw_dmamask: Raw DMA mask
* @stat_lock: Spinlock for handling statistics
* @isp_mutex: Mutex for serializing requests to ISP.
* @crashed: Bitmask of crashed entities (indexed by entity ID)
* @has_context: Context has been saved at least once and can be restored.
* @ref_count: Reference count for handling multiple ISP requests.
* @cam_ick: Pointer to camera interface clock structure.
Expand Down Expand Up @@ -184,7 +185,7 @@ struct isp_device {
/* ISP Obj */
spinlock_t stat_lock; /* common lock for statistic drivers */
struct mutex isp_mutex; /* For handling ref_count field */
bool needs_reset;
u32 crashed;
int has_context;
int ref_count;
unsigned int autoidle;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/media/video/omap3isp/ispvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,17 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
int ret;

pipe->max_rate = pipe->l3_ick;
pipe->entities = 0;

subdev = isp_video_remote_subdev(pipe->output, NULL);
if (subdev == NULL)
return -EPIPE;

while (1) {
unsigned int shifter_link;

pipe->entities |= 1U << subdev->entity.id;

/* Retrieve the sink format */
pad = &subdev->entity.pads[0];
if (!(pad->flags & MEDIA_PAD_FL_SINK))
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/media/video/omap3isp/ispvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ enum isp_pipeline_state {
/*
* struct isp_pipeline - An ISP hardware pipeline
* @error: A hardware error occurred during capture
* @entities: Bitmask of entities in the pipeline (indexed by entity ID)
*/
struct isp_pipeline {
struct media_pipeline pipe;
Expand All @@ -96,6 +97,7 @@ struct isp_pipeline {
enum isp_pipeline_stream_state stream_state;
struct isp_video *input;
struct isp_video *output;
u32 entities;
unsigned long l3_ick;
unsigned int max_rate;
atomic_t frame_number;
Expand Down

0 comments on commit 663eebc

Please sign in to comment.