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
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");
...
@@ -72,19 +72,24 @@ MODULE_PARM(radio_nr, "i");
#define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF)
#define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF)
static
int
radio_open
(
struct
video_device
*
,
int
);
static
int
radio_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
static
int
radio_ioctl
(
struct
video_device
*
,
unsigned
int
,
void
*
);
unsigned
int
cmd
,
void
*
arg
);
static
void
radio_close
(
struct
video_device
*
);
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
,
owner:
THIS_MODULE
,
name:
"Maxi Radio FM2000 radio"
,
name:
"Maxi Radio FM2000 radio"
,
type:
VID_TYPE_TUNER
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_SF16MI
,
hardware:
VID_HARDWARE_SF16MI
,
open:
radio_open
,
fops:
&
maxiradio_fops
,
close:
radio_close
,
kernel_ioctl:
radio_ioctl
,
ioctl:
radio_ioctl
,
};
};
static
struct
radio_device
static
struct
radio_device
...
@@ -173,147 +178,107 @@ inline static int radio_function(struct video_device *dev,
...
@@ -173,147 +178,107 @@ inline static int radio_function(struct video_device *dev,
unsigned
int
cmd
,
void
*
arg
)
unsigned
int
cmd
,
void
*
arg
)
{
{
struct
radio_device
*
card
=
dev
->
priv
;
struct
radio_device
*
card
=
dev
->
priv
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
VIDIOCGCAP
:
{
case
VIDIOCGCAP
:
{
struct
video_capability
v
;
struct
video_capability
*
v
=
arg
;
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
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strcpy
(
v
->
name
,
"Maxi Radio FM2000 radio"
);
v
->
type
=
VID_TYPE_TUNER
;
v
->
channels
=
v
->
audios
=
1
;
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
))
!=
0
)
return
-
EFAULT
;
if
(
v
.
tuner
)
if
(
v
->
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
card
->
stereo
=
0xffff
*
get_stereo
(
card
->
io
);
card
->
stereo
=
0xffff
*
get_stereo
(
card
->
io
);
card
->
tuned
=
0xffff
*
get_tune
(
card
->
io
);
card
->
tuned
=
0xffff
*
get_tune
(
card
->
io
);
v
.
flags
=
VIDEO_TUNER_LOW
|
card
->
stereo
;
v
->
flags
=
VIDEO_TUNER_LOW
|
card
->
stereo
;
v
.
signal
=
card
->
tuned
;
v
->
signal
=
card
->
tuned
;
strcpy
(
v
.
name
,
"FM"
);
strcpy
(
v
->
name
,
"FM"
);
v
.
rangelow
=
FREQ_LO
;
v
->
rangelow
=
FREQ_LO
;
v
.
rangehigh
=
FREQ_HI
;
v
->
rangehigh
=
FREQ_HI
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
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
(
v
->
tuner
!=
0
)
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
return
-
EFAULT
;
if
(
v
.
tuner
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGFREQ
:
{
case
VIDIOCGFREQ
:
{
unsigned
long
tmp
=
card
->
freq
;
unsigned
long
*
freq
=
arg
;
if
(
copy_to_user
(
arg
,
&
tmp
,
sizeof
(
tmp
)))
return
-
EFAULT
;
*
freq
=
card
->
freq
;
return
0
;
return
0
;
}
}
case
VIDIOCSFREQ
:
{
case
VIDIOCSFREQ
:
{
unsigned
long
tmp
;
unsigned
long
*
freq
=
arg
;
if
(
copy_from_user
(
&
tmp
,
arg
,
sizeof
(
tmp
)))
if
(
*
freq
<
FREQ_LO
||
*
freq
>
FREQ_HI
)
return
-
EFAULT
;
if
(
tmp
<
FREQ_LO
||
tmp
>
FREQ_HI
)
return
-
EINVAL
;
return
-
EINVAL
;
card
->
freq
=
*
freq
;
card
->
freq
=
tmp
;
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
sleep_125ms
();
sleep_125ms
();
return
0
;
return
0
;
}
}
case
VIDIOCGAUDIO
:
{
case
VIDIOCGAUDIO
:
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
strcpy
(
v
.
name
,
"Radio"
);
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
audio
=
v
.
volume
=
v
.
bass
=
v
.
treble
=
v
.
balance
=
v
.
step
=
0
;
strcpy
(
v
->
name
,
"Radio"
);
v
.
flags
=
VIDEO_AUDIO_MUTABLE
|
card
->
muted
;
v
->
flags
=
VIDEO_AUDIO_MUTABLE
|
card
->
muted
;
v
.
mode
=
VIDEO_SOUND_STEREO
;
v
->
mode
=
VIDEO_SOUND_STEREO
;
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
;
card
->
muted
=
v
->
flags
&
VIDEO_AUDIO_MUTE
;
card
->
muted
=
v
.
flags
&
VIDEO_AUDIO_MUTE
;
if
(
card
->
muted
)
if
(
card
->
muted
)
turn_power
(
card
->
io
,
0
);
turn_power
(
card
->
io
,
0
);
else
else
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
set_freq
(
card
->
io
,
FREQ2BITS
(
card
->
freq
));
return
0
;
return
0
;
}
}
case
VIDIOCGUNIT
:
{
case
VIDIOCGUNIT
:
{
struct
video_unit
v
;
struct
video_unit
*
v
=
arg
;
v
.
video
=
VIDEO_NO_UNIT
;
v
.
vbi
=
VIDEO_NO_UNIT
;
v
->
video
=
VIDEO_NO_UNIT
;
v
.
radio
=
dev
->
minor
;
v
->
vbi
=
VIDEO_NO_UNIT
;
v
.
audio
=
0
;
v
->
radio
=
dev
->
minor
;
v
.
teletext
=
VIDEO_NO_UNIT
;
v
->
audio
=
0
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
v
->
teletext
=
VIDEO_NO_UNIT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
default:
return
-
ENOIOCTLCMD
;
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
;
struct
radio_device
*
card
=
dev
->
priv
;
int
ret
;
int
ret
;
down
(
&
card
->
lock
);
down
(
&
card
->
lock
);
ret
=
radio_function
(
dev
,
cmd
,
arg
);
ret
=
radio_function
(
dev
,
cmd
,
arg
);
up
(
&
card
->
lock
);
up
(
&
card
->
lock
);
return
ret
;
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_AUTHOR
(
"Dimitromanolakis Apostolos, apdim@grecian.net"
);
MODULE_DESCRIPTION
(
"Radio driver for the Guillemot Maxi Radio FM2000 radio."
);
MODULE_DESCRIPTION
(
"Radio driver for the Guillemot Maxi Radio FM2000 radio."
);
MODULE_LICENSE
(
"GPL"
);
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