Hi
> -----Original Message-----
> From: linux-usb-ow...@vger.kernel.org
> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Heikki Krogerus
> Sent: 2018年2月26日 22:06
> To: Jun Li <jun...@nxp.com>
> Cc: gre...@linuxfoundation.org; robh...@kernel.org; li...@roeck-us.net;
> a.ha...@samsung.com; mark.rutl...@arm.com; yue...@google.com;
> Peter Chen <peter.c...@nxp.com>; garsi...@embeddedor.com;
> o_leve...@orange.fr; shufan_...@richtek.com; linux-usb@vger.kernel.org;
> devicet...@vger.kernel.org; dl-linux-imx <linux-...@nxp.com>
> Subject: Re: [PATCH v2 03/12] staging: typec: tcpci: support port config
> passed via dt
> 
> Hi,
> 
> On Mon, Feb 26, 2018 at 07:49:10PM +0800, Li Jun wrote:
> > User can define the typec port properties in tcpci node to setup the
> > port config.
> >
> > Signed-off-by: Li Jun <jun...@nxp.com>
> > ---
> > Changes for v2:
> > - Use infra APIs to get sink and source config.
> > - Improve the error message.
> >
> >  drivers/staging/typec/tcpci.c | 70
> ++++++++++++++++++++++++++++++++++++++-----
> >  include/linux/usb/tcpm.h      |  6 ++--
> >  2 files changed, 66 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/staging/typec/tcpci.c
> > b/drivers/staging/typec/tcpci.c index b6abaf7..be6ed16 100644
> > --- a/drivers/staging/typec/tcpci.c
> > +++ b/drivers/staging/typec/tcpci.c
> > @@ -426,17 +426,73 @@ 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,
> > -};
> > -
> > +/* Populate struct tcpc_config from device-tree */
> >  static int tcpci_parse_config(struct tcpci *tcpci)  {
> > +   struct tcpc_config *tcfg;
> > +   struct device_node *child;
> > +   int ret = -EINVAL;
> > +
> >     tcpci->controls_vbus = true; /* XXX */
> >
> > -   /* TODO: Populate struct tcpc_config from ACPI/device-tree */
> > -   tcpci->tcpc.config = &tcpci_tcpc_config;
> > +   tcpci->tcpc.config = devm_kzalloc(tcpci->dev, sizeof(*tcfg),
> > +                                     GFP_KERNEL);
> > +   if (!tcpci->tcpc.config)
> > +           return -ENOMEM;
> > +
> > +   tcfg = tcpci->tcpc.config;
> > +
> > +   child = of_get_child_by_name(tcpci->dev->of_node, "connector");
> > +   if (!child) {
> > +           dev_err(tcpci->dev, "failed to get connector node.\n");
> > +           return -EINVAL;
> > +   }
> 
> Why do you need separate child node for the connector? You will always
> have only one connector per tcpc, i.e. the tcpci already represents the
> connector and all its capabilities.
> 
This is my original idea, my understanding is Rob expects those properties 
should
apply for a common usb connector node[1], that way I need add a child node for 
it,
sorry I didn't make the dt-binding patches come first in this series, please see
patch 10,11.

[1] https://patchwork.kernel.org/patch/10231447/

thanks
Li Jun
> 
> Thanks,
> 
> --
> heikki
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in the
> body of a message to majord...@vger.kernel.org More majordomo info at
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger
> .kernel.org%2Fmajordomo-info.html&data=02%7C01%7Cjun.li%40nxp.com
> %7Ce39f8cdcff664858d9ea08d57d221b7a%7C686ea1d3bc2b4c6fa92cd99c5
> c301635%7C0%7C1%7C636552507819862496&sdata=SgStkXiqwV7RIfXcReB
> vIZpOyLEXKNhvH%2FB6p4KXxsA%3D&reserved=0

Reply via email to