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
2bb7eae8
Commit
2bb7eae8
authored
Oct 20, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: battery: some hooking up to the greybus core
Signed-off-by:
Greg Kroah-Hartman
<
greg@kroah.com
>
parent
47ee0d13
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
7 deletions
+15
-7
drivers/staging/greybus/battery-gb.c
drivers/staging/greybus/battery-gb.c
+8
-5
drivers/staging/greybus/connection.c
drivers/staging/greybus/connection.c
+4
-2
drivers/staging/greybus/greybus.h
drivers/staging/greybus/greybus.h
+1
-0
drivers/staging/greybus/greybus_manifest.h
drivers/staging/greybus/greybus_manifest.h
+1
-0
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.c
+1
-0
No files found.
drivers/staging/greybus/battery-gb.c
View file @
2bb7eae8
...
@@ -18,7 +18,10 @@ struct gb_battery {
...
@@ -18,7 +18,10 @@ struct gb_battery {
// we will want to keep the battery stats in here as we will be getting
// we will want to keep the battery stats in here as we will be getting
// updates from the SVC "on the fly" so we don't have to always go ask
// updates from the SVC "on the fly" so we don't have to always go ask
// the battery for some information. Hopefully...
// the battery for some information. Hopefully...
struct
gb_module
*
gmod
;
struct
gb_connection
*
connection
;
u8
version_major
;
u8
version_minor
;
};
};
#define to_gb_battery(x) container_of(x, struct gb_battery, bat)
#define to_gb_battery(x) container_of(x, struct gb_battery, bat)
...
@@ -111,8 +114,7 @@ static enum power_supply_property battery_props[] = {
...
@@ -111,8 +114,7 @@ static enum power_supply_property battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW
,
POWER_SUPPLY_PROP_VOLTAGE_NOW
,
};
};
int
gb_battery_probe
(
struct
gb_module
*
gmod
,
int
gb_battery_device_init
(
struct
gb_connection
*
connection
)
const
struct
greybus_module_id
*
id
)
{
{
struct
gb_battery
*
gb
;
struct
gb_battery
*
gb
;
struct
power_supply
*
b
;
struct
power_supply
*
b
;
...
@@ -122,6 +124,8 @@ int gb_battery_probe(struct gb_module *gmod,
...
@@ -122,6 +124,8 @@ int gb_battery_probe(struct gb_module *gmod,
if
(
!
gb
)
if
(
!
gb
)
return
-
ENOMEM
;
return
-
ENOMEM
;
gb
->
connection
=
connection
;
// FIXME refcount!
b
=
&
gb
->
bat
;
b
=
&
gb
->
bat
;
// FIXME - get a better (i.e. unique) name
// FIXME - get a better (i.e. unique) name
// FIXME - anything else needs to be set?
// FIXME - anything else needs to be set?
...
@@ -131,12 +135,11 @@ int gb_battery_probe(struct gb_module *gmod,
...
@@ -131,12 +135,11 @@ int gb_battery_probe(struct gb_module *gmod,
b
->
num_properties
=
ARRAY_SIZE
(
battery_props
),
b
->
num_properties
=
ARRAY_SIZE
(
battery_props
),
b
->
get_property
=
get_property
,
b
->
get_property
=
get_property
,
retval
=
power_supply_register
(
&
gmod
->
dev
,
b
);
retval
=
power_supply_register
(
&
connection
->
interface
->
gmod
->
dev
,
b
);
if
(
retval
)
{
if
(
retval
)
{
kfree
(
gb
);
kfree
(
gb
);
return
retval
;
return
retval
;
}
}
gmod
->
gb_battery
=
gb
;
return
0
;
return
0
;
}
}
...
...
drivers/staging/greybus/connection.c
View file @
2bb7eae8
...
@@ -203,10 +203,12 @@ int gb_connection_init(struct gb_connection *connection)
...
@@ -203,10 +203,12 @@ int gb_connection_init(struct gb_connection *connection)
switch
(
connection
->
protocol
)
{
switch
(
connection
->
protocol
)
{
case
GREYBUS_PROTOCOL_I2C
:
case
GREYBUS_PROTOCOL_I2C
:
return
gb_i2c_device_init
(
connection
);
return
gb_i2c_device_init
(
connection
);
case
GREYBUS_PROTOCOL_CONTROL
:
case
GREYBUS_PROTOCOL_AP
:
case
GREYBUS_PROTOCOL_GPIO
:
case
GREYBUS_PROTOCOL_GPIO
:
return
gb_gpio_controller_init
(
connection
);
return
gb_gpio_controller_init
(
connection
);
case
GREYBUS_PROTOCOL_BATTERY
:
return
gb_battery_device_init
(
connection
);
case
GREYBUS_PROTOCOL_CONTROL
:
case
GREYBUS_PROTOCOL_AP
:
case
GREYBUS_PROTOCOL_UART
:
case
GREYBUS_PROTOCOL_UART
:
case
GREYBUS_PROTOCOL_HID
:
case
GREYBUS_PROTOCOL_HID
:
case
GREYBUS_PROTOCOL_VENDOR
:
case
GREYBUS_PROTOCOL_VENDOR
:
...
...
drivers/staging/greybus/greybus.h
View file @
2bb7eae8
...
@@ -265,6 +265,7 @@ void gb_deregister_cport_complete(u16 cport_id);
...
@@ -265,6 +265,7 @@ void gb_deregister_cport_complete(u16 cport_id);
extern
const
struct
attribute_group
*
greybus_module_groups
[];
extern
const
struct
attribute_group
*
greybus_module_groups
[];
int
gb_i2c_device_init
(
struct
gb_connection
*
connection
);
int
gb_i2c_device_init
(
struct
gb_connection
*
connection
);
int
gb_battery_device_init
(
struct
gb_connection
*
connection
);
int
gb_gpio_controller_init
(
struct
gb_connection
*
connection
);
int
gb_gpio_controller_init
(
struct
gb_connection
*
connection
);
int
gb_tty_init
(
void
);
int
gb_tty_init
(
void
);
...
...
drivers/staging/greybus/greybus_manifest.h
View file @
2bb7eae8
...
@@ -30,6 +30,7 @@ enum greybus_protocol {
...
@@ -30,6 +30,7 @@ enum greybus_protocol {
GREYBUS_PROTOCOL_I2C
=
0x03
,
GREYBUS_PROTOCOL_I2C
=
0x03
,
GREYBUS_PROTOCOL_UART
=
0x04
,
GREYBUS_PROTOCOL_UART
=
0x04
,
GREYBUS_PROTOCOL_HID
=
0x05
,
GREYBUS_PROTOCOL_HID
=
0x05
,
GREYBUS_PROTOCOL_BATTERY
=
0x08
,
/* ... */
/* ... */
GREYBUS_PROTOCOL_VENDOR
=
0xff
,
GREYBUS_PROTOCOL_VENDOR
=
0xff
,
};
};
...
...
drivers/staging/greybus/operation.c
View file @
2bb7eae8
...
@@ -165,6 +165,7 @@ static gb_operation_recv_handler gb_operation_recv_handlers[] = {
...
@@ -165,6 +165,7 @@ static gb_operation_recv_handler gb_operation_recv_handlers[] = {
[
GREYBUS_PROTOCOL_I2C
]
=
gb_operation_recv_none
,
[
GREYBUS_PROTOCOL_I2C
]
=
gb_operation_recv_none
,
[
GREYBUS_PROTOCOL_UART
]
=
NULL
,
[
GREYBUS_PROTOCOL_UART
]
=
NULL
,
[
GREYBUS_PROTOCOL_HID
]
=
NULL
,
[
GREYBUS_PROTOCOL_HID
]
=
NULL
,
[
GREYBUS_PROTOCOL_BATTERY
]
=
gb_operation_recv_none
,
[
GREYBUS_PROTOCOL_VENDOR
]
=
NULL
,
[
GREYBUS_PROTOCOL_VENDOR
]
=
NULL
,
};
};
...
...
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