diff options
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
| -rw-r--r-- | drivers/media/platform/coda/coda-common.c | 45 | 
1 files changed, 39 insertions, 6 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 94fb4d2ecc43..acff10ad257a 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -155,6 +155,7 @@ static const struct coda_codec coda7_codecs[] = {  static const struct coda_codec coda9_codecs[] = {  	CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_H264,   1920, 1088),  	CODA_CODEC(CODA9_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4,  1920, 1088), +	CODA_CODEC(CODA9_MODE_ENCODE_MJPG, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_JPEG,   8192, 8192),  	CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   V4L2_PIX_FMT_YUV420, 1920, 1088),  	CODA_CODEC(CODA9_MODE_DECODE_MP2,  V4L2_PIX_FMT_MPEG2,  V4L2_PIX_FMT_YUV420, 1920, 1088),  	CODA_CODEC(CODA9_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  V4L2_PIX_FMT_YUV420, 1920, 1088), @@ -235,6 +236,22 @@ static const struct coda_video_device coda_bit_jpeg_decoder = {  	},  }; +static const struct coda_video_device coda9_jpeg_encoder = { +	.name = "coda-jpeg-encoder", +	.type = CODA_INST_ENCODER, +	.ops = &coda9_jpeg_encode_ops, +	.direct = true, +	.src_formats = { +		V4L2_PIX_FMT_NV12, +		V4L2_PIX_FMT_YUV420, +		V4L2_PIX_FMT_YVU420, +		V4L2_PIX_FMT_YUV422P, +	}, +	.dst_formats = { +		V4L2_PIX_FMT_JPEG, +	}, +}; +  static const struct coda_video_device *codadx6_video_devices[] = {  	&coda_bit_encoder,  }; @@ -252,6 +269,7 @@ static const struct coda_video_device *coda7_video_devices[] = {  };  static const struct coda_video_device *coda9_video_devices[] = { +	&coda9_jpeg_encoder,  	&coda_bit_encoder,  	&coda_bit_decoder,  }; @@ -721,7 +739,8 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f,  		ctx->tiled_map_type = GDI_TILED_FRAME_MB_RASTER_MAP;  		break;  	case V4L2_PIX_FMT_NV12: -		if (!disable_tiling && ctx->dev->devtype->product == CODA_960) { +		if (!disable_tiling && ctx->use_bit && +		    ctx->dev->devtype->product == CODA_960) {  			ctx->tiled_map_type = GDI_TILED_FRAME_MB_RASTER_MAP;  			break;  		} @@ -1421,7 +1440,7 @@ static void coda_pic_run_work(struct work_struct *work)  		if (ctx->ops->run_timeout)  			ctx->ops->run_timeout(ctx); -	} else if (!ctx->aborting) { +	} else {  		ctx->ops->finish_run(ctx);  	} @@ -1787,7 +1806,7 @@ static void coda_buf_queue(struct vb2_buffer *vb)  				coda_queue_source_change_event(ctx);  		}  	} else { -		if (ctx->inst_type == CODA_INST_ENCODER && +		if ((ctx->inst_type == CODA_INST_ENCODER || !ctx->use_bit) &&  		    vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)  			vbuf->sequence = ctx->qsequence++;  		v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); @@ -2984,10 +3003,8 @@ static int coda_probe(struct platform_device *pdev)  	irq = platform_get_irq_byname(pdev, "bit");  	if (irq < 0)  		irq = platform_get_irq(pdev, 0); -	if (irq < 0) { -		dev_err(&pdev->dev, "failed to get irq resource\n"); +	if (irq < 0)  		return irq; -	}  	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,  			       dev_name(&pdev->dev), dev); @@ -2996,6 +3013,22 @@ static int coda_probe(struct platform_device *pdev)  		return ret;  	} +	/* JPEG IRQ */ +	if (dev->devtype->product == CODA_960) { +		irq = platform_get_irq_byname(pdev, "jpeg"); +		if (irq < 0) +			return irq; + +		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, +						coda9_jpeg_irq_handler, +						IRQF_ONESHOT, CODA_NAME " jpeg", +						dev); +		if (ret < 0) { +			dev_err(&pdev->dev, "failed to request jpeg irq\n"); +			return ret; +		} +	} +  	dev->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev,  							      NULL);  	if (IS_ERR(dev->rstc)) {  |