diff mbox

[v6,05/15] usb: typec: add API to get typec basic port power and data config

Message ID 1527475967-15201-6-git-send-email-jun.li@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jun Li May 28, 2018, 2:52 a.m. UTC
This patch adds 3 APIs to get the typec port power and data type,
and preferred power role by its name string.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/typec/class.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/usb/typec.h |  3 +++
 2 files changed, 53 insertions(+)

Comments

kernel test robot May 30, 2018, 4:25 a.m. UTC | #1
Hi Li,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.17-rc7 next-20180529]
[cannot apply to staging/staging-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Li-Jun/staging-typec-tcpci-move-out-of-staging/20180530-110011
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-x017-201821 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/list.h:9,
                    from include/linux/kobject.h:19,
                    from include/linux/device.h:16,
                    from drivers/usb/typec/class.c:9:
>> drivers/usb/typec/class.c:1274:19: error: 'typec_find_power_type' undeclared here (not in a function); did you mean 'typec_find_power_role'?
    EXPORT_SYMBOL_GPL(typec_find_power_type);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
>> drivers/usb/typec/class.c:1274:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_power_type);
    ^~~~~~~~~~~~~~~~~
>> drivers/usb/typec/class.c:1288:19: error: 'typec_find_preferred_role' undeclared here (not in a function); did you mean 'typec_find_power_role'?
    EXPORT_SYMBOL_GPL(typec_find_preferred_role);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
   drivers/usb/typec/class.c:1288:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_preferred_role);
    ^~~~~~~~~~~~~~~~~
>> drivers/usb/typec/class.c:1303:19: error: 'typec_find_data_type' undeclared here (not in a function); did you mean 'typec_find_power_type'?
    EXPORT_SYMBOL_GPL(typec_find_data_type);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
   drivers/usb/typec/class.c:1303:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_data_type);
    ^~~~~~~~~~~~~~~~~

vim +1274 drivers/usb/typec/class.c

  1260	
  1261	/**
  1262	 * typec_find_port_power_role - Get the typec port power capability
  1263	 * @name: port power capability string
  1264	 *
  1265	 * This routine is used to find the typec_port_type by its string name.
  1266	 *
  1267	 * Returns typec_port_type if success, otherwise negative error code.
  1268	 */
  1269	int typec_find_port_power_role(const char *name)
  1270	{
  1271		return match_string(typec_port_types, ARRAY_SIZE(typec_port_types),
  1272				    name);
  1273	}
> 1274	EXPORT_SYMBOL_GPL(typec_find_power_type);
  1275	
  1276	/**
  1277	 * typec_find_power_role - Find the typec one specific power role
  1278	 * @name: power role string
  1279	 *
  1280	 * This routine is used to find the typec_role by its string name.
  1281	 *
  1282	 * Returns typec_role if success, otherwise negative error code.
  1283	 */
  1284	int typec_find_power_role(const char *name)
  1285	{
  1286		return match_string(typec_roles, ARRAY_SIZE(typec_roles), name);
  1287	}
> 1288	EXPORT_SYMBOL_GPL(typec_find_preferred_role);
  1289	
  1290	/**
  1291	 * typec_find_port_data_role - Get the typec port data capability
  1292	 * @name: port data capability string
  1293	 *
  1294	 * This routine is used to find the typec_port_data by its string name.
  1295	 *
  1296	 * Returns typec_port_data if success, otherwise negative error code.
  1297	 */
  1298	int typec_find_port_data_role(const char *name)
  1299	{
  1300		return match_string(typec_data_caps, ARRAY_SIZE(typec_data_caps),
  1301				    name);
  1302	}
> 1303	EXPORT_SYMBOL_GPL(typec_find_data_type);
  1304	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Jun Li May 30, 2018, 5:56 a.m. UTC | #2
SGkNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbToga2J1aWxkIHRlc3Qgcm9i
b3QgW21haWx0bzpsa3BAaW50ZWwuY29tXQ0KPiBTZW50OiAyMDE4xOo11MIzMMjVIDEyOjI2DQo+
IFRvOiBKdW4gTGkgPGp1bi5saUBueHAuY29tPg0KPiBDYzoga2J1aWxkLWFsbEAwMS5vcmc7IHJv
YmgrZHRAa2VybmVsLm9yZzsgZ3JlZ2toQGxpbnV4Zm91bmRhdGlvbi5vcmc7DQo+IGhlaWtraS5r
cm9nZXJ1c0BsaW51eC5pbnRlbC5jb207IGxpbnV4QHJvZWNrLXVzLm5ldDsNCj4gY3cwMC5jaG9p
QHNhbXN1bmcuY29tOyBhLmhhamRhQHNhbXN1bmcuY29tOyBzaHVmYW5fbGVlQHJpY2h0ZWsuY29t
Ow0KPiBQZXRlciBDaGVuIDxwZXRlci5jaGVuQG54cC5jb20+OyBnYXJzaWx2YUBlbWJlZGRlZG9y
LmNvbTsNCj4gZ3NvbWxvQGdtYWlsLmNvbTsgSnVuIExpIDxqdW4ubGlAbnhwLmNvbT47IGxpbnV4
LXVzYkB2Z2VyLmtlcm5lbC5vcmc7DQo+IGRldmljZXRyZWVAdmdlci5rZXJuZWwub3JnOyBkbC1s
aW51eC1pbXggPGxpbnV4LWlteEBueHAuY29tPg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIHY2IDA1
LzE1XSB1c2I6IHR5cGVjOiBhZGQgQVBJI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TdDNjg2ZWExZDNiYzJiNGM2ZmE5MmNkOTljNWMzMDE2MzUlDQo+IDdDMCU3QzAlN0M2MzY2MzI1
MTU0ODM2NzMxMDEmc2RhdGE9RGM1bnozcjJUV1U3NnNhT0tjMDNkMkRCVWUNCj4gaHRNZm9rUkJm
S0ViekZROXMlM0QmcmVzZXJ2ZWQ9MCAgICAgICAgICAgICAgICAgICBJbnRlbCBDb3Jwb3JhdGlv
bg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot May 30, 2018, 6:43 a.m. UTC | #3
Hi Li,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.17-rc7 next-20180529]
[cannot apply to staging/staging-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Li-Jun/staging-typec-tcpci-move-out-of-staging/20180530-110011
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-s1-201821 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/list.h:9,
                    from include/linux/kobject.h:19,
                    from include/linux/device.h:16,
                    from drivers/usb//typec/class.c:9:
>> drivers/usb//typec/class.c:1274:19: error: 'typec_find_power_type' undeclared here (not in a function)
    EXPORT_SYMBOL_GPL(typec_find_power_type);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
   drivers/usb//typec/class.c:1274:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_power_type);
    ^~~~~~~~~~~~~~~~~
>> drivers/usb//typec/class.c:1288:19: error: 'typec_find_preferred_role' undeclared here (not in a function)
    EXPORT_SYMBOL_GPL(typec_find_preferred_role);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
   drivers/usb//typec/class.c:1288:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_preferred_role);
    ^~~~~~~~~~~~~~~~~
>> drivers/usb//typec/class.c:1303:19: error: 'typec_find_data_type' undeclared here (not in a function)
    EXPORT_SYMBOL_GPL(typec_find_data_type);
                      ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                   ^~~
   drivers/usb//typec/class.c:1303:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(typec_find_data_type);
    ^~~~~~~~~~~~~~~~~

vim +/typec_find_power_type +1274 drivers/usb//typec/class.c

  1260	
  1261	/**
  1262	 * typec_find_port_power_role - Get the typec port power capability
  1263	 * @name: port power capability string
  1264	 *
  1265	 * This routine is used to find the typec_port_type by its string name.
  1266	 *
  1267	 * Returns typec_port_type if success, otherwise negative error code.
  1268	 */
  1269	int typec_find_port_power_role(const char *name)
  1270	{
  1271		return match_string(typec_port_types, ARRAY_SIZE(typec_port_types),
  1272				    name);
  1273	}
> 1274	EXPORT_SYMBOL_GPL(typec_find_power_type);
  1275	
  1276	/**
  1277	 * typec_find_power_role - Find the typec one specific power role
  1278	 * @name: power role string
  1279	 *
  1280	 * This routine is used to find the typec_role by its string name.
  1281	 *
  1282	 * Returns typec_role if success, otherwise negative error code.
  1283	 */
  1284	int typec_find_power_role(const char *name)
  1285	{
  1286		return match_string(typec_roles, ARRAY_SIZE(typec_roles), name);
  1287	}
> 1288	EXPORT_SYMBOL_GPL(typec_find_preferred_role);
  1289	
  1290	/**
  1291	 * typec_find_port_data_role - Get the typec port data capability
  1292	 * @name: port data capability string
  1293	 *
  1294	 * This routine is used to find the typec_port_data by its string name.
  1295	 *
  1296	 * Returns typec_port_data if success, otherwise negative error code.
  1297	 */
  1298	int typec_find_port_data_role(const char *name)
  1299	{
  1300		return match_string(typec_data_caps, ARRAY_SIZE(typec_data_caps),
  1301				    name);
  1302	}
> 1303	EXPORT_SYMBOL_GPL(typec_find_data_type);
  1304	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 53df10d..4c7d18c 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -802,6 +802,12 @@  static const char * const typec_port_types[] = {
 	[TYPEC_PORT_DRP] = "dual",
 };
 
+static const char * const typec_data_caps[] = {
+	[TYPEC_PORT_DFP] = "host",
+	[TYPEC_PORT_UFP] = "device",
+	[TYPEC_PORT_DRD] = "dual",
+};
+
 static const char * const typec_port_types_drp[] = {
 	[TYPEC_PORT_SRC] = "dual [source] sink",
 	[TYPEC_PORT_SNK] = "dual source [sink]",
@@ -1252,6 +1258,50 @@  void typec_set_pwr_opmode(struct typec_port *port,
 }
 EXPORT_SYMBOL_GPL(typec_set_pwr_opmode);
 
+/**
+ * typec_find_port_power_role - Get the typec port power capability
+ * @name: port power capability string
+ *
+ * This routine is used to find the typec_port_type by its string name.
+ *
+ * Returns typec_port_type if success, otherwise negative error code.
+ */
+int typec_find_port_power_role(const char *name)
+{
+	return match_string(typec_port_types, ARRAY_SIZE(typec_port_types),
+			    name);
+}
+EXPORT_SYMBOL_GPL(typec_find_power_type);
+
+/**
+ * typec_find_power_role - Find the typec one specific power role
+ * @name: power role string
+ *
+ * This routine is used to find the typec_role by its string name.
+ *
+ * Returns typec_role if success, otherwise negative error code.
+ */
+int typec_find_power_role(const char *name)
+{
+	return match_string(typec_roles, ARRAY_SIZE(typec_roles), name);
+}
+EXPORT_SYMBOL_GPL(typec_find_preferred_role);
+
+/**
+ * typec_find_port_data_role - Get the typec port data capability
+ * @name: port data capability string
+ *
+ * This routine is used to find the typec_port_data by its string name.
+ *
+ * Returns typec_port_data if success, otherwise negative error code.
+ */
+int typec_find_port_data_role(const char *name)
+{
+	return match_string(typec_data_caps, ARRAY_SIZE(typec_data_caps),
+			    name);
+}
+EXPORT_SYMBOL_GPL(typec_find_data_type);
+
 /* ------------------------------------------ */
 /* API for Multiplexer/DeMultiplexer Switches */
 
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
index 672b39b..15f8d9a 100644
--- a/include/linux/usb/typec.h
+++ b/include/linux/usb/typec.h
@@ -267,4 +267,7 @@  int typec_set_orientation(struct typec_port *port,
 			  enum typec_orientation orientation);
 int typec_set_mode(struct typec_port *port, int mode);
 
+int typec_find_port_power_role(const char *name);
+int typec_find_power_role(const char *name);
+int typec_find_port_data_role(const char *name);
 #endif /* __LINUX_USB_TYPEC_H */