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
75595af1
Commit
75595af1
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: sf16fm radio update
This patch updates the sf16fm radio driver.
parent
0696dd1c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
84 deletions
+53
-84
drivers/media/radio/radio-sf16fmi.c
drivers/media/radio/radio-sf16fmi.c
+53
-84
No files found.
drivers/media/radio/radio-sf16fmi.c
View file @
75595af1
...
...
@@ -36,7 +36,6 @@ struct fmi_device
static
int
io
=
-
1
;
static
int
radio_nr
=
-
1
;
static
int
users
=
0
;
static
struct
pci_dev
*
dev
=
NULL
;
static
struct
semaphore
lock
;
...
...
@@ -133,121 +132,97 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
return
(
res
&
2
)
?
0
:
0xFFFF
;
}
static
int
fmi_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
fmi_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
fmi_device
*
fmi
=
dev
->
priv
;
switch
(
cmd
)
{
case
VIDIOCGCAP
:
{
struct
video_capability
v
;
strcpy
(
v
.
name
,
"SF16-FMx radio"
);
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
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_capability
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strcpy
(
v
->
name
,
"SF16-FMx radio"
);
v
->
type
=
VID_TYPE_TUNER
;
v
->
channels
=
1
;
v
->
audios
=
1
;
return
0
;
}
case
VIDIOCGTUNER
:
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
int
mult
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
return
-
EFAULT
;
if
(
v
.
tuner
)
/* Only 1 tuner */
if
(
v
->
tuner
)
/* Only 1 tuner */
return
-
EINVAL
;
strcpy
(
v
.
name
,
"FM"
);
strcpy
(
v
->
name
,
"FM"
);
mult
=
(
fmi
->
flags
&
VIDEO_TUNER_LOW
)
?
1
:
1000
;
v
.
rangelow
=
RSF16_MINFREQ
/
mult
;
v
.
rangehigh
=
RSF16_MAXFREQ
/
mult
;
v
.
flags
=
fmi
->
flags
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
fmi_getsigstr
(
fmi
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
v
->
rangelow
=
RSF16_MINFREQ
/
mult
;
v
->
rangehigh
=
RSF16_MAXFREQ
/
mult
;
v
->
flags
=
fmi
->
flags
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
->
signal
=
fmi_getsigstr
(
fmi
);
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
;
fmi
->
flags
=
v
.
flags
&
VIDEO_TUNER_LOW
;
fmi
->
flags
=
v
->
flags
&
VIDEO_TUNER_LOW
;
/* Only 1 tuner so no setting needed ! */
return
0
;
}
case
VIDIOCGFREQ
:
{
unsigned
long
tmp
=
fmi
->
curfreq
;
unsigned
long
*
freq
=
arg
;
*
freq
=
fmi
->
curfreq
;
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
tmp
/=
1000
;
if
(
copy_to_user
(
arg
,
&
tmp
,
sizeof
(
tmp
)))
return
-
EFAULT
;
*
freq
/=
1000
;
return
0
;
}
case
VIDIOCSFREQ
:
{
unsigned
long
tmp
;
if
(
copy_from_user
(
&
tmp
,
arg
,
sizeof
(
tmp
)))
return
-
EFAULT
;
unsigned
long
*
freq
=
arg
;
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
tmp
*=
1000
;
if
(
tmp
<
RSF16_MINFREQ
||
tmp
>
RSF16_MAXFREQ
)
*
freq
*=
1000
;
if
(
*
freq
<
RSF16_MINFREQ
||
*
freq
>
RSF16_MAXFREQ
)
return
-
EINVAL
;
/*rounding in steps of 800 to match th freq
that will be used */
fmi
->
curfreq
=
(
tmp
/
800
)
*
800
;
fmi
->
curfreq
=
(
*
freq
/
800
)
*
800
;
fmi_setfreq
(
fmi
);
return
0
;
}
case
VIDIOCGAUDIO
:
{
struct
video_audio
v
;
v
.
audio
=
0
;
v
.
volume
=
0
;
v
.
bass
=
0
;
v
.
treble
=
0
;
v
.
flags
=
(
(
!
fmi
->
curvol
)
*
VIDEO_AUDIO_MUTE
|
VIDEO_AUDIO_MUTABLE
);
strcpy
(
v
.
name
,
"Radio"
);
v
.
mode
=
VIDEO_SOUND_STEREO
;
v
.
balance
=
0
;
v
.
step
=
0
;
/* No volume, just (un)mute */
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
struct
video_audio
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
->
flags
=
(
(
!
fmi
->
curvol
)
*
VIDEO_AUDIO_MUTE
|
VIDEO_AUDIO_MUTABLE
);
strcpy
(
v
->
name
,
"Radio"
);
v
->
mode
=
VIDEO_SOUND_STEREO
;
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
;
fmi
->
curvol
=
v
.
flags
&
VIDEO_AUDIO_MUTE
?
0
:
1
;
fmi
->
curvol
=
v
->
flags
&
VIDEO_AUDIO_MUTE
?
0
:
1
;
fmi
->
curvol
?
fmi_unmute
(
fmi
->
port
)
:
fmi_mute
(
fmi
->
port
);
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
;
/* How do we find out this??? */
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
;
/* How do we find out this??? */
v
->
teletext
=
VIDEO_NO_UNIT
;
return
0
;
}
default:
...
...
@@ -255,30 +230,24 @@ static int fmi_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
static
int
fmi_open
(
struct
video_device
*
dev
,
int
flags
)
{
if
(
users
)
return
-
EBUSY
;
users
++
;
return
0
;
}
static
void
fmi_close
(
struct
video_device
*
dev
)
{
users
--
;
}
static
struct
fmi_device
fmi_unit
;
static
struct
file_operations
fmi_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
llseek:
no_llseek
,
};
static
struct
video_device
fmi_radio
=
{
owner:
THIS_MODULE
,
name:
"SF16FMx radio"
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_SF16MI
,
open:
fmi_open
,
close:
fmi_close
,
ioctl:
fmi_ioctl
,
fops:
&
fmi_fops
,
kernel_ioctl:
fmi_ioctl
,
};
/* ladis: this is my card. does any other types exist? */
...
...
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