diff options
Diffstat (limited to 'isp')
| -rw-r--r-- | isp/omap3isp.c | 157 | 
1 files changed, 86 insertions, 71 deletions
| diff --git a/isp/omap3isp.c b/isp/omap3isp.c index eb90dcd..7ab90c4 100644 --- a/isp/omap3isp.c +++ b/isp/omap3isp.c @@ -335,6 +335,7 @@ static int omap3_isp_pipeline_try_format(struct omap3_isp_device *isp,  	struct v4l2_mbus_framefmt format;  	struct omap3_isp_entity *source = NULL;  	struct omap3_isp_entity *sink; +	struct omap3_isp_entity *last = NULL;  	struct media_entity_pad *pad;  	int ret; @@ -363,35 +364,53 @@ static int omap3_isp_pipeline_try_format(struct omap3_isp_device *isp,  			continue;  		} -		if (media_entity_type(sink->entity) == MEDIA_ENT_T_DEVNODE) -			break; +		if (source->type == OMAP3_ISP_ENTITY_ENTITY) { +			/* Try to force the output format code onto the source pad. */ +			pad = source->source.link->source; -		/* Try to force the output format code onto the source pad. */ -		pad = source->source.link->source; +			ret = v4l2_subdev_get_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_TRY); +			if (ret < 0) { +				printf("error: get format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			} -		ret = v4l2_subdev_get_format(pad->entity, &format, pad->index, -					     V4L2_SUBDEV_FORMAT_TRY); -		if (ret < 0) { -			printf("error: get format failed on %s:%u.\n", -				pad->entity->info.name, pad->index); -			return ret; +			format.code = ofmt->code; +			ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_TRY); +			if (ret < 0) { +				printf("error: set format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			} + +			source->source.format = format;  		} -		format.code = ofmt->code; -		ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, -					     V4L2_SUBDEV_FORMAT_TRY); -		if (ret < 0) { -			printf("error: set format failed on %s:%u.\n", -				pad->entity->info.name, pad->index); -			return ret; +		if (sink->type == OMAP3_ISP_ENTITY_ENTITY) { +			/* Propagate the format to the link target. */ +			pad = sink->sink.link->sink; + +			ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_TRY); +			if (ret < 0) { +				printf("error: set format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			} + +			sink->sink.format = format; +			last = sink;  		} -		source->source.format = format; +		source = sink; +	} -		/* Propagate the format to the link target. */ -		pad = sink->sink.link->sink; +	if (last != NULL) { +		pad = last->source.link->source; -		ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, +		ret = v4l2_subdev_set_format(pad->entity, ofmt, pad->index,  					     V4L2_SUBDEV_FORMAT_TRY);  		if (ret < 0) {  			printf("error: set format failed on %s:%u.\n", @@ -399,22 +418,9 @@ static int omap3_isp_pipeline_try_format(struct omap3_isp_device *isp,  			return ret;  		} -		sink->sink.format = format; - -		source = sink; -	} - -	pad = source->source.link->source; - -	ret = v4l2_subdev_set_format(pad->entity, ofmt, pad->index, -				     V4L2_SUBDEV_FORMAT_TRY); -	if (ret < 0) { -		printf("error: set format failed on %s:%u.\n", -			pad->entity->info.name, pad->index); -		return ret; +		last->source.format = *ofmt;  	} -	source->source.format = *ofmt;  	return 0;  } @@ -424,6 +430,7 @@ static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp,  	struct v4l2_mbus_framefmt format;  	struct omap3_isp_entity *source = NULL;  	struct omap3_isp_entity *sink; +	struct omap3_isp_entity *last = NULL;  	struct media_entity_pad *pad;  	int ret; @@ -439,13 +446,13 @@ static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp,  		}  		/* Enable the link. */ -		ret = setup_link(isp, source->entity, sink->entity, -				 MEDIA_LNK_FL_ENABLED); -		if (ret < 0) -			return ret; - -		if (media_entity_type(sink->entity) == MEDIA_ENT_T_DEVNODE) -			break; +		if (source->type != OMAP3_ISP_ENTITY_POOL && +		    sink->type != OMAP3_ISP_ENTITY_POOL) { +			ret = setup_link(isp, source->entity, sink->entity, +					 MEDIA_LNK_FL_ENABLED); +			if (ret < 0) +				return ret; +		}  		/* Configure formats.  		 * @@ -457,27 +464,48 @@ static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp,  		 * reason, instead of blindly applying formats that have been  		 * tried earlier, repropagate them through the pipeline.  		 */ -		pad = source->source.link->source; +		if (source->type == OMAP3_ISP_ENTITY_ENTITY) { +			pad = source->source.link->source; + +			ret = v4l2_subdev_get_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_ACTIVE); +			if (ret < 0) { +				printf("error: get format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			} -		ret = v4l2_subdev_get_format(pad->entity, &format, pad->index, -					     V4L2_SUBDEV_FORMAT_ACTIVE); -		if (ret < 0) { -			printf("error: get format failed on %s:%u.\n", -				pad->entity->info.name, pad->index); -			return ret; +			format.code = source->source.format.code; +			ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_ACTIVE); +			if (ret < 0) { +				printf("error: set format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			}  		} -		format.code = source->source.format.code; -		ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, -					     V4L2_SUBDEV_FORMAT_ACTIVE); -		if (ret < 0) { -			printf("error: set format failed on %s:%u.\n", -				pad->entity->info.name, pad->index); -			return ret; +		if (sink->type == OMAP3_ISP_ENTITY_ENTITY) { +			/* Propagate the format to the link target. */ +			pad = sink->sink.link->sink; + +			ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, +						     V4L2_SUBDEV_FORMAT_ACTIVE); +			if (ret < 0) { +				printf("error: set format failed on %s:%u.\n", +					pad->entity->info.name, pad->index); +				return ret; +			} + +			last = sink;  		} -		/* Propagate the format to the link target. */ -		pad = sink->sink.link->sink; +		source = sink; +	} + +	if (last != NULL) { +		pad = last->source.link->source; +		format = last->source.format;  		ret = v4l2_subdev_set_format(pad->entity, &format, pad->index,  					     V4L2_SUBDEV_FORMAT_ACTIVE); @@ -486,19 +514,6 @@ static int omap3_isp_pipeline_activate(struct omap3_isp_device *isp,  				pad->entity->info.name, pad->index);  			return ret;  		} - -		source = sink; -	} - -	pad = source->source.link->source; -	format = source->source.format; - -	ret = v4l2_subdev_set_format(pad->entity, &format, pad->index, -				     V4L2_SUBDEV_FORMAT_ACTIVE); -	if (ret < 0) { -		printf("error: set format failed on %s:%u.\n", -			pad->entity->info.name, pad->index); -		return ret;  	}  	return 0; | 
