From patchwork Thu Feb 8 15:01:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 198441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp227453dyd; Thu, 8 Feb 2024 07:02:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5QZedDb0Vw8QoMQEbM3WNxDIVWM6zU/OY3PopJaXOwKlVmgycvCzTa2bsRSKXcuvnG/7E X-Received: by 2002:a05:620a:2491:b0:785:9635:8a6f with SMTP id i17-20020a05620a249100b0078596358a6fmr4902268qkn.24.1707404577706; Thu, 08 Feb 2024 07:02:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404577; cv=pass; d=google.com; s=arc-20160816; b=EL6yFhAKx+JVmw43N3TYjAzYyA08OlsKmZtnhBakQiwkEu/34/zt8Nn+GRZ9K2Cdum JuGHrWv/KVEr2E8GWDbUROIOHj6IdAgPdzxsKGZr3qEaNQKhyRTtlaXS6Bvke+jm3ssI Hkta0KhInlQ3fJ1bOHd00DcgFAds+8YrsGLlDrQtGukFJXbDbeMHgkU+rKaNBknzIpFC u8A1GoR96IVXXYls6MoxdEGEmqRJnvV3e4Bsx0fwxbo2RWq1Rq1EfAyxlaGsTukwphKo YXgl2l66Hf5z0FKZ5y21SrxaIpA7sguHnQgQizGgsAisvTXAmh4G7S92GC6/zUJAb1Bz sUcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=09TNoOVLZlsGmnIXste9R4IHFqjQ++tBbpkcO+S4Xzc=; fh=GU6NtcKhvTRwzgwV6x3EJeh5lJZ3SKUGgidwk18G+7s=; b=0+9ApCxmlhNN5KhUFixde8wp7v2lhFDI32ki1b7Gsd5sv0u0PKAKKFMHCOtnFXyjCb 3MC1Z0CLTL1c3Buyfd6plx3uU9swb9SUSZDMZq64dn9D6EE90l4kWKANyAbfDEToPTXn UWlL071F1eC4OQn4Q1HYqwZN/5pLsVgQBC0TfxZzYxy3+lOf3NWCPMq3q/mkY399rU8a bHX2X6ft7jQ/QUSKBRA5VGXqbsBalLid8kEHmfXhoFKZRoOQJ/pSj0UP01ANl6b2h5+c kjcsjQVV+UJEkxZb82ZQoR/HHchtb+I48Hoz8GHt0Vp8iLO3qJMqU5NjWf84v0CZxvMV WWEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do1dmkKk; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58260-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58260-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCUTIUunqsZ9EiIei7CEwmmUAJgpnwo6ewrbyannNERytRz29e4+IHOPS9kz9xy6un9Uy2yd9GJnRlxA8T73F6yeXE64dA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j20-20020a05620a411400b007853f72dd4fsi180781qko.286.2024.02.08.07.02.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:02:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58260-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do1dmkKk; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58260-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58260-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D4F341C29A2E for ; Thu, 8 Feb 2024 15:01:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B59F7D3EA; Thu, 8 Feb 2024 15:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Do1dmkKk" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 288247994A for ; Thu, 8 Feb 2024 15:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404474; cv=none; b=Vd0EjJMpPJ11DQBpROFBHQyrN7i0gD24Kg3vlQSaAwmK1kVLi8N07i1KPcAWTqspH3pcsikk7OsAsyzwpwV0OSIpUaFdEutbK6kZI11fYSgYAer3IqnYV1U1/qsYZglSJlEn9MvcKOV/GUlQRCkf2s0k//pO9dd9dR/Kc1WWyds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404474; c=relaxed/simple; bh=wQrgj28WhABziCXeR2PKfGgoe/NHpSXiGLfXEY2pn/0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nT8LDe2qPOk9klj6pXjuRrbMeqjt0TzmjL61+dwfYNe61NVVnxexOkhKHbUMpkDv0Wv6CPqwzNdwlTpVic6A6A8Qg8Aiuhi8Oq0jpJVuSbLh2FS+hy1deNl2DlLPoOrBFHk2liigrGd9oCTAxY+dpUCFySS8UIr4z5ClUwtXNqw= 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=Do1dmkKk; arc=none smtp.client-ip=209.85.167.48 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 Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-511717231bfso628488e87.2 for ; Thu, 08 Feb 2024 07:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707404471; x=1708009271; 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=09TNoOVLZlsGmnIXste9R4IHFqjQ++tBbpkcO+S4Xzc=; b=Do1dmkKkgRpwa5PBzmATCL1HtSX7TaI34cvEDYyXlrtAzGKGMm71+EJ1F8Uz0tm2Mh aji+4oWkAeGRjJUdROlF117lQcXvoslfCOnrOicwSaKdBMJtUS7KxKuCcC++i6kN7+X2 tkMy3dwTCU/KN36K1jdrkVnSm0e/vkEYMsjAF03BW7i2Lrcoz+z/7qEA9squBRQAdYwS SnxRJoNxfRlnU3O47BYGl8U1A0NlLYj+BigYGk5iNJtdMMpe9R4cqt4u7z0k1m+THYpy 6a4IZLIGiuk1oOPfPhCQLoQBZWdz77JY649yaL/rzFwKUwJeMzjHQKZrz2VkD4CC8GU/ JGoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707404471; x=1708009271; 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=09TNoOVLZlsGmnIXste9R4IHFqjQ++tBbpkcO+S4Xzc=; b=F3/Hi6LDjKw681fBkjsERpFf4y0D2jgwDFRIBMUs5FYms/hhuu8su48wHUrR1TC9ZI fkXPb5KZKG9+Z2CdjslJpcXKwnCgpy/D3xL0Mbt1rjYZMzUwxpJefceW5+Vvg5XpzYm4 HKtwGJooi+OSJPuM6qiSIsFEzyPyr65x7VGBLdqUoxUBJT5LN+tV/euTirXqLGo2oxMs jYfmD3OOR+oxGwuAWZhBgHUCGeSRjqlRXjUWwW0qaX1E8SQDUxtgS27iXMuSYbwEbH6y RTNZzFDw4VLUf/BwDkgjwcVFOdn7Y/r+mVRvMRV3pDunrTAXdAyCQ2MCkvQbgz934Tpf aBBA== X-Gm-Message-State: AOJu0YxMnJj5MJlTZPcT6vwTYtQmvdvUmawW6NtsgWbQjFUfdxplJkTy EgU01EdvLgCLlQP98PoBm6xY0kdtAhBlnAg6INfPpQU7yHH00fZK9IrTE09Lhs4Hxm7saaX1GRL 4 X-Received: by 2002:ac2:46cd:0:b0:511:554c:71a8 with SMTP id p13-20020ac246cd000000b00511554c71a8mr5672529lfo.37.1707404471078; Thu, 08 Feb 2024 07:01:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW8CIqsKS2MoC8IQIhHYrx25g7m3GhsQKEu4Gi+Jgrn8YB7SJYEUaUbOkBytY9JQDPqFaMV+iIVvv/IPw5PbLx5v4PISua+xLGpZFa9V95v4EFussmVHaWy3s8CCVHji2967gtRzmKlx113VF0JP1TZ7JdjrTweA86p7YWPpXmOt3T58tYAh+KRU2YDxxu6uCX6BHEk9YXkyXWuVj3cFv1J0VdMsUb/wTgF/euF2UBp7GV8TsznJGHd/tBUEGI5Lvb/0izy/Wo9mIqnrUv5YVCiWXVFf2hKMcSXM+1VabR0/RwDIUwcmIG+xvSmytRmIK3Vs4JrjgO0Pbv/SapB Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x18-20020a19f612000000b00511498107b8sm22444lfe.65.2024.02.08.07.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:01:10 -0800 (PST) From: Dmitry Baryshkov Date: Thu, 08 Feb 2024 17:01:08 +0200 Subject: [PATCH v4 1/4] drm/msm/mdss: generate MDSS data for MDP5 platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240208-fd-migrate-mdp5-v4-1-945d08ef3fa8@linaro.org> References: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@linaro.org> In-Reply-To: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@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, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2849; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=wQrgj28WhABziCXeR2PKfGgoe/NHpSXiGLfXEY2pn/0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlxOy1CdGwLI2jETK9ta5GNVMwZIFrQNtb/S0MN 93oDS77A2CJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZcTstQAKCRCLPIo+Aiko 1WUjB/9cN0J33e4f7b+V8sC0ssXT1eF1ytulLSvWSvYkddvySGtXG/ck06ixKue7dP4BJjwnY1g ldINIUbCjJs3mOGhJRNDKkWdc62itbQ+D1cH92OBp7dGfoCP3+VQ9/78mV0pIEM9aHHN9hluoRV dO21fMcf96nM9dcqs6Hdj1EdKdd8oh3vagVjiINzxikl2THxFc5aKxzuRN9Fo+N1i+FFbr2wd9D Dm8y3ClXQdNhB/DEPx7KcDtwoGogz0idnNgGqc7Ucx1F8j5Hmw4QJGyJhyIRoZxPKUMqIneURFG flGm4ZfQw0BTKV4khUwcggfcgWyZbfy5x2sxs7LjLQKya5Dh X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790343462310049072 X-GMAIL-MSGID: 1790343462310049072 Older (mdp5) platforms do not use per-SoC compatible strings. Instead they use a single compat entry 'qcom,mdss'. To facilitate migrating these platforms to the DPU driver provide a way to generate the MDSS / UBWC data at runtime, when the DPU driver asks for it. It is not possible to generate this data structure at the probe time, since some platforms might not have MDP_CLK enabled, which makes reading HW_REV register useless and prone to possible crashes. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_mdss.c | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index 35423d10aafa..65657230bbff 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -3,6 +3,7 @@ * Copyright (c) 2018, The Linux Foundation */ +#include #include #include #include @@ -213,6 +214,49 @@ static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss) } } +#define MDSS_HW_MAJ_MIN GENMASK(31, 16) + +#define MDSS_HW_MSM8996 0x1007 +#define MDSS_HW_MSM8937 0x100e +#define MDSS_HW_MSM8953 0x1010 +#define MDSS_HW_MSM8998 0x3000 +#define MDSS_HW_SDM660 0x3002 +#define MDSS_HW_SDM630 0x3003 + +/* + * MDP5 platforms use generic qcom,mdp5 compat string, so we have to generate this data + */ +static const struct msm_mdss_data *msm_mdss_generate_mdp5_mdss_data(struct msm_mdss *mdss) +{ + struct msm_mdss_data *data; + u32 hw_rev; + + data = devm_kzalloc(mdss->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return NULL; + + hw_rev = readl_relaxed(mdss->mmio + HW_REV); + hw_rev = FIELD_GET(MDSS_HW_MAJ_MIN, hw_rev); + + if (hw_rev == MDSS_HW_MSM8996 || + hw_rev == MDSS_HW_MSM8937 || + hw_rev == MDSS_HW_MSM8953 || + hw_rev == MDSS_HW_MSM8998 || + hw_rev == MDSS_HW_SDM660 || + hw_rev == MDSS_HW_SDM630) { + data->ubwc_dec_version = UBWC_1_0; + data->ubwc_enc_version = UBWC_1_0; + } + + if (hw_rev == MDSS_HW_MSM8996 || + hw_rev == MDSS_HW_MSM8998) + data->highest_bank_bit = 2; + else + data->highest_bank_bit = 1; + + return data; +} + const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev) { struct msm_mdss *mdss; @@ -222,6 +266,13 @@ const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev) mdss = dev_get_drvdata(dev); + /* + * We could not do it at the probe time, since hw revision register was + * not readable. Fill data structure now for the MDP5 platforms. + */ + if (!mdss->mdss_data && mdss->is_mdp5) + mdss->mdss_data = msm_mdss_generate_mdp5_mdss_data(mdss); + return mdss->mdss_data; } From patchwork Thu Feb 8 15:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 198442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp228073dyd; Thu, 8 Feb 2024 07:03:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgUMp05E9t/nPhaUUFq3LM9uieTtwwlx+lXQCiZrunTO3/Kqhakd2rSBeLktDi+NYut7l/ X-Received: by 2002:a05:6871:6a0:b0:219:5a8d:5961 with SMTP id l32-20020a05687106a000b002195a8d5961mr9263141oao.51.1707404618547; Thu, 08 Feb 2024 07:03:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404618; cv=pass; d=google.com; s=arc-20160816; b=sM4FkOxtI/3xYQ+jfB+6WBQIZPoSY4ReKKN2Tm0BrfvsTbpDW3LyaAqYmpja7pY+zb VdHR9r+xwzjlunONARN0yf+SAgwfmg4Pl/m3+DZGzficnQYjl9XkMvuBhO1sCSMIlY8i 2TMj0odvsRSEgs/0FfotOrV8TTLQ74ElW0z/1atRHLi5V01glKeChFKaQRrw+AZRPkrN KGK5yWuOoJVrkAZwkef7WeSjIlatQvPzgLQxCZSUGvjLSSRbxf9XPbDQq9EtOEY8VYyU dAh5FvoQkQdSp/XYjvn5sB+Z/U6NTTsoUUy/DsemapXoQNYu1e3bxZAwKOMep3Q78Qn4 5wHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=bM1ON0mCYxX+OrdVKZhi68MkEuup4raYVaf9XhQ9xPo=; fh=JhpJIKXNTdYoFBeY/EoPVMxMgPt9njAKC0ozQjE2D7s=; b=wIy5MV+sFmxao+C3B03F/Y8Rnm9Bos866yhrAQ6oaKszg77WLXCVHeLTfjlj/vPjnI qOiurh0KouAsl0AXkk+JyWlwoSoq7dr6J77Beg6Dr6lT3xQRqwqHbGsbQd0oTsortWTw 71V+PYpjbB1HtvWQ3+ogNzIXyHmNsScB360Nvpku9JI1qTgoDXF1ExHiAkJWCTs6L7XA PUUuT+SBJ831k/QNpGTiOLzkocgNQv5OeOOxMgWHBmHcxQhkiexRPUyonuCDFC1HIpE8 pV3qk+uSj8D2Tk1m8Y2k2J1g+QRVyuSDggHcnotqXhFfHfQGprhH8vTwr/QdwWx9k6wl wcDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nVH5MiP4; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58261-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58261-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCVpB9gQhM2lPnsPYgSNThjR/GUUC0VzmUkkvM1Ro6HGxtPVd2f7X+95SaalnJL40TzlOogOxXatM51u+AibIloE6YaWKQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u8-20020a056870700800b00219d21c353dsi1688884oae.27.2024.02.08.07.03.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:03:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58261-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nVH5MiP4; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58261-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58261-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6CFD428C98D for ; Thu, 8 Feb 2024 15:02:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF8197E116; Thu, 8 Feb 2024 15:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nVH5MiP4" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 E041F149DFF for ; Thu, 8 Feb 2024 15:01:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404475; cv=none; b=H/05w0mtVwvByfkb/OgGzvve9wXDX5EjMYOmoNwelynCkhvFkiRvaC6FpOpFgA8ATTiVwiR7/FE0jh/y8go681lFHOx69cAfuoq1XGBOR1nCjHj0P5TxZhV5Y0zfkZTceZHagRUKdT2Wz3vT7keztNENR9kEw7qVmRCImjsT2pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404475; c=relaxed/simple; bh=tl6JEvUus0xlZ8U5q5uQ8wyhk+g9z4wbwtBHieQ2hyo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X2gvUFvRdwdhOVGFmyiCfvNh4dPXyyxtVmMVEb+bBBW/F7Fqaz7w5WXWbtDVrl9vzOVw01GBaVz7HbPPeXevZF6NJwXDe2hsuX1V34sFsKj814N62TUDypxngEln8OyTfHJZ1mHwaXO3lvpeIRpYoP7ftxg8OknrMrHG9tREVKE= 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=nVH5MiP4; arc=none smtp.client-ip=209.85.167.43 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 Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5116ec49081so745182e87.2 for ; Thu, 08 Feb 2024 07:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707404472; x=1708009272; 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=bM1ON0mCYxX+OrdVKZhi68MkEuup4raYVaf9XhQ9xPo=; b=nVH5MiP4i3NaC6AdTyHOiU1rHuIN8Wk9dl3cRG65BlUQZXQc9YaMV2FyEAhQ8wqs9h lBeIam8eD4x0X5vecrKHKyzx2CKMgCwyMYQkjnoKQcz4yZ2isI6+fwjsnuRegIPz7exa 0/JgKsD1VRkST/IeUlHR/ZVKXSWdEx/xB8phNizDJgR0+Y6lmUXrq4Tu7R4jzMPEJaKy Kx/PeF7tlCCnMrWPpf+jDWwQE2JDIKsA0PxrA6My8HZsKXigsAhkZdnYI/A5ZSpp6OrM 7a8m2a2idkQ5lAfFJ59iLjQdqlJRngecRwoozIxVX9Kh8c02rB2GNpDAFXnN6NZQGRMe 6OeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707404472; x=1708009272; 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=bM1ON0mCYxX+OrdVKZhi68MkEuup4raYVaf9XhQ9xPo=; b=P5u2vyXs7Pm95/0OBCbQcbJPSoOfELcojEUUATJxIRSbz54FrjZTE6Bmi1SpJVn/sc xvunlfuUv4UlNZ9/ZuQ65apJVGyhem9o7h8N4bjvPDoNjCRjMMtY3EVw9ZgPdBnKk93a DjjbgSw0861mO+JpraML6oR0HXaKYnEgx97wSb5+Emk21NIpoIlahQ9APVaY8RtK1qun Au7HpxANmfeVa5diwrYP1qXSLEbcnyBvwE+txm9eKeK5d3Xm5HfDR4IWOB8Zl1DAZd/p Ya29XXX3Ta0ylzHDsykyYyfjhXZy58pifHO/WeYUqCpZFWCw0br243Ut3NTtTShG/iS9 MIXA== X-Gm-Message-State: AOJu0YzBuLg97waLtOLxnMFnFWwZzH1XicC/nqBqP4LjqKkeXnwQOvl6 EZdgaEAewnP9cav1p1iQ+8Eu07Jwx+4ICBPCp2Hi+7Ts6IV/YZnKW3tuqQMbWNU= X-Received: by 2002:a05:6512:3084:b0:511:4cc9:33a4 with SMTP id z4-20020a056512308400b005114cc933a4mr8423242lfd.52.1707404472071; Thu, 08 Feb 2024 07:01:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXPI7jqCSDTEQwvf49fCJB2nh7Ft9ZVdyBaxPIsoFErUzO5eWZvcgHD2TbF4rEI5iuJkjhI8AK0Wh82Sw/UdmgCNZRz1Ob08A9Kw3OMk/gabqeh1L6sFzf2TqULTbj1sJshhoSqyhwihX+CqEbFVoYotiAKP6UrBzg1fL02hdFDyFuB29Rv+HSQs+eIe3G7D4h5F9J3t+s1DC2/a3mdNYwR3w7sVDLArt6qhnVLLnyTsjIzxrGC+v85FvKE8cMYShl89HE8sbXPT6wJ2cCQtDnGUgzmheEAFbUtSbLSTRKsUGzBF6CjSaMYv0SEto5fgI3NbMcQPc2R0RHVCZgh Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x18-20020a19f612000000b00511498107b8sm22444lfe.65.2024.02.08.07.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:01:11 -0800 (PST) From: Dmitry Baryshkov Date: Thu, 08 Feb 2024 17:01:09 +0200 Subject: [PATCH v4 2/4] drm/msm/dpu: support binding to the mdp5 devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240208-fd-migrate-mdp5-v4-2-945d08ef3fa8@linaro.org> References: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@linaro.org> In-Reply-To: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@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, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5596; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=tl6JEvUus0xlZ8U5q5uQ8wyhk+g9z4wbwtBHieQ2hyo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlxOy1hHipg/dl04ngXKXm31WoTPg06D4744LEw TGvy4CLo9iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZcTstQAKCRCLPIo+Aiko 1ZXXB/0RJS1fympL90lLUdAGvRisrATJ6XoAg/Oo8/RJvTpFhiUkkwhqsaZLBnqi9yfqYwnLYGh CqwHwd67IigqsW3DYhGGFl2zRNCQncbhH4PA2GY2NHWNcSWxygh7Ql/w/EXEQ7/eG3voik4IuYc 3Bek4Gu7oV/kWt9N2aR+F7uRzNLK572iGLy+ei7XxY5rfIxX6Su0+b6Z8SHsZHx51lZ2u8X3NTO 5+/E4fXhLW/QwHRH9JLIbx1FLoxE4ypbQbrEbkWIGQWe5V/2TzLdPQpGMKzS/ADFgE7eF4Gapyg Tb4oc0uIwySsb+Dn43ofsjL4LlxBRkdUI5k2U2iPT8Az+FIS X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790343505096783137 X-GMAIL-MSGID: 1790343505096783137 Existing MDP5 devices have slightly different bindings. The main register region is called `mdp_phys' instead of `mdp'. Also vbif register regions are a part of the parent, MDSS device. Add support for handling this binding differences. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 98 ++++++++++++++++++++++++++------- drivers/gpu/drm/msm/msm_drv.h | 3 + drivers/gpu/drm/msm/msm_io_utils.c | 13 +++++ 3 files changed, 93 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 723cc1d82143..5de1861f608e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1197,6 +1197,78 @@ static int dpu_kms_init(struct drm_device *ddev) return 0; } +static int dpu_kms_mmap_mdp5(struct dpu_kms *dpu_kms) +{ + struct platform_device *pdev = dpu_kms->pdev; + struct platform_device *mdss_dev; + int ret; + + if (!dev_is_platform(dpu_kms->pdev->dev.parent)) + return -EINVAL; + + mdss_dev = to_platform_device(dpu_kms->pdev->dev.parent); + + dpu_kms->mmio = msm_ioremap(pdev, "mdp_phys"); + if (IS_ERR(dpu_kms->mmio)) { + ret = PTR_ERR(dpu_kms->mmio); + DPU_ERROR("mdp register memory map failed: %d\n", ret); + dpu_kms->mmio = NULL; + return ret; + } + DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); + + dpu_kms->vbif[VBIF_RT] = msm_ioremap_mdss(mdss_dev, + dpu_kms->pdev, + "vbif_phys"); + if (IS_ERR(dpu_kms->vbif[VBIF_RT])) { + ret = PTR_ERR(dpu_kms->vbif[VBIF_RT]); + DPU_ERROR("vbif register memory map failed: %d\n", ret); + dpu_kms->vbif[VBIF_RT] = NULL; + return ret; + } + + dpu_kms->vbif[VBIF_NRT] = msm_ioremap_mdss(mdss_dev, + dpu_kms->pdev, + "vbif_nrt_phys"); + if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { + dpu_kms->vbif[VBIF_NRT] = NULL; + DPU_DEBUG("VBIF NRT is not defined"); + } + + return 0; +} + +static int dpu_kms_mmap_dpu(struct dpu_kms *dpu_kms) +{ + struct platform_device *pdev = dpu_kms->pdev; + int ret; + + dpu_kms->mmio = msm_ioremap(pdev, "mdp"); + if (IS_ERR(dpu_kms->mmio)) { + ret = PTR_ERR(dpu_kms->mmio); + DPU_ERROR("mdp register memory map failed: %d\n", ret); + dpu_kms->mmio = NULL; + return ret; + } + DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); + + dpu_kms->vbif[VBIF_RT] = msm_ioremap(pdev, "vbif"); + if (IS_ERR(dpu_kms->vbif[VBIF_RT])) { + ret = PTR_ERR(dpu_kms->vbif[VBIF_RT]); + DPU_ERROR("vbif register memory map failed: %d\n", ret); + dpu_kms->vbif[VBIF_RT] = NULL; + return ret; + } + + dpu_kms->vbif[VBIF_NRT] = msm_ioremap_quiet(pdev, "vbif_nrt"); + if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { + dpu_kms->vbif[VBIF_NRT] = NULL; + DPU_DEBUG("VBIF NRT is not defined"); + } + + return 0; +} + static int dpu_dev_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1230,28 +1302,12 @@ static int dpu_dev_probe(struct platform_device *pdev) dpu_kms->base.irq = irq; - dpu_kms->mmio = msm_ioremap(pdev, "mdp"); - if (IS_ERR(dpu_kms->mmio)) { - ret = PTR_ERR(dpu_kms->mmio); - DPU_ERROR("mdp register memory map failed: %d\n", ret); - dpu_kms->mmio = NULL; - return ret; - } - DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); - - dpu_kms->vbif[VBIF_RT] = msm_ioremap(pdev, "vbif"); - if (IS_ERR(dpu_kms->vbif[VBIF_RT])) { - ret = PTR_ERR(dpu_kms->vbif[VBIF_RT]); - DPU_ERROR("vbif register memory map failed: %d\n", ret); - dpu_kms->vbif[VBIF_RT] = NULL; + if (of_device_is_compatible(dpu_kms->pdev->dev.of_node, "qcom,mdp5")) + ret = dpu_kms_mmap_mdp5(dpu_kms); + else + ret = dpu_kms_mmap_dpu(dpu_kms); + if (ret) return ret; - } - - dpu_kms->vbif[VBIF_NRT] = msm_ioremap_quiet(pdev, "vbif_nrt"); - if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { - dpu_kms->vbif[VBIF_NRT] = NULL; - DPU_DEBUG("VBIF NRT is not defined"); - } ret = dpu_kms_parse_data_bus_icc_path(dpu_kms); if (ret) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 16a7cbc0b7dd..01e783130054 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -476,6 +476,9 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name); void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); +void __iomem *msm_ioremap_mdss(struct platform_device *mdss_pdev, + struct platform_device *dev, + const char *name); struct icc_path *msm_icc_get(struct device *dev, const char *name); diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c index 59d2788c4510..afedd61c3e28 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ b/drivers/gpu/drm/msm/msm_io_utils.c @@ -50,6 +50,19 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name) return clk; } +void __iomem *msm_ioremap_mdss(struct platform_device *mdss_pdev, + struct platform_device *pdev, + const char *name) +{ + struct resource *res; + + res = platform_get_resource_byname(mdss_pdev, IORESOURCE_MEM, name); + if (!res) + return ERR_PTR(-EINVAL); + + return devm_ioremap_resource(&pdev->dev, res); +} + static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name, bool quiet, phys_addr_t *psize) { From patchwork Thu Feb 8 15:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 198440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp226882dyd; Thu, 8 Feb 2024 07:02:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUqTpCv/A1RowJ9UWks0eic026aLS9p9Wl8pB8xF8ZADHrlaCjRiJbtMziaxCIC9GW5kDxA3nvlXlMDyVn64wrVK61Byw== X-Google-Smtp-Source: AGHT+IGgUT07fQZWVCe9QpbClIzfSJjfkoG6a3PiFJFqALV9tfJFbdx2l39mPRobnxLRTl+Hem8x X-Received: by 2002:a17:906:5ad2:b0:a38:4b66:4201 with SMTP id x18-20020a1709065ad200b00a384b664201mr5877155ejs.43.1707404540098; Thu, 08 Feb 2024 07:02:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404540; cv=pass; d=google.com; s=arc-20160816; b=BtliPOkoDZwWjFNiHUzNu4/0r5Am6oYohWVQ/+ignk64J1WT24904mlKYNcD9iD97L 10Iz6jGUv58kWkbuN7yKomL2ulhtAb9VHHesLGucviAUS9X1BZrLdS/zV1CZLeJ/RXAe OeFXS6BZbs20/WB5xcFzW/qhNQRkzCuaT9p5moV8QeyTnu/lgq0VPa0d1CAMReJ//ISs qLDVCTuDVzRh/bzTGlE3O3RWdg1OcLQi/SDouUSUPLRWSTLWLz5PYP0EyfO6Ab0BHezb nx+P7g6dRR9uHW3N9VNIARvNKoXEfmbYwVv4gq9XbDbg7ZCD+X4PZ/rlEd4sPY6ptsmG N0mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=micFdpjWEfE2iQhufUDk7TfjTaVtXdHcamWR3jJ5CU4=; fh=uQYjbxnLkb6gr1CXvM3WzyJT1o03wAEwy5khfpQ48kU=; b=KFrpNSlxI1K3+ATYf9u7+QJHRPJqGZDUKkJzvxTLLkaF0UU2VTkkvTC2WKom1iSrtI FKEKxQZ+N+8TNDphBthKLsY6w7si/jw/DpUJi913UVo+u0K0ONRV/YoS07Ul7MSMwxUs rxcOxNH2cWDVIRs6JUnKsNQCywsX3+aD+KhsS/V1rkORemmVPiAscQ8w/mGNI0Pua4UY BuvI8ko0tS21uuh3iIe1Vs9/POYVR6E5++iY4BZl1V5cD6pM5DMAh9CwdR5uurY65xcn S1eSh2hXyLdt2/hnjM53KEb3vVAC0TiAPsJCgCe7JR3J5XOX2YFHuHHd8pfU2lLpc3pC eSaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZCP59gsA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58262-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58262-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCUv/08piInUZvdz9Edpo70tRDWvQUL2EJtVdMmyy49/ek8fg3sdA4U0eUYyUeXYOBbncLViRg7jsylUxpMyDPBhP5na5w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hg14-20020a170906f34e00b00a389b74220esi126041ejb.435.2024.02.08.07.02.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:02:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58262-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZCP59gsA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58262-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58262-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 822661F220E5 for ; Thu, 8 Feb 2024 15:02:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF39E7D41A; Thu, 8 Feb 2024 15:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZCP59gsA" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 B81A37B3CA for ; Thu, 8 Feb 2024 15:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404477; cv=none; b=XK+CxB8Fc6RWnXLVS25t7UQJRr7njTnHT/lFAT9ztVDFaKfNpxkgUtSvDmAlGzWEu/oMs8Dn6Sr8ZZDQi5Z2dPjEGrlVT9dUWje8c+Cj1bwgNkA+07weyJ327f1CXSgsA3zfpI864xwUJ4glybHtDuzZuYLSqAkpScYR+6mfU0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404477; c=relaxed/simple; bh=l8WXS3ws5bU0POmatEizYV75CbeDLs5zSep1gpGQJz8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cgDXUbTr8kqIEB/bxmLdFBLye/MGP1im2K/JsiTE6CFI9ORAK+gm7RchflgTbQq3h2nYEzQVymN+r+oiFpCvm9JTMPvlrpiUMmr8N+HnR4sWT3HfuIqGrPeYYi37E6rP6MxmyGFfjsgZgK55MhWn7UwJKcd55vYEc+TD/pgzoh0= 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=ZCP59gsA; arc=none smtp.client-ip=209.85.167.53 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 Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-5114c05806eso2900141e87.1 for ; Thu, 08 Feb 2024 07:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707404473; x=1708009273; 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=micFdpjWEfE2iQhufUDk7TfjTaVtXdHcamWR3jJ5CU4=; b=ZCP59gsAF3w9VZdSRKBfLOYt+o5tjczGE3Bhxgpf/CTShdTYGs+VAL4cy+uuU0XPyh TDb/D3BmvDeykw95ovwlpKdccKbdz6AvLJjjXY0dgOvGhvQSWhWQPXi+PSuWg/sHRZOv 0Pz/5q4JY6Xix5QindJTINOAobrBQZfcqcn4KhH4n1IaKK8KqRmB21tcD4SJjVY/jzdq WcRuDO0R832rQrAr5laJ4UJOlR7++i1Q37DJ0g2olc2BLpmowDeNjcKJBCwE8nKUfOby dkmx8oE0hVHELTXTeEhUaaX/9QmLQqb38XV4CdCv4122vW75NlKIg6WGrXXJBgLDflCe Yblw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707404473; x=1708009273; 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=micFdpjWEfE2iQhufUDk7TfjTaVtXdHcamWR3jJ5CU4=; b=lUoLG/mzLs+n/eVo1/+4O22MYlYZytDXAKxDBqpDNFjBf7vCcrgDRQqix/EABS/1OP qxYwVKSxKID1D5uR6QnoGt2ISZzh+gOs3npjV7GI0F3whPRNP7bHE8bpQ8YHOx2p+G9W lEointxycOtKFkizH1jYHLGhlrctAIggDRehgTnhFxsHqkHl1LR6ZOkzjjUD7ZIf48lN 7m0637qhrrD9pV5rgW/6tNG0qb97qVsP74iWnI7hh+ozCRJ6pHJhZesk8ssaq/3ht2gD Vp/j2Nz6dhpY0jn/C4RVE/aQFCWPuDRWZsAF7PjsMLq6Tj33VrlYIr6mDK/wbT5vuZy/ 7cRA== X-Forwarded-Encrypted: i=1; AJvYcCW5S4mHZhxK+rO55HgOX3u28Wh/tIWohF9KBgkPoYCF8xcpPbXp9NlzbhZ8MGp6/Djs735EvjH6jsVYAL+ba+JeeC/9vtdmvyMuwPfs X-Gm-Message-State: AOJu0YySLFqlGorusYWWipn7OXMFkzL70u4SHoh2QC6CRUSibgH4DQpX fxLogs/VfSu6zUA0Ol8G9vUi+8eQlZG7V958e3b5bkh5CM+HXecIoS4Sx/v2vW4= X-Received: by 2002:a05:6512:3e21:b0:511:60ba:a02e with SMTP id i33-20020a0565123e2100b0051160baa02emr6791569lfv.40.1707404472753; Thu, 08 Feb 2024 07:01:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXUWfyO+YUwrNmX5OGaP+HqleZPdYsG04Ds7ao0CeWN16bbHuQt3u+aO+Zw/SCkAHi6YQHBMr6BF3JbiHNQrsPzMKJTTshL+0u4rDBRdYPtnL5efQBnazgpDhCExpUH7BigN16hrMXoeJjzsCOdHqucZuF2AxCXJPtfSu1/5rBwDxYGLtynw47Sb/EOFtiYER6Lps3TUjHoFnG6NPvUcd3l+DEyPVgyj+sppMkIJhUvWmahWsfimK/UTiTsJ4B+ESdfz4GCNNo5b+ey5XcpQr8QposgPycipvMd7yUeTqydglqcbgGqqmr4Yu3EEgTw8ODw2ygMHISmyM3Ek2uWyVRI/GfOYzaD7gBcqtX4yerpcH9wx3GPibsCq05J94ceEj7v9XT4suzx4BFx Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x18-20020a19f612000000b00511498107b8sm22444lfe.65.2024.02.08.07.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:01:12 -0800 (PST) From: Dmitry Baryshkov Date: Thu, 08 Feb 2024 17:01:10 +0200 Subject: [PATCH v4 3/4] drm/msm: add a kernel param to select between MDP5 and DPU drivers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240208-fd-migrate-mdp5-v4-3-945d08ef3fa8@linaro.org> References: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@linaro.org> In-Reply-To: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@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, linux-kernel@vger.kernel.org, Stephen Boyd , Carl Vanderlip X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3850; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=l8WXS3ws5bU0POmatEizYV75CbeDLs5zSep1gpGQJz8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlxOy1s+We5gpCU3SazjAx5Xh8bF6Dy+O/eQgD0 CopwZ+OHzeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZcTstQAKCRCLPIo+Aiko 1Ua4CACsjd27gTUByFMcUJ8n8OTcCFjUb9uZPstAvEqrs4SpLWihGrO1a1tObcml0Qo0mARRxzn 9Y5ZAIPnolxR0/LzVuQFe1ZA5fpzqUFAi48/aEOBi4PGj/1zGLygX8lNDsp0g07A6F9FLElvxVa Cmjk3LLvkLezQEDGkLqQ9w+EQDwdY216C5ee/rU8HyA16vpgBAnTIVvMmcBV7t4qPGdFF7pG8rU 5o27SeeQTPBMcSAg+16wcIrmPgaDnpVMNcYBRH/ZtEZihdP4hpAYWIuEBmgjYtE5czLunKUW/Pk HZFC70zd/MT0triJoZnBYu5TBE1smnpHfqFiYwZUdK4vyIRU X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790343422892749289 X-GMAIL-MSGID: 1790343422892749289 For some of the platforms (e.g. SDM660, SDM630, MSM8996, etc.) it is possible to support this platform via the DPU driver (e.g. to provide support for DP, multirect, etc). Add a modparam to be able to switch between these two drivers. All platforms supported by both drivers are by default handled by the MDP5 driver. To let them be handled by the DPU driver pass the `msm.prefer_mdp5=false` kernel param. Reviewed-by: Stephen Boyd Reviewed-by: Carl Vanderlip Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +++ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +++ drivers/gpu/drm/msm/msm_drv.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_drv.h | 1 + 4 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 5de1861f608e..4fab3544e4f1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1276,6 +1276,9 @@ static int dpu_dev_probe(struct platform_device *pdev) int irq; int ret = 0; + if (!msm_disp_drv_should_bind(&pdev->dev, true)) + return -ENODEV; + dpu_kms = devm_kzalloc(dev, sizeof(*dpu_kms), GFP_KERNEL); if (!dpu_kms) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 0827634664ae..43d05851c54d 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -866,6 +866,9 @@ static int mdp5_dev_probe(struct platform_device *pdev) DBG(""); + if (!msm_disp_drv_should_bind(&pdev->dev, false)) + return -ENODEV; + mdp5_kms = devm_kzalloc(&pdev->dev, sizeof(*mdp5_kms), GFP_KERNEL); if (!mdp5_kms) return -ENOMEM; diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 50b65ffc24b1..f79134fc6cc0 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -969,6 +969,37 @@ static int add_components_mdp(struct device *master_dev, return 0; } +#if !IS_REACHABLE(CONFIG_DRM_MSM_MDP5) || !IS_REACHABLE(CONFIG_DRM_MSM_DPU) +bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver) +{ + /* If just a single driver is enabled, use it no matter what */ + return true; +} +#else + +static bool prefer_mdp5 = true; +MODULE_PARM_DESC(prefer_mdp5, "Select whether MDP5 or DPU driver should be preferred"); +module_param(prefer_mdp5, bool, 0444); + +/* list all platforms supported by both mdp5 and dpu drivers */ +static const char *const msm_mdp5_dpu_migration[] = { + NULL, +}; + +bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver) +{ + /* If it is not an MDP5 device, do not try MDP5 driver */ + if (!of_device_is_compatible(dev->of_node, "qcom,mdp5")) + return dpu_driver; + + /* If it is not in the migration list, use MDP5 */ + if (!of_device_compatible_match(dev->of_node, msm_mdp5_dpu_migration)) + return !dpu_driver; + + return prefer_mdp5 ? !dpu_driver : dpu_driver; +} +#endif + /* * We don't know what's the best binding to link the gpu with the drm device. * Fow now, we just hunt for all the possible gpus that we support, and add them diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 01e783130054..762e13e2df74 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -563,5 +563,6 @@ int msm_drv_probe(struct device *dev, struct msm_kms *kms); void msm_kms_shutdown(struct platform_device *pdev); +bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver); #endif /* __MSM_DRV_H__ */ From patchwork Thu Feb 8 15:01:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 198443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp228367dyd; Thu, 8 Feb 2024 07:03:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcMrSjHSCBc0pZAIuIWkR6jczv5aX+qX3R9bIxYjm0Y/2BodsfB89DPWy2UbgnLnqpvGLD X-Received: by 2002:a05:6870:bb1a:b0:219:57f4:31c1 with SMTP id nw26-20020a056870bb1a00b0021957f431c1mr10438559oab.28.1707404636338; Thu, 08 Feb 2024 07:03:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707404636; cv=pass; d=google.com; s=arc-20160816; b=FRSt7Ngcy3l23VGx87EGdBtu30KxliarajXT2ewYH2YGJCxpnoIDrPOVKT6U6S1c50 +Pw9k/W/eGH2af6CvEhJugT2H/CMWeGZWkekkE8fpICOCwBfQKM4eGqgmgmr/ySUQHnV +ZIvrHTaVajHm0Zgt05hp9Nzrb/Cl1TfOvZvq7Pi8AL7y+w+jnyNNdA6yQDyYanylQVi zI2KkzEi736C6QQHFPUV+koKHlqrvk0SVsci4FbpmMCw+lxEz/HHg1YbfcqJhyKHjPoo gOY9EhU+yZQrAa7rESGmnelMNO9TziDUtOD34xp3fqJrIl5h6kc4RrJXCUAgzBQVgK58 PkoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=FIZmbIRcvUvz99rxf0RPQhPA5Ky/J7Xzvjbj9Vj02i0=; fh=0Vb+RliJNZu7iyxPGGjh9EfVKByiEShUM0RRxaWkPd8=; b=0nhjPF4vquJL/jhVF2NGeyr7FxZYZjqNyCbaq9dCe1Kl9aETq5n4Chrto4IxNO6b2R iIjiOJcfein6/RhOm0w/K/WT2NH09zcDOyjTEA3RtRIKapWAED4I9QRrPwtTvNFjb04j KTL/fsbFWX4Bl3zZ0rhHihP3KbLn+i8IKh3UmknTP+nMjZ5QjH0PAFrxFgBLbXvNhuIY AiWutp3/nxGxVIGf2/ALs+yTlUO+nRCuO4CdbfqsKloW3vkpNdvRhp1aHaQ1pGp49+5v va5T2oNxquI/aT1X9Cx4pGH+F2hEnjEkposxcEWBVplFOAQoPzbxvEO8VBSnNW3QlTIC +DnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCUhgAXG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58263-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58263-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCWdZh2vScfSbH45tz6jfIKwg3lvDnVJ5w53EeJKw1574dbhV3eoJrwRQnuaxjODvXaPft/ixX5NTvMKpnQsYfdixyTRDQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id dq2-20020a0568300ec200b006e146450c85si1593630otb.282.2024.02.08.07.03.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:03:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58263-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCUhgAXG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-58263-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58263-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5F8E3285983 for ; Thu, 8 Feb 2024 15:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6E4B7E78F; Thu, 8 Feb 2024 15:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jCUhgAXG" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 CCECC7B3F1 for ; Thu, 8 Feb 2024 15:01:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404478; cv=none; b=NEcExzCRHp49Mbc/T6SkYuBjM3q3NPIaXDPftUTVA/josqk29rFZ1JTNJt9/0zp+ZpYNscWjpJStupeBMv7vtJ6Pw6q5RNvuLlXI0QWTuK2z3vRQ8EJ9iBt9E/J9IfiwHSoW2TDPkmS0cnEPeF8E6VdO7cUQoJLJsbaQXk2e3Lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707404478; c=relaxed/simple; bh=R70M+fFc3/2ZE9PGHXFTTMAClUHyGds0A2aBWG1FPcg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GRBiWKrn2oCVqpOeUHIJqfuf74+ADfIPSa9G3xsJGUWzPIqf555PreDcYN3cF1lo5GrCV85MTg2Knus7aOrFw36lKEMv6oXfrysmkFHg9e5E3Wk46QQrkdQnI7r9mUyX2OWtO3IsG9evMF6czZI8kJQCn0VqRaQPzGJ7DCOAbxk= 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=jCUhgAXG; arc=none smtp.client-ip=209.85.167.41 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 Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-51168addef1so2742461e87.1 for ; Thu, 08 Feb 2024 07:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707404474; x=1708009274; 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=FIZmbIRcvUvz99rxf0RPQhPA5Ky/J7Xzvjbj9Vj02i0=; b=jCUhgAXG72rQsN/ktVTdJCU4IkIo0NqaOcORxjjgF38wL3WqiCEFX9pkyZLwmWsmJC g6+AWmvBLHSltjWKYeoiwYG7cVmPQl1ljckHsFPMVVget6Jw2m6C+3xw2RMil4xtOyNK F6hyvbHv54clV5Bwwsv/Wxm30ahd9EyxlNtDwqwBsPPQ4UOabwM3at0fdXYrQifKkdo2 FJhsEq7a9Y1kInA2zNCZ/MFWIXVRvleYEuj0Pp8dOS/D7UOOn2z/iSpI3dK3hjooWKio 5doLGXBeTGmvPdIXrKCJ37IMennNtJcavwljb1TF6ihMztmdWxkgqdAoBoruKSUOupRg /FDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707404474; x=1708009274; 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=FIZmbIRcvUvz99rxf0RPQhPA5Ky/J7Xzvjbj9Vj02i0=; b=QtBEBGBomyiD2QcfAZEMwHQEShpgeHhCfATr9YyWhJ2dn5yAcnmEqfGaTxgwxX/v9W /4E/sPjunTXE+7mA2liwCYQIxcF+cq1Rg9msM7XX0NKdvn9M4y41hYDbPYhCV3+raz4L vpzLsxqdo5IiR5zEgmgPZSLeRhtnZI4Mc7T+0Nh6Yu8J4akBxgt9aV1hQF5XyuIKo4WM jLl554OG1YpWJRCZLhOY9nm97Hi/liZRG4f3DSb9WiwiAEbNjrF7+Gal3b4I0y6pkceD v6o+kwTpCEH1UlvtakRtXRIv/ZDw+oFoKEBUHZ3SjZqLxnY/qsVFIjYEfdQGA43A8oKv Zf1A== X-Gm-Message-State: AOJu0YzzFjQ9mOQzNAodIym8EfrEb4k6AG0kma9owtxmI5LFQ+Yv8evr louEHuzhf2CbLNMDjrLFzqLJobBQSbouWjFYT1tPsA92WtAjyQWiMJ0gi5lK9iI= X-Received: by 2002:a05:6512:3d0f:b0:511:1038:dcde with SMTP id d15-20020a0565123d0f00b005111038dcdemr7764982lfv.52.1707404473756; Thu, 08 Feb 2024 07:01:13 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWxtjDzuEah1k9wdRxLwNpsow4OaOPmIh2HlP6RXyb1KSLxbhw+hOiW0ekQpemBoKcSHLzfSxXfvYlq9UJEQRn6QMJsKsGFUgleR8mYDDOxhX1v38LU9ids+2oWHCY9T6INhajXKfP4QW7529kq+94pbeVzO13jaFUM67zaxuxyobthfwHg3HZ4ZOpcaO8VqUR78PRa3KDaTVtcNeYKEbPrqOx7nYuJELxTk+7YLziqHjhjXfCUNdJbKgRNB3grstHkjluoH33l0jwx1d2Lizn7vDak1EXMX2k6K+vzOfnomnGNN2b+ZmBLgp8KSewJT9S9ERJ7S6UstPA7eoHtYSb+XVD29SBxhE0uoz9fI3fKC6ciV9qMsEvw4FTD Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x18-20020a19f612000000b00511498107b8sm22444lfe.65.2024.02.08.07.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:01:13 -0800 (PST) From: Dmitry Baryshkov Date: Thu, 08 Feb 2024 17:01:11 +0200 Subject: [PATCH v4 4/4] drm/msm/dpu: add support for SDM660 and SDM630 platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240208-fd-migrate-mdp5-v4-4-945d08ef3fa8@linaro.org> References: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@linaro.org> In-Reply-To: <20240208-fd-migrate-mdp5-v4-0-945d08ef3fa8@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, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=19136; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=R70M+fFc3/2ZE9PGHXFTTMAClUHyGds0A2aBWG1FPcg=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlxOy1QwfOio2Qn1qV42f/HOI+8kc3/g51WTbHi LF5SPlFFqWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZcTstQAKCRCLPIo+Aiko 1Xn8B/9rIqxryIpnD65oerL3nL6L/F0S91j/UVdlQ4RWj62/I5Ba5F5NQgL0mFjOB6h40e9KI5e 35i+DF5JpHz/FouOxfBGs6rrVpe0ywisHrJUv4ND7y2dctjLfwl9kpnq6TkLnZTdjdS9znLOrRU IybcVgRFz68vs/KvpGrO5xCzX7cuI4spper7ce2/d62MXPQpjDAU13PnlM0LGG4I5ifEM72OAq7 v+j3nhZMexAhcInBeutH2zuKeP3lGediWtsg76+YRc9HNdJVp+Ou9jVbZ/vjdaN6gXrl6BkNDnM ZsdSJgcO57ykq8g9uA0Qbu9J1+wd9seF+oP+oJzDdDIg1tdd X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790343524106049068 X-GMAIL-MSGID: 1790343524106049068 Bring in hardware support for the SDM660 and SDM630 platforms, which belong to the same DPU generation as MSM8998. Note, by default these platforms are still handled by the MDP5 driver unless the `msm.prefer_mdp5=false' parameter is provided. Co-developed-by: Konrad Dybcio Signed-off-by: Konrad Dybcio Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/catalog/dpu_3_2_sdm660.h | 291 +++++++++++++++++++++ .../gpu/drm/msm/disp/dpu1/catalog/dpu_3_3_sdm630.h | 225 ++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 + drivers/gpu/drm/msm/msm_drv.c | 2 + 6 files changed, 524 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_2_sdm660.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_2_sdm660.h new file mode 100644 index 000000000000..424815e7fb7d --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_2_sdm660.h @@ -0,0 +1,291 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023. Linaro Inc. All rights reserved. + */ + +#ifndef _DPU_3_2_SDM660_H +#define _DPU_3_2_SDM660_H + +static const struct dpu_caps sdm660_dpu_caps = { + .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH, + .max_mixer_blendstages = 0x7, + .has_src_split = true, + .has_dim_layer = true, + .has_idle_pc = true, + .has_3d_merge = true, + .max_linewidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH, + .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE, + .max_hdeci_exp = MAX_HORZ_DECIMATION, + .max_vdeci_exp = MAX_VERT_DECIMATION, +}; + +static const struct dpu_mdp_cfg sdm660_mdp = { + .name = "top_0", + .base = 0x0, .len = 0x458, + .features = BIT(DPU_MDP_VSYNC_SEL), + .clk_ctrls = { + [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 }, + [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 }, + [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2c4, .bit_off = 8 }, + [DPU_CLK_CTRL_CURSOR0] = { .reg_off = 0x3a8, .bit_off = 16 }, + }, +}; + +static const struct dpu_ctl_cfg sdm660_ctl[] = { + { + .name = "ctl_0", .id = CTL_0, + .base = 0x1000, .len = 0x94, + .features = BIT(DPU_CTL_SPLIT_DISPLAY), + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9), + }, { + .name = "ctl_1", .id = CTL_1, + .base = 0x1200, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10), + }, { + .name = "ctl_2", .id = CTL_2, + .base = 0x1400, .len = 0x94, + .features = BIT(DPU_CTL_SPLIT_DISPLAY), + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11), + }, { + .name = "ctl_3", .id = CTL_3, + .base = 0x1600, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12), + }, { + .name = "ctl_4", .id = CTL_4, + .base = 0x1800, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13), + }, +}; + +static const struct dpu_sspp_cfg sdm660_sspp[] = { + { + .name = "sspp_0", .id = SSPP_VIG0, + .base = 0x4000, .len = 0x1ac, + .features = VIG_MSM8998_MASK, + .sblk = &dpu_vig_sblk_qseed3_1_2, + .xin_id = 0, + .type = SSPP_TYPE_VIG, + .clk_ctrl = DPU_CLK_CTRL_VIG0, + }, { + .name = "sspp_1", .id = SSPP_VIG1, + .base = 0x6000, .len = 0x1ac, + .features = VIG_MSM8998_MASK, + .sblk = &dpu_vig_sblk_qseed3_1_2, + .xin_id = 4, + .type = SSPP_TYPE_VIG, + .clk_ctrl = DPU_CLK_CTRL_VIG1, + }, { + .name = "sspp_8", .id = SSPP_DMA0, + .base = 0x24000, .len = 0x1ac, + .features = DMA_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 1, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA0, + }, { + .name = "sspp_9", .id = SSPP_DMA1, + .base = 0x26000, .len = 0x1ac, + .features = DMA_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 5, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA1, + }, { + .name = "sspp_10", .id = SSPP_DMA2, + .base = 0x28000, .len = 0x1ac, + .features = DMA_CURSOR_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 9, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA2, + }, +}; + +static const struct dpu_lm_cfg sdm660_lm[] = { + { + .name = "lm_0", .id = LM_0, + .base = 0x44000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .lm_pair = LM_1, + .pingpong = PINGPONG_0, + .dspp = DSPP_0, + }, { + .name = "lm_1", .id = LM_1, + .base = 0x45000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .lm_pair = LM_0, + .pingpong = PINGPONG_1, + .dspp = DSPP_1, + }, { + .name = "lm_2", .id = LM_2, + .base = 0x46000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .lm_pair = LM_5, + .pingpong = PINGPONG_2, + }, { + .name = "lm_5", .id = LM_5, + .base = 0x49000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, + }, +}; + +static const struct dpu_pingpong_cfg sdm660_pp[] = { + { + .name = "pingpong_0", .id = PINGPONG_0, + .base = 0x70000, .len = 0xd4, + .features = PINGPONG_SDM845_TE2_MASK, + .sblk = &sdm845_pp_sblk_te, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 8), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 12), + }, { + .name = "pingpong_1", .id = PINGPONG_1, + .base = 0x70800, .len = 0xd4, + .features = PINGPONG_SDM845_TE2_MASK, + .sblk = &sdm845_pp_sblk_te, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 9), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 13), + }, { + .name = "pingpong_2", .id = PINGPONG_2, + .base = 0x71000, .len = 0xd4, + .features = PINGPONG_SDM845_MASK, + .sblk = &sdm845_pp_sblk, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 10), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 14), + }, { + .name = "pingpong_3", .id = PINGPONG_3, + .base = 0x71800, .len = 0xd4, + .features = PINGPONG_SDM845_MASK, + .sblk = &sdm845_pp_sblk, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 11), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 15), + }, +}; + +static const struct dpu_dsc_cfg sdm660_dsc[] = { + { + .name = "dsc_0", .id = DSC_0, + .base = 0x80000, .len = 0x140, + }, { + .name = "dsc_1", .id = DSC_1, + .base = 0x80400, .len = 0x140, + }, +}; + +static const struct dpu_dspp_cfg sdm660_dspp[] = { + { + .name = "dspp_0", .id = DSPP_0, + .base = 0x54000, .len = 0x1800, + .features = DSPP_SC7180_MASK, + .sblk = &msm8998_dspp_sblk, + }, { + .name = "dspp_1", .id = DSPP_1, + .base = 0x56000, .len = 0x1800, + .features = DSPP_SC7180_MASK, + .sblk = &msm8998_dspp_sblk, + }, +}; + +static const struct dpu_intf_cfg sdm660_intf[] = { + { + .name = "intf_0", .id = INTF_0, + .base = 0x6a000, .len = 0x280, + .type = INTF_DP, + .controller_id = MSM_DP_CONTROLLER_0, + .prog_fetch_lines_worst_case = 21, + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), + .intr_tear_rd_ptr = -1, + }, { + .name = "intf_1", .id = INTF_1, + .base = 0x6a800, .len = 0x280, + .type = INTF_DSI, + .controller_id = MSM_DSI_CONTROLLER_0, + .prog_fetch_lines_worst_case = 21, + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), + .intr_tear_rd_ptr = -1, + }, { + .name = "intf_2", .id = INTF_2, + .base = 0x6b000, .len = 0x280, + .type = INTF_DSI, + .controller_id = MSM_DSI_CONTROLLER_1, + .prog_fetch_lines_worst_case = 21, + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 28), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 29), + .intr_tear_rd_ptr = -1, + }, +}; + +static const struct dpu_perf_cfg sdm660_perf_data = { + .max_bw_low = 6600000, + .max_bw_high = 6600000, + .min_core_ib = 3100000, + .min_llcc_ib = 800000, + .min_dram_ib = 800000, + .undersized_prefill_lines = 2, + .xtra_prefill_lines = 2, + .dest_scale_prefill_lines = 3, + .macrotile_prefill_lines = 4, + .yuv_nv12_prefill_lines = 8, + .linear_prefill_lines = 1, + .downscaling_prefill_lines = 1, + .amortizable_threshold = 25, + .min_prefill_lines = 25, + .danger_lut_tbl = {0xf, 0xffff, 0x0}, + .safe_lut_tbl = {0xfffc, 0xff00, 0xffff}, + .qos_lut_tbl = { + {.nentry = ARRAY_SIZE(msm8998_qos_linear), + .entries = msm8998_qos_linear + }, + {.nentry = ARRAY_SIZE(msm8998_qos_macrotile), + .entries = msm8998_qos_macrotile + }, + {.nentry = ARRAY_SIZE(msm8998_qos_nrt), + .entries = msm8998_qos_nrt + }, + }, + .cdp_cfg = { + {.rd_enable = 1, .wr_enable = 1}, + {.rd_enable = 1, .wr_enable = 0} + }, + .clk_inefficiency_factor = 200, + .bw_inefficiency_factor = 120, +}; + +static const struct dpu_mdss_version sdm660_mdss_ver = { + .core_major_ver = 3, + .core_minor_ver = 2, +}; + +const struct dpu_mdss_cfg dpu_sdm660_cfg = { + .mdss_ver = &sdm660_mdss_ver, + .caps = &sdm660_dpu_caps, + .mdp = &sdm660_mdp, + .ctl_count = ARRAY_SIZE(sdm660_ctl), + .ctl = sdm660_ctl, + .sspp_count = ARRAY_SIZE(sdm660_sspp), + .sspp = sdm660_sspp, + .mixer_count = ARRAY_SIZE(sdm660_lm), + .mixer = sdm660_lm, + .dspp_count = ARRAY_SIZE(sdm660_dspp), + .dspp = sdm660_dspp, + .pingpong_count = ARRAY_SIZE(sdm660_pp), + .pingpong = sdm660_pp, + .dsc_count = ARRAY_SIZE(sdm660_dsc), + .dsc = sdm660_dsc, + .intf_count = ARRAY_SIZE(sdm660_intf), + .intf = sdm660_intf, + .vbif_count = ARRAY_SIZE(msm8998_vbif), + .vbif = msm8998_vbif, + .perf = &sdm660_perf_data, +}; + +#endif diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_3_sdm630.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_3_sdm630.h new file mode 100644 index 000000000000..df01227fc364 --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_3_sdm630.h @@ -0,0 +1,225 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023. Linaro Inc. All rights reserved. + */ + +#ifndef _DPU_3_3_SDM630_H +#define _DPU_3_3_SDM630_H + +static const struct dpu_caps sdm630_dpu_caps = { + .max_mixer_width = DEFAULT_DPU_LINE_WIDTH, + .max_mixer_blendstages = 0x7, + .has_src_split = true, + .has_dim_layer = true, + .has_idle_pc = true, + .has_3d_merge = true, + .max_linewidth = DEFAULT_DPU_LINE_WIDTH, + .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE, + .max_hdeci_exp = MAX_HORZ_DECIMATION, + .max_vdeci_exp = MAX_VERT_DECIMATION, +}; + +static const struct dpu_mdp_cfg sdm630_mdp = { + .name = "top_0", + .base = 0x0, .len = 0x458, + .features = BIT(DPU_MDP_VSYNC_SEL), + .clk_ctrls = { + [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 }, + [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, + [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2c4, .bit_off = 8 }, + [DPU_CLK_CTRL_CURSOR0] = { .reg_off = 0x3a8, .bit_off = 16 }, + }, +}; + +static const struct dpu_ctl_cfg sdm630_ctl[] = { + { + .name = "ctl_0", .id = CTL_0, + .base = 0x1000, .len = 0x94, + .features = BIT(DPU_CTL_SPLIT_DISPLAY), + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9), + }, { + .name = "ctl_1", .id = CTL_1, + .base = 0x1200, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10), + }, { + .name = "ctl_2", .id = CTL_2, + .base = 0x1400, .len = 0x94, + .features = BIT(DPU_CTL_SPLIT_DISPLAY), + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11), + }, { + .name = "ctl_3", .id = CTL_3, + .base = 0x1600, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12), + }, { + .name = "ctl_4", .id = CTL_4, + .base = 0x1800, .len = 0x94, + .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13), + }, +}; + +static const struct dpu_sspp_cfg sdm630_sspp[] = { + { + .name = "sspp_0", .id = SSPP_VIG0, + .base = 0x4000, .len = 0x1ac, + .features = VIG_MSM8998_MASK, + .sblk = &dpu_vig_sblk_qseed3_1_2, + .xin_id = 0, + .type = SSPP_TYPE_VIG, + .clk_ctrl = DPU_CLK_CTRL_VIG0, + }, { + .name = "sspp_8", .id = SSPP_DMA0, + .base = 0x24000, .len = 0x1ac, + .features = DMA_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 1, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA0, + }, { + .name = "sspp_9", .id = SSPP_DMA1, + .base = 0x26000, .len = 0x1ac, + .features = DMA_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 5, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA1, + }, { + .name = "sspp_10", .id = SSPP_DMA2, + .base = 0x28000, .len = 0x1ac, + .features = DMA_CURSOR_MSM8998_MASK, + .sblk = &dpu_dma_sblk, + .xin_id = 9, + .type = SSPP_TYPE_DMA, + .clk_ctrl = DPU_CLK_CTRL_DMA2, + }, +}; + +static const struct dpu_lm_cfg sdm630_lm[] = { + { + .name = "lm_0", .id = LM_0, + .base = 0x44000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .pingpong = PINGPONG_0, + .dspp = DSPP_0, + }, { + .name = "lm_2", .id = LM_2, + .base = 0x46000, .len = 0x320, + .features = MIXER_MSM8998_MASK, + .sblk = &msm8998_lm_sblk, + .pingpong = PINGPONG_2, + }, +}; + +static const struct dpu_pingpong_cfg sdm630_pp[] = { + { + .name = "pingpong_0", .id = PINGPONG_0, + .base = 0x70000, .len = 0xd4, + .features = PINGPONG_SDM845_TE2_MASK, + .sblk = &sdm845_pp_sblk_te, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 8), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 12), + }, { + .name = "pingpong_2", .id = PINGPONG_2, + .base = 0x71000, .len = 0xd4, + .features = PINGPONG_SDM845_MASK, + .sblk = &sdm845_pp_sblk, + .intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 10), + .intr_rdptr = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 14), + }, +}; + +static const struct dpu_dspp_cfg sdm630_dspp[] = { + { + .name = "dspp_0", .id = DSPP_0, + .base = 0x54000, .len = 0x1800, + .features = DSPP_SC7180_MASK, + .sblk = &msm8998_dspp_sblk, + }, +}; + +static const struct dpu_intf_cfg sdm630_intf[] = { + { + .name = "intf_0", .id = INTF_0, + .base = 0x6a000, .len = 0x280, + .type = INTF_DP, + .controller_id = MSM_DP_CONTROLLER_0, + .prog_fetch_lines_worst_case = 21, + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), + .intr_tear_rd_ptr = -1, + }, { + .name = "intf_1", .id = INTF_1, + .base = 0x6a800, .len = 0x280, + .type = INTF_DSI, + .controller_id = MSM_DSI_CONTROLLER_0, + .prog_fetch_lines_worst_case = 21, + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), + .intr_tear_rd_ptr = -1, + }, +}; + +static const struct dpu_perf_cfg sdm630_perf_data = { + .max_bw_low = 4100000, + .max_bw_high = 4100000, + .min_core_ib = 3200000, + .min_llcc_ib = 800000, + .min_dram_ib = 800000, + .undersized_prefill_lines = 2, + .xtra_prefill_lines = 2, + .dest_scale_prefill_lines = 3, + .macrotile_prefill_lines = 4, + .yuv_nv12_prefill_lines = 8, + .linear_prefill_lines = 1, + .downscaling_prefill_lines = 1, + .amortizable_threshold = 25, + .min_prefill_lines = 25, + .danger_lut_tbl = {0xf, 0xffff, 0x0}, + .safe_lut_tbl = {0xfffc, 0xff00, 0xffff}, + .qos_lut_tbl = { + {.nentry = ARRAY_SIZE(msm8998_qos_linear), + .entries = msm8998_qos_linear + }, + {.nentry = ARRAY_SIZE(msm8998_qos_macrotile), + .entries = msm8998_qos_macrotile + }, + {.nentry = ARRAY_SIZE(msm8998_qos_nrt), + .entries = msm8998_qos_nrt + }, + }, + .cdp_cfg = { + {.rd_enable = 1, .wr_enable = 1}, + {.rd_enable = 1, .wr_enable = 0} + }, + .clk_inefficiency_factor = 200, + .bw_inefficiency_factor = 120, +}; + +static const struct dpu_mdss_version sdm630_mdss_ver = { + .core_major_ver = 3, + .core_minor_ver = 3, +}; + +const struct dpu_mdss_cfg dpu_sdm630_cfg = { + .mdss_ver = &sdm630_mdss_ver, + .caps = &sdm630_dpu_caps, + .mdp = &sdm630_mdp, + .ctl_count = ARRAY_SIZE(sdm630_ctl), + .ctl = sdm630_ctl, + .sspp_count = ARRAY_SIZE(sdm630_sspp), + .sspp = sdm630_sspp, + .mixer_count = ARRAY_SIZE(sdm630_lm), + .mixer = sdm630_lm, + .dspp_count = ARRAY_SIZE(sdm630_dspp), + .dspp = sdm630_dspp, + .pingpong_count = ARRAY_SIZE(sdm630_pp), + .pingpong = sdm630_pp, + .intf_count = ARRAY_SIZE(sdm630_intf), + .intf = sdm630_intf, + .vbif_count = ARRAY_SIZE(msm8998_vbif), + .vbif = msm8998_vbif, + .perf = &sdm630_perf_data, +}; + +#endif diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index 54e8717403a0..ccbee0f40ad7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -680,6 +680,8 @@ static const struct dpu_qos_lut_entry sc7180_qos_nrt[] = { *************************************************************/ #include "catalog/dpu_3_0_msm8998.h" +#include "catalog/dpu_3_2_sdm660.h" +#include "catalog/dpu_3_3_sdm630.h" #include "catalog/dpu_4_0_sdm845.h" #include "catalog/dpu_4_1_sdm670.h" diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index ba82ef4560a6..a54c135e3147 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -832,6 +832,8 @@ struct dpu_mdss_cfg { }; extern const struct dpu_mdss_cfg dpu_msm8998_cfg; +extern const struct dpu_mdss_cfg dpu_sdm630_cfg; +extern const struct dpu_mdss_cfg dpu_sdm660_cfg; extern const struct dpu_mdss_cfg dpu_sdm845_cfg; extern const struct dpu_mdss_cfg dpu_sdm670_cfg; extern const struct dpu_mdss_cfg dpu_sm8150_cfg; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 4fab3544e4f1..c27b624fdde5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1377,6 +1377,8 @@ static const struct dev_pm_ops dpu_pm_ops = { static const struct of_device_id dpu_dt_match[] = { { .compatible = "qcom,msm8998-dpu", .data = &dpu_msm8998_cfg, }, { .compatible = "qcom,qcm2290-dpu", .data = &dpu_qcm2290_cfg, }, + { .compatible = "qcom,sdm630-mdp5", .data = &dpu_sdm630_cfg, }, + { .compatible = "qcom,sdm660-mdp5", .data = &dpu_sdm660_cfg, }, { .compatible = "qcom,sdm670-dpu", .data = &dpu_sdm670_cfg, }, { .compatible = "qcom,sdm845-dpu", .data = &dpu_sdm845_cfg, }, { .compatible = "qcom,sc7180-dpu", .data = &dpu_sc7180_cfg, }, diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index f79134fc6cc0..97790faffd23 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -983,6 +983,8 @@ module_param(prefer_mdp5, bool, 0444); /* list all platforms supported by both mdp5 and dpu drivers */ static const char *const msm_mdp5_dpu_migration[] = { + "qcom,sdm630-mdp5", + "qcom,sdm660-mdp5", NULL, };