2019-08-25 07:54:21 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-10-01 21:54:11 -05:00
|
|
|
/*
|
2014-12-11 17:10:56 -05:00
|
|
|
* Greybus Interface Block code
|
2014-10-01 21:54:11 -05:00
|
|
|
*
|
|
|
|
|
* Copyright 2014 Google Inc.
|
2014-12-12 12:08:42 -06:00
|
|
|
* Copyright 2014 Linaro Ltd.
|
2014-10-01 21:54:11 -05:00
|
|
|
*/
|
|
|
|
|
|
2014-12-19 14:56:30 -08:00
|
|
|
#ifndef __INTERFACE_H
|
|
|
|
|
#define __INTERFACE_H
|
2014-10-01 21:54:11 -05:00
|
|
|
|
2019-08-27 16:53:02 +01:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
|
2016-07-20 16:40:20 +02:00
|
|
|
enum gb_interface_type {
|
|
|
|
|
GB_INTERFACE_TYPE_INVALID = 0,
|
|
|
|
|
GB_INTERFACE_TYPE_UNKNOWN,
|
|
|
|
|
GB_INTERFACE_TYPE_DUMMY,
|
|
|
|
|
GB_INTERFACE_TYPE_UNIPRO,
|
|
|
|
|
GB_INTERFACE_TYPE_GREYBUS,
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-29 18:56:03 -04:00
|
|
|
#define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
|
2016-05-09 14:40:10 +02:00
|
|
|
#define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(1)
|
2016-07-28 11:40:53 +02:00
|
|
|
#define GB_INTERFACE_QUIRK_NO_GMP_IDS BIT(2)
|
2016-05-27 17:26:24 +02:00
|
|
|
#define GB_INTERFACE_QUIRK_FORCED_DISABLE BIT(3)
|
2016-05-27 17:26:40 +02:00
|
|
|
#define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH BIT(4)
|
2016-07-26 13:41:03 -07:00
|
|
|
#define GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE BIT(5)
|
2016-07-26 13:41:04 -07:00
|
|
|
#define GB_INTERFACE_QUIRK_NO_PM BIT(6)
|
2016-03-29 18:56:03 -04:00
|
|
|
|
2014-12-19 14:56:31 -08:00
|
|
|
struct gb_interface {
|
2014-10-01 21:54:11 -05:00
|
|
|
struct device dev;
|
2015-06-22 16:42:26 +05:30
|
|
|
struct gb_control *control;
|
2014-10-01 21:54:11 -05:00
|
|
|
|
2014-12-19 14:56:29 -08:00
|
|
|
struct list_head bundles;
|
2016-04-23 18:47:24 +02:00
|
|
|
struct list_head module_node;
|
2014-12-23 15:16:50 -08:00
|
|
|
struct list_head manifest_descs;
|
2014-12-21 14:10:26 -08:00
|
|
|
u8 interface_id; /* Physical location within the Endo */
|
2016-03-29 18:56:06 -04:00
|
|
|
u8 device_id;
|
2016-05-15 19:37:49 +01:00
|
|
|
u8 features; /* Feature flags set in the manifest */
|
2016-07-20 16:40:20 +02:00
|
|
|
|
|
|
|
|
enum gb_interface_type type;
|
2014-10-01 21:54:11 -05:00
|
|
|
|
2015-12-22 22:04:33 +05:30
|
|
|
u32 ddbl1_manufacturer_id;
|
|
|
|
|
u32 ddbl1_product_id;
|
2015-11-25 15:58:56 +01:00
|
|
|
u32 vendor_id;
|
|
|
|
|
u32 product_id;
|
2015-12-28 11:59:00 +05:30
|
|
|
u64 serial_number;
|
2015-08-12 09:19:31 +05:30
|
|
|
|
2015-11-03 18:03:23 +01:00
|
|
|
struct gb_host_device *hd;
|
2016-04-23 18:47:24 +02:00
|
|
|
struct gb_module *module;
|
2015-10-07 15:40:24 -04:00
|
|
|
|
2016-03-29 18:56:03 -04:00
|
|
|
unsigned long quirks;
|
|
|
|
|
|
2016-04-23 18:47:25 +02:00
|
|
|
struct mutex mutex;
|
|
|
|
|
|
2015-12-15 15:28:57 +01:00
|
|
|
bool disconnected;
|
2016-05-27 17:26:40 +02:00
|
|
|
|
2016-04-23 18:47:25 +02:00
|
|
|
bool ejected;
|
2016-07-20 16:40:24 +02:00
|
|
|
bool removed;
|
2016-04-23 18:47:26 +02:00
|
|
|
bool active;
|
2016-04-13 19:19:06 +02:00
|
|
|
bool enabled;
|
2016-05-27 17:26:40 +02:00
|
|
|
bool mode_switch;
|
2016-07-20 16:40:21 +02:00
|
|
|
bool dme_read;
|
2016-05-27 17:26:40 +02:00
|
|
|
|
|
|
|
|
struct work_struct mode_switch_work;
|
|
|
|
|
struct completion mode_switch_completion;
|
2014-10-01 21:54:11 -05:00
|
|
|
};
|
2014-12-19 14:56:31 -08:00
|
|
|
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
|
2014-10-01 21:54:11 -05:00
|
|
|
|
2016-04-23 18:47:24 +02:00
|
|
|
struct gb_interface *gb_interface_create(struct gb_module *module,
|
2015-06-22 16:42:27 +05:30
|
|
|
u8 interface_id);
|
2016-03-29 18:56:04 -04:00
|
|
|
int gb_interface_activate(struct gb_interface *intf);
|
|
|
|
|
void gb_interface_deactivate(struct gb_interface *intf);
|
2016-03-09 12:20:42 +01:00
|
|
|
int gb_interface_enable(struct gb_interface *intf);
|
2016-03-09 12:20:43 +01:00
|
|
|
void gb_interface_disable(struct gb_interface *intf);
|
2016-03-09 12:20:36 +01:00
|
|
|
int gb_interface_add(struct gb_interface *intf);
|
2016-04-23 18:47:24 +02:00
|
|
|
void gb_interface_del(struct gb_interface *intf);
|
|
|
|
|
void gb_interface_put(struct gb_interface *intf);
|
2016-05-27 17:26:40 +02:00
|
|
|
void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
|
|
|
|
|
u32 mailbox);
|
|
|
|
|
|
|
|
|
|
int gb_interface_request_mode_switch(struct gb_interface *intf);
|
2014-12-19 14:56:35 -08:00
|
|
|
|
2014-12-19 14:56:30 -08:00
|
|
|
#endif /* __INTERFACE_H */
|