Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
9d8a5eb8
Commit
9d8a5eb8
authored
Oct 06, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/davem/sparc-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
a11c692b
7cfb5e64
Changes
51
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
2158 additions
and
614 deletions
+2158
-614
arch/x86_64/kernel/i387.c
arch/x86_64/kernel/i387.c
+5
-0
drivers/media/common/saa7146_vbi.c
drivers/media/common/saa7146_vbi.c
+1
-1
drivers/media/common/saa7146_video.c
drivers/media/common/saa7146_video.c
+3
-2
drivers/media/video/bt848.h
drivers/media/video/bt848.h
+4
-1
drivers/media/video/btcx-risc.c
drivers/media/video/btcx-risc.c
+25
-33
drivers/media/video/bttv-cards.c
drivers/media/video/bttv-cards.c
+166
-30
drivers/media/video/bttv-driver.c
drivers/media/video/bttv-driver.c
+266
-116
drivers/media/video/bttv-if.c
drivers/media/video/bttv-if.c
+273
-33
drivers/media/video/bttv-risc.c
drivers/media/video/bttv-risc.c
+20
-4
drivers/media/video/bttv-vbi.c
drivers/media/video/bttv-vbi.c
+1
-1
drivers/media/video/bttv.h
drivers/media/video/bttv.h
+5
-0
drivers/media/video/bttvp.h
drivers/media/video/bttvp.h
+45
-7
drivers/media/video/saa7134/saa6752hs.c
drivers/media/video/saa7134/saa6752hs.c
+406
-0
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-cards.c
+176
-20
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-core.c
+195
-111
drivers/media/video/saa7134/saa7134-i2c.c
drivers/media/video/saa7134/saa7134-i2c.c
+20
-0
drivers/media/video/saa7134/saa7134-oss.c
drivers/media/video/saa7134/saa7134-oss.c
+1
-1
drivers/media/video/saa7134/saa7134-reg.h
drivers/media/video/saa7134/saa7134-reg.h
+13
-0
drivers/media/video/saa7134/saa7134-ts.c
drivers/media/video/saa7134/saa7134-ts.c
+47
-3
drivers/media/video/saa7134/saa7134-tvaudio.c
drivers/media/video/saa7134/saa7134-tvaudio.c
+32
-16
drivers/media/video/saa7134/saa7134-vbi.c
drivers/media/video/saa7134/saa7134-vbi.c
+2
-2
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134-video.c
+130
-108
drivers/media/video/saa7134/saa7134.h
drivers/media/video/saa7134/saa7134.h
+52
-12
drivers/media/video/video-buf.c
drivers/media/video/video-buf.c
+163
-53
fs/intermezzo/cache.c
fs/intermezzo/cache.c
+0
-1
fs/intermezzo/dcache.c
fs/intermezzo/dcache.c
+0
-1
fs/intermezzo/dir.c
fs/intermezzo/dir.c
+4
-5
fs/intermezzo/ext_attr.c
fs/intermezzo/ext_attr.c
+0
-2
fs/intermezzo/file.c
fs/intermezzo/file.c
+0
-1
fs/intermezzo/fileset.c
fs/intermezzo/fileset.c
+0
-1
fs/intermezzo/inode.c
fs/intermezzo/inode.c
+0
-1
fs/intermezzo/journal.c
fs/intermezzo/journal.c
+0
-1
fs/intermezzo/journal_ext2.c
fs/intermezzo/journal_ext2.c
+0
-1
fs/intermezzo/journal_ext3.c
fs/intermezzo/journal_ext3.c
+0
-1
fs/intermezzo/journal_obdfs.c
fs/intermezzo/journal_obdfs.c
+0
-1
fs/intermezzo/journal_reiserfs.c
fs/intermezzo/journal_reiserfs.c
+0
-1
fs/intermezzo/journal_tmpfs.c
fs/intermezzo/journal_tmpfs.c
+0
-1
fs/intermezzo/journal_xfs.c
fs/intermezzo/journal_xfs.c
+0
-1
fs/intermezzo/kml_utils.c
fs/intermezzo/kml_utils.c
+0
-1
fs/intermezzo/methods.c
fs/intermezzo/methods.c
+0
-1
fs/intermezzo/presto.c
fs/intermezzo/presto.c
+0
-1
fs/intermezzo/psdev.c
fs/intermezzo/psdev.c
+13
-15
fs/intermezzo/replicator.c
fs/intermezzo/replicator.c
+2
-3
fs/intermezzo/super.c
fs/intermezzo/super.c
+0
-1
fs/intermezzo/upcall.c
fs/intermezzo/upcall.c
+0
-1
fs/intermezzo/vfs.c
fs/intermezzo/vfs.c
+0
-1
fs/quota_v1.c
fs/quota_v1.c
+1
-1
include/asm-ia64/elf.h
include/asm-ia64/elf.h
+14
-9
include/linux/sched.h
include/linux/sched.h
+0
-1
include/media/saa6752hs.h
include/media/saa6752hs.h
+58
-0
include/media/video-buf.h
include/media/video-buf.h
+15
-6
No files found.
arch/x86_64/kernel/i387.c
View file @
9d8a5eb8
...
...
@@ -53,6 +53,11 @@ void __init fpu_init(void)
*/
void
init_fpu
(
struct
task_struct
*
child
)
{
if
(
child
->
used_math
)
{
if
(
child
==
current
)
unlazy_fpu
(
child
);
return
;
}
memset
(
&
child
->
thread
.
i387
.
fxsave
,
0
,
sizeof
(
struct
i387_fxsave_struct
));
child
->
thread
.
i387
.
fxsave
.
cwd
=
0x37f
;
child
->
thread
.
i387
.
fxsave
.
mxcsr
=
0x1f80
;
...
...
drivers/media/common/saa7146_vbi.c
View file @
9d8a5eb8
...
...
@@ -235,7 +235,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,enum v4l
saa7146_pgtable_free
(
dev
->
pci
,
&
buf
->
pt
[
2
]);
saa7146_pgtable_alloc
(
dev
->
pci
,
&
buf
->
pt
[
2
]);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
,
NULL
);
if
(
err
)
goto
oops
;
saa7146_pgtable_build_single
(
dev
->
pci
,
&
buf
->
pt
[
2
],
buf
->
vb
.
dma
.
sglist
,
buf
->
vb
.
dma
.
sglen
);
...
...
drivers/media/common/saa7146_video.c
View file @
9d8a5eb8
...
...
@@ -1090,7 +1090,8 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
q
=
&
fh
->
video_q
;
down
(
&
q
->
lock
);
err
=
videobuf_mmap_setup
(
file
,
q
,
gbuffers
,
gbufsize
);
// ,V4L2_MEMORY_MMAP);
err
=
videobuf_mmap_setup
(
file
,
q
,
gbuffers
,
gbufsize
,
V4L2_MEMORY_MMAP
);
if
(
err
<
0
)
{
up
(
&
q
->
lock
);
return
err
;
...
...
@@ -1185,7 +1186,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, enum v4
saa7146_pgtable_alloc
(
dev
->
pci
,
&
buf
->
pt
[
0
]);
}
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
,
NULL
);
if
(
err
)
goto
oops
;
err
=
saa7146_pgtable_build
(
dev
,
buf
);
...
...
drivers/media/video/bt848.h
View file @
9d8a5eb8
...
...
@@ -282,13 +282,16 @@
#define BT848_GPIO_DMA_CTL_FIFO_ENABLE (1<<0)
#define BT848_I2C 0x110
#define BT878_I2C_MODE (1<<7)
#define BT878_I2C_RATE (1<<6)
#define BT878_I2C_NOSTOP (1<<5)
#define BT878_I2C_NOSTART (1<<4)
#define BT848_I2C_DIV (0xf<<4)
#define BT848_I2C_SYNC (1<<3)
#define BT848_I2C_W3B (1<<2)
#define BT848_I2C_SCL (1<<1)
#define BT848_I2C_SDA (1<<0)
#define BT848_RISC_STRT_ADD 0x114
#define BT848_GPIO_OUT_EN 0x118
#define BT848_GPIO_REG_INP 0x11C
...
...
drivers/media/video/btcx-risc.c
View file @
9d8a5eb8
...
...
@@ -44,39 +44,6 @@ MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");
static
int
memcnt
;
int
btcx_riscmem_alloc
(
struct
pci_dev
*
pci
,
struct
btcx_riscmem
*
risc
,
unsigned
int
size
)
{
u32
*
cpu
;
dma_addr_t
dma
;
cpu
=
pci_alloc_consistent
(
pci
,
size
,
&
dma
);
if
(
NULL
==
cpu
)
return
-
ENOMEM
;
memset
(
cpu
,
0
,
size
);
#if 0
if (risc->cpu && risc->size < size) {
/* realloc (enlarge buffer) -- copy old stuff */
memcpy(cpu,risc->cpu,risc->size);
btcx_riscmem_free(pci,risc);
}
#else
BUG_ON
(
NULL
!=
risc
->
cpu
);
#endif
risc
->
cpu
=
cpu
;
risc
->
dma
=
dma
;
risc
->
size
=
size
;
if
(
debug
)
{
memcnt
++
;
printk
(
"btcx: riscmem alloc size=%d [%d]
\n
"
,
size
,
memcnt
);
}
return
0
;
}
void
btcx_riscmem_free
(
struct
pci_dev
*
pci
,
struct
btcx_riscmem
*
risc
)
{
...
...
@@ -90,6 +57,31 @@ void btcx_riscmem_free(struct pci_dev *pci,
}
}
int
btcx_riscmem_alloc
(
struct
pci_dev
*
pci
,
struct
btcx_riscmem
*
risc
,
unsigned
int
size
)
{
u32
*
cpu
;
dma_addr_t
dma
;
if
(
NULL
!=
risc
->
cpu
&&
risc
->
size
<
size
)
btcx_riscmem_free
(
pci
,
risc
);
if
(
NULL
==
risc
->
cpu
)
{
cpu
=
pci_alloc_consistent
(
pci
,
size
,
&
dma
);
if
(
NULL
==
cpu
)
return
-
ENOMEM
;
risc
->
cpu
=
cpu
;
risc
->
dma
=
dma
;
risc
->
size
=
size
;
if
(
debug
)
{
memcnt
++
;
printk
(
"btcx: riscmem alloc size=%d [%d]
\n
"
,
size
,
memcnt
);
}
}
memset
(
risc
->
cpu
,
0
,
risc
->
size
);
return
0
;
}
/* ---------------------------------------------------------- */
/* screen overlay helpers */
...
...
drivers/media/video/bttv-cards.c
View file @
9d8a5eb8
...
...
@@ -21,10 +21,9 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/module.h>
...
...
@@ -32,7 +31,9 @@
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
#ifdef CONFIG_FW_LOADER
# include <linux/firmware.h>
#endif
#include <asm/io.h>
...
...
@@ -62,6 +63,7 @@ static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
static
void
rv605_muxsel
(
struct
bttv
*
btv
,
unsigned
int
input
);
static
void
eagle_muxsel
(
struct
bttv
*
btv
,
unsigned
int
input
);
static
void
xguard_muxsel
(
struct
bttv
*
btv
,
unsigned
int
input
);
static
void
ivc120_muxsel
(
struct
bttv
*
btv
,
unsigned
int
input
);
static
int
terratec_active_radio_upgrade
(
struct
bttv
*
btv
);
static
int
tea5757_read
(
struct
bttv
*
btv
);
...
...
@@ -78,6 +80,7 @@ unsigned int no_overlay=-1;
static
unsigned
int
card
[
BTTV_MAX
]
=
{
[
0
...
(
BTTV_MAX
-
1
)
]
=
UNSET
};
static
unsigned
int
pll
[
BTTV_MAX
]
=
{
[
0
...
(
BTTV_MAX
-
1
)
]
=
UNSET
};
static
unsigned
int
tuner
[
BTTV_MAX
]
=
{
[
0
...
(
BTTV_MAX
-
1
)
]
=
UNSET
};
static
unsigned
int
svhs
[
BTTV_MAX
]
=
{
[
0
...
(
BTTV_MAX
-
1
)
]
=
UNSET
};
#ifdef MODULE
static
unsigned
int
autoload
=
1
;
#else
...
...
@@ -216,12 +219,32 @@ static struct CARD {
{
0x1466aa06
,
BTTV_PV150
,
"Provideo PV150B-3"
},
{
0x1467aa07
,
BTTV_PV150
,
"Provideo PV150B-4"
},
{
0xa1550000
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550001
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550002
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550003
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa132ff00
,
BTTV_IVC100
,
"IVC-100"
},
{
0xa1550000
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550001
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550002
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550003
,
BTTV_IVC200
,
"IVC-200"
},
{
0xa1550100
,
BTTV_IVC200
,
"IVC-200G"
},
{
0xa1550101
,
BTTV_IVC200
,
"IVC-200G"
},
{
0xa1550102
,
BTTV_IVC200
,
"IVC-200G"
},
{
0xa1550103
,
BTTV_IVC200
,
"IVC-200G"
},
{
0xa182ff00
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff01
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff02
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff03
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff04
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff05
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff06
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff07
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff08
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff09
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0a
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0b
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0c
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0d
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0e
,
BTTV_IVC120
,
"IVC-120G"
},
{
0xa182ff0f
,
BTTV_IVC120
,
"IVC-120G"
},
{
0x41424344
,
BTTV_GRANDTEC
,
"GrandTec Multi Capture"
},
{
0x01020304
,
BTTV_XGUARD
,
"Grandtec Grand X-Guard"
},
...
...
@@ -1338,7 +1361,7 @@ struct tvcard bttv_tvcards[] = {
},{
.
name
=
"Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF"
,
.
video_inputs
=
4
,
.
audio_inputs
=
3
,
.
audio_inputs
=
3
,
.
tuner
=
0
,
.
svhs
=
2
,
.
gpiomask
=
7
,
...
...
@@ -1388,18 +1411,19 @@ struct tvcard bttv_tvcards[] = {
.
gpiomask
=
7
,
.
audiomux
=
{
7
},
},{
.
name
=
"GV-BCTV5/PCI"
,
.
name
=
"
IODATA
GV-BCTV5/PCI"
,
.
video_inputs
=
3
,
.
audio_inputs
=
1
,
.
tuner
=
0
,
.
svhs
=
2
,
.
gpiomask
=
0x0
10f0
0
,
.
gpiomask
=
0x0
f0f8
0
,
.
muxsel
=
{
2
,
3
,
1
,
0
},
.
audiomux
=
{
0x
10000
,
0
,
0x10000
,
0
,
0
,
0
},
.
audiomux
=
{
0x
030000
,
0x010000
,
0x030000
,
0
,
0x02000
0
,
0
},
.
no_msp34xx
=
1
,
.
pll
=
PLL_28
,
.
tuner_type
=
TUNER_PHILIPS_NTSC_M
,
.
audio_hook
=
gvbctv3pci_audio
,
.
has_radio
=
1
,
},{
.
name
=
"Osprey 100/150 (878)"
,
/* 0x1(2|3)-45C6-C1 */
.
video_inputs
=
4
,
/* id-inputs-clock */
...
...
@@ -1720,16 +1744,14 @@ struct tvcard bttv_tvcards[] = {
/* ---- card 0x68 ---------------------------------- */
.
name
=
"Nebula Electronics DigiTV"
,
.
video_inputs
=
0
,
.
audio_inputs
=
0
,
.
svhs
=
-
1
,
.
muxsel
=
{
2
,
3
,
1
,
0
},
.
needs_tvaudio
=
0
,
.
no_msp34xx
=
1
,
.
no_tda9875
=
1
,
.
no_tda7432
=
1
,
.
pll
=
PLL_28
,
.
tuner_type
=
-
1
,
.
no_video
=
1
,
},{
/* Jorge Boncompte - DTI2 <jorge@dti2.net> */
.
name
=
"ProVideo PV143"
,
...
...
@@ -1801,6 +1823,33 @@ struct tvcard bttv_tvcards[] = {
.
needs_tvaudio
=
1
,
.
pll
=
PLL_28
,
.
tuner_type
=
-
1
,
},{
.
name
=
"IVC-100"
,
.
video_inputs
=
4
,
.
audio_inputs
=
0
,
.
tuner
=
-
1
,
.
tuner_type
=
-
1
,
.
svhs
=
-
1
,
.
gpiomask
=
0xdf
,
.
muxsel
=
{
2
,
3
,
1
,
0
},
.
pll
=
PLL_28
,
},{
/* IVC-120G - Alan Garfield <alan@fromorbit.com> */
.
name
=
"IVC-120G"
,
.
video_inputs
=
16
,
.
audio_inputs
=
0
,
/* card has no audio */
.
tuner
=
-
1
,
/* card has no tuner */
.
tuner_type
=
-
1
,
.
svhs
=
-
1
,
/* card has no svhs */
.
needs_tvaudio
=
0
,
.
no_msp34xx
=
1
,
.
no_tda9875
=
1
,
.
no_tda7432
=
1
,
.
gpiomask
=
0x00
,
.
muxsel
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
,
0x0d
,
0x0e
,
0x0f
,
0x10
},
.
muxsel_hook
=
ivc120_muxsel
,
.
pll
=
PLL_28
,
}};
const
unsigned
int
bttv_num_tvcards
=
ARRAY_SIZE
(
bttv_tvcards
);
...
...
@@ -1853,12 +1902,8 @@ void __devinit bttv_idcard(struct bttv *btv)
btv
->
type
=
card
[
btv
->
nr
];
/* print which card config we are using */
sprintf
(
btv
->
video_dev
.
name
,
"BT%d%s(%.23s)"
,
btv
->
id
,
(
btv
->
id
==
848
&&
btv
->
revision
==
0x12
)
?
"A"
:
""
,
bttv_tvcards
[
btv
->
type
].
name
);
printk
(
KERN_INFO
"bttv%d: using: %s [card=%d,%s]
\n
"
,
btv
->
nr
,
bt
v
->
video_dev
.
name
,
btv
->
type
,
bt
tv_tvcards
[
btv
->
type
].
name
,
btv
->
type
,
card
[
btv
->
nr
]
<
bttv_num_tvcards
?
"insmod option"
:
"autodetected"
);
...
...
@@ -2107,6 +2152,27 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input)
/* ----------------------------------------------------------------------- */
void
bttv_reset_audio
(
struct
bttv
*
btv
)
{
/*
* BT878A has a audio-reset register.
* 1. This register is an audio reset function but it is in
* function-0 (video capture) address space.
* 2. It is enough to do this once per power-up of the card.
* 3. There is a typo in the Conexant doc -- it is not at
* 0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
* --//Shrikumar 030609
*/
if
(
btv
->
id
!=
878
)
return
;
if
(
bttv_debug
)
printk
(
"bttv%d: BT878A ARESET
\n
"
,
btv
->
nr
);
btwrite
((
1
<<
7
),
0x058
);
udelay
(
10
);
btwrite
(
0
,
0x058
);
}
/* initialization part one -- before registering i2c bus */
void
__devinit
bttv_init_card1
(
struct
bttv
*
btv
)
{
...
...
@@ -2269,6 +2335,9 @@ void __devinit bttv_init_card2(struct bttv *btv)
&
btv
->
pinnacle_id
);
if
(
btv
->
tuner_type
!=
UNSET
)
bttv_call_i2c_clients
(
btv
,
TUNER_SET_TYPE
,
&
btv
->
tuner_type
);
btv
->
svhs
=
bttv_tvcards
[
btv
->
type
].
svhs
;
if
(
svhs
[
btv
->
nr
]
!=
UNSET
)
btv
->
svhs
=
svhs
[
btv
->
nr
];
if
(
bttv_tvcards
[
btv
->
type
].
has_radio
)
btv
->
has_radio
=
1
;
...
...
@@ -2548,10 +2617,9 @@ int __devinit pvr_boot(struct bttv *btv)
int
__devinit
pvr_boot
(
struct
bttv
*
btv
)
{
const
struct
firmware
*
fw_entry
;
struct
device
*
dev
=
&
btv
->
dev
->
dev
;
int
rc
;
rc
=
request_firmware
(
&
fw_entry
,
"hcwamc.rbf"
,
dev
);
rc
=
request_firmware
(
&
fw_entry
,
"hcwamc.rbf"
,
&
btv
->
dev
->
dev
);
if
(
rc
!=
0
)
{
printk
(
KERN_WARNING
"bttv%d: no altera firmware [via hotplug]
\n
"
,
btv
->
nr
);
...
...
@@ -2696,12 +2764,12 @@ int tuner_1_table[] = {
static
void
__devinit
avermedia_eeprom
(
struct
bttv
*
btv
)
{
int
tuner_make
,
tuner_tv_fm
,
tuner_format
,
tuner
=
0
,
remote
;
int
tuner_make
,
tuner_tv_fm
,
tuner_format
,
tuner
=
0
;
tuner_make
=
(
eeprom_data
[
0x41
]
&
0x7
);
tuner_tv_fm
=
(
eeprom_data
[
0x41
]
&
0x18
)
>>
3
;
tuner_format
=
(
eeprom_data
[
0x42
]
&
0xf0
)
>>
4
;
remote
=
(
eeprom_data
[
0x42
]
&
0x01
);
tuner_make
=
(
eeprom_data
[
0x41
]
&
0x7
);
tuner_tv_fm
=
(
eeprom_data
[
0x41
]
&
0x18
)
>>
3
;
tuner_format
=
(
eeprom_data
[
0x42
]
&
0xf0
)
>>
4
;
btv
->
has_remote
=
(
eeprom_data
[
0x42
]
&
0x01
);
if
(
tuner_make
==
0
||
tuner_make
==
2
)
if
(
tuner_format
<=
9
)
...
...
@@ -2718,8 +2786,8 @@ static void __devinit avermedia_eeprom(struct bttv *btv)
}
else
printk
(
"Unknown type"
);
printk
(
" radio:%s remote control:%s
\n
"
,
tuner_tv_fm
?
"yes"
:
"no"
,
remote
?
"yes"
:
"no"
);
tuner_tv_fm
?
"yes"
:
"no"
,
btv
->
has_remote
?
"yes"
:
"no"
);
}
/* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
...
...
@@ -3448,6 +3516,72 @@ static void xguard_muxsel(struct bttv *btv, unsigned int input)
btwrite
(
masks
[
input
%
16
],
BT848_GPIO_DATA
);
}
/*
* ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
*
* The IVC120G security card has 4 i2c controlled TDA8540 matrix
* swichers to provide 16 channels to MUX0. The TDA8540's have
* 4 indepedant outputs and as such the IVC120G also has the
* optional "Monitor Out" bus. This allows the card to be looking
* at one input while the monitor is looking at another.
*
* Since I've couldn't be bothered figuring out how to add an
* independant muxsel for the monitor bus, I've just set it to
* whatever the card is looking at.
*
* OUT0 of the TDA8540's is connected to MUX0 (0x03)
* OUT1 of the TDA8540's is connected to "Monitor Out" (0x0C)
*
* TDA8540_ALT3 IN0-3 = Channel 13 - 16 (0x03)
* TDA8540_ALT4 IN0-3 = Channel 1 - 4 (0x03)
* TDA8540_ALT5 IN0-3 = Channel 5 - 8 (0x03)
* TDA8540_ALT6 IN0-3 = Channel 9 - 12 (0x03)
*
*/
/* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
#define I2C_TDA8540 0x90
#define I2C_TDA8540_ALT1 0x92
#define I2C_TDA8540_ALT2 0x94
#define I2C_TDA8540_ALT3 0x96
#define I2C_TDA8540_ALT4 0x98
#define I2C_TDA8540_ALT5 0x9a
#define I2C_TDA8540_ALT6 0x9c
static
void
ivc120_muxsel
(
struct
bttv
*
btv
,
unsigned
int
input
)
{
// Simple maths
int
key
=
input
%
4
;
int
matrix
=
input
/
4
;
dprintk
(
"bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d
\n
"
,
btv
->
nr
,
input
,
matrix
,
key
);
// Handles the input selection on the TDA8540's
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT3
,
0x00
,
((
matrix
==
3
)
?
(
key
|
key
<<
2
)
:
0x00
),
1
);
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT4
,
0x00
,
((
matrix
==
0
)
?
(
key
|
key
<<
2
)
:
0x00
),
1
);
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT5
,
0x00
,
((
matrix
==
1
)
?
(
key
|
key
<<
2
)
:
0x00
),
1
);
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT6
,
0x00
,
((
matrix
==
2
)
?
(
key
|
key
<<
2
)
:
0x00
),
1
);
// Handles the output enables on the TDA8540's
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT3
,
0x02
,
((
matrix
==
3
)
?
0x03
:
0x00
),
1
);
// 13 - 16
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT4
,
0x02
,
((
matrix
==
0
)
?
0x03
:
0x00
),
1
);
// 1-4
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT5
,
0x02
,
((
matrix
==
1
)
?
0x03
:
0x00
),
1
);
// 5-8
bttv_I2CWrite
(
btv
,
I2C_TDA8540_ALT6
,
0x02
,
((
matrix
==
2
)
?
0x03
:
0x00
),
1
);
// 9-12
// Selects MUX0 for input on the 878
btaor
((
0
)
<<
5
,
~
(
3
<<
5
),
BT848_IFORM
);
}
/* ----------------------------------------------------------------------- */
/* motherboard chipset specific stuff */
...
...
@@ -3467,9 +3601,11 @@ void __devinit bttv_check_chipset(void)
latency
=
0x0A
;
#endif
#if 0
/* print which chipset we have */
while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
#endif
/* print warnings about any quirks found */
if
(
triton1
)
...
...
drivers/media/video/bttv-driver.c
View file @
9d8a5eb8
...
...
@@ -61,14 +61,15 @@ static int radio_nr = -1;
static
int
vbi_nr
=
-
1
;
static
unsigned
int
fdsr
=
0
;
static
unsigned
int
gpint
=
1
;
/* options */
static
unsigned
int
combfilter
=
0
;
static
unsigned
int
lumafilter
=
0
;
static
unsigned
int
automute
=
1
;
static
unsigned
int
chroma_agc
=
0
;
static
unsigned
int
adc_crush
=
1
;
static
unsigned
int
combfilter
=
0
;
static
unsigned
int
lumafilter
=
0
;
static
unsigned
int
automute
=
1
;
static
unsigned
int
chroma_agc
=
0
;
static
unsigned
int
adc_crush
=
1
;
static
unsigned
int
vcr_hack
=
0
;
static
unsigned
int
irq_iswitch
=
0
;
/* API features (turn on/off stuff for testing) */
static
unsigned
int
sloppy
=
0
;
...
...
@@ -98,7 +99,6 @@ MODULE_PARM(radio_nr,"i");
MODULE_PARM
(
vbi_nr
,
"i"
);
MODULE_PARM
(
fdsr
,
"i"
);
MODULE_PARM
(
gpint
,
"i"
);
MODULE_PARM
(
combfilter
,
"i"
);
MODULE_PARM
(
lumafilter
,
"i"
);
...
...
@@ -108,6 +108,10 @@ MODULE_PARM(chroma_agc,"i");
MODULE_PARM_DESC
(
chroma_agc
,
"enables the AGC of chroma signal, default is 0 (no)"
);
MODULE_PARM
(
adc_crush
,
"i"
);
MODULE_PARM_DESC
(
adc_crush
,
"enables the luminance ADC crush, default is 1 (yes)"
);
MODULE_PARM
(
vcr_hack
,
"i"
);
MODULE_PARM_DESC
(
vcr_hack
,
"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"
);
MODULE_PARM
(
irq_iswitch
,
"i"
);
MODULE_PARM_DESC
(
irq_iswitch
,
"switch inputs in irq handler"
);
MODULE_PARM
(
sloppy
,
"i"
);
MODULE_PARM
(
v4l2
,
"i"
);
...
...
@@ -115,7 +119,6 @@ MODULE_PARM(v4l2,"i");
MODULE_DESCRIPTION
(
"bttv - v4l/v4l2 driver module for bt848/878 based cards"
);
MODULE_AUTHOR
(
"Ralph Metzler & Marcus Metzler & Gerd Knorr"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_ALIAS_CHARDEV_MAJOR
(
VIDEO_MAJOR
);
/* kernel args */
#ifndef MODULE
...
...
@@ -123,6 +126,17 @@ static int __init p_radio(char *str) { return bttv_parse(str,BTTV_MAX,radio); }
__setup
(
"bttv.radio="
,
p_radio
);
#endif
/* ----------------------------------------------------------------------- */
/* sysfs */
static
ssize_t
show_card
(
struct
class_device
*
cd
,
char
*
buf
)
{
struct
video_device
*
vfd
=
to_video_device
(
cd
);
struct
bttv
*
btv
=
dev_get_drvdata
(
vfd
->
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
btv
?
btv
->
type
:
UNSET
);
}
static
CLASS_DEVICE_ATTR
(
card
,
S_IRUGO
,
show_card
,
NULL
);
/* ----------------------------------------------------------------------- */
/* static data */
...
...
@@ -464,7 +478,8 @@ const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats);
#define V4L2_CID_PRIVATE_AUTOMUTE (V4L2_CID_PRIVATE_BASE + 2)
#define V4L2_CID_PRIVATE_LUMAFILTER (V4L2_CID_PRIVATE_BASE + 3)
#define V4L2_CID_PRIVATE_AGC_CRUSH (V4L2_CID_PRIVATE_BASE + 4)
#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 5)
#define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5)
#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 6)
static
const
struct
v4l2_queryctrl
no_ctl
=
{
.
name
=
"42"
,
...
...
@@ -576,6 +591,12 @@ static const struct v4l2_queryctrl bttv_ctls[] = {
.
minimum
=
0
,
.
maximum
=
1
,
.
type
=
V4L2_CTRL_TYPE_BOOLEAN
,
},{
.
id
=
V4L2_CID_PRIVATE_VCR_HACK
,
.
name
=
"vcr hack"
,
.
minimum
=
0
,
.
maximum
=
1
,
.
type
=
V4L2_CTRL_TYPE_BOOLEAN
,
}
};
const
int
BTTV_CTLS
=
ARRAY_SIZE
(
bttv_ctls
);
...
...
@@ -721,7 +742,7 @@ void bt848A_set_timing(struct bttv *btv)
int
table_idx
=
bttv_tvnorms
[
btv
->
tvnorm
].
sram
;
int
fsc
=
bttv_tvnorms
[
btv
->
tvnorm
].
Fsc
;
if
(
bttv_tvcards
[
btv
->
type
].
muxsel
[
btv
->
input
]
<
0
)
{
if
(
UNSET
==
bttv_tvcards
[
btv
->
type
].
muxsel
[
btv
->
input
]
)
{
dprintk
(
"bttv%d: load digital timing table (table_idx=%d)
\n
"
,
btv
->
nr
,
table_idx
);
...
...
@@ -815,13 +836,7 @@ video_mux(struct bttv *btv, unsigned int input)
if
(
mask2
)
btaor
(
mask2
,
~
mask2
,
BT848_GPIO_OUT_EN
);
#if 0
/* This seems to get rid of some synchronization problems */
btand(~(3<<5), BT848_IFORM);
schedule_timeout(HZ/10);
#endif
if
(
input
==
bttv_tvcards
[
btv
->
type
].
svhs
)
{
if
(
input
==
btv
->
svhs
)
{
btor
(
BT848_CONTROL_COMP
,
BT848_E_CONTROL
);
btor
(
BT848_CONTROL_COMP
,
BT848_O_CONTROL
);
}
else
{
...
...
@@ -933,8 +948,21 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
static
void
set_input
(
struct
bttv
*
btv
,
unsigned
int
input
)
{
unsigned
long
flags
;
btv
->
input
=
input
;
video_mux
(
btv
,
input
);
if
(
irq_iswitch
)
{
spin_lock_irqsave
(
&
btv
->
s_lock
,
flags
);
if
(
btv
->
curr
.
irqflags
)
{
/* active capture -> delayed input switch */
btv
->
new_input
=
input
;
}
else
{
video_mux
(
btv
,
input
);
}
spin_unlock_irqrestore
(
&
btv
->
s_lock
,
flags
);
}
else
{
video_mux
(
btv
,
input
);
}
audio_mux
(
btv
,(
input
==
bttv_tvcards
[
btv
->
type
].
tuner
?
AUDIO_TUNER
:
AUDIO_EXTERN
));
set_tvnorm
(
btv
,
btv
->
tvnorm
);
...
...
@@ -974,6 +1002,16 @@ static void init_bt848(struct bttv *btv)
btwrite
(
BT848_CONTROL_LDEC
,
BT848_E_CONTROL
);
btwrite
(
BT848_CONTROL_LDEC
,
BT848_O_CONTROL
);
}
/* interrupt */
btwrite
(
0xfffffUL
,
BT848_INT_STAT
);
btwrite
((
btv
->
triton1
)
|
BT848_INT_GPINT
|
BT848_INT_SCERR
|
(
fdsr
?
BT848_INT_FDSR
:
0
)
|
BT848_INT_RISCI
|
BT848_INT_OCERR
|
BT848_INT_VPRES
|
BT848_INT_FMTCHG
|
BT848_INT_HLOCK
,
BT848_INT_MASK
);
}
extern
void
bttv_reinit_bt848
(
struct
bttv
*
btv
)
...
...
@@ -1053,6 +1091,9 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
case
V4L2_CID_PRIVATE_AGC_CRUSH
:
c
->
value
=
btv
->
opt_adc_crush
;
break
;
case
V4L2_CID_PRIVATE_VCR_HACK
:
c
->
value
=
btv
->
opt_vcr_hack
;
break
;
default:
return
-
EINVAL
;
}
...
...
@@ -1138,6 +1179,9 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
btwrite
(
BT848_ADC_RESERVED
|
(
btv
->
opt_adc_crush
?
BT848_ADC_CRUSH
:
0
),
BT848_ADC
);
break
;
case
V4L2_CID_PRIVATE_VCR_HACK
:
btv
->
opt_vcr_hack
=
c
->
value
;
break
;
default:
return
-
EINVAL
;
}
...
...
@@ -1281,7 +1325,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf,
/* alloc risc memory */
if
(
STATE_NEEDS_INIT
==
buf
->
vb
.
state
)
{
redo_dma_risc
=
1
;
if
(
0
!=
(
rc
=
videobuf_iolock
(
btv
->
dev
,
&
buf
->
vb
)))
if
(
0
!=
(
rc
=
videobuf_iolock
(
btv
->
dev
,
&
buf
->
vb
,
&
btv
->
fbuf
)))
goto
fail
;
}
...
...
@@ -1429,7 +1473,7 @@ int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
v
->
flags
|=
VIDEO_VC_TUNER
;
v
->
type
=
VIDEO_TYPE_TV
;
v
->
tuners
=
1
;
}
else
if
(
channel
==
bt
tv_tvcards
[
btv
->
type
].
svhs
)
{
}
else
if
(
channel
==
bt
v
->
svhs
)
{
strcpy
(
v
->
name
,
"S-Video"
);
}
else
{
sprintf
(
v
->
name
,
"Composite%d"
,
channel
);
...
...
@@ -1562,7 +1606,7 @@ int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
sprintf
(
i
->
name
,
"Television"
);
i
->
type
=
V4L2_INPUT_TYPE_TUNER
;
i
->
tuner
=
0
;
}
else
if
(
i
->
index
==
bttv_tvcards
[
btv
->
type
].
svhs
)
{
}
else
if
(
i
->
index
==
btv
->
svhs
)
{
sprintf
(
i
->
name
,
"S-Video"
);
}
else
{
sprintf
(
i
->
name
,
"Composite%d"
,
i
->
index
);
...
...
@@ -1766,7 +1810,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
}
/* clip against screen */
if
(
NULL
!=
btv
->
fbuf
.
base
)
n
=
btcx_screen_clips
(
btv
->
fbuf
.
width
,
btv
->
fbuf
.
width
,
n
=
btcx_screen_clips
(
btv
->
fbuf
.
fmt
.
width
,
btv
->
fbuf
.
fmt
.
height
,
&
win
->
w
,
clips
,
n
);
btcx_sort_clips
(
clips
,
n
);
...
...
@@ -2032,6 +2076,21 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if
(
btv
->
errors
)
bttv_reinit_bt848
(
btv
);
#ifdef VIDIOC_G_PRIORITY
switch
(
cmd
)
{
case
VIDIOCSFREQ
:
case
VIDIOCSTUNER
:
case
VIDIOCSCHAN
:
case
VIDIOC_S_CTRL
:
case
VIDIOC_S_STD
:
case
VIDIOC_S_INPUT
:
case
VIDIOC_S_TUNER
:
case
VIDIOC_S_FREQUENCY
:
retval
=
v4l2_prio_check
(
&
btv
->
prio
,
&
fh
->
prio
);
if
(
0
!=
retval
)
return
retval
;
};
#endif
switch
(
cmd
)
{
/* *** v4l1 *** ************************************************ */
...
...
@@ -2040,7 +2099,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
struct
video_capability
*
cap
=
arg
;
memset
(
cap
,
0
,
sizeof
(
*
cap
));
strcpy
(
cap
->
name
,
btv
->
video_dev
.
name
);
strcpy
(
cap
->
name
,
btv
->
video_dev
->
name
);
if
(
V4L2_BUF_TYPE_VBI_CAPTURE
==
fh
->
type
)
{
/* vbi */
cap
->
type
=
VID_TYPE_TUNER
|
VID_TYPE_TELETEXT
;
...
...
@@ -2147,7 +2206,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
case
VIDIOCGFBUF
:
{
struct
video_buffer
*
fbuf
=
arg
;
*
fbuf
=
btv
->
fbuf
;
fbuf
->
base
=
btv
->
fbuf
.
base
;
fbuf
->
width
=
btv
->
fbuf
.
fmt
.
width
;
fbuf
->
height
=
btv
->
fbuf
.
fmt
.
height
;
fbuf
->
bytesperline
=
btv
->
fbuf
.
fmt
.
bytesperline
;
if
(
fh
->
ovfmt
)
fbuf
->
depth
=
fh
->
ovfmt
->
depth
;
return
0
;
}
case
VIDIOCSFBUF
:
...
...
@@ -2200,7 +2265,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
fbuf
->
depth
!=
24
&&
fbuf
->
depth
!=
32
)
goto
fh_unlock_and_return
;
}
btv
->
fbuf
=
*
fbuf
;
btv
->
fbuf
.
base
=
fbuf
->
base
;
btv
->
fbuf
.
fmt
.
width
=
fbuf
->
width
;
btv
->
fbuf
.
fmt
.
height
=
fbuf
->
height
;
if
(
fbuf
->
bytesperline
)
btv
->
fbuf
.
fmt
.
bytesperline
=
fbuf
->
bytesperline
;
else
btv
->
fbuf
.
fmt
.
bytesperline
=
btv
->
fbuf
.
fmt
.
width
*
fbuf
->
depth
/
8
;
up
(
&
fh
->
cap
.
lock
);
return
0
;
}
...
...
@@ -2245,7 +2316,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
unsigned
int
i
;
down
(
&
fh
->
cap
.
lock
);
retval
=
videobuf_mmap_setup
(
file
,
&
fh
->
cap
,
gbuffers
,
gbufsize
);
retval
=
videobuf_mmap_setup
(
file
,
&
fh
->
cap
,
gbuffers
,
gbufsize
,
V4L2_MEMORY_MMAP
);
if
(
retval
<
0
)
goto
fh_unlock_and_return
;
memset
(
mbuf
,
0
,
sizeof
(
*
mbuf
));
...
...
@@ -2391,7 +2463,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
if
(
0
==
v4l2
)
return
-
EINVAL
;
strcpy
(
cap
->
driver
,
"bttv"
);
strlcpy
(
cap
->
card
,
btv
->
video_dev
.
name
,
sizeof
(
cap
->
card
));
strlcpy
(
cap
->
card
,
btv
->
video_dev
->
name
,
sizeof
(
cap
->
card
));
sprintf
(
cap
->
bus_info
,
"PCI:%s"
,
pci_name
(
btv
->
dev
));
cap
->
version
=
BTTV_VERSION_CODE
;
cap
->
capabilities
=
...
...
@@ -2474,11 +2546,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
{
struct
v4l2_framebuffer
*
fb
=
arg
;
memset
(
fb
,
0
,
sizeof
(
*
fb
));
fb
->
base
=
btv
->
fbuf
.
base
;
fb
->
fmt
.
width
=
btv
->
fbuf
.
width
;
fb
->
fmt
.
height
=
btv
->
fbuf
.
height
;
fb
->
fmt
.
bytesperline
=
btv
->
fbuf
.
bytesperline
;
*
fb
=
btv
->
fbuf
;
fb
->
capability
=
V4L2_FBUF_CAP_LIST_CLIPPING
;
if
(
fh
->
ovfmt
)
fb
->
fmt
.
pixelformat
=
fh
->
ovfmt
->
fourcc
;
...
...
@@ -2488,16 +2556,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
{
struct
v4l2_framebuffer
*
fb
=
arg
;
const
struct
bttv_format
*
fmt
;
unsigned
long
end
;
if
(
!
capable
(
CAP_SYS_ADMIN
)
&&
!
capable
(
CAP_SYS_RAWIO
))
return
-
EPERM
;
/* check args */
end
=
(
unsigned
long
)
fb
->
base
+
fb
->
fmt
.
height
*
fb
->
fmt
.
bytesperline
;
fmt
=
format_by_fourcc
(
fb
->
fmt
.
pixelformat
);
if
(
NULL
==
fmt
)
return
-
EINVAL
;
...
...
@@ -2514,14 +2578,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
}
/* ok, accept it */
btv
->
fbuf
.
base
=
fb
->
base
;
btv
->
fbuf
.
width
=
fb
->
fmt
.
width
;
btv
->
fbuf
.
height
=
fb
->
fmt
.
height
;
btv
->
fbuf
.
depth
=
fmt
->
depth
;
btv
->
fbuf
.
base
=
fb
->
base
;
btv
->
fbuf
.
fmt
.
width
=
fb
->
fmt
.
width
;
btv
->
fbuf
.
fmt
.
height
=
fb
->
fmt
.
height
;
if
(
0
!=
fb
->
fmt
.
bytesperline
)
btv
->
fbuf
.
bytesperline
=
fb
->
fmt
.
bytesperline
;
btv
->
fbuf
.
fmt
.
bytesperline
=
fb
->
fmt
.
bytesperline
;
else
btv
->
fbuf
.
bytesperline
=
btv
->
fbuf
.
width
*
fmt
->
depth
/
8
;
btv
->
fbuf
.
fmt
.
bytesperline
=
btv
->
fbuf
.
fmt
.
width
*
fmt
->
depth
/
8
;
retval
=
0
;
fh
->
ovfmt
=
fmt
;
...
...
@@ -2642,6 +2705,23 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
parm
->
parm
.
capture
.
timeperframe
=
s
.
frameperiod
;
return
0
;
}
#ifdef VIDIOC_G_PRIORITY
case
VIDIOC_G_PRIORITY
:
{
enum
v4l2_priority
*
p
=
arg
;
*
p
=
v4l2_prio_max
(
&
btv
->
prio
);
return
0
;
}
case
VIDIOC_S_PRIORITY
:
{
enum
v4l2_priority
*
prio
=
arg
;
return
v4l2_prio_change
(
&
btv
->
prio
,
&
fh
->
prio
,
*
prio
);
}
#endif
case
VIDIOC_ENUMSTD
:
case
VIDIOC_G_STD
:
...
...
@@ -2768,12 +2848,12 @@ static int bttv_open(struct inode *inode, struct file *file)
dprintk
(
KERN_DEBUG
"bttv: open minor=%d
\n
"
,
minor
);
for
(
i
=
0
;
i
<
bttv_num
;
i
++
)
{
if
(
bttvs
[
i
].
video_dev
.
minor
==
minor
)
{
if
(
bttvs
[
i
].
video_dev
->
minor
==
minor
)
{
btv
=
&
bttvs
[
i
];
type
=
V4L2_BUF_TYPE_VIDEO_CAPTURE
;
break
;
}
if
(
bttvs
[
i
].
vbi_dev
.
minor
==
minor
)
{
if
(
bttvs
[
i
].
vbi_dev
->
minor
==
minor
)
{
btv
=
&
bttvs
[
i
];
type
=
V4L2_BUF_TYPE_VBI_CAPTURE
;
break
;
...
...
@@ -2793,6 +2873,10 @@ static int bttv_open(struct inode *inode, struct file *file)
*
fh
=
btv
->
init
;
fh
->
type
=
type
;
fh
->
ov
.
setup_ok
=
0
;
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_open
(
&
btv
->
prio
,
&
fh
->
prio
);
#endif
videobuf_queue_init
(
&
fh
->
cap
,
&
bttv_video_qops
,
btv
->
dev
,
&
btv
->
s_lock
,
V4L2_BUF_TYPE_VIDEO_CAPTURE
,
...
...
@@ -2840,6 +2924,9 @@ static int bttv_release(struct inode *inode, struct file *file)
free_btres
(
btv
,
fh
,
RESOURCE_VBI
);
}
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_close
(
&
btv
->
prio
,
&
fh
->
prio
);
#endif
file
->
private_data
=
NULL
;
kfree
(
fh
);
...
...
@@ -2897,13 +2984,12 @@ static int radio_open(struct inode *inode, struct file *file)
{
int
minor
=
iminor
(
inode
);
struct
bttv
*
btv
=
NULL
;
u32
v
=
400
*
16
;
unsigned
int
i
;
dprintk
(
"bttv: open minor=%d
\n
"
,
minor
);
for
(
i
=
0
;
i
<
bttv_num
;
i
++
)
{
if
(
bttvs
[
i
].
radio_dev
.
minor
==
minor
)
{
if
(
bttvs
[
i
].
radio_dev
->
minor
==
minor
)
{
btv
=
&
bttvs
[
i
];
break
;
}
...
...
@@ -2921,7 +3007,6 @@ static int radio_open(struct inode *inode, struct file *file)
file
->
private_data
=
btv
;
i2c_vidiocschan
(
btv
);
bttv_call_i2c_clients
(
btv
,
VIDIOCSFREQ
,
&
v
);
bttv_call_i2c_clients
(
btv
,
AUDC_SET_RADIO
,
&
btv
->
tuner_type
);
audio_mux
(
btv
,
AUDIO_RADIO
);
...
...
@@ -2948,7 +3033,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
struct
video_capability
*
cap
=
arg
;
memset
(
cap
,
0
,
sizeof
(
*
cap
));
strcpy
(
cap
->
name
,
btv
->
radio_dev
.
name
);
strcpy
(
cap
->
name
,
btv
->
radio_dev
->
name
);
cap
->
type
=
VID_TYPE_TUNER
;
cap
->
channels
=
1
;
cap
->
audios
=
1
;
...
...
@@ -3131,7 +3216,7 @@ bttv_irq_wakeup_set(struct bttv *btv, struct bttv_buffer_set *wakeup,
}
if
(
wakeup
->
top
==
wakeup
->
bottom
)
{
if
(
NULL
!=
wakeup
->
top
&&
curr
->
top
!=
wakeup
->
top
)
{
if
(
irq_debug
)
if
(
irq_debug
>
1
)
printk
(
"bttv%d: wakeup: both=%p
\n
"
,
btv
->
nr
,
wakeup
->
top
);
wakeup
->
top
->
vb
.
ts
=
ts
;
wakeup
->
top
->
vb
.
field_count
=
btv
->
field_count
;
...
...
@@ -3140,7 +3225,7 @@ bttv_irq_wakeup_set(struct bttv *btv, struct bttv_buffer_set *wakeup,
}
}
else
{
if
(
NULL
!=
wakeup
->
top
&&
curr
->
top
!=
wakeup
->
top
)
{
if
(
irq_debug
)
if
(
irq_debug
>
1
)
printk
(
"bttv%d: wakeup: top=%p
\n
"
,
btv
->
nr
,
wakeup
->
top
);
wakeup
->
top
->
vb
.
ts
=
ts
;
wakeup
->
top
->
vb
.
field_count
=
btv
->
field_count
;
...
...
@@ -3148,7 +3233,7 @@ bttv_irq_wakeup_set(struct bttv *btv, struct bttv_buffer_set *wakeup,
wake_up
(
&
wakeup
->
top
->
vb
.
done
);
}
if
(
NULL
!=
wakeup
->
bottom
&&
curr
->
bottom
!=
wakeup
->
bottom
)
{
if
(
irq_debug
)
if
(
irq_debug
>
1
)
printk
(
"bttv%d: wakeup: bottom=%p
\n
"
,
btv
->
nr
,
wakeup
->
bottom
);
wakeup
->
bottom
->
vb
.
ts
=
ts
;
wakeup
->
bottom
->
vb
.
field_count
=
btv
->
field_count
;
...
...
@@ -3247,6 +3332,12 @@ bttv_irq_switch_fields(struct bttv *btv)
bttv_buffer_set_activate
(
btv
,
&
new
);
bttv_set_dma
(
btv
,
0
,
new
.
irqflags
);
/* switch input */
if
(
UNSET
!=
btv
->
new_input
)
{
video_mux
(
btv
,
btv
->
new_input
);
btv
->
new_input
=
UNSET
;
}
/* wake up finished buffers */
bttv_irq_wakeup_set
(
btv
,
&
old
,
&
new
,
STATE_DONE
);
spin_unlock
(
&
btv
->
s_lock
);
...
...
@@ -3274,7 +3365,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
/* get device status bits */
dstat
=
btread
(
BT848_DSTATUS
);
if
(
0
/*irq_debug*/
)
{
if
(
irq_debug
)
{
printk
(
KERN_DEBUG
"bttv%d: irq loop=%d fc=%d "
"riscs=%x, riscc=%08x, "
,
btv
->
nr
,
count
,
btv
->
field_count
,
...
...
@@ -3295,8 +3386,13 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
if
(
astat
&
BT848_INT_VSYNC
)
btv
->
field_count
++
;
if
(
astat
&
BT848_INT_GPINT
)
if
(
astat
&
BT848_INT_GPINT
)
{
#ifdef CONFIG_VIDEO_IR
if
(
btv
->
remote
)
bttv_input_irq
(
btv
);
#endif
wake_up
(
&
btv
->
gpioq
);
}
if
((
astat
&
BT848_INT_RISCI
)
&&
(
stat
&
(
2
<<
28
)))
bttv_irq_wakeup_top
(
btv
);
...
...
@@ -3325,10 +3421,12 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
}
count
++
;
if
(
count
>
20
)
{
if
(
count
>
4
)
{
btwrite
(
0
,
BT848_INT_MASK
);
printk
(
KERN_ERR
"bttv%d: IRQ lockup, cleared int mask
\n
"
,
btv
->
nr
);
"bttv%d: IRQ lockup, cleared int mask ["
,
btv
->
nr
);
bttv_print_irqbits
(
stat
,
astat
);
printk
(
"]
\n
"
);
}
}
return
IRQ_RETVAL
(
handled
);
...
...
@@ -3338,31 +3436,89 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
/* ----------------------------------------------------------------------- */
/* initialitation */
static
struct
video_device
*
vdev_init
(
struct
bttv
*
btv
,
struct
video_device
*
template
,
char
*
type
)
{
struct
video_device
*
vfd
;
vfd
=
video_device_alloc
();
if
(
NULL
==
vfd
)
return
NULL
;
*
vfd
=
*
template
;
vfd
->
minor
=
-
1
;
vfd
->
dev
=
&
btv
->
dev
->
dev
;
vfd
->
release
=
video_device_release
;
snprintf
(
vfd
->
name
,
sizeof
(
vfd
->
name
),
"BT%d%s %s (%s)"
,
btv
->
id
,
(
btv
->
id
==
848
&&
btv
->
revision
==
0x12
)
?
"A"
:
""
,
type
,
bttv_tvcards
[
btv
->
type
].
name
);
return
vfd
;
}
static
void
bttv_unregister_video
(
struct
bttv
*
btv
)
{
if
(
btv
->
video_dev
)
{
if
(
-
1
!=
btv
->
video_dev
->
minor
)
video_unregister_device
(
btv
->
video_dev
);
else
video_device_release
(
btv
->
video_dev
);
btv
->
video_dev
=
NULL
;
}
if
(
btv
->
vbi_dev
)
{
if
(
-
1
!=
btv
->
vbi_dev
->
minor
)
video_unregister_device
(
btv
->
vbi_dev
);
else
video_device_release
(
btv
->
vbi_dev
);
btv
->
vbi_dev
=
NULL
;
}
if
(
btv
->
radio_dev
)
{
if
(
-
1
!=
btv
->
radio_dev
->
minor
)
video_unregister_device
(
btv
->
radio_dev
);
else
video_device_release
(
btv
->
radio_dev
);
btv
->
radio_dev
=
NULL
;
}
}
/* register video4linux devices */
static
int
__devinit
bttv_register_video
(
struct
bttv
*
btv
)
{
if
(
video_register_device
(
&
btv
->
video_dev
,
VFL_TYPE_GRABBER
,
video_nr
)
<
0
)
return
-
1
;
/* video */
btv
->
video_dev
=
vdev_init
(
btv
,
&
bttv_video_template
,
"video"
);
if
(
NULL
==
btv
->
video_dev
)
goto
err
;
if
(
video_register_device
(
btv
->
video_dev
,
VFL_TYPE_GRABBER
,
video_nr
)
<
0
)
goto
err
;
printk
(
KERN_INFO
"bttv%d: registered device video%d
\n
"
,
btv
->
nr
,
btv
->
video_dev
.
minor
&
0x1f
);
if
(
video_register_device
(
&
btv
->
vbi_dev
,
VFL_TYPE_VBI
,
vbi_nr
)
<
0
)
{
video_unregister_device
(
&
btv
->
video_dev
);
return
-
1
;
}
btv
->
nr
,
btv
->
video_dev
->
minor
&
0x1f
);
video_device_create_file
(
btv
->
video_dev
,
&
class_device_attr_card
);
/* vbi */
btv
->
vbi_dev
=
vdev_init
(
btv
,
&
bttv_vbi_template
,
"vbi"
);
if
(
NULL
==
btv
->
vbi_dev
)
goto
err
;
if
(
video_register_device
(
btv
->
vbi_dev
,
VFL_TYPE_VBI
,
vbi_nr
)
<
0
)
goto
err
;
printk
(
KERN_INFO
"bttv%d: registered device vbi%d
\n
"
,
btv
->
nr
,
btv
->
vbi_dev
.
minor
&
0x1f
);
btv
->
nr
,
btv
->
vbi_dev
->
minor
&
0x1f
);
if
(
!
btv
->
has_radio
)
return
0
;
if
(
video_register_device
(
&
btv
->
radio_dev
,
VFL_TYPE_RADIO
,
radio_nr
)
<
0
)
{
video_unregister_device
(
&
btv
->
vbi_dev
);
video_unregister_device
(
&
btv
->
video_dev
);
return
-
1
;
}
/* radio */
btv
->
radio_dev
=
vdev_init
(
btv
,
&
radio_template
,
"radio"
);
if
(
NULL
==
btv
->
radio_dev
)
goto
err
;
if
(
video_register_device
(
btv
->
radio_dev
,
VFL_TYPE_RADIO
,
radio_nr
)
<
0
)
goto
err
;
printk
(
KERN_INFO
"bttv%d: registered device radio%d
\n
"
,
btv
->
nr
,
btv
->
radio_dev
.
minor
&
0x1f
);
return
0
;
btv
->
nr
,
btv
->
radio_dev
->
minor
&
0x1f
);
/* all done */
return
0
;
err:
bttv_unregister_video
(
btv
);
return
-
1
;
}
...
...
@@ -3401,6 +3557,9 @@ static int __devinit bttv_probe(struct pci_dev *dev,
init_waitqueue_head
(
&
btv
->
gpioq
);
INIT_LIST_HEAD
(
&
btv
->
capture
);
INIT_LIST_HEAD
(
&
btv
->
vcapture
);
#ifdef VIDIOC_G_PRIORITY
v4l2_prio_init
(
&
btv
->
prio
);
#endif
init_timer
(
&
btv
->
timeout
);
btv
->
timeout
.
function
=
bttv_irq_timeout
;
...
...
@@ -3409,19 +3568,10 @@ static int __devinit bttv_probe(struct pci_dev *dev,
btv
->
i2c_rc
=
-
1
;
btv
->
tuner_type
=
UNSET
;
btv
->
pinnacle_id
=
UNSET
;
memcpy
(
&
btv
->
video_dev
,
&
bttv_video_template
,
sizeof
(
bttv_video_template
));
memcpy
(
&
btv
->
radio_dev
,
&
radio_template
,
sizeof
(
radio_template
));
memcpy
(
&
btv
->
vbi_dev
,
&
bttv_vbi_template
,
sizeof
(
bttv_vbi_template
));
btv
->
video_dev
.
minor
=
-
1
;
btv
->
video_dev
.
priv
=
btv
;
btv
->
radio_dev
.
minor
=
-
1
;
btv
->
radio_dev
.
priv
=
btv
;
btv
->
vbi_dev
.
minor
=
-
1
;
btv
->
vbi_dev
.
priv
=
btv
;
btv
->
new_input
=
UNSET
;
btv
->
has_radio
=
radio
[
btv
->
nr
];
/* pci stuff (init, get irq/mmi
p
, ... */
/* pci stuff (init, get irq/mmi
o
, ... */
btv
->
dev
=
dev
;
btv
->
id
=
dev
->
device
;
if
(
pci_enable_device
(
dev
))
{
...
...
@@ -3437,13 +3587,15 @@ static int __devinit bttv_probe(struct pci_dev *dev,
if
(
!
request_mem_region
(
pci_resource_start
(
dev
,
0
),
pci_resource_len
(
dev
,
0
),
btv
->
name
))
{
printk
(
KERN_WARNING
"bttv%d: can't request iomem (0x%lx).
\n
"
,
btv
->
nr
,
pci_resource_start
(
dev
,
0
));
return
-
EBUSY
;
}
pci_set_master
(
dev
);
pci_set_command
(
dev
);
pci_set_drvdata
(
dev
,
btv
);
if
(
!
pci_dma_supported
(
dev
,
0xffffffff
))
{
printk
(
"bttv
: Oops: no 32bit PCI DMA ???
\n
"
);
printk
(
"bttv
%d: Oops: no 32bit PCI DMA ???
\n
"
,
btv
->
nr
);
result
=
-
EIO
;
goto
fail1
;
}
...
...
@@ -3454,13 +3606,14 @@ static int __devinit bttv_probe(struct pci_dev *dev,
bttv_num
,
btv
->
id
,
btv
->
revision
,
pci_name
(
dev
));
printk
(
"irq: %d, latency: %d, mmio: 0x%lx
\n
"
,
btv
->
dev
->
irq
,
lat
,
pci_resource_start
(
dev
,
0
));
schedule
();
#ifdef __sparc__
/* why no ioremap for sparc? */
btv
->
bt848_mmio
=
(
unsigned
char
*
)
pci_resource_start
(
dev
,
0
);
#else
btv
->
bt848_mmio
=
ioremap
(
pci_resource_start
(
dev
,
0
),
0x1000
);
#endif
if
(
NULL
==
ioremap
(
pci_resource_start
(
dev
,
0
),
0x1000
))
{
printk
(
"bttv%d: ioremap() failed
\n
"
,
btv
->
nr
);
result
=
-
EIO
;
goto
fail1
;
}
/* identify card */
bttv_idcard
(
btv
);
...
...
@@ -3486,6 +3639,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
btv
->
opt_automute
=
automute
;
btv
->
opt_chroma_agc
=
chroma_agc
;
btv
->
opt_adc_crush
=
adc_crush
;
btv
->
opt_vcr_hack
=
vcr_hack
;
/* fill struct bttv with some useful defaults */
btv
->
init
.
btv
=
btv
;
...
...
@@ -3502,7 +3656,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
bttv_gpio_tracking
(
btv
,
"pre-init"
);
bttv_risc_init_main
(
btv
);
init_bt848
(
btv
);
if
(
!
bttv_tvcards
[
btv
->
type
].
no_video
)
init_bt848
(
btv
);
/* gpio */
btwrite
(
0x00
,
BT848_GPIO_REG_INP
);
...
...
@@ -3510,16 +3665,6 @@ static int __devinit bttv_probe(struct pci_dev *dev,
if
(
bttv_gpio
)
bttv_gpio_tracking
(
btv
,
"init"
);
/* interrupt */
btwrite
(
0xfffffUL
,
BT848_INT_STAT
);
btwrite
((
btv
->
triton1
)
|
(
gpint
?
BT848_INT_GPINT
:
0
)
|
BT848_INT_SCERR
|
(
fdsr
?
BT848_INT_FDSR
:
0
)
|
BT848_INT_RISCI
|
BT848_INT_OCERR
|
BT848_INT_VPRES
|
BT848_INT_FMTCHG
|
BT848_INT_HLOCK
,
BT848_INT_MASK
);
/* needs to be done before i2c is registered */
bttv_init_card1
(
btv
);
...
...
@@ -3529,15 +3674,20 @@ static int __devinit bttv_probe(struct pci_dev *dev,
/* some card-specific stuff (needs working i2c) */
bttv_init_card2
(
btv
);
/* register video4linux */
bttv_register_video
(
btv
);
/* register video4linux + input */
if
(
!
bttv_tvcards
[
btv
->
type
].
no_video
)
{
bttv_register_video
(
btv
);
#ifdef CONFIG_VIDEO_IR
bttv_input_init
(
btv
);
#endif
bt848_bright
(
btv
,
32768
);
bt848_contrast
(
btv
,
32768
);
bt848_hue
(
btv
,
32768
);
bt848_sat
(
btv
,
32768
);
audio_mux
(
btv
,
AUDIO_MUTE
);
set_input
(
btv
,
0
);
bt848_bright
(
btv
,
32768
);
bt848_contrast
(
btv
,
32768
);
bt848_hue
(
btv
,
32768
);
bt848_sat
(
btv
,
32768
);
audio_mux
(
btv
,
AUDIO_MUTE
);
set_input
(
btv
,
0
);
}
/* everything is fine */
bttv_num
++
;
...
...
@@ -3547,6 +3697,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
free_irq
(
btv
->
dev
->
irq
,
btv
);
fail1:
if
(
btv
->
bt848_mmio
)
iounmap
(
btv
->
bt848_mmio
);
release_mem_region
(
pci_resource_start
(
btv
->
dev
,
0
),
pci_resource_len
(
btv
->
dev
,
0
));
pci_set_drvdata
(
dev
,
NULL
);
...
...
@@ -3572,23 +3724,21 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
btv
->
shutdown
=
1
;
wake_up
(
&
btv
->
gpioq
);
/* unregister i2c_bus */
if
(
0
==
btv
->
i2c_rc
)
i2c_bit_del_bus
(
&
btv
->
i2c_adap
);
/* unregister i2c_bus + input */
fini_bttv_i2c
(
btv
);
#ifdef CONFIG_VIDEO_IR
bttv_input_fini
(
btv
);
#endif
/* unregister video4linux */
if
(
btv
->
video_dev
.
minor
!=-
1
)
video_unregister_device
(
&
btv
->
video_dev
);
if
(
btv
->
radio_dev
.
minor
!=-
1
)
video_unregister_device
(
&
btv
->
radio_dev
);
if
(
btv
->
vbi_dev
.
minor
!=-
1
)
video_unregister_device
(
&
btv
->
vbi_dev
);
bttv_unregister_video
(
btv
);
/* free allocated memory */
btcx_riscmem_free
(
btv
->
dev
,
&
btv
->
main
);
/* free ressources */
free_irq
(
btv
->
dev
->
irq
,
btv
);
iounmap
(
btv
->
bt848_mmio
);
release_mem_region
(
pci_resource_start
(
btv
->
dev
,
0
),
pci_resource_len
(
btv
->
dev
,
0
));
...
...
drivers/media/video/bttv-if.c
View file @
9d8a5eb8
...
...
@@ -27,15 +27,23 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/io.h>
#include "bttvp.h"
static
struct
i2c_algo_bit_data
bttv_i2c_algo_template
;
static
struct
i2c_adapter
bttv_i2c_adap_template
;
static
struct
i2c_algo_bit_data
bttv_i2c_algo_bit_template
;
static
struct
i2c_adapter
bttv_i2c_adap_sw_template
;
static
struct
i2c_adapter
bttv_i2c_adap_hw_template
;
static
struct
i2c_client
bttv_i2c_client_template
;
#ifndef I2C_PEC
static
void
bttv_inc_use
(
struct
i2c_adapter
*
adap
);
static
void
bttv_dec_use
(
struct
i2c_adapter
*
adap
);
#endif
static
int
attach_inform
(
struct
i2c_client
*
client
);
EXPORT_SYMBOL
(
bttv_get_cardinfo
);
EXPORT_SYMBOL
(
bttv_get_pcidev
);
EXPORT_SYMBOL
(
bttv_get_id
);
...
...
@@ -45,6 +53,11 @@ EXPORT_SYMBOL(bttv_write_gpio);
EXPORT_SYMBOL
(
bttv_get_gpio_queue
);
EXPORT_SYMBOL
(
bttv_i2c_call
);
static
int
i2c_debug
=
0
;
static
int
i2c_hw
=
0
;
MODULE_PARM
(
i2c_debug
,
"i"
);
MODULE_PARM
(
i2c_hw
,
"i"
);
/* ----------------------------------------------------------------------- */
/* Exported functions - for other modules which want to access the */
/* gpio ports (IR for example) */
...
...
@@ -76,6 +89,7 @@ int bttv_get_id(unsigned int card)
return
bttvs
[
card
].
type
;
}
int
bttv_gpio_enable
(
unsigned
int
card
,
unsigned
long
mask
,
unsigned
long
data
)
{
struct
bttv
*
btv
;
...
...
@@ -146,7 +160,7 @@ wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
/* ----------------------------------------------------------------------- */
/* I2C functions
*/
/* I2C functions
- bitbanging adapter (software i2c)
*/
void
bttv_bit_setscl
(
void
*
data
,
int
state
)
{
...
...
@@ -190,6 +204,222 @@ static int bttv_bit_getsda(void *data)
return
state
;
}
static
struct
i2c_algo_bit_data
bttv_i2c_algo_bit_template
=
{
.
setsda
=
bttv_bit_setsda
,
.
setscl
=
bttv_bit_setscl
,
.
getsda
=
bttv_bit_getsda
,
.
getscl
=
bttv_bit_getscl
,
.
udelay
=
16
,
.
mdelay
=
10
,
.
timeout
=
200
,
};
static
struct
i2c_adapter
bttv_i2c_adap_sw_template
=
{
#ifdef I2C_PEC
.
owner
=
THIS_MODULE
,
#else
.
inc_use
=
bttv_inc_use
,
.
dec_use
=
bttv_dec_use
,
#endif
#ifdef I2C_ADAP_CLASS_TV_ANALOG
.
class
=
I2C_ADAP_CLASS_TV_ANALOG
,
#endif
I2C_DEVNAME
(
"bt848"
),
.
id
=
I2C_HW_B_BT848
,
.
client_register
=
attach_inform
,
};
/* ----------------------------------------------------------------------- */
/* I2C functions - hardware i2c */
static
int
algo_control
(
struct
i2c_adapter
*
adapter
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
return
0
;
}
static
u32
functionality
(
struct
i2c_adapter
*
adap
)
{
return
I2C_FUNC_SMBUS_EMUL
;
}
static
int
bttv_i2c_wait_done
(
struct
bttv
*
btv
)
{
u32
stat
;
int
timeout
;
timeout
=
jiffies
+
HZ
/
100
+
1
;
/* 10ms */
for
(;;)
{
stat
=
btread
(
BT848_INT_STAT
);
if
(
stat
&
BT848_INT_I2CDONE
)
break
;
if
(
time_after
(
jiffies
,
timeout
))
return
-
EIO
;
udelay
(
10
);
}
btwrite
(
BT848_INT_I2CDONE
|
BT848_INT_RACK
,
BT848_INT_STAT
);
return
((
stat
&
BT848_INT_RACK
)
?
1
:
0
);
}
#define I2C_HW (BT878_I2C_MODE | BT848_I2C_SYNC |\
BT848_I2C_SCL | BT848_I2C_SDA)
static
int
bttv_i2c_sendbytes
(
struct
bttv
*
btv
,
const
struct
i2c_msg
*
msg
,
int
last
)
{
u32
xmit
;
int
retval
,
cnt
;
/* start, address + first byte */
xmit
=
(
msg
->
addr
<<
25
)
|
(
msg
->
buf
[
0
]
<<
16
)
|
I2C_HW
;
if
(
msg
->
len
>
1
||
!
last
)
xmit
|=
BT878_I2C_NOSTOP
;
btwrite
(
xmit
,
BT848_I2C
);
retval
=
bttv_i2c_wait_done
(
btv
);
if
(
retval
<
0
)
goto
err
;
if
(
retval
==
0
)
goto
eio
;
if
(
i2c_debug
)
{
printk
(
" <W %02x %02x"
,
msg
->
addr
<<
1
,
msg
->
buf
[
0
]);
if
(
!
(
xmit
&
BT878_I2C_NOSTOP
))
printk
(
" >
\n
"
);
}
for
(
cnt
=
1
;
cnt
<
msg
->
len
;
cnt
++
)
{
/* following bytes */
xmit
=
(
msg
->
buf
[
cnt
]
<<
24
)
|
I2C_HW
|
BT878_I2C_NOSTART
;
if
(
cnt
<
msg
->
len
-
1
||
!
last
)
xmit
|=
BT878_I2C_NOSTOP
;
btwrite
(
xmit
,
BT848_I2C
);
retval
=
bttv_i2c_wait_done
(
btv
);
if
(
retval
<
0
)
goto
err
;
if
(
retval
==
0
)
goto
eio
;
if
(
i2c_debug
)
{
printk
(
" %02x"
,
msg
->
buf
[
cnt
]);
if
(
!
(
xmit
&
BT878_I2C_NOSTOP
))
printk
(
" >
\n
"
);
}
}
return
msg
->
len
;
eio:
retval
=
-
EIO
;
err:
if
(
i2c_debug
)
printk
(
" ERR: %d
\n
"
,
retval
);
return
retval
;
}
static
int
bttv_i2c_readbytes
(
struct
bttv
*
btv
,
const
struct
i2c_msg
*
msg
,
int
last
)
{
u32
xmit
;
u32
cnt
;
int
retval
;
for
(
cnt
=
0
;
cnt
<
msg
->
len
;
cnt
++
)
{
xmit
=
(
msg
->
addr
<<
25
)
|
(
1
<<
24
)
|
I2C_HW
;
if
(
cnt
<
msg
->
len
-
1
)
xmit
|=
BT848_I2C_W3B
;
if
(
cnt
<
msg
->
len
-
1
||
!
last
)
xmit
|=
BT878_I2C_NOSTOP
;
if
(
cnt
)
xmit
|=
BT878_I2C_NOSTART
;
btwrite
(
xmit
,
BT848_I2C
);
retval
=
bttv_i2c_wait_done
(
btv
);
if
(
retval
<
0
)
goto
err
;
if
(
retval
==
0
)
goto
eio
;
msg
->
buf
[
cnt
]
=
((
u32
)
btread
(
BT848_I2C
)
>>
8
)
&
0xff
;
if
(
i2c_debug
)
{
if
(
!
(
xmit
&
BT878_I2C_NOSTART
))
printk
(
" <R %02x"
,
(
msg
->
addr
<<
1
)
+
1
);
printk
(
" =%02x"
,
msg
->
buf
[
cnt
]);
if
(
!
(
xmit
&
BT878_I2C_NOSTOP
))
printk
(
" >
\n
"
);
}
}
return
msg
->
len
;
eio:
retval
=
-
EIO
;
err:
if
(
i2c_debug
)
printk
(
" ERR: %d
\n
"
,
retval
);
return
retval
;
}
int
bttv_i2c_xfer
(
struct
i2c_adapter
*
i2c_adap
,
struct
i2c_msg
msgs
[],
int
num
)
{
struct
bttv
*
btv
=
i2c_get_adapdata
(
i2c_adap
);
int
retval
=
0
;
int
i
;
if
(
i2c_debug
)
printk
(
"bt-i2c:"
);
btwrite
(
BT848_INT_I2CDONE
|
BT848_INT_RACK
,
BT848_INT_STAT
);
for
(
i
=
0
;
i
<
num
;
i
++
)
{
if
(
msgs
[
i
].
flags
&
I2C_M_RD
)
{
/* read */
retval
=
bttv_i2c_readbytes
(
btv
,
&
msgs
[
i
],
i
+
1
==
num
);
if
(
retval
<
0
)
goto
err
;
}
else
{
/* write */
retval
=
bttv_i2c_sendbytes
(
btv
,
&
msgs
[
i
],
i
+
1
==
num
);
if
(
retval
<
0
)
goto
err
;
}
}
return
num
;
err:
return
retval
;
}
static
struct
i2c_algorithm
bttv_algo
=
{
.
name
=
"bt878"
,
.
id
=
I2C_ALGO_BIT
|
I2C_HW_B_BT848
/* FIXME */
,
.
master_xfer
=
bttv_i2c_xfer
,
.
algo_control
=
algo_control
,
.
functionality
=
functionality
,
};
static
struct
i2c_adapter
bttv_i2c_adap_hw_template
=
{
#ifdef I2C_PEC
.
owner
=
THIS_MODULE
,
#else
.
inc_use
=
bttv_inc_use
,
.
dec_use
=
bttv_dec_use
,
#endif
#ifdef I2C_ADAP_CLASS_TV_ANALOG
.
class
=
I2C_ADAP_CLASS_TV_ANALOG
,
#endif
I2C_DEVNAME
(
"bt878"
),
.
id
=
I2C_ALGO_BIT
|
I2C_HW_B_BT848
/* FIXME */
,
.
algo
=
&
bttv_algo
,
.
client_register
=
attach_inform
,
};
/* ----------------------------------------------------------------------- */
/* I2C functions - common stuff */
#ifndef I2C_PEC
static
void
bttv_inc_use
(
struct
i2c_adapter
*
adap
)
{
MOD_INC_USE_COUNT
;
}
static
void
bttv_dec_use
(
struct
i2c_adapter
*
adap
)
{
MOD_DEC_USE_COUNT
;
}
#endif
static
int
attach_inform
(
struct
i2c_client
*
client
)
{
...
...
@@ -221,24 +451,6 @@ void bttv_i2c_call(unsigned int card, unsigned int cmd, void *arg)
bttv_call_i2c_clients
(
&
bttvs
[
card
],
cmd
,
arg
);
}
static
struct
i2c_algo_bit_data
bttv_i2c_algo_template
=
{
.
setsda
=
bttv_bit_setsda
,
.
setscl
=
bttv_bit_setscl
,
.
getsda
=
bttv_bit_getsda
,
.
getscl
=
bttv_bit_getscl
,
.
udelay
=
16
,
.
mdelay
=
10
,
.
timeout
=
200
,
};
static
struct
i2c_adapter
bttv_i2c_adap_template
=
{
.
owner
=
THIS_MODULE
,
.
class
=
I2C_ADAP_CLASS_TV_ANALOG
,
I2C_DEVNAME
(
"bt848"
),
.
id
=
I2C_HW_B_BT848
,
.
client_register
=
attach_inform
,
};
static
struct
i2c_client
bttv_i2c_client_template
=
{
I2C_DEVNAME
(
"bttv internal"
),
.
id
=
-
1
,
...
...
@@ -308,28 +520,56 @@ void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr)
/* init + register i2c algo-bit adapter */
int
__devinit
init_bttv_i2c
(
struct
bttv
*
btv
)
{
memcpy
(
&
btv
->
i2c_adap
,
&
bttv_i2c_adap_template
,
sizeof
(
struct
i2c_adapter
));
memcpy
(
&
btv
->
i2c_algo
,
&
bttv_i2c_algo_template
,
sizeof
(
struct
i2c_algo_bit_data
));
int
use_hw
=
(
btv
->
id
==
878
)
&&
i2c_hw
;
memcpy
(
&
btv
->
i2c_client
,
&
bttv_i2c_client_template
,
sizeof
(
struct
i2c_client
));
sizeof
(
bttv_i2c_client_template
));
if
(
use_hw
)
{
/* bt878 */
memcpy
(
&
btv
->
i2c_adap
,
&
bttv_i2c_adap_hw_template
,
sizeof
(
bttv_i2c_adap_hw_template
));
}
else
{
/* bt848 */
memcpy
(
&
btv
->
i2c_adap
,
&
bttv_i2c_adap_sw_template
,
sizeof
(
bttv_i2c_adap_sw_template
));
memcpy
(
&
btv
->
i2c_algo
,
&
bttv_i2c_algo_bit_template
,
sizeof
(
bttv_i2c_algo_bit_template
));
btv
->
i2c_algo
.
data
=
btv
;
btv
->
i2c_adap
.
algo_data
=
&
btv
->
i2c_algo
;
}
sprintf
(
btv
->
i2c_adap
.
name
,
"bt848 #%d"
,
btv
->
nr
);
btv
->
i2c_adap
.
dev
.
parent
=
&
btv
->
dev
->
dev
;
snprintf
(
btv
->
i2c_adap
.
name
,
sizeof
(
btv
->
i2c_adap
.
name
),
"bt%d #%d [%s]"
,
btv
->
id
,
btv
->
nr
,
use_hw
?
"hw"
:
"sw"
);
btv
->
i2c_algo
.
data
=
btv
;
i2c_set_adapdata
(
&
btv
->
i2c_adap
,
btv
);
btv
->
i2c_adap
.
algo_data
=
&
btv
->
i2c_algo
;
btv
->
i2c_client
.
adapter
=
&
btv
->
i2c_adap
;
bttv_bit_setscl
(
btv
,
1
);
bttv_bit_setsda
(
btv
,
1
);
btv
->
i2c_rc
=
i2c_bit_add_bus
(
&
btv
->
i2c_adap
);
if
(
use_hw
)
{
btv
->
i2c_rc
=
i2c_add_adapter
(
&
btv
->
i2c_adap
);
}
else
{
bttv_bit_setscl
(
btv
,
1
);
bttv_bit_setsda
(
btv
,
1
);
btv
->
i2c_rc
=
i2c_bit_add_bus
(
&
btv
->
i2c_adap
);
}
return
btv
->
i2c_rc
;
}
int
__devexit
fini_bttv_i2c
(
struct
bttv
*
btv
)
{
int
use_hw
=
(
btv
->
id
==
878
)
&&
i2c_hw
;
if
(
0
!=
btv
->
i2c_rc
)
return
0
;
if
(
use_hw
)
{
return
i2c_del_adapter
(
&
btv
->
i2c_adap
);
}
else
{
return
i2c_bit_del_bus
(
&
btv
->
i2c_adap
);
}
}
/*
* Local variables:
* c-basic-offset: 8
...
...
drivers/media/video/bttv-risc.c
View file @
9d8a5eb8
...
...
@@ -33,6 +33,8 @@
#include "bttvp.h"
#define VCR_HACK_LINES 4
/* ---------------------------------------------------------- */
/* risc code generators */
...
...
@@ -62,6 +64,9 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
/* scan lines */
sg
=
sglist
;
for
(
line
=
0
;
line
<
lines
;
line
++
)
{
if
((
btv
->
opt_vcr_hack
)
&&
(
line
>=
(
lines
-
VCR_HACK_LINES
)))
continue
;
while
(
offset
>=
sg_dma_len
(
sg
))
{
offset
-=
sg_dma_len
(
sg
);
sg
++
;
...
...
@@ -136,6 +141,9 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
usg
=
sglist
;
vsg
=
sglist
;
for
(
line
=
0
;
line
<
ylines
;
line
++
)
{
if
((
btv
->
opt_vcr_hack
)
&&
(
line
>=
(
ylines
-
VCR_HACK_LINES
)))
continue
;
switch
(
vshift
)
{
case
0
:
chroma
=
1
;
break
;
case
1
:
chroma
=
!
(
line
&
1
);
break
;
...
...
@@ -219,8 +227,10 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
instructions
=
(
ov
->
nclips
+
1
)
*
((
skip_even
||
skip_odd
)
?
ov
->
w
.
height
>>
1
:
ov
->
w
.
height
);
instructions
+=
2
;
if
((
rc
=
btcx_riscmem_alloc
(
btv
->
dev
,
risc
,
instructions
*
8
))
<
0
)
if
((
rc
=
btcx_riscmem_alloc
(
btv
->
dev
,
risc
,
instructions
*
8
))
<
0
)
{
kfree
(
skips
);
return
rc
;
}
/* sync instruction */
rp
=
risc
->
cpu
;
...
...
@@ -228,12 +238,18 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
*
(
rp
++
)
=
cpu_to_le32
(
0
);
addr
=
(
unsigned
long
)
btv
->
fbuf
.
base
;
addr
+=
btv
->
fbuf
.
bytesperline
*
ov
->
w
.
top
;
addr
+=
(
(
btv
->
fbuf
.
depth
+
7
)
>>
3
)
*
ov
->
w
.
left
;
addr
+=
btv
->
fbuf
.
fmt
.
bytesperline
*
ov
->
w
.
top
;
addr
+=
(
fmt
->
depth
>>
3
)
*
ov
->
w
.
left
;
/* scan lines */
for
(
maxy
=
-
1
,
line
=
0
;
line
<
ov
->
w
.
height
;
line
++
,
addr
+=
btv
->
fbuf
.
bytesperline
)
{
line
++
,
addr
+=
btv
->
fbuf
.
fmt
.
bytesperline
)
{
if
((
btv
->
opt_vcr_hack
)
&&
(
line
>=
(
ov
->
w
.
height
-
VCR_HACK_LINES
)))
continue
;
if
((
line
%
2
)
==
0
&&
skip_even
)
continue
;
if
((
line
%
2
)
==
1
&&
skip_odd
)
if
((
line
%
2
)
==
0
&&
skip_even
)
continue
;
if
((
line
%
2
)
==
1
&&
skip_odd
)
...
...
drivers/media/video/bttv-vbi.c
View file @
9d8a5eb8
...
...
@@ -87,7 +87,7 @@ static int vbi_buffer_prepare(struct file *file, struct videobuf_buffer *vb,
return
-
EINVAL
;
if
(
STATE_NEEDS_INIT
==
buf
->
vb
.
state
)
{
if
(
0
!=
(
rc
=
videobuf_iolock
(
btv
->
dev
,
&
buf
->
vb
)))
if
(
0
!=
(
rc
=
videobuf_iolock
(
btv
->
dev
,
&
buf
->
vb
,
NULL
)))
goto
fail
;
if
(
0
!=
(
rc
=
vbi_buffer_risc
(
btv
,
buf
,
fh
->
lines
)))
goto
fail
;
...
...
drivers/media/video/bttv.h
View file @
9d8a5eb8
...
...
@@ -115,6 +115,8 @@
#define BTTV_XGUARD 0x67
#define BTTV_NEBULA_DIGITV 0x68
#define BTTV_PV143 0x69
#define BTTV_IVC100 0x6e
#define BTTV_IVC120 0x6f
/* i2c address list */
#define I2C_TSA5522 0xc2
...
...
@@ -170,6 +172,9 @@ struct tvcard
unsigned
int
needs_tvaudio
:
1
;
unsigned
int
msp34xx_alt
:
1
;
/* flag: video pci function is unused */
unsigned
int
no_video
;
/* other settings */
unsigned
int
pll
;
#define PLL_NONE 0
...
...
drivers/media/video/bttvp.h
View file @
9d8a5eb8
...
...
@@ -24,9 +24,8 @@
#ifndef _BTTVP_H_
#define _BTTVP_H_
#include <linux/version.h>
#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,1
1
)
#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,1
2
)
#include <linux/types.h>
#include <linux/wait.h>
...
...
@@ -34,9 +33,11 @@
#include <linux/i2c-algo-bit.h>
#include <linux/videodev.h>
#include <linux/pci.h>
#include <linux/input.h>
#include <asm/scatterlist.h>
#include <asm/io.h>
#include <linux/device.h>
#include <media/video-buf.h>
#include <media/audiochip.h>
#include <media/tuner.h>
...
...
@@ -44,6 +45,9 @@
#include "bt848.h"
#include "bttv.h"
#include "btcx-risc.h"
#ifdef CONFIG_VIDEO_IR
#include "ir-common.h"
#endif
#ifdef __KERNEL__
...
...
@@ -142,6 +146,9 @@ struct bttv_overlay {
struct
bttv_fh
{
struct
bttv
*
btv
;
int
resources
;
#ifdef VIDIOC_G_PRIORITY
enum
v4l2_priority
prio
;
#endif
enum
v4l2_buf_type
type
;
/* video capture */
...
...
@@ -211,6 +218,12 @@ void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines);
extern
struct
videobuf_queue_ops
bttv_vbi_qops
;
/* ---------------------------------------------------------- */
/* bttv-input.c */
int
bttv_input_init
(
struct
bttv
*
btv
);
void
bttv_input_fini
(
struct
bttv
*
btv
);
void
bttv_input_irq
(
struct
bttv
*
btv
);
/* ---------------------------------------------------------- */
/* bttv-driver.c */
...
...
@@ -221,6 +234,7 @@ extern unsigned int bttv_debug;
extern
unsigned
int
bttv_gpio
;
extern
void
bttv_gpio_tracking
(
struct
bttv
*
btv
,
char
*
comment
);
extern
int
init_bttv_i2c
(
struct
bttv
*
btv
);
extern
int
fini_bttv_i2c
(
struct
bttv
*
btv
);
extern
int
pvr_boot
(
struct
bttv
*
btv
);
extern
int
bttv_common_ioctls
(
struct
bttv
*
btv
,
unsigned
int
cmd
,
void
*
arg
);
...
...
@@ -249,6 +263,18 @@ struct bttv_pll_info {
unsigned
int
pll_current
;
/* Currently programmed ofreq */
};
#ifdef CONFIG_VIDEO_IR
/* for gpio-connected remote control */
struct
bttv_input
{
struct
input_dev
dev
;
struct
ir_input_state
ir
;
char
name
[
32
];
char
phys
[
32
];
u32
mask_keycode
;
u32
mask_keydown
;
};
#endif
struct
bttv
{
/* pci device config */
struct
pci_dev
*
dev
;
...
...
@@ -263,6 +289,7 @@ struct bttv {
unsigned
int
type
;
/* card type (pointer into tvcards[]) */
unsigned
int
tuner_type
;
/* tuner chip type */
unsigned
int
pinnacle_id
;
unsigned
int
svhs
;
struct
bttv_pll_info
pll
;
int
triton1
;
...
...
@@ -278,22 +305,31 @@ struct bttv {
int
i2c_state
,
i2c_rc
;
/* video4linux (1) */
struct
video_device
video_dev
;
struct
video_device
radio_dev
;
struct
video_device
vbi_dev
;
struct
video_device
*
video_dev
;
struct
video_device
*
radio_dev
;
struct
video_device
*
vbi_dev
;
/* infrared remote */
int
has_remote
;
#ifdef CONFIG_VIDEO_IR
struct
bttv_input
*
remote
;
#endif
/* locking */
spinlock_t
s_lock
;
struct
semaphore
lock
;
int
resources
;
struct
semaphore
reslock
;
#ifdef VIDIOC_G_PRIORITY
struct
v4l2_prio_state
prio
;
#endif
/* video state */
unsigned
int
input
;
unsigned
int
audio
;
unsigned
long
freq
;
int
tvnorm
,
hue
,
contrast
,
bright
,
saturation
;
struct
v
ideo_
buffer
fbuf
;
struct
v
4l2_frame
buffer
fbuf
;
unsigned
int
field_count
;
/* various options */
...
...
@@ -302,6 +338,7 @@ struct bttv {
int
opt_automute
;
int
opt_chroma_agc
;
int
opt_adc_crush
;
int
opt_vcr_hack
;
/* radio data/state */
int
has_radio
;
...
...
@@ -329,6 +366,7 @@ struct bttv {
struct
list_head
capture
;
/* video capture queue */
struct
list_head
vcapture
;
/* vbi capture queue */
struct
bttv_buffer_set
curr
;
/* active buffers */
int
new_input
;
unsigned
long
cap_ctl
;
unsigned
long
dma_on
;
...
...
drivers/media/video/saa7134/saa6752hs.c
0 → 100644
View file @
9d8a5eb8
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/i2c.h>
#include <linux/types.h>
#include <linux/videodev.h>
#include <linux/init.h>
#include <media/id.h>
#include <media/saa6752hs.h>
/* Addresses to scan */
static
unsigned
short
normal_i2c
[]
=
{
0x20
,
I2C_CLIENT_END
};
static
unsigned
short
normal_i2c_range
[]
=
{
I2C_CLIENT_END
};
I2C_CLIENT_INSMOD
;
MODULE_DESCRIPTION
(
"device driver for saa6752hs MPEG2 encoder"
);
MODULE_AUTHOR
(
"Andrew de Quincey"
);
MODULE_LICENSE
(
"GPL"
);
static
struct
i2c_driver
driver
;
static
struct
i2c_client
client_template
;
enum
saa6752hs_command
{
SAA6752HS_COMMAND_RESET
=
0
,
SAA6752HS_COMMAND_STOP
=
1
,
SAA6752HS_COMMAND_START
=
2
,
SAA6752HS_COMMAND_PAUSE
=
3
,
SAA6752HS_COMMAND_RECONFIGURE
=
4
,
SAA6752HS_COMMAND_SLEEP
=
5
,
SAA6752HS_COMMAND_RECONFIGURE_FORCE
=
6
,
SAA6752HS_COMMAND_MAX
};
/* ---------------------------------------------------------------------- */
static
u8
PAT
[]
=
{
0xc2
,
// i2c register
0x00
,
// table number for encoder
0x47
,
// sync
0x40
,
0x00
,
// transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0)
0x10
,
// transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00
,
// PSI pointer to start of table
0x00
,
// tid(0)
0xb0
,
0x0d
,
// section_syntax_indicator(1), section_length(13)
0x00
,
0x01
,
// transport_stream_id(1)
0xc1
,
// version_number(0), current_next_indicator(1)
0x00
,
0x00
,
// section_number(0), last_section_number(0)
0x00
,
0x01
,
// program_number(1)
0xe0
,
0x10
,
// PMT PID(0x10)
0x76
,
0xf1
,
0x44
,
0xd1
// CRC32
};
static
u8
PMT
[]
=
{
0xc2
,
// i2c register
0x01
,
// table number for encoder
0x47
,
// sync
0x40
,
0x10
,
// transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0x10)
0x10
,
// transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00
,
// PSI pointer to start of table
0x02
,
// tid(2)
0xb0
,
0x17
,
// section_syntax_indicator(1), section_length(23)
0x00
,
0x01
,
// program_number(1)
0xc1
,
// version_number(0), current_next_indicator(1)
0x00
,
0x00
,
// section_number(0), last_section_number(0)
0xe1
,
0x04
,
// PCR_PID (0x104)
0xf0
,
0x00
,
// program_info_length(0)
0x02
,
0xe1
,
0x00
,
0xf0
,
0x00
,
// video stream type(2), pid(0x100)
0x04
,
0xe1
,
0x03
,
0xf0
,
0x00
,
// audio stream type(4), pid(0x103)
0xa1
,
0xca
,
0x0f
,
0x82
// CRC32
};
static
struct
mpeg_params
mpeg_params_template
=
{
.
bitrate_mode
=
MPEG_BITRATE_MODE_CBR
,
.
video_target_bitrate
=
5000
,
.
audio_bitrate
=
MPEG_AUDIO_BITRATE_256
,
.
total_bitrate
=
6000
,
};
/* ---------------------------------------------------------------------- */
static
int
saa6752hs_chip_command
(
struct
i2c_client
*
client
,
enum
saa6752hs_command
command
)
{
unsigned
char
buf
[
3
];
unsigned
long
timeout
;
int
status
=
0
;
// execute the command
switch
(
command
)
{
case
SAA6752HS_COMMAND_RESET
:
buf
[
0
]
=
0x00
;
break
;
case
SAA6752HS_COMMAND_STOP
:
buf
[
0
]
=
0x03
;
break
;
case
SAA6752HS_COMMAND_START
:
buf
[
0
]
=
0x02
;
break
;
case
SAA6752HS_COMMAND_PAUSE
:
buf
[
0
]
=
0x04
;
break
;
case
SAA6752HS_COMMAND_RECONFIGURE
:
buf
[
0
]
=
0x05
;
break
;
case
SAA6752HS_COMMAND_SLEEP
:
buf
[
0
]
=
0x06
;
break
;
case
SAA6752HS_COMMAND_RECONFIGURE_FORCE
:
buf
[
0
]
=
0x07
;
break
;
default:
return
-
EINVAL
;
}
// set it and wait for it to be so
i2c_master_send
(
client
,
buf
,
1
);
timeout
=
jiffies
+
HZ
*
3
;
for
(;;)
{
// get the current status
buf
[
0
]
=
0x10
;
i2c_master_send
(
client
,
buf
,
1
);
i2c_master_recv
(
client
,
buf
,
1
);
if
(
!
(
buf
[
0
]
&
0x20
))
break
;
if
(
time_after
(
jiffies
,
timeout
))
{
status
=
-
ETIMEDOUT
;
break
;
}
// wait a bit
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
1
);
}
// delay a bit to let encoder settle
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
5
);
// done
return
status
;
}
static
int
saa6752hs_set_bitrate
(
struct
i2c_client
*
client
,
struct
mpeg_params
*
params
)
{
u8
buf
[
3
];
// set the bitrate mode
buf
[
0
]
=
0x71
;
buf
[
1
]
=
params
->
bitrate_mode
;
i2c_master_send
(
client
,
buf
,
2
);
// set the video bitrate
if
(
params
->
bitrate_mode
==
MPEG_BITRATE_MODE_VBR
)
{
// set the target bitrate
buf
[
0
]
=
0x80
;
buf
[
1
]
=
params
->
video_target_bitrate
>>
8
;
buf
[
2
]
=
params
->
video_target_bitrate
&
0xff
;
i2c_master_send
(
client
,
buf
,
3
);
// set the max bitrate
buf
[
0
]
=
0x81
;
buf
[
1
]
=
params
->
video_max_bitrate
>>
8
;
buf
[
2
]
=
params
->
video_max_bitrate
&
0xff
;
i2c_master_send
(
client
,
buf
,
3
);
}
else
{
// set the target bitrate (no max bitrate for CBR)
buf
[
0
]
=
0x81
;
buf
[
1
]
=
params
->
video_target_bitrate
>>
8
;
buf
[
2
]
=
params
->
video_target_bitrate
&
0xff
;
i2c_master_send
(
client
,
buf
,
3
);
}
// set the audio bitrate
buf
[
0
]
=
0x94
;
buf
[
1
]
=
params
->
audio_bitrate
;
i2c_master_send
(
client
,
buf
,
2
);
// set the total bitrate
buf
[
0
]
=
0xb1
;
buf
[
1
]
=
params
->
total_bitrate
>>
8
;
buf
[
2
]
=
params
->
total_bitrate
&
0xff
;
i2c_master_send
(
client
,
buf
,
3
);
return
0
;
}
static
int
saa6752hs_init
(
struct
i2c_client
*
client
,
struct
mpeg_params
*
params
)
{
unsigned
char
buf
[
3
];
// check the bitrate parameters first
if
(
params
!=
NULL
)
{
if
(
params
->
bitrate_mode
>=
MPEG_BITRATE_MODE_MAX
)
return
-
EINVAL
;
if
(
params
->
video_target_bitrate
>=
MPEG_VIDEO_TARGET_BITRATE_MAX
)
return
-
EINVAL
;
if
(
params
->
video_max_bitrate
>=
MPEG_VIDEO_MAX_BITRATE_MAX
)
return
-
EINVAL
;
if
(
params
->
audio_bitrate
>=
MPEG_AUDIO_BITRATE_MAX
)
return
-
EINVAL
;
if
(
params
->
total_bitrate
>=
MPEG_TOTAL_BITRATE_MAX
)
return
-
EINVAL
;
if
(
params
->
bitrate_mode
==
MPEG_BITRATE_MODE_MAX
&&
params
->
video_target_bitrate
<=
params
->
video_max_bitrate
)
return
-
EINVAL
;
}
// Set GOP structure {3, 13}
buf
[
0
]
=
0x72
;
buf
[
1
]
=
0x03
;
buf
[
2
]
=
0x0D
;
i2c_master_send
(
client
,
buf
,
3
);
// Set minimum Q-scale {4}
buf
[
0
]
=
0x82
;
buf
[
1
]
=
0x04
;
i2c_master_send
(
client
,
buf
,
2
);
// Set maximum Q-scale {12}
buf
[
0
]
=
0x83
;
buf
[
1
]
=
0x0C
;
i2c_master_send
(
client
,
buf
,
2
);
// Set Output Protocol
buf
[
0
]
=
0xD0
;
buf
[
1
]
=
0x01
;
i2c_master_send
(
client
,
buf
,
2
);
// Set video output stream format {TS}
buf
[
0
]
=
0xB0
;
buf
[
1
]
=
0x05
;
i2c_master_send
(
client
,
buf
,
2
);
// Set Audio PID {0x103}
buf
[
0
]
=
0xC1
;
buf
[
1
]
=
0x01
;
buf
[
2
]
=
0x03
;
i2c_master_send
(
client
,
buf
,
3
);
// setup bitrate settings
if
(
params
)
{
saa6752hs_set_bitrate
(
client
,
params
);
memcpy
(
client
->
data
,
params
,
sizeof
(
struct
mpeg_params
));
}
else
{
// parameters were not supplied. use the previous set
saa6752hs_set_bitrate
(
client
,
(
struct
mpeg_params
*
)
client
->
data
);
}
// Send SI tables
i2c_master_send
(
client
,
PAT
,
sizeof
(
PAT
));
i2c_master_send
(
client
,
PMT
,
sizeof
(
PMT
));
// mute then unmute audio. This removes buzzing artefacts
buf
[
0
]
=
0xa4
;
buf
[
1
]
=
1
;
i2c_master_send
(
client
,
buf
,
2
);
buf
[
1
]
=
0
;
i2c_master_send
(
client
,
buf
,
2
);
// start it going
saa6752hs_chip_command
(
client
,
SAA6752HS_COMMAND_START
);
return
0
;
}
static
int
saa6752hs_attach
(
struct
i2c_adapter
*
adap
,
int
addr
,
int
kind
)
{
struct
i2c_client
*
client
;
struct
mpeg_params
*
params
;
client_template
.
adapter
=
adap
;
client_template
.
addr
=
addr
;
printk
(
"saa6752hs: chip found @ 0x%x
\n
"
,
addr
<<
1
);
if
(
NULL
==
(
client
=
kmalloc
(
sizeof
(
struct
i2c_client
),
GFP_KERNEL
)))
return
-
ENOMEM
;
memcpy
(
client
,
&
client_template
,
sizeof
(
struct
i2c_client
));
strlcpy
(
client
->
name
,
"saa6752hs"
,
sizeof
(
client
->
name
));
if
(
NULL
==
(
params
=
kmalloc
(
sizeof
(
struct
mpeg_params
),
GFP_KERNEL
)))
return
-
ENOMEM
;
memcpy
(
params
,
&
mpeg_params_template
,
sizeof
(
struct
mpeg_params
));
client
->
data
=
params
;
i2c_attach_client
(
client
);
return
0
;
}
static
int
saa6752hs_probe
(
struct
i2c_adapter
*
adap
)
{
if
(
adap
->
class
&
I2C_ADAP_CLASS_TV_ANALOG
)
return
i2c_probe
(
adap
,
&
addr_data
,
saa6752hs_attach
);
return
0
;
}
static
int
saa6752hs_detach
(
struct
i2c_client
*
client
)
{
i2c_detach_client
(
client
);
kfree
(
client
->
data
);
kfree
(
client
);
return
0
;
}
static
int
saa6752hs_command
(
struct
i2c_client
*
client
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
mpeg_params
*
init_arg
=
arg
;
switch
(
cmd
)
{
case
MPEG_SETPARAMS
:
return
saa6752hs_init
(
client
,
init_arg
);
default:
/* nothing */
break
;
}
return
0
;
}
/* ----------------------------------------------------------------------- */
static
struct
i2c_driver
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"i2c saa6752hs MPEG encoder"
,
.
id
=
I2C_DRIVERID_SAA6752HS
,
.
flags
=
I2C_DF_NOTIFY
,
.
attach_adapter
=
saa6752hs_probe
,
.
detach_client
=
saa6752hs_detach
,
.
command
=
saa6752hs_command
,
};
static
struct
i2c_client
client_template
=
{
I2C_DEVNAME
(
"(saa6752hs unset)"
),
.
flags
=
I2C_CLIENT_ALLOW_USE
,
.
driver
=
&
driver
,
};
static
int
saa6752hs_init_module
(
void
)
{
i2c_add_driver
(
&
driver
);
return
0
;
}
static
void
saa6752hs_cleanup_module
(
void
)
{
i2c_del_driver
(
&
driver
);
}
module_init
(
saa6752hs_init_module
);
module_exit
(
saa6752hs_cleanup_module
);
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* ---------------------------------------------------------------------------
* Local variables:
* c-basic-offset: 8
* End:
*/
drivers/media/video/saa7134/saa7134-cards.c
View file @
9d8a5eb8
...
...
@@ -32,6 +32,8 @@ static char name_tv[] = "Television";
static
char
name_tv_mono
[]
=
"TV (mono only)"
;
static
char
name_comp1
[]
=
"Composite1"
;
static
char
name_comp2
[]
=
"Composite2"
;
static
char
name_comp3
[]
=
"Composite3"
;
static
char
name_comp4
[]
=
"Composite4"
;
static
char
name_svideo
[]
=
"S-Video"
;
/* ------------------------------------------------------------------ */
...
...
@@ -361,14 +363,16 @@ struct saa7134_board saa7134_boards[] = {
},
[
SAA7134_BOARD_MD7134
]
=
{
.
name
=
"Medion 7134"
,
.
audio_clock
=
0x00200000
,
//.audio_clock = 0x00200000,
.
audio_clock
=
0x00187de7
,
.
tuner_type
=
TUNER_PHILIPS_FM1216ME_MK3
,
.
need_tda9887
=
1
,
.
inputs
=
{{
.
name
=
name_tv
,
.
vmux
=
1
,
.
amux
=
LINE2
,
.
amux
=
TV
,
.
tv
=
1
,
#if 0
},{
.name = name_comp1,
.vmux = 0,
...
...
@@ -381,6 +385,7 @@ struct saa7134_board saa7134_boards[] = {
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
#endif
}},
.
radio
=
{
.
name
=
name_radio
,
...
...
@@ -388,9 +393,12 @@ struct saa7134_board saa7134_boards[] = {
},
},
[
SAA7134_BOARD_TYPHOON_90031
]
=
{
/* Christian Rothl�nder <Christian@Rothlaender.net> */
.
name
=
"Typhoon TV+Radio 90031"
,
.
audio_clock
=
0x00200000
,
.
tuner_type
=
TUNER_PHILIPS_PAL
,
//.tuner_type = TUNER_PHILIPS_PAL,
.
tuner_type
=
TUNER_PHILIPS_FM1216ME_MK3
,
.
need_tda9887
=
1
,
.
inputs
=
{{
.
name
=
name_tv
,
.
vmux
=
1
,
...
...
@@ -409,7 +417,7 @@ struct saa7134_board saa7134_boards[] = {
.
name
=
name_radio
,
.
amux
=
LINE2
,
},
},
},
[
SAA7134_BOARD_ELSA
]
=
{
.
name
=
"ELSA EX-VISION 300TV"
,
.
audio_clock
=
0x00187de7
,
...
...
@@ -444,14 +452,123 @@ struct saa7134_board saa7134_boards[] = {
.
tv
=
1
,
}},
},
[
SAA7134_BOARD_ASUSTeK_TVFM7134
]
=
{
.
name
=
"ASUS TV-FM 7134"
,
.
audio_clock
=
0x00187de7
,
.
tuner_type
=
TUNER_PHILIPS_FM1216ME_MK3
,
.
need_tda9887
=
1
,
.
inputs
=
{{
.
name
=
name_tv
,
.
vmux
=
1
,
.
amux
=
TV
,
.
tv
=
1
,
#if 0 /* untested */
},{
.name = name_comp1,
.vmux = 4,
.amux = LINE2,
},{
.name = name_comp2,
.vmux = 2,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 6,
.amux = LINE2,
},{
.name = "S-Video2",
.vmux = 7,
.amux = LINE2,
#endif
}},
.
radio
=
{
.
name
=
name_radio
,
.
amux
=
LINE1
,
},
},
[
SAA7134_BOARD_VA1000POWER
]
=
{
.
name
=
"AOPEN VA1000 POWER"
,
.
audio_clock
=
0x00187de7
,
.
tuner_type
=
TUNER_PHILIPS_NTSC
,
.
inputs
=
{{
.
name
=
name_svideo
,
.
vmux
=
8
,
.
amux
=
LINE1
,
},{
.
name
=
name_comp1
,
.
vmux
=
3
,
.
amux
=
LINE1
,
},{
.
name
=
name_tv
,
.
vmux
=
1
,
.
amux
=
LINE2
,
.
tv
=
1
,
}},
},
[
SAA7134_BOARD_BMK_MPEX_NOTUNER
]
=
{
/* "Andrew de Quincey" <adq@lidskialf.net> */
.
name
=
"BMK MPEX No Tuner"
,
.
audio_clock
=
0x200000
,
.
tuner_type
=
TUNER_ABSENT
,
.
inputs
=
{{
.
name
=
name_comp1
,
.
vmux
=
4
,
.
amux
=
LINE1
,
},{
.
name
=
name_comp2
,
.
vmux
=
3
,
.
amux
=
LINE1
,
},{
.
name
=
name_comp3
,
.
vmux
=
0
,
.
amux
=
LINE1
,
},{
.
name
=
name_comp4
,
.
vmux
=
1
,
.
amux
=
LINE1
,
},{
.
name
=
name_svideo
,
.
vmux
=
8
,
.
amux
=
LINE1
,
}},
.
i2s_rate
=
48000
,
.
has_ts
=
1
,
.
video_out
=
CCIR656
,
},
[
SAA7134_BOARD_VIDEOMATE_TV
]
=
{
.
name
=
"Compro VideoMate TV"
,
.
audio_clock
=
0x00187de7
,
.
tuner_type
=
TUNER_PHILIPS_NTSC_M
,
.
inputs
=
{{
.
name
=
name_svideo
,
.
vmux
=
8
,
.
amux
=
LINE1
,
},{
.
name
=
name_comp1
,
.
vmux
=
3
,
.
amux
=
LINE1
,
},{
.
name
=
name_tv
,
.
vmux
=
1
,
.
amux
=
LINE2
,
.
tv
=
1
,
}},
},
[
SAA7134_BOARD_CRONOS_PLUS
]
=
{
.
name
=
"Matrox CronosPlus"
,
.
tuner_type
=
TUNER_ABSENT
,
.
inputs
=
{{
.
name
=
name_comp1
,
.
vmux
=
0
,
}},
},
};
const
unsigned
int
saa7134_bcount
=
ARRAY_SIZE
(
saa7134_boards
);
/* ------------------------------------------------------------------ */
/* PCI ids + subsystem IDs */
struct
pci_device_id
__devinitdata
saa7134_pci_tbl
[]
=
{
struct
pci_device_id
saa7134_pci_tbl
[]
=
{
{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7134
,
...
...
@@ -519,6 +636,42 @@ struct pci_device_id __devinitdata saa7134_pci_tbl[] = {
.
subdevice
=
0x226b
,
.
driver_data
=
SAA7134_BOARD_ELSA_500TV
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7134
,
.
subvendor
=
PCI_VENDOR_ID_ASUSTEK
,
.
subdevice
=
0x4842
,
.
driver_data
=
SAA7134_BOARD_ASUSTeK_TVFM7134
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7134
,
.
subvendor
=
PCI_VENDOR_ID_ASUSTEK
,
.
subdevice
=
0x4830
,
.
driver_data
=
SAA7134_BOARD_ASUSTeK_TVFM7134
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7134
,
.
subvendor
=
PCI_VENDOR_ID_PHILIPS
,
.
subdevice
=
0xfe01
,
.
driver_data
=
SAA7134_BOARD_TYPHOON_90031
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7134
,
.
subvendor
=
0x1131
,
.
subdevice
=
0x7133
,
.
driver_data
=
SAA7134_BOARD_VA1000POWER
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7133
,
.
subvendor
=
0x185b
,
.
subdevice
=
0xc100
,
.
driver_data
=
SAA7134_BOARD_VIDEOMATE_TV
,
},{
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
.
device
=
PCI_DEVICE_ID_PHILIPS_SAA7130
,
.
subvendor
=
PCI_VENDOR_ID_MATROX
,
.
subdevice
=
0x48d0
,
.
driver_data
=
SAA7134_BOARD_CRONOS_PLUS
,
},{
/* --- boards without eeprom + subsystem ID --- */
.
vendor
=
PCI_VENDOR_ID_PHILIPS
,
...
...
@@ -595,22 +748,16 @@ static struct {
static
void
board_flyvideo
(
struct
saa7134_dev
*
dev
)
{
#if 0
u32 value;
int index;
saa_writel
(
SAA7134_GPIO_GPMODE0
>>
2
,
0
);
value
=
saa_readl
(
SAA7134_GPIO_GPSTATUS0
>>
2
);
#if 0
{
int index = (value & 0x1f00) >> 8;
printk(KERN_INFO "%s: flyvideo: gpio is 0x%x "
"[model=%s,tuner=%d]\n",
dev->name, value, fly_list[index].model,
fly_list[index].tuner_type);
dev->tuner_type = fly_list[index].tuner_type;
}
#else
printk
(
KERN_INFO
"%s: flyvideo: gpio is 0x%x
\n
"
,
dev
->
name
,
value
);
value = dev->gpio_value;
index = (value & 0x1f00) >> 8;
printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n",
dev->name, value, fly_list[index].model,
fly_list[index].tuner_type);
dev->tuner_type = fly_list[index].tuner_type;
#endif
}
...
...
@@ -618,10 +765,19 @@ static void board_flyvideo(struct saa7134_dev *dev)
int
saa7134_board_init
(
struct
saa7134_dev
*
dev
)
{
// Always print gpio, often manufacturers encode tuner type and other info.
saa_writel
(
SAA7134_GPIO_GPMODE0
>>
2
,
0
);
dev
->
gpio_value
=
saa_readl
(
SAA7134_GPIO_GPSTATUS0
>>
2
);
printk
(
KERN_INFO
"%s: board init: gpio is %x
\n
"
,
dev
->
name
,
dev
->
gpio_value
);
switch
(
dev
->
board
)
{
case
SAA7134_BOARD_FLYVIDEO2000
:
case
SAA7134_BOARD_FLYVIDEO3000
:
board_flyvideo
(
dev
);
dev
->
has_remote
=
1
;
break
;
case
SAA7134_BOARD_CINERGY400
:
dev
->
has_remote
=
1
;
break
;
}
return
0
;
...
...
drivers/media/video/saa7134/saa7134-core.c
View file @
9d8a5eb8
...
...
@@ -35,7 +35,7 @@ MODULE_DESCRIPTION("v4l2 driver module for saa7130/34 based TV cards");
MODULE_AUTHOR
(
"Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"
);
MODULE_LICENSE
(
"GPL"
);
#define SAA7134_MAXBOARDS
4
#define SAA7134_MAXBOARDS
8
/* ------------------------------------------------------------------ */
...
...
@@ -51,32 +51,32 @@ static unsigned int gpio_tracking = 0;
MODULE_PARM
(
gpio_tracking
,
"i"
);
MODULE_PARM_DESC
(
gpio_tracking
,
"enable debug messages [gpio]"
);
static
unsigned
int
video_nr
=
-
1
;
MODULE_PARM
(
video_nr
,
"i"
);
static
unsigned
int
video_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
video_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
video_nr
,
"video device number"
);
static
unsigned
int
ts_nr
=
-
1
;
MODULE_PARM
(
ts_nr
,
"i"
);
static
unsigned
int
ts_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
ts_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
ts_nr
,
"ts device number"
);
static
unsigned
int
vbi_nr
=
-
1
;
MODULE_PARM
(
vbi_nr
,
"i"
);
static
unsigned
int
vbi_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
vbi_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
vbi_nr
,
"vbi device number"
);
static
unsigned
int
radio_nr
=
-
1
;
MODULE_PARM
(
radio_nr
,
"i"
);
static
unsigned
int
radio_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
radio_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
radio_nr
,
"radio device number"
);
static
unsigned
int
oss
=
0
;
MODULE_PARM
(
oss
,
"i"
);
MODULE_PARM_DESC
(
oss
,
"register oss devices (default: no)"
);
static
unsigned
int
dsp_nr
=
-
1
;
MODULE_PARM
(
dsp_nr
,
"i"
);
static
unsigned
int
dsp_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
dsp_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
dsp_nr
,
"oss dsp device number"
);
static
unsigned
int
mixer_nr
=
-
1
;
MODULE_PARM
(
mixer_nr
,
"i"
);
static
unsigned
int
mixer_nr
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
}
;
MODULE_PARM
(
mixer_nr
,
"
1-"
__stringify
(
SAA7134_MAXBOARDS
)
"
i"
);
MODULE_PARM_DESC
(
mixer_nr
,
"oss mixer device number"
);
static
unsigned
int
tuner
[]
=
{[
0
...
(
SAA7134_MAXBOARDS
-
1
)]
=
UNSET
};
...
...
@@ -529,7 +529,8 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)
static
char
*
irqbits
[]
=
{
"DONE_RA0"
,
"DONE_RA1"
,
"DONE_RA2"
,
"DONE_RA3"
,
"AR"
,
"PE"
,
"PWR_ON"
,
"RDCAP"
,
"INTL"
,
"FIDT"
,
"MMC"
,
"TRIG_ERR"
,
"CONF_ERR"
,
"LOAD_ERR"
"TRIG_ERR"
,
"CONF_ERR"
,
"LOAD_ERR"
,
"GPIO16?"
,
"GPIO18"
,
"GPIO22"
,
"GPIO23"
};
#define IRQBITS ARRAY_SIZE(irqbits)
...
...
@@ -598,6 +599,13 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
if
((
report
&
SAA7134_IRQ_REPORT_DONE_RA3
))
saa7134_irq_oss_done
(
dev
,
status
);
#ifdef CONFIG_VIDEO_IR
if
((
report
&
(
SAA7134_IRQ_REPORT_GPIO16
|
SAA7134_IRQ_REPORT_GPIO18
))
&&
dev
->
remote
)
saa7134_input_irq
(
dev
);
#endif
};
if
(
10
==
loop
)
{
print_irqstatus
(
dev
,
loop
,
report
,
status
);
...
...
@@ -613,23 +621,30 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
/* ------------------------------------------------------------------ */
static
int
saa7134_hwinit
(
struct
saa7134_dev
*
dev
)
/* early init (no i2c, no irq) */
static
int
saa7134_hwinit1
(
struct
saa7134_dev
*
dev
)
{
dprintk
(
"hwinit1
\n
"
);
saa_writel
(
SAA7134_IRQ1
,
0
);
saa_writel
(
SAA7134_IRQ2
,
0
);
init_MUTEX
(
&
dev
->
lock
);
dev
->
slock
=
SPIN_LOCK_UNLOCKED
;
saa7134_track_gpio
(
dev
,
"pre-init"
);
saa7134_tvaudio_init
(
dev
);
saa7134_video_init
(
dev
);
saa7134_vbi_init
(
dev
);
saa7134_video_init1
(
dev
);
saa7134_vbi_init1
(
dev
);
if
(
card_has_ts
(
dev
))
saa7134_ts_init
(
dev
);
saa7134_ts_init1
(
dev
);
#ifdef CONFIG_VIDEO_IR
saa7134_input_init1
(
dev
);
#endif
switch
(
dev
->
pci
->
device
)
{
case
PCI_DEVICE_ID_PHILIPS_SAA7134
:
case
PCI_DEVICE_ID_PHILIPS_SAA7133
:
case
PCI_DEVICE_ID_PHILIPS_SAA7135
:
saa7134_oss_init
(
dev
);
saa7134_oss_init
1
(
dev
);
break
;
}
...
...
@@ -648,20 +663,6 @@ static int saa7134_hwinit(struct saa7134_dev *dev)
SAA7134_MAIN_CTRL_EBADC
|
SAA7134_MAIN_CTRL_EBDAC
);
/* IRQ's */
saa_writel
(
SAA7134_IRQ1
,
0
);
saa_writel
(
SAA7134_IRQ2
,
SAA7134_IRQ2_INTE_SC2
|
SAA7134_IRQ2_INTE_SC1
|
SAA7134_IRQ2_INTE_SC0
|
/* SAA7134_IRQ2_INTE_DEC5 | FIXME: TRIG_ERR ??? */
SAA7134_IRQ2_INTE_DEC3
|
SAA7134_IRQ2_INTE_DEC2
|
/* SAA7134_IRQ2_INTE_DEC1 | */
SAA7134_IRQ2_INTE_DEC0
|
SAA7134_IRQ2_INTE_PE
|
SAA7134_IRQ2_INTE_AR
);
/* enable peripheral devices */
saa_writeb
(
SAA7134_SPECIAL_MODE
,
0x01
);
...
...
@@ -671,6 +672,57 @@ static int saa7134_hwinit(struct saa7134_dev *dev)
return
0
;
}
/* late init (with i2c + irq) */
static
int
saa7134_hwinit2
(
struct
saa7134_dev
*
dev
)
{
dprintk
(
"hwinit2
\n
"
);
saa7134_video_init2
(
dev
);
saa7134_tvaudio_init2
(
dev
);
/* enable IRQ's */
saa_writel
(
SAA7134_IRQ1
,
0
);
saa_writel
(
SAA7134_IRQ2
,
SAA7134_IRQ2_INTE_GPIO18
|
SAA7134_IRQ2_INTE_GPIO18A
|
SAA7134_IRQ2_INTE_GPIO16
|
SAA7134_IRQ2_INTE_SC2
|
SAA7134_IRQ2_INTE_SC1
|
SAA7134_IRQ2_INTE_SC0
|
/* SAA7134_IRQ2_INTE_DEC5 | FIXME: TRIG_ERR ??? */
SAA7134_IRQ2_INTE_DEC3
|
SAA7134_IRQ2_INTE_DEC2
|
/* SAA7134_IRQ2_INTE_DEC1 | */
SAA7134_IRQ2_INTE_DEC0
|
SAA7134_IRQ2_INTE_PE
|
SAA7134_IRQ2_INTE_AR
);
return
0
;
}
/* shutdown */
static
int
saa7134_hwfini
(
struct
saa7134_dev
*
dev
)
{
dprintk
(
"hwfini
\n
"
);
switch
(
dev
->
pci
->
device
)
{
case
PCI_DEVICE_ID_PHILIPS_SAA7134
:
case
PCI_DEVICE_ID_PHILIPS_SAA7133
:
case
PCI_DEVICE_ID_PHILIPS_SAA7135
:
saa7134_oss_fini
(
dev
);
break
;
}
if
(
card_has_ts
(
dev
))
saa7134_ts_fini
(
dev
);
#ifdef CONFIG_VIDEO_IR
saa7134_input_fini
(
dev
);
#endif
saa7134_vbi_fini
(
dev
);
saa7134_video_fini
(
dev
);
saa7134_tvaudio_fini
(
dev
);
return
0
;
}
static
void
__devinit
must_configure_manually
(
void
)
{
unsigned
int
i
,
p
;
...
...
@@ -698,6 +750,56 @@ static void __devinit must_configure_manually(void)
}
}
static
struct
video_device
*
vdev_init
(
struct
saa7134_dev
*
dev
,
struct
video_device
*
template
,
char
*
type
)
{
struct
video_device
*
vfd
;
vfd
=
video_device_alloc
();
if
(
NULL
==
vfd
)
return
NULL
;
*
vfd
=
*
template
;
vfd
->
minor
=
-
1
;
vfd
->
dev
=
&
dev
->
pci
->
dev
;
vfd
->
release
=
video_device_release
;
snprintf
(
vfd
->
name
,
sizeof
(
vfd
->
name
),
"%s %s (%s)"
,
dev
->
name
,
type
,
saa7134_boards
[
dev
->
board
].
name
);
return
vfd
;
}
static
void
saa7134_unregister_video
(
struct
saa7134_dev
*
dev
)
{
if
(
dev
->
video_dev
)
{
if
(
-
1
!=
dev
->
video_dev
->
minor
)
video_unregister_device
(
dev
->
video_dev
);
else
video_device_release
(
dev
->
video_dev
);
dev
->
video_dev
=
NULL
;
}
if
(
dev
->
ts_dev
)
{
if
(
-
1
!=
dev
->
ts_dev
->
minor
)
video_unregister_device
(
dev
->
ts_dev
);
else
video_device_release
(
dev
->
ts_dev
);
dev
->
ts_dev
=
NULL
;
}
if
(
dev
->
vbi_dev
)
{
if
(
-
1
!=
dev
->
vbi_dev
->
minor
)
video_unregister_device
(
dev
->
vbi_dev
);
else
video_device_release
(
dev
->
vbi_dev
);
dev
->
vbi_dev
=
NULL
;
}
if
(
dev
->
radio_dev
)
{
if
(
-
1
!=
dev
->
radio_dev
->
minor
)
video_unregister_device
(
dev
->
radio_dev
);
else
video_device_release
(
dev
->
radio_dev
);
dev
->
radio_dev
=
NULL
;
}
}
static
int
__devinit
saa7134_initdev
(
struct
pci_dev
*
pci_dev
,
const
struct
pci_device_id
*
pci_id
)
{
...
...
@@ -705,10 +807,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
int
err
;
dev
=
kmalloc
(
sizeof
(
*
dev
),
GFP_KERNEL
);
if
(
NULL
==
dev
)
{
err
=
-
ENOMEM
;
goto
fail0
;
}
if
(
NULL
==
dev
)
return
-
ENOMEM
;
memset
(
dev
,
0
,
sizeof
(
*
dev
));
/* pci init */
...
...
@@ -785,19 +885,17 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
goto
fail1
;
}
dev
->
lmmio
=
ioremap
(
pci_resource_start
(
pci_dev
,
0
),
0x1000
);
if
(
!
dev
->
lmmio
)
{
printk
(
KERN_ERR
"Unable to remap memory.
\n
"
);
err
=
-
ENOMEM
;
dev
->
bmmio
=
(
__u8
*
)
dev
->
lmmio
;
if
(
NULL
==
dev
->
lmmio
)
{
err
=
-
EIO
;
printk
(
KERN_ERR
"%s: can't ioremap() MMIO memory
\n
"
,
dev
->
name
);
goto
fail2
;
}
dev
->
bmmio
=
(
__u8
*
)
dev
->
lmmio
;
/* register i2c bus */
saa7134_i2c_register
(
dev
);
/* initialize hardware */
/* initialize hardware
#1
*/
saa7134_board_init
(
dev
);
saa7134_hwinit
(
dev
);
saa7134_hwinit
1
(
dev
);
/* get irq */
err
=
request_irq
(
pci_dev
->
irq
,
saa7134_irq
,
...
...
@@ -808,53 +906,63 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
goto
fail3
;
}
/* wait a bit, register i2c bus */
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
HZ
/
10
);
saa7134_i2c_register
(
dev
);
/* initialize hardware #2 */
saa7134_hwinit2
(
dev
);
/* load i2c helpers */
if
(
TUNER_ABSENT
!=
dev
->
tuner_type
)
request_module
(
"tuner"
);
if
(
saa7134_boards
[
dev
->
board
].
need_tda9887
)
request_module
(
"tda9887"
);
if
(
card_has_ts
(
dev
))
request_module
(
"saa6752hs"
);
/* register v4l devices */
dev
->
video_dev
=
saa7134_video_template
;
dev
->
video_dev
.
priv
=
dev
;
err
=
video_register_device
(
&
dev
->
video_dev
,
VFL_TYPE_GRABBER
,
video_nr
);
dev
->
video_dev
=
vdev_init
(
dev
,
&
saa7134_video_template
,
"video"
)
;
err
=
video_register_device
(
dev
->
video_dev
,
VFL_TYPE_GRABBER
,
video_nr
[
saa7134_devcount
]
);
if
(
err
<
0
)
{
printk
(
KERN_INFO
"%s: can't register video device
\n
"
,
dev
->
name
);
goto
fail4
;
}
printk
(
KERN_INFO
"%s: registered device video%d [v4l2]
\n
"
,
dev
->
name
,
dev
->
video_dev
.
minor
&
0x1f
);
dev
->
name
,
dev
->
video_dev
->
minor
&
0x1f
);
dev
->
ts_dev
=
saa7134_ts_template
;
dev
->
ts_dev
.
priv
=
dev
;
if
(
card_has_ts
(
dev
))
{
err
=
video_register_device
(
&
dev
->
ts_dev
,
VFL_TYPE_GRABBER
,
ts_nr
);
dev
->
ts_dev
=
vdev_init
(
dev
,
&
saa7134_ts_template
,
"ts"
);
err
=
video_register_device
(
dev
->
ts_dev
,
VFL_TYPE_GRABBER
,
ts_nr
[
saa7134_devcount
]);
if
(
err
<
0
)
{
printk
(
KERN_INFO
"%s: can't register video device
\n
"
,
dev
->
name
);
goto
fail
5
;
goto
fail
4
;
}
printk
(
KERN_INFO
"%s: registered device video%d [ts]
\n
"
,
dev
->
name
,
dev
->
ts_dev
.
minor
&
0x1f
);
dev
->
name
,
dev
->
ts_dev
->
minor
&
0x1f
);
}
dev
->
vbi_dev
=
saa7134_vbi_template
;
dev
->
vbi_dev
.
priv
=
dev
;
err
=
video_register_device
(
&
dev
->
vbi_dev
,
VFL_TYPE_VBI
,
vbi_nr
);
dev
->
vbi_dev
=
vdev_init
(
dev
,
&
saa7134_vbi_template
,
"vbi"
)
;
err
=
video_register_device
(
dev
->
vbi_dev
,
VFL_TYPE_VBI
,
vbi_nr
[
saa7134_devcount
]
);
if
(
err
<
0
)
goto
fail
6
;
goto
fail
4
;
printk
(
KERN_INFO
"%s: registered device vbi%d
\n
"
,
dev
->
name
,
dev
->
vbi_dev
.
minor
&
0x1f
);
dev
->
name
,
dev
->
vbi_dev
->
minor
&
0x1f
);
dev
->
radio_dev
=
saa7134_radio_template
;
dev
->
radio_dev
.
priv
=
dev
;
if
(
card_has_radio
(
dev
))
{
err
=
video_register_device
(
&
dev
->
radio_dev
,
VFL_TYPE_RADIO
,
radio_nr
);
dev
->
radio_dev
=
vdev_init
(
dev
,
&
saa7134_radio_template
,
"radio"
);
err
=
video_register_device
(
dev
->
radio_dev
,
VFL_TYPE_RADIO
,
radio_nr
[
saa7134_devcount
]);
if
(
err
<
0
)
goto
fail
7
;
goto
fail
4
;
printk
(
KERN_INFO
"%s: registered device radio%d
\n
"
,
dev
->
name
,
dev
->
radio_dev
.
minor
&
0x1f
);
dev
->
name
,
dev
->
radio_dev
->
minor
&
0x1f
);
}
/* register oss devices */
...
...
@@ -864,17 +972,19 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
case
PCI_DEVICE_ID_PHILIPS_SAA7135
:
if
(
oss
)
{
err
=
dev
->
oss
.
minor_dsp
=
register_sound_dsp
(
&
saa7134_dsp_fops
,
dsp_nr
);
register_sound_dsp
(
&
saa7134_dsp_fops
,
dsp_nr
[
saa7134_devcount
]);
if
(
err
<
0
)
{
goto
fail
8
;
goto
fail
4
;
}
printk
(
KERN_INFO
"%s: registered device dsp%d
\n
"
,
dev
->
name
,
dev
->
oss
.
minor_dsp
>>
4
);
err
=
dev
->
oss
.
minor_mixer
=
register_sound_mixer
(
&
saa7134_mixer_fops
,
mixer_nr
);
register_sound_mixer
(
&
saa7134_mixer_fops
,
mixer_nr
[
saa7134_devcount
]);
if
(
err
<
0
)
goto
fail
9
;
goto
fail
5
;
printk
(
KERN_INFO
"%s: registered device mixer%d
\n
"
,
dev
->
name
,
dev
->
oss
.
minor_mixer
>>
4
);
}
...
...
@@ -887,7 +997,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
saa7134_devcount
++
;
return
0
;
fail
9
:
fail
5
:
switch
(
dev
->
pci
->
device
)
{
case
PCI_DEVICE_ID_PHILIPS_SAA7134
:
case
PCI_DEVICE_ID_PHILIPS_SAA7133
:
...
...
@@ -896,39 +1006,18 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
unregister_sound_dsp
(
dev
->
oss
.
minor_dsp
);
break
;
}
fail8:
if
(
card_has_radio
(
dev
))
video_unregister_device
(
&
dev
->
radio_dev
);
fail7:
video_unregister_device
(
&
dev
->
vbi_dev
);
fail6:
if
(
card_has_ts
(
dev
))
video_unregister_device
(
&
dev
->
ts_dev
);
fail5:
video_unregister_device
(
&
dev
->
video_dev
);
fail4:
saa7134_unregister_video
(
dev
);
saa7134_i2c_unregister
(
dev
);
free_irq
(
pci_dev
->
irq
,
dev
);
fail3:
switch
(
dev
->
pci
->
device
)
{
case
PCI_DEVICE_ID_PHILIPS_SAA7134
:
case
PCI_DEVICE_ID_PHILIPS_SAA7133
:
case
PCI_DEVICE_ID_PHILIPS_SAA7135
:
saa7134_oss_fini
(
dev
);
break
;
}
if
(
card_has_ts
(
dev
))
saa7134_ts_fini
(
dev
);
saa7134_vbi_fini
(
dev
);
saa7134_video_fini
(
dev
);
saa7134_tvaudio_fini
(
dev
);
iounmap
(
dev
->
lmmio
);
saa7134_i2c_unregister
(
dev
);
saa7134_hwfini
(
dev
);
iounmap
(
dev
->
lmmio
);
fail2:
release_mem_region
(
pci_resource_start
(
pci_dev
,
0
),
pci_resource_len
(
pci_dev
,
0
));
fail1:
kfree
(
dev
);
fail0:
return
err
;
}
...
...
@@ -964,12 +1053,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
saa7134_vbi_fini
(
dev
);
saa7134_video_fini
(
dev
);
saa7134_tvaudio_fini
(
dev
);
iounmap
(
dev
->
lmmio
);
/* release ressources */
free_irq
(
pci_dev
->
irq
,
dev
);
release_mem_region
(
pci_resource_start
(
pci_dev
,
0
),
pci_resource_len
(
pci_dev
,
0
));
/* unregister */
saa7134_i2c_unregister
(
dev
);
...
...
@@ -983,17 +1066,18 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
}
break
;
}
if
(
card_has_radio
(
dev
))
video_unregister_device
(
&
dev
->
radio_dev
);
video_unregister_device
(
&
dev
->
vbi_dev
);
if
(
card_has_ts
(
dev
))
video_unregister_device
(
&
dev
->
ts_dev
);
video_unregister_device
(
&
dev
->
video_dev
);
pci_set_drvdata
(
pci_dev
,
NULL
);
#if 0
/* causes some trouble when reinserting the driver ... */
saa7134_unregister_video
(
dev
);
/* release ressources */
free_irq
(
pci_dev
->
irq
,
dev
);
iounmap
(
dev
->
lmmio
);
release_mem_region
(
pci_resource_start
(
pci_dev
,
0
),
pci_resource_len
(
pci_dev
,
0
)
);
#if 0
/* causes some trouble when reinserting the driver ... */
pci_disable_device(pci_dev);
#endif
pci_set_drvdata
(
pci_dev
,
NULL
);
/* free memory */
list_del
(
&
dev
->
devlist
);
...
...
drivers/media/video/saa7134/saa7134-i2c.c
View file @
9d8a5eb8
...
...
@@ -311,6 +311,17 @@ static u32 functionality(struct i2c_adapter *adap)
return
I2C_FUNC_SMBUS_EMUL
;
}
#ifndef I2C_PEC
static
void
inc_use
(
struct
i2c_adapter
*
adap
)
{
MOD_INC_USE_COUNT
;
}
static
void
dec_use
(
struct
i2c_adapter
*
adap
)
{
MOD_DEC_USE_COUNT
;
}
#endif
static
int
attach_inform
(
struct
i2c_client
*
client
)
{
...
...
@@ -330,8 +341,15 @@ static struct i2c_algorithm saa7134_algo = {
};
static
struct
i2c_adapter
saa7134_adap_template
=
{
#ifdef I2C_PEC
.
owner
=
THIS_MODULE
,
#else
.
inc_use
=
inc_use
,
.
dec_use
=
dec_use
,
#endif
#ifdef I2C_ADAP_CLASS_TV_ANALOG
.
class
=
I2C_ADAP_CLASS_TV_ANALOG
,
#endif
I2C_DEVNAME
(
"saa7134"
),
.
id
=
I2C_ALGO_SAA7134
,
.
algo
=
&
saa7134_algo
,
...
...
@@ -393,12 +411,14 @@ saa7134_i2c_scan(struct saa7134_dev *dev)
void
saa7134_i2c_call_clients
(
struct
saa7134_dev
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
{
BUG_ON
(
NULL
==
dev
->
i2c_adap
.
algo_data
);
i2c_clients_command
(
&
dev
->
i2c_adap
,
cmd
,
arg
);
}
int
saa7134_i2c_register
(
struct
saa7134_dev
*
dev
)
{
dev
->
i2c_adap
=
saa7134_adap_template
;
dev
->
i2c_adap
.
dev
.
parent
=
&
dev
->
pci
->
dev
;
strcpy
(
dev
->
i2c_adap
.
name
,
dev
->
name
);
dev
->
i2c_adap
.
algo_data
=
dev
;
i2c_add_adapter
(
&
dev
->
i2c_adap
);
...
...
drivers/media/video/saa7134/saa7134-oss.c
View file @
9d8a5eb8
...
...
@@ -732,7 +732,7 @@ struct file_operations saa7134_mixer_fops = {
/* ------------------------------------------------------------------ */
int
saa7134_oss_init
(
struct
saa7134_dev
*
dev
)
int
saa7134_oss_init
1
(
struct
saa7134_dev
*
dev
)
{
/* general */
init_MUTEX
(
&
dev
->
oss
.
lock
);
...
...
drivers/media/video/saa7134/saa7134-reg.h
View file @
9d8a5eb8
...
...
@@ -101,7 +101,15 @@
#define SAA7134_IRQ1_INTE_RA0_2 (1 << 2)
#define SAA7134_IRQ1_INTE_RA0_1 (1 << 1)
#define SAA7134_IRQ1_INTE_RA0_0 (1 << 0)
#define SAA7134_IRQ2 (0x2c8 >> 2)
#define SAA7134_IRQ2_INTE_GPIO23A (1 << 17)
#define SAA7134_IRQ2_INTE_GPIO23 (1 << 16)
#define SAA7134_IRQ2_INTE_GPIO22A (1 << 15)
#define SAA7134_IRQ2_INTE_GPIO22 (1 << 14)
#define SAA7134_IRQ2_INTE_GPIO18A (1 << 13)
#define SAA7134_IRQ2_INTE_GPIO18 (1 << 12)
#define SAA7134_IRQ2_INTE_GPIO16 (1 << 11)
/* not certain */
#define SAA7134_IRQ2_INTE_SC2 (1 << 10)
#define SAA7134_IRQ2_INTE_SC1 (1 << 9)
#define SAA7134_IRQ2_INTE_SC0 (1 << 8)
...
...
@@ -113,7 +121,12 @@
#define SAA7134_IRQ2_INTE_DEC0 (1 << 2)
#define SAA7134_IRQ2_INTE_PE (1 << 1)
#define SAA7134_IRQ2_INTE_AR (1 << 0)
#define SAA7134_IRQ_REPORT (0x2cc >> 2)
#define SAA7134_IRQ_REPORT_GPIO23 (1 << 17)
#define SAA7134_IRQ_REPORT_GPIO22 (1 << 16)
#define SAA7134_IRQ_REPORT_GPIO18 (1 << 15)
#define SAA7134_IRQ_REPORT_GPIO16 (1 << 14)
/* not certain */
#define SAA7134_IRQ_REPORT_LOAD_ERR (1 << 13)
#define SAA7134_IRQ_REPORT_CONF_ERR (1 << 12)
#define SAA7134_IRQ_REPORT_TRIG_ERR (1 << 11)
...
...
drivers/media/video/saa7134/saa7134-ts.c
View file @
9d8a5eb8
...
...
@@ -24,10 +24,13 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/saa6752hs.h>
/* ------------------------------------------------------------------ */
static
unsigned
int
ts_debug
=
0
;
...
...
@@ -109,7 +112,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
buf
->
vb
.
size
=
size
;
buf
->
pt
=
&
dev
->
ts
.
pt_ts
;
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
,
NULL
);
if
(
err
)
goto
oops
;
err
=
saa7134_pgtable_build
(
dev
->
pci
,
buf
->
pt
,
...
...
@@ -162,6 +165,26 @@ static struct videobuf_queue_ops ts_qops = {
.
buf_release
=
buffer_release
,
};
/* ------------------------------------------------------------------ */
static
void
ts_reset_encoder
(
struct
saa7134_dev
*
dev
)
{
saa_writeb
(
SAA7134_SPECIAL_MODE
,
0x00
);
mdelay
(
10
);
saa_writeb
(
SAA7134_SPECIAL_MODE
,
0x01
);
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
HZ
/
10
);
}
static
int
ts_init_encoder
(
struct
saa7134_dev
*
dev
,
void
*
arg
)
{
ts_reset_encoder
(
dev
);
saa7134_i2c_call_clients
(
dev
,
MPEG_SETPARAMS
,
arg
);
return
0
;
}
/* ------------------------------------------------------------------ */
static
int
ts_open
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
@@ -173,7 +196,7 @@ static int ts_open(struct inode *inode, struct file *file)
list_for_each
(
list
,
&
saa7134_devlist
)
{
h
=
list_entry
(
list
,
struct
saa7134_dev
,
devlist
);
if
(
h
->
ts_dev
.
minor
==
minor
)
if
(
h
->
ts_dev
->
minor
==
minor
)
dev
=
h
;
}
if
(
NULL
==
dev
)
...
...
@@ -185,9 +208,11 @@ static int ts_open(struct inode *inode, struct file *file)
if
(
dev
->
ts
.
users
)
goto
done
;
dev
->
ts
.
started
=
0
;
dev
->
ts
.
users
++
;
file
->
private_data
=
dev
;
err
=
0
;
done:
up
(
&
dev
->
ts
.
ts
.
lock
);
return
err
;
...
...
@@ -203,6 +228,11 @@ static int ts_release(struct inode *inode, struct file *file)
if
(
dev
->
ts
.
ts
.
reading
)
videobuf_read_stop
(
file
,
&
dev
->
ts
.
ts
);
dev
->
ts
.
users
--
;
/* stop the encoder */
if
(
dev
->
ts
.
started
)
ts_reset_encoder
(
dev
);
up
(
&
dev
->
ts
.
ts
.
lock
);
return
0
;
}
...
...
@@ -212,6 +242,11 @@ ts_read(struct file *file, char *data, size_t count, loff_t *ppos)
{
struct
saa7134_dev
*
dev
=
file
->
private_data
;
if
(
!
dev
->
ts
.
started
)
{
ts_init_encoder
(
dev
,
NULL
);
dev
->
ts
.
started
=
1
;
}
return
videobuf_read_stream
(
file
,
&
dev
->
ts
.
ts
,
data
,
count
,
ppos
,
0
);
}
...
...
@@ -345,6 +380,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
f
->
fmt
.
pix
.
height
=
576
;
f
->
fmt
.
pix
.
pixelformat
=
V4L2_PIX_FMT_MPEG
;
f
->
fmt
.
pix
.
sizeimage
=
TS_PACKET_SIZE
*
TS_NR_PACKETS
;
return
0
;
}
case
VIDIOC_REQBUFS
:
...
...
@@ -365,6 +401,14 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
case
VIDIOC_STREAMOFF
:
return
videobuf_streamoff
(
file
,
&
dev
->
ts
.
ts
);
case
VIDIOC_QUERYCTRL
:
case
VIDIOC_G_CTRL
:
case
VIDIOC_S_CTRL
:
return
saa7134_common_ioctl
(
dev
,
cmd
,
arg
);
case
MPEG_SETPARAMS
:
return
ts_init_encoder
(
dev
,
arg
);
default:
return
-
ENOIOCTLCMD
;
}
...
...
@@ -404,7 +448,7 @@ struct video_device saa7134_ts_template =
.
minor
=
-
1
,
};
int
saa7134_ts_init
(
struct
saa7134_dev
*
dev
)
int
saa7134_ts_init
1
(
struct
saa7134_dev
*
dev
)
{
/* sanitycheck insmod options */
if
(
tsbufs
<
2
)
...
...
drivers/media/video/saa7134/saa7134-tvaudio.c
View file @
9d8a5eb8
...
...
@@ -2,7 +2,7 @@
* device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...)
*
* (c) 2001
,02
Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
* (c) 2001
-03
Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
* 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
...
...
@@ -172,7 +172,7 @@ static void mute_input_7134(struct saa7134_dev *dev)
{
unsigned
int
mute
;
struct
saa7134_input
*
in
;
int
reg
=
0
;
int
ausel
=
0
,
ics
=
0
,
ocs
=
0
;
int
mask
;
/* look what is to do ... */
...
...
@@ -200,11 +200,13 @@ static void mute_input_7134(struct saa7134_dev *dev)
/* switch internal audio mux */
switch
(
in
->
amux
)
{
case
TV
:
reg
=
0x02
;
break
;
case
LINE1
:
reg
=
0x00
;
break
;
case
LINE2
:
reg
=
0x01
;
break
;
case
TV
:
ausel
=
0xc0
;
ics
=
0x00
;
ocs
=
0x02
;
break
;
case
LINE1
:
ausel
=
0x80
;
ics
=
0x00
;
ocs
=
0x00
;
break
;
case
LINE2
:
ausel
=
0x80
;
ics
=
0x08
;
ocs
=
0x01
;
break
;
}
saa_andorb
(
SAA7134_ANALOG_IO_SELECT
,
0x07
,
reg
);
saa_andorb
(
SAA7134_AUDIO_FORMAT_CTRL
,
0xc0
,
ausel
);
saa_andorb
(
SAA7134_ANALOG_IO_SELECT
,
0x08
,
ics
);
saa_andorb
(
SAA7134_ANALOG_IO_SELECT
,
0x07
,
ocs
);
/* switch gpio-connected external audio mux */
if
(
0
==
card
(
dev
).
gpiomask
)
...
...
@@ -547,11 +549,19 @@ static int tvaudio_thread(void *data)
tvaudio_setstereo
(
dev
,
&
tvaudio
[
audio
],
V4L2_TUNER_MODE_MONO
);
dev
->
tvaudio
=
&
tvaudio
[
audio
];
if
(
tvaudio_sleep
(
dev
,
3
*
HZ
))
goto
restart
;
rx
=
tvaudio_getstereo
(
dev
,
&
tvaudio
[
i
]);
mode
=
saa7134_tvaudio_rx2mode
(
rx
);
tvaudio_setstereo
(
dev
,
&
tvaudio
[
audio
],
mode
);
for
(;;)
{
if
(
tvaudio_sleep
(
dev
,
3
*
HZ
))
goto
restart
;
if
(
dev
->
thread
.
exit
||
signal_pending
(
current
))
break
;
if
(
UNSET
==
dev
->
thread
.
mode
)
{
rx
=
tvaudio_getstereo
(
dev
,
&
tvaudio
[
i
]);
mode
=
saa7134_tvaudio_rx2mode
(
rx
);
}
else
{
mode
=
dev
->
thread
.
mode
;
}
tvaudio_setstereo
(
dev
,
&
tvaudio
[
audio
],
mode
);
}
}
done:
...
...
@@ -592,8 +602,8 @@ static char *stdres[0x20] = {
[
0x1f
]
=
"??? [in progress]"
,
};
#define DSP_RETRY
16
#define DSP_DELAY 1
6
#define DSP_RETRY
30
#define DSP_DELAY 1
0
static
inline
int
saa_dsp_wait_bit
(
struct
saa7134_dev
*
dev
,
int
bit
)
{
...
...
@@ -838,10 +848,11 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev)
return
retval
;
}
int
saa7134_tvaudio_init
(
struct
saa7134_dev
*
dev
)
int
saa7134_tvaudio_init
2
(
struct
saa7134_dev
*
dev
)
{
DECLARE_MUTEX_LOCKED
(
sem
);
int
(
*
my_thread
)(
void
*
data
)
=
NULL
;
int
rc
;
/* enable I2S audio output */
if
(
saa7134_boards
[
dev
->
board
].
i2s_rate
)
{
...
...
@@ -872,8 +883,12 @@ int saa7134_tvaudio_init(struct saa7134_dev *dev)
/* start tvaudio thread */
init_waitqueue_head
(
&
dev
->
thread
.
wq
);
dev
->
thread
.
notify
=
&
sem
;
kernel_thread
(
my_thread
,
dev
,
0
);
down
(
&
sem
);
rc
=
kernel_thread
(
my_thread
,
dev
,
0
);
if
(
rc
<
0
)
printk
(
KERN_WARNING
"%s: kernel_thread() failed
\n
"
,
dev
->
name
);
else
down
(
&
sem
);
dev
->
thread
.
notify
=
NULL
;
wake_up_interruptible
(
&
dev
->
thread
.
wq
);
}
...
...
@@ -900,6 +915,7 @@ int saa7134_tvaudio_fini(struct saa7134_dev *dev)
int
saa7134_tvaudio_do_scan
(
struct
saa7134_dev
*
dev
)
{
if
(
dev
->
thread
.
task
)
{
dev
->
thread
.
mode
=
UNSET
;
dev
->
thread
.
scan2
++
;
wake_up_interruptible
(
&
dev
->
thread
.
wq
);
}
else
{
...
...
drivers/media/video/saa7134/saa7134-vbi.c
View file @
9d8a5eb8
...
...
@@ -146,7 +146,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
buf
->
vb
.
size
=
size
;
buf
->
pt
=
&
fh
->
pt_vbi
;
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
,
NULL
);
if
(
err
)
goto
oops
;
err
=
saa7134_pgtable_build
(
dev
->
pci
,
buf
->
pt
,
...
...
@@ -215,7 +215,7 @@ struct videobuf_queue_ops saa7134_vbi_qops = {
/* ------------------------------------------------------------------ */
int
saa7134_vbi_init
(
struct
saa7134_dev
*
dev
)
int
saa7134_vbi_init
1
(
struct
saa7134_dev
*
dev
)
{
INIT_LIST_HEAD
(
&
dev
->
vbi_q
.
queue
);
init_timer
(
&
dev
->
vbi_q
.
timeout
);
...
...
drivers/media/video/saa7134/saa7134-video.c
View file @
9d8a5eb8
...
...
@@ -578,21 +578,12 @@ static void set_size(struct saa7134_dev *dev, int task,
saa_writeb
(
SAA7134_VIDEO_LINES2
(
task
),
height
/
div
>>
8
);
/* deinterlace y offsets */
if
(
interlace
)
{
y_odd
=
dev
->
ctl_y_odd
;
y_even
=
dev
->
ctl_y_even
;
saa_writeb
(
SAA7134_V_PHASE_OFFSET0
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET1
(
task
),
y_even
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET2
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET3
(
task
),
y_even
);
}
else
{
y_odd
=
dev
->
ctl_y_odd
;
y_even
=
dev
->
ctl_y_even
;
saa_writeb
(
SAA7134_V_PHASE_OFFSET0
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET1
(
task
),
y_even
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET2
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET3
(
task
),
y_even
);
}
y_odd
=
dev
->
ctl_y_odd
;
y_even
=
dev
->
ctl_y_even
;
saa_writeb
(
SAA7134_V_PHASE_OFFSET0
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET1
(
task
),
y_even
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET2
(
task
),
y_odd
);
saa_writeb
(
SAA7134_V_PHASE_OFFSET3
(
task
),
y_even
);
}
/* ------------------------------------------------------------------ */
...
...
@@ -912,7 +903,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
buf
->
fmt
=
fh
->
fmt
;
buf
->
pt
=
&
fh
->
pt_cap
;
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
);
err
=
videobuf_iolock
(
dev
->
pci
,
&
buf
->
vb
,
&
dev
->
ovbuf
);
if
(
err
)
goto
oops
;
err
=
saa7134_pgtable_build
(
dev
->
pci
,
buf
->
pt
,
...
...
@@ -1084,7 +1075,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh,
default:
return
-
EINVAL
;
}
if
(
restart_overlay
&&
res_check
(
fh
,
RESOURCE_OVERLAY
))
{
if
(
restart_overlay
&&
fh
&&
res_check
(
fh
,
RESOURCE_OVERLAY
))
{
spin_lock_irqsave
(
&
dev
->
slock
,
flags
);
stop_preview
(
dev
,
fh
);
start_preview
(
dev
,
fh
);
...
...
@@ -1140,13 +1131,13 @@ static int video_open(struct inode *inode, struct file *file)
list_for_each
(
list
,
&
saa7134_devlist
)
{
h
=
list_entry
(
list
,
struct
saa7134_dev
,
devlist
);
if
(
h
->
video_dev
.
minor
==
minor
)
if
(
h
->
video_dev
&&
(
h
->
video_dev
->
minor
==
minor
)
)
dev
=
h
;
if
(
h
->
radio_dev
.
minor
==
minor
)
{
if
(
h
->
radio_dev
&&
(
h
->
radio_dev
->
minor
==
minor
)
)
{
radio
=
1
;
dev
=
h
;
}
if
(
h
->
vbi_dev
.
minor
==
minor
)
{
if
(
h
->
vbi_dev
&&
(
h
->
vbi_dev
->
minor
==
minor
)
)
{
type
=
V4L2_BUF_TYPE_VBI_CAPTURE
;
dev
=
h
;
}
...
...
@@ -1188,13 +1179,10 @@ static int video_open(struct inode *inode, struct file *file)
if
(
fh
->
radio
)
{
/* switch to radio mode */
u32
v
=
400
*
16
;
saa7134_tvaudio_setinput
(
dev
,
&
card
(
dev
).
radio
);
saa7134_i2c_call_clients
(
dev
,
VIDIOCSFREQ
,
&
v
);
saa7134_i2c_call_clients
(
dev
,
AUDC_SET_RADIO
,
NULL
);
}
else
{
/* switch to video/vbi mode */
set_tvnorm
(
dev
,
dev
->
tvnorm
);
video_mux
(
dev
,
dev
->
ctl_input
);
}
return
0
;
...
...
@@ -1327,7 +1315,7 @@ void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
f
->
fmt
.
vbi
.
count
[
0
]
=
norm
->
vbi_v_stop
-
norm
->
vbi_v_start
+
1
;
f
->
fmt
.
vbi
.
start
[
1
]
=
norm
->
video_v_stop
+
norm
->
vbi_v_start
+
1
;
f
->
fmt
.
vbi
.
count
[
1
]
=
f
->
fmt
.
vbi
.
count
[
0
];
f
->
fmt
.
vbi
.
flags
=
0
;
/* VBI_UNSYNC VBI_INTERLACED */
;
f
->
fmt
.
vbi
.
flags
=
0
;
/* VBI_UNSYNC VBI_INTERLACED */
#if 0
if (V4L2_STD_PAL == norm->id) {
...
...
@@ -1479,6 +1467,92 @@ int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
}
}
int
saa7134_common_ioctl
(
struct
saa7134_dev
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
{
int
err
;
switch
(
cmd
)
{
case
VIDIOC_QUERYCTRL
:
{
const
struct
v4l2_queryctrl
*
ctrl
;
struct
v4l2_queryctrl
*
c
=
arg
;
if
((
c
->
id
<
V4L2_CID_BASE
||
c
->
id
>=
V4L2_CID_LASTP1
)
&&
(
c
->
id
<
V4L2_CID_PRIVATE_BASE
||
c
->
id
>=
V4L2_CID_PRIVATE_LASTP1
))
return
-
EINVAL
;
ctrl
=
ctrl_by_id
(
c
->
id
);
*
c
=
(
NULL
!=
ctrl
)
?
*
ctrl
:
no_ctrl
;
return
0
;
}
case
VIDIOC_G_CTRL
:
return
get_control
(
dev
,
arg
);
case
VIDIOC_S_CTRL
:
{
down
(
&
dev
->
lock
);
err
=
set_control
(
dev
,
NULL
,
arg
);
up
(
&
dev
->
lock
);
return
err
;
}
/* --- input switching --------------------------------------- */
case
VIDIOC_ENUMINPUT
:
{
struct
v4l2_input
*
i
=
arg
;
unsigned
int
n
;
n
=
i
->
index
;
if
(
n
>=
SAA7134_INPUT_MAX
)
return
-
EINVAL
;
if
(
NULL
==
card_in
(
dev
,
i
->
index
).
name
)
return
-
EINVAL
;
memset
(
i
,
0
,
sizeof
(
*
i
));
i
->
index
=
n
;
i
->
type
=
V4L2_INPUT_TYPE_CAMERA
;
strcpy
(
i
->
name
,
card_in
(
dev
,
n
).
name
);
if
(
card_in
(
dev
,
n
).
tv
)
i
->
type
=
V4L2_INPUT_TYPE_TUNER
;
i
->
audioset
=
1
;
if
(
n
==
dev
->
ctl_input
)
{
int
v1
=
saa_readb
(
SAA7134_STATUS_VIDEO1
);
int
v2
=
saa_readb
(
SAA7134_STATUS_VIDEO2
);
if
(
0
!=
(
v1
&
0x40
))
i
->
status
|=
V4L2_IN_ST_NO_H_LOCK
;
if
(
0
!=
(
v2
&
0x40
))
i
->
status
|=
V4L2_IN_ST_NO_SYNC
;
if
(
0
!=
(
v2
&
0x0e
))
i
->
status
|=
V4L2_IN_ST_MACROVISION
;
}
for
(
n
=
0
;
n
<
TVNORMS
;
n
++
)
i
->
std
|=
tvnorms
[
n
].
id
;
return
0
;
}
case
VIDIOC_G_INPUT
:
{
int
*
i
=
arg
;
*
i
=
dev
->
ctl_input
;
return
0
;
}
case
VIDIOC_S_INPUT
:
{
int
*
i
=
arg
;
if
(
*
i
<
0
||
*
i
>=
SAA7134_INPUT_MAX
)
return
-
EINVAL
;
if
(
NULL
==
card_in
(
dev
,
*
i
).
name
)
return
-
EINVAL
;
down
(
&
dev
->
lock
);
video_mux
(
dev
,
*
i
);
up
(
&
dev
->
lock
);
return
0
;
}
}
return
0
;
}
/*
* This function is _not_ called directly, but from
* video_generic_ioctl (and maybe others). userspace
...
...
@@ -1562,59 +1636,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
return
0
;
}
/* --- input switching --------------------------------------- */
case
VIDIOC_ENUMINPUT
:
{
struct
v4l2_input
*
i
=
arg
;
unsigned
int
n
;
n
=
i
->
index
;
if
(
n
>=
SAA7134_INPUT_MAX
)
return
-
EINVAL
;
if
(
NULL
==
card_in
(
dev
,
i
->
index
).
name
)
return
-
EINVAL
;
memset
(
i
,
0
,
sizeof
(
*
i
));
i
->
index
=
n
;
i
->
type
=
V4L2_INPUT_TYPE_CAMERA
;
strcpy
(
i
->
name
,
card_in
(
dev
,
n
).
name
);
if
(
card_in
(
dev
,
n
).
tv
)
i
->
type
=
V4L2_INPUT_TYPE_TUNER
;
i
->
audioset
=
1
;
if
(
n
==
dev
->
ctl_input
)
{
int
v1
=
saa_readb
(
SAA7134_STATUS_VIDEO1
);
int
v2
=
saa_readb
(
SAA7134_STATUS_VIDEO2
);
if
(
0
!=
(
v1
&
0x40
))
i
->
status
|=
V4L2_IN_ST_NO_H_LOCK
;
if
(
0
!=
(
v2
&
0x40
))
i
->
status
|=
V4L2_IN_ST_NO_SYNC
;
if
(
0
!=
(
v2
&
0x0e
))
i
->
status
|=
V4L2_IN_ST_MACROVISION
;
}
for
(
n
=
0
;
n
<
TVNORMS
;
n
++
)
i
->
std
|=
tvnorms
[
n
].
id
;
return
0
;
}
case
VIDIOC_G_INPUT
:
{
int
*
i
=
arg
;
*
i
=
dev
->
ctl_input
;
return
0
;
}
case
VIDIOC_S_INPUT
:
{
int
*
i
=
arg
;
if
(
*
i
<
0
||
*
i
>=
SAA7134_INPUT_MAX
)
return
-
EINVAL
;
if
(
NULL
==
card_in
(
dev
,
*
i
).
name
)
return
-
EINVAL
;
down
(
&
dev
->
lock
);
video_mux
(
dev
,
*
i
);
up
(
&
dev
->
lock
);
return
0
;
}
/* --- tuner ioctls ------------------------------------------ */
case
VIDIOC_G_TUNER
:
{
...
...
@@ -1643,9 +1664,17 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
}
case
VIDIOC_S_TUNER
:
{
#if 0
struct
v4l2_tuner
*
t
=
arg
;
#endif
int
rx
,
mode
;
mode
=
dev
->
thread
.
mode
;
if
(
UNSET
==
mode
)
{
rx
=
saa7134_tvaudio_getstereo
(
dev
);
mode
=
saa7134_tvaudio_rx2mode
(
t
->
rxsubchans
);
}
if
(
mode
!=
t
->
audmode
)
{
dev
->
thread
.
mode
=
t
->
audmode
;
}
return
0
;
}
case
VIDIOC_G_FREQUENCY
:
...
...
@@ -1673,29 +1702,14 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
}
/* --- control ioctls ---------------------------------------- */
case
VIDIOC_ENUMINPUT
:
case
VIDIOC_G_INPUT
:
case
VIDIOC_S_INPUT
:
case
VIDIOC_QUERYCTRL
:
{
const
struct
v4l2_queryctrl
*
ctrl
;
struct
v4l2_queryctrl
*
c
=
arg
;
if
((
c
->
id
<
V4L2_CID_BASE
||
c
->
id
>=
V4L2_CID_LASTP1
)
&&
(
c
->
id
<
V4L2_CID_PRIVATE_BASE
||
c
->
id
>=
V4L2_CID_PRIVATE_LASTP1
))
return
-
EINVAL
;
ctrl
=
ctrl_by_id
(
c
->
id
);
*
c
=
(
NULL
!=
ctrl
)
?
*
ctrl
:
no_ctrl
;
return
0
;
}
case
VIDIOC_G_CTRL
:
return
get_control
(
dev
,
arg
);
case
VIDIOC_S_CTRL
:
{
down
(
&
dev
->
lock
);
err
=
set_control
(
dev
,
fh
,
arg
);
up
(
&
dev
->
lock
);
return
err
;
}
return
saa7134_common_ioctl
(
dev
,
cmd
,
arg
);
case
VIDIOC_G_AUDIO
:
{
struct
v4l2_audio
*
a
=
arg
;
...
...
@@ -1828,8 +1842,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
q
=
saa7134_queue
(
fh
);
memset
(
&
req
,
0
,
sizeof
(
req
));
req
.
type
=
q
->
type
;
req
.
count
=
gbuffers
;
req
.
type
=
q
->
type
;
req
.
count
=
gbuffers
;
req
.
memory
=
V4L2_MEMORY_MMAP
;
err
=
videobuf_reqbufs
(
file
,
q
,
&
req
);
if
(
err
<
0
)
return
err
;
...
...
@@ -1913,6 +1928,9 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
struct
v4l2_tuner
*
t
=
arg
;
struct
video_tuner
vt
;
if
(
0
!=
t
->
index
)
return
-
EINVAL
;
memset
(
t
,
0
,
sizeof
(
*
t
));
strcpy
(
t
->
name
,
"Radio"
);
t
->
rangelow
=
(
int
)(
65
*
16
);
...
...
@@ -2046,7 +2064,7 @@ struct video_device saa7134_radio_template =
.
minor
=
-
1
,
};
int
saa7134_video_init
(
struct
saa7134_dev
*
dev
)
int
saa7134_video_init
1
(
struct
saa7134_dev
*
dev
)
{
/* sanitycheck insmod options */
if
(
gbuffers
<
2
||
gbuffers
>
VIDEO_MAX_FRAME
)
...
...
@@ -2072,12 +2090,6 @@ int saa7134_video_init(struct saa7134_dev *dev)
dev
->
video_q
.
timeout
.
data
=
(
unsigned
long
)(
&
dev
->
video_q
);
dev
->
video_q
.
dev
=
dev
;
/* init video hw */
set_tvnorm
(
dev
,
&
tvnorms
[
0
]);
video_mux
(
dev
,
0
);
saa7134_tvaudio_setmute
(
dev
);
saa7134_tvaudio_setvolume
(
dev
,
dev
->
ctl_volume
);
if
(
saa7134_boards
[
dev
->
board
].
video_out
)
{
/* enable video output */
int
vo
=
saa7134_boards
[
dev
->
board
].
video_out
;
...
...
@@ -2095,6 +2107,16 @@ int saa7134_video_init(struct saa7134_dev *dev)
return
0
;
}
int
saa7134_video_init2
(
struct
saa7134_dev
*
dev
)
{
/* init video hw */
set_tvnorm
(
dev
,
&
tvnorms
[
0
]);
video_mux
(
dev
,
0
);
saa7134_tvaudio_setmute
(
dev
);
saa7134_tvaudio_setvolume
(
dev
,
dev
->
ctl_volume
);
return
0
;
}
int
saa7134_video_fini
(
struct
saa7134_dev
*
dev
)
{
/* nothing */
...
...
drivers/media/video/saa7134/saa7134.h
View file @
9d8a5eb8
...
...
@@ -19,20 +19,25 @@
*/
#include <linux/version.h>
#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,9)
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/videodev.h>
#include <linux/kdev_t.h>
#include <linux/input.h>
#include <asm/io.h>
#ifdef CONFIG_VIDEO_IR
#include "ir-common.h"
#endif
#include <media/video-buf.h>
#include <media/tuner.h>
#include <media/audiochip.h>
#include <media/id.h>
#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,8)
#ifndef TRUE
# define TRUE (1==1)
#endif
...
...
@@ -133,6 +138,11 @@ struct saa7134_format {
#define SAA7134_BOARD_TYPHOON_90031 13
#define SAA7134_BOARD_ELSA 14
#define SAA7134_BOARD_ELSA_500TV 15
#define SAA7134_BOARD_ASUSTeK_TVFM7134 16
#define SAA7134_BOARD_VA1000POWER 17
#define SAA7134_BOARD_BMK_MPEX_NOTUNER 18
#define SAA7134_BOARD_VIDEOMATE_TV 19
#define SAA7134_BOARD_CRONOS_PLUS 20
#define SAA7134_INPUT_MAX 8
...
...
@@ -200,6 +210,7 @@ struct saa7134_thread {
unsigned
int
exit
;
unsigned
int
scan1
;
unsigned
int
scan2
;
unsigned
int
mode
;
};
/* buffer for one video/vbi/ts frame */
...
...
@@ -255,6 +266,7 @@ struct saa7134_ts {
/* TS capture */
struct
videobuf_queue
ts
;
struct
saa7134_pgtable
pt_ts
;
int
started
;
};
/* oss dsp status */
...
...
@@ -286,6 +298,18 @@ struct saa7134_oss {
unsigned
int
read_count
;
};
#ifdef CONFIG_VIDEO_IR
/* IR input */
struct
saa7134_ir
{
struct
input_dev
dev
;
struct
ir_input_state
ir
;
char
name
[
32
];
char
phys
[
32
];
u32
mask_keycode
;
u32
mask_keydown
;
};
#endif
/* global device status */
struct
saa7134_dev
{
struct
list_head
devlist
;
...
...
@@ -294,13 +318,19 @@ struct saa7134_dev {
/* various device info */
unsigned
int
resources
;
struct
video_device
video_dev
;
struct
video_device
ts_dev
;
struct
video_device
radio_dev
;
struct
video_device
vbi_dev
;
struct
video_device
*
video_dev
;
struct
video_device
*
ts_dev
;
struct
video_device
*
radio_dev
;
struct
video_device
*
vbi_dev
;
struct
saa7134_oss
oss
;
struct
saa7134_ts
ts
;
/* infrared remote */
int
has_remote
;
#ifdef CONFIG_VIDEO_IR
struct
saa7134_ir
*
remote
;
#endif
/* pci i/o */
char
name
[
32
];
struct
pci_dev
*
pci
;
...
...
@@ -311,6 +341,7 @@ struct saa7134_dev {
/* config info */
unsigned
int
board
;
unsigned
int
tuner_type
;
unsigned
int
gpio_value
;
/* i2c i/o */
struct
i2c_adapter
i2c_adap
;
...
...
@@ -372,7 +403,9 @@ struct saa7134_dev {
#define saa_setb(reg,bit) saa_andorb((reg),(bit),(bit))
#define saa_clearb(reg,bit) saa_andorb((reg),(bit),0)
#define saa_wait(d) { if (need_resched()) schedule(); else udelay(d);}
//#define saa_wait(d) { if (need_resched()) schedule(); else udelay(d);}
#define saa_wait(d) { udelay(d); }
//#define saa_wait(d) { schedule_timeout(HZ*d/1000 ?:1); }
/* ----------------------------------------------------------- */
/* saa7134-core.c */
...
...
@@ -433,7 +466,8 @@ extern struct video_device saa7134_radio_template;
int
saa7134_common_ioctl
(
struct
saa7134_dev
*
dev
,
unsigned
int
cmd
,
void
*
arg
);
int
saa7134_video_init
(
struct
saa7134_dev
*
dev
);
int
saa7134_video_init1
(
struct
saa7134_dev
*
dev
);
int
saa7134_video_init2
(
struct
saa7134_dev
*
dev
);
int
saa7134_video_fini
(
struct
saa7134_dev
*
dev
);
void
saa7134_irq_video_intl
(
struct
saa7134_dev
*
dev
);
void
saa7134_irq_video_done
(
struct
saa7134_dev
*
dev
,
unsigned
long
status
);
...
...
@@ -443,7 +477,7 @@ void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);
/* saa7134-ts.c */
extern
struct
video_device
saa7134_ts_template
;
int
saa7134_ts_init
(
struct
saa7134_dev
*
dev
);
int
saa7134_ts_init
1
(
struct
saa7134_dev
*
dev
);
int
saa7134_ts_fini
(
struct
saa7134_dev
*
dev
);
void
saa7134_irq_ts_done
(
struct
saa7134_dev
*
dev
,
unsigned
long
status
);
...
...
@@ -454,7 +488,7 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status);
extern
struct
videobuf_queue_ops
saa7134_vbi_qops
;
extern
struct
video_device
saa7134_vbi_template
;
int
saa7134_vbi_init
(
struct
saa7134_dev
*
dev
);
int
saa7134_vbi_init
1
(
struct
saa7134_dev
*
dev
);
int
saa7134_vbi_fini
(
struct
saa7134_dev
*
dev
);
void
saa7134_irq_vbi_done
(
struct
saa7134_dev
*
dev
,
unsigned
long
status
);
...
...
@@ -470,7 +504,7 @@ void saa7134_tvaudio_setinput(struct saa7134_dev *dev,
void
saa7134_tvaudio_setvolume
(
struct
saa7134_dev
*
dev
,
int
level
);
int
saa7134_tvaudio_getstereo
(
struct
saa7134_dev
*
dev
);
int
saa7134_tvaudio_init
(
struct
saa7134_dev
*
dev
);
int
saa7134_tvaudio_init
2
(
struct
saa7134_dev
*
dev
);
int
saa7134_tvaudio_fini
(
struct
saa7134_dev
*
dev
);
int
saa7134_tvaudio_do_scan
(
struct
saa7134_dev
*
dev
);
...
...
@@ -482,10 +516,16 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value);
extern
struct
file_operations
saa7134_dsp_fops
;
extern
struct
file_operations
saa7134_mixer_fops
;
int
saa7134_oss_init
(
struct
saa7134_dev
*
dev
);
int
saa7134_oss_init
1
(
struct
saa7134_dev
*
dev
);
int
saa7134_oss_fini
(
struct
saa7134_dev
*
dev
);
void
saa7134_irq_oss_done
(
struct
saa7134_dev
*
dev
,
unsigned
long
status
);
/* ----------------------------------------------------------- */
/* saa7134-input.c */
int
saa7134_input_init1
(
struct
saa7134_dev
*
dev
);
void
saa7134_input_fini
(
struct
saa7134_dev
*
dev
);
void
saa7134_input_irq
(
struct
saa7134_dev
*
dev
);
/*
* Local variables:
...
...
drivers/media/video/video-buf.c
View file @
9d8a5eb8
...
...
@@ -197,6 +197,20 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
return
0
;
}
int
videobuf_dma_init_overlay
(
struct
videobuf_dmabuf
*
dma
,
int
direction
,
dma_addr_t
addr
,
int
nr_pages
)
{
dprintk
(
1
,
"init overlay [%d pages @ bus 0x%lx]
\n
"
,
nr_pages
,(
unsigned
long
)
addr
);
dma
->
direction
=
direction
;
if
(
0
==
addr
)
return
-
EINVAL
;
dma
->
bus_addr
=
addr
;
dma
->
nr_pages
=
nr_pages
;
return
0
;
}
int
videobuf_dma_pci_map
(
struct
pci_dev
*
dev
,
struct
videobuf_dmabuf
*
dma
)
{
int
err
;
...
...
@@ -218,12 +232,23 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma)
dma
->
sglist
=
videobuf_vmalloc_to_sg
(
dma
->
vmalloc
,
dma
->
nr_pages
);
}
if
(
dma
->
bus_addr
)
{
dma
->
sglist
=
kmalloc
(
sizeof
(
struct
scatterlist
),
GFP_KERNEL
);
if
(
NULL
!=
dma
->
sglist
)
{
dma
->
sglen
=
1
;
sg_dma_address
(
&
dma
->
sglist
[
0
])
=
dma
->
bus_addr
&
~
PAGE_MASK
;
dma
->
sglist
[
0
].
offset
=
dma
->
bus_addr
&
PAGE_MASK
;
sg_dma_len
(
&
dma
->
sglist
[
0
])
=
dma
->
nr_pages
*
PAGE_SIZE
;
}
}
if
(
NULL
==
dma
->
sglist
)
{
dprintk
(
1
,
"scatterlist is NULL
\n
"
);
return
-
ENOMEM
;
}
dma
->
sglen
=
pci_map_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
if
(
!
dma
->
bus_addr
)
dma
->
sglen
=
pci_map_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
return
0
;
}
...
...
@@ -232,7 +257,8 @@ int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma)
if
(
!
dma
->
sglen
)
BUG
();
pci_dma_sync_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
if
(
!
dma
->
bus_addr
)
pci_dma_sync_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
return
0
;
}
...
...
@@ -241,7 +267,8 @@ int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma)
if
(
!
dma
->
sglen
)
return
0
;
pci_unmap_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
if
(
!
dma
->
bus_addr
)
pci_unmap_sg
(
dev
,
dma
->
sglist
,
dma
->
nr_pages
,
dma
->
direction
);
kfree
(
dma
->
sglist
);
dma
->
sglist
=
NULL
;
dma
->
sglen
=
0
;
...
...
@@ -266,6 +293,9 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
vfree
(
dma
->
vmalloc
);
dma
->
vmalloc
=
NULL
;
}
if
(
dma
->
bus_addr
)
{
dma
->
bus_addr
=
0
;
}
dma
->
direction
=
PCI_DMA_NONE
;
return
0
;
}
...
...
@@ -309,27 +339,48 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr)
}
int
videobuf_iolock
(
struct
pci_dev
*
pci
,
struct
videobuf_buffer
*
vb
)
videobuf_iolock
(
struct
pci_dev
*
pci
,
struct
videobuf_buffer
*
vb
,
struct
v4l2_framebuffer
*
fbuf
)
{
int
err
,
pages
;
if
(
0
==
vb
->
baddr
)
{
/* no userspace addr -- kernel bounce buffer */
dma_addr_t
bus
;
switch
(
vb
->
memory
)
{
case
V4L2_MEMORY_MMAP
:
case
V4L2_MEMORY_USERPTR
:
if
(
0
==
vb
->
baddr
)
{
/* no userspace addr -- kernel bounce buffer */
pages
=
PAGE_ALIGN
(
vb
->
size
)
>>
PAGE_SHIFT
;
err
=
videobuf_dma_init_kernel
(
&
vb
->
dma
,
PCI_DMA_FROMDEVICE
,
pages
);
if
(
0
!=
err
)
return
err
;
}
else
{
/* dma directly to userspace */
err
=
videobuf_dma_init_user
(
&
vb
->
dma
,
PCI_DMA_FROMDEVICE
,
vb
->
baddr
,
vb
->
bsize
);
if
(
0
!=
err
)
return
err
;
}
break
;
case
V4L2_MEMORY_OVERLAY
:
if
(
NULL
==
fbuf
)
return
-
EINVAL
;
/* FIXME: need sanity checks for vb->boff */
bus
=
(
dma_addr_t
)
fbuf
->
base
+
vb
->
boff
;
pages
=
PAGE_ALIGN
(
vb
->
size
)
>>
PAGE_SHIFT
;
err
=
videobuf_dma_init_kernel
(
&
vb
->
dma
,
PCI_DMA_FROMDEVICE
,
pages
);
if
(
0
!=
err
)
return
err
;
}
else
{
/* dma directly to userspace */
err
=
videobuf_dma_init_user
(
&
vb
->
dma
,
PCI_DMA_FROMDEVICE
,
vb
->
baddr
,
vb
->
bsize
);
err
=
videobuf_dma_init_overlay
(
&
vb
->
dma
,
PCI_DMA_FROMDEVICE
,
bus
,
pages
);
if
(
0
!=
err
)
return
err
;
break
;
default:
BUG
();
}
err
=
videobuf_dma_pci_map
(
pci
,
&
vb
->
dma
);
if
(
0
!=
err
)
return
err
;
return
0
;
}
...
...
@@ -447,11 +498,26 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
{
b
->
index
=
vb
->
i
;
b
->
type
=
type
;
b
->
m
.
offset
=
vb
->
boff
;
b
->
length
=
vb
->
bsize
;
b
->
memory
=
vb
->
memory
;
switch
(
b
->
memory
)
{
case
V4L2_MEMORY_MMAP
:
b
->
m
.
offset
=
vb
->
boff
;
b
->
length
=
vb
->
bsize
;
break
;
case
V4L2_MEMORY_USERPTR
:
b
->
m
.
userptr
=
vb
->
baddr
;
b
->
length
=
vb
->
bsize
;
break
;
case
V4L2_MEMORY_OVERLAY
:
b
->
m
.
offset
=
vb
->
boff
;
break
;
}
b
->
flags
=
0
;
if
(
vb
->
map
)
b
->
flags
|=
V4L2_BUF_FLAG_MAPPED
;
switch
(
vb
->
state
)
{
case
STATE_PREPARED
:
case
STATE_QUEUED
:
...
...
@@ -467,6 +533,7 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
/* nothing */
break
;
}
b
->
field
=
vb
->
field
;
b
->
timestamp
=
vb
->
ts
;
b
->
bytesused
=
vb
->
size
;
...
...
@@ -484,6 +551,10 @@ videobuf_reqbufs(struct file *file, struct videobuf_queue *q,
return
-
EINVAL
;
if
(
req
->
count
<
1
)
return
-
EINVAL
;
if
(
req
->
memory
!=
V4L2_MEMORY_MMAP
&&
req
->
memory
!=
V4L2_MEMORY_USERPTR
&&
req
->
memory
!=
V4L2_MEMORY_OVERLAY
)
return
-
EINVAL
;
down
(
&
q
->
lock
);
count
=
req
->
count
;
...
...
@@ -495,10 +566,10 @@ videobuf_reqbufs(struct file *file, struct videobuf_queue *q,
dprintk
(
1
,
"reqbufs: bufs=%d, size=0x%x [%d pages total]
\n
"
,
count
,
size
,
(
count
*
size
)
>>
PAGE_SHIFT
);
retval
=
videobuf_mmap_setup
(
file
,
q
,
count
,
size
);
retval
=
videobuf_mmap_setup
(
file
,
q
,
count
,
size
,
req
->
memory
);
if
(
retval
<
0
)
goto
done
;
req
->
type
=
q
->
type
;
req
->
count
=
count
;
done:
...
...
@@ -540,12 +611,29 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q,
buf
=
q
->
bufs
[
b
->
index
];
if
(
NULL
==
buf
)
goto
done
;
if
(
0
==
buf
->
baddr
)
if
(
buf
->
memory
!=
b
->
memory
)
goto
done
;
if
(
buf
->
state
==
STATE_QUEUED
||
buf
->
state
==
STATE_ACTIVE
)
goto
done
;
switch
(
b
->
memory
)
{
case
V4L2_MEMORY_MMAP
:
if
(
0
==
buf
->
baddr
)
goto
done
;
break
;
case
V4L2_MEMORY_USERPTR
:
if
(
b
->
length
<
buf
->
bsize
)
goto
done
;
buf
->
baddr
=
b
->
m
.
userptr
;
break
;
case
V4L2_MEMORY_OVERLAY
:
buf
->
boff
=
b
->
m
.
offset
;
break
;
default:
goto
done
;
}
field
=
videobuf_next_field
(
q
);
retval
=
q
->
ops
->
buf_prepare
(
file
,
buf
,
field
);
if
(
0
!=
retval
)
...
...
@@ -663,8 +751,9 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q,
if
(
NULL
==
q
->
read_buf
)
goto
done
;
q
->
read_buf
->
baddr
=
(
unsigned
long
)
data
;
q
->
read_buf
->
bsize
=
count
;
q
->
read_buf
->
memory
=
V4L2_MEMORY_USERPTR
;
q
->
read_buf
->
baddr
=
(
unsigned
long
)
data
;
q
->
read_buf
->
bsize
=
count
;
field
=
videobuf_next_field
(
q
);
retval
=
q
->
ops
->
buf_prepare
(
file
,
q
->
read_buf
,
field
);
if
(
0
!=
retval
)
...
...
@@ -719,6 +808,7 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
q
->
read_buf
=
videobuf_alloc
(
q
->
msize
);
if
(
NULL
==
q
->
read_buf
)
goto
done
;
q
->
read_buf
->
memory
=
V4L2_MEMORY_USERPTR
;
field
=
videobuf_next_field
(
q
);
retval
=
q
->
ops
->
buf_prepare
(
file
,
q
->
read_buf
,
field
);
if
(
0
!=
retval
)
...
...
@@ -780,7 +870,7 @@ int videobuf_read_start(struct file *file, struct videobuf_queue *q)
count
=
VIDEO_MAX_FRAME
;
size
=
PAGE_ALIGN
(
size
);
err
=
videobuf_mmap_setup
(
file
,
q
,
count
,
size
);
err
=
videobuf_mmap_setup
(
file
,
q
,
count
,
size
,
V4L2_MEMORY_USERPTR
);
if
(
err
)
return
err
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -850,31 +940,36 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
break
;
}
if
(
vbihack
)
{
/* dirty, undocumented hack -- pass the frame counter
* within the last four bytes of each vbi data block.
* We need that one to maintain backward compatibility
* to all vbi decoding software out there ... */
fc
=
(
unsigned
int
*
)
q
->
read_buf
->
dma
.
vmalloc
;
fc
+=
(
q
->
read_buf
->
size
>>
2
)
-
1
;
*
fc
=
q
->
read_buf
->
field_count
>>
1
;
dprintk
(
1
,
"vbihack: %d
\n
"
,
*
fc
);
}
/* copy stuff */
bytes
=
count
;
if
(
bytes
>
q
->
read_buf
->
size
-
q
->
read_off
)
bytes
=
q
->
read_buf
->
size
-
q
->
read_off
;
if
(
copy_to_user
(
data
+
retval
,
q
->
read_buf
->
dma
.
vmalloc
+
q
->
read_off
,
bytes
))
{
if
(
0
==
retval
)
retval
=
-
EFAULT
;
break
;
if
(
q
->
read_buf
->
state
==
STATE_DONE
)
{
if
(
vbihack
)
{
/* dirty, undocumented hack -- pass the frame counter
* within the last four bytes of each vbi data block.
* We need that one to maintain backward compatibility
* to all vbi decoding software out there ... */
fc
=
(
unsigned
int
*
)
q
->
read_buf
->
dma
.
vmalloc
;
fc
+=
(
q
->
read_buf
->
size
>>
2
)
-
1
;
*
fc
=
q
->
read_buf
->
field_count
>>
1
;
dprintk
(
1
,
"vbihack: %d
\n
"
,
*
fc
);
}
/* copy stuff */
bytes
=
count
;
if
(
bytes
>
q
->
read_buf
->
size
-
q
->
read_off
)
bytes
=
q
->
read_buf
->
size
-
q
->
read_off
;
if
(
copy_to_user
(
data
+
retval
,
q
->
read_buf
->
dma
.
vmalloc
+
q
->
read_off
,
bytes
))
{
if
(
0
==
retval
)
retval
=
-
EFAULT
;
break
;
}
count
-=
bytes
;
retval
+=
bytes
;
q
->
read_off
+=
bytes
;
}
else
{
/* some error -- skip buffer */
q
->
read_off
=
q
->
read_buf
->
size
;
}
count
-=
bytes
;
retval
+=
bytes
;
q
->
read_off
+=
bytes
;
/* requeue buffer when done with copying */
if
(
q
->
read_off
==
q
->
read_buf
->
size
)
{
...
...
@@ -1004,7 +1099,8 @@ static struct vm_operations_struct videobuf_vm_ops =
};
int
videobuf_mmap_setup
(
struct
file
*
file
,
struct
videobuf_queue
*
q
,
unsigned
int
bcount
,
unsigned
int
bsize
)
unsigned
int
bcount
,
unsigned
int
bsize
,
enum
v4l2_memory
memory
)
{
unsigned
int
i
;
int
err
;
...
...
@@ -1012,12 +1108,21 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
err
=
videobuf_mmap_free
(
file
,
q
);
if
(
0
!=
err
)
return
err
;
for
(
i
=
0
;
i
<
bcount
;
i
++
)
{
q
->
bufs
[
i
]
=
videobuf_alloc
(
q
->
msize
);
q
->
bufs
[
i
]
->
i
=
i
;
q
->
bufs
[
i
]
->
boff
=
bsize
*
i
;
q
->
bufs
[
i
]
->
bsize
=
bsize
;
q
->
bufs
[
i
]
->
i
=
i
;
q
->
bufs
[
i
]
->
memory
=
memory
;
q
->
bufs
[
i
]
->
bsize
=
bsize
;
switch
(
memory
)
{
case
V4L2_MEMORY_MMAP
:
q
->
bufs
[
i
]
->
boff
=
bsize
*
i
;
break
;
case
V4L2_MEMORY_USERPTR
:
case
V4L2_MEMORY_OVERLAY
:
/* nothing */
break
;
};
}
dprintk
(
1
,
"mmap setup: %d buffers, %d bytes each
\n
"
,
bcount
,
bsize
);
...
...
@@ -1063,6 +1168,8 @@ int videobuf_mmap_mapper(struct vm_area_struct *vma,
for
(
first
=
0
;
first
<
VIDEO_MAX_FRAME
;
first
++
)
{
if
(
NULL
==
q
->
bufs
[
first
])
continue
;
if
(
V4L2_MEMORY_MMAP
!=
q
->
bufs
[
first
]
->
memory
)
continue
;
if
(
q
->
bufs
[
first
]
->
boff
==
(
vma
->
vm_pgoff
<<
PAGE_SHIFT
))
break
;
}
...
...
@@ -1076,6 +1183,8 @@ int videobuf_mmap_mapper(struct vm_area_struct *vma,
for
(
size
=
0
,
last
=
first
;
last
<
VIDEO_MAX_FRAME
;
last
++
)
{
if
(
NULL
==
q
->
bufs
[
last
])
continue
;
if
(
V4L2_MEMORY_MMAP
!=
q
->
bufs
[
last
]
->
memory
)
continue
;
if
(
q
->
bufs
[
last
]
->
map
)
{
retval
=
-
EBUSY
;
goto
done
;
...
...
@@ -1124,6 +1233,7 @@ EXPORT_SYMBOL_GPL(videobuf_unlock);
EXPORT_SYMBOL_GPL
(
videobuf_dma_init_user
);
EXPORT_SYMBOL_GPL
(
videobuf_dma_init_kernel
);
EXPORT_SYMBOL_GPL
(
videobuf_dma_init_overlay
);
EXPORT_SYMBOL_GPL
(
videobuf_dma_pci_map
);
EXPORT_SYMBOL_GPL
(
videobuf_dma_pci_sync
);
EXPORT_SYMBOL_GPL
(
videobuf_dma_pci_unmap
);
...
...
fs/intermezzo/cache.c
View file @
9d8a5eb8
...
...
@@ -33,7 +33,6 @@
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
...
...
fs/intermezzo/dcache.c
View file @
9d8a5eb8
...
...
@@ -37,7 +37,6 @@
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
...
...
fs/intermezzo/dir.c
View file @
9d8a5eb8
...
...
@@ -23,10 +23,9 @@
*/
#include <asm/bitops.h>
#include <asm/
ioctl
s.h>
#include <asm/
termio
s.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/fs.h>
...
...
@@ -55,7 +54,7 @@ static inline void presto_relock_other(struct inode *dir)
{
/* vfs_mkdir locks */
// down(&dir->i_zombie);
lock_kernel
();
//
lock_kernel();
}
static
inline
void
presto_fulllock
(
struct
inode
*
dir
)
...
...
@@ -64,13 +63,13 @@ static inline void presto_fulllock(struct inode *dir)
down
(
&
dir
->
i_sem
);
/* vfs_mkdir locks */
// down(&dir->i_zombie);
lock_kernel
();
//
lock_kernel();
}
static
inline
void
presto_unlock
(
struct
inode
*
dir
)
{
/* vfs_mkdir locks */
unlock_kernel
();
//
unlock_kernel();
// up(&dir->i_zombie);
/* the lock from sys_mkdir / lookup_create */
up
(
&
dir
->
i_sem
);
...
...
fs/intermezzo/ext_attr.c
View file @
9d8a5eb8
...
...
@@ -28,14 +28,12 @@
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/unistd.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <asm/segment.h>
...
...
fs/intermezzo/file.c
View file @
9d8a5eb8
...
...
@@ -41,7 +41,6 @@
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/module.h>
...
...
fs/intermezzo/fileset.c
View file @
9d8a5eb8
...
...
@@ -35,7 +35,6 @@
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/module.h>
...
...
fs/intermezzo/inode.c
View file @
9d8a5eb8
...
...
@@ -30,7 +30,6 @@
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/unistd.h>
#include <asm/system.h>
...
...
fs/intermezzo/journal.c
View file @
9d8a5eb8
...
...
@@ -33,7 +33,6 @@
#include <linux/vmalloc.h>
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_ext2.c
View file @
9d8a5eb8
...
...
@@ -27,7 +27,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_ext3.c
View file @
9d8a5eb8
...
...
@@ -33,7 +33,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_obdfs.c
View file @
9d8a5eb8
...
...
@@ -32,7 +32,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_reiserfs.c
View file @
9d8a5eb8
...
...
@@ -31,7 +31,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_tmpfs.c
View file @
9d8a5eb8
...
...
@@ -33,7 +33,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/journal_xfs.c
View file @
9d8a5eb8
...
...
@@ -27,7 +27,6 @@
#include <linux/vmalloc.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/kml_utils.c
View file @
9d8a5eb8
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
...
...
fs/intermezzo/methods.c
View file @
9d8a5eb8
...
...
@@ -37,7 +37,6 @@
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/module.h>
...
...
fs/intermezzo/presto.c
View file @
9d8a5eb8
...
...
@@ -31,7 +31,6 @@
#include <linux/errno.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/string.h>
...
...
fs/intermezzo/psdev.c
View file @
9d8a5eb8
...
...
@@ -102,8 +102,7 @@ int izo_psdev_setpid(int minor)
struct
list_head
*
lh
;
struct
upc_req
*
req
;
CERROR
(
"WARNING: setpid & processing not empty!
\n
"
);
lh
=
&
channel
->
uc_processing
;
while
(
(
lh
=
lh
->
next
)
!=
&
channel
->
uc_processing
)
{
list_for_each
(
lh
,
&
channel
->
uc_processing
)
{
req
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
/* freeing of req and data is done by the sleeper */
wake_up
(
&
req
->
rq_sleep
);
...
...
@@ -208,8 +207,7 @@ static ssize_t presto_psdev_write(struct file *file, const char *buf,
spin_lock
(
&
channel
->
uc_lock
);
/* Look for the message on the processing queue. */
lh
=
&
channel
->
uc_processing
;
while
(
(
lh
=
lh
->
next
)
!=
&
channel
->
uc_processing
)
{
list_for_each
(
lh
,
&
channel
->
uc_processing
)
{
tmp
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
if
(
tmp
->
rq_unique
==
hdr
.
unique
)
{
req
=
tmp
;
...
...
@@ -337,8 +335,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
/* Wake up clients so they can return. */
CDEBUG
(
D_PSDEV
,
"Wake up clients sleeping for pending.
\n
"
);
spin_lock
(
&
channel
->
uc_lock
);
lh
=
&
channel
->
uc_pending
;
while
(
(
lh
=
lh
->
next
)
!=
&
channel
->
uc_pending
)
{
list_for_each
(
lh
,
&
channel
->
uc_pending
)
{
req
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
/* Async requests stay around for a new lento */
...
...
@@ -351,8 +348,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
}
CDEBUG
(
D_PSDEV
,
"Wake up clients sleeping for processing
\n
"
);
lh
=
&
channel
->
uc_processing
;
while
(
(
lh
=
lh
->
next
)
!=
&
channel
->
uc_processing
)
{
list_for_each
(
lh
,
&
channel
->
uc_processing
)
{
req
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
/* freeing of req and data is done by the sleeper */
req
->
rq_flags
|=
REQ_DEAD
;
...
...
@@ -419,7 +415,7 @@ void presto_psdev_cleanup(void)
for
(
i
=
0
;
i
<
MAX_CHANNEL
;
i
++
)
{
struct
upc_channel
*
channel
=
&
(
izo_channels
[
i
]);
struct
list_head
*
lh
;
struct
list_head
*
lh
,
*
next
;
spin_lock
(
&
channel
->
uc_lock
);
if
(
!
list_empty
(
&
channel
->
uc_pending
))
{
...
...
@@ -431,12 +427,10 @@ void presto_psdev_cleanup(void)
if
(
!
list_empty
(
&
channel
->
uc_cache_list
))
{
CERROR
(
"Weird, tell Peter: module cleanup and cache listnot empty dev %d
\n
"
,
i
);
}
lh
=
channel
->
uc_pending
.
next
;
while
(
lh
!=
&
channel
->
uc_pending
)
{
list_for_each_safe
(
lh
,
next
,
&
channel
->
uc_pending
)
{
struct
upc_req
*
req
;
req
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
lh
=
lh
->
next
;
if
(
req
->
rq_flags
&
REQ_ASYNC
)
{
list_del
(
&
(
req
->
rq_chain
));
CDEBUG
(
D_UPCALL
,
"free pending upcall type %d
\n
"
,
...
...
@@ -448,8 +442,7 @@ void presto_psdev_cleanup(void)
wake_up
(
&
req
->
rq_sleep
);
}
}
lh
=
&
channel
->
uc_processing
;
while
(
(
lh
=
lh
->
next
)
!=
&
channel
->
uc_processing
)
{
list_for_each
(
lh
,
&
channel
->
uc_processing
)
{
struct
upc_req
*
req
;
req
=
list_entry
(
lh
,
struct
upc_req
,
rq_chain
);
list_del
(
&
(
req
->
rq_chain
));
...
...
@@ -562,6 +555,10 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
buffer
->
u_uniq
=
req
->
rq_unique
;
buffer
->
u_async
=
async
;
/* Remove potential datarace possibility*/
if
(
async
)
req
->
rq_flags
=
REQ_ASYNC
;
spin_lock
(
&
channel
->
uc_lock
);
/* Append msg to pending queue and poke Lento. */
list_add
(
&
req
->
rq_chain
,
channel
->
uc_pending
.
prev
);
...
...
@@ -574,7 +571,7 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
if
(
async
)
{
/* req, rq_data are freed in presto_psdev_read for async */
req
->
rq_flags
=
REQ_ASYNC
;
/* req->rq_flags = REQ_ASYNC;*/
EXIT
;
return
0
;
}
...
...
@@ -645,5 +642,6 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
exit_req:
PRESTO_FREE
(
req
,
sizeof
(
struct
upc_req
));
exit_buf:
PRESTO_FREE
(
buffer
,
*
size
);
return
error
;
}
fs/intermezzo/replicator.c
View file @
9d8a5eb8
...
...
@@ -97,11 +97,10 @@ izo_rep_cache_clean(struct presto_file_set *fset)
struct
izo_offset_rec
*
izo_rep_cache_find
(
struct
presto_file_set
*
fset
,
char
*
uuid
)
{
struct
list_head
*
buck
=
izo_rep_hash
(
fset
->
fset_clients
,
uuid
);
struct
list_head
*
tmp
=
buck
;
struct
list_head
*
tmp
,
*
buck
=
izo_rep_hash
(
fset
->
fset_clients
,
uuid
);
struct
izo_offset_rec
*
rec
=
NULL
;
while
(
(
tmp
=
tmp
->
next
)
!=
buck
)
{
list_for_each
(
tmp
,
buck
)
{
rec
=
list_entry
(
tmp
,
struct
izo_offset_rec
,
or_list
);
if
(
memcmp
(
rec
->
or_uuid
,
uuid
,
sizeof
(
rec
->
or_uuid
))
==
0
)
return
rec
;
...
...
fs/intermezzo/super.c
View file @
9d8a5eb8
...
...
@@ -38,7 +38,6 @@ static char rcsid[] __attribute ((unused)) = "$Id: super.c,v 1.4 2002/10/12 02:1
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
...
...
fs/intermezzo/upcall.c
View file @
9d8a5eb8
...
...
@@ -39,7 +39,6 @@
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/string.h>
#include <asm/uaccess.h>
...
...
fs/intermezzo/vfs.c
View file @
9d8a5eb8
...
...
@@ -55,7 +55,6 @@
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/smp_lock.h>
#include <linux/quotaops.h>
#include <asm/uaccess.h>
...
...
fs/quota_v1.c
View file @
9d8a5eb8
...
...
@@ -21,7 +21,7 @@ static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d)
m
->
dqb_curinodes
=
d
->
dqb_curinodes
;
m
->
dqb_bhardlimit
=
d
->
dqb_bhardlimit
;
m
->
dqb_bsoftlimit
=
d
->
dqb_bsoftlimit
;
m
->
dqb_curspace
=
d
->
dqb_curblocks
<<
QUOTABLOCK_BITS
;
m
->
dqb_curspace
=
((
qsize_t
)
d
->
dqb_curblocks
)
<<
QUOTABLOCK_BITS
;
m
->
dqb_itime
=
d
->
dqb_itime
;
m
->
dqb_btime
=
d
->
dqb_btime
;
}
...
...
include/asm-ia64/elf.h
View file @
9d8a5eb8
...
...
@@ -218,19 +218,22 @@ do { \
#define ELF_CORE_EXTRA_PHDRS (GATE_EHDR->e_phnum)
#define ELF_CORE_WRITE_EXTRA_PHDRS \
do { \
const struct elf_phdr *const
vsyscall
_phdrs = \
const struct elf_phdr *const
gate
_phdrs = \
(const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \
int i; \
Elf
32
_Off ofs = 0; \
Elf
64
_Off ofs = 0; \
for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \
struct elf_phdr phdr =
vsyscall_phdrs[i];
\
struct elf_phdr phdr =
gate_phdrs[i];
\
if (phdr.p_type == PT_LOAD) { \
BUG_ON(ofs != 0); \
ofs = phdr.p_offset = offset; \
phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
phdr.p_filesz = phdr.p_memsz; \
if (ofs == 0) { \
ofs = phdr.p_offset = offset; \
offset += phdr.p_filesz; \
} \
else \
phdr.p_offset = ofs; \
} \
else \
phdr.p_offset += ofs; \
phdr.p_paddr = 0;
/* match other core phdrs */
\
...
...
@@ -239,13 +242,15 @@ do { \
} while (0)
#define ELF_CORE_WRITE_EXTRA_DATA \
do { \
const struct elf_phdr *const
vsyscall
_phdrs = \
const struct elf_phdr *const
gate
_phdrs = \
(const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \
int i; \
for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \
if (vsyscall_phdrs[i].p_type == PT_LOAD) \
DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
if (gate_phdrs[i].p_type == PT_LOAD) { \
DUMP_WRITE((void *) gate_phdrs[i].p_vaddr, \
PAGE_ALIGN(gate_phdrs[i].p_memsz)); \
break; \
} \
} \
} while (0)
...
...
include/linux/sched.h
View file @
9d8a5eb8
...
...
@@ -419,7 +419,6 @@ struct task_struct {
char
comm
[
16
];
/* file system info */
int
link_count
,
total_link_count
;
unsigned
int
locks
;
/* How many file locks are being held */
/* ipc stuff */
struct
sysv_sem
sysvsem
;
/* CPU-specific state of this task */
...
...
include/media/saa6752hs.h
0 → 100644
View file @
9d8a5eb8
/*
saa6752hs.h - definition for saa6752hs MPEG encoder
Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.net>
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _SAA6752HS_H
#define _SAA6752HS_H
enum
mpeg_bitrate_mode
{
MPEG_BITRATE_MODE_VBR
=
0
,
/* Variable bitrate */
MPEG_BITRATE_MODE_CBR
=
1
,
/* Constant bitrate */
MPEG_BITRATE_MODE_MAX
};
enum
mpeg_audio_bitrate
{
MPEG_AUDIO_BITRATE_256
=
0
,
/* 256 kBit/sec */
MPEG_AUDIO_BITRATE_384
=
1
,
/* 384 kBit/sec */
MPEG_AUDIO_BITRATE_MAX
};
#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
#define MPEG_TOTAL_BITRATE_MAX 27000
struct
mpeg_params
{
enum
mpeg_bitrate_mode
bitrate_mode
;
unsigned
int
video_target_bitrate
;
unsigned
int
video_max_bitrate
;
// only used for VBR
enum
mpeg_audio_bitrate
audio_bitrate
;
unsigned
int
total_bitrate
;
};
#define MPEG_SETPARAMS _IOW('6',100,struct mpeg_params)
#endif // _SAA6752HS_H
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
include/media/video-buf.h
View file @
9d8a5eb8
...
...
@@ -43,17 +43,17 @@ int videobuf_unlock(struct page **pages, int nr_pages);
* A small set of helper functions to manage buffers (both userland
* and kernel) for DMA.
*
* videobuf_
init_*_dmabuf
()
* videobuf_
dma_init_*
()
* creates a buffer. The userland version takes a userspace
* pointer + length. The kernel version just wants the size and
* does memory allocation too using vmalloc_32().
*
* videobuf_
pci_*_dmabuf
()
* videobuf_
dma_pci_*
()
* see Documentation/DMA-mapping.txt, these functions to
* basically the same. The map function does also build a
* scatterlist for the buffer (and unmap frees it ...)
*
* videobuf_
free_dmabuf
()
* videobuf_
dma_free
()
* no comment ...
*
*/
...
...
@@ -66,6 +66,9 @@ struct videobuf_dmabuf {
/* for kernel buffers */
void
*
vmalloc
;
/* for overlay buffers (pci-pci dma) */
dma_addr_t
bus_addr
;
/* common */
struct
scatterlist
*
sglist
;
int
sglen
;
...
...
@@ -77,6 +80,8 @@ int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
unsigned
long
data
,
unsigned
long
size
);
int
videobuf_dma_init_kernel
(
struct
videobuf_dmabuf
*
dma
,
int
direction
,
int
nr_pages
);
int
videobuf_dma_init_overlay
(
struct
videobuf_dmabuf
*
dma
,
int
direction
,
dma_addr_t
addr
,
int
nr_pages
);
int
videobuf_dma_pci_map
(
struct
pci_dev
*
dev
,
struct
videobuf_dmabuf
*
dma
);
int
videobuf_dma_pci_sync
(
struct
pci_dev
*
dev
,
struct
videobuf_dmabuf
*
dma
);
...
...
@@ -133,6 +138,7 @@ struct videobuf_buffer {
/* info about the buffer */
unsigned
int
width
;
unsigned
int
height
;
unsigned
int
bytesperline
;
/* use only if != 0 */
unsigned
long
size
;
enum
v4l2_field
field
;
enum
videobuf_state
state
;
...
...
@@ -140,7 +146,8 @@ struct videobuf_buffer {
struct
list_head
stream
;
/* QBUF/DQBUF list */
/* for mmap'ed buffers */
size_t
boff
;
/* buffer offset (mmap) */
enum
v4l2_memory
memory
;
size_t
boff
;
/* buffer offset (mmap + overlay) */
size_t
bsize
;
/* buffer size */
unsigned
long
baddr
;
/* buffer addr (userland ptr!) */
struct
videobuf_mapping
*
map
;
...
...
@@ -185,7 +192,8 @@ struct videobuf_queue {
void
*
videobuf_alloc
(
unsigned
int
size
);
int
videobuf_waiton
(
struct
videobuf_buffer
*
vb
,
int
non_blocking
,
int
intr
);
int
videobuf_iolock
(
struct
pci_dev
*
pci
,
struct
videobuf_buffer
*
vb
);
int
videobuf_iolock
(
struct
pci_dev
*
pci
,
struct
videobuf_buffer
*
vb
,
struct
v4l2_framebuffer
*
fbuf
);
void
videobuf_queue_init
(
struct
videobuf_queue
*
q
,
struct
videobuf_queue_ops
*
ops
,
...
...
@@ -221,7 +229,8 @@ unsigned int videobuf_poll_stream(struct file *file,
poll_table
*
wait
);
int
videobuf_mmap_setup
(
struct
file
*
file
,
struct
videobuf_queue
*
q
,
unsigned
int
bcount
,
unsigned
int
bsize
);
unsigned
int
bcount
,
unsigned
int
bsize
,
enum
v4l2_memory
memory
);
int
videobuf_mmap_free
(
struct
file
*
file
,
struct
videobuf_queue
*
q
);
int
videobuf_mmap_mapper
(
struct
vm_area_struct
*
vma
,
struct
videobuf_queue
*
q
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment