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
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
...
@@ -36,7 +36,6 @@ struct fmi_device
static
int
io
=
-
1
;
static
int
io
=
-
1
;
static
int
radio_nr
=
-
1
;
static
int
radio_nr
=
-
1
;
static
int
users
=
0
;
static
struct
pci_dev
*
dev
=
NULL
;
static
struct
pci_dev
*
dev
=
NULL
;
static
struct
semaphore
lock
;
static
struct
semaphore
lock
;
...
@@ -133,121 +132,97 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
...
@@ -133,121 +132,97 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
return
(
res
&
2
)
?
0
:
0xFFFF
;
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
;
struct
fmi_device
*
fmi
=
dev
->
priv
;
switch
(
cmd
)
switch
(
cmd
)
{
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
v
;
struct
video_capability
*
v
=
arg
;
strcpy
(
v
.
name
,
"SF16-FMx radio"
);
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
type
=
VID_TYPE_TUNER
;
strcpy
(
v
->
name
,
"SF16-FMx radio"
);
v
.
channels
=
1
;
v
->
type
=
VID_TYPE_TUNER
;
v
.
audios
=
1
;
v
->
channels
=
1
;
/* No we don't do pictures */
v
->
audios
=
1
;
v
.
maxwidth
=
0
;
v
.
maxheight
=
0
;
v
.
minwidth
=
0
;
v
.
minheight
=
0
;
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
;
int
mult
;
int
mult
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
if
(
v
->
tuner
)
/* Only 1 tuner */
return
-
EFAULT
;
if
(
v
.
tuner
)
/* Only 1 tuner */
return
-
EINVAL
;
return
-
EINVAL
;
strcpy
(
v
.
name
,
"FM"
);
strcpy
(
v
->
name
,
"FM"
);
mult
=
(
fmi
->
flags
&
VIDEO_TUNER_LOW
)
?
1
:
1000
;
mult
=
(
fmi
->
flags
&
VIDEO_TUNER_LOW
)
?
1
:
1000
;
v
.
rangelow
=
RSF16_MINFREQ
/
mult
;
v
->
rangelow
=
RSF16_MINFREQ
/
mult
;
v
.
rangehigh
=
RSF16_MAXFREQ
/
mult
;
v
->
rangehigh
=
RSF16_MAXFREQ
/
mult
;
v
.
flags
=
fmi
->
flags
;
v
->
flags
=
fmi
->
flags
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
fmi_getsigstr
(
fmi
);
v
->
signal
=
fmi_getsigstr
(
fmi
);
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
;
fmi
->
flags
=
v
.
flags
&
VIDEO_TUNER_LOW
;
fmi
->
flags
=
v
->
flags
&
VIDEO_TUNER_LOW
;
/* Only 1 tuner so no setting needed ! */
/* Only 1 tuner so no setting needed ! */
return
0
;
return
0
;
}
}
case
VIDIOCGFREQ
:
case
VIDIOCGFREQ
:
{
{
unsigned
long
tmp
=
fmi
->
curfreq
;
unsigned
long
*
freq
=
arg
;
*
freq
=
fmi
->
curfreq
;
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
tmp
/=
1000
;
*
freq
/=
1000
;
if
(
copy_to_user
(
arg
,
&
tmp
,
sizeof
(
tmp
)))
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
)))
return
-
EFAULT
;
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
if
(
!
(
fmi
->
flags
&
VIDEO_TUNER_LOW
))
tmp
*=
1000
;
*
freq
*=
1000
;
if
(
tmp
<
RSF16_MINFREQ
||
tmp
>
RSF16_MAXFREQ
)
if
(
*
freq
<
RSF16_MINFREQ
||
*
freq
>
RSF16_MAXFREQ
)
return
-
EINVAL
;
return
-
EINVAL
;
/*rounding in steps of 800 to match th freq
/*rounding in steps of 800 to match th freq
that will be used */
that will be used */
fmi
->
curfreq
=
(
tmp
/
800
)
*
800
;
fmi
->
curfreq
=
(
*
freq
/
800
)
*
800
;
fmi_setfreq
(
fmi
);
fmi_setfreq
(
fmi
);
return
0
;
return
0
;
}
}
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
{
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
v
.
audio
=
0
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
volume
=
0
;
v
->
flags
=
(
(
!
fmi
->
curvol
)
*
VIDEO_AUDIO_MUTE
|
VIDEO_AUDIO_MUTABLE
);
v
.
bass
=
0
;
strcpy
(
v
->
name
,
"Radio"
);
v
.
treble
=
0
;
v
->
mode
=
VIDEO_SOUND_STEREO
;
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
;
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
;
fmi
->
curvol
=
v
.
flags
&
VIDEO_AUDIO_MUTE
?
0
:
1
;
fmi
->
curvol
=
v
->
flags
&
VIDEO_AUDIO_MUTE
?
0
:
1
;
fmi
->
curvol
?
fmi
->
curvol
?
fmi_unmute
(
fmi
->
port
)
:
fmi_mute
(
fmi
->
port
);
fmi_unmute
(
fmi
->
port
)
:
fmi_mute
(
fmi
->
port
);
return
0
;
return
0
;
}
}
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
;
/* How do we find out this??? */
v
->
audio
=
0
;
/* How do we find out this??? */
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:
default:
...
@@ -255,30 +230,24 @@ static int fmi_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -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
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
=
static
struct
video_device
fmi_radio
=
{
{
owner:
THIS_MODULE
,
owner:
THIS_MODULE
,
name:
"SF16FMx radio"
,
name:
"SF16FMx radio"
,
type:
VID_TYPE_TUNER
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_SF16MI
,
hardware:
VID_HARDWARE_SF16MI
,
open:
fmi_open
,
fops:
&
fmi_fops
,
close:
fmi_close
,
kernel_ioctl:
fmi_ioctl
,
ioctl:
fmi_ioctl
,
};
};
/* ladis: this is my card. does any other types exist? */
/* 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