From patchwork Fri Jul 28 10:08:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13331617 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 6C184C001E0 for ; Fri, 28 Jul 2023 10:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235445AbjG1KJF (ORCPT ); Fri, 28 Jul 2023 06:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235395AbjG1KJD (ORCPT ); Fri, 28 Jul 2023 06:09:03 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDCE35A9 for ; Fri, 28 Jul 2023 03:09:02 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fe05fbe250so3320960e87.0 for ; Fri, 28 Jul 2023 03:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690538940; x=1691143740; 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=dbVUYvlsmxwElbn4bcO2JD0LdaBLJryli+XervF+09lsRIxfFCxEJSsZpgrQssOgsX bw28dzjPl2jv/VklY82FidURfubXTX8HV3EWeg/ClnksNx8CdItpuia7MHry03Ts0I3e ouMkPOyugZmLPVCAC26FlrsybVnb18WvEtAZBIP2ysGVGDPQPXfGH7WvisT+FXC80du+ F0F61Dekmg+eSuaHTVwLvPzMaVifrlEsXwIbLIgulRYfTD4mBXLWWuPzgkZtqI/19ZgH PH/5TH0XLUvZyQ9saogsTxg6/NBX6OIm/XWvG28U/HAVtyhfzHKjxKBuUBsq3eVtc1dL px9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690538940; x=1691143740; 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=PD3aJK1D981Ux2byv4fn1NXtvc+ntUs4XNKTldZ2TIah+gnaSPWhbg0Qs6Plb2I361 Xq57gBZ5bEhwh1B0ApZ6wquhq0ScIEiNqEg8sYDQyCatGJMtRe7XYf1Bdc+GtIRqr6PJ dqYkWn5wQgiyQc4r1tx3FWZLPYMtpBOcXX1tUNE5WrqOnW/1T+A7kgrGjT7J2q9geY6M HwYSFKu1t0oO2Xwe1lwh4nQnSA6sPZG0Zk10/dqsIxSUFu6ztckY0mmncyY3B9r27JFF +H1KJQqN4ge5sXYwsbgQHchz8nlvfbssmNrR9Aq7ObuuEltXpGqz68i+ZtMic6OkJ/Ux 7ubA== X-Gm-Message-State: ABy/qLZTPyX06XntoxKsJec0pMIwOC7snfZ9jA220s3HW9Hk8DARWf6A U7bPiB0Wkt0mke7hi8DCzD+hjQ== X-Google-Smtp-Source: APBJJlEfILIhP5ot4LQTaeb0Ra1phmwRasCbohQ4Dqjz1wikHTwVX3V+dIS/l8+SueD8SM/DBjJydA== X-Received: by 2002:a05:6512:78c:b0:4f8:5e21:a3a9 with SMTP id x12-20020a056512078c00b004f85e21a3a9mr1229831lfr.45.1690538940442; Fri, 28 Jul 2023 03:09:00 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id h16-20020ac25970000000b004fe0de39fddsm741704lfp.290.2023.07.28.03.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 03:08:59 -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 v3 1/2] usb: typec: altmodes/displayport: add support for embedded DP cases Date: Fri, 28 Jul 2023 13:08:56 +0300 Message-Id: <20230728100857.471984-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230728100857.471984-1-dmitry.baryshkov@linaro.org> References: <20230728100857.471984-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 10:08:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13331618 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 79E5CC04E69 for ; Fri, 28 Jul 2023 10:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235610AbjG1KJH (ORCPT ); Fri, 28 Jul 2023 06:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235423AbjG1KJE (ORCPT ); Fri, 28 Jul 2023 06:09:04 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F22A35BF for ; Fri, 28 Jul 2023 03:09:03 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4fe15bfb1adso3252085e87.0 for ; Fri, 28 Jul 2023 03:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690538941; x=1691143741; 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=GeuHcSlwr8k7ZjEttcrBe2bsInJmNS0h0EGzA/qhp2s=; b=WrqZTOfmFipQa3LmSX2vMNshbaJ2oTrq3ydUn/mUOqq91xR03OJ+FWu1P94kJw9pUH s97M9OzbvZHXFIYCGLky0XESYeAc1gENW5nj2lBGJvojMOp1xdpu3LG9xInsw69p0U/U y79+kw/vTtGmzeuXP/l4MkA0Thg4CCQm0yuO704QUawEkVY7xasCfs1P5/bFKUmt+C8E HvYGKBm75l2zfGFD3BLphvzR6xSzyYC7cY+jXexbrJiTOeJquGvK6vozOnX8SYIBXRUW vQgkUg+zzUcz+QtBeYVj8Cnitm0Yuu16yACG0DlsJpMVel3ucqID7tA8Q6cdYuCM6Aya Bk8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690538941; x=1691143741; 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=GeuHcSlwr8k7ZjEttcrBe2bsInJmNS0h0EGzA/qhp2s=; b=dKosNnUgHL2xW/M9+2sZf5eTySv2N5Y5gEhbMFaA8ZZ3K7QccSYLkXmxf5vIeRU3zZ LWf1vbZ/9fZ/b6DM6v0ZN92ipqEBBWeVg5NTLD5U/l7kVXCVvjFrqOVX4v3t3eI8LCzi kT4IKYOE6hZKQkyMrOGxc9qFvVVMBo34Q186tRmaJKWz4Z0CzEp2eH9SSfyQjFiOIRfu OeNhwENbbx33lfStYDgKpkfGbGpfykXeC1CQ2qTxJB4yJoOKcWNG1qbjetxyhpjCmWxh sEEkfPGUDQLQrAoVpJti/STeN6OQEQu636XwAGXu7alVl9BpIh5ViEPkyPoedvqcGbn6 1cEQ== X-Gm-Message-State: ABy/qLZxHQsNB1VeZ8mRoX+7WaiGgSbKNas84jgWcyeWdHYiwuwt4SS+ kXQJy34tXPsrhX7h2ICVIJhOVQ== X-Google-Smtp-Source: APBJJlGJhXZDa07Yt1+xaZ+RDBvdJhY4SzD6ngnP/kTRnzjRJL9dBiK4NJ/vDrGnNKWuZ8FAlNXANg== X-Received: by 2002:a19:4f4c:0:b0:4fc:4f3e:9cbf with SMTP id a12-20020a194f4c000000b004fc4f3e9cbfmr1165284lfk.50.1690538941541; Fri, 28 Jul 2023 03:09:01 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id h16-20020ac25970000000b004fe0de39fddsm741704lfp.290.2023.07.28.03.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 03:09:00 -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 v3 2/2] usb: typec: qcom-pmic-typec: register drm_bridge Date: Fri, 28 Jul 2023 13:08:57 +0300 Message-Id: <20230728100857.471984-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230728100857.471984-1-dmitry.baryshkov@linaro.org> References: <20230728100857.471984-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..bf6f504d2160 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_USB; + + 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;