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
0f752d9d
Commit
0f752d9d
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: maestro radio update
This patch updates the maestro radio driver.
parent
785048ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
74 deletions
+48
-74
drivers/media/radio/radio-maestro.c
drivers/media/radio/radio-maestro.c
+48
-74
No files found.
drivers/media/radio/radio-maestro.c
View file @
0f752d9d
...
@@ -64,10 +64,16 @@
...
@@ -64,10 +64,16 @@
static
int
radio_nr
=
-
1
;
static
int
radio_nr
=
-
1
;
MODULE_PARM
(
radio_nr
,
"i"
);
MODULE_PARM
(
radio_nr
,
"i"
);
static
int
radio_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
);
static
int
radio_open
(
struct
video_device
*
,
int
);
static
struct
file_operations
maestro_fops
=
{
static
int
radio_ioctl
(
struct
video_device
*
,
unsigned
int
,
void
*
);
owner:
THIS_MODULE
,
static
void
radio_close
(
struct
video_device
*
);
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
maestro_radio
=
static
struct
video_device
maestro_radio
=
{
{
...
@@ -75,9 +81,8 @@ static struct video_device maestro_radio=
...
@@ -75,9 +81,8 @@ static struct video_device maestro_radio=
name:
"Maestro radio"
,
name:
"Maestro radio"
,
type:
VID_TYPE_TUNER
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_SF16MI
,
hardware:
VID_HARDWARE_SF16MI
,
open:
radio_open
,
fops:
&
maestro_fops
,
close:
radio_close
,
kernel_ioctl:
radio_ioctl
,
ioctl:
radio_ioctl
,
};
};
static
struct
radio_device
static
struct
radio_device
...
@@ -89,8 +94,6 @@ static struct radio_device
...
@@ -89,8 +94,6 @@ static struct radio_device
struct
semaphore
lock
;
struct
semaphore
lock
;
}
radio_unit
=
{
0
,
0
,
0
,
0
,
};
}
radio_unit
=
{
0
,
0
,
0
,
0
,
};
static
int
users
=
0
;
static
void
sleep_125ms
(
void
)
static
void
sleep_125ms
(
void
)
{
{
current
->
state
=
TASK_INTERRUPTIBLE
;
current
->
state
=
TASK_INTERRUPTIBLE
;
...
@@ -178,76 +181,61 @@ inline static int radio_function(struct video_device *dev,
...
@@ -178,76 +181,61 @@ inline static int radio_function(struct video_device *dev,
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
,
"Maestro radio"
);
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
type
=
VID_TYPE_TUNER
;
strcpy
(
v
->
name
,
"Maestro radio"
);
v
.
channels
=
v
.
audios
=
1
;
v
->
type
=
VID_TYPE_TUNER
;
v
.
maxwidth
=
v
.
maxheight
=
v
.
minwidth
=
v
.
minheight
=
0
;
v
->
channels
=
v
->
audios
=
1
;
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
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
(
void
)
radio_bits_get
(
card
);
(
void
)
radio_bits_get
(
card
);
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
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
tuner
!=
0
)
return
-
EFAULT
;
if
(
v
.
tuner
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGFREQ
:
{
case
VIDIOCGFREQ
:
{
unsigned
long
tmp
=
BITS2FREQ
(
radio_bits_get
(
card
));
unsigned
long
*
freq
=
arg
;
if
(
copy_to_user
(
arg
,
&
tmp
,
sizeof
(
tmp
)))
*
freq
=
BITS2FREQ
(
radio_bits_get
(
card
));
return
-
EFAULT
;
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
;
radio_bits_set
(
card
,
FREQ2BITS
(
tmp
));
radio_bits_set
(
card
,
FREQ2BITS
(
*
freq
));
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
;
{
{
register
__u16
io
=
card
->
io
;
register
__u16
io
=
card
->
io
;
register
__u16
omask
=
inw
(
io
+
IO_MASK
);
register
__u16
omask
=
inw
(
io
+
IO_MASK
);
outw
(
~
STR_WREN
,
io
+
IO_MASK
);
outw
(
~
STR_WREN
,
io
+
IO_MASK
);
outw
((
card
->
muted
=
v
.
flags
&
VIDEO_AUDIO_MUTE
)
outw
((
card
->
muted
=
v
->
flags
&
VIDEO_AUDIO_MUTE
)
?
STR_WREN
:
0
,
io
);
?
STR_WREN
:
0
,
io
);
udelay4
();
udelay4
();
outw
(
omask
,
io
+
IO_MASK
);
outw
(
omask
,
io
+
IO_MASK
);
...
@@ -256,22 +244,22 @@ inline static int radio_function(struct video_device *dev,
...
@@ -256,22 +244,22 @@ inline static int radio_function(struct video_device *dev,
}
}
}
}
case
VIDIOCGUNIT
:
{
case
VIDIOCGUNIT
:
{
struct
video_unit
v
;
struct
video_unit
*
v
=
arg
;
v
.
video
=
VIDEO_NO_UNIT
;
v
->
video
=
VIDEO_NO_UNIT
;
v
.
vbi
=
VIDEO_NO_UNIT
;
v
->
vbi
=
VIDEO_NO_UNIT
;
v
.
radio
=
dev
->
minor
;
v
->
radio
=
dev
->
minor
;
v
.
audio
=
0
;
v
->
audio
=
0
;
v
.
teletext
=
VIDEO_NO_UNIT
;
v
->
teletext
=
VIDEO_NO_UNIT
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
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
);
...
@@ -280,20 +268,6 @@ static int radio_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -280,20 +268,6 @@ static int radio_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
return
ret
;
return
ret
;
}
}
static
int
radio_open
(
struct
video_device
*
dev
,
int
flags
)
{
if
(
users
)
return
-
EBUSY
;
users
++
;
return
0
;
}
static
void
radio_close
(
struct
video_device
*
dev
)
{
users
--
;
}
inline
static
__u16
radio_install
(
struct
pci_dev
*
pcidev
);
inline
static
__u16
radio_install
(
struct
pci_dev
*
pcidev
);
MODULE_AUTHOR
(
"Adam Tlalka, atlka@pg.gda.pl"
);
MODULE_AUTHOR
(
"Adam Tlalka, atlka@pg.gda.pl"
);
...
...
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