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
0696dd1c
Commit
0696dd1c
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: radiotrack driver update
This patch updates the radiotrack driver.
parent
92999637
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
64 deletions
+47
-64
drivers/media/radio/radio-rtrack2.c
drivers/media/radio/radio-rtrack2.c
+47
-64
No files found.
drivers/media/radio/radio-rtrack2.c
View file @
0696dd1c
...
...
@@ -24,7 +24,6 @@
static
int
io
=
CONFIG_RADIO_RTRACK2_PORT
;
static
int
radio_nr
=
-
1
;
static
int
users
=
0
;
static
spinlock_t
lock
;
struct
rt_device
...
...
@@ -107,85 +106,75 @@ static int rt_getsigstr(struct rt_device *dev)
return
1
;
/* signal present */
}
static
int
rt_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
rt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
rt_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
,
"RadioTrack II"
);
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
,
"RadioTrack II"
);
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
=
88
*
16000
;
v
.
rangehigh
=
108
*
16000
;
v
.
flags
=
VIDEO_TUNER_LOW
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
0xFFFF
*
rt_getsigstr
(
rt
);
strcpy
(
v
.
name
,
"FM"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
v
->
rangelow
=
88
*
16000
;
v
->
rangehigh
=
108
*
16000
;
v
->
flags
=
VIDEO_TUNER_LOW
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
->
signal
=
0xFFFF
*
rt_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
;
rt_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
=
arg
;
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
)
rt_mute
(
rt
);
else
rt_unmute
(
rt
);
...
...
@@ -197,30 +186,24 @@ static int rt_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
static
int
rt_open
(
struct
video_device
*
dev
,
int
flags
)
{
if
(
users
)
return
-
EBUSY
;
users
++
;
return
0
;
}
static
void
rt_close
(
struct
video_device
*
dev
)
{
users
--
;
}
static
struct
rt_device
rtrack2_unit
;
static
struct
file_operations
rtrack2_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
rtrack2_radio
=
{
owner:
THIS_MODULE
,
name:
"RadioTrack II radio"
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_RTRACK2
,
open:
rt_open
,
close:
rt_close
,
ioctl:
rt_ioctl
,
fops:
&
rtrack2_fops
,
kernel_ioctl:
rt_ioctl
,
};
static
int
__init
rtrack2_init
(
void
)
...
...
@@ -275,6 +258,6 @@ module_exit(rtrack2_cleanup_module);
/*
Local variables:
compile-command: "
gcc -c -DMODVERSIONS -D__KERNEL__ -DMODULE -O6 -Wall -Wstrict-prototypes -I /home/blp/tmp/linux-2.1.111-rtrack/include radio-rtrack2.c
"
compile-command: "
mmake
"
End:
*/
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