| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * av7110_av.c: audio and video MPEG decoder stuff |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * originally based on code by: |
|---|
| 8 | 9 | * 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 | | - * |
|---|
| 24 | 10 | * |
|---|
| 25 | 11 | * the project's page is at https://linuxtv.org |
|---|
| 26 | 12 | */ |
|---|
| .. | .. |
|---|
| 932 | 918 | return 0; |
|---|
| 933 | 919 | } |
|---|
| 934 | 920 | |
|---|
| 935 | | - |
|---|
| 936 | 921 | /****************************************************************************** |
|---|
| 937 | 922 | * DVB device file operations |
|---|
| 938 | 923 | ******************************************************************************/ |
|---|
| .. | .. |
|---|
| 1095 | 1080 | return 0; |
|---|
| 1096 | 1081 | } |
|---|
| 1097 | 1082 | |
|---|
| 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 |
|---|
| 1098 | 1119 | |
|---|
| 1099 | 1120 | static int dvb_video_ioctl(struct file *file, |
|---|
| 1100 | 1121 | unsigned int cmd, void *parg) |
|---|
| .. | .. |
|---|
| 1184 | 1205 | memcpy(parg, &av7110->videostate, sizeof(struct video_status)); |
|---|
| 1185 | 1206 | break; |
|---|
| 1186 | 1207 | |
|---|
| 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 | + |
|---|
| 1187 | 1214 | case VIDEO_GET_EVENT: |
|---|
| 1188 | 1215 | ret = dvb_video_get_event(av7110, parg, file->f_flags); |
|---|
| 1189 | 1216 | break; |
|---|
| .. | .. |
|---|
| 1225 | 1252 | ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetMonitorType, |
|---|
| 1226 | 1253 | 1, (u16) arg); |
|---|
| 1227 | 1254 | 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 |
|---|
| 1228 | 1268 | |
|---|
| 1229 | 1269 | case VIDEO_STILLPICTURE: |
|---|
| 1230 | 1270 | { |
|---|
| .. | .. |
|---|
| 1533 | 1573 | .owner = THIS_MODULE, |
|---|
| 1534 | 1574 | .write = dvb_video_write, |
|---|
| 1535 | 1575 | .unlocked_ioctl = dvb_generic_ioctl, |
|---|
| 1576 | + .compat_ioctl = dvb_generic_ioctl, |
|---|
| 1536 | 1577 | .open = dvb_video_open, |
|---|
| 1537 | 1578 | .release = dvb_video_release, |
|---|
| 1538 | 1579 | .poll = dvb_video_poll, |
|---|
| .. | .. |
|---|
| 1552 | 1593 | .owner = THIS_MODULE, |
|---|
| 1553 | 1594 | .write = dvb_audio_write, |
|---|
| 1554 | 1595 | .unlocked_ioctl = dvb_generic_ioctl, |
|---|
| 1596 | + .compat_ioctl = dvb_generic_ioctl, |
|---|
| 1555 | 1597 | .open = dvb_audio_open, |
|---|
| 1556 | 1598 | .release = dvb_audio_release, |
|---|
| 1557 | 1599 | .poll = dvb_audio_poll, |
|---|