blob: f9a60daf9a72e7d0bbd6e356fd64a48bb0d3730f [file] [log] [blame]
Viresh Kumarcdee4f72015-06-22 16:42:26 +05301/*
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
13struct gb_control {
Johan Hovolda6e5b012016-04-13 19:19:02 +020014 struct device dev;
15 struct gb_interface *intf;
16
17 struct gb_connection *connection;
Johan Hovolde217ae72016-01-19 12:51:14 +010018
19 u8 protocol_major;
20 u8 protocol_minor;
Johan Hovoldb807aa72016-01-19 12:51:21 +010021
Johan Hovold23580242016-07-21 14:24:11 +020022 bool has_bundle_activate;
Johan Hovoldb807aa72016-01-19 12:51:21 +010023 bool has_bundle_version;
Johan Hovold7c8eb122016-04-13 19:19:04 +020024
25 char *vendor_string;
26 char *product_string;
Viresh Kumarcdee4f72015-06-22 16:42:26 +053027};
Johan Hovolda6e5b012016-04-13 19:19:02 +020028#define to_gb_control(d) container_of(d, struct gb_control, dev)
Viresh Kumarcdee4f72015-06-22 16:42:26 +053029
Johan Hovoldc6346502015-12-15 15:28:56 +010030struct gb_control *gb_control_create(struct gb_interface *intf);
31int gb_control_enable(struct gb_control *control);
32void gb_control_disable(struct gb_control *control);
David Lin707a5c42016-07-07 22:07:00 -050033int gb_control_suspend(struct gb_control *control);
34int gb_control_resume(struct gb_control *control);
Johan Hovold7326e072016-04-13 19:19:03 +020035int gb_control_add(struct gb_control *control);
36void gb_control_del(struct gb_control *control);
Johan Hovold55742d22016-05-27 17:26:40 +020037struct gb_control *gb_control_get(struct gb_control *control);
Johan Hovolda6e5b012016-04-13 19:19:02 +020038void gb_control_put(struct gb_control *control);
Johan Hovoldc6346502015-12-15 15:28:56 +010039
Johan Hovoldb807aa72016-01-19 12:51:21 +010040int gb_control_get_bundle_versions(struct gb_control *control);
Viresh Kumarcdee4f72015-06-22 16:42:26 +053041int gb_control_connected_operation(struct gb_control *control, u16 cport_id);
42int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id);
Johan Hovold197616e2016-05-27 17:26:26 +020043int gb_control_disconnecting_operation(struct gb_control *control,
44 u16 cport_id);
Johan Hovold1c3aead2016-04-29 17:08:34 +020045int gb_control_mode_switch_operation(struct gb_control *control);
Johan Hovold55742d22016-05-27 17:26:40 +020046void gb_control_mode_switch_prepare(struct gb_control *control);
47void gb_control_mode_switch_complete(struct gb_control *control);
Viresh Kumarcdee4f72015-06-22 16:42:26 +053048int gb_control_get_manifest_size_operation(struct gb_interface *intf);
49int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest,
50 size_t size);
Bryan O'Donoghue8fd94662016-03-02 16:51:10 +000051int gb_control_timesync_enable(struct gb_control *control, u8 count,
52 u64 frame_time, u32 strobe_delay, u32 refclk);
53int gb_control_timesync_disable(struct gb_control *control);
Bryan O'Donoghuefa433b62016-05-12 12:43:51 +010054int gb_control_timesync_get_last_event(struct gb_control *control,
55 u64 *frame_time);
Bryan O'Donoghue8fd94662016-03-02 16:51:10 +000056int gb_control_timesync_authoritative(struct gb_control *control,
Bryan O'Donoghue123e7492016-05-12 12:43:52 +010057 u64 *frame_time);
David Lin2c8e8842016-07-07 22:07:00 -050058int gb_control_bundle_suspend(struct gb_control *control, u8 bundle_id);
59int gb_control_bundle_resume(struct gb_control *control, u8 bundle_id);
David Linf61908f2016-07-07 22:07:00 -050060int gb_control_bundle_deactivate(struct gb_control *control, u8 bundle_id);
61int gb_control_bundle_activate(struct gb_control *control, u8 bundle_id);
David Linf53be0e2016-07-07 22:07:00 -050062int gb_control_interface_suspend_prepare(struct gb_control *control);
David Lin30ea26b2016-07-07 22:07:00 -050063int gb_control_interface_deactivate_prepare(struct gb_control *control);
David Lin385227f2016-07-07 22:07:00 -050064int gb_control_interface_hibernate_abort(struct gb_control *control);
Viresh Kumarcdee4f72015-06-22 16:42:26 +053065#endif /* __CONTROL_H */