Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
aa85704c
Commit
aa85704c
authored
Aug 29, 2009
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'battery' into test
parents
82d91e2c
bc76f90b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
drivers/acpi/battery.c
drivers/acpi/battery.c
+20
-0
No files found.
drivers/acpi/battery.c
View file @
aa85704c
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/jiffies.h>
#include <linux/jiffies.h>
#include <linux/async.h>
#include <linux/async.h>
#include <linux/dmi.h>
#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
...
@@ -87,6 +88,10 @@ static const struct acpi_device_id battery_device_ids[] = {
...
@@ -87,6 +88,10 @@ static const struct acpi_device_id battery_device_ids[] = {
MODULE_DEVICE_TABLE
(
acpi
,
battery_device_ids
);
MODULE_DEVICE_TABLE
(
acpi
,
battery_device_ids
);
/* For buggy DSDTs that report negative 16-bit values for either charging
* or discharging current and/or report 0 as 65536 due to bad math.
*/
#define QUIRK_SIGNED16_CURRENT 0x0001
struct
acpi_battery
{
struct
acpi_battery
{
struct
mutex
lock
;
struct
mutex
lock
;
...
@@ -114,6 +119,7 @@ struct acpi_battery {
...
@@ -114,6 +119,7 @@ struct acpi_battery {
int
state
;
int
state
;
int
power_unit
;
int
power_unit
;
u8
alarm_present
;
u8
alarm_present
;
long
quirks
;
};
};
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
...
@@ -392,6 +398,11 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
...
@@ -392,6 +398,11 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
state_offsets
,
ARRAY_SIZE
(
state_offsets
));
state_offsets
,
ARRAY_SIZE
(
state_offsets
));
battery
->
update_time
=
jiffies
;
battery
->
update_time
=
jiffies
;
kfree
(
buffer
.
pointer
);
kfree
(
buffer
.
pointer
);
if
((
battery
->
quirks
&
QUIRK_SIGNED16_CURRENT
)
&&
battery
->
rate_now
!=
-
1
)
battery
->
rate_now
=
abs
((
s16
)
battery
->
rate_now
);
return
result
;
return
result
;
}
}
...
@@ -497,6 +508,14 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
...
@@ -497,6 +508,14 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
}
}
#endif
#endif
static
void
acpi_battery_quirks
(
struct
acpi_battery
*
battery
)
{
battery
->
quirks
=
0
;
if
(
dmi_name_in_vendors
(
"Acer"
)
&&
battery
->
power_unit
)
{
battery
->
quirks
|=
QUIRK_SIGNED16_CURRENT
;
}
}
static
int
acpi_battery_update
(
struct
acpi_battery
*
battery
)
static
int
acpi_battery_update
(
struct
acpi_battery
*
battery
)
{
{
int
result
,
old_present
=
acpi_battery_present
(
battery
);
int
result
,
old_present
=
acpi_battery_present
(
battery
);
...
@@ -515,6 +534,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
...
@@ -515,6 +534,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
result
=
acpi_battery_get_info
(
battery
);
result
=
acpi_battery_get_info
(
battery
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
acpi_battery_quirks
(
battery
);
acpi_battery_init_alarm
(
battery
);
acpi_battery_init_alarm
(
battery
);
}
}
#ifdef CONFIG_ACPI_SYSFS_POWER
#ifdef CONFIG_ACPI_SYSFS_POWER
...
...
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