aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r--drivers/media/platform/coda/coda-common.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index e8a7554a61d2..04e35d70ce2e 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -128,7 +128,8 @@ void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
128/* 128/*
129 * Arrays of codecs supported by each given version of Coda: 129 * Arrays of codecs supported by each given version of Coda:
130 * i.MX27 -> codadx6 130 * i.MX27 -> codadx6
131 * i.MX5x -> coda7 131 * i.MX51 -> codahx4
132 * i.MX53 -> coda7
132 * i.MX6 -> coda960 133 * i.MX6 -> coda960
133 * Use V4L2_PIX_FMT_YUV420 as placeholder for all supported YUV 4:2:0 variants 134 * Use V4L2_PIX_FMT_YUV420 as placeholder for all supported YUV 4:2:0 variants
134 */ 135 */
@@ -137,6 +138,13 @@ static const struct coda_codec codadx6_codecs[] = {
137 CODA_CODEC(CODADX6_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4, 720, 576), 138 CODA_CODEC(CODADX6_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4, 720, 576),
138}; 139};
139 140
141static const struct coda_codec codahx4_codecs[] = {
142 CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_H264, 720, 576),
143 CODA_CODEC(CODA7_MODE_DECODE_H264, V4L2_PIX_FMT_H264, V4L2_PIX_FMT_YUV420, 1920, 1088),
144 CODA_CODEC(CODA7_MODE_DECODE_MP2, V4L2_PIX_FMT_MPEG2, V4L2_PIX_FMT_YUV420, 1920, 1088),
145 CODA_CODEC(CODA7_MODE_DECODE_MP4, V4L2_PIX_FMT_MPEG4, V4L2_PIX_FMT_YUV420, 1280, 720),
146};
147
140static const struct coda_codec coda7_codecs[] = { 148static const struct coda_codec coda7_codecs[] = {
141 CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_H264, 1280, 720), 149 CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_H264, 1280, 720),
142 CODA_CODEC(CODA7_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4, 1280, 720), 150 CODA_CODEC(CODA7_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4, 1280, 720),
@@ -234,6 +242,11 @@ static const struct coda_video_device *codadx6_video_devices[] = {
234 &coda_bit_encoder, 242 &coda_bit_encoder,
235}; 243};
236 244
245static const struct coda_video_device *codahx4_video_devices[] = {
246 &coda_bit_encoder,
247 &coda_bit_decoder,
248};
249
237static const struct coda_video_device *coda7_video_devices[] = { 250static const struct coda_video_device *coda7_video_devices[] = {
238 &coda_bit_jpeg_encoder, 251 &coda_bit_jpeg_encoder,
239 &coda_bit_jpeg_decoder, 252 &coda_bit_jpeg_decoder,
@@ -332,6 +345,8 @@ const char *coda_product_name(int product)
332 switch (product) { 345 switch (product) {
333 case CODA_DX6: 346 case CODA_DX6:
334 return "CodaDx6"; 347 return "CodaDx6";
348 case CODA_HX4:
349 return "CodaHx4";
335 case CODA_7541: 350 case CODA_7541:
336 return "CODA7541"; 351 return "CODA7541";
337 case CODA_960: 352 case CODA_960:
@@ -1775,7 +1790,8 @@ static void coda_encode_ctrls(struct coda_ctx *ctx)
1775 V4L2_CID_MPEG_VIDEO_H264_PROFILE, 1790 V4L2_CID_MPEG_VIDEO_H264_PROFILE,
1776 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, 0x0, 1791 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, 0x0,
1777 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE); 1792 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE);
1778 if (ctx->dev->devtype->product == CODA_7541) { 1793 if (ctx->dev->devtype->product == CODA_HX4 ||
1794 ctx->dev->devtype->product == CODA_7541) {
1779 v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, 1795 v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops,
1780 V4L2_CID_MPEG_VIDEO_H264_LEVEL, 1796 V4L2_CID_MPEG_VIDEO_H264_LEVEL,
1781 V4L2_MPEG_VIDEO_H264_LEVEL_3_1, 1797 V4L2_MPEG_VIDEO_H264_LEVEL_3_1,
@@ -1803,7 +1819,8 @@ static void coda_encode_ctrls(struct coda_ctx *ctx)
1803 V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE, 1819 V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE,
1804 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, 0x0, 1820 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, 0x0,
1805 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE); 1821 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE);
1806 if (ctx->dev->devtype->product == CODA_7541 || 1822 if (ctx->dev->devtype->product == CODA_HX4 ||
1823 ctx->dev->devtype->product == CODA_7541 ||
1807 ctx->dev->devtype->product == CODA_960) { 1824 ctx->dev->devtype->product == CODA_960) {
1808 v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, 1825 v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops,
1809 V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, 1826 V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL,
@@ -2004,6 +2021,7 @@ static int coda_open(struct file *file)
2004 if (enable_bwb || ctx->inst_type == CODA_INST_ENCODER) 2021 if (enable_bwb || ctx->inst_type == CODA_INST_ENCODER)
2005 ctx->frame_mem_ctrl = CODA9_FRAME_ENABLE_BWB; 2022 ctx->frame_mem_ctrl = CODA9_FRAME_ENABLE_BWB;
2006 /* fallthrough */ 2023 /* fallthrough */
2024 case CODA_HX4:
2007 case CODA_7541: 2025 case CODA_7541:
2008 ctx->reg_idx = 0; 2026 ctx->reg_idx = 0;
2009 break; 2027 break;
@@ -2182,7 +2200,8 @@ static int coda_hw_init(struct coda_dev *dev)
2182 2200
2183 /* Tell the BIT where to find everything it needs */ 2201 /* Tell the BIT where to find everything it needs */
2184 if (dev->devtype->product == CODA_960 || 2202 if (dev->devtype->product == CODA_960 ||
2185 dev->devtype->product == CODA_7541) { 2203 dev->devtype->product == CODA_7541 ||
2204 dev->devtype->product == CODA_HX4) {
2186 coda_write(dev, dev->tempbuf.paddr, 2205 coda_write(dev, dev->tempbuf.paddr,
2187 CODA_REG_BIT_TEMP_BUF_ADDR); 2206 CODA_REG_BIT_TEMP_BUF_ADDR);
2188 coda_write(dev, 0, CODA_REG_BIT_BIT_STREAM_PARAM); 2207 coda_write(dev, 0, CODA_REG_BIT_BIT_STREAM_PARAM);
@@ -2387,6 +2406,7 @@ put_pm:
2387 2406
2388enum coda_platform { 2407enum coda_platform {
2389 CODA_IMX27, 2408 CODA_IMX27,
2409 CODA_IMX51,
2390 CODA_IMX53, 2410 CODA_IMX53,
2391 CODA_IMX6Q, 2411 CODA_IMX6Q,
2392 CODA_IMX6DL, 2412 CODA_IMX6DL,
@@ -2407,6 +2427,21 @@ static const struct coda_devtype coda_devdata[] = {
2407 .workbuf_size = 288 * 1024 + FMO_SLICE_SAVE_BUF_SIZE * 8 * 1024, 2427 .workbuf_size = 288 * 1024 + FMO_SLICE_SAVE_BUF_SIZE * 8 * 1024,
2408 .iram_size = 0xb000, 2428 .iram_size = 0xb000,
2409 }, 2429 },
2430 [CODA_IMX51] = {
2431 .firmware = {
2432 "vpu_fw_imx51.bin",
2433 "vpu/vpu_fw_imx51.bin",
2434 "v4l-codahx4-imx51.bin"
2435 },
2436 .product = CODA_HX4,
2437 .codecs = codahx4_codecs,
2438 .num_codecs = ARRAY_SIZE(codahx4_codecs),
2439 .vdevs = codahx4_video_devices,
2440 .num_vdevs = ARRAY_SIZE(codahx4_video_devices),
2441 .workbuf_size = 128 * 1024,
2442 .tempbuf_size = 304 * 1024,
2443 .iram_size = 0x14000,
2444 },
2410 [CODA_IMX53] = { 2445 [CODA_IMX53] = {
2411 .firmware = { 2446 .firmware = {
2412 "vpu_fw_imx53.bin", 2447 "vpu_fw_imx53.bin",
@@ -2463,6 +2498,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids);
2463#ifdef CONFIG_OF 2498#ifdef CONFIG_OF
2464static const struct of_device_id coda_dt_ids[] = { 2499static const struct of_device_id coda_dt_ids[] = {
2465 { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, 2500 { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] },
2501 { .compatible = "fsl,imx51-vpu", .data = &coda_devdata[CODA_IMX51] },
2466 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, 2502 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] },
2467 { .compatible = "fsl,imx6q-vpu", .data = &coda_devdata[CODA_IMX6Q] }, 2503 { .compatible = "fsl,imx6q-vpu", .data = &coda_devdata[CODA_IMX6Q] },
2468 { .compatible = "fsl,imx6dl-vpu", .data = &coda_devdata[CODA_IMX6DL] }, 2504 { .compatible = "fsl,imx6dl-vpu", .data = &coda_devdata[CODA_IMX6DL] },