.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Samsung S5P Multi Format Codec v 5.1 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
---|
5 | 6 | * Kamil Debski, <k.debski@samsung.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License as published by |
---|
9 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
10 | | - * (at your option) any later version. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #include <linux/clk.h> |
---|
.. | .. |
---|
1093 | 1089 | child->coherent_dma_mask = dev->coherent_dma_mask; |
---|
1094 | 1090 | child->dma_mask = dev->dma_mask; |
---|
1095 | 1091 | child->release = s5p_mfc_memdev_release; |
---|
| 1092 | + child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms), |
---|
| 1093 | + GFP_KERNEL); |
---|
| 1094 | + if (!child->dma_parms) |
---|
| 1095 | + goto err; |
---|
| 1096 | + |
---|
| 1097 | + /* |
---|
| 1098 | + * The memdevs are not proper OF platform devices, so in order for them |
---|
| 1099 | + * to be treated as valid DMA masters we need a bit of a hack to force |
---|
| 1100 | + * them to inherit the MFC node's DMA configuration. |
---|
| 1101 | + */ |
---|
| 1102 | + of_dma_configure(child, dev->of_node, true); |
---|
1096 | 1103 | |
---|
1097 | 1104 | if (device_add(child) == 0) { |
---|
1098 | 1105 | ret = of_reserved_mem_device_init_by_idx(child, dev->of_node, |
---|
.. | .. |
---|
1101 | 1108 | return child; |
---|
1102 | 1109 | device_del(child); |
---|
1103 | 1110 | } |
---|
1104 | | - |
---|
| 1111 | +err: |
---|
1105 | 1112 | put_device(child); |
---|
1106 | 1113 | return NULL; |
---|
1107 | 1114 | } |
---|
.. | .. |
---|
1346 | 1353 | vfd->lock = &dev->mfc_mutex; |
---|
1347 | 1354 | vfd->v4l2_dev = &dev->v4l2_dev; |
---|
1348 | 1355 | vfd->vfl_dir = VFL_DIR_M2M; |
---|
| 1356 | + vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
---|
| 1357 | + set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags); |
---|
1349 | 1358 | snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME); |
---|
1350 | 1359 | dev->vfd_dec = vfd; |
---|
1351 | 1360 | video_set_drvdata(vfd, dev); |
---|
.. | .. |
---|
1363 | 1372 | vfd->lock = &dev->mfc_mutex; |
---|
1364 | 1373 | vfd->v4l2_dev = &dev->v4l2_dev; |
---|
1365 | 1374 | vfd->vfl_dir = VFL_DIR_M2M; |
---|
| 1375 | + vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
---|
1366 | 1376 | snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME); |
---|
1367 | 1377 | dev->vfd_enc = vfd; |
---|
1368 | 1378 | video_set_drvdata(vfd, dev); |
---|
.. | .. |
---|
1374 | 1384 | s5p_mfc_init_regs(dev); |
---|
1375 | 1385 | |
---|
1376 | 1386 | /* Register decoder and encoder */ |
---|
1377 | | - ret = video_register_device(dev->vfd_dec, VFL_TYPE_GRABBER, 0); |
---|
| 1387 | + ret = video_register_device(dev->vfd_dec, VFL_TYPE_VIDEO, 0); |
---|
1378 | 1388 | if (ret) { |
---|
1379 | 1389 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
---|
1380 | 1390 | goto err_dec_reg; |
---|
.. | .. |
---|
1382 | 1392 | v4l2_info(&dev->v4l2_dev, |
---|
1383 | 1393 | "decoder registered as /dev/video%d\n", dev->vfd_dec->num); |
---|
1384 | 1394 | |
---|
1385 | | - ret = video_register_device(dev->vfd_enc, VFL_TYPE_GRABBER, 0); |
---|
| 1395 | + ret = video_register_device(dev->vfd_enc, VFL_TYPE_VIDEO, 0); |
---|
1386 | 1396 | if (ret) { |
---|
1387 | 1397 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
---|
1388 | 1398 | goto err_enc_reg; |
---|