From 8a37d87d72f0c69f837229c04d2fcd7117ea57e7 Mon Sep 17 00:00:00 2001 From: Heikki Krogerus Date: Wed, 27 Jun 2018 18:19:50 +0300 Subject: usb: typec: Bus type for alternate modes Introducing a simple bus for the alternate modes. Bus allows binding drivers to the discovered alternate modes the partners support. Signed-off-by: Heikki Krogerus Tested-by: Hans de Goede Signed-off-by: Greg Kroah-Hartman --- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'scripts/mod') diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 6667f7b491d6..293004499b4d 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -221,5 +221,9 @@ int main(void) DEVID_FIELD(tb_service_id, protocol_version); DEVID_FIELD(tb_service_id, protocol_revision); + DEVID(typec_device_id); + DEVID_FIELD(typec_device_id, svid); + DEVID_FIELD(typec_device_id, mode); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 52fd54a8fe39..7be43697ff84 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1352,6 +1352,19 @@ static int do_tbsvc_entry(const char *filename, void *symval, char *alias) } ADD_TO_DEVTABLE("tbsvc", tb_service_id, do_tbsvc_entry); +/* Looks like: typec:idNmN */ +static int do_typec_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, typec_device_id, svid); + DEF_FIELD(symval, typec_device_id, mode); + + sprintf(alias, "typec:id%04X", svid); + ADD(alias, "m", mode != TYPEC_ANY_MODE, mode); + + return 1; +} +ADD_TO_DEVTABLE("typec", typec_device_id, do_typec_entry); + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { -- cgit v1.2.3-58-ga151