All of lore.kernel.org
 help / color / mirror / Atom feed
* [v3,03/12] usb: typec: add fwnode to tcpc
@ 2018-03-13 11:17 Heikki Krogerus
  0 siblings, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2018-03-13 11:17 UTC (permalink / raw)
  To: Li Jun
  Cc: robh+dt, mark.rutland, gregkh, a.hajda, linux, yueyao,
	shufan_lee, o_leveque, linux-usb, linux-imx

Hi Jun Li,

On Tue, Mar 13, 2018 at 05:34:29PM +0800, Li Jun wrote:
> Add fwnode handle to get the fwnode so we can get typec configs
> it contains.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

You should not sign-off patches for other people. If you check section
13 from Documentation/process/submitting-patches.rst you'll find
definition for "Suggested-by" tag. I believe that is the appropriate
tag that you should using in this case.


Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [v3,03/12] usb: typec: add fwnode to tcpc
@ 2018-03-14  1:27 Jun Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2018-03-14  1:27 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: robh+dt, mark.rutland, gregkh, a.hajda, linux, yueyao,
	shufan_lee, o_leveque, linux-usb, dl-linux-imx

> -----Original Message-----
> From: Heikki Krogerus [mailto:heikki.krogerus@linux.intel.com]
> Sent: 2018年3月13日 19:18
> To: Jun Li <jun.li@nxp.com>
> Cc: robh+dt@kernel.org; mark.rutland@arm.com;
> gregkh@linuxfoundation.org; a.hajda@samsung.com; linux@roeck-us.net;
> yueyao@google.com; shufan_lee@richtek.com; o_leveque@orange.fr;
> linux-usb@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH v3 03/12] usb: typec: add fwnode to tcpc
> 
> Hi Jun Li,
> 
> On Tue, Mar 13, 2018 at 05:34:29PM +0800, Li Jun wrote:
> > Add fwnode handle to get the fwnode so we can get typec configs it
> > contains.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> You should not sign-off patches for other people. If you check section
> 13 from Documentation/process/submitting-patches.rst you'll find definition
> for "Suggested-by" tag. I believe that is the appropriate tag that you should
> using in this case.

You are right, my copy paste mistake, I will correct this.

Thanks
Jun
> 
> 
> Thanks,
> 
> --
> heikki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [v3,03/12] usb: typec: add fwnode to tcpc
@ 2018-03-13  9:34 Jun Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2018-03-13  9:34 UTC (permalink / raw)
  To: robh+dt, mark.rutland, gregkh, heikki.krogerus
  Cc: a.hajda, jun.li, linux, yueyao, shufan_lee, o_leveque, linux-usb,
	linux-imx

Add fwnode handle to get the fwnode so we can get typec configs
it contains.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/staging/typec/tcpci.c | 14 +++++++-------
 drivers/usb/typec/tcpm.c      |  1 +
 include/linux/usb/tcpm.h      |  2 ++
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 076d97e..24ad44f 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/usb/pd.h>
 #include <linux/usb/tcpm.h>
@@ -463,17 +464,16 @@ static const struct regmap_config tcpci_regmap_config = {
 	.max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */
 };
 
-static const struct tcpc_config tcpci_tcpc_config = {
-	.type = TYPEC_PORT_DFP,
-	.default_role = TYPEC_SINK,
-};
-
 static int tcpci_parse_config(struct tcpci *tcpci)
 {
 	tcpci->controls_vbus = true; /* XXX */
 
-	/* TODO: Populate struct tcpc_config from ACPI/device-tree */
-	tcpci->tcpc.config = &tcpci_tcpc_config;
+	tcpci->tcpc.fwnode = device_get_named_child_node(tcpci->dev,
+							 "connector");
+	if (!tcpci->tcpc.fwnode) {
+		dev_err(tcpci->dev, "Can't find connector node.\n");
+		return -EINVAL;
+	}
 
 	return 0;
 }
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 3f0851b..7500dc0 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3735,6 +3735,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
 	else
 		port->try_role = TYPEC_NO_PREFERRED_ROLE;
 
+	port->typec_caps.fwnode = tcpc->fwnode;
 	port->typec_caps.prefer_role = tcpc->config->default_role;
 	port->typec_caps.type = tcpc->config->type;
 	port->typec_caps.data = tcpc->config->data;
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index f0d839d..e2e2db3 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -115,6 +115,7 @@ enum tcpc_mux_mode {
 /**
  * struct tcpc_dev - Port configuration and callback functions
  * @config:	Pointer to port configuration
+ * @fwnode:	Pointer to port fwnode
  * @get_vbus:	Called to read current VBUS state
  * @get_current_limit:
  *		Optional; called by the tcpm core when configured as a snk
@@ -143,6 +144,7 @@ enum tcpc_mux_mode {
  */
 struct tcpc_dev {
 	const struct tcpc_config *config;
+	struct fwnode_handle *fwnode;
 
 	int (*init)(struct tcpc_dev *dev);
 	int (*get_vbus)(struct tcpc_dev *dev);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-14  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 11:17 [v3,03/12] usb: typec: add fwnode to tcpc Heikki Krogerus
  -- strict thread matches above, loose matches on Subject: below --
2018-03-14  1:27 Jun Li
2018-03-13  9:34 Jun Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.