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
61bc79b5
Commit
61bc79b5
authored
Nov 25, 2002
by
Andy Grover
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://groveronline.com:5555
into groveronline.com:/root/bk/linux-acpi
parents
5dfef799
564a39dd
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
522 additions
and
560 deletions
+522
-560
drivers/acpi/ac.c
drivers/acpi/ac.c
+26
-31
drivers/acpi/button.c
drivers/acpi/button.c
+20
-25
drivers/acpi/power.c
drivers/acpi/power.c
+29
-34
drivers/acpi/processor.c
drivers/acpi/processor.c
+153
-183
drivers/acpi/sleep.c
drivers/acpi/sleep.c
+44
-58
drivers/acpi/thermal.c
drivers/acpi/thermal.c
+117
-134
drivers/acpi/toshiba_acpi.c
drivers/acpi/toshiba_acpi.c
+133
-95
No files found.
drivers/acpi/ac.c
View file @
61bc79b5
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
...
@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
int
acpi_ac_add
(
struct
acpi_device
*
device
);
int
acpi_ac_add
(
struct
acpi_device
*
device
);
int
acpi_ac_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_ac_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_ac_driver
=
{
static
struct
acpi_driver
acpi_ac_driver
=
{
.
name
=
ACPI_AC_DRIVER_NAME
,
.
name
=
ACPI_AC_DRIVER_NAME
,
...
@@ -69,6 +71,12 @@ struct acpi_ac {
...
@@ -69,6 +71,12 @@ struct acpi_ac {
unsigned
long
state
;
unsigned
long
state
;
};
};
static
struct
file_operations
acpi_ac_fops
=
{
.
open
=
acpi_ac_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
AC Adapter Management
AC Adapter Management
...
@@ -103,53 +111,40 @@ acpi_ac_get_state (
...
@@ -103,53 +111,40 @@ acpi_ac_get_state (
struct
proc_dir_entry
*
acpi_ac_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_ac_dir
=
NULL
;
static
int
int
acpi_ac_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_ac_read_state
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_ac
*
ac
=
(
struct
acpi_ac
*
)
data
;
struct
acpi_ac
*
ac
=
(
struct
acpi_ac
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_ac_
read_state
"
);
ACPI_FUNCTION_TRACE
(
"acpi_ac_
seq_show
"
);
if
(
!
ac
||
(
off
!=
0
)
)
if
(
!
ac
)
goto
end
;
return
0
;
if
(
acpi_ac_get_state
(
ac
))
{
if
(
acpi_ac_get_state
(
ac
))
{
p
+=
sprintf
(
p
,
"ERROR: Unable to read AC Adapter state
\n
"
);
seq_puts
(
seq
,
"ERROR: Unable to read AC Adapter state
\n
"
);
goto
end
;
return
0
;
}
}
p
+=
sprintf
(
p
,
"state: "
);
seq_puts
(
seq
,
"state: "
);
switch
(
ac
->
state
)
{
switch
(
ac
->
state
)
{
case
ACPI_AC_STATUS_OFFLINE
:
case
ACPI_AC_STATUS_OFFLINE
:
p
+=
sprintf
(
p
,
"off-line
\n
"
);
seq_puts
(
seq
,
"off-line
\n
"
);
break
;
break
;
case
ACPI_AC_STATUS_ONLINE
:
case
ACPI_AC_STATUS_ONLINE
:
p
+=
sprintf
(
p
,
"on-line
\n
"
);
seq_puts
(
seq
,
"on-line
\n
"
);
break
;
break
;
default:
default:
p
+=
sprintf
(
p
,
"unknown
\n
"
);
seq_puts
(
seq
,
"unknown
\n
"
);
break
;
break
;
}
}
end:
return
0
;
len
=
(
p
-
page
);
}
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
len
-=
off
;
{
if
(
len
>
count
)
len
=
count
;
return
single_open
(
file
,
acpi_ac_seq_show
,
PDE
(
inode
)
->
data
);
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
static
int
acpi_ac_add_fs
(
acpi_ac_add_fs
(
...
@@ -174,7 +169,7 @@ acpi_ac_add_fs (
...
@@ -174,7 +169,7 @@ acpi_ac_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_AC_FILE_STATE
));
ACPI_AC_FILE_STATE
));
else
{
else
{
entry
->
read_proc
=
acpi_ac_read_state
;
entry
->
proc_fops
=
&
acpi_ac_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/button.c
View file @
61bc79b5
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
...
@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
int
acpi_button_add
(
struct
acpi_device
*
device
);
int
acpi_button_add
(
struct
acpi_device
*
device
);
int
acpi_button_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_button_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_button_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_button_driver
=
{
static
struct
acpi_driver
acpi_button_driver
=
{
.
name
=
ACPI_BUTTON_DRIVER_NAME
,
.
name
=
ACPI_BUTTON_DRIVER_NAME
,
...
@@ -87,6 +89,12 @@ struct acpi_button {
...
@@ -87,6 +89,12 @@ struct acpi_button {
unsigned
long
pushed
;
unsigned
long
pushed
;
};
};
static
struct
file_operations
acpi_button_fops
=
{
.
open
=
acpi_button_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
FS Interface (/proc)
FS Interface (/proc)
...
@@ -94,39 +102,26 @@ struct acpi_button {
...
@@ -94,39 +102,26 @@ struct acpi_button {
static
struct
proc_dir_entry
*
acpi_button_dir
=
NULL
;
static
struct
proc_dir_entry
*
acpi_button_dir
=
NULL
;
static
int
static
int
acpi_button_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
acpi_button_read_info
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_button
*
button
=
(
struct
acpi_button
*
)
data
;
struct
acpi_button
*
button
=
(
struct
acpi_button
*
)
seq
->
private
;
char
*
p
=
page
;
int
len
=
0
;
ACPI_FUNCTION_TRACE
(
"acpi_button_
read_info
"
);
ACPI_FUNCTION_TRACE
(
"acpi_button_
seq_show
"
);
if
(
!
button
||
!
button
->
device
)
if
(
!
button
||
!
button
->
device
)
goto
end
;
return
0
;
p
+=
sprintf
(
p
,
"type: %s
\n
"
,
seq_printf
(
seq
,
"type: %s
\n
"
,
acpi_device_name
(
button
->
device
));
acpi_device_name
(
button
->
device
));
end:
return
0
;
len
=
(
p
-
page
);
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_button_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_button_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_button_add_fs
(
acpi_button_add_fs
(
struct
acpi_device
*
device
)
struct
acpi_device
*
device
)
...
@@ -170,7 +165,7 @@ acpi_button_add_fs (
...
@@ -170,7 +165,7 @@ acpi_button_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_BUTTON_FILE_INFO
));
ACPI_BUTTON_FILE_INFO
));
else
{
else
{
entry
->
read_proc
=
acpi_button_read_info
;
entry
->
proc_fops
=
&
acpi_button_fops
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/power.c
View file @
61bc79b5
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_bus.h"
#include "acpi_drivers.h"
#include "acpi_drivers.h"
...
@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
...
@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
int
acpi_power_add
(
struct
acpi_device
*
device
);
int
acpi_power_add
(
struct
acpi_device
*
device
);
int
acpi_power_remove
(
struct
acpi_device
*
device
,
int
type
);
int
acpi_power_remove
(
struct
acpi_device
*
device
,
int
type
);
static
int
acpi_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
acpi_driver
acpi_power_driver
=
{
static
struct
acpi_driver
acpi_power_driver
=
{
.
name
=
ACPI_POWER_DRIVER_NAME
,
.
name
=
ACPI_POWER_DRIVER_NAME
,
...
@@ -71,6 +73,12 @@ struct acpi_power_resource
...
@@ -71,6 +73,12 @@ struct acpi_power_resource
static
struct
list_head
acpi_power_resource_list
;
static
struct
list_head
acpi_power_resource_list
;
static
struct
file_operations
acpi_power_fops
=
{
.
open
=
acpi_power_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
Power Resource Management
Power Resource Management
...
@@ -379,58 +387,45 @@ acpi_power_transition (
...
@@ -379,58 +387,45 @@ acpi_power_transition (
struct
proc_dir_entry
*
acpi_power_dir
=
NULL
;
struct
proc_dir_entry
*
acpi_power_dir
=
NULL
;
static
int
acpi_power_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_power_read_status
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
struct
acpi_power_resource
*
resource
=
NULL
;
struct
acpi_power_resource
*
resource
=
NULL
;
char
*
p
=
page
;
int
len
;
ACPI_FUNCTION_TRACE
(
"acpi_power_
read_status
"
);
ACPI_FUNCTION_TRACE
(
"acpi_power_
seq_show
"
);
if
(
!
data
||
(
off
!=
0
))
resource
=
(
struct
acpi_power_resource
*
)
seq
->
private
;
goto
end
;
resource
=
(
struct
acpi_power_resource
*
)
data
;
if
(
!
resource
)
goto
end
;
p
+=
sprintf
(
p
,
"state: "
);
seq_puts
(
seq
,
"state: "
);
switch
(
resource
->
state
)
{
switch
(
resource
->
state
)
{
case
ACPI_POWER_RESOURCE_STATE_ON
:
case
ACPI_POWER_RESOURCE_STATE_ON
:
p
+=
sprintf
(
p
,
"on
\n
"
);
seq_puts
(
seq
,
"on
\n
"
);
break
;
break
;
case
ACPI_POWER_RESOURCE_STATE_OFF
:
case
ACPI_POWER_RESOURCE_STATE_OFF
:
p
+=
sprintf
(
p
,
"off
\n
"
);
seq_puts
(
seq
,
"off
\n
"
);
break
;
break
;
default:
default:
p
+=
sprintf
(
p
,
"unknown
\n
"
);
seq_puts
(
seq
,
"unknown
\n
"
);
break
;
break
;
}
}
p
+=
sprintf
(
p
,
"system level: S%d
\n
"
,
seq_printf
(
seq
,
"system level: S%d
\n
"
resource
->
system_level
);
"order: %d
\n
"
p
+=
sprintf
(
p
,
"order:
%d
\n
"
,
"reference count:
%d
\n
"
,
resource
->
order
);
resource
->
system_level
,
p
+=
sprintf
(
p
,
"reference count: %d
\n
"
,
resource
->
order
,
resource
->
references
);
resource
->
references
);
end:
end:
len
=
(
p
-
page
);
return
0
;
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return_VALUE
(
len
);
}
}
static
int
acpi_power_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_power_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_power_add_fs
(
acpi_power_add_fs
(
...
@@ -458,7 +453,7 @@ acpi_power_add_fs (
...
@@ -458,7 +453,7 @@ acpi_power_add_fs (
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_POWER_FILE_STATUS
));
ACPI_POWER_FILE_STATUS
));
else
{
else
{
entry
->
read_proc
=
acpi_power_read_statu
s
;
entry
->
proc_fops
=
&
acpi_power_fop
s
;
entry
->
data
=
acpi_driver_data
(
device
);
entry
->
data
=
acpi_driver_data
(
device
);
}
}
...
...
drivers/acpi/processor.c
View file @
61bc79b5
This diff is collapsed.
Click to expand it.
drivers/acpi/sleep.c
View file @
61bc79b5
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
#include <asm/acpi.h>
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
static
int
acpi_system_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
struct
file_operations
acpi_system_sleep_fops
=
{
.
open
=
acpi_system_sleep_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_system_alarm_fops
=
{
.
open
=
acpi_system_alarm_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
void
static
void
acpi_power_off
(
void
)
acpi_power_off
(
void
)
{
{
...
@@ -271,43 +289,26 @@ acpi_suspend (
...
@@ -271,43 +289,26 @@ acpi_suspend (
return
status
;
return
status
;
}
}
static
int
acpi_system_sleep_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_sleep
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
char
*
p
=
page
;
int
size
;
int
i
;
int
i
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_sleep"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_sleep_seq_show"
);
if
(
off
!=
0
)
goto
end
;
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
if
(
sleep_states
[
i
])
if
(
sleep_states
[
i
])
p
+=
sprintf
(
p
,
"S%d "
,
i
);
seq_printf
(
seq
,
"S%d "
,
i
);
}
}
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
end:
return
0
;
size
=
(
p
-
page
);
if
(
size
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
size
-=
off
;
if
(
size
>
count
)
size
=
count
;
if
(
size
<
0
)
size
=
0
;
return_VALUE
(
size
);
}
}
static
int
acpi_system_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_system_sleep_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_system_write_sleep
(
acpi_system_write_sleep
(
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
return_VALUE
(
count
);
return_VALUE
(
count
);
}
}
static
int
acpi_system_alarm_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_alarm
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
int
size
=
0
;
u32
sec
,
min
,
hr
;
u32
sec
,
min
,
hr
;
u32
day
,
mo
,
yr
;
u32
day
,
mo
,
yr
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_alarm"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_alarm_seq_show"
);
if
(
off
!=
0
)
goto
end
;
spin_lock
(
&
rtc_lock
);
spin_lock
(
&
rtc_lock
);
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
yr
+=
2000
;
yr
+=
2000
;
#endif
#endif
p
+=
sprintf
(
p
,
"%4.4u-"
,
yr
);
seq_printf
(
seq
,
"%4.4u-"
,
yr
);
p
+=
(
mo
>
12
)
?
sprintf
(
p
,
"**-"
)
:
sprintf
(
p
,
"%2.2u-"
,
mo
);
(
mo
>
12
)
?
seq_puts
(
seq
,
"**-"
)
:
seq_printf
(
seq
,
"%2.2u-"
,
mo
);
p
+=
(
day
>
31
)
?
sprintf
(
p
,
"** "
)
:
sprintf
(
p
,
"%2.2u "
,
day
);
(
day
>
31
)
?
seq_puts
(
seq
,
"** "
)
:
seq_printf
(
seq
,
"%2.2u "
,
day
);
p
+=
(
hr
>
23
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
hr
);
(
hr
>
23
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
hr
);
p
+=
(
min
>
59
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
min
);
(
min
>
59
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
min
);
p
+=
(
sec
>
59
)
?
sprintf
(
p
,
"**
\n
"
)
:
sprintf
(
p
,
"%2.2u
\n
"
,
sec
);
(
sec
>
59
)
?
seq_puts
(
seq
,
"**
\n
"
)
:
seq_printf
(
seq
,
"%2.2u
\n
"
,
sec
);
end:
return
0
;
size
=
p
-
page
;
}
if
(
size
<
count
)
*
eof
=
1
;
else
if
(
size
>
count
)
size
=
count
;
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
if
(
size
<
0
)
size
=
0
;
{
*
start
=
page
;
return
single_open
(
file
,
acpi_system_alarm_seq_show
,
PDE
(
inode
)
->
data
);
return_VALUE
(
size
);
}
}
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_SLEEP
));
ACPI_SYSTEM_FILE_SLEEP
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_sleep
;
entry
->
proc_fops
=
&
acpi_system_sleep_fops
;
entry
->
write_proc
=
acpi_system_write_sleep
;
entry
->
write_proc
=
acpi_system_write_sleep
;
}
}
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_ALARM
));
ACPI_SYSTEM_FILE_ALARM
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_alarm
;
entry
->
proc_fops
=
&
acpi_system_alarm_fops
;
entry
->
write_proc
=
acpi_system_write_alarm
;
entry
->
write_proc
=
acpi_system_write_alarm
;
}
}
...
...
drivers/acpi/thermal.c
View file @
61bc79b5
This diff is collapsed.
Click to expand it.
drivers/acpi/toshiba_acpi.c
View file @
61bc79b5
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/version.h>
#include <linux/version.h>
#include <acconfig.h>
#include <acconfig.h>
...
@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
...
@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
#define HCI_VIDEO_OUT_CRT 0x2
#define HCI_VIDEO_OUT_CRT 0x2
#define HCI_VIDEO_OUT_TV 0x4
#define HCI_VIDEO_OUT_TV 0x4
static
int
toshiba_lcd_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_video_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_fan_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_keys_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
toshiba_version_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
struct
file_operations
toshiba_lcd_fops
=
{
.
open
=
toshiba_lcd_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_video_fops
=
{
.
open
=
toshiba_video_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_fan_fops
=
{
.
open
=
toshiba_fan_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_keys_fops
=
{
.
open
=
toshiba_keys_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
toshiba_version_fops
=
{
.
open
=
toshiba_version_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
/* utility
/* utility
*/
*/
...
@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
...
@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
return
result
;
return
result
;
}
}
/* This is the common code at the end of every proc read handler. I don't
* understand it yet.
*/
static
int
end_proc_read
(
const
char
*
p
,
char
*
page
,
off_t
off
,
int
count
,
char
**
start
,
int
*
eof
)
{
int
len
=
(
p
-
page
);
if
(
len
<=
off
+
count
)
*
eof
=
1
;
*
start
=
page
+
off
;
len
-=
off
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
/* acpi interface wrappers
/* acpi interface wrappers
*/
*/
...
@@ -259,29 +285,27 @@ static int key_event_valid;
...
@@ -259,29 +285,27 @@ static int key_event_valid;
/* proc file handlers
/* proc file handlers
*/
*/
static
int
static
int
toshiba_lcd_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_lcd
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_LCD_BRIGHTNESS
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_LCD_BRIGHTNESS
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
value
=
value
>>
HCI_LCD_BRIGHTNESS_SHIFT
;
value
=
value
>>
HCI_LCD_BRIGHTNESS_SHIFT
;
p
+=
sprintf
(
p
,
"brightness: %d
\n
"
,
value
);
seq_printf
(
seq
,
"brightness: %d
\n
"
p
+=
sprintf
(
p
,
"brightness_levels: %d
\n
"
,
"brightness_levels: %d
\n
"
,
HCI_LCD_BRIGHTNESS_LEVELS
);
value
,
}
else
{
HCI_LCD_BRIGHTNESS_LEVELS
);
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
}
else
goto
end
;
seq_puts
(
seq
,
"ERROR
\n
"
);
}
return
0
;
}
end:
static
int
toshiba_lcd_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_lcd_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
...
@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_video_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_video
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_VIDEO_OUT
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_VIDEO_OUT
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
int
is_lcd
=
(
value
&
HCI_VIDEO_OUT_LCD
)
?
1
:
0
;
int
is_lcd
=
(
value
&
HCI_VIDEO_OUT_LCD
)
?
1
:
0
;
int
is_crt
=
(
value
&
HCI_VIDEO_OUT_CRT
)
?
1
:
0
;
int
is_crt
=
(
value
&
HCI_VIDEO_OUT_CRT
)
?
1
:
0
;
int
is_tv
=
(
value
&
HCI_VIDEO_OUT_TV
)
?
1
:
0
;
int
is_tv
=
(
value
&
HCI_VIDEO_OUT_TV
)
?
1
:
0
;
p
+=
sprintf
(
p
,
"lcd_out: %d
\n
"
,
is_lcd
);
seq_printf
(
seq
,
"lcd_out: %d
\n
"
p
+=
sprintf
(
p
,
"crt_out: %d
\n
"
,
is_crt
);
"crt_out: %d
\n
"
p
+=
sprintf
(
p
,
"tv_out: %d
\n
"
,
is_tv
);
"tv_out: %d
\n
"
,
}
else
{
is_lcd
,
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
is_crt
,
goto
end
;
is_tv
);
}
}
else
seq_puts
(
seq
,
"ERROR
\n
"
);
return
0
;
}
end:
static
int
toshiba_video_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_video_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
...
@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_fan_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_fan
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
hci_read1
(
HCI_FAN
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_FAN
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
p
+=
sprintf
(
p
,
"running: %d
\n
"
,
(
value
>
0
));
seq_printf
(
seq
,
"running: %d
\n
"
p
+=
sprintf
(
p
,
"force_on: %d
\n
"
,
force_fan
);
"force_on: %d
\n
"
,
}
else
{
(
value
>
0
),
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
force_fan
);
goto
end
;
}
else
}
seq_puts
(
seq
,
"ERROR
\n
"
);
return
0
;
}
end:
static
int
toshiba_fan_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_fan_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
...
@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_keys_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_keys
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
u32
hci_result
;
u32
hci_result
;
u32
value
;
u32
value
;
if
(
off
!=
0
)
goto
end
;
if
(
!
key_event_valid
)
{
if
(
!
key_event_valid
)
{
hci_read1
(
HCI_SYSTEM_EVENT
,
&
value
,
&
hci_result
);
hci_read1
(
HCI_SYSTEM_EVENT
,
&
value
,
&
hci_result
);
if
(
hci_result
==
HCI_SUCCESS
)
{
if
(
hci_result
==
HCI_SUCCESS
)
{
...
@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
...
@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
}
else
if
(
hci_result
==
HCI_EMPTY
)
{
}
else
if
(
hci_result
==
HCI_EMPTY
)
{
/* better luck next time */
/* better luck next time */
}
else
{
}
else
{
p
+=
sprintf
(
p
,
"ERROR
\n
"
);
seq_puts
(
seq
,
"ERROR
\n
"
);
goto
end
;
goto
end
;
}
}
}
}
p
+=
sprintf
(
p
,
"hotkey_ready: %d
\n
"
,
key_event_valid
);
seq_printf
(
seq
,
"hotkey_ready: %d
\n
"
p
+=
sprintf
(
p
,
"hotkey: 0x%04x
\n
"
,
last_key_event
);
"hotkey: 0x%04x
\n
"
,
key_event_valid
,
last_key_event
);
end:
end:
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
return
0
;
}
static
int
toshiba_keys_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
toshiba_keys_seq_show
,
NULL
);
}
}
static
int
static
int
...
@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
...
@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
return
count
;
return
count
;
}
}
static
int
static
int
toshiba_version_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
proc_read_version
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
seq_printf
(
seq
,
"driver: %s
\n
"
"proc_interface: %d
\n
"
,
if
(
off
!=
0
)
goto
end
;
TOSHIBA_ACPI_VERSION
,
PROC_INTERFACE_VERSION
);
p
+=
sprintf
(
p
,
"driver: %s
\n
"
,
TOSHIBA_ACPI_VERSION
);
return
0
;
p
+=
sprintf
(
p
,
"proc_interface: %d
\n
"
,
}
PROC_INTERFACE_VERSION
);
end:
static
int
toshiba_version_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
return
end_proc_read
(
p
,
page
,
off
,
count
,
start
,
eof
);
{
return
single_open
(
file
,
toshiba_version_seq_show
,
NULL
);
}
}
/* proc and module init
/* proc and module init
...
@@ -490,24 +514,38 @@ add_device(void)
...
@@ -490,24 +514,38 @@ add_device(void)
{
{
struct
proc_dir_entry
*
proc
;
struct
proc_dir_entry
*
proc
;
proc
=
create_proc_read_entry
(
PROC_LCD
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_LCD
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_lcd
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_lcd
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_lcd_fops
;
proc
->
write_proc
=
proc_write_lcd
;
}
proc
=
create_proc_read_entry
(
PROC_VIDEO
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_VIDEO
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_video
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_video
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_video_fops
;
proc
->
write_proc
=
proc_write_video
;
}
proc
=
create_proc_read_entry
(
PROC_FAN
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_FAN
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_fan
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_fan
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_fan_fops
;
proc
->
write_proc
=
proc_write_fan
;
}
proc
=
create_proc_read_entry
(
PROC_KEYS
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_KEYS
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_keys
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
write_proc
=
proc_write_keys
;
if
(
proc
)
{
proc
->
proc_fops
=
&
toshiba_keys_fops
;
proc
->
write_proc
=
proc_write_keys
;
}
proc
=
create_proc_read_entry
(
PROC_VERSION
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
proc
=
create_proc_entry
(
PROC_VERSION
,
S_IFREG
|
S_IRUGO
|
S_IWUSR
,
toshiba_proc_dir
,
proc_read_version
,
0
);
toshiba_proc_dir
);
if
(
proc
)
proc
->
proc_fops
=
&
toshiba_version_fops
;
return
(
AE_OK
);
return
(
AE_OK
);
}
}
...
...
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