RE: [PATCH v7 06/14] usb: typec: tcpm: support get typec and pd config from device properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
> -----Original Message-----
> From: Adam Thomson [mailto:Adam.Thomson.Opensource@xxxxxxxxxxx]
> Sent: 2018年6月25日 18:46
> To: Jun Li <jun.li@xxxxxxx>; robh+dt@xxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx;
> heikki.krogerus@xxxxxxxxxxxxxxx; linux@xxxxxxxxxxxx
> Cc: a.hajda@xxxxxxxxxxx; cw00.choi@xxxxxxxxxxx; shufan_lee@xxxxxxxxxxx;
> Peter Chen <peter.chen@xxxxxxx>; devicetree@xxxxxxxxxxxxxxx;
> linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>
> Subject: RE: [PATCH v7 06/14] usb: typec: tcpm: support get typec and pd config
> from device properties
> 
> On 25 June 2018 09:09, Li Jun wrote:
> 
> > This patch adds support of get typec and power delivery config from
> > firmware description.
> >
> > Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> > Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > Signed-off-by: Li Jun <jun.li@xxxxxxx>
> > ---
> >  drivers/usb/typec/tcpm.c | 132
> > +++++++++++++++++++++++++++++++++++++++-----
> > ---
> >  1 file changed, 110 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index
> > d22b37b..0454654 100644
> > --- a/drivers/usb/typec/tcpm.c
> > +++ b/drivers/usb/typec/tcpm.c
> > @@ -4236,6 +4236,81 @@ static int tcpm_copy_vdos(u32 *dest_vdo, const
> > u32 *src_vdo,
> >  	return nr_vdo;
> >  }
> 
> ...
> 
> >  struct tcpm_port *tcpm_register_port(struct device *dev, struct
> > tcpc_dev *tcpc)  {
> >  	struct tcpm_port *port;
> >  	int i, err;
> >
> > -	if (!dev || !tcpc || !tcpc->config ||
> > +	if (!dev || !tcpc ||
> >  	    !tcpc->get_vbus || !tcpc->set_cc || !tcpc->get_cc ||
> >  	    !tcpc->set_polarity || !tcpc->set_vconn || !tcpc->set_vbus ||
> >  	    !tcpc->set_pd_rx || !tcpc->set_roles || !tcpc->pd_transmit) @@
> > -4556,30 +4655,19 @@ struct tcpm_port *tcpm_register_port(struct
> > device *dev, struct tcpc_dev *tcpc)
> >  	init_completion(&port->pps_complete);
> >  	tcpm_debugfs_init(port);
> >
> > -	if (tcpm_validate_caps(port, tcpc->config->src_pdo,
> > -			       tcpc->config->nr_src_pdo) ||
> > -	    tcpm_validate_caps(port, tcpc->config->snk_pdo,
> > -			       tcpc->config->nr_snk_pdo)) {
> > -		err = -EINVAL;
> > +	if (tcpc->config)
> > +		err = tcpm_copy_caps(port, tcpc->config);
> > +	else
> > +		err = tcpm_fw_get_caps(port, tcpc->fwnode);
> > +	if (err < 0)
> 
> Should we not be favouring the generic FW based capabilities over values
> defined in a Type C port controller driver, if the FW config is present? For
> example
> fusb302 driver has a hard coded config so that would always be selected rather
> than the FW based config, unless I'm missing something obvious?

You are right, I will change it to be below:
err = tcpm_fw_get_caps(port, tcpc->fwnode);
if ((err < 0) && tcpc->config)
	err = tcpm_copy_caps(port, tcpc->config);

thanks
Jun
?韬{.n?????%??檩??w?{.n????z谵{???塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux