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
Kirill Smelkov
linux
Commits
6b7dff88
Commit
6b7dff88
authored
Dec 08, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: battery-gb.c: add new functions from Greybus spec document.
Signed-off-by:
Greg Kroah-Hartman
<
greg@kroah.com
>
parent
82b5e3fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
drivers/staging/greybus/battery-gb.c
drivers/staging/greybus/battery-gb.c
+8
-4
No files found.
drivers/staging/greybus/battery-gb.c
View file @
6b7dff88
...
...
@@ -35,9 +35,12 @@ struct gb_battery {
#define GB_BATTERY_TYPE_TECHNOLOGY 0x02
#define GB_BATTERY_TYPE_STATUS 0x03
#define GB_BATTERY_TYPE_MAX_VOLTAGE 0x04
#define GB_BATTERY_TYPE_
CAPACITY
0x05
#define GB_BATTERY_TYPE_
PERCENT_CAPACITY
0x05
#define GB_BATTERY_TYPE_TEMPERATURE 0x06
#define GB_BATTERY_TYPE_VOLTAGE 0x07
#define GB_BATTERY_TYPE_CURRENT 0x08
#define GB_BATTERY_TYPE_CAPACITY 0x09 // TODO - POWER_SUPPLY_PROP_CURRENT_MAX
#define GB_BATTERY_TYPE_SHUTDOWN_TEMP 0x0a // TODO - POWER_SUPPLY_PROP_TEMP_ALERT_MAX
struct
gb_battery_proto_version_response
{
__u8
major
;
...
...
@@ -211,13 +214,14 @@ static int get_max_voltage(struct gb_battery *gb)
return
max_voltage
;
}
static
int
get_capacity
(
struct
gb_battery
*
gb
)
static
int
get_
percent_
capacity
(
struct
gb_battery
*
gb
)
{
struct
gb_battery_capacity_response
capacity_response
;
u32
capacity
;
int
retval
;
retval
=
gb_operation_sync
(
gb
->
connection
,
GB_BATTERY_TYPE_CAPACITY
,
retval
=
gb_operation_sync
(
gb
->
connection
,
GB_BATTERY_TYPE_PERCENT_CAPACITY
,
NULL
,
0
,
&
capacity_response
,
sizeof
(
capacity_response
));
if
(
retval
)
...
...
@@ -279,7 +283,7 @@ static int get_property(struct power_supply *b,
break
;
case
POWER_SUPPLY_PROP_CAPACITY
:
val
->
intval
=
get_capacity
(
gb
);
val
->
intval
=
get_
percent_
capacity
(
gb
);
break
;
case
POWER_SUPPLY_PROP_TEMP
:
...
...
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