Commit 5e85a04c authored by Li Jun's avatar Li Jun Committed by Greg Kroah-Hartman

usb: typec: add fwnode to tcpc

Add fwnode handle to get the fwnode so we can get typec configs
it contains.
Suggested-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 40242086
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/usb/pd.h> #include <linux/usb/pd.h>
#include <linux/usb/tcpm.h> #include <linux/usb/tcpm.h>
...@@ -474,6 +475,12 @@ static int tcpci_parse_config(struct tcpci *tcpci) ...@@ -474,6 +475,12 @@ static int tcpci_parse_config(struct tcpci *tcpci)
/* TODO: Populate struct tcpc_config from ACPI/device-tree */ /* TODO: Populate struct tcpc_config from ACPI/device-tree */
tcpci->tcpc.config = &tcpci_tcpc_config; 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; return 0;
} }
......
...@@ -4576,6 +4576,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) ...@@ -4576,6 +4576,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
else else
port->try_role = TYPEC_NO_PREFERRED_ROLE; 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.prefer_role = tcpc->config->default_role;
port->typec_caps.type = tcpc->config->type; port->typec_caps.type = tcpc->config->type;
port->typec_caps.data = tcpc->config->data; port->typec_caps.data = tcpc->config->data;
......
...@@ -110,6 +110,7 @@ enum tcpc_mux_mode { ...@@ -110,6 +110,7 @@ enum tcpc_mux_mode {
/** /**
* struct tcpc_dev - Port configuration and callback functions * struct tcpc_dev - Port configuration and callback functions
* @config: Pointer to port configuration * @config: Pointer to port configuration
* @fwnode: Pointer to port fwnode
* @get_vbus: Called to read current VBUS state * @get_vbus: Called to read current VBUS state
* @get_current_limit: * @get_current_limit:
* Optional; called by the tcpm core when configured as a snk * Optional; called by the tcpm core when configured as a snk
...@@ -138,6 +139,7 @@ enum tcpc_mux_mode { ...@@ -138,6 +139,7 @@ enum tcpc_mux_mode {
*/ */
struct tcpc_dev { struct tcpc_dev {
const struct tcpc_config *config; const struct tcpc_config *config;
struct fwnode_handle *fwnode;
int (*init)(struct tcpc_dev *dev); int (*init)(struct tcpc_dev *dev);
int (*get_vbus)(struct tcpc_dev *dev); int (*get_vbus)(struct tcpc_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment