From patchwork Sun Jul 9 20:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13306107 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 36405C001E0 for ; Sun, 9 Jul 2023 20:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjGIUNP (ORCPT ); Sun, 9 Jul 2023 16:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjGIUNO (ORCPT ); Sun, 9 Jul 2023 16:13:14 -0400 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 ADF6912E for ; Sun, 9 Jul 2023 13:13:12 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b5c231c23aso59119801fa.0 for ; Sun, 09 Jul 2023 13:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688933591; x=1691525591; 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=c7lSjPQNhr0BWjor5LdaN815hU/chfe4hoYUxqnTCAI=; b=T5GzhtTyJjxGyLP24p+UvR8XLrB4NVRE7/XTXnHdYuT77xZjInL1SKJoXJXffjIa3e hUxY+aw8lZWYqavxNLsCk072IIDUzC27HS4WGJjZhXR6GsfqE10BM1LBkwHterRl5vYD ZZpRxt9ZEOzVu8OD6ELJrTwnL7hAce86y6Zu3nEHY41nQRqGO4d2lL6oczaA5sMUXdGZ tTI72OzMVuaNd9VhQlcEkzCJSz3O24Yxw8ShDUL5aJ40jVI19BKcsNB816PUuO2Xrh+A p5v5DPBxmn7jF+kjqdLcVz+cBYXAEdUdI6eg8XjNXCEM+dl+kHMyU/d/B8Rk+6zwPitS WvVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688933591; x=1691525591; 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=c7lSjPQNhr0BWjor5LdaN815hU/chfe4hoYUxqnTCAI=; b=LSM2pq+jwDrqK6GRRD3oDE4HB1ntwaAlFo0B9+SCPJlHUrbgzXiV3wS/t0L6JkFHPx aoRYpMXn8l2klCngh58kOV09+ItamNaB/85qca8G7P+2w0VmhT7VQa8Oe/tHshFJGs9z rVreUnVhb6jzPBgALgFRN+Uuyw8Vnrq0ZGXdNo5l9OEWoOrW3bBxZ1PGKOFkslvT3McJ sAcfErgfM5Zszc6cu+Re8Lz0E4SDiXO7qrfSqy87NebGjE+aKVAyTxu5uSO4ToBcOmNH bYhhl/gCmfA6nUkPT56uh//umA58KMrQjOMtMXdB27+E6vt5VxHtnl7gphjM4JzTLqXI FJVA== X-Gm-Message-State: ABy/qLbVdGj11uWaBELi5qNAUXJwr8hi0F8UmpazUuOLmk4hSCw9g/5Q a26VzwkTWUZyV3KvZijO0jB60g== X-Google-Smtp-Source: APBJJlFZuEiOyJs+Wxo5yotGxmFY/kIczdsa1ko9Q5u26MRMkHnsWnGRIo9a62sNAbznJh5fjeHpqw== X-Received: by 2002:a05:6512:3295:b0:4f8:770f:1b0b with SMTP id p21-20020a056512329500b004f8770f1b0bmr7078397lfe.33.1688933591071; Sun, 09 Jul 2023 13:13:11 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id c12-20020ac2530c000000b004fb77d6cab3sm1420378lfh.261.2023.07.09.13.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 13:13:10 -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 v2 1/2] usb: typec: altmodes/displayport: add support for embedded DP cases Date: Sun, 9 Jul 2023 23:13:08 +0300 Message-Id: <20230709201309.274306-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230709201309.274306-1-dmitry.baryshkov@linaro.org> References: <20230709201309.274306-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. 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 4e5aa17ce4c8..699438c7755e 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 Sun Jul 9 20:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13306106 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 26B89C001B0 for ; Sun, 9 Jul 2023 20:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjGIUNQ (ORCPT ); Sun, 9 Jul 2023 16:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjGIUNP (ORCPT ); Sun, 9 Jul 2023 16:13:15 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F639132 for ; Sun, 9 Jul 2023 13:13:13 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fbcbf4375dso4441315e87.0 for ; Sun, 09 Jul 2023 13:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688933592; x=1691525592; 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=WA1kyr+5gi8wVBQq27truSLCLcCOixtjsbYq8TbHk5o=; b=RxgHzFQV/TWZ8R5SPiK8DcLlBe3SX/+rkewBMUcj4n2kCJR/8C60Iw/USlcoZYXjLB mH3UyXwvcyYtrUbs34pKjSeD2xaT1sBZGGy5OVqXUT/gLQ435YDTKktPMaaeFJCE2WLe ny/LKsqCvy+Jel0jWCFmMXrdXfHPycYj2sDE6ckKZkC7N54BJiKOGfKbg1KIPRDOoTiB 34dq63AoOph46rMHIx1vUJgjg0IdXEyfyNkwkwUjBUP++y1ISel6QZEHbeO5S0MlDTNV piDSj6QgbonE6GrJvAvo891JMDT5u75rwprntRAvNRAJgZmAfxIQ09vMwVZLdluXVOC9 bQLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688933592; x=1691525592; 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=WA1kyr+5gi8wVBQq27truSLCLcCOixtjsbYq8TbHk5o=; b=X6vmLjiNZhANV612/vEJTwME4EXzJPKqMvUS+KG6kJBzcka/S4qSJ0bnu8w1sUQGEK /YXDjlHR0gk6lkDZDb637EhOFfN6mAsmlsSF8Tnozxq3OHuz9LIWLWHQRs1a0f+aWR6v R3kqrD4mpdcW/eBqRS+GBBAgcWB2AcUj5V5eWz8ONKw7+ZjY6VOooczyUXBMnrtt7M8+ IMj8AOub8aPuXhK60nOirHmZCNPFza8cAmUWnVPmDIUyO+OE5BJFE7eHZ8XZt0TmY4bi 6W5B4lryVmrKzlGP3MSYmel6++PEOGjdNvNureOHVBDmpWLjLZ9TpqwOLTTrxci6P6Z7 Ks0w== X-Gm-Message-State: ABy/qLYgq7gsCVW9S3KxG/2WYZbA4LJ8eA9NInYqyleq4DOXjfoMj0q2 Lez7oj686BzlyR1oPDy+FEll6g== X-Google-Smtp-Source: APBJJlGeqDYei5cft5PMP/m5vV3TDpr4OYU84Zf3OoRCAr1nK1Jed/uealwGZ7MMNYE1s7YyZFtEVQ== X-Received: by 2002:a05:6512:2528:b0:4fa:d522:a38f with SMTP id be40-20020a056512252800b004fad522a38fmr4231630lfb.26.1688933591924; Sun, 09 Jul 2023 13:13:11 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id c12-20020ac2530c000000b004fb77d6cab3sm1420378lfh.261.2023.07.09.13.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 13:13:11 -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 v2 2/2] usb: typec: qcom-pmic-typec: register drm_bridge Date: Sun, 9 Jul 2023 23:13:09 +0300 Message-Id: <20230709201309.274306-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230709201309.274306-1-dmitry.baryshkov@linaro.org> References: <20230709201309.274306-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. Signed-off-by: Dmitry Baryshkov Acked-by: Bryan O'Donoghue --- drivers/usb/typec/tcpm/Kconfig | 1 + drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 39 +++++++++++++++++++ 2 files changed, 40 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 a905160dd860..0722fb8d75c4 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,9 @@ struct pmic_typec { struct pmic_typec_port *pmic_typec_port; bool vbus_enabled; struct mutex lock; /* VBUS state serialization */ +#ifdef CONFIG_DRM + struct drm_bridge bridge; +#endif }; #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc) @@ -146,6 +152,35 @@ 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; +#if 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_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 +243,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 (IS_ERR(tcpm->tcpc.fwnode)) return PTR_ERR(tcpm->tcpc.fwnode);