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
4adae09a
Commit
4adae09a
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: mediavision pms update
This patch updates the mediavision pms video driver.
parent
0de708fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
113 deletions
+78
-113
drivers/media/video/pms.c
drivers/media/video/pms.c
+78
-113
No files found.
drivers/media/video/pms.c
View file @
4adae09a
...
@@ -672,119 +672,93 @@ static int pms_capture(struct pms_device *dev, char *buf, int rgb555, int count)
...
@@ -672,119 +672,93 @@ static int pms_capture(struct pms_device *dev, char *buf, int rgb555, int count)
* Video4linux interfacing
* Video4linux interfacing
*/
*/
static
int
pms_open
(
struct
video_device
*
dev
,
int
flags
)
static
int
pms_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
{
unsigned
int
cmd
,
void
*
arg
)
return
0
;
}
static
void
pms_close
(
struct
video_device
*
dev
)
{
}
static
long
pms_write
(
struct
video_device
*
v
,
const
char
*
buf
,
unsigned
long
count
,
int
noblock
)
{
return
-
EINVAL
;
}
static
int
pms_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
{
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
pms_device
*
pd
=
(
struct
pms_device
*
)
dev
;
struct
pms_device
*
pd
=
(
struct
pms_device
*
)
dev
;
switch
(
cmd
)
switch
(
cmd
)
{
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
b
;
struct
video_capability
*
b
=
arg
;
strcpy
(
b
.
name
,
"Mediavision PMS"
);
strcpy
(
b
->
name
,
"Mediavision PMS"
);
b
.
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
;
b
->
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
;
b
.
channels
=
4
;
b
->
channels
=
4
;
b
.
audios
=
0
;
b
->
audios
=
0
;
b
.
maxwidth
=
640
;
b
->
maxwidth
=
640
;
b
.
maxheight
=
480
;
b
->
maxheight
=
480
;
b
.
minwidth
=
16
;
b
->
minwidth
=
16
;
b
.
minheight
=
16
;
b
->
minheight
=
16
;
if
(
copy_to_user
(
arg
,
&
b
,
sizeof
(
b
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCGCHAN
:
case
VIDIOCGCHAN
:
{
{
struct
video_channel
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
<
0
||
v
->
channel
>
3
)
return
-
EFAULT
;
if
(
v
.
channel
<
0
||
v
.
channel
>
3
)
return
-
EINVAL
;
return
-
EINVAL
;
v
.
flags
=
0
;
v
->
flags
=
0
;
v
.
tuners
=
1
;
v
->
tuners
=
1
;
/* Good question.. its composite or SVHS so.. */
/* Good question.. its composite or SVHS so.. */
v
.
type
=
VIDEO_TYPE_CAMERA
;
v
->
type
=
VIDEO_TYPE_CAMERA
;
switch
(
v
.
channel
)
switch
(
v
->
channel
)
{
{
case
0
:
case
0
:
strcpy
(
v
.
name
,
"Composite"
);
break
;
strcpy
(
v
->
name
,
"Composite"
);
break
;
case
1
:
case
1
:
strcpy
(
v
.
name
,
"SVideo"
);
break
;
strcpy
(
v
->
name
,
"SVideo"
);
break
;
case
2
:
case
2
:
strcpy
(
v
.
name
,
"Composite(VCR)"
);
break
;
strcpy
(
v
->
name
,
"Composite(VCR)"
);
break
;
case
3
:
case
3
:
strcpy
(
v
.
name
,
"SVideo(VCR)"
);
break
;
strcpy
(
v
->
name
,
"SVideo(VCR)"
);
break
;
}
}
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSCHAN
:
case
VIDIOCSCHAN
:
{
{
int
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
<
0
||
v
->
channel
>
3
)
return
-
EFAULT
;
if
(
v
<
0
||
v
>
3
)
return
-
EINVAL
;
return
-
EINVAL
;
down
(
&
pd
->
lock
);
down
(
&
pd
->
lock
);
pms_videosource
(
v
&
1
);
pms_videosource
(
v
->
channel
&
1
);
pms_vcrinput
(
v
>>
1
);
pms_vcrinput
(
v
->
channel
>>
1
);
up
(
&
pd
->
lock
);
up
(
&
pd
->
lock
);
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
;
strcpy
(
v
.
name
,
"Format"
);
strcpy
(
v
->
name
,
"Format"
);
v
.
rangelow
=
0
;
v
->
rangelow
=
0
;
v
.
rangehigh
=
0
;
v
->
rangehigh
=
0
;
v
.
flags
=
VIDEO_TUNER_PAL
|
VIDEO_TUNER_NTSC
|
VIDEO_TUNER_SECAM
;
v
->
flags
=
VIDEO_TUNER_PAL
|
VIDEO_TUNER_NTSC
|
VIDEO_TUNER_SECAM
;
switch
(
standard
)
switch
(
standard
)
{
{
case
0
:
case
0
:
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
break
;
break
;
case
1
:
case
1
:
v
.
mode
=
VIDEO_MODE_NTSC
;
v
->
mode
=
VIDEO_MODE_NTSC
;
break
;
break
;
case
2
:
case
2
:
v
.
mode
=
VIDEO_MODE_PAL
;
v
->
mode
=
VIDEO_MODE_PAL
;
break
;
break
;
case
3
:
case
3
:
v
.
mode
=
VIDEO_MODE_SECAM
;
v
->
mode
=
VIDEO_MODE_SECAM
;
break
;
break
;
}
}
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
))
!=
0
)
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
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
down
(
&
pd
->
lock
);
down
(
&
pd
->
lock
);
switch
(
v
.
mode
)
switch
(
v
->
mode
)
{
{
case
VIDEO_MODE_AUTO
:
case
VIDEO_MODE_AUTO
:
pms_framerate
(
25
);
pms_framerate
(
25
);
...
@@ -815,48 +789,43 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -815,48 +789,43 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCGPICT
:
case
VIDIOCGPICT
:
{
{
struct
video_picture
p
=
pd
->
picture
;
struct
video_picture
*
p
=
arg
;
if
(
copy_to_user
(
arg
,
&
p
,
sizeof
(
p
)))
*
p
=
pd
->
picture
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSPICT
:
case
VIDIOCSPICT
:
{
{
struct
video_picture
p
;
struct
video_picture
*
p
=
arg
;
if
(
copy_from_user
(
&
p
,
arg
,
sizeof
(
p
)))
if
(
!
((
p
->
palette
==
VIDEO_PALETTE_RGB565
&&
p
->
depth
==
16
)
return
-
EFAULT
;
||
(
p
->
palette
==
VIDEO_PALETTE_RGB555
&&
p
->
depth
==
15
)))
if
(
!
((
p
.
palette
==
VIDEO_PALETTE_RGB565
&&
p
.
depth
==
16
)
||
(
p
.
palette
==
VIDEO_PALETTE_RGB555
&&
p
.
depth
==
15
)))
return
-
EINVAL
;
return
-
EINVAL
;
pd
->
picture
=
p
;
pd
->
picture
=
*
p
;
/*
/*
* Now load the card.
* Now load the card.
*/
*/
down
(
&
pd
->
lock
);
down
(
&
pd
->
lock
);
pms_brightness
(
p
.
brightness
>>
8
);
pms_brightness
(
p
->
brightness
>>
8
);
pms_hue
(
p
.
hue
>>
8
);
pms_hue
(
p
->
hue
>>
8
);
pms_colour
(
p
.
colour
>>
8
);
pms_colour
(
p
->
colour
>>
8
);
pms_contrast
(
p
.
contrast
>>
8
);
pms_contrast
(
p
->
contrast
>>
8
);
up
(
&
pd
->
lock
);
up
(
&
pd
->
lock
);
return
0
;
return
0
;
}
}
case
VIDIOCSWIN
:
case
VIDIOCSWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
if
(
copy_from_user
(
&
vw
,
arg
,
sizeof
(
vw
)))
if
(
vw
->
flags
)
return
-
EFAULT
;
if
(
vw
.
flags
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
clipcount
)
if
(
vw
->
clipcount
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
height
<
16
||
vw
.
height
>
480
)
if
(
vw
->
height
<
16
||
vw
->
height
>
480
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
width
<
16
||
vw
.
width
>
640
)
if
(
vw
->
width
<
16
||
vw
->
width
>
640
)
return
-
EINVAL
;
return
-
EINVAL
;
pd
->
width
=
vw
.
width
;
pd
->
width
=
vw
->
width
;
pd
->
height
=
vw
.
height
;
pd
->
height
=
vw
->
height
;
down
(
&
pd
->
lock
);
down
(
&
pd
->
lock
);
pms_resolution
(
pd
->
width
,
pd
->
height
);
pms_resolution
(
pd
->
width
,
pd
->
height
);
up
(
&
pd
->
lock
);
/* Ok we figured out what to use from our wide choice */
up
(
&
pd
->
lock
);
/* Ok we figured out what to use from our wide choice */
...
@@ -864,31 +833,20 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -864,31 +833,20 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCGWIN
:
case
VIDIOCGWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
vw
.
x
=
0
;
memset
(
vw
,
0
,
sizeof
(
*
vw
));
vw
.
y
=
0
;
vw
->
width
=
pd
->
width
;
vw
.
width
=
pd
->
width
;
vw
->
height
=
pd
->
height
;
vw
.
height
=
pd
->
height
;
vw
.
chromakey
=
0
;
vw
.
flags
=
0
;
if
(
copy_to_user
(
arg
,
&
vw
,
sizeof
(
vw
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCKEY
:
return
0
;
case
VIDIOCCAPTURE
:
case
VIDIOCCAPTURE
:
return
-
EINVAL
;
case
VIDIOCGFBUF
:
case
VIDIOCGFBUF
:
return
-
EINVAL
;
case
VIDIOCSFBUF
:
case
VIDIOCSFBUF
:
return
-
EINVAL
;
case
VIDIOCKEY
:
return
0
;
case
VIDIOCGFREQ
:
case
VIDIOCGFREQ
:
return
-
EINVAL
;
case
VIDIOCSFREQ
:
case
VIDIOCSFREQ
:
return
-
EINVAL
;
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
return
-
EINVAL
;
case
VIDIOCSAUDIO
:
case
VIDIOCSAUDIO
:
return
-
EINVAL
;
return
-
EINVAL
;
default:
default:
...
@@ -897,8 +855,10 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -897,8 +855,10 @@ static int pms_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
return
0
;
return
0
;
}
}
static
long
pms_read
(
struct
video_device
*
v
,
char
*
buf
,
unsigned
long
count
,
int
noblock
)
static
int
pms_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
video_device
*
v
=
video_devdata
(
file
);
struct
pms_device
*
pd
=
(
struct
pms_device
*
)
v
;
struct
pms_device
*
pd
=
(
struct
pms_device
*
)
v
;
int
len
;
int
len
;
...
@@ -908,18 +868,23 @@ static long pms_read(struct video_device *v, char *buf, unsigned long count, in
...
@@ -908,18 +868,23 @@ static long pms_read(struct video_device *v, char *buf, unsigned long count, in
return
len
;
return
len
;
}
}
static
struct
file_operations
pms_fops
=
{
struct
video_device
pms_template
=
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
read:
pms_read
,
llseek:
no_llseek
,
};
static
struct
video_device
pms_template
=
{
{
owner:
THIS_MODULE
,
owner:
THIS_MODULE
,
name:
"Mediavision PMS"
,
name:
"Mediavision PMS"
,
type:
VID_TYPE_CAPTURE
,
type:
VID_TYPE_CAPTURE
,
hardware:
VID_HARDWARE_PMS
,
hardware:
VID_HARDWARE_PMS
,
open:
pms_open
,
fops:
&
pms_fops
,
close:
pms_close
,
kernel_ioctl:
pms_ioctl
,
read:
pms_read
,
write:
pms_write
,
ioctl:
pms_ioctl
,
};
};
struct
pms_device
pms_device
;
struct
pms_device
pms_device
;
...
...
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