Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Greybus CPort control protocol |
| 3 | * |
| 4 | * Copyright 2015 Google Inc. |
| 5 | * Copyright 2015 Linaro Ltd. |
| 6 | * |
| 7 | * Released under the GPLv2 only. |
| 8 | */ |
| 9 | |
| 10 | #ifndef __CONTROL_H |
| 11 | #define __CONTROL_H |
| 12 | |
| 13 | struct gb_control { |
Johan Hovold | a6e5b01 | 2016-04-13 19:19:02 +0200 | [diff] [blame] | 14 | struct device dev; |
| 15 | struct gb_interface *intf; |
| 16 | |
| 17 | struct gb_connection *connection; |
Johan Hovold | e217ae7 | 2016-01-19 12:51:14 +0100 | [diff] [blame] | 18 | |
| 19 | u8 protocol_major; |
| 20 | u8 protocol_minor; |
Johan Hovold | b807aa7 | 2016-01-19 12:51:21 +0100 | [diff] [blame] | 21 | |
Johan Hovold | 2358024 | 2016-07-21 14:24:11 +0200 | [diff] [blame^] | 22 | bool has_bundle_activate; |
Johan Hovold | b807aa7 | 2016-01-19 12:51:21 +0100 | [diff] [blame] | 23 | bool has_bundle_version; |
Johan Hovold | 7c8eb12 | 2016-04-13 19:19:04 +0200 | [diff] [blame] | 24 | |
| 25 | char *vendor_string; |
| 26 | char *product_string; |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 27 | }; |
Johan Hovold | a6e5b01 | 2016-04-13 19:19:02 +0200 | [diff] [blame] | 28 | #define to_gb_control(d) container_of(d, struct gb_control, dev) |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 29 | |
Johan Hovold | c634650 | 2015-12-15 15:28:56 +0100 | [diff] [blame] | 30 | struct gb_control *gb_control_create(struct gb_interface *intf); |
| 31 | int gb_control_enable(struct gb_control *control); |
| 32 | void gb_control_disable(struct gb_control *control); |
David Lin | 707a5c4 | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 33 | int gb_control_suspend(struct gb_control *control); |
| 34 | int gb_control_resume(struct gb_control *control); |
Johan Hovold | 7326e07 | 2016-04-13 19:19:03 +0200 | [diff] [blame] | 35 | int gb_control_add(struct gb_control *control); |
| 36 | void gb_control_del(struct gb_control *control); |
Johan Hovold | 55742d2 | 2016-05-27 17:26:40 +0200 | [diff] [blame] | 37 | struct gb_control *gb_control_get(struct gb_control *control); |
Johan Hovold | a6e5b01 | 2016-04-13 19:19:02 +0200 | [diff] [blame] | 38 | void gb_control_put(struct gb_control *control); |
Johan Hovold | c634650 | 2015-12-15 15:28:56 +0100 | [diff] [blame] | 39 | |
Johan Hovold | b807aa7 | 2016-01-19 12:51:21 +0100 | [diff] [blame] | 40 | int gb_control_get_bundle_versions(struct gb_control *control); |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 41 | int gb_control_connected_operation(struct gb_control *control, u16 cport_id); |
| 42 | int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id); |
Johan Hovold | 197616e | 2016-05-27 17:26:26 +0200 | [diff] [blame] | 43 | int gb_control_disconnecting_operation(struct gb_control *control, |
| 44 | u16 cport_id); |
Johan Hovold | 1c3aead | 2016-04-29 17:08:34 +0200 | [diff] [blame] | 45 | int gb_control_mode_switch_operation(struct gb_control *control); |
Johan Hovold | 55742d2 | 2016-05-27 17:26:40 +0200 | [diff] [blame] | 46 | void gb_control_mode_switch_prepare(struct gb_control *control); |
| 47 | void gb_control_mode_switch_complete(struct gb_control *control); |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 48 | int gb_control_get_manifest_size_operation(struct gb_interface *intf); |
| 49 | int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest, |
| 50 | size_t size); |
Bryan O'Donoghue | 8fd9466 | 2016-03-02 16:51:10 +0000 | [diff] [blame] | 51 | int gb_control_timesync_enable(struct gb_control *control, u8 count, |
| 52 | u64 frame_time, u32 strobe_delay, u32 refclk); |
| 53 | int gb_control_timesync_disable(struct gb_control *control); |
Bryan O'Donoghue | fa433b6 | 2016-05-12 12:43:51 +0100 | [diff] [blame] | 54 | int gb_control_timesync_get_last_event(struct gb_control *control, |
| 55 | u64 *frame_time); |
Bryan O'Donoghue | 8fd9466 | 2016-03-02 16:51:10 +0000 | [diff] [blame] | 56 | int gb_control_timesync_authoritative(struct gb_control *control, |
Bryan O'Donoghue | 123e749 | 2016-05-12 12:43:52 +0100 | [diff] [blame] | 57 | u64 *frame_time); |
David Lin | 2c8e884 | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 58 | int gb_control_bundle_suspend(struct gb_control *control, u8 bundle_id); |
| 59 | int gb_control_bundle_resume(struct gb_control *control, u8 bundle_id); |
David Lin | f61908f | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 60 | int gb_control_bundle_deactivate(struct gb_control *control, u8 bundle_id); |
| 61 | int gb_control_bundle_activate(struct gb_control *control, u8 bundle_id); |
David Lin | f53be0e | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 62 | int gb_control_interface_suspend_prepare(struct gb_control *control); |
David Lin | 30ea26b | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 63 | int gb_control_interface_deactivate_prepare(struct gb_control *control); |
David Lin | 385227f | 2016-07-07 22:07:00 -0500 | [diff] [blame] | 64 | int gb_control_interface_hibernate_abort(struct gb_control *control); |
Viresh Kumar | cdee4f7 | 2015-06-22 16:42:26 +0530 | [diff] [blame] | 65 | #endif /* __CONTROL_H */ |