From patchwork Sun Jul 9 03:48:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 700943 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 67C71EB64DD for ; Sun, 9 Jul 2023 03:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229953AbjGIDsO (ORCPT ); Sat, 8 Jul 2023 23:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbjGIDsM (ORCPT ); Sat, 8 Jul 2023 23:48:12 -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 78418E4E for ; Sat, 8 Jul 2023 20:48:11 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so5087687e87.2 for ; Sat, 08 Jul 2023 20:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688874489; x=1691466489; 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=k3IRY5xwt8qJIv7SfJiV73BLBZgOE7DBWFEiap7mJyO/HbBphYtUffF1Jlup/HJrEs /JjyZzFYlvaXKS9K0P433ZpGG7vnO6bVweICxU7jBwIn8ZtljMASfo8Om07veq/h9ZGK sQIkamitoxVnF8DeYjDEvD4mHNcq4CEG9z3V/4/KDIbk7/0IqhDgKc9HLOH2XgQFkGQo cN0JwDH0qY6DAWunwHNTrQFlThCKDvI2KQ+P50qQbvO4KZ+DnBMxU9WIyJ3KEqyTJwE4 6xKmkeIQmeJZ/kYdXwvaZBLJ844U7JCjAiEFAqoaFZV1no/uRpF41v5qpTBY3j/lC620 fK5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688874489; x=1691466489; 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=e09y+zG4LryeT1lr1KLdMm5ERUG0Sz5xoxiJViHobx/79AoyyoFX6H8AgbDHKKZC6n 3jH0fSQ36VI3CaFBE544gFsA8fruGpgutg6bv1l/c/g7pE2UYhbWjcwuVck/ZXGXzVby U4sxheD9w+uSyXfK3+7cR2e7JI6d+vGO0jloucU0Xawj+UYBSbj5vPYjz08OEyN/E/qo RAdzgNWmkxOMzkWgKMj4NEcec92lVzWWjxW2Q1o8bEicwYKQr7oH83qOe4stP90IS/fv gCm5aVpFtnYv0C28zMBCM6ytIx0ZZLulyRbOEJGWmP69kFOBxcMeAxNmdjU+WIfCoRn3 JDBQ== X-Gm-Message-State: ABy/qLbGGQTnC2E9LX2Iu5u9CHUgOFDKOy1/3O/MWLmXiMvOP5Cvuyhg fJpw+WzP/h/89DlOw9P1323gjuNnZQF1PqOdI8c= X-Google-Smtp-Source: APBJJlGBWLJww4zVZJn5slMiO1WRJFBNn0Jw1gOm5v8j+Z/fPCJHt1d9NrO2xEnhmnI4idxJcFQ0iw== X-Received: by 2002:a19:e059:0:b0:4f8:6d54:72f9 with SMTP id g25-20020a19e059000000b004f86d5472f9mr6239729lfj.61.1688874489726; Sat, 08 Jul 2023 20:48:09 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id u23-20020a2e9b17000000b002b70206cd45sm1398633lji.90.2023.07.08.20.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jul 2023 20:48:09 -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 1/2] usb: typec: altmodes/displayport: add support for embedded DP cases Date: Sun, 9 Jul 2023 06:48:07 +0300 Message-Id: <20230709034808.4049383-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230709034808.4049383-1-dmitry.baryshkov@linaro.org> References: <20230709034808.4049383-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 03:48: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: 701175 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 CA655C001B0 for ; Sun, 9 Jul 2023 03:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbjGIDsO (ORCPT ); Sat, 8 Jul 2023 23:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbjGIDsN (ORCPT ); Sat, 8 Jul 2023 23:48:13 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06296E51 for ; Sat, 8 Jul 2023 20:48:12 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b5c2433134so41531921fa.0 for ; Sat, 08 Jul 2023 20:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688874490; x=1691466490; 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=9pYCYaD1I9NzXxuURGxzFdIQMsoW5k/5IxfRvjuLiHQ=; b=ZyPoV8VuNEvccc+hchM2pV6o8vTlDW1fWllTLYlBPNPdfOWULamhpXnfM9RqU8+Rv8 Nh4VQ/qEJ31/7gfzz29xep2rxDobhZqI+YQLk3TXyylAyJLs2PqASFqiuTBQufvwfSc8 hi0ViseEb36NIaUgo40Q0kZUWsgojp/RZc9c5zOV+RSY4wq7cOd/LhybO1+qXPBonSfo UGOqQsV8NKhAgJH091u85RjIZBSgAfcSHmfKoa3G2P1RQGn7pSpsvu4xwk9uFM24q9M4 g4euo0l0gzByhVXZF9YkYGMIcNI0Oij+lFnLVOASE08O5+zEQ9TGuEc2GP15VI07Hf9g 3Bkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688874490; x=1691466490; 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=9pYCYaD1I9NzXxuURGxzFdIQMsoW5k/5IxfRvjuLiHQ=; b=KYdeL0VERsFZ8lk1fdDUAln8+a2CFQsZJNpUokwSsQnKMT8r6NCiGvwUCMk151mefm n5Jhzr++4eu/1SJHP61Oz3zgok44Pdat3OY0r32Z5WDL+Yhd1ktqlkke4POfBUSJNyXt Kr+WwZPZpk8P3Mdmo8kjwQgNd1bjPx8CKCVz0tjTADHy/kHIbnWd0k5HGJ73VFfOT2aW z2vJcOmDKXAgFuBtJ6TbSMzSIGhw7UYmJPMHu0eh03dEbz8lYgTaw9WG/+ToF0arr8vC cl1kq5xVi4EFw9WIG3x/P5NlSHf34hCBOs6Pg5ZM9VvUJr5AG1awLmO/EUMzic6nhKVU U15g== X-Gm-Message-State: ABy/qLbMNdUYVMHYO5THs4sJ+fmEl2gfE5hvqLhgCaPkbXsB9EnNIy05 XNlIn42jDJhg5nMlr32O49Cz/Q== X-Google-Smtp-Source: APBJJlGpQHNclYa9samGTpOPC2huFZCJkKbTh7Lxrme1df9/NO10/U3dJhp/jvqWu6VUBS7HAXXP8w== X-Received: by 2002:a2e:9086:0:b0:2b6:eceb:9b8 with SMTP id l6-20020a2e9086000000b002b6eceb09b8mr3593555ljg.10.1688874490407; Sat, 08 Jul 2023 20:48:10 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id u23-20020a2e9b17000000b002b70206cd45sm1398633lji.90.2023.07.08.20.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jul 2023 20:48: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 2/2] usb: typec: qcom-pmic-typec: register drm_bridge Date: Sun, 9 Jul 2023 06:48:08 +0300 Message-Id: <20230709034808.4049383-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230709034808.4049383-1-dmitry.baryshkov@linaro.org> References: <20230709034808.4049383-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index a905160dd860..ca832a28176e 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,16 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } +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_probe(struct platform_device *pdev) { struct pmic_typec *tcpm; @@ -208,6 +222,17 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); + tcpm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; +#if CONFIG_OF + tcpm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector"); +#endif + tcpm->bridge.ops = DRM_BRIDGE_OP_HPD; + tcpm->bridge.type = DRM_MODE_CONNECTOR_USB; + + ret = devm_drm_bridge_add(dev, &tcpm->bridge); + 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);