From patchwork Wed Oct 25 22:28:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13436892 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62AB5381C4 for ; Wed, 25 Oct 2023 22:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="u7xROQHS" Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6FE8F for ; Wed, 25 Oct 2023 15:30:37 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2c51388ccebso3200161fa.3 for ; Wed, 25 Oct 2023 15:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698273036; x=1698877836; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8BPC0gvdjP8wM+oIvBMJYIiBTyxbJHuviF4Sm6CqMh8=; b=u7xROQHSAPTTSS7g9F7cFCWb/IzvBWoASZx1RXYebOI8J8aMR5oNqTnV0KXNVE7sTP 1pwddfuaJIQj+EtrnIqZlJqhFPdEN7yISpl2jvXJUTwN6kj4Htim9ASOTHVjrIXEX/FD wKHZElGa0d1X0nuv5M1WXDVe3OY3E8YebIAVgLQ7D5K8dTEliCIP6/TsXzBhmrqNYgkO +duSdHe9LCx9RsmG5Dew9ETRyu+UGLn4O8T3rJSTpiGFdTbbk9E8IdDwo2C6t4iO91aR +Bqj0HNWhQnxQlqQpsrzPFP+DwisHZjDm6raa5Ow/YnfJoU3+n12h49arKix0u+ABMFa ix+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698273036; x=1698877836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8BPC0gvdjP8wM+oIvBMJYIiBTyxbJHuviF4Sm6CqMh8=; b=Mx3gBeO/+69FtLYriLFW0yaWI2pTQMn8wgkEBc4Qqjphka5ek6tj6Lo8HlpHribEYb gqKFACOcr1b2HUp7IJOzbHRbBS9AOdCWPiB6sxZ3cpniZUVjxjm5/ZTLhMcTI3PLyNKv vaSsDMGD4sy5UwjEqqmb6EKmbkewn6H6sdVpgMzVcA4v2T1wyzSGIOD+sKS71U3H+eFn jSO7u2mv3wncOnYdWfB21lrsVX1zsbgy902T6kmbrRwI6GibTUCNQcHsDq/VO9lQLXic lLkemuUapdxfJ3mQ30cME59IB4eRWisR4F885U3FP9HHduE+Zh93DIPcumXbliA1/RI/ USyQ== X-Gm-Message-State: AOJu0YzExQQOHpZ1uN1JnavhPDRzoOkPr1ZodqFkytA+XLduHDLHLdop gUAXcrFW4PSYvoP8Hj1Njy3oFA== X-Google-Smtp-Source: AGHT+IGs/BWXfJ4hALXW5GTDDn/R5PVKdMi+0bQF8BkcG9HtcaVYNOa+oCwLx2BP8qdJj5NA5N5fgA== X-Received: by 2002:a2e:a589:0:b0:2c5:1a8e:e4c9 with SMTP id m9-20020a2ea589000000b002c51a8ee4c9mr12892138ljp.31.1698273036102; Wed, 25 Oct 2023 15:30:36 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a36-20020a05651c212400b002bcbae4c21fsm2612543ljq.50.2023.10.25.15.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 15:30:35 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Heikki Krogerus , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v5 5/6] soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE Date: Thu, 26 Oct 2023 01:28:06 +0300 Message-ID: <20231025223027.943563-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025223027.943563-1-dmitry.baryshkov@linaro.org> References: <20231025223027.943563-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the freshly defined DRM_AUX_HPD_BRIDGE instead of open-coding the same functionality for the DRM bridge chain termination. Signed-off-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson Acked-by: Bjorn Andersson --- drivers/soc/qcom/Kconfig | 1 + drivers/soc/qcom/pmic_glink_altmode.c | 33 ++++++++------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index b3634e10f6f5..c954001ae79e 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -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 diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index 6f8b2f7ae3cc..cb0db362447c 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -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;