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]

 



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?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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