aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 20:16:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 20:16:59 -0400
commitef1c4a6fa91bbbe9b09f770d28eba31a9edf770c (patch)
tree52f5d175031c553160d14890e876ffc5432d2467 /drivers/media/platform/coda/coda-common.c
parent147a89bc71e7db40f011454a40add7ff2d10f8d8 (diff)
parentf8a695c4b43d02c89b8bba9ba6058fd5db1bc71d (diff)
Merge tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - new CEC pin injection code for testing purposes - DVB frontend cxd2099 promoted from staging - new platform driver for Sony cxd2880 DVB devices - new sensor drivers: mt9t112, ov2685, ov5695, ov772x, tda1997x, tw9910.c - removal of unused cx18 and ivtv alsa mixers - the reneseas-ceu driver doesn't depend on soc_camera anymore and moved from staging - removed the mantis_vp3028 driver, unused since 2009 - s5p-mfc: add support for version 10 of the MSP - added a decoder for imon protocol - atomisp: lots of cleanups - imx074 and mt9t031: don't depend on soc_camera anymore, being promoted from staging - added helper functions to better support DVB I2C binding - lots of driver improvements and cleanups * tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (438 commits) media: v4l2-ioctl: rename a temp var that stores _IOC_SIZE(cmd) media: fimc-capture: get rid of two warnings media: dvb-usb-v2: fix a missing dependency of I2C_MUX media: uvc: to the right check at uvc_ioctl_enum_framesizes() media: cec-core: fix a bug at cec_error_inj_write() media: tda9840: cleanup a warning media: tm6000: avoid casting just to print pointer address media: em28xx-input: improve error handling code media: zr364xx: avoid casting just to print pointer address media: vivid-radio-rx: add a cast to avoid a warning media: saa7134-alsa: don't use casts to print a buffer address media: solo6x10: get rid of an address space warning media: zoran: don't cast pointers to print them media: ir-kbd-i2c: change the if logic to avoid a warning media: ir-kbd-i2c: improve error handling code media: saa7134-input: improve error handling media: s2255drv: fix a casting warning media: ivtvfb: Cleanup some warnings media: videobuf-dma-sg: Fix a weird cast soc_camera: fix a weird cast on printk ...
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] },