aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-ioctl.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-12-12 11:44:14 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-05 12:15:20 -0500
commit582c52cb9cd2616ab0d41127b22ad56ee49d40b4 (patch)
treea307760a7c7e1b56a9327228558454b36bc60815 /drivers/media/v4l2-core/v4l2-ioctl.c
parent855df1dc6fdb519c7552053bc095f821bc360905 (diff)
[media] v4l: enable some IOCTLs for SDR receiver
Enable stream format (FMT) IOCTLs for SDR use. These are used for negotiate used data stream format. Reorganise some some IOCTL selection logic. Signed-off-by: Antti Palosaari <crope@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-ioctl.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 9a2acaf75426..95dd4f15ab6e 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -246,6 +246,7 @@ static void v4l_print_format(const void *arg, bool write_only)
246 const struct v4l2_vbi_format *vbi; 246 const struct v4l2_vbi_format *vbi;
247 const struct v4l2_sliced_vbi_format *sliced; 247 const struct v4l2_sliced_vbi_format *sliced;
248 const struct v4l2_window *win; 248 const struct v4l2_window *win;
249 const struct v4l2_format_sdr *sdr;
249 unsigned i; 250 unsigned i;
250 251
251 pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); 252 pr_cont("type=%s", prt_names(p->type, v4l2_type_names));
@@ -319,6 +320,14 @@ static void v4l_print_format(const void *arg, bool write_only)
319 sliced->service_lines[0][i], 320 sliced->service_lines[0][i],
320 sliced->service_lines[1][i]); 321 sliced->service_lines[1][i]);
321 break; 322 break;
323 case V4L2_BUF_TYPE_SDR_CAPTURE:
324 sdr = &p->fmt.sdr;
325 pr_cont(", pixelformat=%c%c%c%c\n",
326 (sdr->pixelformat >> 0) & 0xff,
327 (sdr->pixelformat >> 8) & 0xff,
328 (sdr->pixelformat >> 16) & 0xff,
329 (sdr->pixelformat >> 24) & 0xff);
330 break;
322 } 331 }
323} 332}
324 333
@@ -882,6 +891,7 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type)
882 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; 891 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
883 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; 892 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER;
884 bool is_vbi = vfd->vfl_type == VFL_TYPE_VBI; 893 bool is_vbi = vfd->vfl_type == VFL_TYPE_VBI;
894 bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR;
885 bool is_rx = vfd->vfl_dir != VFL_DIR_TX; 895 bool is_rx = vfd->vfl_dir != VFL_DIR_TX;
886 bool is_tx = vfd->vfl_dir != VFL_DIR_RX; 896 bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
887 897
@@ -931,6 +941,10 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type)
931 if (is_vbi && is_tx && ops->vidioc_g_fmt_sliced_vbi_out) 941 if (is_vbi && is_tx && ops->vidioc_g_fmt_sliced_vbi_out)
932 return 0; 942 return 0;
933 break; 943 break;
944 case V4L2_BUF_TYPE_SDR_CAPTURE:
945 if (is_sdr && is_rx && ops->vidioc_g_fmt_sdr_cap)
946 return 0;
947 break;
934 default: 948 default:
935 break; 949 break;
936 } 950 }
@@ -1050,6 +1064,10 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
1050 if (unlikely(!is_tx || !ops->vidioc_enum_fmt_vid_out_mplane)) 1064 if (unlikely(!is_tx || !ops->vidioc_enum_fmt_vid_out_mplane))
1051 break; 1065 break;
1052 return ops->vidioc_enum_fmt_vid_out_mplane(file, fh, arg); 1066 return ops->vidioc_enum_fmt_vid_out_mplane(file, fh, arg);
1067 case V4L2_BUF_TYPE_SDR_CAPTURE:
1068 if (unlikely(!is_rx || !ops->vidioc_enum_fmt_sdr_cap))
1069 break;
1070 return ops->vidioc_enum_fmt_sdr_cap(file, fh, arg);
1053 } 1071 }
1054 return -EINVAL; 1072 return -EINVAL;
1055} 1073}
@@ -1060,6 +1078,7 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,
1060 struct v4l2_format *p = arg; 1078 struct v4l2_format *p = arg;
1061 struct video_device *vfd = video_devdata(file); 1079 struct video_device *vfd = video_devdata(file);
1062 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; 1080 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER;
1081 bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR;
1063 bool is_rx = vfd->vfl_dir != VFL_DIR_TX; 1082 bool is_rx = vfd->vfl_dir != VFL_DIR_TX;
1064 bool is_tx = vfd->vfl_dir != VFL_DIR_RX; 1083 bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
1065 1084
@@ -1104,6 +1123,10 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,
1104 if (unlikely(!is_tx || is_vid || !ops->vidioc_g_fmt_sliced_vbi_out)) 1123 if (unlikely(!is_tx || is_vid || !ops->vidioc_g_fmt_sliced_vbi_out))
1105 break; 1124 break;
1106 return ops->vidioc_g_fmt_sliced_vbi_out(file, fh, arg); 1125 return ops->vidioc_g_fmt_sliced_vbi_out(file, fh, arg);
1126 case V4L2_BUF_TYPE_SDR_CAPTURE:
1127 if (unlikely(!is_rx || !is_sdr || !ops->vidioc_g_fmt_sdr_cap))
1128 break;
1129 return ops->vidioc_g_fmt_sdr_cap(file, fh, arg);
1107 } 1130 }
1108 return -EINVAL; 1131 return -EINVAL;
1109} 1132}
@@ -1114,6 +1137,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
1114 struct v4l2_format *p = arg; 1137 struct v4l2_format *p = arg;
1115 struct video_device *vfd = video_devdata(file); 1138 struct video_device *vfd = video_devdata(file);
1116 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; 1139 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER;
1140 bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR;
1117 bool is_rx = vfd->vfl_dir != VFL_DIR_TX; 1141 bool is_rx = vfd->vfl_dir != VFL_DIR_TX;
1118 bool is_tx = vfd->vfl_dir != VFL_DIR_RX; 1142 bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
1119 1143
@@ -1168,6 +1192,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
1168 break; 1192 break;
1169 CLEAR_AFTER_FIELD(p, fmt.sliced); 1193 CLEAR_AFTER_FIELD(p, fmt.sliced);
1170 return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg); 1194 return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg);
1195 case V4L2_BUF_TYPE_SDR_CAPTURE:
1196 if (unlikely(!is_rx || !is_sdr || !ops->vidioc_s_fmt_sdr_cap))
1197 break;
1198 CLEAR_AFTER_FIELD(p, fmt.sdr);
1199 return ops->vidioc_s_fmt_sdr_cap(file, fh, arg);
1171 } 1200 }
1172 return -EINVAL; 1201 return -EINVAL;
1173} 1202}
@@ -1178,6 +1207,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
1178 struct v4l2_format *p = arg; 1207 struct v4l2_format *p = arg;
1179 struct video_device *vfd = video_devdata(file); 1208 struct video_device *vfd = video_devdata(file);
1180 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; 1209 bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER;
1210 bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR;
1181 bool is_rx = vfd->vfl_dir != VFL_DIR_TX; 1211 bool is_rx = vfd->vfl_dir != VFL_DIR_TX;
1182 bool is_tx = vfd->vfl_dir != VFL_DIR_RX; 1212 bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
1183 1213
@@ -1232,6 +1262,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
1232 break; 1262 break;
1233 CLEAR_AFTER_FIELD(p, fmt.sliced); 1263 CLEAR_AFTER_FIELD(p, fmt.sliced);
1234 return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg); 1264 return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg);
1265 case V4L2_BUF_TYPE_SDR_CAPTURE:
1266 if (unlikely(!is_rx || !is_sdr || !ops->vidioc_try_fmt_sdr_cap))
1267 break;
1268 CLEAR_AFTER_FIELD(p, fmt.sdr);
1269 return ops->vidioc_try_fmt_sdr_cap(file, fh, arg);
1235 } 1270 }
1236 return -EINVAL; 1271 return -EINVAL;
1237} 1272}