From patchwork Thu Aug 17 15:08:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 714607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5655FC3064E for ; Thu, 17 Aug 2023 15:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352856AbjHQPJV (ORCPT ); Thu, 17 Aug 2023 11:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352915AbjHQPJQ (ORCPT ); Thu, 17 Aug 2023 11:09:16 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B062722 for ; Thu, 17 Aug 2023 08:08:40 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b962c226ceso121396591fa.3 for ; Thu, 17 Aug 2023 08:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692284907; x=1692889707; 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=4ddjcWCgwJaLnL8ww0foMDG3MYHlwLCKKRjeLVlMd+8=; b=NmS12C68Ek6FGxcL41yJMQAPpOLInT4lZJeuT198d6qei9HTL1O5AugK5oiLnbnnNo rb+aJVG3ydOaASzM8WvQMOSdFNtCu0jHGTbDkx2HCi5kL2HEkbJ8orTysaFwQQQNOkbG 2SYp8AIRrFc9u3H+0syt/F0ww+3TX+pPqY98eQBYjR/Z9HkHLmuf4cffRy5WNxSPLRxW ws2UTYL2M1TuSyK2Bp6hVDZLwb/nQpS+3AwqXh+hP984rq0NwsqwsWEVzxCTeEMa/I0u WtVVzmiOqaAnjg8IR5tSVt/WdU1Cs1rkTBEdMCIC81KEraJHwcFv4fZLywOe2X1zgTlH ejXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692284907; x=1692889707; 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=4ddjcWCgwJaLnL8ww0foMDG3MYHlwLCKKRjeLVlMd+8=; b=ek0wPNIs3xZEeo0p8e+S8j7oz+6mOvCvrPt83sPJFju8BUnfFFsmeOa9zLSmUlovTr 6GaImU6AdKwzHMHk0cjmnyVxDRs0SYWEnxIlqbsQzEehJdthY4shK5pbEEvF/J0wUTDO Op+A350Vt1rekED//LgOdphLrKu7YF6MOGbJwFBnx4edHl127XFuq5q3QbOTPcd/laOL geZCXtCRT6tef9srFnnefMlBjRKvFY+gguLLQC1NQGHhT9DdycZWbKZmioWzIC8G470O 0p9usHB7gQG6aA/B+E9FrHh5LSyhO+o+lFAq+tLy8Jxg7jEiPudQAL+3AxYw8rAzl8b0 jkCQ== X-Gm-Message-State: AOJu0YzncQsluY3CY3viE+JX3LI7Hh0DAuhEAaI7wp6rnhiWEJw13N4n oB1xraOhE60bUIL32kn+3cBBt2PM2JiRfYOZeuRaFvmz X-Google-Smtp-Source: AGHT+IH+dUtUNhhf+BxvarcZxUA7ooVgEEkhp9jCXNmwcEXY+Qd+X5hRytpK9tASF6fmVJXVwoesLg== X-Received: by 2002:a05:651c:218:b0:2ba:cbb:47a6 with SMTP id y24-20020a05651c021800b002ba0cbb47a6mr4153573ljn.5.1692284907272; Thu, 17 Aug 2023 08:08:27 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id u8-20020a2e9b08000000b002b6ef2fca66sm4111413lji.41.2023.08.17.08.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 08:08:26 -0700 (PDT) From: Dmitry Baryshkov To: "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/2] usb: typec: altmodes/displayport: add support for embedded DP cases Date: Thu, 17 Aug 2023 18:08:23 +0300 Message-Id: <20230817150824.14371-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230817150824.14371-1-dmitry.baryshkov@linaro.org> References: <20230817150824.14371-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In the embedded cases, the DisplayPort connector is handled by the TCPM itself. It was proposed to add the "displayport" OF property to the DT bindings, but it was rejected in favour of properly describing the electrical signal path using of_graph. Fallback to the controller fwnode for HPD notifications to support such usecases without requiring additional DT properties. Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- drivers/usb/typec/altmodes/displayport.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index bc4af130940d..a4cf1045b535 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -594,7 +594,10 @@ int dp_altmode_probe(struct typec_altmode *alt) alt->ops = &dp_altmode_ops; fwnode = dev_fwnode(alt->dev.parent->parent); /* typec_port fwnode */ - dp->connector_fwnode = fwnode_find_reference(fwnode, "displayport", 0); + if (fwnode_property_present(fwnode, "displayport")) + dp->connector_fwnode = fwnode_find_reference(fwnode, "displayport", 0); + else + dp->connector_fwnode = fwnode_handle_get(fwnode); /* embedded DP */ if (IS_ERR(dp->connector_fwnode)) dp->connector_fwnode = NULL; From patchwork Thu Aug 17 15:08:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 715164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75BCFC3065A for ; Thu, 17 Aug 2023 15:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352864AbjHQPJW (ORCPT ); Thu, 17 Aug 2023 11:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352928AbjHQPJR (ORCPT ); Thu, 17 Aug 2023 11:09:17 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC3730DF for ; Thu, 17 Aug 2023 08:08:44 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b9db1de50cso117816341fa.3 for ; Thu, 17 Aug 2023 08:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692284908; x=1692889708; 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=hZ0C4gM1MGvlXqRM+eWMYuEXR3MLstzhpSuwjlgfvLI=; b=e7/tjJYcUXzJ/fc5afxlyPh2GEoSNtR/Pik/2N83a5bFFYgYpqHPFzRybUOC3aYxRN 0YAkAIX2NkCWmCkzgN3/ElWQFzS5bgm34BzASSAq9ytScx7/9lmEQcm4gTCoPSyw5dmL stBk8pFVBIcyx7hE2sBOg4d+vM0tx2DrfNG1VCph7yamdeID/bpyYB5v2YvZ2jin7Iuu mGbWB+Id7Jrko47BYDtm24ImW9z5mFEgWva65DgzmKUI67dDU9LqdoFXfE3dzq4nbRK7 tBg3kx/vOWc3+VAAIfOJLRaxWFdAXnMGzmxMHR8CcTIF1R9myLRzbqAdUPaexCCEgXD/ TaHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692284908; x=1692889708; 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=hZ0C4gM1MGvlXqRM+eWMYuEXR3MLstzhpSuwjlgfvLI=; b=BfuhWk3HWM1/bpj7ibPeXh7IDBiTXeywHpSAMEDzdo8GoYQjhaTPyDR2xfEH/d9w31 gW7wuZGr6pdqYHqXY51xYPO4fy1QPmT2QuD3aTiUXyGB9sqqSX9IHeX6TZMcHrJcqxgE eeGIuDyEmuBi7rgMB2soQ9rIiXElHljnb0+4PXb6oqjeMNHKLsTFcOrXjwbJgR9kCR4O ywKxpo7kIKGwIi658ZobsWa4g/itsIaBi5zyPiwvf0qYFikAWJ04Bsv1rD4N+5xngQAQ JCv4/yJo3KyVdvbxp40OBCe5VkLDXLAj2BzTWRdNKa0bjiYlrdUWMkC9Efkd6M/Fkiac B4ow== X-Gm-Message-State: AOJu0YyIvN1ww+Gh01AZrNf43bAkkumwgMynrARpNSgkLl9QkL7TPdZC r4UQTbLMFlh0flouy/X7tenb4w== X-Google-Smtp-Source: AGHT+IHCkGizuzzIPtIX5WMAX9krzdeHAXfQZ492o8PeshzyR0meMULw9sDdOM14ds1qMND3CXOeog== X-Received: by 2002:a2e:994b:0:b0:2bb:a28b:58e0 with SMTP id r11-20020a2e994b000000b002bba28b58e0mr2005867ljj.14.1692284908361; Thu, 17 Aug 2023 08:08:28 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id u8-20020a2e9b08000000b002b6ef2fca66sm4111413lji.41.2023.08.17.08.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 08:08:27 -0700 (PDT) From: Dmitry Baryshkov To: "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/2] usb: typec: qcom-pmic-typec: register drm_bridge Date: Thu, 17 Aug 2023 18:08:24 +0300 Message-Id: <20230817150824.14371-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230817150824.14371-1-dmitry.baryshkov@linaro.org> References: <20230817150824.14371-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The current approach to handling DP on bridge-enabled platforms requires a chain of DP bridges up to the USB-C connector. Register a last DRM bridge for such chain. Acked-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/Kconfig | 1 + drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig index 5d393f520fc2..0b2993fef564 100644 --- a/drivers/usb/typec/tcpm/Kconfig +++ b/drivers/usb/typec/tcpm/Kconfig @@ -79,6 +79,7 @@ config TYPEC_WCOVE config TYPEC_QCOM_PMIC tristate "Qualcomm PMIC USB Type-C Port Controller Manager driver" depends on ARCH_QCOM || COMPILE_TEST + depends on DRM || DRM=n help A Type-C port and Power Delivery driver which aggregates two discrete pieces of silicon in the PM8150b PMIC block: the diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index af44ee4e6e86..581199d37b49 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -17,6 +17,9 @@ #include #include #include + +#include + #include "qcom_pmic_typec_pdphy.h" #include "qcom_pmic_typec_port.h" @@ -33,6 +36,7 @@ struct pmic_typec { struct pmic_typec_port *pmic_typec_port; bool vbus_enabled; struct mutex lock; /* VBUS state serialization */ + struct drm_bridge bridge; }; #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc) @@ -146,6 +150,35 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } +#if IS_ENABLED(CONFIG_DRM) +static int qcom_pmic_typec_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 qcom_pmic_typec_bridge_funcs = { + .attach = qcom_pmic_typec_attach, +}; + +static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) +{ + tcpm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; +#ifdef CONFIG_OF + tcpm->bridge.of_node = of_get_child_by_name(tcpm->dev->of_node, "connector"); +#endif + tcpm->bridge.ops = DRM_BRIDGE_OP_HPD; + tcpm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + + return devm_drm_bridge_add(tcpm->dev, &tcpm->bridge); +} +#else +static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) +{ + return 0; +} +#endif + static int qcom_pmic_typec_probe(struct platform_device *pdev) { struct pmic_typec *tcpm; @@ -208,6 +241,10 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); + ret = qcom_pmic_typec_init_drm(tcpm); + if (ret) + return ret; + tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) return -EINVAL;