From patchwork Fri Nov 3 23:03: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: 13445209 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53559C001B0 for ; Fri, 3 Nov 2023 23:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qHEajgZCPU6nBD8IbLQUP4W7Zp182fHyQD/xumHA4bg=; b=hdCv/ZWo8BS7hJ S+meb6WaJNzctkFGh1B7MYsJ9CMCWYl9bnupKihyPRhMGD0dZQryh/Dv2H4CGRJyJM/5OCsDokama kUxUDOnU32a9+pA5PfymVu2TpLXIK1xOqb79cQ2fYhL7An9FLWsh1vxO3EJ4imcukxteYkuj3gaZb KBYMs4t6GR9MraWvyTYyZ07o6A7/lNmhP6MyO6SlCF58C+aFHIVnij1PI6G6YI1473Q/+4K6zjCxf a7damh+3p9O+oq/3Mss41nfT5c2F+f88TlR6qMNe5j5VGE6MZR+qDAduv6d7fJ+PvS+zYFzcAXPJK YEgBgqkejsO7vCX4pkuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qz3DG-00CIOJ-05; Fri, 03 Nov 2023 23:04:26 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qz3DC-00CIJC-3B for linux-phy@lists.infradead.org; Fri, 03 Nov 2023 23:04:24 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5079f9ec8d9so2785682e87.0 for ; Fri, 03 Nov 2023 16:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699052660; x=1699657460; darn=lists.infradead.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=QARkaW3YAHrIEHRWT+FmbK4DkLcRgyf7kmgHichP+rw=; b=DBwLnr5M6nTyilI9O/4AJ4KWH3rNbRr6raF1KKWEoEfLyX4YplnZK1v5aEa04oCByT Luc85XB3u5Eq1Cdn4mxt0UDt21zn/XPARil9d3AMTwQiEXACLJY5Q17u+b18NZb2LrUK I7+o4YpLZei67K0h35fmoerApM6JUYhieSZNtKciZ901qEIW3OojekpLnpPl7cxTEr/a 03uDrel8YtWBQ+6J3NHMirpSmOhzdPDHu9CzaVyHz4ic1jUQYqGeHYEtv0a8X1Ajzgdb 3UuTso+iKXIO5abCt0tn7qp3nfRykz4SrLex9BEfEL6Z/Z15vuaZ+Wa7WyzZjJ7CSwll tUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699052660; x=1699657460; 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=QARkaW3YAHrIEHRWT+FmbK4DkLcRgyf7kmgHichP+rw=; b=MdYzfk/NHCZ7Ocf3VmT2sURNN3zCzlGsz2QRR24ZzCnnaxjSR/zbuWkb36LRtxLd/E pn9iMq1azhnRMHbRON3IinFo9Bg1NsrghgadxTO+HBCMfxH88WN8QqF6v9lVvdzePjua n0Ti6MVQeMpk0XDc6XchBjCaaMQr3+qd2EfC/tdU7cgFb33xeoICAvnzfSuzA/xY6z8r Tc3kOs1NKexYsMNuD6I49sy/thjcT6lvkPubTCZY5xkzJwg8q1W7lsIDzCwLU76chc/O wZ82YAqplbCwq056y//yPIiIyI4I0ZBDszx2o1+Xus0/aQi2Pin4yJSY2xyZu/IjIXHy yfRw== X-Gm-Message-State: AOJu0YxWsXh00exjTdSCUUCXlwzK/fnMM98iU9/SZnEOEM4wY08hvQeU /NiF5qcZIzF16BIinYJVH/xh/w== X-Google-Smtp-Source: AGHT+IHxZ3SwBOE6PCX0jYjbOHiWg1mHD/29WBAeYOQpW39iEwAyMKXLx8WJMBpsaR9rgdUOupSWJA== X-Received: by 2002:a19:8c41:0:b0:500:c00e:8f15 with SMTP id i1-20020a198c41000000b00500c00e8f15mr1391304lfj.16.1699052659811; Fri, 03 Nov 2023 16:04:19 -0700 (PDT) Received: from eriador.lan (dzdqv0yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::8a5]) by smtp.gmail.com with ESMTPSA id s16-20020ac24650000000b00504211d2a7bsm329919lfo.297.2023.11.03.16.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 16:04:19 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Heikki Krogerus , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v6 5/6] soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE Date: Sat, 4 Nov 2023 01:03:08 +0200 Message-ID: <20231103230414.1483428-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231103230414.1483428-1-dmitry.baryshkov@linaro.org> References: <20231103230414.1483428-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_160423_025727_0FCA9E3D X-CRM114-Status: GOOD ( 13.68 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Use the freshly defined DRM_AUX_HPD_BRIDGE instead of open-coding the same functionality for the DRM bridge chain termination. Reviewed-by: Bjorn Andersson Acked-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/Kconfig | 1 + drivers/soc/qcom/pmic_glink_altmode.c | 33 ++++++++------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index b3634e10f6f5..c954001ae79e 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -86,6 +86,7 @@ config QCOM_PMIC_GLINK depends on OF select AUXILIARY_BUS select QCOM_PDR_HELPERS + select DRM_AUX_HPD_BRIDGE help The Qualcomm PMIC GLINK driver provides access, over GLINK, to the USB and battery firmware running on one of the coprocessors in diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index 6f8b2f7ae3cc..cb0db362447c 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -76,7 +76,7 @@ struct pmic_glink_altmode_port { struct work_struct work; - struct drm_bridge bridge; + struct device *bridge; enum typec_orientation orientation; u16 svid; @@ -230,10 +230,10 @@ static void pmic_glink_altmode_worker(struct work_struct *work) else pmic_glink_altmode_enable_usb(altmode, alt_port); - if (alt_port->hpd_state) - drm_bridge_hpd_notify(&alt_port->bridge, connector_status_connected); - else - drm_bridge_hpd_notify(&alt_port->bridge, connector_status_disconnected); + drm_aux_hpd_bridge_notify(alt_port->bridge, + alt_port->hpd_state ? + connector_status_connected : + connector_status_disconnected); pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index); }; @@ -365,16 +365,6 @@ static void pmic_glink_altmode_callback(const void *data, size_t len, void *priv } } -static int pmic_glink_altmode_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 pmic_glink_altmode_bridge_funcs = { - .attach = pmic_glink_altmode_attach, -}; - static void pmic_glink_altmode_put_retimer(void *data) { typec_retimer_put(data); @@ -464,15 +454,10 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, alt_port->index = port; INIT_WORK(&alt_port->work, pmic_glink_altmode_worker); - alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs; - alt_port->bridge.of_node = to_of_node(fwnode); - alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; - alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - - ret = devm_drm_bridge_add(dev, &alt_port->bridge); - if (ret) { + alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode)); + if (IS_ERR(alt_port->bridge)) { fwnode_handle_put(fwnode); - return ret; + return PTR_ERR(alt_port->bridge); } alt_port->dp_alt.svid = USB_TYPEC_DP_SID;