Message ID | 20231025115620.905538-3-dmitry.baryshkov@linaro.org |
---|---|
State | Accepted |
Commit | 4db09e7b967b905ba3036a4d96e81c06b896b1bf |
Headers | show |
Series | usb: typec: ucsi: add workaround for several Qualcomm platforms | expand |
On 25/10/2023 13:49, Dmitry Baryshkov wrote: > Now as the issue with the UCSI_GET_PDOS is worked around, enable UCSI > support for all PMIC_GLINK platforms except Qualcomm SC8180X. The > mentioned SoC has slightly different UCSI implementation, which I would > like be tested properly before enabling it. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- > drivers/soc/qcom/pmic_glink.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c > index 914057331afd..71d8901a9389 100644 > --- a/drivers/soc/qcom/pmic_glink.c > +++ b/drivers/soc/qcom/pmic_glink.c > @@ -18,9 +18,6 @@ enum { > PMIC_GLINK_CLIENT_UCSI, > }; > > -#define PMIC_GLINK_CLIENT_DEFAULT (BIT(PMIC_GLINK_CLIENT_BATT) | \ > - BIT(PMIC_GLINK_CLIENT_ALTMODE)) > - > struct pmic_glink { > struct device *dev; > struct pdr_handle *pdr; > @@ -263,10 +260,10 @@ static int pmic_glink_probe(struct platform_device *pdev) > mutex_init(&pg->state_lock); > > match_data = (unsigned long *)of_device_get_match_data(&pdev->dev); > - if (match_data) > - pg->client_mask = *match_data; > - else > - pg->client_mask = PMIC_GLINK_CLIENT_DEFAULT; > + if (!match_data) > + return -EINVAL; > + > + pg->client_mask = *match_data; > > if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) { > ret = pmic_glink_add_aux_device(pg, &pg->ucsi_aux, "ucsi"); > @@ -336,14 +333,16 @@ static void pmic_glink_remove(struct platform_device *pdev) > mutex_unlock(&__pmic_glink_lock); > } > > +static const unsigned long pmic_glink_sc8180x_client_mask = BIT(PMIC_GLINK_CLIENT_BATT) | > + BIT(PMIC_GLINK_CLIENT_ALTMODE); > + > static const unsigned long pmic_glink_sm8450_client_mask = BIT(PMIC_GLINK_CLIENT_BATT) | > BIT(PMIC_GLINK_CLIENT_ALTMODE) | > BIT(PMIC_GLINK_CLIENT_UCSI); > > static const struct of_device_id pmic_glink_of_match[] = { > - { .compatible = "qcom,sm8450-pmic-glink", .data = &pmic_glink_sm8450_client_mask }, > - { .compatible = "qcom,sm8550-pmic-glink", .data = &pmic_glink_sm8450_client_mask }, > - { .compatible = "qcom,pmic-glink" }, > + { .compatible = "qcom,sc8180x-pmic-glink", .data = &pmic_glink_sc8180x_client_mask }, > + { .compatible = "qcom,pmic-glink", .data = &pmic_glink_sm8450_client_mask }, > {} > }; > MODULE_DEVICE_TABLE(of, pmic_glink_of_match); Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c index 914057331afd..71d8901a9389 100644 --- a/drivers/soc/qcom/pmic_glink.c +++ b/drivers/soc/qcom/pmic_glink.c @@ -18,9 +18,6 @@ enum { PMIC_GLINK_CLIENT_UCSI, }; -#define PMIC_GLINK_CLIENT_DEFAULT (BIT(PMIC_GLINK_CLIENT_BATT) | \ - BIT(PMIC_GLINK_CLIENT_ALTMODE)) - struct pmic_glink { struct device *dev; struct pdr_handle *pdr; @@ -263,10 +260,10 @@ static int pmic_glink_probe(struct platform_device *pdev) mutex_init(&pg->state_lock); match_data = (unsigned long *)of_device_get_match_data(&pdev->dev); - if (match_data) - pg->client_mask = *match_data; - else - pg->client_mask = PMIC_GLINK_CLIENT_DEFAULT; + if (!match_data) + return -EINVAL; + + pg->client_mask = *match_data; if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) { ret = pmic_glink_add_aux_device(pg, &pg->ucsi_aux, "ucsi"); @@ -336,14 +333,16 @@ static void pmic_glink_remove(struct platform_device *pdev) mutex_unlock(&__pmic_glink_lock); } +static const unsigned long pmic_glink_sc8180x_client_mask = BIT(PMIC_GLINK_CLIENT_BATT) | + BIT(PMIC_GLINK_CLIENT_ALTMODE); + static const unsigned long pmic_glink_sm8450_client_mask = BIT(PMIC_GLINK_CLIENT_BATT) | BIT(PMIC_GLINK_CLIENT_ALTMODE) | BIT(PMIC_GLINK_CLIENT_UCSI); static const struct of_device_id pmic_glink_of_match[] = { - { .compatible = "qcom,sm8450-pmic-glink", .data = &pmic_glink_sm8450_client_mask }, - { .compatible = "qcom,sm8550-pmic-glink", .data = &pmic_glink_sm8450_client_mask }, - { .compatible = "qcom,pmic-glink" }, + { .compatible = "qcom,sc8180x-pmic-glink", .data = &pmic_glink_sc8180x_client_mask }, + { .compatible = "qcom,pmic-glink", .data = &pmic_glink_sm8450_client_mask }, {} }; MODULE_DEVICE_TABLE(of, pmic_glink_of_match);
Now as the issue with the UCSI_GET_PDOS is worked around, enable UCSI support for all PMIC_GLINK platforms except Qualcomm SC8180X. The mentioned SoC has slightly different UCSI implementation, which I would like be tested properly before enabling it. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/soc/qcom/pmic_glink.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)