Re: AW: tcpci module in Kernel 5.15.74 with PTN5110 not working correctly

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

 



On Mon, Feb 20, 2023 at 04:45:32PM +0000, Christian Bach wrote:
> Hello everyone
> 
> We finally found a solution to the problem we had with the PTN5110 Chip and the Kernel Module tcpci that manages this chip in 5.15.xx Kernel. NXP Patched their Kernel a while ago (https://source.codeaurora.org/external/imx/linux-imx/commit/drivers/usb/typec/tcpm/tcpci.c?h=lf-5.15.y&id=2a263f918b25725e0434afa9ff3b83b1bc18ef74) and we reimplemented the NXP patch for the Kernel 5.15.91. I attached my reworked patch below:
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 5340a3a3a81b..0d715e091b78 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -628,6 +628,9 @@ static int tcpci_init(struct tcpc_dev *tcpc)
>         if (ret < 0)
>                 return ret;
> 
> +       /* Clear fault condition */
> +       regmap_write(tcpci->regmap, TCPC_FAULT_STATUS, 0x80);
> +
>         if (tcpci->controls_vbus)
>                 reg = TCPC_POWER_STATUS_VBUS_PRES;
>         else
> @@ -644,7 +647,8 @@ static int tcpci_init(struct tcpc_dev *tcpc)
> 
>         reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED |
>                 TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS |
> -               TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;
> +               TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS |
> +               TCPC_ALERT_V_ALARM_LO | TCPC_ALERT_FAULT;
>         if (tcpci->controls_vbus)
>                 reg |= TCPC_ALERT_POWER_STATUS;
>         /* Enable VSAFE0V status interrupt when detecting VSAFE0V is supported */
> @@ -728,6 +732,13 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci)
>                         tcpm_vbus_change(tcpci->port);
>         }
> 
> +       /* Clear the fault status anyway */
> +       if (status & TCPC_ALERT_FAULT) {
> +               regmap_read(tcpci->regmap, TCPC_FAULT_STATUS, &raw);
> +               regmap_write(tcpci->regmap, TCPC_FAULT_STATUS,
> +                               raw | TCPC_FAULT_STATUS_MASK);
> +       }
> +
>         if (status & TCPC_ALERT_RX_HARD_RST)
>                 tcpm_pd_hard_reset(tcpci->port);
> 
> 
> 
> 
> 
> 
> 

Can you submit this as a real fix so that we can apply it properly?

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux