2019-08-25 13:54:21 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2015-05-23 02:02:08 +08:00
|
|
|
/*
|
|
|
|
* Greybus SVC code
|
|
|
|
*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
* Copyright 2015 Linaro Ltd.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SVC_H
|
|
|
|
#define __SVC_H
|
|
|
|
|
staging: greybus: add missing includes
Before moving greybus core out of staging and moving header files to
include/linux some greybus header files were missing the necessary
includes. This would trigger compilation faillures with some example
errors logged bellow for with CONFIG_KERNEL_HEADER_TEST=y.
So, add the necessary headers to compile clean before relocating the
header files.
./include/linux/greybus/hd.h:23:50: error: unknown type name 'u16'
int (*cport_disable)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/greybus_protocols.h:1314:2: error: unknown type name '__u8'
__u8 data[0];
^~~~
./include/linux/greybus/hd.h:24:52: error: unknown type name 'u16'
int (*cport_connected)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:25:48: error: unknown type name 'u16'
int (*cport_flush)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:26:51: error: unknown type name 'u16'
int (*cport_shutdown)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:27:5: error: unknown type name 'u8'
u8 phase, unsigned int timeout);
^~
./include/linux/greybus/hd.h:28:50: error: unknown type name 'u16'
int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:29:5: error: unknown type name 'size_t'
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:29:5: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
./include/linux/greybus/hd.h:1:1:
+#include <stddef.h>
/* SPDX-License-Identifier: GPL-2.0 */
./include/linux/greybus/hd.h:29:5:
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:30:48: error: unknown type name 'u16'
int (*cport_clear)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:32:49: error: unknown type name 'u16'
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id, ^~~
./include/linux/greybus/hd.h:33:32: error: unknown type name 'gfp_t'
struct gb_message *message, gfp_t gfp_mask); ^~~~~
./include/linux/greybus/hd.h:35:55: error: unknown type name 'u16'
int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Gao Xiang <hsiangkao@aol.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20190827155302.25704-1-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27 23:53:02 +08:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
2019-08-28 20:48:25 +08:00
|
|
|
struct gb_svc_l2_timer_cfg;
|
|
|
|
|
2016-03-30 06:55:59 +08:00
|
|
|
#define GB_SVC_CPORT_FLAG_E2EFC BIT(0)
|
|
|
|
#define GB_SVC_CPORT_FLAG_CSD_N BIT(1)
|
|
|
|
#define GB_SVC_CPORT_FLAG_CSV_N BIT(2)
|
2016-03-03 20:34:38 +08:00
|
|
|
|
2015-11-25 22:59:08 +08:00
|
|
|
enum gb_svc_state {
|
|
|
|
GB_SVC_STATE_RESET,
|
|
|
|
GB_SVC_STATE_PROTOCOL_VERSION,
|
|
|
|
GB_SVC_STATE_SVC_HELLO,
|
|
|
|
};
|
|
|
|
|
2016-07-27 07:27:28 +08:00
|
|
|
enum gb_svc_watchdog_bite {
|
|
|
|
GB_SVC_WATCHDOG_BITE_RESET_UNIPRO = 0,
|
|
|
|
GB_SVC_WATCHDOG_BITE_PANIC_KERNEL,
|
|
|
|
};
|
|
|
|
|
2016-01-21 14:51:49 +08:00
|
|
|
struct gb_svc_watchdog;
|
|
|
|
|
2016-04-21 07:55:08 +08:00
|
|
|
struct svc_debugfs_pwrmon_rail {
|
|
|
|
u8 id;
|
|
|
|
struct gb_svc *svc;
|
|
|
|
};
|
|
|
|
|
2015-11-25 22:59:08 +08:00
|
|
|
struct gb_svc {
|
|
|
|
struct device dev;
|
|
|
|
|
2015-12-04 02:18:02 +08:00
|
|
|
struct gb_host_device *hd;
|
2015-11-25 22:59:08 +08:00
|
|
|
struct gb_connection *connection;
|
|
|
|
enum gb_svc_state state;
|
|
|
|
struct ida device_id_map;
|
2015-12-03 01:23:31 +08:00
|
|
|
struct workqueue_struct *wq;
|
2015-11-25 22:59:09 +08:00
|
|
|
|
|
|
|
u16 endo_id;
|
|
|
|
u8 ap_intf_id;
|
2016-01-19 19:51:19 +08:00
|
|
|
|
|
|
|
u8 protocol_major;
|
|
|
|
u8 protocol_minor;
|
2016-01-21 09:42:17 +08:00
|
|
|
|
2016-01-21 14:51:49 +08:00
|
|
|
struct gb_svc_watchdog *watchdog;
|
2016-07-27 07:27:28 +08:00
|
|
|
enum gb_svc_watchdog_bite action;
|
2016-04-21 07:55:08 +08:00
|
|
|
|
|
|
|
struct dentry *debugfs_dentry;
|
|
|
|
struct svc_debugfs_pwrmon_rail *pwrmon_rails;
|
2015-11-25 22:59:08 +08:00
|
|
|
};
|
2016-03-31 04:53:17 +08:00
|
|
|
#define to_gb_svc(d) container_of(d, struct gb_svc, dev)
|
2015-05-23 02:02:08 +08:00
|
|
|
|
2015-12-07 22:05:37 +08:00
|
|
|
struct gb_svc *gb_svc_create(struct gb_host_device *hd);
|
|
|
|
int gb_svc_add(struct gb_svc *svc);
|
|
|
|
void gb_svc_del(struct gb_svc *svc);
|
|
|
|
void gb_svc_put(struct gb_svc *svc);
|
|
|
|
|
2016-04-08 11:15:30 +08:00
|
|
|
int gb_svc_pwrmon_intf_sample_get(struct gb_svc *svc, u8 intf_id,
|
|
|
|
u8 measurement_type, u32 *value);
|
2016-03-30 06:56:04 +08:00
|
|
|
int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id);
|
|
|
|
int gb_svc_route_create(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
|
|
|
|
u8 intf2_id, u8 dev2_id);
|
|
|
|
void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id);
|
2015-05-23 02:02:08 +08:00
|
|
|
int gb_svc_connection_create(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
|
2016-03-03 20:34:38 +08:00
|
|
|
u8 intf2_id, u16 cport2_id, u8 cport_flags);
|
2015-08-31 19:51:05 +08:00
|
|
|
void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
|
|
|
|
u8 intf2_id, u16 cport2_id);
|
2016-01-11 21:46:31 +08:00
|
|
|
int gb_svc_intf_eject(struct gb_svc *svc, u8 intf_id);
|
2016-04-24 00:47:27 +08:00
|
|
|
int gb_svc_intf_vsys_set(struct gb_svc *svc, u8 intf_id, bool enable);
|
|
|
|
int gb_svc_intf_refclk_set(struct gb_svc *svc, u8 intf_id, bool enable);
|
|
|
|
int gb_svc_intf_unipro_set(struct gb_svc *svc, u8 intf_id, bool enable);
|
2016-04-24 00:47:28 +08:00
|
|
|
int gb_svc_intf_activate(struct gb_svc *svc, u8 intf_id, u8 *intf_type);
|
2016-07-08 11:07:00 +08:00
|
|
|
int gb_svc_intf_resume(struct gb_svc *svc, u8 intf_id);
|
|
|
|
|
2015-09-09 23:38:29 +08:00
|
|
|
int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
|
|
|
|
u32 *value);
|
|
|
|
int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
|
|
|
|
u32 value);
|
2016-01-06 22:16:46 +08:00
|
|
|
int gb_svc_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series,
|
|
|
|
u8 tx_mode, u8 tx_gear, u8 tx_nlanes,
|
2016-06-03 23:24:44 +08:00
|
|
|
u8 tx_amplitude, u8 tx_hs_equalizer,
|
2016-01-06 22:16:46 +08:00
|
|
|
u8 rx_mode, u8 rx_gear, u8 rx_nlanes,
|
2016-06-03 23:24:44 +08:00
|
|
|
u8 flags, u32 quirks,
|
|
|
|
struct gb_svc_l2_timer_cfg *local,
|
|
|
|
struct gb_svc_l2_timer_cfg *remote);
|
2016-07-08 11:07:00 +08:00
|
|
|
int gb_svc_intf_set_power_mode_hibernate(struct gb_svc *svc, u8 intf_id);
|
2016-01-20 15:30:42 +08:00
|
|
|
int gb_svc_ping(struct gb_svc *svc);
|
2016-01-21 14:51:49 +08:00
|
|
|
int gb_svc_watchdog_create(struct gb_svc *svc);
|
|
|
|
void gb_svc_watchdog_destroy(struct gb_svc *svc);
|
2016-01-27 07:17:08 +08:00
|
|
|
bool gb_svc_watchdog_enabled(struct gb_svc *svc);
|
|
|
|
int gb_svc_watchdog_enable(struct gb_svc *svc);
|
|
|
|
int gb_svc_watchdog_disable(struct gb_svc *svc);
|
2015-05-23 02:02:08 +08:00
|
|
|
|
2015-07-03 19:30:29 +08:00
|
|
|
int gb_svc_protocol_init(void);
|
|
|
|
void gb_svc_protocol_exit(void);
|
2015-07-21 20:14:18 +08:00
|
|
|
|
2015-05-23 02:02:08 +08:00
|
|
|
#endif /* __SVC_H */
|