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
d23e4b81
Commit
d23e4b81
authored
Apr 09, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Automerge
parents
154a5d4c
de2b8a19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
72 deletions
+53
-72
drivers/media/radio/radio-zoltrix.c
drivers/media/radio/radio-zoltrix.c
+53
-72
No files found.
drivers/media/radio/radio-zoltrix.c
View file @
d23e4b81
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
static
int
io
=
CONFIG_RADIO_ZOLTRIX_PORT
;
static
int
io
=
CONFIG_RADIO_ZOLTRIX_PORT
;
static
int
radio_nr
=
-
1
;
static
int
radio_nr
=
-
1
;
static
int
users
=
0
;
struct
zol_device
{
struct
zol_device
{
int
port
;
int
port
;
...
@@ -216,106 +215,93 @@ int zol_is_stereo (struct zol_device *dev)
...
@@ -216,106 +215,93 @@ int zol_is_stereo (struct zol_device *dev)
return
0
;
return
0
;
}
}
static
int
zol_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
zol_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
zol_device
*
zol
=
dev
->
priv
;
struct
zol_device
*
zol
=
dev
->
priv
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
v
;
struct
video_capability
*
v
=
arg
;
v
.
type
=
VID_TYPE_TUNER
;
v
.
channels
=
1
+
zol
->
stereo
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
audios
=
1
;
v
->
type
=
VID_TYPE_TUNER
;
/* No we don't do pictures */
v
->
channels
=
1
+
zol
->
stereo
;
v
.
maxwidth
=
0
;
v
->
audios
=
1
;
v
.
maxheight
=
0
;
strcpy
(
v
->
name
,
"Zoltrix Radio"
);
v
.
minwidth
=
0
;
v
.
minheight
=
0
;
strcpy
(
v
.
name
,
"Zoltrix Radio"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCGTUNER
:
case
VIDIOCGTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
strcpy
(
v
.
name
,
"FM"
);
strcpy
(
v
->
name
,
"FM"
);
v
.
rangelow
=
(
int
)
(
88
.
0
*
16000
);
v
->
rangelow
=
(
int
)
(
88
.
0
*
16000
);
v
.
rangehigh
=
(
int
)
(
108
.
0
*
16000
);
v
->
rangehigh
=
(
int
)
(
108
.
0
*
16000
);
v
.
flags
=
zol_is_stereo
(
zol
)
v
->
flags
=
zol_is_stereo
(
zol
)
?
VIDEO_TUNER_STEREO_ON
:
0
;
?
VIDEO_TUNER_STEREO_ON
:
0
;
v
.
flags
|=
VIDEO_TUNER_LOW
;
v
->
flags
|=
VIDEO_TUNER_LOW
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
0xFFFF
*
zol_getsigstr
(
zol
);
v
->
signal
=
0xFFFF
*
zol_getsigstr
(
zol
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSTUNER
:
case
VIDIOCSTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
tuner
!=
0
)
return
-
EFAULT
;
if
(
v
.
tuner
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
/* Only 1 tuner so no setting needed ! */
/* Only 1 tuner so no setting needed ! */
return
0
;
return
0
;
}
}
case
VIDIOCGFREQ
:
case
VIDIOCGFREQ
:
if
(
copy_to_user
(
arg
,
&
zol
->
curfreq
,
sizeof
(
zol
->
curfreq
)))
{
return
-
EFAULT
;
unsigned
long
*
freq
=
arg
;
*
freq
=
zol
->
curfreq
;
return
0
;
return
0
;
}
case
VIDIOCSFREQ
:
case
VIDIOCSFREQ
:
if
(
copy_from_user
(
&
zol
->
curfreq
,
arg
,
sizeof
(
zol
->
curfreq
)))
{
return
-
EFAULT
;
unsigned
long
*
freq
=
arg
;
zol
->
curfreq
=
*
freq
;
zol_setfreq
(
zol
,
zol
->
curfreq
);
zol_setfreq
(
zol
,
zol
->
curfreq
);
return
0
;
return
0
;
}
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
{
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
&
v
,
0
,
sizeof
(
*
v
));
v
.
flags
|=
VIDEO_AUDIO_MUTABLE
|
VIDEO_AUDIO_VOLUME
;
v
->
flags
|=
VIDEO_AUDIO_MUTABLE
|
VIDEO_AUDIO_VOLUME
;
v
.
mode
!=
zol_is_stereo
(
zol
)
v
->
mode
!=
zol_is_stereo
(
zol
)
?
VIDEO_SOUND_STEREO
:
VIDEO_SOUND_MONO
;
?
VIDEO_SOUND_STEREO
:
VIDEO_SOUND_MONO
;
v
.
volume
=
zol
->
curvol
*
4096
;
v
->
volume
=
zol
->
curvol
*
4096
;
v
.
step
=
4096
;
v
->
step
=
4096
;
strcpy
(
v
.
name
,
"Zoltrix Radio"
);
strcpy
(
v
->
name
,
"Zoltrix Radio"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSAUDIO
:
case
VIDIOCSAUDIO
:
{
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
audio
)
return
-
EFAULT
;
if
(
v
.
audio
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
v
.
flags
&
VIDEO_AUDIO_MUTE
)
if
(
v
->
flags
&
VIDEO_AUDIO_MUTE
)
zol_mute
(
zol
);
zol_mute
(
zol
);
else
else
{
{
zol_unmute
(
zol
);
zol_unmute
(
zol
);
zol_setvol
(
zol
,
v
.
volume
/
4096
);
zol_setvol
(
zol
,
v
->
volume
/
4096
);
}
}
if
(
v
.
mode
&
VIDEO_SOUND_STEREO
)
if
(
v
->
mode
&
VIDEO_SOUND_STEREO
)
{
{
zol
->
stereo
=
1
;
zol
->
stereo
=
1
;
zol_setfreq
(
zol
,
zol
->
curfreq
);
zol_setfreq
(
zol
,
zol
->
curfreq
);
}
}
if
(
v
.
mode
&
VIDEO_SOUND_MONO
)
if
(
v
->
mode
&
VIDEO_SOUND_MONO
)
{
{
zol
->
stereo
=
0
;
zol
->
stereo
=
0
;
zol_setfreq
(
zol
,
zol
->
curfreq
);
zol_setfreq
(
zol
,
zol
->
curfreq
);
}
}
return
0
;
return
0
;
}
}
default:
default:
...
@@ -323,20 +309,16 @@ static int zol_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -323,20 +309,16 @@ static int zol_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
}
}
static
int
zol_open
(
struct
video_device
*
dev
,
int
flags
)
static
struct
zol_device
zoltrix_unit
;
{
if
(
users
)
return
-
EBUSY
;
users
++
;
return
0
;
}
static
void
zol_close
(
struct
video_device
*
dev
)
static
struct
file_operations
zoltrix_fops
=
{
{
users
--
;
owner:
THIS_MODULE
,
}
open:
video_exclusive_open
,
release:
video_exclusive_release
,
static
struct
zol_device
zoltrix_unit
;
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
zoltrix_radio
=
static
struct
video_device
zoltrix_radio
=
{
{
...
@@ -344,9 +326,8 @@ static struct video_device zoltrix_radio =
...
@@ -344,9 +326,8 @@ static struct video_device zoltrix_radio =
name:
"Zoltrix Radio Plus"
,
name:
"Zoltrix Radio Plus"
,
type:
VID_TYPE_TUNER
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_ZOLTRIX
,
hardware:
VID_HARDWARE_ZOLTRIX
,
open:
zol_open
,
fops:
&
zoltrix_fops
,
close:
zol_close
,
kernel_ioctl:
zol_ioctl
,
ioctl:
zol_ioctl
,
};
};
static
int
__init
zoltrix_init
(
void
)
static
int
__init
zoltrix_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