[RFC PATCH v1 12/12] usb: typec: qcom: define the bridge's path
Dmitry Baryshkov
dmitry.baryshkov at linaro.org
Sun Sep 3 21:41:50 UTC 2023
In order to notify the userspace about the DRM connector's USB-C port,
export the corresponding port's name as the bridge's path field.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
---
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++----
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c | 4 +++-
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h | 6 ++++--
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
index b9d4856101c7..452dc6437861 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
@@ -156,6 +156,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
const struct pmic_typec_resources *res;
struct regmap *regmap;
+ char *tcpm_name;
u32 base[2];
int ret;
@@ -211,10 +212,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
mutex_init(&tcpm->lock);
platform_set_drvdata(pdev, tcpm);
- tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev);
- if (IS_ERR(tcpm->pmic_typec_drm))
- return PTR_ERR(tcpm->pmic_typec_drm);
-
tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
if (!tcpm->tcpc.fwnode)
return -EINVAL;
@@ -225,6 +222,12 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
goto fwnode_remove;
}
+ tcpm_name = tcpm_port_get_name(tcpm->tcpm_port);
+ tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev, tcpm_name);
+ kfree(tcpm_name);
+ if (IS_ERR(tcpm->pmic_typec_drm))
+ return PTR_ERR(tcpm->pmic_typec_drm);
+
ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port,
tcpm->tcpm_port);
if (ret)
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c
index e202eb7b52db..7bd7f4bf3539 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c
@@ -21,7 +21,8 @@ static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = {
.attach = qcom_pmic_typec_attach,
};
-struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev)
+struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev,
+ const char *path)
{
struct pmic_typec_drm *tcpm_drm;
@@ -33,6 +34,7 @@ struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev)
tcpm_drm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector");
tcpm_drm->bridge.ops = DRM_BRIDGE_OP_HPD;
tcpm_drm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
+ tcpm_drm->bridge.path = devm_kstrdup(dev, path, GFP_KERNEL);
return ERR_PTR(devm_drm_bridge_add(dev, &tcpm_drm->bridge));
}
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h
index 01f4bb71346b..259c047265f7 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h
@@ -9,9 +9,11 @@
struct pmic_typec_drm;
#if IS_ENABLED(CONFIG_DRM)
-struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev);
+struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev,
+ const char *path);
#else
-static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev)
+static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev,
+ const char *path)
{
return NULL;
}
--
2.39.2
More information about the dri-devel
mailing list