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
05a0bb34
Commit
05a0bb34
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: trust radio update
This is the update for the trust radio driver.
parent
97b49ed5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
82 deletions
+50
-82
drivers/media/radio/radio-trust.c
drivers/media/radio/radio-trust.c
+50
-82
No files found.
drivers/media/radio/radio-trust.c
View file @
05a0bb34
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
static
int
io
=
CONFIG_RADIO_TRUST_PORT
;
static
int
io
=
CONFIG_RADIO_TRUST_PORT
;
static
int
radio_nr
=
-
1
;
static
int
radio_nr
=
-
1
;
static
int
ioval
=
0xf
;
static
int
ioval
=
0xf
;
static
int
users
=
0
;
static
__u16
curvol
;
static
__u16
curvol
;
static
__u16
curbass
;
static
__u16
curbass
;
static
__u16
curtreble
;
static
__u16
curtreble
;
...
@@ -155,114 +154,89 @@ static void tr_setfreq(unsigned long f)
...
@@ -155,114 +154,89 @@ static void tr_setfreq(unsigned long f)
write_i2c
(
5
,
TSA6060T_ADDR
,
(
f
<<
1
)
|
1
,
f
>>
7
,
0x60
|
((
f
>>
15
)
&
1
),
0
);
write_i2c
(
5
,
TSA6060T_ADDR
,
(
f
<<
1
)
|
1
,
f
>>
7
,
0x60
|
((
f
>>
15
)
&
1
),
0
);
}
}
static
int
tr_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
static
int
tr_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
{
{
switch
(
cmd
)
switch
(
cmd
)
{
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
v
;
struct
video_capability
*
v
=
arg
;
v
.
type
=
VID_TYPE_TUNER
;
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
channels
=
1
;
v
->
type
=
VID_TYPE_TUNER
;
v
.
audios
=
1
;
v
->
channels
=
1
;
v
->
audios
=
1
;
/* No we don't do pictures */
strcpy
(
v
->
name
,
"Trust FM Radio"
);
v
.
maxwidth
=
0
;
v
.
maxheight
=
0
;
v
.
minwidth
=
0
;
v
.
minheight
=
0
;
strcpy
(
v
.
name
,
"Trust FM Radio"
);
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
)
/* Only 1 tuner */
return
-
EFAULT
;
if
(
v
.
tuner
)
/* Only 1 tuner */
return
-
EINVAL
;
return
-
EINVAL
;
v
.
rangelow
=
87500
*
16
;
v
->
rangelow
=
87500
*
16
;
v
.
rangehigh
=
108000
*
16
;
v
->
rangehigh
=
108000
*
16
;
v
.
flags
=
VIDEO_TUNER_LOW
;
v
->
flags
=
VIDEO_TUNER_LOW
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
.
signal
=
tr_getsigstr
();
v
->
signal
=
tr_getsigstr
();
if
(
tr_getstereo
())
if
(
tr_getstereo
())
v
.
flags
|=
VIDEO_TUNER_STEREO_ON
;
v
->
flags
|=
VIDEO_TUNER_STEREO_ON
;
strcpy
(
v
.
name
,
"FM"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
strcpy
(
v
->
name
,
"FM"
);
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
:
if
(
copy_to_user
(
arg
,
&
curfreq
,
sizeof
(
curfreq
)))
{
return
-
EFAULT
;
unsigned
long
*
freq
=
arg
;
*
freq
=
curfreq
;
return
0
;
return
0
;
}
case
VIDIOCSFREQ
:
case
VIDIOCSFREQ
:
{
{
unsigned
long
f
;
unsigned
long
*
freq
=
arg
;
tr_setfreq
(
*
freq
);
if
(
copy_from_user
(
&
f
,
arg
,
sizeof
(
curfreq
)))
return
-
EFAULT
;
tr_setfreq
(
f
);
return
0
;
return
0
;
}
}
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
{
{
struct
video_audio
v
;
struct
video_audio
*
v
=
arg
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
flags
=
VIDEO_AUDIO_MUTABLE
|
VIDEO_AUDIO_VOLUME
|
v
->
flags
=
VIDEO_AUDIO_MUTABLE
|
VIDEO_AUDIO_VOLUME
|
VIDEO_AUDIO_BASS
|
VIDEO_AUDIO_TREBLE
;
VIDEO_AUDIO_BASS
|
VIDEO_AUDIO_TREBLE
;
v
.
mode
=
curstereo
?
VIDEO_SOUND_STEREO
:
VIDEO_SOUND_MONO
;
v
->
mode
=
curstereo
?
VIDEO_SOUND_STEREO
:
VIDEO_SOUND_MONO
;
v
.
volume
=
curvol
*
2048
;
v
->
volume
=
curvol
*
2048
;
v
.
step
=
2048
;
v
->
step
=
2048
;
v
.
bass
=
curbass
*
4370
;
v
->
bass
=
curbass
*
4370
;
v
.
treble
=
curtreble
*
4370
;
v
->
treble
=
curtreble
*
4370
;
strcpy
(
v
.
name
,
"Trust FM Radio"
);
strcpy
(
v
->
name
,
"Trust FM Radio"
);
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
;
tr_setvol
(
v
->
volume
);
tr_setvol
(
v
.
volume
);
tr_setbass
(
v
->
bass
);
tr_setbass
(
v
.
bass
);
tr_settreble
(
v
->
treble
);
tr_settreble
(
v
.
treble
);
tr_setstereo
(
v
->
mode
&
VIDEO_SOUND_STEREO
);
tr_setstereo
(
v
.
mode
&
VIDEO_SOUND_STEREO
);
tr_setmute
(
v
->
flags
&
VIDEO_AUDIO_MUTE
);
tr_setmute
(
v
.
flags
&
VIDEO_AUDIO_MUTE
);
return
0
;
return
0
;
}
}
default:
default:
...
@@ -270,18 +244,13 @@ static int tr_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -270,18 +244,13 @@ static int tr_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
}
}
static
int
tr_open
(
struct
video_device
*
dev
,
int
flags
)
static
struct
file_operations
trust_fops
=
{
{
owner:
THIS_MODULE
,
if
(
users
)
open:
video_exclusive_open
,
return
-
EBUSY
;
release:
video_exclusive_release
,
users
++
;
ioctl:
video_generic_ioctl
,
return
0
;
llseek:
no_llseek
,
}
};
static
void
tr_close
(
struct
video_device
*
dev
)
{
users
--
;
}
static
struct
video_device
trust_radio
=
static
struct
video_device
trust_radio
=
{
{
...
@@ -289,9 +258,8 @@ static struct video_device trust_radio=
...
@@ -289,9 +258,8 @@ static struct video_device trust_radio=
name:
"Trust FM Radio"
,
name:
"Trust FM Radio"
,
type:
VID_TYPE_TUNER
,
type:
VID_TYPE_TUNER
,
hardware:
VID_HARDWARE_TRUST
,
hardware:
VID_HARDWARE_TRUST
,
open:
tr_open
,
fops:
&
trust_fops
,
close:
tr_close
,
kernel_ioctl:
tr_ioctl
,
ioctl:
tr_ioctl
,
};
};
static
int
__init
trust_init
(
void
)
static
int
__init
trust_init
(
void
)
...
...
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