Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2122973rdb; Sun, 3 Dec 2023 03:44:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/jfKr3cAaltsXbabGGE15d10vlfpfDZKtEr7BFF+21eds2Tgw6FBqxZrPE7sN+sYR0sDa X-Received: by 2002:a6b:e807:0:b0:7b4:28f8:15c6 with SMTP id f7-20020a6be807000000b007b428f815c6mr3613411ioh.38.1701603843907; Sun, 03 Dec 2023 03:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701603843; cv=none; d=google.com; s=arc-20160816; b=0aj8TkVXaHkOE4R+L44Gh+uHGGPCWPq4ncS/SfLrbMcLscx1w8dglQtWtQEI3K7BvK sV89HD48UqPp/Mf3zuuELIGc8276foxk0afKHXb0n9wBrjIaBKX09Lnq6mVIfRFuuwZh ZQitfl851rpQnZKjhvJ+Z5N1oygDgfCdH6z/bjlMXj2QVs1EGXW3IFMEZDU5Mq6H5za2 g68/OBkBpnyRPij5IZ3sjADEWkUZaYj6ZmpnJN96JCJtV9TMMizmtzwEvqqGD13DvWYM PR8kxyjykb/lK88wWy9IHyCVSszvJ75b3pb61zHi1aytg6AH2oJBnSF/W2a2oTdoM0OU WeCg== 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=nMbl5DaTa88R8QWO3ldLiDu8WUCRErATauR7weFBowc=; fh=WDFPvueeU8NMCVIXdba5cD9ZhiaQah2KG+InBXx7Yw4=; b=k31MbEeQfDSSse/+SfHrhC6Pf2yRe071aKve5mkRlTq1A0tbtlIXTIv+08QlqCXHhn ZKrWpm8nRyN3JskZIK1GYjA5FVzgH3uFADlFHfRMRvAGmfh6fOCBBBuwSqZq8A+wE0vx vjC7TP2uaLwNB7YtJJHBYJGt+zL8YWDwiiTAMuCUSnV8LuI6DTNG1ZarHSHXzRtICLh6 Wp/ORn94c45g5JYMoq2ozFWoXlQJwfyMQapKnaLPpKN1QlAjWCT1QhRFjzity1bTAD5M sA+BiRFDCHZvweBLSFdzwi6LMDQaVYXQxjns1QUfgxu1Ago1r1oNbaHR0Slu3Hej2Bf5 LTjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gLkM0epy; 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 pg11-20020a17090b1e0b00b00278f6d616aasi843302pjb.71.2023.12.03.03.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:44:03 -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=gLkM0epy; 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 EB84A80981BC; Sun, 3 Dec 2023 03:44:02 -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 S233489AbjLCLnu (ORCPT + 99 others); Sun, 3 Dec 2023 06:43:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233418AbjLCLne (ORCPT ); Sun, 3 Dec 2023 06:43:34 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63168125 for ; Sun, 3 Dec 2023 03:43:40 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2c9f84533beso5856761fa.1 for ; Sun, 03 Dec 2023 03:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603818; x=1702208618; 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=nMbl5DaTa88R8QWO3ldLiDu8WUCRErATauR7weFBowc=; b=gLkM0epy4TjTQ9rb/vv4KeugA58TmsM4mCO4x+qTPxUA3pANQb3DcprRYlyGiDO1AX V5WahZR7/egHbo5osT+YqIJhLNczkD6aXTX3okTp2jDYqD+iB23nQ/OolXklHNBSY6OW FPdmanhvgJlJw0mglXcaXWGcoc5IsD7jrlcFiK1zF+zzR0N6FazmS1e6GvtMD3nEIS3G FA39cgaoWx4pTmm6jDOq/6T/Rq7K7wmDKCudcUQyIazLTtf2cRmuoEtC/zQFqN8L+SwN jUp0bIyhXNYIw6AUVNHFpnnFUI1da414mVcsNp4YxNiCunsFZmj8ib8TZvMzUNRxlfY/ nNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603818; x=1702208618; 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=nMbl5DaTa88R8QWO3ldLiDu8WUCRErATauR7weFBowc=; b=GCkQOrY91q3xxPJyCBaWZ6CS9BMuxqaXEaZbLfZB5559KLPhpM4QmDJJKK/496de94 JhUXizI6uxzk+unH/NXQ/MFPpjjP64PpdvatzfRYY4kmvB3ZwWLIfmtH/aKnwRgndmOg sJ9j6ASMg1solBOHqCN3nGfY+xPejUPkaZJHh+hsYht/Q85jF5YieOS0izFS8iADXOCe BoQZqCAqtdFACiFHmBTKWYDpU7YZj+nW664lnB0ZLp9QfaJKqhdsz0eazkvkcM+P0NM7 LO28rrbNmhb94rRvFiwxf64xs3h1Dryr8Q2epBnxeMxIpfAX6tau3xLakSIP5Pne9s3j nY2A== X-Gm-Message-State: AOJu0YzVdC4kIlzgQ7C24EtRHj72vnrd8tgmQh4i7oY5S2SivxzNOPj8 jpUUZExiNw/ex+rg9zCotoMx6g== X-Received: by 2002:a2e:9d17:0:b0:2c9:fa34:332d with SMTP id t23-20020a2e9d17000000b002c9fa34332dmr220397lji.12.1701603818621; Sun, 03 Dec 2023 03:43:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:37 -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 5/6] soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE Date: Sun, 3 Dec 2023 14:43:32 +0300 Message-Id: <20231203114333.1305826-6-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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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:03 -0800 (PST) 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 b78279e2f54c..053b7393e26a 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; -- 2.39.2