Commit 2bcca96a authored by Dmitry Baryshkov's avatar Dmitry Baryshkov
Browse files

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: default avatarBjorn Andersson <andersson@kernel.org>
Acked-by: default avatarBjorn Andersson <andersson@kernel.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231203114333.1305826-6-dmitry.baryshkov@linaro.org
parent e560518a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ config QCOM_PMIC_GLINK
	depends on OF
	select AUXILIARY_BUS
	select QCOM_PDR_HELPERS
	select DRM_AUX_HPD_BRIDGE
	help
	  The Qualcomm PMIC GLINK driver provides access, over GLINK, to the
	  USB and battery firmware running on one of the coprocessors in
+9 −24
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
#include <linux/mutex.h>
#include <linux/property.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_dp.h>
@@ -76,7 +76,7 @@ struct pmic_glink_altmode_port {

	struct work_struct work;

	struct drm_bridge bridge;
	struct device *bridge;

	enum typec_orientation orientation;
	u16 svid;
@@ -230,10 +230,10 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
	else
		pmic_glink_altmode_enable_usb(altmode, alt_port);

	if (alt_port->hpd_state)
		drm_bridge_hpd_notify(&alt_port->bridge, connector_status_connected);
	else
		drm_bridge_hpd_notify(&alt_port->bridge, connector_status_disconnected);
	drm_aux_hpd_bridge_notify(alt_port->bridge,
				  alt_port->hpd_state ?
				  connector_status_connected :
				  connector_status_disconnected);

	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)
{
	typec_retimer_put(data);
@@ -464,15 +454,10 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
		alt_port->index = port;
		INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);

		alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs;
		alt_port->bridge.of_node = to_of_node(fwnode);
		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) {
		alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
		if (IS_ERR(alt_port->bridge)) {
			fwnode_handle_put(fwnode);
			return ret;
			return PTR_ERR(alt_port->bridge);
		}

		alt_port->dp_alt.svid = USB_TYPEC_DP_SID;