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: 700998 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 1A040EB64DD for ; Sun, 9 Jul 2023 03:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbjGIDsO (ORCPT ); Sat, 8 Jul 2023 23:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbjGIDsN (ORCPT ); Sat, 8 Jul 2023 23:48:13 -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 7852FE50 for ; Sat, 8 Jul 2023 20:48:11 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fb96e2b573so5092049e87.3 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=kbPNwBJklQRefWfAqpdO9QoJ3VHGEQ2JrxCPY/nGQh0RFSwuvmjnAiFZUUFN0BFcJA NsQxLJ7/nTejk3vx6S5YojOkDDO1r4YdP/OWSjOXVNjht4Vfbav1dJpCyt5WWZdS1BjO xwOqCP+gD+8A8Y6AxKWlQjnw4JUAEbhtYjS2XRBvku7rP+rwzrYSec5iCUOUO2tRHSFA lWdpXkBQM59/YgMzSH+NbA0Wa+xylF5sCag7ePJAx49pSwBWMIHKLXauXkbET8G0F2s6 Yl+JIk2cQ0oiC57FItUqvzzEXRKvVojP8ZXdskr8pQR6M7tLqYEnplVHqNEumZszLEyV xUIQ== X-Gm-Message-State: ABy/qLYEFlAJB1YLm2wGNUL8JatJyRa9W8fjlhHlzL6swHqd2NAjISC2 k6BYWpuB+1QJzpHZL9GhAPgCrg== 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-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 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: 701838 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 59F88C001B0 for ; Sun, 9 Jul 2023 03:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbjGIDsQ (ORCPT ); Sat, 8 Jul 2023 23:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbjGIDsN (ORCPT ); Sat, 8 Jul 2023 23:48:13 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0771BE58 for ; Sat, 8 Jul 2023 20:48:12 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b717e9d423so4671371fa.1 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=UQ26IBnm7DBSnRl3I0PbOhbWo4IEBXASlNgyNyUz2u1HH+HAMyeGl6AvfD/UEoPpPB SMF1NgSJkyVwfVLnu/d2QChZKXn/bzbJivKkOx3eES+XhAnpuhUimTCzD8y3nNzbNUEu H9VWqh+aQOGpombTA9mNlHYGRJ9CT7BvuR4rPCjf1Um8t7H/K1oqT0A3uvw8xGOs85jO ohGFnAO3CTJfhECZzcJcULexjgWEkKlrD3dF57NvAv86ALCCufSI+kTrjhigzWC1IofH M7MtSUxp5x/qzxdtcCUhWLcRvl33vYQegnN7epaXGDFBtHBo3qDBZyETkt++6UITbo2W r9Nw== X-Gm-Message-State: ABy/qLbRDengpUTr7DWEMHzbA0XWXZywvQ8uutaMrRyQ1ZHAAfVM56N+ oGpFQbdZu0fBOq/7/fb29jZzfA== 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-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 --- 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);