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
6e301393
Commit
6e301393
authored
Dec 14, 2007
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Pull bugzilla-9362 into release branch
parents
5889ba0a
5a21e4fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
19 deletions
+31
-19
drivers/acpi/sbs.c
drivers/acpi/sbs.c
+12
-15
drivers/acpi/sbshc.c
drivers/acpi/sbshc.c
+13
-4
drivers/acpi/sbshc.h
drivers/acpi/sbshc.h
+6
-0
No files found.
drivers/acpi/sbs.c
View file @
6e301393
...
...
@@ -54,12 +54,6 @@
#define ACPI_BATTERY_DIR_NAME "BAT%i"
#define ACPI_AC_DIR_NAME "AC0"
enum
acpi_sbs_device_addr
{
ACPI_SBS_CHARGER
=
0x9
,
ACPI_SBS_MANAGER
=
0xa
,
ACPI_SBS_BATTERY
=
0xb
,
};
#define ACPI_SBS_NOTIFY_STATUS 0x80
#define ACPI_SBS_NOTIFY_INFO 0x81
...
...
@@ -539,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
static
inline
char
*
acpi_battery_units
(
struct
acpi_battery
*
battery
)
{
return
acpi_battery_mode
(
battery
)
?
" mW
h"
:
" mAh
"
;
return
acpi_battery_mode
(
battery
)
?
" mW
"
:
" mA
"
;
}
...
...
@@ -556,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
if
(
!
battery
->
present
)
goto
end
;
seq_printf
(
seq
,
"design capacity: %i%s
\n
"
,
seq_printf
(
seq
,
"design capacity: %i%s
h
\n
"
,
battery
->
design_capacity
*
acpi_battery_scale
(
battery
),
acpi_battery_units
(
battery
));
seq_printf
(
seq
,
"last full capacity: %i%s
\n
"
,
seq_printf
(
seq
,
"last full capacity: %i%s
h
\n
"
,
battery
->
full_charge_capacity
*
acpi_battery_scale
(
battery
),
acpi_battery_units
(
battery
));
seq_printf
(
seq
,
"battery technology: rechargeable
\n
"
);
...
...
@@ -590,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
{
struct
acpi_battery
*
battery
=
seq
->
private
;
struct
acpi_sbs
*
sbs
=
battery
->
sbs
;
int
r
esult
=
0
;
int
r
ate
;
mutex_lock
(
&
sbs
->
lock
);
seq_printf
(
seq
,
"present: %s
\n
"
,
...
...
@@ -604,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
seq_printf
(
seq
,
"charging state: %s
\n
"
,
(
battery
->
current_now
<
0
)
?
"discharging"
:
((
battery
->
current_now
>
0
)
?
"charging"
:
"charged"
));
seq_printf
(
seq
,
"present rate: %d mA
\n
"
,
abs
(
battery
->
current_now
)
*
acpi_battery_ipscale
(
battery
));
seq_printf
(
seq
,
"remaining capacity: %i%s
\n
"
,
rate
=
abs
(
battery
->
current_now
)
*
acpi_battery_ipscale
(
battery
);
rate
*=
(
acpi_battery_mode
(
battery
))
?
(
battery
->
voltage_now
*
acpi_battery_vscale
(
battery
)
/
1000
)
:
1
;
seq_printf
(
seq
,
"present rate: %d%s
\n
"
,
rate
,
acpi_battery_units
(
battery
));
seq_printf
(
seq
,
"remaining capacity: %i%sh
\n
"
,
battery
->
capacity_now
*
acpi_battery_scale
(
battery
),
acpi_battery_units
(
battery
));
seq_printf
(
seq
,
"present voltage: %i mV
\n
"
,
...
...
@@ -614,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
end:
mutex_unlock
(
&
sbs
->
lock
);
return
result
;
return
0
;
}
static
int
acpi_battery_state_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
@@ -638,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
acpi_battery_get_alarm
(
battery
);
seq_printf
(
seq
,
"alarm: "
);
if
(
battery
->
alarm_capacity
)
seq_printf
(
seq
,
"%i%s
\n
"
,
seq_printf
(
seq
,
"%i%s
h
\n
"
,
battery
->
alarm_capacity
*
acpi_battery_scale
(
battery
),
acpi_battery_units
(
battery
));
...
...
drivers/acpi/sbshc.c
View file @
6e301393
...
...
@@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc)
EXPORT_SYMBOL_GPL
(
acpi_smbus_unregister_callback
);
static
void
acpi_smbus_callback
(
void
*
context
)
static
inline
void
acpi_smbus_callback
(
void
*
context
)
{
struct
acpi_smb_hc
*
hc
=
context
;
if
(
hc
->
callback
)
hc
->
callback
(
hc
->
context
);
}
...
...
@@ -214,6 +213,7 @@ static int smbus_alarm(void *context)
{
struct
acpi_smb_hc
*
hc
=
context
;
union
acpi_smb_status
status
;
u8
address
;
if
(
smb_hc_read
(
hc
,
ACPI_SMB_STATUS
,
&
status
.
raw
))
return
0
;
/* Check if it is only a completion notify */
...
...
@@ -222,9 +222,18 @@ static int smbus_alarm(void *context)
if
(
!
status
.
fields
.
alarm
)
return
0
;
mutex_lock
(
&
hc
->
lock
);
smb_hc_read
(
hc
,
ACPI_SMB_ALARM_ADDRESS
,
&
address
);
status
.
fields
.
alarm
=
0
;
smb_hc_write
(
hc
,
ACPI_SMB_STATUS
,
status
.
raw
);
if
(
hc
->
callback
)
acpi_os_execute
(
OSL_GPE_HANDLER
,
acpi_smbus_callback
,
hc
);
/* We are only interested in events coming from known devices */
switch
(
address
>>
1
)
{
case
ACPI_SBS_CHARGER
:
case
ACPI_SBS_MANAGER
:
case
ACPI_SBS_BATTERY
:
acpi_os_execute
(
OSL_GPE_HANDLER
,
acpi_smbus_callback
,
hc
);
default:
;
}
mutex_unlock
(
&
hc
->
lock
);
return
0
;
}
...
...
drivers/acpi/sbshc.h
View file @
6e301393
...
...
@@ -16,6 +16,12 @@ enum acpi_smb_protocol {
static
const
u8
SMBUS_PEC
=
0x80
;
enum
acpi_sbs_device_addr
{
ACPI_SBS_CHARGER
=
0x9
,
ACPI_SBS_MANAGER
=
0xa
,
ACPI_SBS_BATTERY
=
0xb
,
};
typedef
void
(
*
smbus_alarm_callback
)(
void
*
context
);
extern
int
acpi_smbus_read
(
struct
acpi_smb_hc
*
hc
,
u8
protocol
,
u8
address
,
...
...
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