2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Support for a cx23416 mpeg encoder via cx2388x host port.
|
|
|
|
* "blackbird" reference design.
|
|
|
|
*
|
2008-11-20 18:07:45 +08:00
|
|
|
* (c) 2004 Jelle Foks <jelle@foks.us>
|
2005-04-17 06:20:36 +08:00
|
|
|
* (c) 2004 Gerd Knorr <kraxel@bytesex.org>
|
|
|
|
*
|
MAINTAINERS & files: Canonize the e-mails I use at files
From now on, I'll start using my @kernel.org as my development e-mail.
As such, let's remove the entries that point to the old
mchehab@s-opensource.com at MAINTAINERS file.
For the files written with a copyright with mchehab@s-opensource,
let's keep Samsung on their names, using mchehab+samsung@kernel.org,
in order to keep pointing to my employer, with sponsors the work.
For the files written before I join Samsung (on July, 4 2013),
let's just use mchehab@kernel.org.
For bug reports, we can simply point to just kernel.org, as
this will reach my mchehab+samsung inbox anyway.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Brian Warner <brian.warner@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-04-25 17:34:48 +08:00
|
|
|
* (c) 2005-2006 Mauro Carvalho Chehab <mchehab@kernel.org>
|
2007-01-21 00:59:38 +08:00
|
|
|
* - video_ioctl2 conversion
|
|
|
|
*
|
2010-10-18 17:03:14 +08:00
|
|
|
* Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/>
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
#include "cx88.h"
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/firmware.h>
|
2006-05-22 21:31:54 +08:00
|
|
|
#include <media/v4l2-common.h>
|
2008-07-20 19:12:02 +08:00
|
|
|
#include <media/v4l2-ioctl.h>
|
2012-05-11 22:25:03 +08:00
|
|
|
#include <media/v4l2-event.h>
|
2015-11-14 05:40:07 +08:00
|
|
|
#include <media/drv-intf/cx2341x.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
|
2008-11-20 18:07:45 +08:00
|
|
|
MODULE_AUTHOR("Jelle Foks <jelle@foks.us>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_LICENSE("GPL");
|
[media] Stop using linux/version.h on most video drivers
All the modified drivers didn't have any version increment since
Jan, 1 2011. Several of them didn't have any version increment
for a long time, even having new features and important bug fixes
happening.
As we're now filling the QUERYCAP version with the current Kernel
Release, we don't need to maintain a per-driver version control
anymore. So, let's just use the default.
In order to preserve the Kernel module version history, a
KERNEL_VERSION() macro were added to all modified drivers, and
the extraver number were incremented.
I opted to preserve the per-driver version control to a few
pwc, pvrusb2, s2255, s5p-fimc and sh_vou.
A few drivers are still using the legacy way to handle ioctl's.
So, we can't do such change on them, otherwise, they'll break.
Those are: uvc, et61x251 and sn9c102.
The rationale is that the per-driver version control seems to be
actively maintained on those.
Yet, I think that the better for them would be to just use the
default version numbering, instead of doing that by themselves.
While here, removed a few uneeded include linux/version.h
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-06-25 01:45:49 +08:00
|
|
|
MODULE_VERSION(CX88_VERSION);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-04-23 01:41:48 +08:00
|
|
|
static unsigned int debug;
|
2016-11-16 16:59:49 +08:00
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "enable debug messages [blackbird]");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
#define dprintk(level, fmt, arg...) do { \
|
|
|
|
if (debug + 1 > level) \
|
|
|
|
printk(KERN_DEBUG pr_fmt("%s: blackbird:" fmt), \
|
|
|
|
__func__, ##arg); \
|
|
|
|
} while (0)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2007-05-30 20:39:46 +08:00
|
|
|
#define BLACKBIRD_FIRM_IMAGE_SIZE 376836
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* defines below are from ivtv-driver.h */
|
|
|
|
|
|
|
|
#define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF
|
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
/* Firmware API commands */
|
|
|
|
#define IVTV_API_STD_TIMEOUT 500
|
|
|
|
|
|
|
|
enum blackbird_capture_type {
|
|
|
|
BLACKBIRD_MPEG_CAPTURE,
|
|
|
|
BLACKBIRD_RAW_CAPTURE,
|
|
|
|
BLACKBIRD_RAW_PASSTHRU_CAPTURE
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_capture_bits {
|
|
|
|
BLACKBIRD_RAW_BITS_NONE = 0x00,
|
|
|
|
BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01,
|
|
|
|
BLACKBIRD_RAW_BITS_PCM_CAPTURE = 0x02,
|
|
|
|
BLACKBIRD_RAW_BITS_VBI_CAPTURE = 0x04,
|
|
|
|
BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08,
|
|
|
|
BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_capture_end {
|
|
|
|
BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */
|
|
|
|
BLACKBIRD_END_NOW, /* stop immediately, no irq */
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_framerate {
|
|
|
|
BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */
|
|
|
|
BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_stream_port {
|
|
|
|
BLACKBIRD_OUTPUT_PORT_MEMORY,
|
|
|
|
BLACKBIRD_OUTPUT_PORT_STREAMING,
|
|
|
|
BLACKBIRD_OUTPUT_PORT_SERIAL
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_data_xfer_status {
|
|
|
|
BLACKBIRD_MORE_BUFFERS_FOLLOW,
|
|
|
|
BLACKBIRD_LAST_BUFFER,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_picture_mask {
|
|
|
|
BLACKBIRD_PICTURE_MASK_NONE,
|
|
|
|
BLACKBIRD_PICTURE_MASK_I_FRAMES,
|
|
|
|
BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3,
|
|
|
|
BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_vbi_mode_bits {
|
|
|
|
BLACKBIRD_VBI_BITS_SLICED,
|
|
|
|
BLACKBIRD_VBI_BITS_RAW,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_vbi_insertion_bits {
|
|
|
|
BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA,
|
|
|
|
BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1,
|
|
|
|
BLACKBIRD_VBI_BITS_SEPARATE_STREAM = 0x2 << 1,
|
|
|
|
BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1,
|
|
|
|
BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_dma_unit {
|
|
|
|
BLACKBIRD_DMA_BYTES,
|
|
|
|
BLACKBIRD_DMA_FRAMES,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_dma_transfer_status_bits {
|
|
|
|
BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01,
|
|
|
|
BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04,
|
|
|
|
BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_pause {
|
|
|
|
BLACKBIRD_PAUSE_ENCODING,
|
|
|
|
BLACKBIRD_RESUME_ENCODING,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_copyright {
|
|
|
|
BLACKBIRD_COPYRIGHT_OFF,
|
|
|
|
BLACKBIRD_COPYRIGHT_ON,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_notification_type {
|
|
|
|
BLACKBIRD_NOTIFICATION_REFRESH,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_notification_status {
|
|
|
|
BLACKBIRD_NOTIFICATION_OFF,
|
|
|
|
BLACKBIRD_NOTIFICATION_ON,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_notification_mailbox {
|
|
|
|
BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_field1_lines {
|
|
|
|
BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */
|
|
|
|
BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */
|
|
|
|
BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_field2_lines {
|
|
|
|
BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */
|
|
|
|
BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */
|
|
|
|
BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_custom_data_type {
|
|
|
|
BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
|
|
|
|
BLACKBIRD_CUSTOM_PRIVATE_PACKET,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_mute {
|
|
|
|
BLACKBIRD_UNMUTE,
|
|
|
|
BLACKBIRD_MUTE,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_mute_video_mask {
|
|
|
|
BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00,
|
|
|
|
BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000,
|
|
|
|
BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000,
|
|
|
|
};
|
[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-20 05:27:30 +08:00
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
enum blackbird_mute_video_shift {
|
|
|
|
BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8,
|
|
|
|
BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16,
|
|
|
|
BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24,
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Registers */
|
|
|
|
#define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/)
|
|
|
|
#define IVTV_REG_ENC_SDRAM_PRECHARGE (0x07FC /*| IVTV_REG_OFFSET*/)
|
|
|
|
#define IVTV_REG_SPU (0x9050 /*| IVTV_REG_OFFSET*/)
|
|
|
|
#define IVTV_REG_HW_BLOCKS (0x9054 /*| IVTV_REG_OFFSET*/)
|
|
|
|
#define IVTV_REG_VPU (0x9058 /*| IVTV_REG_OFFSET*/)
|
|
|
|
#define IVTV_REG_APU (0xA064 /*| IVTV_REG_OFFSET*/)
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
static void host_setup(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
/* toggle reset of the host */
|
|
|
|
cx_write(MO_GPHST_SOFT_RST, 1);
|
|
|
|
udelay(100);
|
|
|
|
cx_write(MO_GPHST_SOFT_RST, 0);
|
|
|
|
udelay(100);
|
|
|
|
|
|
|
|
/* host port setup */
|
|
|
|
cx_write(MO_GPHST_WSC, 0x44444444U);
|
|
|
|
cx_write(MO_GPHST_XFR, 0);
|
|
|
|
cx_write(MO_GPHST_WDTH, 15);
|
|
|
|
cx_write(MO_GPHST_HDSHK, 0);
|
|
|
|
cx_write(MO_GPHST_MUX16, 0x44448888U);
|
|
|
|
cx_write(MO_GPHST_MODE, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
#define P1_MDATA0 0x390000
|
|
|
|
#define P1_MDATA1 0x390001
|
|
|
|
#define P1_MDATA2 0x390002
|
|
|
|
#define P1_MDATA3 0x390003
|
|
|
|
#define P1_MADDR2 0x390004
|
|
|
|
#define P1_MADDR1 0x390005
|
|
|
|
#define P1_MADDR0 0x390006
|
|
|
|
#define P1_RDATA0 0x390008
|
|
|
|
#define P1_RDATA1 0x390009
|
|
|
|
#define P1_RDATA2 0x39000A
|
|
|
|
#define P1_RDATA3 0x39000B
|
|
|
|
#define P1_RADDR0 0x39000C
|
|
|
|
#define P1_RADDR1 0x39000D
|
|
|
|
#define P1_RRDWR 0x39000E
|
|
|
|
|
|
|
|
static int wait_ready_gpio0_bit1(struct cx88_core *core, u32 state)
|
|
|
|
{
|
|
|
|
unsigned long timeout = jiffies + msecs_to_jiffies(1);
|
2016-11-16 16:59:49 +08:00
|
|
|
u32 gpio0, need;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
need = state ? 2 : 0;
|
|
|
|
for (;;) {
|
|
|
|
gpio0 = cx_read(MO_GP0_IO) & 2;
|
|
|
|
if (need == gpio0)
|
|
|
|
return 0;
|
2016-11-16 16:59:49 +08:00
|
|
|
if (time_after(jiffies, timeout))
|
2005-04-17 06:20:36 +08:00
|
|
|
return -1;
|
|
|
|
udelay(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int memory_write(struct cx88_core *core, u32 address, u32 value)
|
|
|
|
{
|
|
|
|
/* Warning: address is dword address (4 bytes) */
|
|
|
|
cx_writeb(P1_MDATA0, (unsigned int)value);
|
|
|
|
cx_writeb(P1_MDATA1, (unsigned int)(value >> 8));
|
|
|
|
cx_writeb(P1_MDATA2, (unsigned int)(value >> 16));
|
|
|
|
cx_writeb(P1_MDATA3, (unsigned int)(value >> 24));
|
|
|
|
cx_writeb(P1_MADDR2, (unsigned int)(address >> 16) | 0x40);
|
|
|
|
cx_writeb(P1_MADDR1, (unsigned int)(address >> 8));
|
|
|
|
cx_writeb(P1_MADDR0, (unsigned int)address);
|
|
|
|
cx_read(P1_MDATA0);
|
|
|
|
cx_read(P1_MADDR0);
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
return wait_ready_gpio0_bit1(core, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int memory_read(struct cx88_core *core, u32 address, u32 *value)
|
|
|
|
{
|
2005-11-09 13:37:43 +08:00
|
|
|
int retval;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
/* Warning: address is dword address (4 bytes) */
|
|
|
|
cx_writeb(P1_MADDR2, (unsigned int)(address >> 16) & ~0xC0);
|
|
|
|
cx_writeb(P1_MADDR1, (unsigned int)(address >> 8));
|
|
|
|
cx_writeb(P1_MADDR0, (unsigned int)address);
|
|
|
|
cx_read(P1_MADDR0);
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
retval = wait_ready_gpio0_bit1(core, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
cx_writeb(P1_MDATA3, 0);
|
|
|
|
val = (unsigned char)cx_read(P1_MDATA3) << 24;
|
|
|
|
cx_writeb(P1_MDATA2, 0);
|
|
|
|
val |= (unsigned char)cx_read(P1_MDATA2) << 16;
|
|
|
|
cx_writeb(P1_MDATA1, 0);
|
|
|
|
val |= (unsigned char)cx_read(P1_MDATA1) << 8;
|
|
|
|
cx_writeb(P1_MDATA0, 0);
|
|
|
|
val |= (unsigned char)cx_read(P1_MDATA0);
|
|
|
|
|
|
|
|
*value = val;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int register_write(struct cx88_core *core, u32 address, u32 value)
|
|
|
|
{
|
|
|
|
cx_writeb(P1_RDATA0, (unsigned int)value);
|
|
|
|
cx_writeb(P1_RDATA1, (unsigned int)(value >> 8));
|
|
|
|
cx_writeb(P1_RDATA2, (unsigned int)(value >> 16));
|
|
|
|
cx_writeb(P1_RDATA3, (unsigned int)(value >> 24));
|
|
|
|
cx_writeb(P1_RADDR0, (unsigned int)address);
|
|
|
|
cx_writeb(P1_RADDR1, (unsigned int)(address >> 8));
|
|
|
|
cx_writeb(P1_RRDWR, 1);
|
|
|
|
cx_read(P1_RDATA0);
|
|
|
|
cx_read(P1_RADDR0);
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
return wait_ready_gpio0_bit1(core, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int register_read(struct cx88_core *core, u32 address, u32 *value)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
cx_writeb(P1_RADDR0, (unsigned int)address);
|
|
|
|
cx_writeb(P1_RADDR1, (unsigned int)(address >> 8));
|
|
|
|
cx_writeb(P1_RRDWR, 0);
|
|
|
|
cx_read(P1_RADDR0);
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
retval = wait_ready_gpio0_bit1(core, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
val = (unsigned char)cx_read(P1_RDATA0);
|
|
|
|
val |= (unsigned char)cx_read(P1_RDATA1) << 8;
|
|
|
|
val |= (unsigned char)cx_read(P1_RDATA2) << 16;
|
|
|
|
val |= (unsigned char)cx_read(P1_RDATA3) << 24;
|
|
|
|
|
|
|
|
*value = val;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
static int blackbird_mbox_func(void *priv, u32 command, int in,
|
|
|
|
int out, u32 data[CX2341X_MBOX_MAX_DATA])
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-06-19 03:11:06 +08:00
|
|
|
struct cx8802_dev *dev = priv;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long timeout;
|
|
|
|
u32 value, flag, retval;
|
|
|
|
int i;
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "%s: 0x%X\n", __func__, command);
|
2005-04-17 06:20:36 +08: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-20 05:27:30 +08:00
|
|
|
/*
|
|
|
|
* this may not be 100% safe if we can't read any memory location
|
|
|
|
* without side effects
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
memory_read(dev->core, dev->mailbox - 4, &value);
|
|
|
|
if (value != 0x12345678) {
|
[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-20 05:27:30 +08:00
|
|
|
dprintk(0,
|
|
|
|
"Firmware and/or mailbox pointer not initialized or corrupted\n");
|
2014-08-29 16:29:19 +08:00
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
memory_read(dev->core, dev->mailbox, &flag);
|
|
|
|
if (flag) {
|
|
|
|
dprintk(0, "ERROR: Mailbox appears to be in use (%x)\n", flag);
|
2014-08-29 16:29:19 +08:00
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
flag |= 1; /* tell 'em we're working on it */
|
|
|
|
memory_write(dev->core, dev->mailbox, flag);
|
|
|
|
|
|
|
|
/* write command + args + fill remaining with zeros */
|
|
|
|
memory_write(dev->core, dev->mailbox + 1, command); /* command code */
|
[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-20 05:27:30 +08:00
|
|
|
/* timeout */
|
|
|
|
memory_write(dev->core, dev->mailbox + 3, IVTV_API_STD_TIMEOUT);
|
2006-06-19 03:11:06 +08:00
|
|
|
for (i = 0; i < in; i++) {
|
|
|
|
memory_write(dev->core, dev->mailbox + 4 + i, data[i]);
|
|
|
|
dprintk(1, "API Input %d = %d\n", i, data[i]);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-06-19 03:11:06 +08:00
|
|
|
for (; i < CX2341X_MBOX_MAX_DATA; i++)
|
2005-04-17 06:20:36 +08:00
|
|
|
memory_write(dev->core, dev->mailbox + 4 + i, 0);
|
|
|
|
|
|
|
|
flag |= 3; /* tell 'em we're done writing */
|
|
|
|
memory_write(dev->core, dev->mailbox, flag);
|
|
|
|
|
|
|
|
/* wait for firmware to handle the API command */
|
2014-08-29 16:45:59 +08:00
|
|
|
timeout = jiffies + msecs_to_jiffies(1000);
|
2005-04-17 06:20:36 +08:00
|
|
|
for (;;) {
|
|
|
|
memory_read(dev->core, dev->mailbox, &flag);
|
|
|
|
if (0 != (flag & 4))
|
|
|
|
break;
|
2016-11-16 16:59:49 +08:00
|
|
|
if (time_after(jiffies, timeout)) {
|
2014-08-29 16:29:19 +08:00
|
|
|
dprintk(0, "ERROR: API Mailbox timeout %x\n", command);
|
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
udelay(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read output values */
|
2006-06-19 03:11:06 +08:00
|
|
|
for (i = 0; i < out; i++) {
|
|
|
|
memory_read(dev->core, dev->mailbox + 4 + i, data + i);
|
|
|
|
dprintk(1, "API Output %d = %d\n", i, data[i]);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
memory_read(dev->core, dev->mailbox + 2, &retval);
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "API result = %d\n", retval);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
flag = 0;
|
|
|
|
memory_write(dev->core, dev->mailbox, flag);
|
|
|
|
return retval;
|
|
|
|
}
|
[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-20 05:27:30 +08:00
|
|
|
|
2006-06-19 03:11:06 +08:00
|
|
|
/* ------------------------------------------------------------------ */
|
2005-04-17 06:20:36 +08: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-20 05:27:30 +08:00
|
|
|
/*
|
|
|
|
* We don't need to call the API often, so using just one mailbox
|
|
|
|
* will probably suffice
|
|
|
|
*/
|
2006-06-19 03:11:06 +08:00
|
|
|
static int blackbird_api_cmd(struct cx8802_dev *dev, u32 command,
|
|
|
|
u32 inputcnt, u32 outputcnt, ...)
|
|
|
|
{
|
|
|
|
u32 data[CX2341X_MBOX_MAX_DATA];
|
|
|
|
va_list vargs;
|
|
|
|
int i, err;
|
|
|
|
|
|
|
|
va_start(vargs, outputcnt);
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
for (i = 0; i < inputcnt; i++)
|
2006-06-19 03:11:06 +08:00
|
|
|
data[i] = va_arg(vargs, int);
|
[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-20 05:27:30 +08:00
|
|
|
|
2006-06-19 03:11:06 +08:00
|
|
|
err = blackbird_mbox_func(dev, command, inputcnt, outputcnt, data);
|
|
|
|
for (i = 0; i < outputcnt; i++) {
|
|
|
|
int *vptr = va_arg(vargs, int *);
|
|
|
|
*vptr = data[i];
|
|
|
|
}
|
|
|
|
va_end(vargs);
|
|
|
|
return err;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static int blackbird_find_mailbox(struct cx8802_dev *dev)
|
|
|
|
{
|
2016-11-16 16:59:49 +08:00
|
|
|
u32 signature[4] = {0x12345678, 0x34567812, 0x56781234, 0x78123456};
|
|
|
|
int signaturecnt = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 value;
|
|
|
|
int i;
|
|
|
|
|
2007-05-31 00:29:32 +08:00
|
|
|
for (i = 0; i < BLACKBIRD_FIRM_IMAGE_SIZE; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
memory_read(dev->core, i, &value);
|
|
|
|
if (value == signature[signaturecnt])
|
|
|
|
signaturecnt++;
|
|
|
|
else
|
|
|
|
signaturecnt = 0;
|
2016-11-16 16:59:49 +08:00
|
|
|
if (signaturecnt == 4) {
|
2005-04-17 06:20:36 +08:00
|
|
|
dprintk(1, "Mailbox signature found\n");
|
[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-20 05:27:30 +08:00
|
|
|
return i + 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
dprintk(0, "Mailbox signature values not found!\n");
|
2014-08-29 16:29:19 +08:00
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int blackbird_load_firmware(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
static const unsigned char magic[8] = {
|
|
|
|
0xa7, 0x0d, 0x00, 0x00, 0x66, 0xbb, 0x55, 0xaa
|
|
|
|
};
|
|
|
|
const struct firmware *firmware;
|
|
|
|
int i, retval = 0;
|
|
|
|
u32 value = 0;
|
|
|
|
u32 checksum = 0;
|
2014-08-29 16:20:44 +08:00
|
|
|
__le32 *dataptr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
retval = register_write(dev->core, IVTV_REG_VPU, 0xFFFFFFED);
|
[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-20 05:27:30 +08:00
|
|
|
retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS,
|
|
|
|
IVTV_CMD_HW_BLOCKS_RST);
|
|
|
|
retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_REFRESH,
|
|
|
|
0x80000640);
|
|
|
|
retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_PRECHARGE,
|
|
|
|
0x1A);
|
|
|
|
usleep_range(10000, 20000);
|
2005-11-09 13:37:43 +08:00
|
|
|
retval |= register_write(dev->core, IVTV_REG_APU, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (retval < 0)
|
|
|
|
dprintk(0, "Error with register_write\n");
|
|
|
|
|
2006-05-22 21:32:00 +08:00
|
|
|
retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME,
|
2005-04-17 06:20:36 +08:00
|
|
|
&dev->pci->dev);
|
2005-12-12 16:37:28 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (retval != 0) {
|
2014-08-29 16:29:19 +08:00
|
|
|
pr_err("Hotplug firmware request failed (%s).\n",
|
2016-11-13 20:07:38 +08:00
|
|
|
CX2341X_FIRM_ENC_FILENAME);
|
2014-08-29 16:29:19 +08:00
|
|
|
pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n");
|
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-05-30 20:39:46 +08:00
|
|
|
if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
|
2014-08-29 16:29:19 +08:00
|
|
|
pr_err("Firmware size mismatch (have %zd, expected %d)\n",
|
2016-11-13 20:07:38 +08:00
|
|
|
firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
|
2006-07-10 19:44:09 +08:00
|
|
|
release_firmware(firmware);
|
2014-08-29 16:29:19 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if (memcmp(firmware->data, magic, 8) != 0) {
|
2014-08-29 16:29:19 +08:00
|
|
|
pr_err("Firmware magic mismatch, wrong file?\n");
|
2006-07-10 19:44:09 +08:00
|
|
|
release_firmware(firmware);
|
2014-08-29 16:29:19 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* transfer to the chip */
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "Loading firmware ...\n");
|
2014-08-29 16:20:44 +08:00
|
|
|
dataptr = (__le32 *)firmware->data;
|
2005-04-17 06:20:36 +08:00
|
|
|
for (i = 0; i < (firmware->size >> 2); i++) {
|
2012-05-26 20:28:02 +08:00
|
|
|
value = le32_to_cpu(*dataptr);
|
2005-04-17 06:20:36 +08:00
|
|
|
checksum += ~value;
|
|
|
|
memory_write(dev->core, i, value);
|
|
|
|
dataptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read back to verify with the checksum */
|
|
|
|
for (i--; i >= 0; i--) {
|
|
|
|
memory_read(dev->core, i, &value);
|
|
|
|
checksum -= ~value;
|
|
|
|
}
|
2014-08-29 16:29:19 +08:00
|
|
|
release_firmware(firmware);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (checksum) {
|
2014-08-29 16:29:19 +08:00
|
|
|
pr_err("Firmware load might have failed (checksum mismatch).\n");
|
|
|
|
return -EIO;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
dprintk(0, "Firmware upload successful.\n");
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS,
|
|
|
|
IVTV_CMD_HW_BLOCKS_RST);
|
2005-11-09 13:37:43 +08:00
|
|
|
retval |= register_read(dev->core, IVTV_REG_SPU, &value);
|
|
|
|
retval |= register_write(dev->core, IVTV_REG_SPU, value & 0xFFFFFFFE);
|
[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-20 05:27:30 +08:00
|
|
|
usleep_range(10000, 20000);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
retval |= register_read(dev->core, IVTV_REG_VPU, &value);
|
2005-11-09 13:37:43 +08:00
|
|
|
retval |= register_write(dev->core, IVTV_REG_VPU, value & 0xFFFFFFE8);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (retval < 0)
|
|
|
|
dprintk(0, "Error with register_write\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
/*
|
|
|
|
* Settings used by the windows tv app for PVR2000:
|
|
|
|
* =================================================================================================================
|
|
|
|
* Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode
|
|
|
|
* -----------------------------------------------------------------------------------------------------------------
|
|
|
|
* MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
|
|
|
|
* MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
|
|
|
|
* VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
|
|
|
|
* DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
|
|
|
|
* DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
|
|
|
|
* =================================================================================================================
|
|
|
|
* [*] DB: "DirectBurn"
|
|
|
|
*/
|
2005-11-09 13:36:17 +08:00
|
|
|
|
2006-06-19 03:11:06 +08:00
|
|
|
static void blackbird_codec_settings(struct cx8802_dev *dev)
|
|
|
|
{
|
2014-09-20 20:23:44 +08:00
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
|
2006-06-19 03:11:06 +08:00
|
|
|
/* assign frame size */
|
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
|
[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-20 05:27:30 +08:00
|
|
|
core->height, core->width);
|
2006-06-19 03:11:06 +08:00
|
|
|
|
2014-09-20 20:23:44 +08:00
|
|
|
dev->cxhdl.width = core->width;
|
|
|
|
dev->cxhdl.height = core->height;
|
[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-20 05:27:30 +08:00
|
|
|
cx2341x_handler_set_50hz(&dev->cxhdl,
|
|
|
|
dev->core->tvnorm & V4L2_STD_625_50);
|
2012-07-02 19:47:11 +08:00
|
|
|
cx2341x_handler_setup(&dev->cxhdl);
|
2006-06-19 03:11:06 +08:00
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static int blackbird_initialize_codec(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
int version;
|
|
|
|
int retval;
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "Initialize codec\n");
|
2006-05-22 21:31:54 +08:00
|
|
|
retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
|
2005-04-17 06:20:36 +08:00
|
|
|
if (retval < 0) {
|
|
|
|
/* ping was not successful, reset and upload firmware */
|
|
|
|
cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */
|
|
|
|
cx_write(MO_SRST_IO, 1); /* SYS_RSTO=1 */
|
|
|
|
retval = blackbird_load_firmware(dev);
|
|
|
|
if (retval < 0)
|
|
|
|
return retval;
|
|
|
|
|
2008-04-26 22:25:18 +08:00
|
|
|
retval = blackbird_find_mailbox(dev);
|
|
|
|
if (retval < 0)
|
2005-04-17 06:20:36 +08:00
|
|
|
return -1;
|
|
|
|
|
2008-04-26 22:25:18 +08:00
|
|
|
dev->mailbox = retval;
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
/* ping */
|
|
|
|
retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (retval < 0) {
|
|
|
|
dprintk(0, "ERROR: Firmware ping failed!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
[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-20 05:27:30 +08:00
|
|
|
retval = blackbird_api_cmd(dev, CX2341X_ENC_GET_VERSION,
|
|
|
|
0, 1, &version);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (retval < 0) {
|
[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-20 05:27:30 +08:00
|
|
|
dprintk(0,
|
|
|
|
"ERROR: Firmware get encoder version failed!\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
dprintk(0, "Firmware version is 0x%08x\n", version);
|
|
|
|
}
|
|
|
|
|
|
|
|
cx_write(MO_PINMUX_IO, 0x88); /* 656-8bit IO and enable MPEG parallel IO */
|
|
|
|
cx_clear(MO_INPUT_FORMAT, 0x100); /* chroma subcarrier lock to normal? */
|
|
|
|
cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */
|
|
|
|
cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */
|
|
|
|
|
|
|
|
blackbird_codec_settings(dev);
|
|
|
|
|
2006-05-22 21:31:54 +08:00
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 0,
|
[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-20 05:27:30 +08:00
|
|
|
BLACKBIRD_FIELD1_SAA7115, BLACKBIRD_FIELD2_SAA7115);
|
2005-06-24 13:05:03 +08:00
|
|
|
|
2006-05-22 21:31:54 +08:00
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_SET_PLACEHOLDER, 12, 0,
|
[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-20 05:27:30 +08:00
|
|
|
BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-05-22 01:36:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static int blackbird_start_codec(struct cx8802_dev *dev)
|
2007-05-22 01:36:01 +08:00
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
/* start capturing to the host interface */
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int lastchange = -1;
|
|
|
|
int lastval = 0;
|
|
|
|
|
2007-12-17 21:35:59 +08:00
|
|
|
for (i = 0; (i < 10) && (i < (lastchange + 4)); i++) {
|
2007-05-22 01:36:01 +08:00
|
|
|
reg = cx_read(AUD_STATUS);
|
|
|
|
|
2007-12-17 21:35:59 +08:00
|
|
|
dprintk(1, "AUD_STATUS:%dL: 0x%x\n", i, reg);
|
|
|
|
if ((reg & 0x0F) != lastval) {
|
2007-05-22 01:36:01 +08:00
|
|
|
lastval = reg & 0x0F;
|
|
|
|
lastchange = i;
|
|
|
|
}
|
|
|
|
msleep(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unmute audio source */
|
|
|
|
cx_clear(AUD_VOL_CTL, (1 << 6));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-12-17 21:35:59 +08:00
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_REFRESH_INPUT, 0, 0);
|
2007-05-22 01:36:01 +08:00
|
|
|
|
|
|
|
/* initialize the video input */
|
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_INITIALIZE_INPUT, 0, 0);
|
|
|
|
|
2012-07-02 19:47:11 +08:00
|
|
|
cx2341x_handler_set_busy(&dev->cxhdl, 1);
|
|
|
|
|
2005-09-10 04:03:41 +08:00
|
|
|
/* start capturing to the host interface */
|
2006-05-22 21:31:54 +08:00
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
|
[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-20 05:27:30 +08:00
|
|
|
BLACKBIRD_MPEG_CAPTURE, BLACKBIRD_RAW_BITS_NONE);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-05-22 01:36:01 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int blackbird_stop_codec(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
|
[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-20 05:27:30 +08:00
|
|
|
BLACKBIRD_END_NOW,
|
|
|
|
BLACKBIRD_MPEG_CAPTURE,
|
|
|
|
BLACKBIRD_RAW_BITS_NONE);
|
2007-05-22 01:36:01 +08:00
|
|
|
|
2012-07-02 19:47:11 +08:00
|
|
|
cx2341x_handler_set_busy(&dev->cxhdl, 0);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2015-10-28 10:50:37 +08: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-20 05:27:30 +08:00
|
|
|
unsigned int *num_buffers, unsigned int *num_planes,
|
|
|
|
unsigned int sizes[], struct device *alloc_devs[])
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = q->drv_priv;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
*num_planes = 1;
|
|
|
|
dev->ts_packet_size = 188 * 4;
|
|
|
|
dev->ts_packet_count = 32;
|
|
|
|
sizes[0] = dev->ts_packet_size * dev->ts_packet_count;
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static int buffer_prepare(struct vb2_buffer *vb)
|
2005-04-17 06:20:36 +08: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 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_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 21:30:30 +08:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2014-09-20 20:22:18 +08:00
|
|
|
|
2014-09-20 20:23:44 +08:00
|
|
|
return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static void buffer_finish(struct vb2_buffer *vb)
|
2005-04-17 06:20:36 +08: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 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_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 21:30:30 +08:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2014-08-29 15:11:54 +08:00
|
|
|
struct cx88_riscmem *risc = &buf->risc;
|
2014-09-20 20:22:18 +08:00
|
|
|
|
2014-08-29 15:11:54 +08:00
|
|
|
if (risc->cpu)
|
|
|
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
|
|
|
memset(risc, 0, sizeof(*risc));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static void buffer_queue(struct vb2_buffer *vb)
|
2005-04-17 06:20:36 +08: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 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_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 21:30:30 +08:00
|
|
|
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
|
2014-09-20 20:22:18 +08:00
|
|
|
|
|
|
|
cx8802_buf_queue(dev, buf);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static int start_streaming(struct vb2_queue *q, unsigned int count)
|
|
|
|
{
|
|
|
|
struct cx8802_dev *dev = q->drv_priv;
|
|
|
|
struct cx88_dmaqueue *dmaq = &dev->mpegq;
|
|
|
|
struct cx8802_driver *drv;
|
|
|
|
struct cx88_buffer *buf;
|
|
|
|
unsigned long flags;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/* Make sure we can acquire the hardware */
|
|
|
|
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
|
|
|
|
if (!drv) {
|
|
|
|
dprintk(1, "%s: blackbird driver is not loaded\n", __func__);
|
|
|
|
err = -ENODEV;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = drv->request_acquire(drv);
|
|
|
|
if (err != 0) {
|
[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-20 05:27:30 +08:00
|
|
|
dprintk(1, "%s: Unable to acquire hardware, %d\n", __func__,
|
|
|
|
err);
|
2014-09-20 20:22:18 +08:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (blackbird_initialize_codec(dev) < 0) {
|
|
|
|
drv->request_release(drv);
|
|
|
|
err = -EINVAL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = blackbird_start_codec(dev);
|
|
|
|
if (err == 0) {
|
|
|
|
buf = list_entry(dmaq->active.next, struct cx88_buffer, list);
|
|
|
|
cx8802_start_dma(dev, dmaq, buf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
fail:
|
|
|
|
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 21:30:30 +08:00
|
|
|
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
|
2014-09-20 20:22:18 +08:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void stop_streaming(struct vb2_queue *q)
|
|
|
|
{
|
|
|
|
struct cx8802_dev *dev = q->drv_priv;
|
|
|
|
struct cx88_dmaqueue *dmaq = &dev->mpegq;
|
|
|
|
struct cx8802_driver *drv = NULL;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
cx8802_cancel_buffers(dev);
|
|
|
|
blackbird_stop_codec(dev);
|
|
|
|
|
|
|
|
/* Make sure we release the hardware */
|
|
|
|
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
|
|
|
|
WARN_ON(!drv);
|
|
|
|
if (drv)
|
|
|
|
drv->request_release(drv);
|
|
|
|
|
|
|
|
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 21:30:30 +08:00
|
|
|
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
2014-09-20 20:22:18 +08:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
|
|
|
}
|
|
|
|
|
2016-09-09 07:59:18 +08:00
|
|
|
static const struct vb2_ops blackbird_qops = {
|
2014-09-20 20:22:18 +08:00
|
|
|
.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,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2012-05-10 03:23:07 +08:00
|
|
|
static int vidioc_querycap(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-20 05:27:30 +08:00
|
|
|
struct v4l2_capability *cap)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2018-09-11 04:20:42 +08:00
|
|
|
strscpy(cap->driver, "cx88_blackbird", sizeof(cap->driver));
|
2012-05-10 03:23:07 +08:00
|
|
|
sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
|
2017-09-29 06:39:32 +08:00
|
|
|
return cx88_querycap(file, core, cap);
|
2007-01-21 00:59:38 +08:00
|
|
|
}
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_enum_fmt_vid_cap(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-20 05:27:30 +08:00
|
|
|
struct v4l2_fmtdesc *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
|
|
|
if (f->index != 0)
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2018-09-10 20:19:14 +08:00
|
|
|
strscpy(f->description, "MPEG", sizeof(f->description));
|
2007-01-21 00:59:38 +08:00
|
|
|
f->pixelformat = V4L2_PIX_FMT_MPEG;
|
2012-05-25 23:04:10 +08:00
|
|
|
f->flags = V4L2_FMT_FLAG_COMPRESSED;
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-09-20 20:23:44 +08:00
|
|
|
static int vidioc_g_fmt_vid_cap(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-20 05:27:30 +08:00
|
|
|
struct v4l2_format *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
2014-09-20 20:23:44 +08:00
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:59:38 +08:00
|
|
|
|
|
|
|
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
|
|
|
f->fmt.pix.bytesperline = 0;
|
2014-09-20 20:22:18 +08:00
|
|
|
f->fmt.pix.sizeimage = dev->ts_packet_size * dev->ts_packet_count;
|
2012-05-25 23:04:10 +08:00
|
|
|
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
|
2014-09-20 20:23:44 +08:00
|
|
|
f->fmt.pix.width = core->width;
|
|
|
|
f->fmt.pix.height = core->height;
|
|
|
|
f->fmt.pix.field = core->field;
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2005-09-10 04:03:41 +08:00
|
|
|
|
2014-09-20 20:23:44 +08:00
|
|
|
static int vidioc_try_fmt_vid_cap(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-20 05:27:30 +08:00
|
|
|
struct v4l2_format *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
2014-09-20 20:23:44 +08:00
|
|
|
struct cx88_core *core = dev->core;
|
2016-11-16 16:59:49 +08:00
|
|
|
unsigned int maxw, maxh;
|
2014-09-20 20:23:44 +08:00
|
|
|
enum v4l2_field field;
|
2007-01-21 00:59:38 +08:00
|
|
|
|
|
|
|
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
|
|
|
|
f->fmt.pix.bytesperline = 0;
|
2014-09-20 20:22:18 +08:00
|
|
|
f->fmt.pix.sizeimage = dev->ts_packet_size * dev->ts_packet_count;
|
2012-05-25 23:04:10 +08:00
|
|
|
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
|
2014-09-20 20:23:44 +08:00
|
|
|
|
|
|
|
maxw = norm_maxw(core->tvnorm);
|
|
|
|
maxh = norm_maxh(core->tvnorm);
|
|
|
|
|
|
|
|
field = f->fmt.pix.field;
|
|
|
|
|
|
|
|
switch (field) {
|
|
|
|
case V4L2_FIELD_TOP:
|
|
|
|
case V4L2_FIELD_BOTTOM:
|
|
|
|
case V4L2_FIELD_INTERLACED:
|
|
|
|
case V4L2_FIELD_SEQ_BT:
|
|
|
|
case V4L2_FIELD_SEQ_TB:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
field = (f->fmt.pix.height > maxh / 2)
|
|
|
|
? V4L2_FIELD_INTERLACED
|
|
|
|
: V4L2_FIELD_BOTTOM;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (V4L2_FIELD_HAS_T_OR_B(field))
|
|
|
|
maxh /= 2;
|
|
|
|
|
|
|
|
v4l_bound_align_image(&f->fmt.pix.width, 48, maxw, 2,
|
|
|
|
&f->fmt.pix.height, 32, maxh, 0, 0);
|
|
|
|
f->fmt.pix.field = field;
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2005-09-10 04:03:41 +08:00
|
|
|
|
2014-09-20 20:23:44 +08:00
|
|
|
static int vidioc_s_fmt_vid_cap(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-20 05:27:30 +08:00
|
|
|
struct v4l2_format *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
2007-01-21 00:59:38 +08:00
|
|
|
struct cx88_core *core = dev->core;
|
2005-09-10 04:03:41 +08:00
|
|
|
|
2014-08-29 17:08:07 +08:00
|
|
|
if (vb2_is_busy(&dev->vb2_mpegq))
|
|
|
|
return -EBUSY;
|
|
|
|
if (core->v4ldev && (vb2_is_busy(&core->v4ldev->vb2_vidq) ||
|
|
|
|
vb2_is_busy(&core->v4ldev->vb2_vbiq)))
|
|
|
|
return -EBUSY;
|
2014-09-20 20:23:44 +08:00
|
|
|
vidioc_try_fmt_vid_cap(file, priv, f);
|
|
|
|
core->width = f->fmt.pix.width;
|
|
|
|
core->height = f->fmt.pix.height;
|
|
|
|
core->field = f->fmt.pix.field;
|
[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-20 05:27:30 +08:00
|
|
|
cx88_set_scale(core, f->fmt.pix.width, f->fmt.pix.height,
|
|
|
|
f->fmt.pix.field);
|
2007-01-21 00:59:38 +08:00
|
|
|
blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
|
[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-20 05:27:30 +08:00
|
|
|
f->fmt.pix.height, f->fmt.pix.width);
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_s_frequency(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-20 05:27:30 +08:00
|
|
|
const struct v4l2_frequency *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2014-08-29 17:06:37 +08:00
|
|
|
bool streaming;
|
2007-01-21 00:59:22 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if (unlikely(core->board.tuner_type == UNSET))
|
2012-05-25 23:04:10 +08:00
|
|
|
return -EINVAL;
|
|
|
|
if (unlikely(f->tuner != 0))
|
|
|
|
return -EINVAL;
|
2014-11-11 00:55:54 +08:00
|
|
|
streaming = vb2_start_streaming_called(&dev->vb2_mpegq);
|
2014-08-29 17:06:37 +08:00
|
|
|
if (streaming)
|
2007-05-22 01:36:01 +08:00
|
|
|
blackbird_stop_codec(dev);
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_set_freq(core, f);
|
2007-01-21 00:59:38 +08:00
|
|
|
blackbird_initialize_codec(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-20 05:27:30 +08:00
|
|
|
cx88_set_scale(core, core->width, core->height, core->field);
|
2014-08-29 17:06:37 +08:00
|
|
|
if (streaming)
|
|
|
|
blackbird_start_codec(dev);
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2007-01-21 00:59:22 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_log_status(struct file *file, void *priv)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:59:38 +08:00
|
|
|
char name[32 + 2];
|
|
|
|
|
|
|
|
snprintf(name, sizeof(name), "%s/2", core->name);
|
2009-03-29 19:26:01 +08:00
|
|
|
call_all(core, core, log_status);
|
2012-07-02 19:47:11 +08:00
|
|
|
v4l2_ctrl_handler_log_status(&dev->cxhdl.hdl, name);
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2007-01-21 00:59:22 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_enum_input(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-20 05:27:30 +08:00
|
|
|
struct v4l2_input *i)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2016-11-16 16:59:49 +08:00
|
|
|
|
|
|
|
return cx88_enum_input(core, i);
|
2007-01-21 00:59:38 +08:00
|
|
|
}
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_g_frequency(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-20 05:27:30 +08:00
|
|
|
struct v4l2_frequency *f)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if (unlikely(core->board.tuner_type == UNSET))
|
2007-01-21 00:59:38 +08:00
|
|
|
return -EINVAL;
|
2012-05-25 23:04:10 +08:00
|
|
|
if (unlikely(f->tuner != 0))
|
|
|
|
return -EINVAL;
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2007-01-21 00:59:38 +08:00
|
|
|
f->frequency = core->freq;
|
2009-03-29 19:26:01 +08:00
|
|
|
call_all(core, tuner, g_frequency, f);
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:59:22 +08:00
|
|
|
|
2007-01-21 00:59:38 +08:00
|
|
|
*i = core->input;
|
|
|
|
return 0;
|
|
|
|
}
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:58:39 +08:00
|
|
|
|
2007-01-21 00:59:38 +08:00
|
|
|
if (i >= 4)
|
|
|
|
return -EINVAL;
|
[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-20 05:27:30 +08:00
|
|
|
if (!INPUT(i).type)
|
2012-05-25 23:04:10 +08:00
|
|
|
return -EINVAL;
|
2007-01-21 00:59:38 +08:00
|
|
|
|
|
|
|
cx88_newstation(core);
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_video_mux(core, i);
|
2007-01-21 00:58:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_g_tuner(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-20 05:27:30 +08:00
|
|
|
struct v4l2_tuner *t)
|
2007-01-21 00:59:38 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:59:38 +08:00
|
|
|
u32 reg;
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if (unlikely(core->board.tuner_type == UNSET))
|
2007-01-21 00:59:38 +08:00
|
|
|
return -EINVAL;
|
2016-11-16 16:59:49 +08:00
|
|
|
if (t->index != 0)
|
2007-05-22 01:56:17 +08:00
|
|
|
return -EINVAL;
|
2007-01-21 00:59:38 +08:00
|
|
|
|
2018-09-11 04:20:42 +08:00
|
|
|
strscpy(t->name, "Television", sizeof(t->name));
|
2007-01-21 00:59:38 +08:00
|
|
|
t->capability = V4L2_TUNER_CAP_NORM;
|
|
|
|
t->rangehigh = 0xffffffffUL;
|
2012-05-25 23:04:10 +08:00
|
|
|
call_all(core, tuner, g_tuner, t);
|
2007-01-21 00:59:38 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_get_stereo(core, t);
|
2007-01-21 00:59:38 +08:00
|
|
|
reg = cx_read(MO_DEVICE_STATUS);
|
[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-20 05:27:30 +08:00
|
|
|
t->signal = (reg & (1 << 5)) ? 0xffff : 0x0000;
|
2007-01-21 00:59:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static int vidioc_s_tuner(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-20 05:27:30 +08:00
|
|
|
const struct v4l2_tuner *t)
|
2005-09-10 04:03:41 +08:00
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2007-01-21 00:59:38 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if (core->board.tuner_type == UNSET)
|
2007-01-21 00:59:38 +08:00
|
|
|
return -EINVAL;
|
2016-11-16 16:59:49 +08:00
|
|
|
if (t->index != 0)
|
2007-01-21 00:59:38 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
cx88_set_stereo(core, t->audmode, 1);
|
|
|
|
return 0;
|
2005-09-10 04:03:41 +08:00
|
|
|
}
|
|
|
|
|
2012-05-25 23:15:30 +08:00
|
|
|
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorm)
|
|
|
|
{
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
|
|
|
struct cx88_core *core = dev->core;
|
2012-05-25 23:15:30 +08:00
|
|
|
|
|
|
|
*tvnorm = core->tvnorm;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-15 17:10:40 +08:00
|
|
|
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-12-10 21:44:04 +08:00
|
|
|
struct cx8802_dev *dev = video_drvdata(file);
|
2014-09-20 20:22:18 +08:00
|
|
|
struct cx88_core *core = dev->core;
|
2011-05-01 17:29:37 +08:00
|
|
|
|
2014-08-29 17:08:07 +08:00
|
|
|
return cx88_set_tvnorm(core, id);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static const struct v4l2_file_operations mpeg_fops = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.owner = THIS_MODULE,
|
2014-09-20 20:22:18 +08:00
|
|
|
.open = v4l2_fh_open,
|
|
|
|
.release = vb2_fop_release,
|
|
|
|
.read = vb2_fop_read,
|
|
|
|
.poll = vb2_fop_poll,
|
|
|
|
.mmap = vb2_fop_mmap,
|
2012-05-25 23:30:18 +08:00
|
|
|
.unlocked_ioctl = video_ioctl2,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-07-21 13:57:38 +08:00
|
|
|
static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
|
2007-01-21 00:59:38 +08:00
|
|
|
.vidioc_querycap = vidioc_querycap,
|
2008-05-28 23:16:41 +08:00
|
|
|
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
|
|
|
|
.vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
|
|
|
|
.vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
|
|
|
|
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
|
2014-09-20 20:22:18 +08:00
|
|
|
.vidioc_reqbufs = vb2_ioctl_reqbufs,
|
|
|
|
.vidioc_querybuf = vb2_ioctl_querybuf,
|
|
|
|
.vidioc_qbuf = vb2_ioctl_qbuf,
|
|
|
|
.vidioc_dqbuf = vb2_ioctl_dqbuf,
|
|
|
|
.vidioc_streamon = vb2_ioctl_streamon,
|
|
|
|
.vidioc_streamoff = vb2_ioctl_streamoff,
|
2007-01-21 00:59:38 +08:00
|
|
|
.vidioc_s_frequency = vidioc_s_frequency,
|
|
|
|
.vidioc_log_status = vidioc_log_status,
|
|
|
|
.vidioc_enum_input = vidioc_enum_input,
|
|
|
|
.vidioc_g_frequency = vidioc_g_frequency,
|
|
|
|
.vidioc_g_input = vidioc_g_input,
|
|
|
|
.vidioc_s_input = vidioc_s_input,
|
|
|
|
.vidioc_g_tuner = vidioc_g_tuner,
|
|
|
|
.vidioc_s_tuner = vidioc_s_tuner,
|
2012-05-25 23:15:30 +08:00
|
|
|
.vidioc_g_std = vidioc_g_std,
|
2007-01-21 00:59:38 +08:00
|
|
|
.vidioc_s_std = vidioc_s_std,
|
2012-05-11 22:25:03 +08:00
|
|
|
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
|
|
|
|
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
|
2008-07-21 13:57:38 +08:00
|
|
|
};
|
|
|
|
|
2017-08-26 21:08:11 +08:00
|
|
|
static const struct video_device cx8802_mpeg_template = {
|
2008-07-21 13:57:38 +08:00
|
|
|
.name = "cx8802",
|
|
|
|
.fops = &mpeg_fops,
|
2016-11-16 16:59:49 +08:00
|
|
|
.ioctl_ops = &mpeg_ioctl_ops,
|
2007-01-21 00:59:38 +08:00
|
|
|
.tvnorms = CX88_NORMS,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
/* The CX8802 MPEG API will call this when we can use the hardware */
|
|
|
|
static int cx8802_blackbird_advise_acquire(struct cx8802_driver *drv)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = drv->core;
|
|
|
|
int err = 0;
|
|
|
|
|
2007-08-16 01:41:57 +08:00
|
|
|
switch (core->boardnr) {
|
2006-12-03 07:15:51 +08:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR1300:
|
[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-20 05:27:30 +08:00
|
|
|
/*
|
|
|
|
* By default, core setup will leave the cx22702 out of reset,
|
|
|
|
* on the bus.
|
2006-12-03 07:15:51 +08:00
|
|
|
* We left the hardware on power up with the cx22702 active.
|
|
|
|
* We're being given access to re-arrange the GPIOs.
|
|
|
|
* Take the bus off the cx22702 and put the cx23416 on it.
|
|
|
|
*/
|
2008-12-18 17:28:35 +08:00
|
|
|
/* Toggle reset on cx22702 leaving i2c active */
|
|
|
|
cx_set(MO_GP0_IO, 0x00000080);
|
|
|
|
udelay(1000);
|
|
|
|
cx_clear(MO_GP0_IO, 0x00000080);
|
|
|
|
udelay(50);
|
|
|
|
cx_set(MO_GP0_IO, 0x00000080);
|
|
|
|
udelay(1000);
|
|
|
|
/* tri-state the cx22702 pins */
|
|
|
|
cx_set(MO_GP0_IO, 0x00000004);
|
|
|
|
udelay(1000);
|
2006-12-03 07:15:51 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
err = -ENODEV;
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The CX8802 MPEG API will call this when we need to release the hardware */
|
|
|
|
static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = drv->core;
|
|
|
|
int err = 0;
|
|
|
|
|
2007-08-16 01:41:57 +08:00
|
|
|
switch (core->boardnr) {
|
2006-12-03 07:15:51 +08:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR1300:
|
|
|
|
/* Exit leaving the cx23416 on the bus */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
err = -ENODEV;
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static void blackbird_unregister_video(struct cx8802_dev *dev)
|
|
|
|
{
|
2015-03-10 00:34:00 +08:00
|
|
|
video_unregister_device(&dev->mpeg_dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int blackbird_register_video(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2015-03-10 00:34:00 +08:00
|
|
|
cx88_vdev_init(dev->core, dev->pci, &dev->mpeg_dev,
|
|
|
|
&cx8802_mpeg_template, "mpeg");
|
|
|
|
dev->mpeg_dev.ctrl_handler = &dev->cxhdl.hdl;
|
|
|
|
video_set_drvdata(&dev->mpeg_dev, dev);
|
|
|
|
dev->mpeg_dev.queue = &dev->vb2_mpegq;
|
|
|
|
err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (err < 0) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("can't register mpeg device\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
return err;
|
|
|
|
}
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("registered device %s [mpeg]\n",
|
|
|
|
video_device_node_name(&dev->mpeg_dev));
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
static int cx8802_blackbird_probe(struct cx8802_driver *drv)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-12-03 07:15:51 +08:00
|
|
|
struct cx88_core *core = drv->core;
|
|
|
|
struct cx8802_dev *dev = core->dvbdev;
|
2014-09-20 20:22:18 +08:00
|
|
|
struct vb2_queue *q;
|
2005-04-17 06:20:36 +08:00
|
|
|
int err;
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "%s\n", __func__);
|
|
|
|
dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
|
2007-08-16 01:41:57 +08:00
|
|
|
core->boardnr,
|
2006-12-03 07:15:51 +08:00
|
|
|
core->name,
|
|
|
|
core->pci_bus,
|
|
|
|
core->pci_slot);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
err = -ENODEV;
|
2007-08-16 01:41:57 +08:00
|
|
|
if (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))
|
2005-04-17 06:20:36 +08:00
|
|
|
goto fail_core;
|
|
|
|
|
2012-07-02 19:47:11 +08:00
|
|
|
dev->cxhdl.port = CX2341X_PORT_STREAMING;
|
2014-09-20 20:23:44 +08:00
|
|
|
dev->cxhdl.width = core->width;
|
|
|
|
dev->cxhdl.height = core->height;
|
2012-07-02 19:47:11 +08:00
|
|
|
dev->cxhdl.func = blackbird_mbox_func;
|
|
|
|
dev->cxhdl.priv = dev;
|
|
|
|
err = cx2341x_handler_init(&dev->cxhdl, 36);
|
|
|
|
if (err)
|
|
|
|
goto fail_core;
|
2018-05-21 16:54:36 +08:00
|
|
|
v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL, false);
|
2006-01-10 01:25:17 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* blackbird stuff */
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("cx23416 based mpeg encoder (blackbird reference design)\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
host_setup(dev->core);
|
|
|
|
|
2007-05-22 01:36:01 +08:00
|
|
|
blackbird_initialize_codec(dev);
|
2005-09-10 04:03:41 +08:00
|
|
|
|
|
|
|
/* initial device configuration: needed ? */
|
2007-01-21 00:59:38 +08:00
|
|
|
// init_controls(core);
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_set_tvnorm(core, core->tvnorm);
|
|
|
|
cx88_video_mux(core, 0);
|
2014-09-20 20:23:44 +08:00
|
|
|
cx2341x_handler_set_50hz(&dev->cxhdl, core->height == 576);
|
2012-07-02 19:47:11 +08:00
|
|
|
cx2341x_handler_setup(&dev->cxhdl);
|
2014-09-20 20:22:18 +08:00
|
|
|
|
|
|
|
q = &dev->vb2_mpegq;
|
|
|
|
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
|
|
|
q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
|
|
|
|
q->gfp_flags = GFP_DMA32;
|
|
|
|
q->min_buffers_needed = 2;
|
|
|
|
q->drv_priv = dev;
|
|
|
|
q->buf_struct_size = sizeof(struct cx88_buffer);
|
|
|
|
q->ops = &blackbird_qops;
|
|
|
|
q->mem_ops = &vb2_dma_sg_memops;
|
|
|
|
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
|
|
|
|
q->lock = &core->lock;
|
2016-02-15 22:37:15 +08:00
|
|
|
q->dev = &dev->pci->dev;
|
2014-09-20 20:22:18 +08:00
|
|
|
|
|
|
|
err = vb2_queue_init(q);
|
|
|
|
if (err < 0)
|
|
|
|
goto fail_core;
|
|
|
|
|
2012-07-02 19:47:11 +08:00
|
|
|
blackbird_register_video(dev);
|
2005-09-10 04:03:41 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
fail_core:
|
2005-04-17 06:20:36 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
static int cx8802_blackbird_remove(struct cx8802_driver *drv)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-07-02 19:47:11 +08:00
|
|
|
struct cx88_core *core = drv->core;
|
|
|
|
struct cx8802_dev *dev = core->dvbdev;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* blackbird */
|
2006-12-03 07:15:51 +08:00
|
|
|
blackbird_unregister_video(drv->core->dvbdev);
|
2012-07-02 19:47:11 +08:00
|
|
|
v4l2_ctrl_handler_free(&dev->cxhdl.hdl);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
static struct cx8802_driver cx8802_blackbird_driver = {
|
|
|
|
.type_id = CX88_MPEG_BLACKBIRD,
|
|
|
|
.hw_access = CX8802_DRVCTL_SHARED,
|
|
|
|
.probe = cx8802_blackbird_probe,
|
|
|
|
.remove = cx8802_blackbird_remove,
|
|
|
|
.advise_acquire = cx8802_blackbird_advise_acquire,
|
|
|
|
.advise_release = cx8802_blackbird_advise_release,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-07-17 07:00:01 +08:00
|
|
|
static int __init blackbird_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("cx2388x blackbird driver version %s loaded\n",
|
|
|
|
CX88_VERSION);
|
2006-12-03 07:15:51 +08:00
|
|
|
return cx8802_register_driver(&cx8802_blackbird_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-07-17 07:00:01 +08:00
|
|
|
static void __exit blackbird_fini(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-12-03 07:15:51 +08:00
|
|
|
cx8802_unregister_driver(&cx8802_blackbird_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(blackbird_init);
|
|
|
|
module_exit(blackbird_fini);
|