diff options
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-ioctl.c')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ioctl.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 8a018c6dd16a..170dd68d27f4 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <media/v4l2-event.h> | 27 | #include <media/v4l2-event.h> |
28 | #include <media/v4l2-device.h> | 28 | #include <media/v4l2-device.h> |
29 | #include <media/videobuf2-v4l2.h> | 29 | #include <media/videobuf2-v4l2.h> |
30 | #include <media/v4l2-mc.h> | ||
30 | 31 | ||
31 | #include <trace/events/v4l2.h> | 32 | #include <trace/events/v4l2.h> |
32 | 33 | ||
@@ -1041,6 +1042,12 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops, | |||
1041 | static int v4l_s_input(const struct v4l2_ioctl_ops *ops, | 1042 | static int v4l_s_input(const struct v4l2_ioctl_ops *ops, |
1042 | struct file *file, void *fh, void *arg) | 1043 | struct file *file, void *fh, void *arg) |
1043 | { | 1044 | { |
1045 | struct video_device *vfd = video_devdata(file); | ||
1046 | int ret; | ||
1047 | |||
1048 | ret = v4l_enable_media_source(vfd); | ||
1049 | if (ret) | ||
1050 | return ret; | ||
1044 | return ops->vidioc_s_input(file, fh, *(unsigned int *)arg); | 1051 | return ops->vidioc_s_input(file, fh, *(unsigned int *)arg); |
1045 | } | 1052 | } |
1046 | 1053 | ||
@@ -1165,7 +1172,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) | |||
1165 | case V4L2_PIX_FMT_YVYU: descr = "YVYU 4:2:2"; break; | 1172 | case V4L2_PIX_FMT_YVYU: descr = "YVYU 4:2:2"; break; |
1166 | case V4L2_PIX_FMT_UYVY: descr = "UYVY 4:2:2"; break; | 1173 | case V4L2_PIX_FMT_UYVY: descr = "UYVY 4:2:2"; break; |
1167 | case V4L2_PIX_FMT_VYUY: descr = "VYUY 4:2:2"; break; | 1174 | case V4L2_PIX_FMT_VYUY: descr = "VYUY 4:2:2"; break; |
1168 | case V4L2_PIX_FMT_YUV422P: descr = "Planar YVU 4:2:2"; break; | 1175 | case V4L2_PIX_FMT_YUV422P: descr = "Planar YUV 4:2:2"; break; |
1169 | case V4L2_PIX_FMT_YUV411P: descr = "Planar YUV 4:1:1"; break; | 1176 | case V4L2_PIX_FMT_YUV411P: descr = "Planar YUV 4:1:1"; break; |
1170 | case V4L2_PIX_FMT_Y41P: descr = "YUV 4:1:1 (Packed)"; break; | 1177 | case V4L2_PIX_FMT_Y41P: descr = "YUV 4:1:1 (Packed)"; break; |
1171 | case V4L2_PIX_FMT_YUV444: descr = "16-bit A/XYUV 4-4-4-4"; break; | 1178 | case V4L2_PIX_FMT_YUV444: descr = "16-bit A/XYUV 4-4-4-4"; break; |
@@ -1191,6 +1198,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) | |||
1191 | case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/CbCr 4:2:0 (16x16 MB, N-C)"; break; | 1198 | case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/CbCr 4:2:0 (16x16 MB, N-C)"; break; |
1192 | case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; | 1199 | case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; |
1193 | case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; | 1200 | case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; |
1201 | case V4L2_PIX_FMT_YUV422M: descr = "Planar YUV 4:2:2 (N-C)"; break; | ||
1202 | case V4L2_PIX_FMT_YVU422M: descr = "Planar YVU 4:2:2 (N-C)"; break; | ||
1203 | case V4L2_PIX_FMT_YUV444M: descr = "Planar YUV 4:4:4 (N-C)"; break; | ||
1204 | case V4L2_PIX_FMT_YVU444M: descr = "Planar YVU 4:4:4 (N-C)"; break; | ||
1194 | case V4L2_PIX_FMT_SBGGR8: descr = "8-bit Bayer BGBG/GRGR"; break; | 1205 | case V4L2_PIX_FMT_SBGGR8: descr = "8-bit Bayer BGBG/GRGR"; break; |
1195 | case V4L2_PIX_FMT_SGBRG8: descr = "8-bit Bayer GBGB/RGRG"; break; | 1206 | case V4L2_PIX_FMT_SGBRG8: descr = "8-bit Bayer GBGB/RGRG"; break; |
1196 | case V4L2_PIX_FMT_SGRBG8: descr = "8-bit Bayer GRGR/BGBG"; break; | 1207 | case V4L2_PIX_FMT_SGRBG8: descr = "8-bit Bayer GRGR/BGBG"; break; |
@@ -1448,6 +1459,9 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, | |||
1448 | bool is_tx = vfd->vfl_dir != VFL_DIR_RX; | 1459 | bool is_tx = vfd->vfl_dir != VFL_DIR_RX; |
1449 | int ret; | 1460 | int ret; |
1450 | 1461 | ||
1462 | ret = v4l_enable_media_source(vfd); | ||
1463 | if (ret) | ||
1464 | return ret; | ||
1451 | v4l_sanitize_format(p); | 1465 | v4l_sanitize_format(p); |
1452 | 1466 | ||
1453 | switch (p->type) { | 1467 | switch (p->type) { |
@@ -1637,7 +1651,11 @@ static int v4l_s_tuner(const struct v4l2_ioctl_ops *ops, | |||
1637 | { | 1651 | { |
1638 | struct video_device *vfd = video_devdata(file); | 1652 | struct video_device *vfd = video_devdata(file); |
1639 | struct v4l2_tuner *p = arg; | 1653 | struct v4l2_tuner *p = arg; |
1654 | int ret; | ||
1640 | 1655 | ||
1656 | ret = v4l_enable_media_source(vfd); | ||
1657 | if (ret) | ||
1658 | return ret; | ||
1641 | p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ? | 1659 | p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ? |
1642 | V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1660 | V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
1643 | return ops->vidioc_s_tuner(file, fh, p); | 1661 | return ops->vidioc_s_tuner(file, fh, p); |
@@ -1691,7 +1709,11 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops, | |||
1691 | struct video_device *vfd = video_devdata(file); | 1709 | struct video_device *vfd = video_devdata(file); |
1692 | const struct v4l2_frequency *p = arg; | 1710 | const struct v4l2_frequency *p = arg; |
1693 | enum v4l2_tuner_type type; | 1711 | enum v4l2_tuner_type type; |
1712 | int ret; | ||
1694 | 1713 | ||
1714 | ret = v4l_enable_media_source(vfd); | ||
1715 | if (ret) | ||
1716 | return ret; | ||
1695 | if (vfd->vfl_type == VFL_TYPE_SDR) { | 1717 | if (vfd->vfl_type == VFL_TYPE_SDR) { |
1696 | if (p->type != V4L2_TUNER_SDR && p->type != V4L2_TUNER_RF) | 1718 | if (p->type != V4L2_TUNER_SDR && p->type != V4L2_TUNER_RF) |
1697 | return -EINVAL; | 1719 | return -EINVAL; |
@@ -1746,7 +1768,11 @@ static int v4l_s_std(const struct v4l2_ioctl_ops *ops, | |||
1746 | { | 1768 | { |
1747 | struct video_device *vfd = video_devdata(file); | 1769 | struct video_device *vfd = video_devdata(file); |
1748 | v4l2_std_id id = *(v4l2_std_id *)arg, norm; | 1770 | v4l2_std_id id = *(v4l2_std_id *)arg, norm; |
1771 | int ret; | ||
1749 | 1772 | ||
1773 | ret = v4l_enable_media_source(vfd); | ||
1774 | if (ret) | ||
1775 | return ret; | ||
1750 | norm = id & vfd->tvnorms; | 1776 | norm = id & vfd->tvnorms; |
1751 | if (vfd->tvnorms && !norm) /* Check if std is supported */ | 1777 | if (vfd->tvnorms && !norm) /* Check if std is supported */ |
1752 | return -EINVAL; | 1778 | return -EINVAL; |
@@ -1760,7 +1786,11 @@ static int v4l_querystd(const struct v4l2_ioctl_ops *ops, | |||
1760 | { | 1786 | { |
1761 | struct video_device *vfd = video_devdata(file); | 1787 | struct video_device *vfd = video_devdata(file); |
1762 | v4l2_std_id *p = arg; | 1788 | v4l2_std_id *p = arg; |
1789 | int ret; | ||
1763 | 1790 | ||
1791 | ret = v4l_enable_media_source(vfd); | ||
1792 | if (ret) | ||
1793 | return ret; | ||
1764 | /* | 1794 | /* |
1765 | * If no signal is detected, then the driver should return | 1795 | * If no signal is detected, then the driver should return |
1766 | * V4L2_STD_UNKNOWN. Otherwise it should return tvnorms with | 1796 | * V4L2_STD_UNKNOWN. Otherwise it should return tvnorms with |
@@ -1779,7 +1809,11 @@ static int v4l_s_hw_freq_seek(const struct v4l2_ioctl_ops *ops, | |||
1779 | struct video_device *vfd = video_devdata(file); | 1809 | struct video_device *vfd = video_devdata(file); |
1780 | struct v4l2_hw_freq_seek *p = arg; | 1810 | struct v4l2_hw_freq_seek *p = arg; |
1781 | enum v4l2_tuner_type type; | 1811 | enum v4l2_tuner_type type; |
1812 | int ret; | ||
1782 | 1813 | ||
1814 | ret = v4l_enable_media_source(vfd); | ||
1815 | if (ret) | ||
1816 | return ret; | ||
1783 | /* s_hw_freq_seek is not supported for SDR for now */ | 1817 | /* s_hw_freq_seek is not supported for SDR for now */ |
1784 | if (vfd->vfl_type == VFL_TYPE_SDR) | 1818 | if (vfd->vfl_type == VFL_TYPE_SDR) |
1785 | return -EINVAL; | 1819 | return -EINVAL; |