soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE

Use the freshly defined DRM_AUX_HPD_BRIDGE instead of open-coding the
same functionality for the DRM bridge chain termination.

Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Acked-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231203114333.1305826-6-dmitry.baryshkov@linaro.org
This commit is contained in:
Dmitry Baryshkov 2023-12-03 14:43:32 +03:00
parent e560518a6c
commit 2bcca96abf
2 changed files with 10 additions and 24 deletions

View File

@ -86,6 +86,7 @@ config QCOM_PMIC_GLINK
depends on OF depends on OF
select AUXILIARY_BUS select AUXILIARY_BUS
select QCOM_PDR_HELPERS select QCOM_PDR_HELPERS
select DRM_AUX_HPD_BRIDGE
help help
The Qualcomm PMIC GLINK driver provides access, over GLINK, to the The Qualcomm PMIC GLINK driver provides access, over GLINK, to the
USB and battery firmware running on one of the coprocessors in USB and battery firmware running on one of the coprocessors in

View File

@ -11,7 +11,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/soc/qcom/pdr.h> #include <linux/soc/qcom/pdr.h>
#include <drm/drm_bridge.h> #include <drm/bridge/aux-bridge.h>
#include <linux/usb/typec_altmode.h> #include <linux/usb/typec_altmode.h>
#include <linux/usb/typec_dp.h> #include <linux/usb/typec_dp.h>
@ -76,7 +76,7 @@ struct pmic_glink_altmode_port {
struct work_struct work; struct work_struct work;
struct drm_bridge bridge; struct device *bridge;
enum typec_orientation orientation; enum typec_orientation orientation;
u16 svid; u16 svid;
@ -230,10 +230,10 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
else else
pmic_glink_altmode_enable_usb(altmode, alt_port); pmic_glink_altmode_enable_usb(altmode, alt_port);
if (alt_port->hpd_state) drm_aux_hpd_bridge_notify(alt_port->bridge,
drm_bridge_hpd_notify(&alt_port->bridge, connector_status_connected); alt_port->hpd_state ?
else connector_status_connected :
drm_bridge_hpd_notify(&alt_port->bridge, connector_status_disconnected); connector_status_disconnected);
pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index); pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index);
}; };
@ -365,16 +365,6 @@ static void pmic_glink_altmode_callback(const void *data, size_t len, void *priv
} }
} }
static int pmic_glink_altmode_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL;
}
static const struct drm_bridge_funcs pmic_glink_altmode_bridge_funcs = {
.attach = pmic_glink_altmode_attach,
};
static void pmic_glink_altmode_put_retimer(void *data) static void pmic_glink_altmode_put_retimer(void *data)
{ {
typec_retimer_put(data); typec_retimer_put(data);
@ -464,15 +454,10 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
alt_port->index = port; alt_port->index = port;
INIT_WORK(&alt_port->work, pmic_glink_altmode_worker); INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);
alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs; alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
alt_port->bridge.of_node = to_of_node(fwnode); if (IS_ERR(alt_port->bridge)) {
alt_port->bridge.ops = DRM_BRIDGE_OP_HPD;
alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
ret = devm_drm_bridge_add(dev, &alt_port->bridge);
if (ret) {
fwnode_handle_put(fwnode); fwnode_handle_put(fwnode);
return ret; return PTR_ERR(alt_port->bridge);
} }
alt_port->dp_alt.svid = USB_TYPEC_DP_SID; alt_port->dp_alt.svid = USB_TYPEC_DP_SID;