2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Support for the mpeg transport stream transfers
|
|
|
|
* PCI function #2 of the cx2388x.
|
|
|
|
*
|
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 Chris Pascoe <c.pascoe@itee.uq.edu.au>
|
|
|
|
* (c) 2004 Gerd Knorr <kraxel@bytesex.org>
|
|
|
|
*
|
|
|
|
* 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 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/init.h>
|
|
|
|
#include <linux/device.h>
|
2007-05-07 05:51:55 +08:00
|
|
|
#include <linux/dma-mapping.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/interrupt.h>
|
[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
|
|
|
#include <linux/delay.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("mpeg driver for cx2388x based TV cards");
|
2008-11-20 18:07:45 +08:00
|
|
|
MODULE_AUTHOR("Jelle Foks <jelle@foks.us>");
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
|
|
|
|
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
|
|
|
|
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 [mpeg]");
|
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: mpeg:" fmt), \
|
|
|
|
__func__, ##arg); \
|
|
|
|
} while (0)
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2007-04-27 23:31:06 +08:00
|
|
|
#if defined(CONFIG_MODULES) && defined(MODULE)
|
|
|
|
static void request_module_async(struct work_struct *work)
|
|
|
|
{
|
[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 cx8802_dev *dev = container_of(work, struct cx8802_dev,
|
|
|
|
request_module_wk);
|
2007-04-27 23:31:07 +08:00
|
|
|
|
2007-08-16 01:41:57 +08:00
|
|
|
if (dev->core->board.mpeg & CX88_MPEG_DVB)
|
2007-04-27 23:31:06 +08:00
|
|
|
request_module("cx88-dvb");
|
2007-08-16 01:41:57 +08:00
|
|
|
if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD)
|
2007-04-27 23:31:07 +08:00
|
|
|
request_module("cx88-blackbird");
|
2007-04-27 23:31:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void request_modules(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
INIT_WORK(&dev->request_module_wk, request_module_async);
|
|
|
|
schedule_work(&dev->request_module_wk);
|
|
|
|
}
|
2010-12-24 23:14:20 +08:00
|
|
|
|
|
|
|
static void flush_request_modules(struct cx8802_dev *dev)
|
|
|
|
{
|
2012-08-21 05:51:24 +08:00
|
|
|
flush_work(&dev->request_module_wk);
|
2010-12-24 23:14:20 +08:00
|
|
|
}
|
2007-04-27 23:31:06 +08:00
|
|
|
#else
|
|
|
|
#define request_modules(dev)
|
2010-12-24 23:14:20 +08:00
|
|
|
#define flush_request_modules(dev)
|
2007-04-27 23:31:06 +08:00
|
|
|
#endif /* CONFIG_MODULES */
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
static LIST_HEAD(cx8802_devlist);
|
2011-05-01 17:30:14 +08:00
|
|
|
static DEFINE_MUTEX(cx8802_mutex);
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
int cx8802_start_dma(struct cx8802_dev *dev,
|
[media] cx88: make checkpatch.pl happy
Usually, I don't like fixing coding style issues on non-staging
drivers, as it could be a mess pretty easy, and could become like
a snow ball. That's the case of recent changes on two changesets:
they disalign some statements. Yet, a care a lot with cx88 driver,
as it was the first driver I touched at the Kernel, and I've been
maintaining it since 2005. So, several of the coding style issues
were due to my code.
Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with
fixed several other issues, did some function alinments, but broke
other alinments.
So, I had to manually apply another round of manual fixes to make
sure that everything is ok, and to make checkpatch happy with
this patch.
With this patch, checkpatch.pl is now happy when called with:
./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL
Also, the 80-cols violations that made sense were fixed.
Checkpatch would be happier if we convert it to use dev_foo(),
but this is a more complex change.
NOTE: there are some places with msleep(1). As this driver was
written at the time that the default was to sleep at least 10ms
on such calls (e. g. CONFIG_HZ=100), I replaced those calls by
usleep_range(10000, 20000), with should be safe to avoid breakages.
Fixes: 65bc2fe86e66 ("[media] cx88: convert it to use pr_foo() macros")
Fixes: 7b61ba8ff838 ("[media] cx88: make checkpatch happier")
Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-20 05:27:30 +08:00
|
|
|
struct cx88_dmaqueue *q,
|
|
|
|
struct cx88_buffer *buf)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "w: %d, h: %d, f: %d\n",
|
2014-09-20 20:23:44 +08:00
|
|
|
core->width, core->height, core->field);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* setup fifo + format */
|
|
|
|
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28],
|
|
|
|
dev->ts_packet_size, buf->risc.dma);
|
|
|
|
|
|
|
|
/* write TS length to chip */
|
2014-09-20 20:22:18 +08:00
|
|
|
cx_write(MO_TS_LNGTH, dev->ts_packet_size);
|
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
|
|
|
/*
|
|
|
|
* FIXME: this needs a review.
|
|
|
|
* also: move to cx88-blackbird + cx88-dvb source files?
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "core->active_type_id = 0x%08x\n", core->active_type_id);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
if ((core->active_type_id == CX88_MPEG_DVB) &&
|
[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->board.mpeg & CX88_MPEG_DVB)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "cx8802_start_dma doing .dvb\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
/* negedge driven & software reset */
|
2005-07-08 08:58:39 +08:00
|
|
|
cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl);
|
2005-04-17 06:20:36 +08:00
|
|
|
udelay(100);
|
|
|
|
cx_write(MO_PINMUX_IO, 0x00);
|
[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
|
|
|
cx_write(TS_HW_SOP_CNTRL, 0x47 << 16 | 188 << 4 | 0x01);
|
2007-08-16 01:41:57 +08:00
|
|
|
switch (core->boardnr) {
|
2005-09-10 04:03:41 +08:00
|
|
|
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
|
|
|
|
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
|
|
|
|
case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
|
2006-04-07 13:21:31 +08:00
|
|
|
case CX88_BOARD_PCHDTV_HD5500:
|
[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
|
|
|
cx_write(TS_SOP_STAT, 1 << 13);
|
2005-09-10 04:03:41 +08:00
|
|
|
break;
|
2010-02-12 05:06:34 +08:00
|
|
|
case CX88_BOARD_SAMSUNG_SMT_7020:
|
|
|
|
cx_write(TS_SOP_STAT, 0x00);
|
|
|
|
break;
|
2006-01-10 01:25:02 +08:00
|
|
|
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
|
|
|
|
case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
|
[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
|
|
|
/* Enable MPEG parallel IO and video signal pins */
|
|
|
|
cx_write(MO_PINMUX_IO, 0x88);
|
2006-01-10 01:25:02 +08:00
|
|
|
udelay(100);
|
|
|
|
break;
|
2006-12-03 07:15:51 +08:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR1300:
|
2009-07-26 22:06:20 +08:00
|
|
|
/* Enable MPEG parallel IO and video signal pins */
|
|
|
|
cx_write(MO_PINMUX_IO, 0x88);
|
|
|
|
cx_write(TS_SOP_STAT, 0);
|
|
|
|
cx_write(TS_VALERR_CNTRL, 0);
|
2006-12-03 07:15:51 +08:00
|
|
|
break;
|
2008-01-06 03:53:01 +08:00
|
|
|
case CX88_BOARD_PINNACLE_PCTV_HD_800i:
|
2008-01-16 08:57:14 +08:00
|
|
|
/* Enable MPEG parallel IO and video signal pins */
|
|
|
|
cx_write(MO_PINMUX_IO, 0x88);
|
|
|
|
cx_write(TS_HW_SOP_CNTRL, (0x47 << 16) | (188 << 4));
|
|
|
|
dev->ts_gen_cntrl = 5;
|
|
|
|
cx_write(TS_SOP_STAT, 0);
|
|
|
|
cx_write(TS_VALERR_CNTRL, 0);
|
2008-01-06 03:53:01 +08:00
|
|
|
udelay(100);
|
|
|
|
break;
|
2005-09-10 04:03:41 +08:00
|
|
|
default:
|
2005-07-13 04:58:44 +08:00
|
|
|
cx_write(TS_SOP_STAT, 0x00);
|
2005-09-10 04:03:41 +08:00
|
|
|
break;
|
2005-07-08 08:58:39 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
|
|
|
|
udelay(100);
|
2016-11-16 16:59:49 +08:00
|
|
|
} else if ((core->active_type_id == CX88_MPEG_BLACKBIRD) &&
|
|
|
|
(core->board.mpeg & CX88_MPEG_BLACKBIRD)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "cx8802_start_dma doing .blackbird\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
|
|
|
|
|
[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
|
|
|
/* punctured clock TS & posedge driven & software reset */
|
|
|
|
cx_write(TS_GEN_CNTRL, 0x46);
|
2005-04-17 06:20:36 +08:00
|
|
|
udelay(100);
|
|
|
|
|
|
|
|
cx_write(TS_HW_SOP_CNTRL, 0x408); /* mpeg start byte */
|
|
|
|
cx_write(TS_VALERR_CNTRL, 0x2000);
|
|
|
|
|
[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
|
|
|
/* punctured clock TS & posedge driven */
|
|
|
|
cx_write(TS_GEN_CNTRL, 0x06);
|
2005-04-17 06:20:36 +08:00
|
|
|
udelay(100);
|
2006-12-03 07:15:51 +08:00
|
|
|
} else {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("%s() Failed. Unsupported value in .mpeg (0x%08x)\n",
|
|
|
|
__func__, core->board.mpeg);
|
2006-12-03 07:15:51 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* reset counter */
|
|
|
|
cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET);
|
2015-04-03 18:22:40 +08:00
|
|
|
q->count = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* enable irqs */
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "setting the interrupt mask\n");
|
2007-08-18 17:57:55 +08:00
|
|
|
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT);
|
2005-06-24 13:05:03 +08:00
|
|
|
cx_set(MO_TS_INTMSK, 0x1f0011);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* start dma */
|
[media] cx88: make checkpatch.pl happy
Usually, I don't like fixing coding style issues on non-staging
drivers, as it could be a mess pretty easy, and could become like
a snow ball. That's the case of recent changes on two changesets:
they disalign some statements. Yet, a care a lot with cx88 driver,
as it was the first driver I touched at the Kernel, and I've been
maintaining it since 2005. So, several of the coding style issues
were due to my code.
Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with
fixed several other issues, did some function alinments, but broke
other alinments.
So, I had to manually apply another round of manual fixes to make
sure that everything is ok, and to make checkpatch happy with
this patch.
With this patch, checkpatch.pl is now happy when called with:
./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL
Also, the 80-cols violations that made sense were fixed.
Checkpatch would be happier if we convert it to use dev_foo(),
but this is a more complex change.
NOTE: there are some places with msleep(1). As this driver was
written at the time that the default was to sleep at least 10ms
on such calls (e. g. CONFIG_HZ=100), I replaced those calls by
usleep_range(10000, 20000), with should be safe to avoid breakages.
Fixes: 65bc2fe86e66 ("[media] cx88: convert it to use pr_foo() macros")
Fixes: 7b61ba8ff838 ("[media] cx88: make checkpatch happier")
Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-20 05:27:30 +08:00
|
|
|
cx_set(MO_DEV_CNTRL2, (1 << 5));
|
2005-06-24 13:05:03 +08:00
|
|
|
cx_set(MO_TS_DMACNTRL, 0x11);
|
2005-04-17 06:20:36 +08:00
|
|
|
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
|
|
|
EXPORT_SYMBOL(cx8802_start_dma);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static int cx8802_stop_dma(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
2016-11-16 16:59:49 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* stop dma */
|
|
|
|
cx_clear(MO_TS_DMACNTRL, 0x11);
|
|
|
|
|
|
|
|
/* disable irqs */
|
2007-08-18 17:57:55 +08:00
|
|
|
cx_clear(MO_PCI_INTMSK, PCI_INT_TSINT);
|
2005-04-17 06:20:36 +08:00
|
|
|
cx_clear(MO_TS_INTMSK, 0x1f0011);
|
|
|
|
|
|
|
|
/* Reset the controller */
|
|
|
|
cx_write(TS_GEN_CNTRL, 0xcd);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cx8802_restart_queue(struct cx8802_dev *dev,
|
|
|
|
struct cx88_dmaqueue *q)
|
|
|
|
{
|
|
|
|
struct cx88_buffer *buf;
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
if (list_empty(&q->active))
|
|
|
|
return 0;
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
buf = list_entry(q->active.next, struct cx88_buffer, list);
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(2, "restart_queue [%p/%d]: restart dma\n",
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
buf, buf->vb.vb2_buf.index);
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_start_dma(dev, q, buf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
|
[media] cx88: make checkpatch.pl happy
Usually, I don't like fixing coding style issues on non-staging
drivers, as it could be a mess pretty easy, and could become like
a snow ball. That's the case of recent changes on two changesets:
they disalign some statements. Yet, a care a lot with cx88 driver,
as it was the first driver I touched at the Kernel, and I've been
maintaining it since 2005. So, several of the coding style issues
were due to my code.
Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with
fixed several other issues, did some function alinments, but broke
other alinments.
So, I had to manually apply another round of manual fixes to make
sure that everything is ok, and to make checkpatch happy with
this patch.
With this patch, checkpatch.pl is now happy when called with:
./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL
Also, the 80-cols violations that made sense were fixed.
Checkpatch would be happier if we convert it to use dev_foo(),
but this is a more complex change.
NOTE: there are some places with msleep(1). As this driver was
written at the time that the default was to sleep at least 10ms
on such calls (e. g. CONFIG_HZ=100), I replaced those calls by
usleep_range(10000, 20000), with should be safe to avoid breakages.
Fixes: 65bc2fe86e66 ("[media] cx88: convert it to use pr_foo() macros")
Fixes: 7b61ba8ff838 ("[media] cx88: make checkpatch happier")
Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-20 05:27:30 +08:00
|
|
|
struct cx88_buffer *buf)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int size = dev->ts_packet_size * dev->ts_packet_count;
|
[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 sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
|
2014-08-29 15:11:54 +08:00
|
|
|
struct cx88_riscmem *risc = &buf->risc;
|
2005-04-17 06:20:36 +08:00
|
|
|
int rc;
|
|
|
|
|
[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
|
|
|
if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
|
2005-04-17 06:20:36 +08:00
|
|
|
return -EINVAL;
|
[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_set_plane_payload(&buf->vb.vb2_buf, 0, size);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-08-29 15:11:54 +08:00
|
|
|
rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
|
[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
|
|
|
dev->ts_packet_size, dev->ts_packet_count, 0);
|
2014-08-29 16:40:47 +08:00
|
|
|
if (rc) {
|
2014-08-29 15:11:54 +08:00
|
|
|
if (risc->cpu)
|
[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
|
|
|
pci_free_consistent(dev->pci, risc->size,
|
|
|
|
risc->cpu, risc->dma);
|
2014-08-29 15:11:54 +08:00
|
|
|
memset(risc, 0, sizeof(*risc));
|
2014-08-29 16:40:47 +08:00
|
|
|
return rc;
|
|
|
|
}
|
2014-09-20 20:22:18 +08:00
|
|
|
return 0;
|
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
|
|
|
EXPORT_SYMBOL(cx8802_buf_prepare);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
|
|
|
|
{
|
|
|
|
struct cx88_buffer *prev;
|
2006-03-10 23:29:15 +08:00
|
|
|
struct cx88_dmaqueue *cx88q = &dev->mpegq;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "\n");
|
2014-09-20 20:22:18 +08:00
|
|
|
/* add jump to start */
|
|
|
|
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
|
|
|
|
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
|
|
|
|
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-03-10 23:29:15 +08:00
|
|
|
if (list_empty(&cx88q->active)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "queue is empty - first active\n");
|
2014-09-20 20:22:18 +08:00
|
|
|
list_add_tail(&buf->list, &cx88q->active);
|
2016-11-16 16:59:49 +08:00
|
|
|
dprintk(1, "[%p/%d] %s - first active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
buf, buf->vb.vb2_buf.index, __func__);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
} else {
|
2014-09-20 20:22:18 +08:00
|
|
|
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "queue is not empty - append to active\n");
|
2014-09-20 20:22:18 +08:00
|
|
|
prev = list_entry(cx88q->active.prev, struct cx88_buffer, list);
|
|
|
|
list_add_tail(&buf->list, &cx88q->active);
|
2005-04-17 06:20:36 +08:00
|
|
|
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "[%p/%d] %s - append to active\n",
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
buf, buf->vb.vb2_buf.index, __func__);
|
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
|
|
|
EXPORT_SYMBOL(cx8802_buf_queue);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2014-09-20 20:22:18 +08:00
|
|
|
static void do_cancel_buffers(struct cx8802_dev *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct cx88_dmaqueue *q = &dev->mpegq;
|
|
|
|
struct cx88_buffer *buf;
|
|
|
|
unsigned long flags;
|
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
while (!list_empty(&q->active)) {
|
2014-09-20 20:22:18 +08:00
|
|
|
buf = list_entry(q->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);
|
2005-06-24 13:05:03 +08:00
|
|
|
}
|
2016-11-16 16:59:49 +08:00
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void cx8802_cancel_buffers(struct cx8802_dev *dev)
|
|
|
|
{
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_stop_dma(dev);
|
2014-09-20 20:22:18 +08:00
|
|
|
do_cancel_buffers(dev);
|
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
|
|
|
EXPORT_SYMBOL(cx8802_cancel_buffers);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-16 16:59:49 +08:00
|
|
|
static const char *cx88_mpeg_irqs[32] = {
|
2005-07-13 04:58:44 +08:00
|
|
|
"ts_risci1", NULL, NULL, NULL,
|
|
|
|
"ts_risci2", NULL, NULL, NULL,
|
|
|
|
"ts_oflow", NULL, NULL, NULL,
|
|
|
|
"ts_sync", NULL, NULL, NULL,
|
|
|
|
"opc_err", "par_err", "rip_err", "pci_abort",
|
|
|
|
"ts_err?",
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static void cx8802_mpeg_irq(struct cx8802_dev *dev)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
u32 status, mask, count;
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
status = cx_read(MO_TS_INTSTAT);
|
|
|
|
mask = cx_read(MO_TS_INTMSK);
|
|
|
|
if (0 == (status & mask))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cx_write(MO_TS_INTSTAT, status);
|
2005-07-13 04:58:44 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (debug || (status & mask & ~0xff))
|
2016-11-13 20:07:38 +08:00
|
|
|
cx88_print_irqbits("irq mpeg ",
|
2007-03-29 19:47:04 +08:00
|
|
|
cx88_mpeg_irqs, ARRAY_SIZE(cx88_mpeg_irqs),
|
|
|
|
status, mask);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* risc op code error */
|
|
|
|
if (status & (1 << 16)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_warn("mpeg risc op code error\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
cx_clear(MO_TS_DMACNTRL, 0x11);
|
[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_sram_channel_dump(dev->core,
|
|
|
|
&cx88_sram_channels[SRAM_CH28]);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* risc1 y */
|
|
|
|
if (status & 0x01) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "wake up\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
spin_lock(&dev->slock);
|
|
|
|
count = cx_read(MO_TS_GPCNT);
|
|
|
|
cx88_wakeup(dev->core, &dev->mpegq, count);
|
|
|
|
spin_unlock(&dev->slock);
|
|
|
|
}
|
|
|
|
|
2005-11-09 13:37:43 +08:00
|
|
|
/* other general errors */
|
|
|
|
if (status & 0x1f0100) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(0, "general errors: 0x%08x\n", status & 0x1f0100);
|
2005-11-09 13:37:43 +08:00
|
|
|
spin_lock(&dev->slock);
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_stop_dma(dev);
|
2005-11-09 13:37:43 +08:00
|
|
|
spin_unlock(&dev->slock);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
#define MAX_IRQ_LOOP 10
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
static irqreturn_t cx8802_irq(int irq, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct cx8802_dev *dev = dev_id;
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
u32 status;
|
|
|
|
int loop, handled = 0;
|
|
|
|
|
2005-06-24 13:05:03 +08:00
|
|
|
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
|
2007-08-18 17:57:55 +08:00
|
|
|
status = cx_read(MO_PCI_INTSTAT) &
|
|
|
|
(core->pci_irqmask | PCI_INT_TSINT);
|
2016-11-16 16:59:49 +08:00
|
|
|
if (status == 0)
|
2005-04-17 06:20:36 +08:00
|
|
|
goto out;
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "cx8802_irq\n");
|
|
|
|
dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP);
|
|
|
|
dprintk(1, " status: %d\n", status);
|
2005-04-17 06:20:36 +08:00
|
|
|
handled = 1;
|
|
|
|
cx_write(MO_PCI_INTSTAT, status);
|
|
|
|
|
|
|
|
if (status & core->pci_irqmask)
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_core_irq(core, status);
|
2007-08-18 17:57:55 +08:00
|
|
|
if (status & PCI_INT_TSINT)
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_mpeg_irq(dev);
|
2012-09-28 16:37:22 +08:00
|
|
|
}
|
2016-11-16 16:59:49 +08:00
|
|
|
if (loop == MAX_IRQ_LOOP) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(0, "clearing mask\n");
|
|
|
|
pr_warn("irq loop -- clearing mask\n");
|
2016-11-16 16:59:49 +08:00
|
|
|
cx_write(MO_PCI_INTMSK, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
return IRQ_RETVAL(handled);
|
|
|
|
}
|
|
|
|
|
2007-11-06 01:07:22 +08:00
|
|
|
static int cx8802_init_common(struct cx8802_dev *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct cx88_core *core = dev->core;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/* pci init */
|
|
|
|
if (pci_enable_device(dev->pci))
|
|
|
|
return -EIO;
|
|
|
|
pci_set_master(dev->pci);
|
2016-11-16 16:59:49 +08:00
|
|
|
err = pci_set_dma_mask(dev->pci, DMA_BIT_MASK(32));
|
2015-11-21 07:57:07 +08:00
|
|
|
if (err) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("Oops: no 32bit PCI DMA ???\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2011-03-21 22:35:56 +08:00
|
|
|
dev->pci_rev = dev->pci->revision;
|
2005-11-09 13:37:43 +08:00
|
|
|
pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat);
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
|
|
|
|
pci_name(dev->pci), dev->pci_rev, dev->pci->irq,
|
|
|
|
dev->pci_lat,
|
|
|
|
(unsigned long long)pci_resource_start(dev->pci, 0));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* initialize driver struct */
|
|
|
|
spin_lock_init(&dev->slock);
|
|
|
|
|
|
|
|
/* init dma queue */
|
|
|
|
INIT_LIST_HEAD(&dev->mpegq.active);
|
|
|
|
|
|
|
|
/* get irq */
|
|
|
|
err = request_irq(dev->pci->irq, cx8802_irq,
|
2013-10-13 13:49:29 +08:00
|
|
|
IRQF_SHARED, dev->core->name, dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (err < 0) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("can't get IRQ %d\n", dev->pci->irq);
|
2005-04-17 06:20:36 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
cx_set(MO_PCI_INTMSK, core->pci_irqmask);
|
|
|
|
|
|
|
|
/* everything worked */
|
2016-11-16 16:59:49 +08:00
|
|
|
pci_set_drvdata(dev->pci, dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-06 01:07:22 +08:00
|
|
|
static void cx8802_fini_common(struct cx8802_dev *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(2, "\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_stop_dma(dev);
|
|
|
|
pci_disable_device(dev->pci);
|
|
|
|
|
|
|
|
/* unregister stuff */
|
|
|
|
free_irq(dev->pci->irq, dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2007-11-06 01:07:22 +08:00
|
|
|
static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-11-09 13:37:43 +08:00
|
|
|
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
|
2013-04-14 05:52:04 +08:00
|
|
|
unsigned long flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* stop mpeg dma */
|
2013-04-14 05:52:04 +08:00
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!list_empty(&dev->mpegq.active)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(2, "suspend\n");
|
|
|
|
pr_info("suspend mpeg\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
cx8802_stop_dma(dev);
|
|
|
|
}
|
2013-04-14 05:52:04 +08:00
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* FIXME -- shutdown device */
|
|
|
|
cx88_shutdown(dev->core);
|
|
|
|
|
|
|
|
pci_save_state(pci_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
|
|
|
if (pci_set_power_state(pci_dev,
|
|
|
|
pci_choose_state(pci_dev, state)) != 0) {
|
2005-04-17 06:20:36 +08:00
|
|
|
pci_disable_device(pci_dev);
|
|
|
|
dev->state.disabled = 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-06 01:07:22 +08:00
|
|
|
static int cx8802_resume_common(struct pci_dev *pci_dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-09-10 04:03:55 +08:00
|
|
|
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
|
2013-04-14 05:52:04 +08:00
|
|
|
unsigned long flags;
|
2005-09-10 04:03:55 +08:00
|
|
|
int err;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (dev->state.disabled) {
|
2016-11-16 16:59:49 +08:00
|
|
|
err = pci_enable_device(pci_dev);
|
2005-09-10 04:03:55 +08:00
|
|
|
if (err) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("can't enable device\n");
|
2005-09-10 04:03:55 +08:00
|
|
|
return err;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
dev->state.disabled = 0;
|
|
|
|
}
|
2016-11-16 16:59:49 +08:00
|
|
|
err = pci_set_power_state(pci_dev, PCI_D0);
|
2005-09-10 04:03:55 +08:00
|
|
|
if (err) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("can't enable device\n");
|
2005-09-10 04:03:55 +08:00
|
|
|
pci_disable_device(pci_dev);
|
|
|
|
dev->state.disabled = 1;
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
pci_restore_state(pci_dev);
|
|
|
|
|
|
|
|
/* FIXME: re-initialize hardware */
|
|
|
|
cx88_reset(dev->core);
|
|
|
|
|
|
|
|
/* restart video+vbi capture */
|
2013-04-14 05:52:04 +08:00
|
|
|
spin_lock_irqsave(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!list_empty(&dev->mpegq.active)) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("resume mpeg\n");
|
2016-11-16 16:59:49 +08:00
|
|
|
cx8802_restart_queue(dev, &dev->mpegq);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2013-04-14 05:52:04 +08:00
|
|
|
spin_unlock_irqrestore(&dev->slock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
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
|
|
|
struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev,
|
|
|
|
enum cx88_board_type btype)
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
struct cx8802_driver *d;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2007-10-14 13:52:17 +08:00
|
|
|
list_for_each_entry(d, &dev->drvlist, drvlist)
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
if (d->type_id == btype)
|
|
|
|
return d;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
[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
|
|
|
EXPORT_SYMBOL(cx8802_get_driver);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* Driver asked for hardware access. */
|
2007-05-01 19:35:10 +08:00
|
|
|
static int cx8802_request_acquire(struct cx8802_driver *drv)
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
|
|
|
struct cx88_core *core = drv->core;
|
2010-03-27 20:47:45 +08:00
|
|
|
unsigned int i;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* Fail a request for hardware if the device is busy. */
|
2008-02-12 00:00:34 +08:00
|
|
|
if (core->active_type_id != CX88_BOARD_NONE &&
|
|
|
|
core->active_type_id != drv->type_id)
|
2006-12-03 07:15:51 +08:00
|
|
|
return -EBUSY;
|
|
|
|
|
2011-07-14 23:44:46 +08:00
|
|
|
if (drv->type_id == CX88_MPEG_DVB) {
|
|
|
|
/* When switching to DVB, always set the input to the tuner */
|
|
|
|
core->last_analog_input = core->input;
|
|
|
|
core->input = 0;
|
|
|
|
for (i = 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
|
|
|
i < (sizeof(core->board.input) /
|
|
|
|
sizeof(struct cx88_input));
|
2011-07-14 23:44:46 +08:00
|
|
|
i++) {
|
|
|
|
if (core->board.input[i].type == CX88_VMUX_DVB) {
|
|
|
|
core->input = i;
|
|
|
|
break;
|
|
|
|
}
|
2010-03-27 20:47:45 +08:00
|
|
|
}
|
|
|
|
}
|
2008-04-23 01:45:14 +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
|
|
|
if (drv->advise_acquire) {
|
2008-02-14 09:41:15 +08:00
|
|
|
core->active_ref++;
|
2008-02-12 00:00:34 +08:00
|
|
|
if (core->active_type_id == CX88_BOARD_NONE) {
|
|
|
|
core->active_type_id = drv->type_id;
|
|
|
|
drv->advise_acquire(drv);
|
|
|
|
}
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "Post acquire GPIO=%x\n", cx_read(MO_GP0_IO));
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Driver asked to release hardware. */
|
2007-05-01 19:35:10 +08:00
|
|
|
static int cx8802_request_release(struct cx8802_driver *drv)
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
|
|
|
struct cx88_core *core = drv->core;
|
|
|
|
|
[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 (drv->advise_release && --core->active_ref == 0) {
|
2011-07-14 23:44:46 +08:00
|
|
|
if (drv->type_id == CX88_MPEG_DVB) {
|
[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 the DVB driver is releasing, reset the input
|
|
|
|
* state to the last configured analog input
|
|
|
|
*/
|
2011-07-14 23:44:46 +08:00
|
|
|
core->input = core->last_analog_input;
|
|
|
|
}
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
drv->advise_release(drv);
|
|
|
|
core->active_type_id = CX88_BOARD_NONE;
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "Post release GPIO=%x\n", cx_read(MO_GP0_IO));
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cx8802_check_driver(struct cx8802_driver *drv)
|
|
|
|
{
|
[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 (!drv)
|
2006-12-03 07:15:51 +08:00
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
if ((drv->type_id != CX88_MPEG_DVB) &&
|
[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
|
|
|
(drv->type_id != CX88_MPEG_BLACKBIRD))
|
2006-12-03 07:15:51 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if ((drv->hw_access != CX8802_DRVCTL_SHARED) &&
|
[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
|
|
|
(drv->hw_access != CX8802_DRVCTL_EXCLUSIVE))
|
2006-12-03 07:15:51 +08:00
|
|
|
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 ((!drv->probe) ||
|
|
|
|
(!drv->remove) ||
|
|
|
|
(!drv->advise_acquire) ||
|
|
|
|
(!drv->advise_release))
|
2006-12-03 07:15:51 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cx8802_register_driver(struct cx8802_driver *drv)
|
|
|
|
{
|
2007-10-14 13:52:17 +08:00
|
|
|
struct cx8802_dev *dev;
|
2006-12-03 07:15:51 +08:00
|
|
|
struct cx8802_driver *driver;
|
2007-10-14 13:52:17 +08:00
|
|
|
int err, i = 0;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("registering cx8802 driver, type: %s access: %s\n",
|
|
|
|
drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
|
[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
|
|
|
drv->hw_access == CX8802_DRVCTL_SHARED ?
|
|
|
|
"shared" : "exclusive");
|
2006-12-03 07:15:51 +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
|
|
|
err = cx8802_check_driver(drv);
|
|
|
|
if (err) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("cx8802_driver is invalid\n");
|
2006-12-03 07:15:51 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2011-05-01 17:30:14 +08:00
|
|
|
mutex_lock(&cx8802_mutex);
|
|
|
|
|
2007-10-14 13:52:17 +08:00
|
|
|
list_for_each_entry(dev, &cx8802_devlist, devlist) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
|
|
|
|
dev->pci->subsystem_vendor,
|
|
|
|
dev->pci->subsystem_device, dev->core->board.name,
|
|
|
|
dev->core->boardnr);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* Bring up a new struct for each driver instance */
|
2016-11-16 16:59:49 +08:00
|
|
|
driver = kzalloc(sizeof(*drv), GFP_KERNEL);
|
[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 (!driver) {
|
2011-05-01 17:30:14 +08:00
|
|
|
err = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* Snapshot of the driver registration data */
|
2007-10-14 13:52:17 +08:00
|
|
|
drv->core = dev->core;
|
2006-12-03 07:15:51 +08:00
|
|
|
drv->suspend = cx8802_suspend_common;
|
|
|
|
drv->resume = cx8802_resume_common;
|
|
|
|
drv->request_acquire = cx8802_request_acquire;
|
|
|
|
drv->request_release = cx8802_request_release;
|
|
|
|
memcpy(driver, drv, sizeof(*driver));
|
|
|
|
|
2011-05-01 17:29:56 +08:00
|
|
|
mutex_lock(&drv->core->lock);
|
2006-12-03 07:15:51 +08:00
|
|
|
err = drv->probe(driver);
|
|
|
|
if (err == 0) {
|
2006-10-07 08:29:25 +08:00
|
|
|
i++;
|
2007-10-14 13:52:17 +08:00
|
|
|
list_add_tail(&driver->drvlist, &dev->drvlist);
|
2006-12-03 07:15:51 +08:00
|
|
|
} else {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("cx8802 probe failed, err = %d\n", err);
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
2011-05-01 17:29:56 +08:00
|
|
|
mutex_unlock(&drv->core->lock);
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
|
2011-05-01 17:30:14 +08:00
|
|
|
err = i ? 0 : -ENODEV;
|
|
|
|
out:
|
|
|
|
mutex_unlock(&cx8802_mutex);
|
|
|
|
return err;
|
2006-12-03 07:15:51 +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
|
|
|
EXPORT_SYMBOL(cx8802_register_driver);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
int cx8802_unregister_driver(struct cx8802_driver *drv)
|
|
|
|
{
|
2007-10-14 13:52:17 +08:00
|
|
|
struct cx8802_dev *dev;
|
|
|
|
struct cx8802_driver *d, *dtmp;
|
|
|
|
int err = 0;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("unregistering cx8802 driver, type: %s access: %s\n",
|
|
|
|
drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
|
[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
|
|
|
drv->hw_access == CX8802_DRVCTL_SHARED ?
|
|
|
|
"shared" : "exclusive");
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2011-05-01 17:30:14 +08:00
|
|
|
mutex_lock(&cx8802_mutex);
|
|
|
|
|
2007-10-14 13:52:17 +08:00
|
|
|
list_for_each_entry(dev, &cx8802_devlist, devlist) {
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
|
|
|
|
dev->pci->subsystem_vendor,
|
|
|
|
dev->pci->subsystem_device, dev->core->board.name,
|
|
|
|
dev->core->boardnr);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2011-05-01 17:29:16 +08:00
|
|
|
mutex_lock(&dev->core->lock);
|
|
|
|
|
2007-10-14 13:52:17 +08:00
|
|
|
list_for_each_entry_safe(d, dtmp, &dev->drvlist, drvlist) {
|
2006-12-03 07:15:51 +08:00
|
|
|
/* only unregister the correct driver type */
|
|
|
|
if (d->type_id != drv->type_id)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
err = d->remove(d);
|
|
|
|
if (err == 0) {
|
2007-10-14 13:52:17 +08:00
|
|
|
list_del(&d->drvlist);
|
2007-10-05 22:28:09 +08:00
|
|
|
kfree(d);
|
2006-12-03 07:15:51 +08:00
|
|
|
} else
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("cx8802 driver remove failed (%d)\n",
|
|
|
|
err);
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
|
2011-05-01 17:29:16 +08:00
|
|
|
mutex_unlock(&dev->core->lock);
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
|
2011-05-01 17:30:14 +08:00
|
|
|
mutex_unlock(&cx8802_mutex);
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
return err;
|
|
|
|
}
|
[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
|
|
|
EXPORT_SYMBOL(cx8802_unregister_driver);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
2012-12-22 05:17:53 +08:00
|
|
|
static int cx8802_probe(struct pci_dev *pci_dev,
|
|
|
|
const struct pci_device_id *pci_id)
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
|
|
|
struct cx8802_dev *dev;
|
|
|
|
struct cx88_core *core;
|
2008-10-21 21:42:00 +08:00
|
|
|
int err;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
/* general setup */
|
|
|
|
core = cx88_core_get(pci_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
|
|
|
if (!core)
|
2006-12-03 07:15:51 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_info("cx2388x 8802 Driver Manager\n");
|
2006-12-03 07:15:51 +08:00
|
|
|
|
|
|
|
err = -ENODEV;
|
2007-08-16 01:41:57 +08:00
|
|
|
if (!core->board.mpeg)
|
2006-12-03 07:15:51 +08:00
|
|
|
goto fail_core;
|
|
|
|
|
|
|
|
err = -ENOMEM;
|
2016-11-16 16:59:49 +08:00
|
|
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
[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 (!dev)
|
2006-12-03 07:15:51 +08:00
|
|
|
goto fail_core;
|
|
|
|
dev->pci = pci_dev;
|
|
|
|
dev->core = core;
|
|
|
|
|
V4L/DVB (10190): cx88: Fix some Kbuild troubles
As Randy Dunlap <randy.dunlap@oracle.com> reported, cx88 has some compilation issues:
drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to `videobuf_dvb_get_frontend'
drivers/built-in.o: In function `cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to `videobuf_dvb_alloc_frontend'
cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to `videobuf_dvb_dealloc_frontends'
With those configs:
CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m
After carefully examining the code, with the current code, several cx88 drivers
(cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module,
if one of them is marked as such. Just fixing Kconfig could create a very complex
set of rules. Also, this hides a problem with the current approach where the dvb
functionality weren't confined inside dvb module.
What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.
So, instead of doing some tricks at Kconfig and wait for a next breakage,
this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.
Another problem is that cx8802 were being compiled, even without cx88-dvb
and cx88-blackbird modules.
While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html
A solution for the issue were proposed here:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg00021.html
Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect
and solve the issues.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-07 03:06:07 +08:00
|
|
|
/* Maintain a reference so cx88-video can query the 8802 device. */
|
|
|
|
core->dvbdev = dev;
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
err = cx8802_init_common(dev);
|
|
|
|
if (err != 0)
|
2016-02-15 22:37:15 +08:00
|
|
|
goto fail_dev;
|
2006-12-03 07:15:51 +08:00
|
|
|
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
INIT_LIST_HEAD(&dev->drvlist);
|
2011-05-01 17:30:14 +08:00
|
|
|
mutex_lock(&cx8802_mutex);
|
2016-11-16 16:59:49 +08:00
|
|
|
list_add_tail(&dev->devlist, &cx8802_devlist);
|
2011-05-01 17:30:14 +08:00
|
|
|
mutex_unlock(&cx8802_mutex);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-04-27 23:31:06 +08:00
|
|
|
/* now autoload cx88-dvb or cx88-blackbird */
|
|
|
|
request_modules(dev);
|
2006-12-03 07:15:51 +08:00
|
|
|
return 0;
|
|
|
|
|
2015-02-15 07:12:56 +08:00
|
|
|
fail_dev:
|
2006-12-03 07:15:51 +08:00
|
|
|
kfree(dev);
|
|
|
|
fail_core:
|
V4L/DVB (10190): cx88: Fix some Kbuild troubles
As Randy Dunlap <randy.dunlap@oracle.com> reported, cx88 has some compilation issues:
drivers/built-in.o: In function `cx88_call_i2c_clients':
(.text+0x20af17): undefined reference to `videobuf_dvb_get_frontend'
drivers/built-in.o: In function `cx8802_probe':
cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to `videobuf_dvb_alloc_frontend'
cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to `videobuf_dvb_dealloc_frontends'
With those configs:
CONFIG_VIDEO_CX88=y
CONFIG_VIDEO_CX88_BLACKBIRD=y
CONFIG_VIDEO_CX88_DVB=m
CONFIG_DVB_CORE=m
After carefully examining the code, with the current code, several cx88 drivers
(cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module,
if one of them is marked as such. Just fixing Kconfig could create a very complex
set of rules. Also, this hides a problem with the current approach where the dvb
functionality weren't confined inside dvb module.
What happens is that:
- cx88-i2c (part of cx8800) has some special rules if DVB;
- cx88-mpeg (cx8802 module) has also part of DVB init code;
- cx88-dvb has the rest of the dvb code;
- cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not.
So, instead of doing some tricks at Kconfig and wait for a next breakage,
this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb.
Another problem is that cx8802 were being compiled, even without cx88-dvb
and cx88-blackbird modules.
While on this code, let's fix also a reported problem:
http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html
A solution for the issue were proposed here:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg00021.html
Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect
and solve the issues.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-07 03:06:07 +08:00
|
|
|
core->dvbdev = NULL;
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_core_put(core, pci_dev);
|
2006-12-03 07:15:51 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-12-22 05:17:53 +08:00
|
|
|
static void cx8802_remove(struct pci_dev *pci_dev)
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
|
|
|
struct cx8802_dev *dev;
|
|
|
|
|
|
|
|
dev = pci_get_drvdata(pci_dev);
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
dprintk(1, "%s\n", __func__);
|
2006-12-03 07:15:51 +08:00
|
|
|
|
2010-12-24 23:14:20 +08:00
|
|
|
flush_request_modules(dev);
|
|
|
|
|
2011-05-01 17:29:16 +08:00
|
|
|
mutex_lock(&dev->core->lock);
|
|
|
|
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
if (!list_empty(&dev->drvlist)) {
|
2007-10-14 13:52:17 +08:00
|
|
|
struct cx8802_driver *drv, *tmp;
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
int err;
|
|
|
|
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_warn("Trying to remove cx8802 driver while cx8802 sub-drivers still loaded?!\n");
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
|
2007-10-14 13:52:17 +08:00
|
|
|
list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) {
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
err = drv->remove(drv);
|
|
|
|
if (err == 0) {
|
2007-10-14 13:52:17 +08:00
|
|
|
list_del(&drv->drvlist);
|
V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-14 13:52:17 +08:00
|
|
|
} else
|
2016-11-13 20:07:38 +08:00
|
|
|
pr_err("cx8802 driver remove failed (%d)\n",
|
|
|
|
err);
|
2007-10-05 22:28:09 +08:00
|
|
|
kfree(drv);
|
2006-12-03 07:15:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-01 17:29:16 +08:00
|
|
|
mutex_unlock(&dev->core->lock);
|
|
|
|
|
2006-12-03 07:15:51 +08:00
|
|
|
/* Destroy any 8802 reference. */
|
|
|
|
dev->core->dvbdev = NULL;
|
|
|
|
|
|
|
|
/* common */
|
|
|
|
cx8802_fini_common(dev);
|
2016-11-16 16:59:49 +08:00
|
|
|
cx88_core_put(dev->core, dev->pci);
|
2006-12-03 07:15:51 +08:00
|
|
|
kfree(dev);
|
|
|
|
}
|
|
|
|
|
2010-08-25 20:50:20 +08:00
|
|
|
static const struct pci_device_id cx8802_pci_tbl[] = {
|
2006-12-03 07:15:51 +08:00
|
|
|
{
|
|
|
|
.vendor = 0x14f1,
|
|
|
|
.device = 0x8802,
|
|
|
|
.subvendor = PCI_ANY_ID,
|
|
|
|
.subdevice = PCI_ANY_ID,
|
2016-11-16 16:59:49 +08:00
|
|
|
}, {
|
2006-12-03 07:15:51 +08:00
|
|
|
/* --- end of list --- */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl);
|
|
|
|
|
|
|
|
static struct pci_driver cx8802_pci_driver = {
|
|
|
|
.name = "cx88-mpeg driver manager",
|
|
|
|
.id_table = cx8802_pci_tbl,
|
|
|
|
.probe = cx8802_probe,
|
2012-12-22 05:17:53 +08:00
|
|
|
.remove = cx8802_remove,
|
2006-12-03 07:15:51 +08:00
|
|
|
};
|
|
|
|
|
2013-09-20 16:32:06 +08:00
|
|
|
module_pci_driver(cx8802_pci_driver);
|