Lines Matching +full:multi +full:- +full:ported

1 // SPDX-License-Identifier: GPL-2.0-or-later
29 * 2.4 PROCFS support ported from 2.4 kernels by
32 * 2.4 devfs support ported from 2.4 kernels by
46 #include <media/v4l2-common.h>
47 #include <media/v4l2-device.h>
48 #include <media/v4l2-ctrls.h>
73 v4l2_ctrl_fill(qctrl->id, &name, &qctrl->type, in v4l2_ctrl_query_fill()
74 &min, &max, &step, &def, &qctrl->flags); in v4l2_ctrl_query_fill()
77 return -EINVAL; in v4l2_ctrl_query_fill()
79 qctrl->minimum = min; in v4l2_ctrl_query_fill()
80 qctrl->maximum = max; in v4l2_ctrl_query_fill()
81 qctrl->step = step; in v4l2_ctrl_query_fill()
82 qctrl->default_value = def; in v4l2_ctrl_query_fill()
83 qctrl->reserved[0] = qctrl->reserved[1] = 0; in v4l2_ctrl_query_fill()
84 strscpy(qctrl->name, name, sizeof(qctrl->name)); in v4l2_ctrl_query_fill()
97 unsigned int mask = ~((1 << align) - 1); in clamp_align()
104 x = (x + (1 << (align - 1))) & mask; in clamp_align()
137 unsigned int wmaxa = __fls(wmax ^ (wmin - 1)); in v4l_bound_align_image()
139 unsigned int hmaxa = __fls(hmax ^ (hmin - 1)); in v4l_bound_align_image()
172 error = abs(*entry_width - width) + abs(*entry_height - height); in __v4l2_find_nearest_size()
192 if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && in v4l2_g_parm_cap()
193 a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) in v4l2_g_parm_cap()
194 return -EINVAL; in v4l2_g_parm_cap()
196 if (vdev->device_caps & V4L2_CAP_READWRITE) in v4l2_g_parm_cap()
197 a->parm.capture.readbuffers = 2; in v4l2_g_parm_cap()
199 a->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; in v4l2_g_parm_cap()
202 a->parm.capture.timeperframe = ival.interval; in v4l2_g_parm_cap()
211 .interval = a->parm.capture.timeperframe in v4l2_s_parm_cap()
215 if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && in v4l2_s_parm_cap()
216 a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) in v4l2_s_parm_cap()
217 return -EINVAL; in v4l2_s_parm_cap()
219 memset(&a->parm, 0, sizeof(a->parm)); in v4l2_s_parm_cap()
220 if (vdev->device_caps & V4L2_CAP_READWRITE) in v4l2_s_parm_cap()
221 a->parm.capture.readbuffers = 2; in v4l2_s_parm_cap()
223 a->parm.capture.readbuffers = 0; in v4l2_s_parm_cap()
226 a->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; in v4l2_s_parm_cap()
229 a->parm.capture.timeperframe = ival.interval; in v4l2_s_parm_cap()
348 if (!info->block_w[plane]) in v4l2_format_block_width()
350 return info->block_w[plane]; in v4l2_format_block_width()
355 if (!info->block_h[plane]) in v4l2_format_block_height()
357 return info->block_h[plane]; in v4l2_format_block_height()
370 *width = clamp_roundup(*width, frmsize->min_width, frmsize->max_width, in v4l2_apply_frmsize_constraints()
371 frmsize->step_width); in v4l2_apply_frmsize_constraints()
372 *height = clamp_roundup(*height, frmsize->min_height, frmsize->max_height, in v4l2_apply_frmsize_constraints()
373 frmsize->step_height); in v4l2_apply_frmsize_constraints()
386 return -EINVAL; in v4l2_fill_pixfmt_mp()
388 pixfmt->width = width; in v4l2_fill_pixfmt_mp()
389 pixfmt->height = height; in v4l2_fill_pixfmt_mp()
390 pixfmt->pixelformat = pixelformat; in v4l2_fill_pixfmt_mp()
391 pixfmt->num_planes = info->mem_planes; in v4l2_fill_pixfmt_mp()
393 if (info->mem_planes == 1) { in v4l2_fill_pixfmt_mp()
394 plane = &pixfmt->plane_fmt[0]; in v4l2_fill_pixfmt_mp()
395 …plane->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_di… in v4l2_fill_pixfmt_mp()
396 plane->sizeimage = 0; in v4l2_fill_pixfmt_mp()
398 for (i = 0; i < info->comp_planes; i++) { in v4l2_fill_pixfmt_mp()
399 unsigned int hdiv = (i == 0) ? 1 : info->hdiv; in v4l2_fill_pixfmt_mp()
400 unsigned int vdiv = (i == 0) ? 1 : info->vdiv; in v4l2_fill_pixfmt_mp()
407 plane->sizeimage += info->bpp[i] * in v4l2_fill_pixfmt_mp()
409 DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i]; in v4l2_fill_pixfmt_mp()
412 for (i = 0; i < info->comp_planes; i++) { in v4l2_fill_pixfmt_mp()
413 unsigned int hdiv = (i == 0) ? 1 : info->hdiv; in v4l2_fill_pixfmt_mp()
414 unsigned int vdiv = (i == 0) ? 1 : info->vdiv; in v4l2_fill_pixfmt_mp()
421 plane = &pixfmt->plane_fmt[i]; in v4l2_fill_pixfmt_mp()
422 plane->bytesperline = in v4l2_fill_pixfmt_mp()
423 info->bpp[i] * DIV_ROUND_UP(aligned_width, hdiv) / info->bpp_div[i]; in v4l2_fill_pixfmt_mp()
424 plane->sizeimage = in v4l2_fill_pixfmt_mp()
425 plane->bytesperline * DIV_ROUND_UP(aligned_height, vdiv); in v4l2_fill_pixfmt_mp()
440 return -EINVAL; in v4l2_fill_pixfmt()
442 /* Single planar API cannot be used for multi plane formats. */ in v4l2_fill_pixfmt()
443 if (info->mem_planes > 1) in v4l2_fill_pixfmt()
444 return -EINVAL; in v4l2_fill_pixfmt()
446 pixfmt->width = width; in v4l2_fill_pixfmt()
447 pixfmt->height = height; in v4l2_fill_pixfmt()
448 pixfmt->pixelformat = pixelformat; in v4l2_fill_pixfmt()
449 …pixfmt->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_d… in v4l2_fill_pixfmt()
450 pixfmt->sizeimage = 0; in v4l2_fill_pixfmt()
452 for (i = 0; i < info->comp_planes; i++) { in v4l2_fill_pixfmt()
453 unsigned int hdiv = (i == 0) ? 1 : info->hdiv; in v4l2_fill_pixfmt()
454 unsigned int vdiv = (i == 0) ? 1 : info->vdiv; in v4l2_fill_pixfmt()
461 pixfmt->sizeimage += info->bpp[i] * in v4l2_fill_pixfmt()
463 DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i]; in v4l2_fill_pixfmt()
484 return -ENOENT; in v4l2_get_link_freq()
489 return -ENOENT; in v4l2_get_link_freq()
493 return -ENOENT; in v4l2_get_link_freq()
503 return freq > 0 ? freq : -EINVAL; in v4l2_get_link_freq()
511 * arbitrary parameters to remove non-significative terms from the simple
543 r = x - an[n] * y; in v4l2_simplify_fraction()
552 for (i = n; i > 0; --i) { in v4l2_simplify_fraction()
554 y = an[i-1] * y + x; in v4l2_simplify_fraction()
575 numerator/denominator >= ((u32)-1)/10000000) in v4l2_fraction_to_interval()
576 return (u32)-1; in v4l2_fraction_to_interval()
584 while (numerator > ((u32)-1)/multiplier) { in v4l2_fraction_to_interval()
605 return -ENODATA; in v4l2_link_freq_to_bitmap()
633 return -ENOENT; in v4l2_link_freq_to_bitmap()