summaryrefslogtreecommitdiff
path: root/drivers/media/pci/cx88/cx88-core.c
AgeCommit message (Collapse)Author
2017-04-05[media] cx88: convert struct cx88_core.refcount from atomic_t to refcount_tElena Reshetova
refcount_t is better suitable for counting references than atomic_t. Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David Windsor <dwindsor@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25[media] cx88: make checkpatch.pl happyMauro Carvalho Chehab
Usually, I don't like fixing coding style issues on non-staging drivers, as it could be a mess pretty easy, and could become like a snow ball. That's the case of recent changes on two changesets: they disalign some statements. Yet, a care a lot with cx88 driver, as it was the first driver I touched at the Kernel, and I've been maintaining it since 2005. So, several of the coding style issues were due to my code. Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with fixed several other issues, did some function alinments, but broke other alinments. So, I had to manually apply another round of manual fixes to make sure that everything is ok, and to make checkpatch happy with this patch. With this patch, checkpatch.pl is now happy when called with: ./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL Also, the 80-cols violations that made sense were fixed. Checkpatch would be happier if we convert it to use dev_foo(), but this is a more complex change. NOTE: there are some places with msleep(1). As this driver was written at the time that the default was to sleep at least 10ms on such calls (e. g. CONFIG_HZ=100), I replaced those calls by usleep_range(10000, 20000), with should be safe to avoid breakages. Fixes: 65bc2fe86e66 ("[media] cx88: convert it to use pr_foo() macros") Fixes: 7b61ba8ff838 ("[media] cx88: make checkpatch happier") Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18[media] cx88: make checkpatch happierMauro Carvalho Chehab
This driver is old, and have lots of checkpatch violations. As we're touching a lot on this driver due to the printk conversions, let's run checkpatch --fix on it, in order to solve some of those issues. Also, do a few manual adjustments: - remove the FSF address and use the usual coding style for the initial comments; - use WARN_ON() instead of BUG_ON(); - remove an unused typedef; - break a few long lines. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18[media] cx88: convert it to use pr_foo() macrosMauro Carvalho Chehab
Instead of calling printk() directly, use pr_foo() macros, as suggested at the Kernel's coding style. Please notice that a conversion to dev_foo() is not trivial, as several parts on this driver uses pr_cont(). Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18[media] cx88: use KERN_CONT where neededMauro Carvalho Chehab
Some continuation messages are not using KERN_CONT. Since commit 563873318d32 ("Merge branch 'printk-cleanups'"), this won't work as expected anymore. So, let's add KERN_CONT to those lines. While here, add missing log level annotations. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2015-12-18[media] media: videobuf2: Move timestamp to vb2_bufferJunghak Sung
Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer for common use, and change its type to u64 in order to handling y2038 problem. This patch also includes all device drivers' changes related to this restructuring. 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 <hansverk@cisco.com> 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-05-01[media] cx88: v4l2-compliance fixesHans Verkuil
Fix three v4l2-compliance failures: - the colorspace wasn't set in vidioc_try_fmt_vid_cap(). - the field wasn't set in v4l2_buffer when vb2_buffer_done() was called. - the sequence wasn't set in v4l2_buffer when vb2_buffer_done() was called. This fix also removes the unused buf->count field and starts the count at 0 instead of 1. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08[media] cx88: embed video_deviceHans Verkuil
Embed the video_device struct to simplify the error handling and in order to (eventually) get rid of video_device_alloc/release. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-22[media] media: remove emacs editor variablesHans Verkuil
1) This is not allowed by the kernel coding style 2) Just configure your editor correctly 3) It's really ugly Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25[media] bttv/cx25821/cx88/ivtv: use sg_next instead of sg++Hans Verkuil
Never use sg++, always use sg = sg_next(sg). Scatterlist entries can be combined if the memory is contiguous but sg++ won't know about that. As far as I can tell cx88 and ivtv are really broken because of this, and bttv and cx25821 are OK because vb1 doesn't combine scatterlist entries. But regardless, sg++ should never be used, only sg_next is safe. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx88: don't allow changes while vb2_is_busyHans Verkuil
Make sure that changing the standard or format is not allowed while one or more of the video, vbi or mpeg vb2 queues are busy. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx88: remove dependency on btcx-riscHans Verkuil
btcx-risc is for the bt8xx driver and other drivers shouldn't depend on it. There is no benefit to use that module just to do a pci_zalloc_consistent. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx88: drop cx88_free_bufferHans Verkuil
Remove this function. This makes all vb2 queues behave the same, which simplifies comparing the various vb2 queue op implementations. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx88: convert to vb2Hans Verkuil
As usual, this patch is very large due to the fact that half a vb2 conversion isn't possible. And since this affects blackbird, alsa, core, dvb, vbi and video the changes are all over. What made this more difficult was the peculiar way the risc program was setup. The driver allowed for running out of buffers in which case the DMA would stop and restart when the next buffer was queued. There was also a complicated timeout system for when buffers weren't filled. This was replaced by a much simpler scheme where there is always one buffer around and the DMA will just cycle that buffer until a new buffer is queued. In that case the previous buffer will be chained to the new buffer. An interrupt is generated at the start of the new buffer telling the driver that the previous buffer can be passed on to userspace. Much simpler and more robust. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-07-04[media] media: remove the setting of the flag V4L2_FL_USE_FH_PRIORamakrishnan Muthukrishnan
Since all the drivers that use `struct v4l2_fh' use the core priority checking, the setting of the flag in the drivers can be removed. Signed-off-by: Ramakrishnan Muthukrishnan <ramakrmu@cisco.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-24[media] v4l: subdev: Move [gs]_std operation to video opsLaurent Pinchart
The g_std and s_std operations are video-related, move them to the video ops where they belong. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-06-21[media] cx88: set dev_parent to the correct parent PCI busHans Verkuil
The cx88 driver has one v4l2_device, but the video nodes are owned by two different PCI busses. So the dev_parent pointer should be set to the correct parent bus, otherwise sysfs won't show the correct device hierarchy. This broke starting in 3.6 after a driver change, so this patch resurrects the correct behavior. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-28[media] cx88: make core less verboseMauro Carvalho Chehab
Along the time, several debug messages were added at cx88-cards. While those are still useful to track some troubles with tuners, they're too verbose: [ 5768.281801] cx88[0]: Calling XC2028/3028 callback [ 5768.287388] cx88[0]: Calling XC2028/3028 callback [ 5768.292575] cx88[0]: Calling XC2028/3028 callback [ 5768.299408] cx88[0]: Calling XC2028/3028 callback [ 5768.306244] cx88[0]: Calling XC2028/3028 callback ... and, most of the time, useless. So, disable them, except if core_debug modprobe parameter is used. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-21[media] v4l: Convert drivers to use monotonic timestampsSakari Ailus
Convert drivers using wall clock time (CLOCK_REALTIME) to timestamp from the monotonic timer (CLOCK_MONOTONIC). Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-28[media] cx88: reorder inline to prevent a gcc warningMauro Carvalho Chehab
drivers/media/pci/cx88/cx88.h:97:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88.h:103:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:649:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:654:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:659:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:664:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:684:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] drivers/media/pci/cx88/cx88-core.c:695:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15[media] rename most media/video pci drivers to media/pciMauro Carvalho Chehab
Rename all PCI drivers with their own directory under drivers/media/video into drivers/media/pci and update the building system. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>