License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
*/
|
2016-11-13 12:07:38 +00:00
|
|
|
|
|
|
|
#include "cx88.h"
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
2008-04-22 17:41:48 +00:00
|
|
|
static unsigned int vbi_debug;
|
2016-11-16 08:59:49 +00:00
|
|
|
module_param(vbi_debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-11-13 12:07:38 +00:00
|
|
|
#define dprintk(level, fmt, arg...) do { \
|
|
|
|
if (vbi_debug >= level) \
|
|
|
|
printk(KERN_DEBUG pr_fmt("%s: vbi:" fmt), \
|
|
|
|
__func__, ##arg); \
|
|
|
|
} while (0)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2016-11-16 08:59:49 +00:00
|
|
|
int cx8800_vbi_fmt(struct file *file, void *priv,
|
[media] cx88: make checkpatch.pl happy
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-19 21:27:30 +00:00
|
|
|
struct v4l2_format *f)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2014-09-20 12:22:18 +00:00
|
|
|
struct cx8800_dev *dev = video_drvdata(file);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
|
|
|
|
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
|
|
|
f->fmt.vbi.offset = 244;
|
|
|
|
|
2007-01-20 16:58:33 +00:00
|
|
|
if (dev->core->tvnorm & V4L2_STD_525_60) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* ntsc */
|
|
|
|
f->fmt.vbi.sampling_rate = 28636363;
|
2006-05-22 13:32:11 +00:00
|
|
|
f->fmt.vbi.start[0] = 10;
|
|
|
|
f->fmt.vbi.start[1] = 273;
|
2014-09-20 12:24:58 +00:00
|
|
|
f->fmt.vbi.count[0] = VBI_LINE_NTSC_COUNT;
|
|
|
|
f->fmt.vbi.count[1] = VBI_LINE_NTSC_COUNT;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-01-20 16:58:33 +00:00
|
|
|
} else if (dev->core->tvnorm & V4L2_STD_625_50) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* pal */
|
|
|
|
f->fmt.vbi.sampling_rate = 35468950;
|
2014-09-20 12:24:58 +00:00
|
|
|
f->fmt.vbi.start[0] = V4L2_VBI_ITU_625_F1_START + 5;
|
|
|
|
f->fmt.vbi.start[1] = V4L2_VBI_ITU_625_F2_START + 5;
|
|
|
|
f->fmt.vbi.count[0] = VBI_LINE_PAL_COUNT;
|
|
|
|
f->fmt.vbi.count[1] = VBI_LINE_PAL_COUNT;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2007-01-20 16:58:17 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-05-01 15:59:29 +00:00
|
|
|
static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
|
[media] cx88: make checkpatch.pl happy
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-19 21:27:30 +00:00
|
|
|
struct cx88_dmaqueue *q,
|
|
|
|
struct cx88_buffer *buf)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
|
|
|
|
/* setup fifo + format */
|
|
|
|
cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24],
|
2014-09-20 12:22:18 +00:00
|
|
|
VBI_LINE_LENGTH, buf->risc.dma);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
[media] cx88: make checkpatch.pl happy
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-19 21:27:30 +00:00
|
|
|
cx_write(MO_VBOS_CONTROL, (1 << 18) | /* comb filter delay fixup */
|
|
|
|
(1 << 15) | /* enable vbi capture */
|
|
|
|
(1 << 11));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* reset counter */
|
|
|
|
cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET);
|
2015-04-03 10:22:40 +00:00
|
|
|
q->count = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* enable irqs */
|
2007-08-18 09:57:55 +00:00
|
|
|
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_VIDINT);
|
2005-04-16 22:20:36 +00:00
|
|
|
cx_set(MO_VID_INTMSK, 0x0f0088);
|
|
|
|
|
|
|
|
/* enable capture */
|
2016-11-16 08:59:49 +00:00
|
|
|
cx_set(VID_CAPTURE_CONTROL, 0x18);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* start dma */
|
[media] cx88: make checkpatch.pl happy
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-19 21:27:30 +00:00
|
|
|
cx_set(MO_DEV_CNTRL2, (1 << 5));
|
2005-04-16 22:20:36 +00:00
|
|
|
cx_set(MO_VID_DMACNTRL, 0x88);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
void cx8800_stop_vbi_dma(struct cx8800_dev *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
|
|
|
|
/* stop dma */
|
|
|
|
cx_clear(MO_VID_DMACNTRL, 0x88);
|
|
|
|
|
|
|
|
/* disable capture */
|
2016-11-16 08:59:49 +00:00
|
|
|
cx_clear(VID_CAPTURE_CONTROL, 0x18);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* disable irqs */
|
2007-08-18 09:57:55 +00:00
|
|
|
cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT);
|
2005-04-16 22:20:36 +00:00
|
|
|
cx_clear(MO_VID_INTMSK, 0x0f0088);
|
|
|
|
}
|
|
|
|
|
|
|
|
int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
|
|
|
|
struct cx88_dmaqueue *q)
|
|
|
|
{
|
|
|
|
struct cx88_buffer *buf;
|
|
|
|
|
|
|
|
if (list_empty(&q->active))
|
|
|
|
return 0;
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
2016-11-16 08:59:49 +00:00
|
|
|
dprintk(2, "restart_queue [%p/%d]: restart dma\n",
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2005-04-16 22:20:36 +00:00
|
|
|
cx8800_start_vbi_dma(dev, q, buf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2015-10-28 02:50:37 +00:00
|
|
|
static int queue_setup(struct vb2_queue *q,
|
[media] cx88: make checkpatch.pl happy
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-19 21:27:30 +00:00
|
|
|
unsigned int *num_buffers, unsigned int *num_planes,
|
|
|
|
unsigned int sizes[], struct device *alloc_devs[])
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2014-09-20 12:24:58 +00:00
|
|
|
struct cx8800_dev *dev = q->drv_priv;
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
*num_planes = 1;
|
2014-09-20 12:24:58 +00:00
|
|
|
if (dev->core->tvnorm & V4L2_STD_525_60)
|
|
|
|
sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2;
|
|
|
|
else
|
|
|
|
sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2;
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
static int buffer_prepare(struct vb2_buffer *vb)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 12:22:18 +00:00
|
|
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2014-09-20 12:22:18 +00:00
|
|
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
2014-09-20 12:24:58 +00:00
|
|
|
unsigned int lines;
|
2005-04-16 22:20:36 +00:00
|
|
|
unsigned int size;
|
|
|
|
|
2014-09-20 12:24:58 +00:00
|
|
|
if (dev->core->tvnorm & V4L2_STD_525_60)
|
|
|
|
lines = VBI_LINE_NTSC_COUNT;
|
|
|
|
else
|
|
|
|
lines = VBI_LINE_PAL_COUNT;
|
|
|
|
size = lines * VBI_LINE_LENGTH * 2;
|
2014-09-20 12:22:18 +00:00
|
|
|
if (vb2_plane_size(vb, 0) < size)
|
2005-04-16 22:20:36 +00:00
|
|
|
return -EINVAL;
|
2014-09-20 12:22:18 +00:00
|
|
|
vb2_set_plane_payload(vb, 0, size);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl,
|
2014-09-20 12:24:58 +00:00
|
|
|
0, VBI_LINE_LENGTH * lines,
|
2014-09-20 12:22:18 +00:00
|
|
|
VBI_LINE_LENGTH, 0,
|
2014-09-20 12:24:58 +00:00
|
|
|
lines);
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
2014-09-20 12:22:18 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
static void buffer_finish(struct vb2_buffer *vb)
|
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 12:22:18 +00:00
|
|
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2014-08-29 07:11:54 +00:00
|
|
|
struct cx88_riscmem *risc = &buf->risc;
|
2014-09-20 12:22:18 +00:00
|
|
|
|
2014-08-29 07:11:54 +00:00
|
|
|
if (risc->cpu)
|
|
|
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
|
|
|
memset(risc, 0, sizeof(*risc));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
static void buffer_queue(struct vb2_buffer *vb)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 12:22:18 +00:00
|
|
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2005-04-16 22:20:36 +00:00
|
|
|
struct cx88_buffer *prev;
|
|
|
|
struct cx88_dmaqueue *q = &dev->vbiq;
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
/* add jump to start */
|
|
|
|
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
|
|
|
|
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
|
|
|
|
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (list_empty(&q->active)) {
|
2014-09-20 12:22:18 +00:00
|
|
|
list_add_tail(&buf->list, &q->active);
|
2016-11-16 08:59:49 +00:00
|
|
|
dprintk(2, "[%p/%d] vbi_queue - first active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
} else {
|
2014-09-20 12:22:18 +00:00
|
|
|
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
|
|
|
prev = list_entry(q->active.prev, struct cx88_buffer, list);
|
|
|
|
list_add_tail(&buf->list, &q->active);
|
2005-04-16 22:20:36 +00:00
|
|
|
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
2016-11-16 08:59:49 +00:00
|
|
|
dprintk(2, "[%p/%d] buffer_queue - append to active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
static int start_streaming(struct vb2_queue *q, unsigned int count)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2014-09-20 12:22:18 +00:00
|
|
|
struct cx8800_dev *dev = q->drv_priv;
|
|
|
|
struct cx88_dmaqueue *dmaq = &dev->vbiq;
|
|
|
|
struct cx88_buffer *buf = list_entry(dmaq->active.next,
|
|
|
|
struct cx88_buffer, list);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
cx8800_start_vbi_dma(dev, dmaq, buf);
|
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
static void stop_streaming(struct vb2_queue *q)
|
|
|
|
{
|
|
|
|
struct cx8800_dev *dev = q->drv_priv;
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
struct cx88_dmaqueue *dmaq = &dev->vbiq;
|
|
|
|
unsigned long flags;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-09-20 12:22:18 +00:00
|
|
|
cx_clear(MO_VID_DMACNTRL, 0x11);
|
|
|
|
cx_clear(VID_CAPTURE_CONTROL, 0x06);
|
|
|
|
cx8800_stop_vbi_dma(dev);
|
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
|
|
|
while (!list_empty(&dmaq->active)) {
|
|
|
|
struct cx88_buffer *buf = list_entry(dmaq->active.next,
|
|
|
|
struct cx88_buffer, list);
|
|
|
|
|
|
|
|
list_del(&buf->list);
|
[media] media: videobuf2: Restructure vb2_buffer
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-09-22 13:30:30 +00:00
|
|
|
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
2014-09-20 12:22:18 +00:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct vb2_ops cx8800_vbi_qops = {
|
|
|
|
.queue_setup = queue_setup,
|
|
|
|
.buf_prepare = buffer_prepare,
|
|
|
|
.buf_finish = buffer_finish,
|
|
|
|
.buf_queue = buffer_queue,
|
|
|
|
.wait_prepare = vb2_ops_wait_prepare,
|
|
|
|
.wait_finish = vb2_ops_wait_finish,
|
|
|
|
.start_streaming = start_streaming,
|
|
|
|
.stop_streaming = stop_streaming,
|
|
|
|
};
|