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
Kirill Smelkov
linux
Commits
7b6b283a
Commit
7b6b283a
authored
Mar 12, 2002
by
Gerd Knorr
Committed by
Linus Torvalds
Mar 12, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] v4l: gemtek radio update
This patch updates the gemtek and gemtek pci radio drivers.
parent
0f752d9d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
157 deletions
+101
-157
drivers/media/radio/radio-gemtek-pci.c
drivers/media/radio/radio-gemtek-pci.c
+54
-93
drivers/media/radio/radio-gemtek.c
drivers/media/radio/radio-gemtek.c
+47
-64
No files found.
drivers/media/radio/radio-gemtek-pci.c
View file @
7b6b283a
...
...
@@ -90,24 +90,6 @@ static const char rcsid[] = "$Id: radio-gemtek-pci.c,v 1.1 2001/07/23 08:08:16 t
static
int
nr_radio
=
-
1
;
static
int
gemtek_pci_open
(
struct
video_device
*
dev
,
int
flags
)
{
struct
gemtek_pci_card
*
card
=
dev
->
priv
;
/* Paranoid check */
if
(
!
card
)
return
-
ENODEV
;
return
0
;
}
static
void
gemtek_pci_close
(
struct
video_device
*
dev
)
{
/*
* The module usage is managed by 'videodev'
*/
}
static
inline
u8
gemtek_pci_out
(
u16
value
,
u32
port
)
{
outw
(
value
,
port
);
...
...
@@ -195,80 +177,65 @@ static inline unsigned int gemtek_pci_getsignal( struct gemtek_pci_card *card )
return
(
inb
(
card
->
iobase
)
&
0x08
)
?
0
:
1
;
}
static
int
gemtek_pci_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
gemtek_pci_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
gemtek_pci_card
*
card
=
dev
->
priv
;
switch
(
cmd
)
{
case
VIDIOCGCAP
:
{
struct
video_capability
c
;
c
.
type
=
VID_TYPE_TUNER
;
c
.
channels
=
1
;
c
.
audios
=
1
;
c
.
maxwidth
=
0
;
c
.
maxheight
=
0
;
c
.
minwidth
=
0
;
c
.
minheight
=
0
;
strcpy
(
c
.
name
,
"Gemtek PCI Radio"
);
if
(
copy_to_user
(
arg
,
&
c
,
sizeof
(
c
)
)
)
return
-
EFAULT
;
struct
video_capability
*
c
=
arg
;
memset
(
c
,
0
,
sizeof
(
*
c
));
c
->
type
=
VID_TYPE_TUNER
;
c
->
channels
=
1
;
c
->
audios
=
1
;
strcpy
(
c
->
name
,
"Gemtek PCI Radio"
);
return
0
;
}
case
VIDIOCGTUNER
:
{
struct
video_tuner
t
;
struct
video_tuner
*
t
=
arg
;
if
(
copy_from_user
(
&
t
,
arg
,
sizeof
(
struct
video_tuner
)
)
)
return
-
EFAULT
;
if
(
t
.
tuner
)
if
(
t
->
tuner
)
return
-
EINVAL
;
t
.
rangelow
=
GEMTEK_PCI_RANGE_LOW
;
t
.
rangehigh
=
GEMTEK_PCI_RANGE_HIGH
;
t
.
flags
=
VIDEO_TUNER_LOW
;
t
.
mode
=
VIDEO_MODE_AUTO
;
t
.
signal
=
0xFFFF
*
gemtek_pci_getsignal
(
card
);
strcpy
(
t
.
name
,
"FM"
);
if
(
copy_to_user
(
arg
,
&
t
,
sizeof
(
struct
video_tuner
)
)
)
return
-
EFAULT
;
t
->
rangelow
=
GEMTEK_PCI_RANGE_LOW
;
t
->
rangehigh
=
GEMTEK_PCI_RANGE_HIGH
;
t
->
flags
=
VIDEO_TUNER_LOW
;
t
->
mode
=
VIDEO_MODE_AUTO
;
t
->
signal
=
0xFFFF
*
gemtek_pci_getsignal
(
card
);
strcpy
(
t
->
name
,
"FM"
);
return
0
;
}
case
VIDIOCSTUNER
:
{
struct
video_tuner
t
;
if
(
copy_from_user
(
&
t
,
arg
,
sizeof
(
struct
video_tuner
)
)
)
return
-
EFAULT
;
if
(
t
.
tuner
)
struct
video_tuner
*
t
=
arg
;
if
(
t
->
tuner
)
return
-
EINVAL
;
return
0
;
}
case
VIDIOCGFREQ
:
return
put_user
(
card
->
current_frequency
,
(
u32
*
)
arg
);
{
unsigned
long
*
freq
=
arg
;
*
freq
=
card
->
current_frequency
;
return
0
;
}
case
VIDIOCSFREQ
:
{
u
32
frequency
;
u
nsigned
long
*
freq
=
arg
;
if
(
get_user
(
frequency
,
(
u32
*
)
arg
)
)
return
-
EFAULT
;
if
(
(
frequency
<
GEMTEK_PCI_RANGE_LOW
)
||
(
frequency
>
GEMTEK_PCI_RANGE_HIGH
)
)
if
(
(
*
freq
<
GEMTEK_PCI_RANGE_LOW
)
||
(
*
freq
>
GEMTEK_PCI_RANGE_HIGH
)
)
return
-
EINVAL
;
gemtek_pci_setfrequency
(
card
,
frequency
);
card
->
current_frequency
=
frequency
;
gemtek_pci_setfrequency
(
card
,
*
freq
);
card
->
current_frequency
=
*
freq
;
card
->
mute
=
FALSE
;
return
0
;
...
...
@@ -276,36 +243,27 @@ static int gemtek_pci_ioctl( struct video_device *dev, unsigned int cmd, void *a
case
VIDIOCGAUDIO
:
{
struct
video_audio
a
;
memset
(
&
a
,
0
,
sizeof
(
a
)
);
a
.
flags
|=
VIDEO_AUDIO_MUTABLE
;
a
.
volume
=
1
;
a
.
step
=
65535
;
strcpy
(
a
.
name
,
"Radio"
);
if
(
copy_to_user
(
arg
,
&
a
,
sizeof
(
struct
video_audio
)
)
)
return
-
EFAULT
;
struct
video_audio
*
a
=
arg
;
memset
(
a
,
0
,
sizeof
(
*
a
)
);
a
->
flags
|=
VIDEO_AUDIO_MUTABLE
;
a
->
volume
=
1
;
a
->
step
=
65535
;
strcpy
(
a
->
name
,
"Radio"
);
return
0
;
}
case
VIDIOCSAUDIO
:
{
struct
video_audio
a
;
if
(
copy_from_user
(
&
a
,
arg
,
sizeof
(
struct
video_audio
)
)
)
return
-
EFAULT
;
struct
video_audio
*
a
=
arg
;
if
(
a
.
audio
)
if
(
a
->
audio
)
return
-
EINVAL
;
if
(
a
.
flags
&
VIDEO_AUDIO_MUTE
)
if
(
a
->
flags
&
VIDEO_AUDIO_MUTE
)
gemtek_pci_mute
(
card
);
else
gemtek_pci_unmute
(
card
);
return
0
;
}
...
...
@@ -333,19 +291,22 @@ MODULE_DEVICE_TABLE( pci, gemtek_pci_id );
static
u8
mx
=
1
;
static
char
gemtek_pci_videodev_name
[]
=
"Gemtek PCI Radio"
;
static
struct
file_operations
gemtek_pci_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
inline
void
gemtek_pci_init_struct
(
struct
video_device
*
dev
)
{
memset
(
dev
,
0
,
sizeof
(
struct
video_device
)
);
dev
->
owner
=
THIS_MODULE
;
strcpy
(
dev
->
name
,
gemtek_pci_videodev_name
);
dev
->
type
=
VID_TYPE_TUNER
;
dev
->
hardware
=
VID_HARDWARE_GEMTEK
;
dev
->
open
=
gemtek_pci_open
;
dev
->
close
=
gemtek_pci_close
;
dev
->
ioctl
=
gemtek_pci_ioctl
;
}
static
struct
video_device
vdev_template
=
{
owner:
THIS_MODULE
,
name:
"Gemtek PCI Radio"
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_GEMTEK
,
fops:
&
gemtek_pci_fops
,
kernel_ioctl:
gemtek_pci_ioctl
,
};
static
int
__devinit
gemtek_pci_probe
(
struct
pci_dev
*
pci_dev
,
const
struct
pci_device_id
*
pci_id
)
{
...
...
@@ -378,7 +339,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
printk
(
KERN_ERR
"gemtek_pci: out of memory
\n
"
);
goto
err_video
;
}
gemtek_pci_init_struct
(
devradio
)
;
*
devradio
=
vdev_template
;
if
(
video_register_device
(
devradio
,
VFL_TYPE_RADIO
,
nr_radio
)
==
-
1
)
{
kfree
(
devradio
);
...
...
drivers/media/radio/radio-gemtek.c
View file @
7b6b283a
...
...
@@ -31,7 +31,6 @@
static
int
io
=
CONFIG_RADIO_GEMTEK_PORT
;
static
int
radio_nr
=
-
1
;
static
int
users
=
0
;
static
spinlock_t
lock
;
struct
gemtek_device
...
...
@@ -139,87 +138,77 @@ int gemtek_getsigstr(struct gemtek_device *dev)
return
1
;
/* signal present */
}
static
int
gemtek_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
gemtek_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
gemtek_device
*
rt
=
dev
->
priv
;
switch
(
cmd
)
{
case
VIDIOCGCAP
:
{
struct
video_capability
v
;
v
.
type
=
VID_TYPE_TUNER
;
v
.
channels
=
1
;
v
.
audios
=
1
;
/* No we don't do pictures */
v
.
maxwidth
=
0
;
v
.
maxheight
=
0
;
v
.
minwidth
=
0
;
v
.
minheight
=
0
;
strcpy
(
v
.
name
,
"GemTek"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_capability
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
->
type
=
VID_TYPE_TUNER
;
v
->
channels
=
1
;
v
->
audios
=
1
;
strcpy
(
v
->
name
,
"GemTek"
);
return
0
;
}
case
VIDIOCGTUNER
:
{
struct
video_tuner
v
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
return
-
EFAULT
;
if
(
v
.
tuner
)
/* Only 1 tuner */
struct
video_tuner
*
v
=
arg
;
if
(
v
->
tuner
)
/* Only 1 tuner */
return
-
EINVAL
;
v
.
rangelow
=
87
*
16000
;
v
.
rangehigh
=
108
*
16000
;
v
.
flags
=
VIDEO_TUNER_LOW
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
0xFFFF
*
gemtek_getsigstr
(
rt
);
strcpy
(
v
.
name
,
"FM"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
v
->
rangelow
=
87
*
16000
;
v
->
rangehigh
=
108
*
16000
;
v
->
flags
=
VIDEO_TUNER_LOW
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
->
signal
=
0xFFFF
*
gemtek_getsigstr
(
rt
);
strcpy
(
v
->
name
,
"FM"
);
return
0
;
}
case
VIDIOCSTUNER
:
{
struct
video_tuner
v
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
if
(
v
.
tuner
!=
0
)
struct
video_tuner
*
v
=
arg
;
if
(
v
->
tuner
!=
0
)
return
-
EINVAL
;
/* Only 1 tuner so no setting needed ! */
return
0
;
}
case
VIDIOCGFREQ
:
if
(
copy_to_user
(
arg
,
&
rt
->
curfreq
,
sizeof
(
rt
->
curfreq
)))
return
-
EFAULT
;
{
unsigned
long
*
freq
=
arg
;
*
freq
=
rt
->
curfreq
;
return
0
;
}
case
VIDIOCSFREQ
:
if
(
copy_from_user
(
&
rt
->
curfreq
,
arg
,
sizeof
(
rt
->
curfreq
)))
return
-
EFAULT
;
{
unsigned
long
*
freq
=
arg
;
rt
->
curfreq
=
*
freq
;
/* needs to be called twice in order for getsigstr to work */
gemtek_setfreq
(
rt
,
rt
->
curfreq
);
gemtek_setfreq
(
rt
,
rt
->
curfreq
);
return
0
;
}
case
VIDIOCGAUDIO
:
{
struct
video_audio
v
;
memset
(
&
v
,
0
,
sizeof
(
v
));
v
.
flags
|=
VIDEO_AUDIO_MUTABLE
;
v
.
volume
=
1
;
v
.
step
=
65535
;
strcpy
(
v
.
name
,
"Radio"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_audio
*
v
=
0
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
->
flags
|=
VIDEO_AUDIO_MUTABLE
;
v
->
volume
=
1
;
v
->
step
=
65535
;
strcpy
(
v
->
name
,
"Radio"
);
return
0
;
}
case
VIDIOCSAUDIO
:
{
struct
video_audio
v
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
if
(
v
.
audio
)
struct
video_audio
*
v
=
arg
;
if
(
v
->
audio
)
return
-
EINVAL
;
if
(
v
.
flags
&
VIDEO_AUDIO_MUTE
)
if
(
v
->
flags
&
VIDEO_AUDIO_MUTE
)
gemtek_mute
(
rt
);
else
gemtek_unmute
(
rt
);
...
...
@@ -231,30 +220,24 @@ static int gemtek_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
static
int
gemtek_open
(
struct
video_device
*
dev
,
int
flags
)
{
if
(
users
)
return
-
EBUSY
;
users
++
;
return
0
;
}
static
void
gemtek_close
(
struct
video_device
*
dev
)
{
users
--
;
}
static
struct
gemtek_device
gemtek_unit
;
static
struct
file_operations
gemtek_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
gemtek_radio
=
{
owner:
THIS_MODULE
,
name:
"GemTek radio"
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_GEMTEK
,
open:
gemtek_open
,
close:
gemtek_close
,
ioctl:
gemtek_ioctl
,
fops:
&
gemtek_fops
,
kernel_ioctl:
gemtek_ioctl
,
};
static
int
__init
gemtek_init
(
void
)
...
...
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