From patchwork Fri Jul 28 11:09:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13331716 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 86A0CC001DE for ; Fri, 28 Jul 2023 11:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236171AbjG1LJt (ORCPT ); Fri, 28 Jul 2023 07:09:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236149AbjG1LJs (ORCPT ); Fri, 28 Jul 2023 07:09:48 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0FB02727 for ; Fri, 28 Jul 2023 04:09:45 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4fcd615d7d6so3372798e87.3 for ; Fri, 28 Jul 2023 04:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690542584; x=1691147384; 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=CspJ1Q+2LosEzKqDlXYExoY3sG/z+p7xYAQPInOGC34=; b=ewdWI7HtFVt+Vy3k+KCOVsfT0qkmuc5UXfntmc/5BhslLaNuno1VvpEbP79UDK0TEN KJ1N3MOh8yDj+6EGxDIeCFdSV9RFXP+Nvs4V2MITJCQgGsYhXZi1reHyaaTAnjXN2aqC xQBwToefEKB9ixgrIBHbG3Zxr17l0JBcRD6VyoePM9Mcr/25SGdFkdt8lG9JDfcbzU0h A0QO6OoiT0kxf20TPL+7NshxoQfznsElCJ1gN+bh1KLSBc30hLe56MmKyg1gxCTeUoTL unZLYPpA4NcbKxtlsffAHw23rN0Fj/kiAxq2qMi3/ptBoU7zcs/7KvuJUpGEl+Xq5mNH VBgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690542584; x=1691147384; 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=CspJ1Q+2LosEzKqDlXYExoY3sG/z+p7xYAQPInOGC34=; b=Vf7psP/pliWUK8vuxw8kE4V3EYa4cA8/FrmR1OavVIXDku/81ZwlzqOPQq3P+gk0vl 9SlESjZn/GKH/+TWOSiUFOCiTfwrnHXurOOLWe8qd9CAOtVjnI+QGyqLyPMPO5hZKDAW nr4KBQzKbQQsx6g2wUwEAjrbFuOph2ZYs57mbUZNPoMpJcsEcuSiuJhibQbHrcVlJ3QV QK1LAx6iytKQEoEpZJ1l+K9pqZvdrEaNOzHN4QaSF5Thxwy6mYLejFP2IswZ4jBaPrNF GYWebctLb5kzpLEXXDH7zVAzW9fPnbTJnmv6AqTn6QA+el/7vu+T8bSvRwP1XP1pkulg wUww== X-Gm-Message-State: ABy/qLbuYaJlDbWJaZ1cD0jL6XfJUZdGPYlfayc7At0ST85ziuezRV8V /CvlUC7dodabu+LrbrtgUgZrIw== X-Google-Smtp-Source: APBJJlGPo6otdvbNpb6PPOVqJHoECkI7+9NbxwMBipH4J83WRCsY5+S7f+PfklXFUlp6M330NYT+aQ== X-Received: by 2002:ac2:499c:0:b0:4fb:242:6dfa with SMTP id f28-20020ac2499c000000b004fb02426dfamr1328866lfl.57.1690542584328; Fri, 28 Jul 2023 04:09:44 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id v11-20020a056512096b00b004fdc5557a70sm759854lft.141.2023.07.28.04.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 04:09:43 -0700 (PDT) From: Dmitry Baryshkov To: Heikki Krogerus , Greg Kroah-Hartman , Bryan O'Donoghue , Guenter Roeck , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 1/2] usb: typec: altmodes/displayport: add support for embedded DP cases Date: Fri, 28 Jul 2023 14:09:41 +0300 Message-Id: <20230728110942.485358-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230728110942.485358-1-dmitry.baryshkov@linaro.org> References: <20230728110942.485358-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 --- 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 dc2d3a83dc26..76c3e2f8e117 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -578,7 +578,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 Fri Jul 28 11:09:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13331717 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 94548C001E0 for ; Fri, 28 Jul 2023 11:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236153AbjG1LJu (ORCPT ); Fri, 28 Jul 2023 07:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236152AbjG1LJt (ORCPT ); Fri, 28 Jul 2023 07:09:49 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 209DE3A95 for ; Fri, 28 Jul 2023 04:09:46 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4fe216edaf7so551509e87.0 for ; Fri, 28 Jul 2023 04:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690542585; x=1691147385; 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=klthd6vAZO8COPYLdUmNjwbf5hPeD+fKJf2Tr1rWU5s=; b=qzoI7aDGs6Icvzs1VL++YFRxBZAQ/CSpMZ+nRP4xzxPQrNllm6WKvFFsjv87CiKRlO Gzm9ZPSG7uxRGoB75hpB2HvPvrver8hVzxrVHx2ikfyb3Wgoq0Pjo2mwRx3YsitRPIt6 eBuwqeBgSZjofhfCJe7oyJ1ieYQEI+sGoUl7TwQP41F1Rbx8OM5FRtme4w+OfDyFb9X0 juU+zysMLfalcpjyBTU5vkUTxSngXW3ChNnow3xtYQysmfED/QGydCegDS7q/wjb6xY1 8az23JKCFKVpqzBxKkFsPs6Xn/3kuktvAfGohu4MYkkCbXASy9pMhE/o90w+qrcmP/Us XuIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690542585; x=1691147385; 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=klthd6vAZO8COPYLdUmNjwbf5hPeD+fKJf2Tr1rWU5s=; b=SChhtHr9tEKxX7HUI/XPkElh69bfpEV3URopGs/V//atvMTziHBY1hnsd7IiiuMpj5 r3EQeVW5JuuXhy7RTHrSMGrJwpSL0dWH+B9Q55BWHtYBW5f99SO49VLgRnis2QV1ksql Zb5XHqvLetOd4uc2O0/rNBNMKLGTenGnblH7sqYcuoxowLlHjoym/EgY7H17YJCAUW0H /CcMpr7cMNL5mxi3fttLMO/9TegNkY6QZwhkSVYjjdEmZC5KFFfHDp1gaNMvN37oo1rN pSdNE/SASxnS4xBeYvMf8JP/ov7gkgvENQMmqBRTvhUZZDviNRBZQKoo0tYnnvcrwrGN R5Pg== X-Gm-Message-State: ABy/qLbuksiaA95N0Pib6uy3/CMuw9JIaf72uARbmDLBrR7+M9KvhE5W scWMOzvUh74JqJ4dCCx1cC+KrA== X-Google-Smtp-Source: APBJJlFusFJBmXpetb2rNKn22mRzVB1nKAAqvRO40U27Jprw3SApjUkSFuzZJP+swFiOqPjd80NJFw== X-Received: by 2002:a05:6512:3246:b0:4f9:5693:3d2c with SMTP id c6-20020a056512324600b004f956933d2cmr748279lfr.34.1690542585211; Fri, 28 Jul 2023 04:09:45 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id v11-20020a056512096b00b004fdc5557a70sm759854lft.141.2023.07.28.04.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 04:09:44 -0700 (PDT) From: Dmitry Baryshkov To: Heikki Krogerus , Greg Kroah-Hartman , Bryan O'Donoghue , Guenter Roeck , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 2/2] usb: typec: qcom-pmic-typec: register drm_bridge Date: Fri, 28 Jul 2023 14:09:42 +0300 Message-Id: <20230728110942.485358-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230728110942.485358-1-dmitry.baryshkov@linaro.org> References: <20230728110942.485358-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 | 35 +++++++++++++++++++ 2 files changed, 36 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..0ea7cc656089 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,33 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } +#ifdef 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; + tcpm->bridge.of_node = of_get_child_by_name(tcpm->dev->of_node, "connector"); + 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 +239,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;