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
cfaae3ee
Commit
cfaae3ee
authored
Apr 28, 2007
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Pull sony into release branch
parents
eaf60d69
c6c60106
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2073 additions
and
264 deletions
+2073
-264
Documentation/sony-laptop.txt
Documentation/sony-laptop.txt
+18
-7
Documentation/video4linux/meye.txt
Documentation/video4linux/meye.txt
+3
-4
drivers/char/sonypi.c
drivers/char/sonypi.c
+43
-10
drivers/media/video/Kconfig
drivers/media/video/Kconfig
+3
-3
drivers/media/video/meye.c
drivers/media/video/meye.c
+31
-31
drivers/media/video/meye.h
drivers/media/video/meye.h
+1
-1
drivers/misc/Kconfig
drivers/misc/Kconfig
+10
-5
drivers/misc/sony-laptop.c
drivers/misc/sony-laptop.c
+1930
-203
include/linux/sony-laptop.h
include/linux/sony-laptop.h
+34
-0
No files found.
Documentation/sony-laptop.txt
View file @
cfaae3ee
...
...
@@ -3,12 +3,18 @@ Sony Notebook Control Driver (SNC) Readme
Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net>
Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
This mini-driver drives the SNC device present in the ACPI BIOS of
the Sony Vaio laptops.
This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
Sony Vaio laptops. This driver mixes both devices functions under the same
(hopefully consistent) interface. This also means that the sonypi driver is
obsoleted by sony-laptop now.
It gives access to some extra laptop functionalities. In its current
form, this driver let the user set or query the screen brightness
through the backlight subsystem and remove/apply power to some devices.
Fn keys (hotkeys):
------------------
Some models report hotkeys through the SNC or SPIC devices, such events are
reported both through the ACPI subsystem as acpi events and through the INPUT
subsystem. See the logs of acpid or /proc/acpi/event and
/proc/bus/input/devices to find out what those events are and which input
devices are created by the driver.
Backlight control:
------------------
...
...
@@ -39,6 +45,8 @@ The files are:
audiopower power on/off the internal sound card
lanpower power on/off the internal ethernet card
(only in debug mode)
bluetoothpower power on/off the internal bluetooth device
fanspeed get/set the fan speed
Note that some files may be missing if they are not supported
by your particular laptop model.
...
...
@@ -76,9 +84,9 @@ The sony-laptop driver creates, for some of those methods (the most
current ones found on several Vaio models), an entry under
/sys/devices/platform/sony-laptop, just like the 'cdpower' one.
You can create other entries corresponding to your own laptop methods by
further editing the source (see the 'sony_
acpi
_values' table, and add a new
further editing the source (see the 'sony_
nc
_values' table, and add a new
entry to this table with your get/set method names using the
HANDLE_NAMES macro).
SNC_
HANDLE_NAMES macro).
Your mission, should you accept it, is to try finding out what
those entries are for, by reading/writing random values from/to those
...
...
@@ -87,6 +95,9 @@ files and find out what is the impact on your laptop.
Should you find anything interesting, please report it back to me,
I will not disavow all knowledge of your actions :)
See also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other
useful info.
Bugs/Limitations:
-----------------
...
...
Documentation/video4linux/meye.txt
View file @
cfaae3ee
...
...
@@ -5,10 +5,9 @@ Vaio Picturebook Motion Eye Camera Driver Readme
Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
This driver enable the use of video4linux compatible applications with the
Motion Eye camera. This driver requires the "Sony Vaio Programmable I/O
Control Device" driver (which can be found in the "Character drivers"
section of the kernel configuration utility) to be compiled and installed
(using its "camera=1" parameter).
Motion Eye camera. This driver requires the "Sony Laptop Extras" driver (which
can be found in the "Misc devices" section of the kernel configuration utility)
to be compiled and installed (using its "camera=1" parameter).
It can do at maximum 30 fps @ 320x240 or 15 fps @ 640x480.
...
...
drivers/char/sonypi.c
View file @
cfaae3ee
/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
*
* Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
...
...
@@ -95,6 +97,11 @@ module_param(useinput, int, 0444);
MODULE_PARM_DESC
(
useinput
,
"set this if you would like sonypi to feed events to the input subsystem"
);
static
int
check_ioport
=
1
;
module_param
(
check_ioport
,
int
,
0444
);
MODULE_PARM_DESC
(
check_ioport
,
"set this to 0 if you think the automatic ioport check for sony-laptop is wrong"
);
#define SONYPI_DEVICE_MODEL_TYPE1 1
#define SONYPI_DEVICE_MODEL_TYPE2 2
#define SONYPI_DEVICE_MODEL_TYPE3 3
...
...
@@ -477,7 +484,7 @@ static struct sonypi_device {
u16
evtype_offset
;
int
camera_power
;
int
bluetooth_power
;
struct
semaphore
lock
;
struct
mutex
lock
;
struct
kfifo
*
fifo
;
spinlock_t
fifo_lock
;
wait_queue_head_t
fifo_proc_list
;
...
...
@@ -884,7 +891,7 @@ int sonypi_camera_command(int command, u8 value)
if
(
!
camera
)
return
-
EIO
;
down
(
&
sonypi_device
.
lock
);
mutex_lock
(
&
sonypi_device
.
lock
);
switch
(
command
)
{
case
SONYPI_COMMAND_SETCAMERA
:
...
...
@@ -919,7 +926,7 @@ int sonypi_camera_command(int command, u8 value)
command
);
break
;
}
up
(
&
sonypi_device
.
lock
);
mutex_unlock
(
&
sonypi_device
.
lock
);
return
0
;
}
...
...
@@ -938,20 +945,20 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on)
static
int
sonypi_misc_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
sonypi_misc_fasync
(
-
1
,
file
,
0
);
down
(
&
sonypi_device
.
lock
);
mutex_lock
(
&
sonypi_device
.
lock
);
sonypi_device
.
open_count
--
;
up
(
&
sonypi_device
.
lock
);
mutex_unlock
(
&
sonypi_device
.
lock
);
return
0
;
}
static
int
sonypi_misc_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
down
(
&
sonypi_device
.
lock
);
mutex_lock
(
&
sonypi_device
.
lock
);
/* Flush input queue on first open */
if
(
!
sonypi_device
.
open_count
)
kfifo_reset
(
sonypi_device
.
fifo
);
sonypi_device
.
open_count
++
;
up
(
&
sonypi_device
.
lock
);
mutex_unlock
(
&
sonypi_device
.
lock
);
return
0
;
}
...
...
@@ -1001,7 +1008,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
u8
val8
;
u16
val16
;
down
(
&
sonypi_device
.
lock
);
mutex_lock
(
&
sonypi_device
.
lock
);
switch
(
cmd
)
{
case
SONYPI_IOCGBRT
:
if
(
sonypi_ec_read
(
SONYPI_LCD_LIGHT
,
&
val8
))
{
...
...
@@ -1101,7 +1108,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
default:
ret
=
-
EINVAL
;
}
up
(
&
sonypi_device
.
lock
);
mutex_unlock
(
&
sonypi_device
.
lock
);
return
ret
;
}
...
...
@@ -1260,6 +1267,28 @@ static int __devinit sonypi_create_input_devices(void)
static
int
__devinit
sonypi_setup_ioports
(
struct
sonypi_device
*
dev
,
const
struct
sonypi_ioport_list
*
ioport_list
)
{
/* try to detect if sony-laptop is being used and thus
* has already requested one of the known ioports.
* As in the deprecated check_region this is racy has we have
* multiple ioports available and one of them can be requested
* between this check and the subsequent request. Anyway, as an
* attempt to be some more user-friendly as we currently are,
* this is enough.
*/
const
struct
sonypi_ioport_list
*
check
=
ioport_list
;
while
(
check_ioport
&&
check
->
port1
)
{
if
(
!
request_region
(
check
->
port1
,
sonypi_device
.
region_size
,
"Sony Programable I/O Device Check"
))
{
printk
(
KERN_ERR
"sonypi: ioport 0x%.4x busy, using sony-laptop? "
"if not use check_ioport=0
\n
"
,
check
->
port1
);
return
-
EBUSY
;
}
release_region
(
check
->
port1
,
sonypi_device
.
region_size
);
check
++
;
}
while
(
ioport_list
->
port1
)
{
if
(
request_region
(
ioport_list
->
port1
,
...
...
@@ -1321,6 +1350,10 @@ static int __devinit sonypi_probe(struct platform_device *dev)
struct
pci_dev
*
pcidev
;
int
error
;
printk
(
KERN_WARNING
"sonypi: please try the sony-laptop module instead "
"and report failures, see also "
"http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
\n
"
);
spin_lock_init
(
&
sonypi_device
.
fifo_lock
);
sonypi_device
.
fifo
=
kfifo_alloc
(
SONYPI_BUF_SIZE
,
GFP_KERNEL
,
&
sonypi_device
.
fifo_lock
);
...
...
@@ -1330,7 +1363,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
}
init_waitqueue_head
(
&
sonypi_device
.
fifo_proc_list
);
init_MUTEX
(
&
sonypi_device
.
lock
);
mutex_init
(
&
sonypi_device
.
lock
);
sonypi_device
.
bluetooth_power
=
-
1
;
if
((
pcidev
=
pci_get_device
(
PCI_VENDOR_ID_INTEL
,
...
...
drivers/media/video/Kconfig
View file @
cfaae3ee
...
...
@@ -577,14 +577,14 @@ config VIDEO_ZORAN_AVS6EYES
config VIDEO_MEYE
tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
depends on PCI && SONY
PI
&& VIDEO_V4L1
depends on PCI && SONY
_LAPTOP
&& VIDEO_V4L1
---help---
This is the video4linux driver for the Motion Eye camera found
in the Vaio Picturebook laptops. Please read the material in
<file:Documentation/video4linux/meye.txt> for more information.
If you say Y or M here, you need to say Y or M to "Sony
Programmable
I/O Control Device" in the character
device section.
If you say Y or M here, you need to say Y or M to "Sony
Laptop
Extras" in the misc
device section.
To compile this driver as a module, choose M here: the
module will be called meye.
...
...
drivers/media/video/meye.c
View file @
cfaae3ee
...
...
@@ -925,13 +925,13 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
if
(
p
->
palette
!=
VIDEO_PALETTE_YUV422
&&
p
->
palette
!=
VIDEO_PALETTE_YUYV
)
return
-
EINVAL
;
mutex_lock
(
&
meye
.
lock
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERABRIGHTNESS
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERABRIGHTNESS
,
p
->
brightness
>>
10
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAHUE
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAHUE
,
p
->
hue
>>
10
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERACOLOR
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERACOLOR
,
p
->
colour
>>
10
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERACONTRAST
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERACONTRAST
,
p
->
contrast
>>
10
);
meye
.
picture
=
*
p
;
mutex_unlock
(
&
meye
.
lock
);
...
...
@@ -1043,11 +1043,11 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
meye
.
params
.
quality
!=
jp
->
quality
)
mchip_hic_stop
();
/* need restart */
meye
.
params
=
*
jp
;
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERASHARPNESS
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERASHARPNESS
,
meye
.
params
.
sharpness
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAAGC
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAAGC
,
meye
.
params
.
agc
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAPICTURE
,
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAPICTURE
,
meye
.
params
.
picture
);
mutex_unlock
(
&
meye
.
lock
);
break
;
...
...
@@ -1287,38 +1287,38 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
mutex_lock
(
&
meye
.
lock
);
switch
(
c
->
id
)
{
case
V4L2_CID_BRIGHTNESS
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERABRIGHTNESS
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERABRIGHTNESS
,
c
->
value
);
meye
.
picture
.
brightness
=
c
->
value
<<
10
;
break
;
case
V4L2_CID_HUE
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERAHUE
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERAHUE
,
c
->
value
);
meye
.
picture
.
hue
=
c
->
value
<<
10
;
break
;
case
V4L2_CID_CONTRAST
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERACONTRAST
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERACONTRAST
,
c
->
value
);
meye
.
picture
.
contrast
=
c
->
value
<<
10
;
break
;
case
V4L2_CID_SATURATION
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERACOLOR
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERACOLOR
,
c
->
value
);
meye
.
picture
.
colour
=
c
->
value
<<
10
;
break
;
case
V4L2_CID_AGC
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERAAGC
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERAAGC
,
c
->
value
);
meye
.
params
.
agc
=
c
->
value
;
break
;
case
V4L2_CID_SHARPNESS
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERASHARPNESS
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERASHARPNESS
,
c
->
value
);
meye
.
params
.
sharpness
=
c
->
value
;
break
;
case
V4L2_CID_PICTURE
:
sony
pi
_camera_command
(
SONY
PI
_COMMAND_SETCAMERAPICTURE
,
c
->
value
);
sony
_pic
_camera_command
(
SONY
_PIC
_COMMAND_SETCAMERAPICTURE
,
c
->
value
);
meye
.
params
.
picture
=
c
->
value
;
break
;
case
V4L2_CID_JPEGQUAL
:
...
...
@@ -1848,7 +1848,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
memcpy
(
meye
.
video_dev
,
&
meye_template
,
sizeof
(
meye_template
));
meye
.
video_dev
->
dev
=
&
meye
.
mchip_dev
->
dev
;
if
((
ret
=
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERA
,
1
)))
{
if
((
ret
=
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERA
,
1
)))
{
printk
(
KERN_ERR
"meye: unable to power on the camera
\n
"
);
printk
(
KERN_ERR
"meye: did you enable the camera in "
"sonypi using the module options ?
\n
"
);
...
...
@@ -1928,13 +1928,13 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
meye
.
params
.
picture
=
0
;
meye
.
params
.
framerate
=
0
;
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERABRIGHTNESS
,
32
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAHUE
,
32
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERACOLOR
,
32
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERACONTRAST
,
32
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERASHARPNESS
,
32
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAPICTURE
,
0
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERAAGC
,
48
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERABRIGHTNESS
,
32
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAHUE
,
32
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERACOLOR
,
32
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERACONTRAST
,
32
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERASHARPNESS
,
32
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAPICTURE
,
0
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERAAGC
,
48
);
printk
(
KERN_INFO
"meye: Motion Eye Camera Driver v%s.
\n
"
,
MEYE_DRIVER_VERSION
);
...
...
@@ -1953,7 +1953,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
outregions:
pci_disable_device
(
meye
.
mchip_dev
);
outenabledev:
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERA
,
0
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERA
,
0
);
outsonypienable:
kfifo_free
(
meye
.
doneq
);
outkfifoalloc2:
...
...
@@ -1986,7 +1986,7 @@ static void __devexit meye_remove(struct pci_dev *pcidev)
pci_disable_device
(
meye
.
mchip_dev
);
sony
pi_camera_command
(
SONYPI
_COMMAND_SETCAMERA
,
0
);
sony
_pic_camera_command
(
SONY_PIC
_COMMAND_SETCAMERA
,
0
);
kfifo_free
(
meye
.
doneq
);
kfifo_free
(
meye
.
grabq
);
...
...
drivers/media/video/meye.h
View file @
cfaae3ee
...
...
@@ -255,7 +255,7 @@
/****************************************************************************/
/* Sony Programmable I/O Controller for accessing the camera commands */
#include <linux/sony
pi
.h>
#include <linux/sony
-laptop
.h>
/* private API definitions */
#include <linux/meye.h>
...
...
drivers/misc/Kconfig
View file @
cfaae3ee
...
...
@@ -112,14 +112,19 @@ config SONY_LAPTOP
depends on X86 && ACPI
select BACKLIGHT_CLASS_DEVICE
---help---
This mini-driver drives the SNC
device present in the ACPI BIOS of
the Sony Vaio laptops.
This mini-driver drives the SNC
and SPIC devices present in the ACPI
BIOS of
the Sony Vaio laptops.
It gives access to some extra laptop functionalities. In its current
form, this driver let the user set or query the screen brightness
through the backlight subsystem and remove/apply power to some
It gives access to some extra laptop functionalities like Bluetooth,
screen brightness control, Fn keys and allows powering on/off some
devices.
Read <file:Documentation/sony-laptop.txt> for more information.
config SONY_LAPTOP_OLD
bool "Sonypi compatibility"
depends on SONY_LAPTOP
---help---
Build the sonypi driver compatibility code into the sony-laptop driver.
endmenu
drivers/misc/sony-laptop.c
View file @
cfaae3ee
This diff is collapsed.
Click to expand it.
include/linux/sony-laptop.h
0 → 100644
View file @
cfaae3ee
#ifndef _SONYLAPTOP_H_
#define _SONYLAPTOP_H_
#include <linux/types.h>
#ifdef __KERNEL__
/* used only for communication between v4l and sony-laptop */
#define SONY_PIC_COMMAND_GETCAMERA 1
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERA 2
#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4
#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6
#define SONY_PIC_COMMAND_GETCAMERAHUE 7
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERAHUE 8
#define SONY_PIC_COMMAND_GETCAMERACOLOR 9
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERACOLOR 10
#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12
#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14
#define SONY_PIC_COMMAND_GETCAMERAAGC 15
/* obsolete */
#define SONY_PIC_COMMAND_SETCAMERAAGC 16
#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17
/* obsolete */
#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18
/* obsolete */
#define SONY_PIC_COMMAND_GETCAMERAREVISION 19
/* obsolete */
int
sony_pic_camera_command
(
int
command
,
u8
value
);
#endif
/* __KERNEL__ */
#endif
/* _SONYLAPTOP_H_ */
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