From patchwork Sat Mar 9 15:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779504 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 473BA44366 for ; Sat, 9 Mar 2024 15:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996952; cv=none; b=g6wwPNXiDnfBWMvPtWAfNrlRow64HGH9qZbeklmHiPAz5Dyd3zuFKwA4K8o3QMOSmV1udm+OGYU/NXtJWQL0ALOtSrrNP4+fIQN8DeI5s/mZt5kVFhR8XbCmNUku9g0xMBT8JrCV3zMRscC0W+noWd3uOlyc5n+X5Tni30A6Blk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996952; c=relaxed/simple; bh=25sj2EpAUs4CVgh43hLR16WG/PkkmsNSMdc3g9mxl2I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t/fGvTl4MoPXs3L/wSCyzxnzaOjhwVdifE0Pbx3fNqFxpGptXji+IaEcItWLFVI6Qe+mf2QId8UnRD4MvB1WJPWP4bDvjZybGqQZuP1JO1rnbviY/2S/eaOTNNeNPLME0nLBR9NUGxFvUYPkFRAAidxEA5aFIpGLdU3IeCOcwPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=U0YSiaf4; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U0YSiaf4" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d40fe2181dso21084011fa.1 for ; Sat, 09 Mar 2024 07:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709996948; x=1710601748; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=aDBr2FAG34D/nO8EL2D1pYlW3kGuhkxGNLEsghBUPo4=; b=U0YSiaf4zIBwa3mQ7e9LL1C7szTm4fPmxAdPdMADDZM/coeNbfW2nG8hjdsn1xJkPz pA/wkultan92nvE/ORGVRJndb222CxTR0j2EDE3orbohAJmewQP2ix/F6b20VYcnuUUV fgW2PXh55OBA7lCEAgIHr//DAP2d9Jm9JsbVczKeMDaWrGLHFDtUPRRMdXrWTxiru1B8 MCor3hDQy9aNvbx3e7zhND8er4FIR6b8bl7AvNnUnHgz0tpinn6EUSvBoLdLP5WxMd2f q8oJ9PfXQ4VHVJZXdQMbxF65Zjyl/YPCXAKfj6NJlqDsWytaAnDUaLKBbOpYeZWFK5ev wLeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709996948; x=1710601748; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aDBr2FAG34D/nO8EL2D1pYlW3kGuhkxGNLEsghBUPo4=; b=fbuOPh0voaCoUzYFsmTZjeTUjRx39MT4KQRmNxYFhhfxX7Tgj6RvrxqffElJVMrb1a DzVjpzYeoPIScNAsV/GVJIgbUjlpZN+vW6pfE4dQHvcXHWQJgrR0Fiy88AX73OoCN5Wh 21i3GLQWLDnbGxySe5evN2rplUHGfNs3C7poC69FG98AZg4PP05vSIadRV92cG0fuMYK pw9iePRcGMOLrGEWG2qqsowbkvFChyLtgEdDUOTEU2cWN6o4iHAq2PJH1Y8e309JXvdT oEhvLq1gN8vqaZzC/B6PPv7ZIzYmWPWs0N7lH3ge0zSIhS1nM0ooljrci8zkt1c+x5xy TaUw== X-Gm-Message-State: AOJu0YyeQXa931ESZfGQAQbOio2ve8SNCtCh/JK6ol7F63GyzbN1ykbj Aa1eIZGy4hiIIcmIZ8u/1u3WOmqp9kjRM6AVkNiz/+B4ZODK5dMplvkqqlk7ems= X-Google-Smtp-Source: AGHT+IEPT352wtTz9iAipTw3WZyhnuQwbR41TmyOH1p5I8NW7VTHUCkkrju+IO+M+E5Komq4fBWr9w== X-Received: by 2002:a2e:9890:0:b0:2d3:a7da:b17b with SMTP id b16-20020a2e9890000000b002d3a7dab17bmr1584405ljj.4.1709996948665; Sat, 09 Mar 2024 07:09:08 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id m1-20020a2eb6c1000000b002d4062c833dsm328511ljo.98.2024.03.09.07.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:09:08 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Mar 2024 17:09:05 +0200 Subject: [PATCH 1/3] drm/msm/dsi: remove the drm_bridge_attach fallback Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240309-fd-dsi-cleanup-bridges-v1-1-962ebdba82ed@linaro.org> References: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> In-Reply-To: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2369; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=25sj2EpAUs4CVgh43hLR16WG/PkkmsNSMdc3g9mxl2I=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7HuSPyhU7mt5oJSmJoDFQtH4cLTENnWHFQ6NV 7NYXoxKi+SJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZex7kgAKCRCLPIo+Aiko 1UWUB/9fcjO5+fe58xaEbgbtZcYIbSS/rTMGDmJ9GSgRT3x9eINjFvydclOPe1eyvrtLy1gcS+W JFLKvxnr0//Dyf2ObqocW3EpKp9/TMA1OpkCYUbAnP9sjgtcyoPNQ+6KVfCkgorZySXFPvTtWZK 98tClxsDyXUeG7sEvDzqjvmOFNdSZa/oIl/XRcyeRa2+T9LOECKniV0U0i6vRpcqQvWCBndWW/u TstpB/6g/UflC+2ZLlGbLgJHfbl1iD4YA1Gs7FHCq4+bYqbM+6EuzN318o8y1LP6egUlo1YJa7s RD28X1JAPXAjGSE+pI7rztz/i0tj+XiD7SSyMngfAg35+Raw X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A All the bridges that are being used with the MSM DSI hosts have been converted to support DRM_BRIDGE_ATTACH_NO_CONNECTOR. Drop the fallback code and require DRM_BRIDGE_ATTACH_NO_CONNECTOR to be supported by the downstream bridges. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 36 +++++++++++------------------------ 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index af2a287cb3bd..a7c7f85b73e4 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -465,6 +465,7 @@ int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge) struct drm_device *dev = msm_dsi->dev; struct drm_encoder *encoder; struct drm_bridge *ext_bridge; + struct drm_connector *connector; int ret; ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev, @@ -474,36 +475,21 @@ int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge) encoder = int_bridge->encoder; - /* - * Try first to create the bridge without it creating its own - * connector.. currently some bridges support this, and others - * do not (and some support both modes) - */ ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); - if (ret == -EINVAL) { - /* - * link the internal dsi bridge to the external bridge, - * connector is created by the next bridge. - */ - ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); - if (ret < 0) - return ret; - } else { - struct drm_connector *connector; - - /* We are in charge of the connector, create one now. */ - connector = drm_bridge_connector_init(dev, encoder); - if (IS_ERR(connector)) { - DRM_ERROR("Unable to create bridge connector\n"); - return PTR_ERR(connector); - } + if (ret) + return ret; - ret = drm_connector_attach_encoder(connector, encoder); - if (ret < 0) - return ret; + connector = drm_bridge_connector_init(dev, encoder); + if (IS_ERR(connector)) { + DRM_ERROR("Unable to create bridge connector\n"); + return PTR_ERR(connector); } + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) + return ret; + return 0; } From patchwork Sat Mar 9 15:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779211 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FE8344369 for ; Sat, 9 Mar 2024 15:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996953; cv=none; b=GbLw7LQowPgwUVwN9DGDQ8APSZOfq6zYru8bVjeeJUwisJJlmMmS2vbjWKBBLKl5HkkF0wQLHrq7+okdveI/7XV2wLv1kON+S65sXhTl0HLztjzJF+r24NdR+vIknnpNHBEkwdkV2WaLyqqHsC4M5mFKnRC/xIJAQK8/CsdMIQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996953; c=relaxed/simple; bh=OYTBWb/J609udo4PjWcZWo+dNYpRZDjaYBzF/KuEgrE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RSj9LUOoFRUWRYxbV4l97lO2DXSx9XnTADEFS3N8srshsHBE8dUCTHTCNEyLME40OBIze6zyZ7FMi7W3odqgg70WIG6FOkLuvmQKFPc0DbC+XQKflGfD8bddapTIs2erVbfq8iCuvov+bTsn1H97Gb1aNow/q/mzn0/mqHT0kjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=l3fu65YQ; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l3fu65YQ" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d09cf00214so24143591fa.0 for ; Sat, 09 Mar 2024 07:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709996950; x=1710601750; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=R79kFi5q6h2xuMcDgiL3xD0MGpR9aHNwztoW/ysGcfk=; b=l3fu65YQICHBvM/2pkqHP/oOI1tcc69dN/Osp/ORZ7M479KTnB1ayOL8AxkbseaiQG 6u8pgVGJiR01EIi25340fPLVGpKUso92q/TR0hzIN28P4USfL03/P/15F2jO2DOeTg1w PLXR88pgZaf0fUGgZepKoh4FGuB2c83zuqWbly5NOKc+JPl0t94Y3f+vAP6T/z2hg/aP s7swvk5JqSKSQL4R+O9d451iXPMHnD/+RcuO19tRe5GNzLoTB95nqkK2wklEdl8uHdqB UiqOgHfMgFo2y0LrmrHARvRY1TblxdW2Sk2Tj5Ca47n5tkX8eRhnWhkg8M39UUIWtxIG n2oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709996950; x=1710601750; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R79kFi5q6h2xuMcDgiL3xD0MGpR9aHNwztoW/ysGcfk=; b=kfy3KEpLRd8bCsYNz7bxOjEtp3S9MaWGqw5r+PslULEKsusqxeQajfnV2DCaLSGbj/ yBli5N6YW6VvvItZUsgouTM3uZWip+pqJlWD8orH8xNomuJVOnAK0fI50iFPsZF2SwpP EnRgHEqdTt9uzzzTNeUNW9Zl1NOvbTFoMs3tT7VKFN9DU6JrYOIPmu+m7OJHkvI+nFxH bBah6Ou87yDVCQIku4XHJJZUWNrS9vhttHCeOBdyqi8N76HBTVwD62MLFlFWtodPFN+1 nr4xAZk64PZaiQFSoytgY9hoJcJUZChphwJig6xZTtsF/HxX2kpD1yCKbqCcRr6kd6gg /uOg== X-Gm-Message-State: AOJu0YwYcym/TaeEUr06Q9UMp5S6A5z0qmhAI/c0p55IqVYMafRK+Vio qP0CbJlMjCAs+emfzaw4nMvQRtef9mMVR8svA5IMFjvrdpTwKRBFJsNAYF2N/XRiQwLjnut6I+J J X-Google-Smtp-Source: AGHT+IF10RdRaEvCv2MBr+YeGRYtPmBijFVM+6qaB/W22c/QZiNOF6sehdHZcf/RnA+ICJGFiv516g== X-Received: by 2002:a05:651c:218:b0:2d4:31cc:87d7 with SMTP id y24-20020a05651c021800b002d431cc87d7mr108841ljn.28.1709996949687; Sat, 09 Mar 2024 07:09:09 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id m1-20020a2eb6c1000000b002d4062c833dsm328511ljo.98.2024.03.09.07.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:09:08 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Mar 2024 17:09:06 +0200 Subject: [PATCH 2/3] drm/msm/dsi: move next bridge acquisition to dsi_bind Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240309-fd-dsi-cleanup-bridges-v1-2-962ebdba82ed@linaro.org> References: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> In-Reply-To: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2851; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=OYTBWb/J609udo4PjWcZWo+dNYpRZDjaYBzF/KuEgrE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7HuSPV7ttgcma4S2K4UnNqtxQz1m7V6TPk4Nd Brshdy3BfeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZex7kgAKCRCLPIo+Aiko 1Y8PB/4ju7I8KPNnBZAuwfztOn6XPapfqb0/O+pAbLVoCzMKZGRHsHZdSpt0mFYzzVoMrfrHOhE XrVazcgFuVv7Xrq9QIB7B8NHvDsR2qHObpSNe24vRNcSHuFWardbaco+YEXWsRniWzafJby1lA7 9JM1bFtUzUQQxr/4RmOuL+JdFnzj7kXfl8rXpz1A7lL3aVhrPvUybcGY9euo6bcDvkbRaXDAYgI asJKK743VLnRLx7Fhxcz5aOtjr7Rc1J050h8uwksdHVYy/7CHUxcbS+8kqFUsFRRKjMVy9VHlEa hmECpG/9TM1ql1DOrj+EW+MQK1zYYvkvGoX2sT7EnM1ELAfg X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Currently the MSM DSI driver looks for the next bridge during msm_dsi_modeset_init(). If the bridge is not registered at that point, this might result in -EPROBE_DEFER, which can be problematic that late during the device probe process. Move next bridge acquisition to the dsi_bind state so that probe deferral is returned as early as possible. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi.c | 16 ++++++++++++++++ drivers/gpu/drm/msm/dsi/dsi.h | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 8 +------- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 37c4c07005fe..38f10f7a10d3 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -120,6 +120,22 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) struct msm_drm_private *priv = dev_get_drvdata(master); struct msm_dsi *msm_dsi = dev_get_drvdata(dev); + /* + * Next bridge doesn't exist for the secondary DSI host in a bonded + * pair. + */ + if (!msm_dsi_is_bonded_dsi(msm_dsi) || + msm_dsi_is_master_dsi(msm_dsi)) { + struct drm_bridge *ext_bridge; + + ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev, + msm_dsi->pdev->dev.of_node, 1, 0); + if (IS_ERR(ext_bridge)) + return PTR_ERR(ext_bridge); + + msm_dsi->next_bridge = ext_bridge; + } + priv->dsi[msm_dsi->id] = msm_dsi; return 0; diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 2ad9a842c678..0adef65be1de 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -38,6 +38,8 @@ struct msm_dsi { struct mipi_dsi_host *host; struct msm_dsi_phy *phy; + struct drm_bridge *next_bridge; + struct device *phy_dev; bool phy_enabled; diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index a7c7f85b73e4..b7c52b14c790 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -464,18 +464,12 @@ int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge) struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct drm_device *dev = msm_dsi->dev; struct drm_encoder *encoder; - struct drm_bridge *ext_bridge; struct drm_connector *connector; int ret; - ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev, - msm_dsi->pdev->dev.of_node, 1, 0); - if (IS_ERR(ext_bridge)) - return PTR_ERR(ext_bridge); - encoder = int_bridge->encoder; - ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, + ret = drm_bridge_attach(encoder, msm_dsi->next_bridge, int_bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) return ret; From patchwork Sat Mar 9 15:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779503 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 739B44437B for ; Sat, 9 Mar 2024 15:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996954; cv=none; b=d5Jm39j5nDhbOHuxSUqX0c575r2vnKsQTk0K7Nyzzcl1wAAV8Xxo4kPYL451F3ZhByV1LrVPoKeNCIEFD9cInUrNDNoVmlhAQDdVCtY99+1Uik9jGRt++L5kshIvgUsVWU1iy0eUfOrTpvIUCmYxHJKfsKoloFhtOwSAEald+tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709996954; c=relaxed/simple; bh=sQ9dGrX0/pUk+Y+5/wO+qeOzx57mrk8gd0lJNrR0tkU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pGReb9nE64BWk+e8O1ByDAA46uUI5LbxWITx/rqJOIs7zqhJJUP3BQ46/bY6RBcFvx7mXOMMQyr70dKwKxHvmu7lD8aes4z5XBs5z+7tawaPk2B5eXpjw27BvIjjTqP899zV3dt+KH5+g3A73MQZIvJZQasXEG0rE9CQVwMEu2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wEd2pgPh; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wEd2pgPh" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d29111272eso42324661fa.0 for ; Sat, 09 Mar 2024 07:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709996950; x=1710601750; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xNGj9hvd5eMMotayR67It4TFcWGQFtfA/p9pyF/5mE0=; b=wEd2pgPhg82Q3cFj92aclkJHbI0x2RZLPawS6fwDgJhMNjQRoLJprLdtyguAOpG5XK tiq2Z888CJlTuRtd0y8V0jImZtY4HxOHDiJrdX+rxcfZi0Up15jddwhP07XRWjjyrAtc ruCz1X1dybKoP2wbZcuSRCsf6nZI7OHzpR0k6PNhKp5rfaR5FsW6j62kIgZuhOwBeJTc UvMZ93DQYViRrvK7xtZp+wXG76lqe7WvIYjfG1DCYQ/oepko9DuHYXgAVpWMStR3PT2V wkEuBDRdUlhUOfGlUgEb8WtBaiicJhjp6y8gwEPVRztomaQ23Cgu8Im9EBhDaWhtn8pu hnUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709996950; x=1710601750; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xNGj9hvd5eMMotayR67It4TFcWGQFtfA/p9pyF/5mE0=; b=D5/Nk79Y94EfOV81UD89SMynYepzyDAWtAK+b51Uv+R0ZCknktDKC6HYJOo+of4Cbn /xoDDKrapn6kTs2ZUi3S08e34skc2rGgKvS1qe8L02wC0aFIf97+PatpNSmWybTF2qhT D2u2B6JQTq1cCKsUef2FPogR+z/rnfs9ZYvtl+y27gC6y0E8+Nzmnh99w5JQi71fKc8j t6ullpPINS3IwjNknTa8q3nU2nvaAZnDAdwymLoZi1jGaTQTANu1DP+ZJldYAjBtrVPL UrNCwDnoWuDCRcpkayS14EqeVxXrSBx/4Q0puXCJi5URNHLQCokvVu/iIw1vnRaPS6Kg kyBQ== X-Gm-Message-State: AOJu0Yyz8PP1EjAm+D5weJA0dUemWfHDl7o2bMv//ihoqhrupVjXjcuV RUWbxPztZfpKtAUIueNuMlc8nz5lkwpTIyuY3gC/jA+FBCFWnm2T1i01dPexhLU= X-Google-Smtp-Source: AGHT+IEHNSWqX0gXHFX29xuxi93+Jfhzbx2TyMa/UqdM693sNC4YDSZ/Of892Jm2Pp9Awa4lM82QPQ== X-Received: by 2002:a2e:8007:0:b0:2d3:dcb0:56d9 with SMTP id j7-20020a2e8007000000b002d3dcb056d9mr1461938ljg.29.1709996950750; Sat, 09 Mar 2024 07:09:10 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id m1-20020a2eb6c1000000b002d4062c833dsm328511ljo.98.2024.03.09.07.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:09:09 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Mar 2024 17:09:07 +0200 Subject: [PATCH 3/3] drm/msm/dsi: simplify connector creation Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240309-fd-dsi-cleanup-bridges-v1-3-962ebdba82ed@linaro.org> References: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> In-Reply-To: <20240309-fd-dsi-cleanup-bridges-v1-0-962ebdba82ed@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4757; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=sQ9dGrX0/pUk+Y+5/wO+qeOzx57mrk8gd0lJNrR0tkU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7HuTSHu38iYiw5kUL9hewWylm4rO5ExjUE6u6 7tGAahVjqiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZex7kwAKCRCLPIo+Aiko 1Ys2CACm3di5oU6X/lXIp+QIh9BnCKdasPf41Phfo4D3UzixHBdHYXeI7lluOz9oMgmjSHRdpvp FVkQ9j6PxkGDSJqzkAGrGgsSnZNuAPAD3zEGaB1hVPgoY2I2lns2L/4uPm8YN0VPPqSfNWm9k52 L0xRdKYFer8SMAasJZtU+XlLQFBotC2ddTel8mWz3gQLQPMUuDTKZbp72ZKu3ZE2cHIkH+UDXz2 g2MXSbL0VrR3WPilOUl3p/8U4s5h+LBRor8p9bncTwA4fld+P2R5Qygq6w49bXuPDhSp5s8Urli SFUxGJM76aFA8Fud8Z3Bx08MbDAPgA0/0lzbhcw/aXZVVu6a X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Instead of having two functions, msm_dsi_manager_bridge_init() and msm_dsi_manager_ext_bridge_init(), merge them into msm_dsi_manager_connector_init(), moving drm_bridge_attach() to be called from the bridge's attach callback (as most other bridges do). Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi.c | 10 +-------- drivers/gpu/drm/msm/dsi/dsi.h | 5 ++--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 41 +++++++++++++++-------------------- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 38f10f7a10d3..efd7c23b662f 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -232,7 +232,6 @@ void __exit msm_dsi_unregister(void) int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { - struct drm_bridge *bridge; int ret; msm_dsi->dev = dev; @@ -252,14 +251,7 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, return 0; } - bridge = msm_dsi_manager_bridge_init(msm_dsi, encoder); - if (IS_ERR(bridge)) { - ret = PTR_ERR(bridge); - DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret); - return ret; - } - - ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id, bridge); + ret = msm_dsi_manager_connector_init(msm_dsi, encoder); if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 0adef65be1de..afc290408ba4 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -47,9 +47,8 @@ struct msm_dsi { }; /* dsi manager */ -struct drm_bridge *msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi, - struct drm_encoder *encoder); -int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge); +int msm_dsi_manager_connector_init(struct msm_dsi *msm_dsi, + struct drm_encoder *encoder); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index b7c52b14c790..5b3f3068fd92 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -423,7 +423,18 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, return msm_dsi_host_check_dsc(host, mode); } +static int dsi_mgr_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + + return drm_bridge_attach(bridge->encoder, msm_dsi->next_bridge, + bridge, flags); +} + static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { + .attach = dsi_mgr_bridge_attach, .pre_enable = dsi_mgr_bridge_pre_enable, .post_disable = dsi_mgr_bridge_post_disable, .mode_set = dsi_mgr_bridge_mode_set, @@ -431,17 +442,19 @@ static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { }; /* initialize bridge */ -struct drm_bridge *msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi, - struct drm_encoder *encoder) +int msm_dsi_manager_connector_init(struct msm_dsi *msm_dsi, + struct drm_encoder *encoder) { + struct drm_device *dev = msm_dsi->dev; struct drm_bridge *bridge; struct dsi_bridge *dsi_bridge; + struct drm_connector *connector; int ret; dsi_bridge = devm_kzalloc(msm_dsi->dev->dev, sizeof(*dsi_bridge), GFP_KERNEL); if (!dsi_bridge) - return ERR_PTR(-ENOMEM); + return -ENOMEM; dsi_bridge->id = msm_dsi->id; @@ -450,27 +463,9 @@ struct drm_bridge *msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi, ret = devm_drm_bridge_add(msm_dsi->dev->dev, bridge); if (ret) - return ERR_PTR(ret); - - ret = drm_bridge_attach(encoder, bridge, NULL, 0); - if (ret) - return ERR_PTR(ret); - - return bridge; -} - -int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge) -{ - struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct drm_device *dev = msm_dsi->dev; - struct drm_encoder *encoder; - struct drm_connector *connector; - int ret; - - encoder = int_bridge->encoder; + return ret; - ret = drm_bridge_attach(encoder, msm_dsi->next_bridge, int_bridge, - DRM_BRIDGE_ATTACH_NO_CONNECTOR); + ret = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) return ret;