* [PATCH 0/3] usb: typec: ucsi: additional fixes for Qualcomm platforms
@ 2024-04-08 1:04 Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Dmitry Baryshkov
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2024-04-08 1:04 UTC (permalink / raw
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Neil Armstrong, linux-usb, linux-kernel, linux-arm-msm,
Dmitry Baryshkov
Fix small issues in the Qualcomm PMIC-GLINK UCSI implementation.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Dmitry Baryshkov (3):
usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490
usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650
usb: typec: ucsi_glink: drop special handling for CCI_BUSY
drivers/usb/typec/ucsi/ucsi_glink.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
---
base-commit: 25e918cf1bb906bd9aca19ae0270feb7f6d68783
change-id: 20240408-qcom-ucsi-fixes-bis-6b314764c5be
Best regards,
--
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490
2024-04-08 1:04 [PATCH 0/3] usb: typec: ucsi: additional fixes for Qualcomm platforms Dmitry Baryshkov
@ 2024-04-08 1:04 ` Dmitry Baryshkov
2024-04-09 6:21 ` Heikki Krogerus
2024-04-08 1:04 ` [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650 Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY Dmitry Baryshkov
2 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2024-04-08 1:04 UTC (permalink / raw
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Neil Armstrong, linux-usb, linux-kernel, linux-arm-msm,
Dmitry Baryshkov
Enable the UCSI_DELAY_DEVICE_PDOS quirk on Qualcomm QCM6490. This
platform also doesn't correctly handle reading PD capabilities until PD
partner is connected.
Fixes: 5da727f75823 ("usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index ef00a6563c88..9bd80a2218e4 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -316,7 +316,7 @@ static unsigned long quirk_sc8280xp = UCSI_NO_PARTNER_PDOS | UCSI_DELAY_DEVICE_P
static unsigned long quirk_sm8450 = UCSI_DELAY_DEVICE_PDOS;
static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
- { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8180x, },
+ { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8280xp, },
{ .compatible = "qcom,sc8180x-pmic-glink", .data = &quirk_sc8180x, },
{ .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, },
{ .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650
2024-04-08 1:04 [PATCH 0/3] usb: typec: ucsi: additional fixes for Qualcomm platforms Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Dmitry Baryshkov
@ 2024-04-08 1:04 ` Dmitry Baryshkov
2024-04-09 6:22 ` Heikki Krogerus
2024-04-08 1:04 ` [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY Dmitry Baryshkov
2 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2024-04-08 1:04 UTC (permalink / raw
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Neil Armstrong, linux-usb, linux-kernel, linux-arm-msm,
Dmitry Baryshkov
The Qualcomm SM8550 (and via a fallback compat SM8650) firmware properly
handles the GET_PDOS command, it sends the CCI_BUSY notification,
and then follows with the CCI_COMMAND_COMPLETE event. Stop using the quirk
for those two platforms.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 9bd80a2218e4..9ffea20020e7 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -321,7 +321,7 @@ static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
{ .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, },
{ .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
{ .compatible = "qcom,sm8450-pmic-glink", .data = &quirk_sm8450, },
- { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sc8280xp, },
+ { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sm8450, },
{}
};
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY
2024-04-08 1:04 [PATCH 0/3] usb: typec: ucsi: additional fixes for Qualcomm platforms Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650 Dmitry Baryshkov
@ 2024-04-08 1:04 ` Dmitry Baryshkov
2024-04-09 6:30 ` Heikki Krogerus
2 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2024-04-08 1:04 UTC (permalink / raw
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Neil Armstrong, linux-usb, linux-kernel, linux-arm-msm,
Dmitry Baryshkov
Newer Qualcomm platforms (sm8450+) successfully handle busy state and
send the Command Completion after sending the Busy state. Older devices
have firmware bug and can not continue after sending the CCI_BUSY state,
but the command that leads to CCI_BUSY is already forbidden by the
NO_PARTNER_PDOS quirk.
Follow other UCSI glue drivers and drop special handling for CCI_BUSY
event. Let the UCSI core properly handle this state.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/ucsi/ucsi_glink.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 9ffea20020e7..b91d2d15d7d9 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -176,7 +176,8 @@ static int pmic_glink_ucsi_sync_write(struct ucsi *__ucsi, unsigned int offset,
left = wait_for_completion_timeout(&ucsi->sync_ack, 5 * HZ);
if (!left) {
dev_err(ucsi->dev, "timeout waiting for UCSI sync write response\n");
- ret = -ETIMEDOUT;
+ /* return 0 here and let core UCSI code handle the CCI_BUSY */
+ ret = 0;
} else if (ucsi->sync_val) {
dev_err(ucsi->dev, "sync write returned: %d\n", ucsi->sync_val);
}
@@ -243,10 +244,7 @@ static void pmic_glink_ucsi_notify(struct work_struct *work)
ucsi_connector_change(ucsi->ucsi, con_num);
}
- if (ucsi->sync_pending && cci & UCSI_CCI_BUSY) {
- ucsi->sync_val = -EBUSY;
- complete(&ucsi->sync_ack);
- } else if (ucsi->sync_pending &&
+ if (ucsi->sync_pending &&
(cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))) {
complete(&ucsi->sync_ack);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490
2024-04-08 1:04 ` [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Dmitry Baryshkov
@ 2024-04-09 6:21 ` Heikki Krogerus
0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2024-04-09 6:21 UTC (permalink / raw
To: Dmitry Baryshkov
Cc: Greg Kroah-Hartman, Neil Armstrong, linux-usb, linux-kernel,
linux-arm-msm
On Mon, Apr 08, 2024 at 04:04:15AM +0300, Dmitry Baryshkov wrote:
> Enable the UCSI_DELAY_DEVICE_PDOS quirk on Qualcomm QCM6490. This
> platform also doesn't correctly handle reading PD capabilities until PD
> partner is connected.
>
> Fixes: 5da727f75823 ("usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index ef00a6563c88..9bd80a2218e4 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -316,7 +316,7 @@ static unsigned long quirk_sc8280xp = UCSI_NO_PARTNER_PDOS | UCSI_DELAY_DEVICE_P
> static unsigned long quirk_sm8450 = UCSI_DELAY_DEVICE_PDOS;
>
> static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
> - { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8180x, },
> + { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8280xp, },
> { .compatible = "qcom,sc8180x-pmic-glink", .data = &quirk_sc8180x, },
> { .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, },
> { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
>
> --
> 2.39.2
--
heikki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650
2024-04-08 1:04 ` [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650 Dmitry Baryshkov
@ 2024-04-09 6:22 ` Heikki Krogerus
0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2024-04-09 6:22 UTC (permalink / raw
To: Dmitry Baryshkov
Cc: Greg Kroah-Hartman, Neil Armstrong, linux-usb, linux-kernel,
linux-arm-msm
On Mon, Apr 08, 2024 at 04:04:16AM +0300, Dmitry Baryshkov wrote:
> The Qualcomm SM8550 (and via a fallback compat SM8650) firmware properly
> handles the GET_PDOS command, it sends the CCI_BUSY notification,
> and then follows with the CCI_COMMAND_COMPLETE event. Stop using the quirk
> for those two platforms.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 9bd80a2218e4..9ffea20020e7 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -321,7 +321,7 @@ static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
> { .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, },
> { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
> { .compatible = "qcom,sm8450-pmic-glink", .data = &quirk_sm8450, },
> - { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sc8280xp, },
> + { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sm8450, },
> {}
> };
>
>
> --
> 2.39.2
--
heikki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY
2024-04-08 1:04 ` [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY Dmitry Baryshkov
@ 2024-04-09 6:30 ` Heikki Krogerus
0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2024-04-09 6:30 UTC (permalink / raw
To: Dmitry Baryshkov
Cc: Greg Kroah-Hartman, Neil Armstrong, linux-usb, linux-kernel,
linux-arm-msm
On Mon, Apr 08, 2024 at 04:04:17AM +0300, Dmitry Baryshkov wrote:
> Newer Qualcomm platforms (sm8450+) successfully handle busy state and
> send the Command Completion after sending the Busy state. Older devices
> have firmware bug and can not continue after sending the CCI_BUSY state,
> but the command that leads to CCI_BUSY is already forbidden by the
> NO_PARTNER_PDOS quirk.
>
> Follow other UCSI glue drivers and drop special handling for CCI_BUSY
> event. Let the UCSI core properly handle this state.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
One minor nitpick below, but feel free to ignore that one.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/ucsi/ucsi_glink.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 9ffea20020e7..b91d2d15d7d9 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -176,7 +176,8 @@ static int pmic_glink_ucsi_sync_write(struct ucsi *__ucsi, unsigned int offset,
> left = wait_for_completion_timeout(&ucsi->sync_ack, 5 * HZ);
> if (!left) {
> dev_err(ucsi->dev, "timeout waiting for UCSI sync write response\n");
> - ret = -ETIMEDOUT;
> + /* return 0 here and let core UCSI code handle the CCI_BUSY */
> + ret = 0;
> } else if (ucsi->sync_val) {
> dev_err(ucsi->dev, "sync write returned: %d\n", ucsi->sync_val);
> }
> @@ -243,10 +244,7 @@ static void pmic_glink_ucsi_notify(struct work_struct *work)
> ucsi_connector_change(ucsi->ucsi, con_num);
> }
>
> - if (ucsi->sync_pending && cci & UCSI_CCI_BUSY) {
> - ucsi->sync_val = -EBUSY;
> - complete(&ucsi->sync_ack);
> - } else if (ucsi->sync_pending &&
> + if (ucsi->sync_pending &&
> (cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))) {
Looks like you forgot to fix the alignment.
> complete(&ucsi->sync_ack);
> }
>
> --
> 2.39.2
--
heikki
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-09 6:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 1:04 [PATCH 0/3] usb: typec: ucsi: additional fixes for Qualcomm platforms Dmitry Baryshkov
2024-04-08 1:04 ` [PATCH 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Dmitry Baryshkov
2024-04-09 6:21 ` Heikki Krogerus
2024-04-08 1:04 ` [PATCH 2/3] usb: typec: ucsi_glink: drop NO_PARTNER_PDOS quirk for sm8550 / sm8650 Dmitry Baryshkov
2024-04-09 6:22 ` Heikki Krogerus
2024-04-08 1:04 ` [PATCH 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY Dmitry Baryshkov
2024-04-09 6:30 ` Heikki Krogerus
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.