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
785048ce
Commit
785048ce
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: maxiradio update
This patch updates the Maxi FM2000 Radio driver.
parent
23862a35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
89 deletions
+54
-89
drivers/media/radio/radio-maxiradio.c
drivers/media/radio/radio-maxiradio.c
+54
-89
No files found.
drivers/media/radio/radio-maxiradio.c
View file @
785048ce
...
...
@@ -72,19 +72,24 @@ MODULE_PARM(radio_nr, "i");
#define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF)
static
int
radio_open
(
struct
video_device
*
,
int
);
static
int
radio_ioctl
(
struct
video_device
*
,
unsigned
int
,
void
*
);
static
void
radio_close
(
struct
video_device
*
);
static
int
radio_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
);
static
struct
video_device
maxiradio_radio
=
static
struct
file_operations
maxiradio_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
maxiradio_radio
=
{
owner:
THIS_MODULE
,
name:
"Maxi Radio FM2000 radio"
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_SF16MI
,
open:
radio_open
,
close:
radio_close
,
ioctl:
radio_ioctl
,
fops:
&
maxiradio_fops
,
kernel_ioctl:
radio_ioctl
,
};
static
struct
radio_device
...
...
@@ -173,147 +178,107 @@ inline static int radio_function(struct video_device *dev,
unsigned
int
cmd
,
void
*
arg
)
{
struct
radio_device
*
card
=
dev
->
priv
;
switch
(
cmd
)
{
case
VIDIOCGCAP
:
{
struct
video_capability
v
;
strcpy
(
v
.
name
,
"Maxi Radio FM2000 radio"
);
v
.
type
=
VID_TYPE_TUNER
;
v
.
channels
=
v
.
audios
=
1
;
v
.
maxwidth
=
v
.
maxheight
=
v
.
minwidth
=
v
.
minheight
=
0
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_capability
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strcpy
(
v
->
name
,
"Maxi Radio FM2000 radio"
);
v
->
type
=
VID_TYPE_TUNER
;
v
->
channels
=
v
->
audios
=
1
;
return
0
;
}
case
VIDIOCGTUNER
:
{
struct
video_tuner
v
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
return
-
EFAULT
;
struct
video_tuner
*
v
=
arg
;
if
(
v
.
tuner
)
if
(
v
->
tuner
)
return
-
EINVAL
;
card
->
stereo
=
0xffff
*
get_stereo
(
card
->
io
);
card
->
tuned
=
0xffff
*
get_tune
(
card
->
io
);
v
.
flags
=
VIDEO_TUNER_LOW
|
card
->
stereo
;
v
.
signal
=
card
->
tuned
;
v
->
flags
=
VIDEO_TUNER_LOW
|
card
->
stereo
;
v
->
signal
=
card
->
tuned
;
strcpy
(
v
.
name
,
"FM"
);
strcpy
(
v
->
name
,
"FM"
);
v
.
rangelow
=
FREQ_LO
;
v
.
rangehigh
=
FREQ_HI
;
v
.
mode
=
VIDEO_MODE_AUTO
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
v
->
rangelow
=
FREQ_LO
;
v
->
rangehigh
=
FREQ_HI
;
v
->
mode
=
VIDEO_MODE_AUTO
;
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
;
return
0
;
}
case
VIDIOCGFREQ
:
{
unsigned
long
tmp
=
card
->
freq
;
if
(
copy_to_user
(
arg
,
&
tmp
,
sizeof
(
tmp
)))
return
-
EFAULT
;
unsigned
long
*
freq
=
arg
;
*
freq
=
card
->
freq
;
return
0
;
}
case
VIDIOCSFREQ
:
{
unsigned
long
tmp
;
unsigned
long
*
freq
=
arg
;
if
(
copy_from_user
(
&
tmp
,
arg
,
sizeof
(
tmp
)))
return
-
EFAULT
;
if
(
tmp
<
FREQ_LO
||
tmp
>
FREQ_HI
)
if
(
*
freq
<
FREQ_LO
||
*
freq
>
FREQ_HI
)
return
-
EINVAL
;
card
->
freq
=
tmp
;
card
->
freq
=
*
freq
;
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
sleep_125ms
();
return
0
;
}
case
VIDIOCGAUDIO
:
{
struct
video_audio
v
;
strcpy
(
v
.
name
,
"Radio"
);
v
.
audio
=
v
.
volume
=
v
.
bass
=
v
.
treble
=
v
.
balance
=
v
.
step
=
0
;
v
.
flags
=
VIDEO_AUDIO_MUTABLE
|
card
->
muted
;
v
.
mode
=
VIDEO_SOUND_STEREO
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_audio
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strcpy
(
v
->
name
,
"Radio"
);
v
->
flags
=
VIDEO_AUDIO_MUTABLE
|
card
->
muted
;
v
->
mode
=
VIDEO_SOUND_STEREO
;
return
0
;
}
case
VIDIOCSAUDIO
:
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
if
(
v
.
audio
)
if
(
v
->
audio
)
return
-
EINVAL
;
card
->
muted
=
v
.
flags
&
VIDEO_AUDIO_MUTE
;
card
->
muted
=
v
->
flags
&
VIDEO_AUDIO_MUTE
;
if
(
card
->
muted
)
turn_power
(
card
->
io
,
0
);
else
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
return
0
;
}
case
VIDIOCGUNIT
:
{
struct
video_unit
v
;
v
.
video
=
VIDEO_NO_UNIT
;
v
.
vbi
=
VIDEO_NO_UNIT
;
v
.
radio
=
dev
->
minor
;
v
.
audio
=
0
;
v
.
teletext
=
VIDEO_NO_UNIT
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_unit
*
v
=
arg
;
v
->
video
=
VIDEO_NO_UNIT
;
v
->
vbi
=
VIDEO_NO_UNIT
;
v
->
radio
=
dev
->
minor
;
v
->
audio
=
0
;
v
->
teletext
=
VIDEO_NO_UNIT
;
return
0
;
}
default:
return
-
ENOIOCTLCMD
;
}
}
static
int
radio_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
radio_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
radio_device
*
card
=
dev
->
priv
;
int
ret
;
down
(
&
card
->
lock
);
ret
=
radio_function
(
dev
,
cmd
,
arg
);
up
(
&
card
->
lock
);
return
ret
;
}
static
int
radio_open
(
struct
video_device
*
dev
,
int
flags
)
{
return
0
;
}
static
void
radio_close
(
struct
video_device
*
dev
)
{
}
MODULE_AUTHOR
(
"Dimitromanolakis Apostolos, apdim@grecian.net"
);
MODULE_DESCRIPTION
(
"Radio driver for the Guillemot Maxi Radio FM2000 radio."
);
MODULE_LICENSE
(
"GPL"
);
...
...
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