xref: /OK3568_Linux_fs/kernel/include/linux/greybus/control.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Greybus CPort control protocol
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright 2015 Google Inc.
6*4882a593Smuzhiyun  * Copyright 2015 Linaro Ltd.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __CONTROL_H
10*4882a593Smuzhiyun #define __CONTROL_H
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <linux/types.h>
13*4882a593Smuzhiyun #include <linux/device.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun struct gb_control {
16*4882a593Smuzhiyun 	struct device dev;
17*4882a593Smuzhiyun 	struct gb_interface *intf;
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun 	struct gb_connection *connection;
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun 	u8 protocol_major;
22*4882a593Smuzhiyun 	u8 protocol_minor;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun 	bool has_bundle_activate;
25*4882a593Smuzhiyun 	bool has_bundle_version;
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun 	char *vendor_string;
28*4882a593Smuzhiyun 	char *product_string;
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun #define to_gb_control(d) container_of(d, struct gb_control, dev)
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun struct gb_control *gb_control_create(struct gb_interface *intf);
33*4882a593Smuzhiyun int gb_control_enable(struct gb_control *control);
34*4882a593Smuzhiyun void gb_control_disable(struct gb_control *control);
35*4882a593Smuzhiyun int gb_control_suspend(struct gb_control *control);
36*4882a593Smuzhiyun int gb_control_resume(struct gb_control *control);
37*4882a593Smuzhiyun int gb_control_add(struct gb_control *control);
38*4882a593Smuzhiyun void gb_control_del(struct gb_control *control);
39*4882a593Smuzhiyun struct gb_control *gb_control_get(struct gb_control *control);
40*4882a593Smuzhiyun void gb_control_put(struct gb_control *control);
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun int gb_control_get_bundle_versions(struct gb_control *control);
43*4882a593Smuzhiyun int gb_control_connected_operation(struct gb_control *control, u16 cport_id);
44*4882a593Smuzhiyun int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id);
45*4882a593Smuzhiyun int gb_control_disconnecting_operation(struct gb_control *control,
46*4882a593Smuzhiyun 				       u16 cport_id);
47*4882a593Smuzhiyun int gb_control_mode_switch_operation(struct gb_control *control);
48*4882a593Smuzhiyun void gb_control_mode_switch_prepare(struct gb_control *control);
49*4882a593Smuzhiyun void gb_control_mode_switch_complete(struct gb_control *control);
50*4882a593Smuzhiyun int gb_control_get_manifest_size_operation(struct gb_interface *intf);
51*4882a593Smuzhiyun int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest,
52*4882a593Smuzhiyun 				      size_t size);
53*4882a593Smuzhiyun int gb_control_bundle_suspend(struct gb_control *control, u8 bundle_id);
54*4882a593Smuzhiyun int gb_control_bundle_resume(struct gb_control *control, u8 bundle_id);
55*4882a593Smuzhiyun int gb_control_bundle_deactivate(struct gb_control *control, u8 bundle_id);
56*4882a593Smuzhiyun int gb_control_bundle_activate(struct gb_control *control, u8 bundle_id);
57*4882a593Smuzhiyun int gb_control_interface_suspend_prepare(struct gb_control *control);
58*4882a593Smuzhiyun int gb_control_interface_deactivate_prepare(struct gb_control *control);
59*4882a593Smuzhiyun int gb_control_interface_hibernate_abort(struct gb_control *control);
60*4882a593Smuzhiyun #endif /* __CONTROL_H */
61