]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/greybus/svc.h
greybus: svc: fix function-parameter indentation
[karo-tx-linux.git] / drivers / staging / greybus / svc.h
1 /*
2  * Greybus SVC code
3  *
4  * Copyright 2015 Google Inc.
5  * Copyright 2015 Linaro Ltd.
6  *
7  * Released under the GPLv2 only.
8  */
9
10 #ifndef __SVC_H
11 #define __SVC_H
12
13 #define GB_SVC_CPORT_FLAG_E2EFC         BIT(0)
14 #define GB_SVC_CPORT_FLAG_CSD_N         BIT(1)
15 #define GB_SVC_CPORT_FLAG_CSV_N         BIT(2)
16
17 enum gb_svc_state {
18         GB_SVC_STATE_RESET,
19         GB_SVC_STATE_PROTOCOL_VERSION,
20         GB_SVC_STATE_SVC_HELLO,
21 };
22
23 struct gb_svc_watchdog;
24
25 struct svc_debugfs_pwrmon_rail {
26         u8 id;
27         struct gb_svc *svc;
28 };
29
30 struct gb_svc {
31         struct device           dev;
32
33         struct gb_host_device   *hd;
34         struct gb_connection    *connection;
35         enum gb_svc_state       state;
36         struct ida              device_id_map;
37         struct workqueue_struct *wq;
38
39         u16 endo_id;
40         u8 ap_intf_id;
41
42         u8 protocol_major;
43         u8 protocol_minor;
44
45         struct input_dev        *input;
46         char                    *input_phys;
47         struct gb_svc_watchdog  *watchdog;
48
49         struct dentry *debugfs_dentry;
50         struct svc_debugfs_pwrmon_rail *pwrmon_rails;
51         struct gb_svc_pwrmon_rail_names_get_response *rail_names;
52         u8 rail_count;
53 };
54 #define to_gb_svc(d) container_of(d, struct gb_svc, dev)
55
56 struct gb_svc *gb_svc_create(struct gb_host_device *hd);
57 int gb_svc_add(struct gb_svc *svc);
58 void gb_svc_del(struct gb_svc *svc);
59 void gb_svc_put(struct gb_svc *svc);
60
61 int gb_svc_pwrmon_intf_sample_get(struct gb_svc *svc, u8 intf_id,
62                                   u8 measurement_type, u32 *value);
63 int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id);
64 int gb_svc_route_create(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
65                                u8 intf2_id, u8 dev2_id);
66 void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id);
67 int gb_svc_connection_create(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
68                              u8 intf2_id, u16 cport2_id, u8 cport_flags);
69 void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
70                                u8 intf2_id, u16 cport2_id);
71 int gb_svc_intf_eject(struct gb_svc *svc, u8 intf_id);
72 int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
73                         u32 *value);
74 int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
75                         u32 value);
76 int gb_svc_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series,
77                                u8 tx_mode, u8 tx_gear, u8 tx_nlanes,
78                                u8 rx_mode, u8 rx_gear, u8 rx_nlanes,
79                                u8 flags, u32 quirks);
80 int gb_svc_ping(struct gb_svc *svc);
81 int gb_svc_watchdog_create(struct gb_svc *svc);
82 void gb_svc_watchdog_destroy(struct gb_svc *svc);
83 bool gb_svc_watchdog_enabled(struct gb_svc *svc);
84 int gb_svc_watchdog_enable(struct gb_svc *svc);
85 int gb_svc_watchdog_disable(struct gb_svc *svc);
86
87 int gb_svc_protocol_init(void);
88 void gb_svc_protocol_exit(void);
89
90 #endif /* __SVC_H */