aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cobalt/cobalt-v4l2.c
AgeCommit message (Collapse)Author
2024-03-26media: media/pci: rename VFL_TYPE_GRABBER to _VIDEOHans Verkuil
[ Upstream commit 3e30a927af3ca86f6556faf437da44ca8bcf54a4 ] 'GRABBER' is a weird name, all other types map to the /dev device names. Rename to 'VIDEO' to be consistent with the other types. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Stable-dep-of: d0b07f712bf6 ("media: ttpci: fix two memleaks in budget_av_attach") Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-23media: drivers/media: don't set pix->priv = 0Hans Verkuil
The priv field of struct v4l2_pix_format shouldn't be set by drivers, it's set by the v4l2 core instead to V4L2_PIX_FMT_PRIV_MAGIC. Drop this from the few media drivers that still do this. Note that the gspca patch is slightly more involved since some of the sub-gspca drivers use the priv field internally. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [hverkuil-cisco@xs4all.nl: fix clash in gspca between priv arg and priv variable] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-22media: media/pci: don't set description for ENUM_FMTHans Verkuil
The V4L2 core sets the description for the driver in order to ensure consistent naming. So drop the strscpy of the description in drivers. Also remove any description strings in driver-internal structures since those are no longer needed. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-06-24media: media/pci: set device_caps in struct video_deviceHans Verkuil
Instead of filling in the struct v4l2_capability device_caps field, fill in the struct video_device device_caps field. That way the V4L2 core knows what the capabilities of the video device are. But this only really works if all drivers use this, so convert all pci drivers in this patch. Tested with cx88-blackbird and ivtv PVR-350. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-03-01media: pci: fix several typosMauro Carvalho Chehab
Use codespell to fix lots of typos over frontends. Manually verified to avoid false-positives. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20media: vidioc_cropcap -> vidioc_g_pixelaspectHans Verkuil
Now vidioc_cropcap is only used to return the pixelaspect, so rename it accordingly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20media: cropcap/g_selection splitHans Verkuil
If g_selection is implemented, then the v4l2-ioctl cropcap code assumes that cropcap just implements the pixelaspect part and that g_selection provides the crop bounds and default rectangles. There are still some drivers that only implement cropcap and not g_selection. Split up cropcap into a cropcap and g_selection for those drivers. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-11media: use strscpy() instead of strlcpy()Mauro Carvalho Chehab
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-31media: cobalt: Use v4l2_calc_timeperframe helperJose Abreu
Currently, cobalt driver always returns 60fps in g_parm. This patch uses the new v4l2_calc_timeperframe helper to calculate the time per frame value. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-02-14media: cobalt: add SPDX license infoHans Verkuil
Replace the old license information with the corresponding SPDX license. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16[media] cobalt: fix copy-and-paste errorHans Verkuil
The vmr_stat variable was filled with the contents of the control register, not the status register. Classic copy-and-paste error. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16[media] cobalt: add cropcap supportHans Verkuil
Now that the timings contain picture aspect ratio information, we can support cropcap to return the pixel aspect ratio. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24[media] cobalt: support reduced fpsHans Verkuil
Add support for reduced fps (i.e. 59.94 Hz instead of 60 Hz) for the HDMI output. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil
Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] media/pci: convert drivers to use the new vb2_queue dev fieldHans Verkuil
Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Federico Vaga <federico.vaga@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2015-12-18[media] vb2: drop v4l2_format argument from queue_setupHans Verkuil
The queue_setup callback has a void pointer that is just for V4L2 and is the pointer to the v4l2_format struct that was passed to VIDIOC_CREATE_BUFS. The idea was that drivers would use the information from that struct to buffers suitable for the requested format. After the vb2 split series this pointer is now a void pointer, which is ugly, and the reality is that all existing drivers will effectively just look at the sizeimage field of v4l2_format. To make this more generic the queue_setup callback is changed: the void pointer is dropped, instead if the *num_planes argument is 0, then use the current format size, if it is non-zero, then it contains the number of requested planes and the sizes array contains the requested sizes. If either is unsupported, then return -EINVAL, otherwise use the requested size(s). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03[media] v4l2-dv-timings: add new arg to v4l2_match_dv_timingsHans Verkuil
Add the new match_reduced_fps argument to v4l2_match_dv_timings(). Depending on the situation you may or may not desire to match the reduced_fps flag. Typically only HDMI transmitters will need to check for this flag. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17[media] include/media: split I2C headers from V4L2 coreMauro Carvalho Chehab
Currently, include/media is messy, as it contains both the V4L2 core headers and some driver-specific headers on the same place. That makes harder to identify what core headers should be documented and what headers belong to I2C drivers that are included only by bridge/main drivers that would require the functions provided by them. Let's move those i2c specific files to its own subdirectory. The files to move were produced via the following script: mkdir include/media/i2c (cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done) (cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/*/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done) for i in include/media/*.h; do n=`basename $i`; (for j in $(git grep -l $n); do dirname $j; done)|sort|uniq|grep -ve '^.$' > list; num=$(wc -l list|cut -d' ' -f1); if [ $num == 1 ]; then if [ "`grep i2c list`" != "" ]; then git mv $i include/media/i2c; fi; fi; done And the references corrected via this script: MAIN_DIR="media/" PREV_DIR="media/" DIRS="i2c/" echo "Checking affected files" >&2 for i in $DIRS; do for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do n=`basename $j` git grep -l $n done done|sort|uniq >files && ( echo "Handling files..." >&2; echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\"; ( cd include/$MAIN_DIR; for j in $DIRS; do for i in $(ls $j); do echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\"; done; done; echo "cat > a && mv a \$i; done"; ); echo "Handling documentation..." >&2; echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\"; ( cd include/$MAIN_DIR; for j in $DIRS; do for i in $(ls $j); do echo " perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\"; done; done; echo "cat > a && mv a \$i; done" ); ) >script && . ./script Merged Sakari Ailus patch that moves smiapp.h to include/media/i2c. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-10-20[media] media: videobuf2: Change queue_setup argumentJunghak Sung
Replace struct v4l2_format * with void * to make queue_setup() for common use. And then, modify all device drivers related with this change. Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: fix missing const in fimc-lite.c] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01[media] media: videobuf2: Restructure vb2_bufferJunghak Sung
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer. Add new member variables - bytesused, length, offset, userptr, fd, data_offset - to struct vb2_plane in order to cover all information of v4l2_plane. struct vb2_plane { <snip> unsigned int bytesused; unsigned int length; union { unsigned int offset; unsigned long userptr; int fd; } m; unsigned int data_offset; } Replace v4l2_buf with new member variables - index, type, memory - which are common fields for buffer management. struct vb2_buffer { <snip> unsigned int index; unsigned int type; unsigned int memory; unsigned int num_planes; struct vb2_plane planes[VIDEO_MAX_PLANES]; <snip> }; v4l2 specific fields - flags, field, timestamp, timecode, sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c struct vb2_v4l2_buffer { struct vb2_buffer vb2_buf; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; }; Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22[media] cobalt: accept unchanged timings when vb2_is_busy()Hans Verkuil
When vb2_is_busy() it should still be possible to call S_DV_TIMINGS provided the new timings are the same as the current timings. For input 1 (test generator) the size is always 1080p, so just return that. Fixes a v4l2-compliance issue. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10[media] cobalt: fix 64-bit divisionHans Verkuil
There are still some 64-bit division problems in the cobalt code. Replace it by div_u64. [mchehab@osg.samsung.com: folded with an additional diff sent by Hans via a priv e-mail] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05[media] cobalt: simplify colorspace codeHans Verkuil
Simplify cobalt_g/try_fmt_vid_cap by not setting the colorspace fields in pix again (since v4l2_fill_pix_format does that already), and by using v4l2_fill_mbus_format in cobalt_s_fmt_vid_out which allows the get_fmt call to be dropped as well. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05[media] cobalt: support transfer functionHans Verkuil
Add support for the transfer function to the cobalt driver: make sure it is passed on to/retrieved from the sub-device correctly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] cobalt: fix sparse warningsHans Verkuil
drivers/media/pci/cobalt/cobalt-v4l2.c:189:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:191:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:192:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:193:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:194:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:195:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:196:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:197:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:198:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:199:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:201:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:202:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:203:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:234:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:240:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:246:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:266:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:267:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:271:28: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:275:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:276:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:312:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:313:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:314:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:315:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:317:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:320:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:321:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:321:36: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:324:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:327:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:328:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:328:41: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:329:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:331:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:332:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:334:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:335:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:336:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:362:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:367:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:368:17: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:420:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:421:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:422:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:423:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:516:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:516:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:518:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:518:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:518:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:525:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:525:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:531:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:546:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:546:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:548:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:549:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:550:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:551:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:552:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:553:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:554:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:555:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:556:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:556:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:556:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:563:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:564:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:564:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:569:9: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:595:16: warning: dereference of noderef expression drivers/media/pci/cobalt/cobalt-v4l2.c:602:9: warning: dereference of noderef expression Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] cobalt: fix 64-bit division link errorHans Verkuil
[linuxtv-media:master 1023/1029] ERROR: "__aeabi_uldivmod" [drivers/media/pci/cobalt/cobalt.ko] undefined! Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cobalt: add new driverHans Verkuil
The cobalt device is a PCIe card with 4 HDMI inputs (adv7604) and a connector that can be used to hook up an adv7511 transmitter or an adv7842 receiver daughterboard. This device is used within Cisco but is sadly not available outside of Cisco. Nevertheless it is a very interesting driver that can serve as an example of how to support HDMI hardware and how to use the popular adv devices. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>