Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2122994rdb; Sun, 3 Dec 2023 03:44:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCiR0Z8ppdFi9gJfPMRCbdLxT3KqK8AYJ6iO1ddKqMMIXaVf15tDjdv0BkjTkgyOpGH5/r X-Received: by 2002:a05:6a20:8611:b0:18f:97c:8a48 with SMTP id l17-20020a056a20861100b0018f097c8a48mr2344521pze.115.1701603847419; Sun, 03 Dec 2023 03:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701603847; cv=none; d=google.com; s=arc-20160816; b=QgCotQ02LMBPZi0zm3DYIXOikkcrJjKQznINNocMcFM4ziUCrV7P2rxmKu3dxpnGtT c89iS24pZD8+H498Q5lG7iVYQETtbOyzDDGh9GPlDqE230BFJVx8X5dlUo3cm8OnYyeD Ixe+nikmpB62Msf0zqAy3oM4Ppn8Lac3gRVLV9M4TxlqT9F0LGmtFTPFnhKH5lalWr3i xZQ2qcpbwDg9EVVyQHX7RCkAV+7Ylrx1FsWiAbueq/IhIaPPpqgTYD+eu0ahA0yTFxDu wqtscAOVdj9X9EeNSm4XENORAyeTVNr7EkJpI5b9Y93WCVE1PJvx1pSurX+Y7OCoSNH1 J9gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UKrvC1va3zOXcp6YVKcTFgaHzs/W3SOKPJn+fUfNRVg=; fh=WDFPvueeU8NMCVIXdba5cD9ZhiaQah2KG+InBXx7Yw4=; b=qpKtNc4G4Kk5viMIqJNOkMee+2IJUmPmeOsEK5NdtmYJroaxmiXUIxjm9xyxnVMOVp S3bz/CDgcp07mH542q1jQn3NDpA6CXqAY8sAF9Iixtbr//PkA/jTB+Fajc/f9b26RDTg i1wJT26h4scEhQz9JaigXD9BQqNJvdtLGAA/mITEk+VFeG/h/E5yT6ziYKPBBsKDHUem n/lQQJuwarS8UkW26JtxQCdGzPuNluCESOrbMVUiOxSZWUFSsMVOAwaoyYFr5Yq0q/RU BnAPjmRGvPNt4AEi3Gvek7hqAgHblfXMXA//QMn3GzQjlyCMzMSxBGNhRPRoyIxT9aiU S1zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1CtVHMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d2-20020a056a00244200b006cda14566f1si6244885pfj.150.2023.12.03.03.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:44:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1CtVHMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 58057809848C; Sun, 3 Dec 2023 03:44:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233502AbjLCLny (ORCPT + 99 others); Sun, 3 Dec 2023 06:43:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbjLCLng (ORCPT ); Sun, 3 Dec 2023 06:43:36 -0500 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 3BC03FF for ; Sun, 3 Dec 2023 03:43:41 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2c9b956c68cso37426321fa.1 for ; Sun, 03 Dec 2023 03:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603819; x=1702208619; darn=vger.kernel.org; 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=UKrvC1va3zOXcp6YVKcTFgaHzs/W3SOKPJn+fUfNRVg=; b=i1CtVHMj1QPOlv60fO4WklXqp9md/WEZC/PBPskl+OMw7P6dtoPu5WYVA+h+/6fsJz wLb36uYV/PIhgsAogmCzM6NB6W1poUmKTcnU7FZwC/3LyqChWvMMBqF2uw/rXBzRrCDW +/v9pBOmTazCAp9iNPhthh/Bfvq/KOq/2Jt0TQm5y1Oo+XmBDxtnOLrIVyIbU8dzc6vH wRzLulK0RBIOAa/P2DE+WtzCsZ5qzYRJOzxKmxuJ5NzXbL4UudCS4+/o6lutqtOpLv71 AQlTEjG/X8acvHAEwlKjVmqDMVCYM8InhQKkZFU7wobczH9/SEFYn5GFw+aQH4j4bq39 H4AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603819; x=1702208619; 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=UKrvC1va3zOXcp6YVKcTFgaHzs/W3SOKPJn+fUfNRVg=; b=HpNWiqahjykbWpQJpNfm4P4TA9YwbMAuA+mb8Ukm+AW4u8XNE4X5YHU4aVfwr99wsp p6E6ZkGfglMoERYdxcL//GnxY1Vw54chn80ZeXT9aoTiSuL4+7l+LJzhe4l4UYOMmnvJ 6GBTM85BPANUblma/+43aOX6a+GIjTf09YNE9jiYIDndNPGb77EEmTzRCMkZ3LU+u9ty 7wV/aUW3kuT3Lhy+6MmEz6NoEDfH97NA8Imds6/Lb/Ylyd4/FFRlJ5CciLBZrzhtL0Dl 52C34uML+pnylHieEoEd2hSzvy3IT9qvXeMDGMufoUt6XmYMzq20gVTnm2xtMMI1d3lt AeAw== X-Gm-Message-State: AOJu0YzvoRwyUJLavBrJUKuJgBLlMbgj3syNw4zpkXsdkwtud3BGQKE/ RIwYqmGqvi2UKMdwHrrbcCivrA== X-Received: by 2002:a2e:8751:0:b0:2c9:f8fa:f1cb with SMTP id q17-20020a2e8751000000b002c9f8faf1cbmr520349ljj.23.1701603819537; Sun, 03 Dec 2023 03:43:39 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o17-20020a2e90d1000000b002c993c5d4c6sm894666ljg.105.2023.12.03.03.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:39 -0800 (PST) From: Dmitry Baryshkov To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH RESEND 6/6] usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE Date: Sun, 3 Dec 2023 14:43:33 +0300 Message-Id: <20231203114333.1305826-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> References: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 03 Dec 2023 03:44:06 -0800 (PST) Use the freshly defined DRM_AUX_HPD_BRIDGE instead of open-coding the same functionality for the DRM bridge chain termination. 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 | 41 +++---------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig index 0b2993fef564..64d5421c69e6 100644 --- a/drivers/usb/typec/tcpm/Kconfig +++ b/drivers/usb/typec/tcpm/Kconfig @@ -80,6 +80,7 @@ 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 + select DRM_AUX_HPD_BRIDGE if DRM_BRIDGE 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 581199d37b49..1a2b4bddaa97 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include "qcom_pmic_typec_pdphy.h" #include "qcom_pmic_typec_port.h" @@ -36,7 +36,6 @@ 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) @@ -150,35 +149,6 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } -#if IS_ENABLED(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; -#ifdef 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_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; @@ -186,6 +156,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct pmic_typec_resources *res; struct regmap *regmap; + struct device *bridge_dev; u32 base[2]; int ret; @@ -241,14 +212,14 @@ 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; + bridge_dev = drm_dp_hpd_bridge_register(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); + if (IS_ERR(bridge_dev)) + return PTR_ERR(bridge_dev); + tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc); if (IS_ERR(tcpm->tcpm_port)) { ret = PTR_ERR(tcpm->tcpm_port); -- 2.39.2