hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/s5p-mfc/s5p_mfc.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Samsung S5P Multi Format Codec v 5.1
34 *
45 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
56 * 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.
117 */
128
139 #include <linux/clk.h>
....@@ -1093,6 +1089,17 @@
10931089 child->coherent_dma_mask = dev->coherent_dma_mask;
10941090 child->dma_mask = dev->dma_mask;
10951091 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);
10961103
10971104 if (device_add(child) == 0) {
10981105 ret = of_reserved_mem_device_init_by_idx(child, dev->of_node,
....@@ -1101,7 +1108,7 @@
11011108 return child;
11021109 device_del(child);
11031110 }
1104
-
1111
+err:
11051112 put_device(child);
11061113 return NULL;
11071114 }
....@@ -1346,6 +1353,8 @@
13461353 vfd->lock = &dev->mfc_mutex;
13471354 vfd->v4l2_dev = &dev->v4l2_dev;
13481355 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);
13491358 snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME);
13501359 dev->vfd_dec = vfd;
13511360 video_set_drvdata(vfd, dev);
....@@ -1363,6 +1372,7 @@
13631372 vfd->lock = &dev->mfc_mutex;
13641373 vfd->v4l2_dev = &dev->v4l2_dev;
13651374 vfd->vfl_dir = VFL_DIR_M2M;
1375
+ vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
13661376 snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME);
13671377 dev->vfd_enc = vfd;
13681378 video_set_drvdata(vfd, dev);
....@@ -1374,7 +1384,7 @@
13741384 s5p_mfc_init_regs(dev);
13751385
13761386 /* 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);
13781388 if (ret) {
13791389 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
13801390 goto err_dec_reg;
....@@ -1382,7 +1392,7 @@
13821392 v4l2_info(&dev->v4l2_dev,
13831393 "decoder registered as /dev/video%d\n", dev->vfd_dec->num);
13841394
1385
- ret = video_register_device(dev->vfd_enc, VFL_TYPE_GRABBER, 0);
1395
+ ret = video_register_device(dev->vfd_enc, VFL_TYPE_VIDEO, 0);
13861396 if (ret) {
13871397 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
13881398 goto err_enc_reg;