forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/ttpci/av7110_av.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * av7110_av.c: audio and video MPEG decoder stuff
34 *
....@@ -6,21 +7,6 @@
67 *
78 * originally based on code by:
89 * Copyright (C) 1998,1999 Christian Theiss <mistert@rz.fh-augsburg.de>
9
- *
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public License
12
- * as published by the Free Software Foundation; either version 2
13
- * of the License, or (at your option) any later version.
14
- *
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * To obtain the license, point your browser to
22
- * http://www.gnu.org/copyleft/gpl.html
23
- *
2410 *
2511 * the project's page is at https://linuxtv.org
2612 */
....@@ -932,7 +918,6 @@
932918 return 0;
933919 }
934920
935
-
936921 /******************************************************************************
937922 * DVB device file operations
938923 ******************************************************************************/
....@@ -1095,6 +1080,42 @@
10951080 return 0;
10961081 }
10971082
1083
+#ifdef CONFIG_COMPAT
1084
+struct compat_video_still_picture {
1085
+ compat_uptr_t iFrame;
1086
+ int32_t size;
1087
+};
1088
+#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture)
1089
+
1090
+struct compat_video_event {
1091
+ __s32 type;
1092
+ /* unused, make sure to use atomic time for y2038 if it ever gets used */
1093
+ compat_long_t timestamp;
1094
+ union {
1095
+ video_size_t size;
1096
+ unsigned int frame_rate; /* in frames per 1000sec */
1097
+ unsigned char vsync_field; /* unknown/odd/even/progressive */
1098
+ } u;
1099
+};
1100
+#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event)
1101
+
1102
+static int dvb_compat_video_get_event(struct av7110 *av7110,
1103
+ struct compat_video_event *event, int flags)
1104
+{
1105
+ struct video_event ev;
1106
+ int ret;
1107
+
1108
+ ret = dvb_video_get_event(av7110, &ev, flags);
1109
+
1110
+ *event = (struct compat_video_event) {
1111
+ .type = ev.type,
1112
+ .timestamp = ev.timestamp,
1113
+ .u.size = ev.u.size,
1114
+ };
1115
+
1116
+ return ret;
1117
+}
1118
+#endif
10981119
10991120 static int dvb_video_ioctl(struct file *file,
11001121 unsigned int cmd, void *parg)
....@@ -1184,6 +1205,12 @@
11841205 memcpy(parg, &av7110->videostate, sizeof(struct video_status));
11851206 break;
11861207
1208
+#ifdef CONFIG_COMPAT
1209
+ case VIDEO_GET_EVENT32:
1210
+ ret = dvb_compat_video_get_event(av7110, parg, file->f_flags);
1211
+ break;
1212
+#endif
1213
+
11871214 case VIDEO_GET_EVENT:
11881215 ret = dvb_video_get_event(av7110, parg, file->f_flags);
11891216 break;
....@@ -1225,6 +1252,19 @@
12251252 ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetMonitorType,
12261253 1, (u16) arg);
12271254 break;
1255
+
1256
+#ifdef CONFIG_COMPAT
1257
+ case VIDEO_STILLPICTURE32:
1258
+ {
1259
+ struct compat_video_still_picture *pic =
1260
+ (struct compat_video_still_picture *) parg;
1261
+ av7110->videostate.stream_source = VIDEO_SOURCE_MEMORY;
1262
+ dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
1263
+ ret = play_iframe(av7110, compat_ptr(pic->iFrame),
1264
+ pic->size, file->f_flags & O_NONBLOCK);
1265
+ break;
1266
+ }
1267
+#endif
12281268
12291269 case VIDEO_STILLPICTURE:
12301270 {
....@@ -1533,6 +1573,7 @@
15331573 .owner = THIS_MODULE,
15341574 .write = dvb_video_write,
15351575 .unlocked_ioctl = dvb_generic_ioctl,
1576
+ .compat_ioctl = dvb_generic_ioctl,
15361577 .open = dvb_video_open,
15371578 .release = dvb_video_release,
15381579 .poll = dvb_video_poll,
....@@ -1552,6 +1593,7 @@
15521593 .owner = THIS_MODULE,
15531594 .write = dvb_audio_write,
15541595 .unlocked_ioctl = dvb_generic_ioctl,
1596
+ .compat_ioctl = dvb_generic_ioctl,
15551597 .open = dvb_audio_open,
15561598 .release = dvb_audio_release,
15571599 .poll = dvb_audio_poll,