From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 7B7CF20F3E5 for ; Fri, 25 Oct 2024 17:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876566; cv=none; b=LlLpLO/yHDaXYtf3Ndw3L2NemzOEhgbeIdIO4g4x5l2AfE0DyCTd2I/Hlg0BGmo9X0MShqHkTRHNt2K1iDOxqzWZF6wuHg+vITBFtOaFiY2EALzs1BgxOMuG/wTBI+SCO80PTbVsNACVqsXVAedH/2K5L7VdHxMVSULRrNfAr6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876566; c=relaxed/simple; bh=ivKc1N4Mmh0vuWkC2a0EqN95MvZ1q0W3nPRNkGt3VSI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QmO+3AQnixeZMqn6j2yYPv4NVcPo35xq/LEMj7OZSDf5uorEpFtilMxlqfcnMjCigfYzKtPqBxDpd9wQaEgQRtxSFx7x0bCkAZQytrgfcUj/eFZoJN9lXY88K4+A8BLJkrVzej/qs6/mQxJ18ExxWyPZW4/8ejoO9d5MHD7B0ek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=ezsNy5JI; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ezsNy5JI" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-37d518f9abcso1663955f8f.2 for ; Fri, 25 Oct 2024 10:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876562; x=1730481362; 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=mE1J+qWE3+MY5OdGTFndB6Yv1OgEwWzvu24HL6ntl3Y=; b=ezsNy5JIiUAp5606R9ZC8NRkX4ZOAJp5V8k+NWoc0p3DeiEx5rrvxDJ+ibMaLbrzUw B1N4nW8zydTdgZrtDR5j4A//Lg1hPovVJGFHLErAh7OgTUL/qyQZZAMobj8uOu7l5CGs z6q+HeAKpdd2d3z6QutOdsmBrueGupoqx95Q9oaBZrmx/KVdRx6Dr7y3vcUVaPy8C/xW BYWBerUt2pJPsi1LB/LcS7ufnz8L5dx+m1qaQPeA3BQcRhsfn0FzPXCeeMQLfWTv2IPN xiMFsVLVDscunNVdXEqLXHxkqcX9ql5/buwRyRuPFBDcmoM6ix4iSsqSv20kKpND/KuC y9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876562; x=1730481362; 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=mE1J+qWE3+MY5OdGTFndB6Yv1OgEwWzvu24HL6ntl3Y=; b=Okt5MJaW3XtHXNP7qIOENrnHxOEkEcsgt+SXyAfhZgTvAwGvOeKYBRs1gSOQfl5ur5 5nmQYTMqqS1s8O4SzwSIInoeAeeJ28pF3Z0YKsozRmy/KHcHNjNfpLjINfoHFmvGcI5d werhSJe4dF18C5M68NOF4d8Y+XqQq31uP+T94vGd6oCDB1B9QLLfI4wWhrZdPzl6pyQw asXkDfcOq5vGW61uAPYC9fVWn4mMi5JxltadpMExN495/CbDLMXBzDZ3vOg5x30l6Tg1 h7Vci0QPlDeU5M/ihg8e7gkLxrzEQSUtDqrbIilXW8F8wxA56QVEVrms4yo6bnY7C7N6 Lnjw== X-Forwarded-Encrypted: i=1; AJvYcCVRFGLO9KCeLX6H4FHtK1esG05n23KxWi9qouYr7hhonevgLlsSVN4Tb6SlJy4W96j+PkFj406KJ3eaPn8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+mfqk7RYmIa3d/kI++jwIEkxemcKblpsTvAoNxXyG/IK6BdCr yVbp8ILhKdsv3geta5A2oU1gmh6w32hdoOW3+gXPoW6g+mrW7imDHRzR23vaVwg= X-Google-Smtp-Source: AGHT+IEHBMyfg8LeLTWXyBsyEhO7uNb2SflsZSQOS0RHT+/8zxN2LWxj0WgsnINVEDyefqmgv9Nkcw== X-Received: by 2002:adf:a29b:0:b0:37d:3f5c:5a83 with SMTP id ffacd0b85a97d-38061128754mr107580f8f.19.1729876561858; Fri, 25 Oct 2024 10:16:01 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:01 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:32 +0100 Subject: [PATCH v2 01/36] drm/vc4: Use of_device_get_match_data to set generation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-1-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 Use of_device_get_match_data to retrieve the generation value as set in the struct of_device_id, rather than manually comparing compatible strings. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index d47e5967592f..3099292f22a5 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -300,10 +300,7 @@ static int vc4_drm_bind(struct device *dev) =20 dev->coherent_dma_mask =3D DMA_BIT_MASK(32); =20 - if (of_device_is_compatible(dev->of_node, "brcm,bcm2711-vc5")) - gen =3D VC4_GEN_5; - else - gen =3D VC4_GEN_4; + gen =3D (enum vc4_gen)of_device_get_match_data(dev); =20 if (gen > VC4_GEN_4) driver =3D &vc5_drm_driver; @@ -462,9 +459,9 @@ static void vc4_platform_drm_shutdown(struct platform_d= evice *pdev) } =20 static const struct of_device_id vc4_of_match[] =3D { - { .compatible =3D "brcm,bcm2711-vc5", }, - { .compatible =3D "brcm,bcm2835-vc4", }, - { .compatible =3D "brcm,cygnus-vc4", }, + { .compatible =3D "brcm,bcm2711-vc5", .data =3D (void *)VC4_GEN_5 }, + { .compatible =3D "brcm,bcm2835-vc4", .data =3D (void *)VC4_GEN_4 }, + { .compatible =3D "brcm,cygnus-vc4", .data =3D (void *)VC4_GEN_4 }, {}, }; MODULE_DEVICE_TABLE(of, vc4_of_match); --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 94F5C20F3EC for ; Fri, 25 Oct 2024 17:16:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876567; cv=none; b=IqJlLAcJe2LaNCLwolVTMShTVoynSyEc7AbG4la7dhJXTEFTg63Bq/m5XDzqdqErAtSZ4I/BrHWISS1/5WCJ1fJ5gz1F9vj5csfyUlyoL5e6FhGWbIeKRVMWs6Z9lk3e8r8dVHiqqgPxHa4NOu7JDVPw43JOT/b3pUhoZrTZCU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876567; c=relaxed/simple; bh=MuA1+gA2LA+0RarF591IDfJ3YMiX2FefV1latoO+A60=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ox5YBB/72N2gRN7UD1e8SVKmh/zMHyJZJ+Iw7+m0tIkJ+qiiTQuYwnFD4UL0THF2602u4UKcyvyxQVlf9LTMUYd8UkeR3FSVv01tFOBil2Mg4ZA6og9sJt+WkbeYXUmN5BfE2Q23R2o6zEkEZQGZlva0VYnB/GgUPcyZHop0QmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=C7l/kThH; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="C7l/kThH" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4315eeb2601so29131795e9.2 for ; Fri, 25 Oct 2024 10:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876563; x=1730481363; 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=x2GjkUl3p/O3LyFYgokUMRNrG9yDODmMulXK3H2wmqc=; b=C7l/kThHiq5oCkdSq6sFBcBb/2dTOnmqxnqv0jUNWcces94sjUeY43oRGZn8D7iybt r24KGkqiAJseIsi747612l9rLGoOM1E7TXYUMSb36+7MsmO5U1JiSfwLERruBr8VW6yy TDPtsJ3eSb2U+6M1CroJgWNSA5CS9VLUB2l0nabiWdf/Kudh/nkJm7EX6ZJ18mcNmARU UyOCpx5Uvf6zhmjNSkT5ViQ4iuP4xOEIAqoYpvEdGNpUf2vTc/gHX8cyuWPuqGSWKkRI NSS0yEGENiZHu6G71eZ/UMyLf3iQN7VwrY0Vb0Wc0acKcWx98K3N0PXQeDuRusH/nK8A wG0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876563; x=1730481363; 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=x2GjkUl3p/O3LyFYgokUMRNrG9yDODmMulXK3H2wmqc=; b=fNbk00ZrjUD/fpnMdi75gOIPZw6CUMHBytgteAnN9xgH3sj/UwfjGC0yjWf/8tgrLb efZEoPCqn5llA8O6OTGQGiwDuqX/SxKSCbHC3XX4YRPufImSdGZMA2+ZvNSXociGmN/s OuMUDxiwN9uYkLay5zd0ZuBczDGYoZ+d+oIQYrbPvjvrcAw7kEyx0X54VemWidPSQrXH bg1PUYFFIZfRAuFLplpfndMnsIdtsYZyoDNQ8ybnL6rTsAYd6JLHKyt++JOmRBreWJcB kUrAEyWC93VmyD+krogPxtmqzlekk1wprWXRcytACoaA+Sl2DZVR41Psb0cBuKxMLlzd lVZg== X-Forwarded-Encrypted: i=1; AJvYcCUHipDCrZgTXrdg1FO8wJwG+t+gppsX3Jea2fBePqwoRPzY2XWpK0oqiItwDaAXCZDWIYnG4PZsHljQ1dY=@vger.kernel.org X-Gm-Message-State: AOJu0YzLPHVx0v3nx5YPueWlTlaOmfVlKY2dWhFUVz7sIq4HV7Lzd77s nMuucr53+lZaaqIoECN7RVS/1nEdrS0tmVl+09Fn44MOACSxgRgwi3pgDPR84wU= X-Google-Smtp-Source: AGHT+IHS33FJ99QvsSnwlHEO0RVmS3g3mQFRGvOhUZla0C49szl9I45Vo/iib3shrh2XvYSiEjJZJQ== X-Received: by 2002:a05:600c:314a:b0:431:4847:47c0 with SMTP id 5b1f17b1804b1-431841eb704mr109059015e9.7.1729876562817; Fri, 25 Oct 2024 10:16:02 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:02 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:33 +0100 Subject: [PATCH v2 02/36] drm/vc4: Fix reading of frame count on GEN5 / Pi4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-2-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 The frame count values moved within registers DISPSTAT1 and DISPSTAT2 with GEN5, so update the accessor function to accommodate that. Fixes: b51cd7ad143d ("drm/vc4: hvs: Fix frame count register readout") Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hvs.c | 45 +++++++++++++++++++++++++++++++-------= ---- drivers/gpu/drm/vc4/vc4_regs.h | 6 ++++++ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 1edf6e3fa7e6..f8edb0791091 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -272,19 +272,42 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, = unsigned int fifo) if (!drm_dev_enter(drm, &idx)) return 0; =20 - switch (fifo) { - case 0: - field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), - SCALER_DISPSTAT1_FRCNT0); - break; - case 1: - field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), - SCALER_DISPSTAT1_FRCNT1); + switch (vc4->gen) { + case VC4_GEN_5: + switch (fifo) { + case 0: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), + SCALER5_DISPSTAT1_FRCNT0); + break; + case 1: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), + SCALER5_DISPSTAT1_FRCNT1); + break; + case 2: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT2), + SCALER5_DISPSTAT2_FRCNT2); + break; + } break; - case 2: - field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT2), - SCALER_DISPSTAT2_FRCNT2); + case VC4_GEN_4: + switch (fifo) { + case 0: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), + SCALER_DISPSTAT1_FRCNT0); + break; + case 1: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1), + SCALER_DISPSTAT1_FRCNT1); + break; + case 2: + field =3D VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT2), + SCALER_DISPSTAT2_FRCNT2); + break; + } break; + default: + drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); + return 0; } =20 drm_dev_exit(idx); diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index c55dec383929..341a75cf92e5 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -418,6 +418,10 @@ # define SCALER_DISPSTAT1_FRCNT0_SHIFT 18 # define SCALER_DISPSTAT1_FRCNT1_MASK VC4_MASK(17, 12) # define SCALER_DISPSTAT1_FRCNT1_SHIFT 12 +# define SCALER5_DISPSTAT1_FRCNT0_MASK VC4_MASK(25, 20) +# define SCALER5_DISPSTAT1_FRCNT0_SHIFT 20 +# define SCALER5_DISPSTAT1_FRCNT1_MASK VC4_MASK(19, 14) +# define SCALER5_DISPSTAT1_FRCNT1_SHIFT 14 =20 #define SCALER_DISPSTATX(x) (SCALER_DISPSTAT0 + \ (x) * (SCALER_DISPSTAT1 - \ @@ -436,6 +440,8 @@ #define SCALER_DISPSTAT2 0x00000068 # define SCALER_DISPSTAT2_FRCNT2_MASK VC4_MASK(17, 12) # define SCALER_DISPSTAT2_FRCNT2_SHIFT 12 +# define SCALER5_DISPSTAT2_FRCNT2_MASK VC4_MASK(19, 14) +# define SCALER5_DISPSTAT2_FRCNT2_SHIFT 14 =20 #define SCALER_DISPBASE2 0x0000006c #define SCALER_DISPALPHA2 0x00000070 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 622F6231CB6 for ; Fri, 25 Oct 2024 17:16:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876567; cv=none; b=kwfhCT52EJjgavZ2/d8sMLh3EQL5/po+m1wqUqs+iE7Y3zXxHdfCLk9wzqcUk4nuSSrhFwZVOL36XtsBCqyV3Yn4/NqizgstIaqDiVFM8uyvflfMaPyF50FPxDZIf4wRpXchityFk6JFlSW1tfTGjg1QZvWliUpWuSbfGJMAAbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876567; c=relaxed/simple; bh=FQ5F+QORxSN0hqjJB03JSaZBLHg3MohVrt+mbUZveP8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LqmP8boTcZgMbWXwxZvvYfHjhNiFgjtd2Y94QvoHj6m5iYUTD3D8irA+Ct0ZO3NXvBaORhN3FylAyu96q1Vn+X7Zq0hasRlz9AVCehFSp++l/CIK14F0x/aB8d3mO15+bfcPS/tUviFIg7MzR04MrR+cyCd1uEX/MPZcFeK0dDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=V+xcY9lY; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="V+xcY9lY" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-37d495d217bso1930600f8f.0 for ; Fri, 25 Oct 2024 10:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876564; x=1730481364; 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=YvdhnqZWhjJaVRixzXDF8i8NipPmGHymdrTVaS8WSIY=; b=V+xcY9lY8+VhefPvWzvQLqs6bq0IAfYlzx1Qac5aIVuRmlDHdaUyzI0yM3j98TAlW7 msIv9Rj9FxN7fUfMilC5Bd8V+6S1VIIBfTlJfwvEsEH9rWMSs1hgRTTZgqXsZ1M6g71X toGhaowAE5/RXAVcJw4kuyeLnwyhla015DwIqXqJtrMHO8kTvN8aJlfEJELY4y47GNQy 9cB8MMLitLuRHd4G5ug3nnR8bdEuvsica6nqnmwcD5r8eTVQuBw2Pn0Fgn6ct4Cf5agz aZ4Mfty0uRIl5z0nv5dmgoMh0D0poAtOyOKVRz01XpYFrzoM7iCrm7msOqWYE0SxCySs E6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876564; x=1730481364; 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=YvdhnqZWhjJaVRixzXDF8i8NipPmGHymdrTVaS8WSIY=; b=VdvWHVBBiPXO2kHqxrVNYmUFAvs/QfHZlS6UCOc37ZXRbq9Q0AFxee6oWfE7yhz+hg FdnZ/EqzdBPOmgfZ+iMao2+Dvan5m/ECNqvaP/6w4rvp3RZn94LjVUXPnNIFtwhuaeIV X/uGXdc9vKbQu5PAphzIub0oJscbh9YRUM43FxUL+JSJvhojsQBlKGzPo3s5e9TDUv2A Bp1/0z0aU12Z/VR/xdXYmQYPSZZP8aOq+MpBv6hUkwGjhDBy1ImX+nKy/KECDYWxSF8P vWLOC9fM0kyp6EBIK6wetHMElUKF/CTsBi05ZkMyJHf/I/0DMQdJQVEule19E1f14eJA HGwQ== X-Forwarded-Encrypted: i=1; AJvYcCVMkZu+urDTAG92r9tVkm/5OndEjanHE6Yxc7tvr0c2IvF0Qr9hoIRZQ9ji6Y4KSfpQbfuFFSoI1Plwr1g=@vger.kernel.org X-Gm-Message-State: AOJu0YxhXaZby2O5gPmGSyiNyAQIecBE1+PNIGU8IlsGk+gbOg3ebCHG LFs5x/0aPoY1SikZgDGXaoeEWXZMevgzlp8WcYX10UW25lBBQ19uUe900Kw/DY8= X-Google-Smtp-Source: AGHT+IGJw1+OsEH13czUNrPVKJZqUz4zqCjXXtEZzfN0U7VM1+Tkm4ryrjbOYe8QkQQMzLnZPTtsFg== X-Received: by 2002:a5d:6a07:0:b0:37d:4619:f975 with SMTP id ffacd0b85a97d-380611727b1mr120000f8f.19.1729876563675; Fri, 25 Oct 2024 10:16:03 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:03 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:34 +0100 Subject: [PATCH v2 03/36] dt-bindings: display: Add BCM2712 HDMI bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-3-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 HDMI controller uses a slightly different HDMI controller than the BCM2711, and a completely different PHY. Let's introduce a new compatible for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.ya= ml b/Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml index 5b35adf34c7b..6d11f5955b51 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml @@ -14,6 +14,8 @@ properties: enum: - brcm,bcm2711-hdmi0 - brcm,bcm2711-hdmi1 + - brcm,bcm2712-hdmi0 + - brcm,bcm2712-hdmi1 =20 reg: items: --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 5C5B11FB8AE for ; Fri, 25 Oct 2024 17:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876568; cv=none; b=f+2wpsHy80EcktdLLcHKvJ6iznHUrhS36bZCfHl6iS/xDZGgtqEXccX+PGSGa6SijaE8nbIjKDY5T67Iqwm6DfS4pH4LwZOC8bLnkpwdXIsoiYEDvAlpLMQV+5ZLdGqrzlVDyDa71jawkmm8bUSghvApbKQwLES/hOEqJzlCeLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876568; c=relaxed/simple; bh=dv8rXfxqR9AoaKXMEWoKx/PzHL9rfreE/NSbe58pUjA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d9uRMY1DeeXUVeL0jpe/CiIDvMV+eOMIgx2LAoXhuf8BlzmVufBinDGF0TTSReGSLiQJQrGtCDdlah7KEL9x4s9l5D/ujHeeT5oXljNdeHN6tOhw9M1PiHWnRehPzb6SVwBk9TNZa0WCezIs4fJcawd7YOIXbMWeDL/IV79Y0jw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=HJjVLcs+; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="HJjVLcs+" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d58377339so1728572f8f.1 for ; Fri, 25 Oct 2024 10:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876565; x=1730481365; 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=F7a7/HziehwTjKT233D/IuQwrsCio9lv2e2bEhcrly0=; b=HJjVLcs+IYrKCIAFPllcMjTqWsTYUGTjnYy8bsc11ErFpesqL0/OfFmeURCOlAFw6N cA0VjAtf1XA1GuvY5lXk/fVmvP/u7Aq+cxbHNhfXQpTBRKWL0Oi/wyR9G377wnJX9Y7W Vc2+5ZUaSNkPnewVwHMN1iiRa7mZsOfH8AzWdM2nni4G7y4b7ZYD0XCxa8dSdV34sTWP b3PRvEsh719ni0A6bOp5+UXVAEYns3UzmHzwLixQAWoaTnjck0c+taIXv6rnyR0au+36 5KaT5YltUO8riZGBSh7PoWJtUeN8nynuPauzN+31PIQ1j1gZZZX9cXzSQn02dIMfLVgq W9Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876565; x=1730481365; 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=F7a7/HziehwTjKT233D/IuQwrsCio9lv2e2bEhcrly0=; b=nfXKnpHgvjs4/GGf/7s5fqbp1ChRq4NWPhs6ONYXaLrB5SDjUbTqMpmj1u0jEmqsVB p9GdWU0B3V/qXc44X0ZVWlM4TLHs9p8br0R3o5q8rir3dHzBrD+GyugZOgsFezGkxfY/ C99tVegcZuT+Rnju95Vz3A4DXCsI0gFlRf4EO0yCBU4TtNhsT5CGw/bYS3AmnITDEgoK QAjK5+v/Nx5KXYcw4hMhscQ1SfXbUV9vYCCdtQZiGDB4Dwllp5gsvQy+G7FSikV1XOgu H5KzgBpVAfRsDm9a8QIU6H+0JqmYf2b1c7+aFCCs17kIEpVJHEetIYD1Qge5zf+NE0Ao uglw== X-Forwarded-Encrypted: i=1; AJvYcCXA3wYyTmeeplQT++80UM1ausoCWnSU2XacAA/8caxHLkGe3ETdLHNXGt+Kot+Nx9DmnIF1VWSzxY8ycc0=@vger.kernel.org X-Gm-Message-State: AOJu0YyUQxochcARNC5Z4mmjDRQOIBCMEZAj3uqSSVHmD/S3jVS2lt1+ nUKuRUlX7e1YiOq1lvt0//AZO+rUY4FTbMpS8eUk72opwFZQGRM3kr4QHYLm/nY= X-Google-Smtp-Source: AGHT+IEFF/mt9prwLkoO/wBDShJYk4RCDN1nX+/N8QkdDrkFHXlIdTeqdVrZSLG6RmWbSoiHWDwtlg== X-Received: by 2002:a5d:4106:0:b0:37d:612c:5e43 with SMTP id ffacd0b85a97d-3806101335amr193017f8f.0.1729876564669; Fri, 25 Oct 2024 10:16:04 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:04 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:35 +0100 Subject: [PATCH v2 04/36] dt-bindings: display: Add BCM2712 HVS bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-4-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has a completely different HVS than the previous generations, so let's add a new compatible for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/display/brcm,bcm2835-hvs.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-hvs.yam= l b/Documentation/devicetree/bindings/display/brcm,bcm2835-hvs.yaml index 2e8566f47e63..f91c9dce2a44 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2835-hvs.yaml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-hvs.yaml @@ -13,6 +13,7 @@ properties: compatible: enum: - brcm,bcm2711-hvs + - brcm,bcm2712-hvs - brcm,bcm2835-hvs =20 reg: @@ -36,7 +37,9 @@ if: properties: compatible: contains: - const: brcm,bcm2711-hvs + enum: + - brcm,bcm2711-hvs + - brcm,bcm2712-hvs =20 then: required: --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 7D15B3DAC1E for ; Fri, 25 Oct 2024 17:16:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876569; cv=none; b=AWvUQ4Fb12EbXSqeCOzOzu0QfbabOqALrgh36k+LV20crld+1qGCGP2vu3vBazJdwCvdE8o7UMdFFmMnFxLR96Tb13HLUkG4FB58E6EGdh/RX3v6Yaek2CFZtnofl0qeLNA1fmdF8RQGcDBjjyA6+/k8zOkHCqYr+wEaTbzOEyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876569; c=relaxed/simple; bh=EzCY04J3dN6dTWo5FwrMuejIBtmJGz3e+StnFJARUp4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Sq13BAfdtK8EYk7AmleMZtmo6lhyd/w2CbSIe5b8ordJf0AyfZNpqvMmu9b0NRnNQZhwHVIR2uxvHVH5ayQY73vF2eMJPydeyUOUF2hkIO9s3v6f13MZFa00eZDJpOkLeO36Tal5nNYuhEWx2bwaXZMD8178Um6cfpvFlNmnCpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=KSVVkqgJ; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="KSVVkqgJ" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-37d4c1b1455so1467692f8f.3 for ; Fri, 25 Oct 2024 10:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876566; x=1730481366; 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=uvy6mw3HkfOGNiDeKKmifz1sEp4TpAMlLMBCwtNZJJ8=; b=KSVVkqgJIKlthNKX/izMXmNMjDGtLIkFSPXqXt/ujb/FVcQYeW9rcGkTWbrqPnlcV9 AJvhVSZzK1XBLACYScU3Sf0WY4PTDGawmEQ8O6pJObV+1QmnnicBn1Osrpd9OG7qa5sn YRTnYgJU/H3r5dsZ55317voR1tRuUUc8ldPuAlf7r3qXPK2KVOS8ACayZkWRvE2MvDlO 4M/ypvG86nDSAEvpzMofeymWbpTTrqoDj1Uq9AmzbV44zDoWD+OzSPJYd/H3cMoIG4qY Z2YmWNi3EGFTAnuiMqEbXm7TWnNyGnV42c4w+bCs2jGCujca1+g0FxC3FGVzLPeVMgo9 WkjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876566; x=1730481366; 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=uvy6mw3HkfOGNiDeKKmifz1sEp4TpAMlLMBCwtNZJJ8=; b=pILwb2lFJnDoyfQilv5x+zjVc3bYGvj3OaKLBN8kGJaebq53LbqfV3MSGvp3w5WDzE 5eHR6LBSLo0YrWtVO5QyrZB2d6mBElMUY9JSAGBzcTcvNOHAxRXBcUJd3CC73yvdtqmF kRBfwBdwIj3Md5ms2d+MlAZ0+GppB3Z59YrRDrbaA1zipksN/5kRirEHmxminJ26p8be kT4ikNe7aJw90WJnlB9lQSnUoX8DQGJBdCRoGB6IrPuYZ5n8N5LybVRdjJYQYXvnpw3g zaZfiJFIYFTiBoCIjVq8gGa+Opq1gkWRRHgo+n2pJViDu6XuNKQNHuAo19LRK4010Zr+ /LRA== X-Forwarded-Encrypted: i=1; AJvYcCWF9wqu9lObQeS/7i5HBKQte+NrbB+Xhh5OO5Tr6h4zPRP/MsXV20a/zR0NHfdg4v9xbIh3L/4r06CsQNs=@vger.kernel.org X-Gm-Message-State: AOJu0YzlR3lYOH7IQmBcZXSNdDY7IByqQTJerttFTpEdTT4JK6otqXuM CrvOMqJ/qlcDrUlUHsA1v8mG8SyG3c0uaJQ+VZl/wxJ2xdYks8R0HffUDRMbMFg= X-Google-Smtp-Source: AGHT+IHirezA1gYr0G/DUtQrSt/DP/1VMOY/GWyL0+CDPDCZHRfOmDWirKI9sgtwCb0jA2Kn8vQ++g== X-Received: by 2002:adf:ea8d:0:b0:37c:ddab:a626 with SMTP id ffacd0b85a97d-380610e69f9mr139123f8f.7.1729876565769; Fri, 25 Oct 2024 10:16:05 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:05 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:36 +0100 Subject: [PATCH v2 05/36] dt-bindings: display: Add BCM2712 PixelValve bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-5-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has 3 different pixelvalves that are similar to the ones found in the previous generations but with slightly different capabilities. Express that using a new set of compatibles. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/display/brcm,bcm2835-pixelvalve0.yaml | 3= +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-pixelva= lve0.yaml b/Documentation/devicetree/bindings/display/brcm,bcm2835-pixelval= ve0.yaml index 4e1ba03f6477..6b5b1d3fbc0b 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2835-pixelvalve0.ya= ml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-pixelvalve0.ya= ml @@ -20,6 +20,9 @@ properties: - brcm,bcm2711-pixelvalve2 - brcm,bcm2711-pixelvalve3 - brcm,bcm2711-pixelvalve4 + - brcm,bcm2712-pixelvalve0 + - brcm,bcm2712-pixelvalve1 + - brcm,bcm2712-pixelvalve2 =20 reg: maxItems: 1 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 9D54D214426 for ; Fri, 25 Oct 2024 17:16:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876571; cv=none; b=GKMA6f2NS4XbY6HizQ1pba2jwyvfi5XCcrajrY8/He7tfSwqwCmAxbLYb1u3tZVHUCWpnkw9D15V2/113T7wFYv1RSZz4ag7CX+GSDcHytqQ010OpBY3b7nhOu/N0xOD8c0tMrB9ocYV+2vtPsKq3RPSQHZYyFwQkwl5HV2o49Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876571; c=relaxed/simple; bh=im8lPEqPibwrkF20d8j8rEeYbRDE7CTkHJHOC7HO310=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MF7GcFTw9TPa9tJzNkNk/zSNzdTxqX1x/bBdK/tFCUh095cSEyEpMGlnC1x6w5Wm1ugA3opbiVGuN1z8rdO8kr8dJhA4+ZOWRyg0KbgnHsOmL1nj9BYmiBc9GsrP2a5ikGucRSwTjXSgVvqP+hTaJt4sT6oB76wXvXxITreEGc4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=hq77L8ag; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hq77L8ag" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-37d70df0b1aso1770268f8f.3 for ; Fri, 25 Oct 2024 10:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876567; x=1730481367; 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=N3D0msUfHXMuv4C1SeqQ0nPQBde1GE17PCvfA0szIc8=; b=hq77L8agFTQHoKn/LUIhqFf6iqy6b+G1eAnm/qLM1cxLur0NTEegbLWzNJM8hEh+Of nFX00/o0m9xoZBJjhRlO3Zu4fpfcs550HPEkoBA9rmXVrrqrRFmcGwIeDVtCnwWzvXNC yBmyaru0/ptOat0zlO4NeedWxcMW4B1dDC/0c+RebeE4/FR9M3x+U4d2rAfwHV2tJSvz vHCL2C+pDBCfazM8zxwjJQjxwTl7j1XizllsDSA5NJfZzMu0MJNrqkjN3bEgdGkvZ5gk IwTeRGoqUbKPmHETc+4GemGhrhyjRGKKz5ktRwLyljo/m0C04TP7QO8btNpmjmH1wyb1 GLAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876567; x=1730481367; 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=N3D0msUfHXMuv4C1SeqQ0nPQBde1GE17PCvfA0szIc8=; b=BZ6rJKFihmBG1RnlS0pBX57f1To+hv8xuEHFxLvQP5/f+bxKTAjsYzu7AVDK6fHUSl pn3CfGpFMM2BkUn1u1oBIpCGE/sAn/VuEcpki5pMC+gbyMU2wgTDQtc5aNdTRdx+OyIn bOLM71wuaUfnpCE5QPfqZlgPSSV/fveipfg4vyTdp9Ck3+fc7Fm8iITtt6wgVVSz2OR/ wNxSvKzFNtieDoo/A6nSQ1FLzFEaaDq/PdHzj7Obm/wi5ogD3BPZ0EFehQRE7sqg8Zav AGwv4ysDZsvzIO25YICTi4CiwbaAxs7rVJIqlbXJyqlf8xTa4nXfz2RkCKrToriE3T72 OOpg== X-Forwarded-Encrypted: i=1; AJvYcCVPB/IIBDd3w2rsV8J+bkoTnmSIuOxWM282DtgdA51fmcyhTLaQy9OjBKe5C8mCtxiuaQMPxBbZxfVfGbw=@vger.kernel.org X-Gm-Message-State: AOJu0YwRqqZtfOiE/s9dYxJTTF83rI9eU6aqAZIJX+G2wwCrDqHOJB/N 8cN9bzA/Iqo8/3frUfvoTIw4BaIHYAz6DTDavX7/i+XiFxCQxiM++DNWVx+L+Hc= X-Google-Smtp-Source: AGHT+IG4wS89LpASUknXmvnY5DCWRnrRky+UYDTB7/8M+xpU5UpHS3oldLC31P65rzLuem6Jwptv4w== X-Received: by 2002:a05:6000:c90:b0:37d:511b:aecc with SMTP id ffacd0b85a97d-380611ff90bmr97416f8f.54.1729876566840; Fri, 25 Oct 2024 10:16:06 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:06 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:37 +0100 Subject: [PATCH v2 06/36] dt-bindings: display: Add BCM2712 MOP bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-6-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has a MOP controller which is basically a new revision of the TXP. Express that by adding a new compatible for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yam= l b/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml index bb186197e471..c9c08042cffc 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml @@ -11,7 +11,9 @@ maintainers: =20 properties: compatible: - const: brcm,bcm2835-txp + enum: + - brcm,bcm2712-mop + - brcm,bcm2835-txp =20 reg: maxItems: 1 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 895853DABF5 for ; Fri, 25 Oct 2024 17:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876572; cv=none; b=mJZ+yhv/UUmSOjvk9z+5Ur8QsgNgmZD54FobOic+1u7uvlPU+v/GtefwmXWyyKNas0O9CFlk1yUVw9W4y2RhDs2AnYCbRWOI/Q1jIBuy8cqop3n2Tz+cYiz4Zs17P3bisOPNKMkbXrPA4zZF365g9R4K+SmaEOfUNXrrYZF4UMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876572; c=relaxed/simple; bh=8naEEFxCbLHkAmUL6zTp78kctDF2IrBiUYYqMXNVvhk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fqtN1baOT0KM/TQV0RTU15K3AH3iVi4Q/0jItRBCH51t8gHCSXBKMv9KLjZQmzXcsl/pzoGWiCEPuB5LmzafH24wLHEDlcbnMWHRHqrbmKt7IVRiGs2STwAA53xVYnYruaIkVBMfoF+sHFmJx0NVyZ9Lc28W3vA+Tcf6YkwSFyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=n7+QYS1X; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="n7+QYS1X" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43161c0068bso22041435e9.1 for ; Fri, 25 Oct 2024 10:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876568; x=1730481368; 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=fLIH9tyCJziS0oZVp659ectLCUh/04IQKJ1VKaLHRLQ=; b=n7+QYS1XYvOKH3cudTWjSJ0KLObSgnFTGZLMkvrUM9uQj12nByKjEQtDnNLB5rSsbg U+82f/7ojms+BhV68QaPMV/x3kAoHEc8rgtEWcq0AtTIxVFoU1vXhRGxYw4kHa92o2P0 FVRySBpKVEWE8J1IA0vKaAxg9Q5d3f9ZBi4CFkq+mCZGkVjVDzSqMX7yZ8Q5T89oTMGu aR2tiIqPtcxj6Ycw3d648NKtH1wMJvCoEYbXylIJzqpbJy2DnvK/FbCn+OZYXVRAL+II 1TifB/3HhPEMpzZexjGFl9PynScU8eZf3bm1fWzgdhKvPD9js2nA2JOLG2ZedFvhE8J8 voLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876568; x=1730481368; 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=fLIH9tyCJziS0oZVp659ectLCUh/04IQKJ1VKaLHRLQ=; b=GSRMtjxbC0j4zw4E5YncMiF2ZBbrtTQ1mKcx9t7grzafgsSdS++gLgS4by0TbXZ5mb 5xchS8QuX+aOZ+nq/XSIR7tXBn1tI4g6RL2Vv/KfJZJdidaTGCn/AReD5b2wjekY0b0W gR45obzc6PST7Qb5Uj0cOTJ6fmTdmgAaoUXjNmc7ExseFt1uAGOiULz7amg4Cw6KRQCy Mt21Ecej3eL1NvHs9M4AlZIYymuKCH991o1RSoL7nn/CJDF2LeY93X/hnrXWb4pVJ5Xg 3w/rumFo1ujo54Duxfrj8ZDDZ5Ha+l3EzyBOj465+34/9N0JeYCOgdZRQ+MGgXVy778o QOhQ== X-Forwarded-Encrypted: i=1; AJvYcCVQCNUkp64ZaMEnCaG+zyJocvMMGX7oCH+n1Mr+/sP2fWxMt2q0bc4m6pzzmmvkBUNFgxYosiHVu+3xCEw=@vger.kernel.org X-Gm-Message-State: AOJu0YxZuX1OxIGZDIohZ4GA0sU9IAwhEtHQW/3kFlIUTzHPsBEUAXpc +IwKTzEfa9WYosMcImNs67Ja7wD3MfxlXE8tyzAIEFsJVKY3fxdT7tqHoTO8UU8= X-Google-Smtp-Source: AGHT+IHeSVH8WqDyVkxiZojUuOptC1WUDDZpkGk6AneCSrSzoFw3bb8pQ04irSZpkbra+Ogj57FSIw== X-Received: by 2002:a05:600c:3b96:b0:431:50cb:2398 with SMTP id 5b1f17b1804b1-431841e13fdmr91410915e9.2.1729876567815; Fri, 25 Oct 2024 10:16:07 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:07 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:38 +0100 Subject: [PATCH v2 07/36] dt-bindings: display: Add BCM2712 MOPLET bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-7-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has a MOPLET controller which is basically a TXP without the transpose feature. Express that by adding a new compatible for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yam= l b/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml index c9c08042cffc..16f45afd2bad 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-txp.yaml @@ -13,6 +13,7 @@ properties: compatible: enum: - brcm,bcm2712-mop + - brcm,bcm2712-moplet - brcm,bcm2835-txp =20 reg: --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 58737215C60 for ; Fri, 25 Oct 2024 17:16:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876572; cv=none; b=bByDPQJlmbQegf5PGxirGpzSFrKKX21HpOrMF/OSz1FwIRJlPOF+DMMtVhNAPWWL6DiB+MW2LO/7NSI8SZecUcc1SILhlswSnBf0W748FmTU8fC0cZkiqZd8dgm20ARpwOrnPc16Y80yTzZbkeQg/TV7FCAgrrYwX9qhmsfbh+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876572; c=relaxed/simple; bh=k6R9IHCAOKpNgfleJXOjd6jC25fBTS6hozkENjnK1mk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Lqunn97Hupt10lsbPv0EAqoAihn7IT2A4esNBKikTBaSycI+gcJ1K7nnTI9n4pNkzuAXHhQ3HBvyZszQb9H7B5CUFXLWFXWMXePUr7SfVtFVpPkmop3RI3mGm924OgvJuXDpHn+Yde9AuUBIlxFdfLxLgHt7GhY25l0nD8X8n5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=GzcpFNPr; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="GzcpFNPr" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so1495029f8f.0 for ; Fri, 25 Oct 2024 10:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876569; x=1730481369; 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=GHIbxCZv7ndlL/NngNJdWVaw8pnmec8lE+r1y4sRvZg=; b=GzcpFNPr7xDAY9PrGbdMlSYoEGgrolnKUN16DFcZd3jpXYJKG2tlyfn50MmYvovr9h cYoqQByba0/NItPP4jOSggUw4SGQdegNQi59UHh6wt7+1q8Id2RifGTustQSDEBwsPRH ihQD5qM1On7JPbVhwFpe7YUIj8F2jSKlc++HgcePn0NGlKqAtQIrzXg6/LWa/6nfI7ZW qwmSRD81pKvMxOvfg3EosyjGaY979jLB1867azbdCTq2K1D51lYYZ0tjadv1jeHSRwE/ 0HBU6YPwx/Wko4l4GE7jlxByFw5zHm/f8j4av8hzUtGLqcNiS4dVjg5uRmC66B2BY+24 AGqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876569; x=1730481369; 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=GHIbxCZv7ndlL/NngNJdWVaw8pnmec8lE+r1y4sRvZg=; b=qKvVDJUGZuMI9L9+ZIGpLrtnI3zitqmMiVnyGh/c5lfr2UZy0doQmH48xF6menNex6 nyvfZcVwvC7r6NzX3mlQjy4lCo+SDtTQZ1O+uX0fEw6am6p79RDaVTbC0T8gn/AJgzz8 ez4QBu/PE4EA6naIfkUbsezDiqxv8J6hIAabTLN7lasFIX+qanNJ8RdZdo1w7M0b70Oa ImuTtl7GKEUrTm2y9GIAFvH9G1uBYrRDylRlFIYUU4QZsnXSvRZzLchhFz6VzJEZv9Hb MnmrVv4zj2FLaIY6H3LDM2/RWQKDBmGWeVGmz6lEWe7t2J5Tt9UhLUM0bgiPvlVbjEQd 0/rQ== X-Forwarded-Encrypted: i=1; AJvYcCUF1fZoqDh5XAWlOENK1UQ39BPX+cmIsWBCAUBSHOSnebEz9mjtyGY8LYIJDjo8kybDqwb7t/FYCG3D0Hw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9URiMIdCw0siQyPnqZjpbxjKQTleMfKu1N+CELphPxypCxfMH vujQGEcJldTCzaGrjiO9MURlp69Xd0kuIurPCodevKESiFccWpE2WaD8EBBRxCU= X-Google-Smtp-Source: AGHT+IEtkqmEo1cHWR2W1weuYPM4uWgJxftiucw4MZPmb7qQfL+iD3mzdPD9IiAb9rW3E2dTgpbMnA== X-Received: by 2002:a5d:6082:0:b0:374:baeb:2ec with SMTP id ffacd0b85a97d-38061122a87mr106867f8f.19.1729876568721; Fri, 25 Oct 2024 10:16:08 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:08 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:39 +0100 Subject: [PATCH v2 08/36] dt-bindings: display: Add BCM2712 KMS driver bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-8-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 SoC comes with a new variation of the videocore display pipeline. Let's create a new compatible for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/display/brcm,bcm2835-vc4.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-vc4.yam= l b/Documentation/devicetree/bindings/display/brcm,bcm2835-vc4.yaml index 49a5e041aa49..2aa9d5d2afff 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm2835-vc4.yaml +++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-vc4.yaml @@ -18,6 +18,7 @@ properties: compatible: enum: - brcm,bcm2711-vc5 + - brcm,bcm2712-vc6 - brcm,bcm2835-vc4 - brcm,cygnus-vc4 =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 B56A8223A4A for ; Fri, 25 Oct 2024 17:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876573; cv=none; b=mFvg9M3vooEQq/Allb7kG/NpSAx7LYvYA1Qm/qwH+hpRdwzgskW/vrZjFZX+3eVsGISKXsTlp1BLsUlHseeD/Qly3z0YzYFXd/EA5BFR8IZYXbvnV2O1hGgu8FbgyAKJofIZOyqOqpMMOcpCzET+cQeYArAR59LcNoFclV/96wI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876573; c=relaxed/simple; bh=qbTXGGCtCxRZYwnAfxwA9KNcR/Ug/Ds7SZHmLf1ddZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u4VdM74SvqadAw9GRpbZP1UywPUYQ7MqgBjzqgDTg6qejTRXWn8z7v2Pc8wLjpEHXVXnZviKB11NQXdqK0JtfCzzM5nD+mq48I6k13pedM1z28wZFhbDel5fMUTLJI/1OQvXBGnLv7zAkTESlFcB7XcK3SUQK4VLZVc0JLJDtaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=MtwogUUq; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="MtwogUUq" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d495d217bso1930697f8f.0 for ; Fri, 25 Oct 2024 10:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876570; x=1730481370; 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=5GUojHTwofpiEg2dwpNmSHs/emdcMv58M0L0R39wpRI=; b=MtwogUUqA3LKPuCToQrOZSZ/P1lm5oo9buekMumYqxn7PC4IJWh4Pu9G6uVNGj9InU Rwjpb9a2Z8QKF7En17h967fS+MQxxBkqp8VR3C8wsBiSu6IZiIrwuITnauHzmAp/PfIK X6G/iP3IR4MHWa3EoO4ttI6g7hFT3KW5EZNWU9gDtBNUoCKr4O/fTYD7NOyyTew7ns+U INS7mO7nW4tu6Hawijy+F6elnv5YfTLgzz/cA9fuxn9BOyhBFuuHGLfDkwuKMF+cKfs7 KEWHdvr//4piPR5gjDpnFAViQnxp+kNseD4jKS1tx0SmlkIKvwB6GiID8Nv7nFnqRJ7n 9qPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876570; x=1730481370; 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=5GUojHTwofpiEg2dwpNmSHs/emdcMv58M0L0R39wpRI=; b=ZNQwwLAWfZ+gnMDdKAelFnLlMmW2RLDX3qIXjfm96LaICcth6EKmgQYAKuPY56abuU ORUhI9uM+sbXWFaNbeP1wceYMAdDxpF8pi89FCQH8Or1KRnOc2qyP5E7eXCXQly8ZLlG y31i9yxFUPZoMvpbx6E7WLQqwfQw8gVf9rebxLvKQz24Y65NWIfFMMs4eNpvKcTa39xA Qq2WB3kAdETfMTdTQgCUCn/HwQrVc7W9aUxkrwwMusXFwRz+pKMk54Gyj2qIypD1U9gw TCGZ8FHDEr5Ev2EDFgTdd8uTPjR2SFkzvnNPk0eVQXFPwJZaDJ+585TnrBLpBnD7ojdM f61g== X-Forwarded-Encrypted: i=1; AJvYcCXw62/xXswrFttg7Z3XjNMiv6ikMhl8Gli++JBFI0zWB3lhr/d21ayKguMrQims7djcc3/oSUWNnrIlu48=@vger.kernel.org X-Gm-Message-State: AOJu0YztAxEeLv7sQUurrQJHadmZjcfoNOLLmRVXvAjGNjBrBWe6Irc5 hVR2MHpGvgmVzvq1nDi61DolmG53+A8jsDTCvPjNbIwafIU3JBYJcdO59pZcGZ4= X-Google-Smtp-Source: AGHT+IGCwZV5fbmeF0D4Xme2MrSeeStQPCABILFJnZu8X/UbpKfmCgg7tE2q1WXeLJuU2hjtaGAprQ== X-Received: by 2002:a5d:56d2:0:b0:37e:f4a1:2b58 with SMTP id ffacd0b85a97d-38061172aa9mr141238f8f.16.1729876569829; Fri, 25 Oct 2024 10:16:09 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:09 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:40 +0100 Subject: [PATCH v2 09/36] drm/vc4: drv: Support BCM2712 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-9-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has an improved display pipeline, most notably with a different HVS and only HDMI and writeback outputs. Let's introduce it as a new VideoCore generation and compatible. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 3099292f22a5..417a5b456d80 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -460,6 +460,7 @@ static void vc4_platform_drm_shutdown(struct platform_d= evice *pdev) =20 static const struct of_device_id vc4_of_match[] =3D { { .compatible =3D "brcm,bcm2711-vc5", .data =3D (void *)VC4_GEN_5 }, + { .compatible =3D "brcm,bcm2712-vc6", .data =3D (void *)VC4_GEN_6_C }, { .compatible =3D "brcm,bcm2835-vc4", .data =3D (void *)VC4_GEN_4 }, { .compatible =3D "brcm,cygnus-vc4", .data =3D (void *)VC4_GEN_4 }, {}, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index c6be1997f1c7..14b0a7ef2683 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -84,6 +84,7 @@ struct vc4_perfmon { enum vc4_gen { VC4_GEN_4, VC4_GEN_5, + VC4_GEN_6_C, }; =20 struct vc4_dev { --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 B215A224409 for ; Fri, 25 Oct 2024 17:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876583; cv=none; b=NS0fAjOZU2UOryRSln1IbCq9v1QVmmY3EUUqpyHJuUxlrp/zxsWl0SUuGHVs8Wg5apzB5vMFhIfkr6MvV2fSxAwUbLcqp3KwO1lGq0583aCe2E84xOg3+2mEVO663ZGD+R29GpGyZlCx7f1guIjlXcu4pY8lttUODo4jlfO19h0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876583; c=relaxed/simple; bh=z0PIy1d3eC8YJXC+OFicf5vJWYtsLHDHQmhG8wMDrAs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XfQvRJclYo5U0Qd6x6K2cE+hVp6JuWEhAzTO/KEiMsL/vKXeLs+XJOa+Cu/DMW0UTqa9cpZh6oC5ukYcKm8HIQyBW8Lh2sfp+EkyUX4QP3Y9mJdeg607eSZ1muepkqoq/I/ttcxQ5CegQlQpOaHXo3UedoCz+626NVr15o6OGfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=Dm+IqpY5; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Dm+IqpY5" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d495d217bso1930744f8f.0 for ; Fri, 25 Oct 2024 10:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876572; x=1730481372; 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=eQEy0I65UAvNP/JLKWqUi1U0XMKj1EH5WdRu1gWVUzs=; b=Dm+IqpY5wWqj/IL1zSelbKt36dgNlNAN1dullSqqWCvqQp/cxrbZH6AwPYGatFPcL8 hON4viYZaRE5NuanpX4h+uSYTFVyNL8dGCJMgxLItrVkVwfLVPLkUM32JtuIxk3fEPM0 f1BhwfzMsVR16xY/mvlP3XbZ4fSpZNmRXTMIET2qytRHzFL7sFxRiXhi2ESpuK9VBcya YuHJxsONWL30drlAl+DIWxMLC4lf+ew1s2EXWjFzYHf1FJmMDtBq442yQM1DXjYgyOvv mfXPVrDpuSeIbfzPT12z+h+5F1vjYGUs7gaU98cFVPW6G1drfopL75x1FHukTehPyURI 7ywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876572; x=1730481372; 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=eQEy0I65UAvNP/JLKWqUi1U0XMKj1EH5WdRu1gWVUzs=; b=MaqssnFT/mlx1bwv4r9GDiA+7UKsSfPQUDRej8II+Ng9IrHYGQ4fiufc+suSnAY5A/ CKqf7MCRNT9XjxORLIYieKOgPjoKKdI0czqGSBLshrknjriH0F/7FghW9Fa4RQrcnmap Fvj4v/Ai30WSxw2pIvi7e9Xn7FUIm28hhW+zi422hsBRQgd5CIE15Z+BogXT+xPuJn1d kEIYvkU/TXsp8sMLzAR8f2fodrQ0Mz0/Whgl4ETyAv7irbFGJ+kaXV+b0Nx7EJlAqvDm Zo9FncrK2AIGIBTEZMILfaQUGjohdeG4o5PX2u/BeW2nLyhMBi84ekAQRqlCM6Pjd4RK bJrQ== X-Forwarded-Encrypted: i=1; AJvYcCVk5sEbgy7wA+F5wjF8HH41EJUI+r7nO2XyZib3py+7VMY6w/dQ3MCS84ENn6zsakk06CsLcBZX6BO0pAA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6dvMKqRNG3cejVNOkUjgfrYxOp+jQJI9+weZYt9G/TQoDsKXl fOXBjKCT/wn23SJX6Iv8+xC8x/kyjvJ4tIGt/DnevrOUBAfL39icIx8Pi3trtDQ= X-Google-Smtp-Source: AGHT+IHoF3S0BlWVKnxRkG+M8VOAf/ltSo4cMnO8kJ7RUVPYkL+8sUxtVqa8Fq82OI7AHdr6ukuoYg== X-Received: by 2002:a05:6000:b11:b0:37d:4376:6e1d with SMTP id ffacd0b85a97d-38061227b35mr125534f8f.41.1729876570989; Fri, 25 Oct 2024 10:16:10 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:10 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:41 +0100 Subject: [PATCH v2 10/36] drm/vc4: hvs: Add support for BCM2712 HVS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-10-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The HVS found in the BCM2712, while having a similar role, is very different from the one found in the previous SoCs. Indeed, the register layout is fairly different, and the DLIST format is new as well. Let's introduce the needed functions to support the new HVS. This commit adds the C-step register layout. The D-step will be added later. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_crtc.c | 47 ++- drivers/gpu/drm/vc4/vc4_drv.c | 6 + drivers/gpu/drm/vc4/vc4_drv.h | 30 ++ drivers/gpu/drm/vc4/vc4_hvs.c | 564 +++++++++++++++++++++++++++-- drivers/gpu/drm/vc4/vc4_kms.c | 98 ++++- drivers/gpu/drm/vc4/vc4_plane.c | 767 ++++++++++++++++++++++++++++++++++++= ++-- drivers/gpu/drm/vc4/vc4_regs.h | 181 ++++++++++ 7 files changed, 1616 insertions(+), 77 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 575900ee67a5..53bca104d0d5 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -83,13 +83,22 @@ static unsigned int vc4_crtc_get_cob_allocation(struct vc4_dev *vc4, unsigned int channel) { struct vc4_hvs *hvs =3D vc4->hvs; - u32 dispbase =3D HVS_READ(SCALER_DISPBASEX(channel)); + u32 dispbase, top, base; + /* Top/base are supposed to be 4-pixel aligned, but the * Raspberry Pi firmware fills the low bits (which are * presumably ignored). */ - u32 top =3D VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_TOP) & ~3; - u32 base =3D VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_BASE) & ~3; + + if (vc4->gen >=3D VC4_GEN_6_C) { + dispbase =3D HVS_READ(SCALER6_DISPX_COB(channel)); + top =3D VC4_GET_FIELD(dispbase, SCALER6_DISPX_COB_TOP) & ~3; + base =3D VC4_GET_FIELD(dispbase, SCALER6_DISPX_COB_BASE) & ~3; + } else { + dispbase =3D HVS_READ(SCALER_DISPBASEX(channel)); + top =3D VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_TOP) & ~3; + base =3D VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_BASE) & ~3; + } =20 return top - base + 4; } @@ -122,7 +131,10 @@ static bool vc4_crtc_get_scanout_position(struct drm_c= rtc *crtc, * Read vertical scanline which is currently composed for our * pixelvalve by the HVS, and also the scaler status. */ - val =3D HVS_READ(SCALER_DISPSTATX(channel)); + if (vc4->gen >=3D VC4_GEN_6_C) + val =3D HVS_READ(SCALER6_DISPX_STATUS(channel)); + else + val =3D HVS_READ(SCALER_DISPSTATX(channel)); =20 /* Get optional system timestamp after query. */ if (etime) @@ -131,7 +143,12 @@ static bool vc4_crtc_get_scanout_position(struct drm_c= rtc *crtc, /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ =20 /* Vertical position of hvs composed scanline. */ - *vpos =3D VC4_GET_FIELD(val, SCALER_DISPSTATX_LINE); + + if (vc4->gen >=3D VC4_GEN_6_C) + *vpos =3D VC4_GET_FIELD(val, SCALER6_DISPX_STATUS_YLINE); + else + *vpos =3D VC4_GET_FIELD(val, SCALER_DISPSTATX_LINE); + *hpos =3D 0; =20 if (mode->flags & DRM_MODE_FLAG_INTERLACE) { @@ -459,8 +476,10 @@ static void require_hvs_enabled(struct drm_device *dev) struct vc4_dev *vc4 =3D to_vc4_dev(dev); struct vc4_hvs *hvs =3D vc4->hvs; =20 - WARN_ON_ONCE((HVS_READ(SCALER_DISPCTRL) & SCALER_DISPCTRL_ENABLE) !=3D - SCALER_DISPCTRL_ENABLE); + if (vc4->gen >=3D VC4_GEN_6_C) + WARN_ON_ONCE(!(HVS_READ(SCALER6_CONTROL) & SCALER6_CONTROL_HVS_EN)); + else + WARN_ON_ONCE(!(HVS_READ(SCALER_DISPCTRL) & SCALER_DISPCTRL_ENABLE)); } =20 static int vc4_crtc_disable(struct drm_crtc *crtc, @@ -789,14 +808,21 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc= *vc4_crtc) struct drm_device *dev =3D crtc->dev; struct vc4_dev *vc4 =3D to_vc4_dev(dev); struct vc4_hvs *hvs =3D vc4->hvs; + unsigned int current_dlist; u32 chan =3D vc4_crtc->current_hvs_channel; unsigned long flags; =20 spin_lock_irqsave(&dev->event_lock, flags); spin_lock(&vc4_crtc->irq_lock); + + if (vc4->gen >=3D VC4_GEN_6_C) + current_dlist =3D VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_DL(chan)), + SCALER6_DISPX_DL_LACT); + else + current_dlist =3D HVS_READ(SCALER_DISPLACTX(chan)); + if (vc4_crtc->event && - (vc4_crtc->current_dlist =3D=3D HVS_READ(SCALER_DISPLACTX(chan)) || - vc4_crtc->feeds_txp)) { + (vc4_crtc->current_dlist =3D=3D current_dlist || vc4_crtc->feeds_txp)= ) { drm_crtc_send_vblank_event(crtc, vc4_crtc->event); vc4_crtc->event =3D NULL; drm_crtc_vblank_put(crtc); @@ -807,7 +833,8 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *= vc4_crtc) * the CRTC and encoder already reconfigured, leading to * underruns. This can be seen when reconfiguring the CRTC. */ - vc4_hvs_unmask_underrun(hvs, chan); + if (vc4->gen < VC4_GEN_6_C) + vc4_hvs_unmask_underrun(hvs, chan); } spin_unlock(&vc4_crtc->irq_lock); spin_unlock_irqrestore(&dev->event_lock, flags); diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 417a5b456d80..94e01ce2b1ef 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -279,6 +279,7 @@ static void vc4_component_unbind_all(void *ptr) =20 static const struct of_device_id vc4_dma_range_matches[] =3D { { .compatible =3D "brcm,bcm2711-hvs" }, + { .compatible =3D "brcm,bcm2712-hvs" }, { .compatible =3D "brcm,bcm2835-hvs" }, { .compatible =3D "brcm,bcm2835-v3d" }, { .compatible =3D "brcm,cygnus-v3d" }, @@ -307,6 +308,11 @@ static int vc4_drm_bind(struct device *dev) else driver =3D &vc4_drm_driver; =20 + if (gen >=3D VC4_GEN_6_C) + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(36)); + else + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + node =3D of_find_matching_node_and_match(NULL, vc4_dma_range_matches, NULL); if (node) { diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 14b0a7ef2683..aea585bf83eb 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -317,6 +317,21 @@ struct vc4_v3d { struct debugfs_regset32 regset; }; =20 +#define VC4_NUM_UPM_HANDLES 32 +struct vc4_upm_refcounts { + refcount_t refcount; + + /* Allocation size */ + size_t size; + /* Our allocation in UPM for prefetching. */ + struct drm_mm_node upm; + + /* Pointer back to the HVS structure */ + struct vc4_hvs *hvs; +}; + +#define HVS_NUM_CHANNELS 3 + struct vc4_hvs { struct vc4_dev *vc4; struct platform_device *pdev; @@ -325,6 +340,7 @@ struct vc4_hvs { unsigned int dlist_mem_size; =20 struct clk *core_clk; + struct clk *disp_clk; =20 unsigned long max_core_rate; =20 @@ -332,8 +348,15 @@ struct vc4_hvs { * list. Units are dwords. */ struct drm_mm dlist_mm; + /* Memory manager for the LBM memory used by HVS scaling. */ struct drm_mm lbm_mm; + + /* Memory manager for the UPM memory used for prefetching. */ + struct drm_mm upm_mm; + struct ida upm_handles; + struct vc4_upm_refcounts upm_refcounts[VC4_NUM_UPM_HANDLES + 1]; + spinlock_t mm_lock; =20 struct drm_mm_node mitchell_netravali_filter; @@ -356,6 +379,7 @@ struct vc4_hvs { }; =20 #define HVS_NUM_CHANNELS 3 +#define HVS_UBM_WORD_SIZE 256 =20 struct vc4_hvs_state { struct drm_private_state base; @@ -425,6 +449,12 @@ struct vc4_plane_state { /* Our allocation in LBM for temporary storage during scaling. */ struct drm_mm_node lbm; =20 + /* The Unified Pre-Fetcher Handle */ + unsigned int upm_handle[DRM_FORMAT_MAX_PLANES]; + + /* Number of lines to pre-fetch */ + unsigned int upm_buffer_lines; + /* Set when the plane has per-pixel alpha content or does not cover * the entire screen. This is a hint to the CRTC that it might need * to enable background color fill. diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index f8edb0791091..7c2dccfdb58d 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -67,6 +67,80 @@ static const struct debugfs_reg32 vc4_hvs_regs[] =3D { VC4_REG32(SCALER_OLEDCOEF2), }; =20 +static const struct debugfs_reg32 vc6_hvs_regs[] =3D { + VC4_REG32(SCALER6_VERSION), + VC4_REG32(SCALER6_CXM_SIZE), + VC4_REG32(SCALER6_LBM_SIZE), + VC4_REG32(SCALER6_UBM_SIZE), + VC4_REG32(SCALER6_COBA_SIZE), + VC4_REG32(SCALER6_COB_SIZE), + VC4_REG32(SCALER6_CONTROL), + VC4_REG32(SCALER6_FETCHER_STATUS), + VC4_REG32(SCALER6_FETCH_STATUS), + VC4_REG32(SCALER6_HANDLE_ERROR), + VC4_REG32(SCALER6_DISP0_CTRL0), + VC4_REG32(SCALER6_DISP0_CTRL1), + VC4_REG32(SCALER6_DISP0_BGND), + VC4_REG32(SCALER6_DISP0_LPTRS), + VC4_REG32(SCALER6_DISP0_COB), + VC4_REG32(SCALER6_DISP0_STATUS), + VC4_REG32(SCALER6_DISP0_DL), + VC4_REG32(SCALER6_DISP0_RUN), + VC4_REG32(SCALER6_DISP1_CTRL0), + VC4_REG32(SCALER6_DISP1_CTRL1), + VC4_REG32(SCALER6_DISP1_BGND), + VC4_REG32(SCALER6_DISP1_LPTRS), + VC4_REG32(SCALER6_DISP1_COB), + VC4_REG32(SCALER6_DISP1_STATUS), + VC4_REG32(SCALER6_DISP1_DL), + VC4_REG32(SCALER6_DISP1_RUN), + VC4_REG32(SCALER6_DISP2_CTRL0), + VC4_REG32(SCALER6_DISP2_CTRL1), + VC4_REG32(SCALER6_DISP2_BGND), + VC4_REG32(SCALER6_DISP2_LPTRS), + VC4_REG32(SCALER6_DISP2_COB), + VC4_REG32(SCALER6_DISP2_STATUS), + VC4_REG32(SCALER6_DISP2_DL), + VC4_REG32(SCALER6_DISP2_RUN), + VC4_REG32(SCALER6_EOLN), + VC4_REG32(SCALER6_DL_STATUS), + VC4_REG32(SCALER6_BFG_MISC), + VC4_REG32(SCALER6_QOS0), + VC4_REG32(SCALER6_PROF0), + VC4_REG32(SCALER6_QOS1), + VC4_REG32(SCALER6_PROF1), + VC4_REG32(SCALER6_QOS2), + VC4_REG32(SCALER6_PROF2), + VC4_REG32(SCALER6_PRI_MAP0), + VC4_REG32(SCALER6_PRI_MAP1), + VC4_REG32(SCALER6_HISTCTRL), + VC4_REG32(SCALER6_HISTBIN0), + VC4_REG32(SCALER6_HISTBIN1), + VC4_REG32(SCALER6_HISTBIN2), + VC4_REG32(SCALER6_HISTBIN3), + VC4_REG32(SCALER6_HISTBIN4), + VC4_REG32(SCALER6_HISTBIN5), + VC4_REG32(SCALER6_HISTBIN6), + VC4_REG32(SCALER6_HISTBIN7), + VC4_REG32(SCALER6_HDR_CFG_REMAP), + VC4_REG32(SCALER6_COL_SPACE), + VC4_REG32(SCALER6_HVS_ID), + VC4_REG32(SCALER6_CFC1), + VC4_REG32(SCALER6_DISP_UPM_ISO0), + VC4_REG32(SCALER6_DISP_UPM_ISO1), + VC4_REG32(SCALER6_DISP_UPM_ISO2), + VC4_REG32(SCALER6_DISP_LBM_ISO0), + VC4_REG32(SCALER6_DISP_LBM_ISO1), + VC4_REG32(SCALER6_DISP_LBM_ISO2), + VC4_REG32(SCALER6_DISP_COB_ISO0), + VC4_REG32(SCALER6_DISP_COB_ISO1), + VC4_REG32(SCALER6_DISP_COB_ISO2), + VC4_REG32(SCALER6_BAD_COB), + VC4_REG32(SCALER6_BAD_LBM), + VC4_REG32(SCALER6_BAD_UPM), + VC4_REG32(SCALER6_BAD_AXI), +}; + void vc4_hvs_dump_state(struct vc4_hvs *hvs) { struct drm_device *drm =3D &hvs->vc4->base; @@ -145,6 +219,76 @@ static int vc4_hvs_debugfs_dlist(struct seq_file *m, v= oid *data) return 0; } =20 +static int vc6_hvs_debugfs_dlist(struct seq_file *m, void *data) +{ + struct drm_info_node *node =3D m->private; + struct drm_device *dev =3D node->minor->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(dev); + struct vc4_hvs *hvs =3D vc4->hvs; + struct drm_printer p =3D drm_seq_file_printer(m); + unsigned int dlist_mem_size =3D hvs->dlist_mem_size; + unsigned int next_entry_start; + unsigned int i; + + for (i =3D 0; i < SCALER_CHANNELS_COUNT; i++) { + unsigned int active_dlist, dispstat; + unsigned int j; + + dispstat =3D VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_STATUS(i)), + SCALER6_DISPX_STATUS_MODE); + if (dispstat =3D=3D SCALER6_DISPX_STATUS_MODE_DISABLED || + dispstat =3D=3D SCALER6_DISPX_STATUS_MODE_EOF) { + drm_printf(&p, "HVS chan %u disabled\n", i); + continue; + } + + drm_printf(&p, "HVS chan %u:\n", i); + + active_dlist =3D VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_DL(i)), + SCALER6_DISPX_DL_LACT); + next_entry_start =3D 0; + + for (j =3D active_dlist; j < dlist_mem_size; j++) { + u32 dlist_word; + + dlist_word =3D readl((u32 __iomem *)vc4->hvs->dlist + j); + drm_printf(&p, "dlist: %02d: 0x%08x\n", j, + dlist_word); + if (!next_entry_start || + next_entry_start =3D=3D j) { + if (dlist_word & SCALER_CTL0_END) + break; + next_entry_start =3D j + + VC4_GET_FIELD(dlist_word, + SCALER_CTL0_SIZE); + } + } + } + + return 0; +} + +static int vc6_hvs_debugfs_upm_allocs(struct seq_file *m, void *data) +{ + struct drm_debugfs_entry *entry =3D m->private; + struct drm_device *dev =3D entry->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(dev); + struct vc4_hvs *hvs =3D vc4->hvs; + struct drm_printer p =3D drm_seq_file_printer(m); + struct vc4_upm_refcounts *refcount; + unsigned int i; + + drm_printf(&p, "UPM Handles:\n"); + for (i =3D 1; i <=3D VC4_NUM_UPM_HANDLES; i++) { + refcount =3D &hvs->upm_refcounts[i]; + drm_printf(&p, "handle %u: refcount %u, size %zu [%08llx + %08llx]\n", + i, refcount_read(&refcount->refcount), refcount->size, + refcount->upm.start, refcount->upm.size); + } + + return 0; +} + /* The filter kernel is composed of dwords each containing 3 9-bit * signed integers packed next to each other. */ @@ -265,7 +409,8 @@ static void vc4_hvs_update_gamma_lut(struct vc4_hvs *hv= s, =20 u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo) { - struct drm_device *drm =3D &hvs->vc4->base; + struct vc4_dev *vc4 =3D hvs->vc4; + struct drm_device *drm =3D &vc4->base; u8 field =3D 0; int idx; =20 @@ -273,6 +418,10 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, u= nsigned int fifo) return 0; =20 switch (vc4->gen) { + case VC4_GEN_6_C: + field =3D VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_STATUS(fifo)), + SCALER6_DISPX_STATUS_FRCNT); + break; case VC4_GEN_5: switch (fifo) { case 0: @@ -375,6 +524,23 @@ int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, = unsigned int output) return -EPIPE; } =20 + case VC4_GEN_6_C: + switch (output) { + case 0: + return 0; + + case 2: + return 2; + + case 1: + case 3: + case 4: + return 1; + + default: + return -EPIPE; + } + default: return -EPIPE; } @@ -443,7 +609,41 @@ static int vc4_hvs_init_channel(struct vc4_hvs *hvs, s= truct drm_crtc *crtc, return 0; } =20 -void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) +static int vc6_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc, + struct drm_display_mode *mode, bool oneshot) +{ + struct vc4_dev *vc4 =3D hvs->vc4; + struct drm_device *drm =3D &vc4->base; + struct vc4_crtc_state *vc4_crtc_state =3D to_vc4_crtc_state(crtc->state); + unsigned int chan =3D vc4_crtc_state->assigned_channel; + bool interlace =3D mode->flags & DRM_MODE_FLAG_INTERLACE; + u32 disp_ctrl1; + int idx; + + if (!drm_dev_enter(drm, &idx)) + return -ENODEV; + + HVS_WRITE(SCALER6_DISPX_CTRL0(chan), SCALER6_DISPX_CTRL0_RESET); + + disp_ctrl1 =3D HVS_READ(SCALER6_DISPX_CTRL1(chan)); + disp_ctrl1 &=3D ~SCALER6_DISPX_CTRL1_INTLACE; + HVS_WRITE(SCALER6_DISPX_CTRL1(chan), + disp_ctrl1 | (interlace ? SCALER6_DISPX_CTRL1_INTLACE : 0)); + + HVS_WRITE(SCALER6_DISPX_CTRL0(chan), + SCALER6_DISPX_CTRL0_ENB | + VC4_SET_FIELD(mode->hdisplay - 1, + SCALER6_DISPX_CTRL0_FWIDTH) | + (oneshot ? SCALER6_DISPX_CTRL0_ONESHOT : 0) | + VC4_SET_FIELD(mode->vdisplay - 1, + SCALER6_DISPX_CTRL0_LINES)); + + drm_dev_exit(idx); + + return 0; +} + +static void __vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) { struct drm_device *drm =3D &hvs->vc4->base; int idx; @@ -472,6 +672,42 @@ void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigne= d int chan) drm_dev_exit(idx); } =20 +static void __vc6_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) +{ + struct vc4_dev *vc4 =3D hvs->vc4; + struct drm_device *drm =3D &vc4->base; + int idx; + + if (!drm_dev_enter(drm, &idx)) + return; + + if (!(HVS_READ(SCALER6_DISPX_CTRL0(chan)) & SCALER6_DISPX_CTRL0_ENB)) + goto out; + + HVS_WRITE(SCALER6_DISPX_CTRL0(chan), + HVS_READ(SCALER6_DISPX_CTRL0(chan)) | SCALER6_DISPX_CTRL0_RESET); + + HVS_WRITE(SCALER6_DISPX_CTRL0(chan), + HVS_READ(SCALER6_DISPX_CTRL0(chan)) & ~SCALER6_DISPX_CTRL0_ENB); + + WARN_ON_ONCE(VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_STATUS(chan)), + SCALER6_DISPX_STATUS_MODE) !=3D + SCALER6_DISPX_STATUS_MODE_DISABLED); + +out: + drm_dev_exit(idx); +} + +void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) +{ + struct vc4_dev *vc4 =3D hvs->vc4; + + if (vc4->gen >=3D VC4_GEN_6_C) + __vc6_hvs_stop_channel(hvs, chan); + else + __vc4_hvs_stop_channel(hvs, chan); +} + int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *s= tate) { struct drm_crtc_state *crtc_state =3D drm_atomic_get_new_crtc_state(state= , crtc); @@ -528,8 +764,13 @@ static void vc4_hvs_install_dlist(struct drm_crtc *crt= c) if (!drm_dev_enter(dev, &idx)) return; =20 - HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), - vc4_state->mm.start); + if (vc4->gen >=3D VC4_GEN_6_C) + HVS_WRITE(SCALER6_DISPX_LPTRS(vc4_state->assigned_channel), + VC4_SET_FIELD(vc4_state->mm.start, + SCALER6_DISPX_LPTRS_HEADE)); + else + HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), + vc4_state->mm.start); =20 drm_dev_exit(idx); } @@ -584,7 +825,11 @@ void vc4_hvs_atomic_enable(struct drm_crtc *crtc, =20 vc4_hvs_install_dlist(crtc); vc4_hvs_update_dlist(crtc); - vc4_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); + + if (vc4->gen >=3D VC4_GEN_6_C) + vc6_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); + else + vc4_hvs_init_channel(vc4->hvs, crtc, mode, oneshot); } =20 void vc4_hvs_atomic_disable(struct drm_crtc *crtc, @@ -668,13 +913,26 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc, =20 WARN_ON_ONCE(dlist_next - dlist_start !=3D vc4_state->mm.size); =20 - if (enable_bg_fill) + if (vc4->gen >=3D VC4_GEN_6_C) { /* This sets a black background color fill, as is the case * with other DRM drivers. */ + if (enable_bg_fill) + HVS_WRITE(SCALER6_DISPX_CTRL1(channel), + HVS_READ(SCALER6_DISPX_CTRL1(channel)) | + SCALER6_DISPX_CTRL1_BGENB); + else + HVS_WRITE(SCALER6_DISPX_CTRL1(channel), + HVS_READ(SCALER6_DISPX_CTRL1(channel)) & + ~SCALER6_DISPX_CTRL1_BGENB); + } else { + /* we can actually run with a lower core clock when background + * fill is enabled on VC4_GEN_5 so leave it enabled always. + */ HVS_WRITE(SCALER_DISPBKGNDX(channel), HVS_READ(SCALER_DISPBKGNDX(channel)) | SCALER_DISPBKGND_FILL); + } =20 /* Only update DISPLIST if the CRTC was already running and is not * being disabled. @@ -825,7 +1083,12 @@ int vc4_hvs_debugfs_init(struct drm_minor *minor) minor->debugfs_root, &vc4->load_tracker_enabled); =20 - drm_debugfs_add_file(drm, "hvs_dlists", vc4_hvs_debugfs_dlist, NULL); + if (vc4->gen >=3D VC4_GEN_6_C) { + drm_debugfs_add_file(drm, "hvs_dlists", vc6_hvs_debugfs_dlist, NULL); + drm_debugfs_add_file(drm, "hvs_upm", vc6_hvs_debugfs_upm_allocs, NULL); + } else { + drm_debugfs_add_file(drm, "hvs_dlists", vc4_hvs_debugfs_dlist, NULL); + } =20 drm_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun, NULL); =20 @@ -840,6 +1103,10 @@ struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, { struct drm_device *drm =3D &vc4->base; struct vc4_hvs *hvs; + unsigned int dlist_start; + size_t dlist_size; + size_t lbm_size; + unsigned int i; =20 hvs =3D drmm_kzalloc(drm, sizeof(*hvs), GFP_KERNEL); if (!hvs) @@ -851,27 +1118,92 @@ struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, =20 spin_lock_init(&hvs->mm_lock); =20 - /* Set up the HVS display list memory manager. We never - * overwrite the setup from the bootloader (just 128b out of - * our 16K), since we don't want to scramble the screen when - * transitioning from the firmware's boot setup to runtime. - */ - hvs->dlist_mem_size =3D (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_E= ND; - drm_mm_init(&hvs->dlist_mm, - HVS_BOOTLOADER_DLIST_END, - hvs->dlist_mem_size); + switch (vc4->gen) { + case VC4_GEN_4: + case VC4_GEN_5: + /* Set up the HVS display list memory manager. We never + * overwrite the setup from the bootloader (just 128b + * out of our 16K), since we don't want to scramble the + * screen when transitioning from the firmware's boot + * setup to runtime. + */ + dlist_start =3D HVS_BOOTLOADER_DLIST_END; + dlist_size =3D (SCALER_DLIST_SIZE >> 2) - HVS_BOOTLOADER_DLIST_END; + break; + + case VC4_GEN_6_C: + dlist_start =3D HVS_BOOTLOADER_DLIST_END; + + /* + * If we are running a test, it means that we can't + * access a register. Use a plausible size then. + */ + if (!kunit_get_current_test()) + dlist_size =3D HVS_READ(SCALER6_CXM_SIZE); + else + dlist_size =3D 4096; + + for (i =3D 0; i < VC4_NUM_UPM_HANDLES; i++) { + refcount_set(&hvs->upm_refcounts[i].refcount, 0); + hvs->upm_refcounts[i].hvs =3D hvs; + } + + break; + + default: + drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); + return ERR_PTR(-ENODEV); + } + + drm_mm_init(&hvs->dlist_mm, dlist_start, dlist_size); + + hvs->dlist_mem_size =3D dlist_size; =20 /* Set up the HVS LBM memory manager. We could have some more * complicated data structure that allowed reuse of LBM areas * between planes when they don't overlap on the screen, but * for now we just allocate globally. */ - if (vc4->gen =3D=3D VC4_GEN_4) + + switch (vc4->gen) { + case VC4_GEN_4: /* 48k words of 2x12-bit pixels */ - drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024); - else + lbm_size =3D 48 * SZ_1K; + break; + + case VC4_GEN_5: /* 60k words of 4x12-bit pixels */ - drm_mm_init(&hvs->lbm_mm, 0, 60 * 1024); + lbm_size =3D 60 * SZ_1K; + break; + + case VC4_GEN_6_C: + /* + * If we are running a test, it means that we can't + * access a register. Use a plausible size then. + */ + lbm_size =3D 1024; + break; + + default: + drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); + return ERR_PTR(-ENODEV); + } + + drm_mm_init(&hvs->lbm_mm, 0, lbm_size); + + if (vc4->gen >=3D VC4_GEN_6_C) { + ida_init(&hvs->upm_handles); + + /* + * NOTE: On BCM2712, the size can also be read through + * the SCALER_UBM_SIZE register. We would need to do a + * register access though, which we can't do with kunit + * that also uses this function to create its mock + * device. + */ + drm_mm_init(&hvs->upm_mm, 0, 1024 * HVS_UBM_WORD_SIZE); + } + =20 vc4->hvs =3D hvs; =20 @@ -968,10 +1300,124 @@ static int vc4_hvs_hw_init(struct vc4_hvs *hvs) return 0; } =20 +#define CFC1_N_NL_CSC_CTRL(x) (0xa000 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C00(x) (0xa008 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C01(x) (0xa00c + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C02(x) (0xa010 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C03(x) (0xa014 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C04(x) (0xa018 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C10(x) (0xa01c + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C11(x) (0xa020 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C12(x) (0xa024 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C13(x) (0xa028 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C14(x) (0xa02c + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C20(x) (0xa030 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C21(x) (0xa034 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C22(x) (0xa038 + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C23(x) (0xa03c + ((x) * 0x3000)) +#define CFC1_N_MA_CSC_COEFF_C24(x) (0xa040 + ((x) * 0x3000)) + +/* 4 S2.22 multiplication factors, and 1 S9.15 addititive element for each= of 3 + * output components + */ +struct vc6_csc_coeff_entry { + u32 csc[3][5]; +}; + +static const struct vc6_csc_coeff_entry csc_coeffs[2][3] =3D { + [DRM_COLOR_YCBCR_LIMITED_RANGE] =3D { + [DRM_COLOR_YCBCR_BT601] =3D { + .csc =3D { + { 0x004A8542, 0x0, 0x0066254A, 0x0, 0xFF908A0D }, + { 0x004A8542, 0xFFE6ED5D, 0xFFCBF856, 0x0, 0x0043C9A3 }, + { 0x004A8542, 0x00811A54, 0x0, 0x0, 0xFF759502 } + } + }, + [DRM_COLOR_YCBCR_BT709] =3D { + .csc =3D { + { 0x004A8542, 0x0, 0x0072BC44, 0x0, 0xFF83F312 }, + { 0x004A8542, 0xFFF25A22, 0xFFDDE4D0, 0x0, 0x00267064 }, + { 0x004A8542, 0x00873197, 0x0, 0x0, 0xFF6F7DC0 } + } + }, + [DRM_COLOR_YCBCR_BT2020] =3D { + .csc =3D { + { 0x004A8542, 0x0, 0x006B4A17, 0x0, 0xFF8B653F }, + { 0x004A8542, 0xFFF402D9, 0xFFDDE4D0, 0x0, 0x0024C7AE }, + { 0x004A8542, 0x008912CC, 0x0, 0x0, 0xFF6D9C8B } + } + } + }, + [DRM_COLOR_YCBCR_FULL_RANGE] =3D { + [DRM_COLOR_YCBCR_BT601] =3D { + .csc =3D { + { 0x00400000, 0x0, 0x0059BA5E, 0x0, 0xFFA645A1 }, + { 0x00400000, 0xFFE9F9AC, 0xFFD24B97, 0x0, 0x0043BABB }, + { 0x00400000, 0x00716872, 0x0, 0x0, 0xFF8E978D } + } + }, + [DRM_COLOR_YCBCR_BT709] =3D { + .csc =3D { + { 0x00400000, 0x0, 0x0064C985, 0x0, 0xFF9B367A }, + { 0x00400000, 0xFFF402E1, 0xFFE20A40, 0x0, 0x0029F2DE }, + { 0x00400000, 0x0076C226, 0x0, 0x0, 0xFF893DD9 } + } + }, + [DRM_COLOR_YCBCR_BT2020] =3D { + .csc =3D { + { 0x00400000, 0x0, 0x005E3F14, 0x0, 0xFFA1C0EB }, + { 0x00400000, 0xFFF577F6, 0xFFDB580F, 0x0, 0x002F2FFA }, + { 0x00400000, 0x007868DB, 0x0, 0x0, 0xFF879724 } + } + } + } +}; + +static int vc6_hvs_hw_init(struct vc4_hvs *hvs) +{ + const struct vc6_csc_coeff_entry *coeffs; + unsigned int i; + + HVS_WRITE(SCALER6_CONTROL, + SCALER6_CONTROL_HVS_EN | + VC4_SET_FIELD(8, SCALER6_CONTROL_PF_LINES) | + VC4_SET_FIELD(15, SCALER6_CONTROL_MAX_REQS)); + + /* Set HVS arbiter priority to max */ + HVS_WRITE(SCALER6_PRI_MAP0, 0xffffffff); + HVS_WRITE(SCALER6_PRI_MAP1, 0xffffffff); + + for (i =3D 0; i < 6; i++) { + coeffs =3D &csc_coeffs[i / 3][i % 3]; + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C00(i), coeffs->csc[0][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C01(i), coeffs->csc[0][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C02(i), coeffs->csc[0][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C03(i), coeffs->csc[0][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C04(i), coeffs->csc[0][4]); + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C10(i), coeffs->csc[1][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C11(i), coeffs->csc[1][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C12(i), coeffs->csc[1][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C13(i), coeffs->csc[1][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C14(i), coeffs->csc[1][4]); + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C20(i), coeffs->csc[2][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C21(i), coeffs->csc[2][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C22(i), coeffs->csc[2][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C23(i), coeffs->csc[2][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C24(i), coeffs->csc[2][4]); + + HVS_WRITE(CFC1_N_NL_CSC_CTRL(i), BIT(15)); + } + + return 0; +} + static int vc4_hvs_cob_init(struct vc4_hvs *hvs) { struct vc4_dev *vc4 =3D hvs->vc4; - u32 reg, top; + u32 reg, top, base; =20 /* * Recompute Composite Output Buffer (COB) allocations for the @@ -1032,6 +1478,31 @@ static int vc4_hvs_cob_init(struct vc4_hvs *hvs) HVS_WRITE(SCALER_DISPBASE0, reg); break; =20 + case VC4_GEN_6_C: + #define VC6_COB_LINE_WIDTH 3840 + #define VC6_COB_NUM_LINES 4 + base =3D 0; + top =3D 3840; + + HVS_WRITE(SCALER6_DISP2_COB, + VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | + VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); + + base =3D top + 16; + top +=3D VC6_COB_LINE_WIDTH * VC6_COB_NUM_LINES; + + HVS_WRITE(SCALER6_DISP1_COB, + VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | + VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); + + base =3D top + 16; + top +=3D VC6_COB_LINE_WIDTH * VC6_COB_NUM_LINES; + + HVS_WRITE(SCALER6_DISP0_COB, + VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | + VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); + break; + default: return -EINVAL; } @@ -1057,10 +1528,16 @@ static int vc4_hvs_bind(struct device *dev, struct = device *master, void *data) return PTR_ERR(hvs); =20 hvs->regset.base =3D hvs->regs; - hvs->regset.regs =3D vc4_hvs_regs; - hvs->regset.nregs =3D ARRAY_SIZE(vc4_hvs_regs); =20 - if (vc4->gen =3D=3D VC4_GEN_5) { + if (vc4->gen >=3D VC4_GEN_6_C) { + hvs->regset.regs =3D vc6_hvs_regs; + hvs->regset.nregs =3D ARRAY_SIZE(vc6_hvs_regs); + } else { + hvs->regset.regs =3D vc4_hvs_regs; + hvs->regset.nregs =3D ARRAY_SIZE(vc4_hvs_regs); + } + + if (vc4->gen >=3D VC4_GEN_5) { struct rpi_firmware *firmware; struct device_node *node; unsigned int max_rate; @@ -1074,12 +1551,20 @@ static int vc4_hvs_bind(struct device *dev, struct = device *master, void *data) if (!firmware) return -EPROBE_DEFER; =20 - hvs->core_clk =3D devm_clk_get(&pdev->dev, NULL); + hvs->core_clk =3D devm_clk_get(&pdev->dev, + (vc4->gen >=3D VC4_GEN_6_C) ? "core" : NULL); if (IS_ERR(hvs->core_clk)) { dev_err(&pdev->dev, "Couldn't get core clock\n"); return PTR_ERR(hvs->core_clk); } =20 + hvs->disp_clk =3D devm_clk_get(&pdev->dev, + (vc4->gen >=3D VC4_GEN_6_C) ? "disp" : NULL); + if (IS_ERR(hvs->disp_clk)) { + dev_err(&pdev->dev, "Couldn't get disp clock\n"); + return PTR_ERR(hvs->disp_clk); + } + max_rate =3D rpi_firmware_clk_get_max_rate(firmware, RPI_FIRMWARE_CORE_CLK_ID); rpi_firmware_put(firmware); @@ -1096,14 +1581,23 @@ static int vc4_hvs_bind(struct device *dev, struct = device *master, void *data) dev_err(&pdev->dev, "Couldn't enable the core clock\n"); return ret; } + + ret =3D clk_prepare_enable(hvs->disp_clk); + if (ret) { + dev_err(&pdev->dev, "Couldn't enable the disp clock\n"); + return ret; + } } =20 - if (vc4->gen =3D=3D VC4_GEN_4) - hvs->dlist =3D hvs->regs + SCALER_DLIST_START; - else + if (vc4->gen >=3D VC4_GEN_5) hvs->dlist =3D hvs->regs + SCALER5_DLIST_START; + else + hvs->dlist =3D hvs->regs + SCALER_DLIST_START; =20 - ret =3D vc4_hvs_hw_init(hvs); + if (vc4->gen >=3D VC4_GEN_6_C) + ret =3D vc6_hvs_hw_init(hvs); + else + ret =3D vc4_hvs_hw_init(hvs); if (ret) return ret; =20 @@ -1120,10 +1614,12 @@ static int vc4_hvs_bind(struct device *dev, struct = device *master, void *data) if (ret) return ret; =20 - ret =3D devm_request_irq(dev, platform_get_irq(pdev, 0), - vc4_hvs_irq_handler, 0, "vc4 hvs", drm); - if (ret) - return ret; + if (vc4->gen < VC4_GEN_6_C) { + ret =3D devm_request_irq(dev, platform_get_irq(pdev, 0), + vc4_hvs_irq_handler, 0, "vc4 hvs", drm); + if (ret) + return ret; + } =20 return 0; } @@ -1148,6 +1644,7 @@ static void vc4_hvs_unbind(struct device *dev, struct= device *master, drm_mm_remove_node(node); drm_mm_takedown(&vc4->hvs->lbm_mm); =20 + clk_disable_unprepare(hvs->disp_clk); clk_disable_unprepare(hvs->core_clk); =20 vc4->hvs =3D NULL; @@ -1170,6 +1667,7 @@ static void vc4_hvs_dev_remove(struct platform_device= *pdev) =20 static const struct of_device_id vc4_hvs_dt_match[] =3D { { .compatible =3D "brcm,bcm2711-hvs" }, + { .compatible =3D "brcm,bcm2712-hvs" }, { .compatible =3D "brcm,bcm2835-hvs" }, {} }; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 58bbb9efc2df..aa0b50d6c9fd 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -320,17 +320,62 @@ static void vc5_hvs_pv_muxing_commit(struct vc4_dev *= vc4, } } =20 +static void vc6_hvs_pv_muxing_commit(struct vc4_dev *vc4, + struct drm_atomic_state *state) +{ + struct vc4_hvs *hvs =3D vc4->hvs; + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + unsigned int i; + + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_6_C); + + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { + struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); + struct vc4_encoder *vc4_encoder; + struct drm_encoder *encoder; + unsigned char mux; + u32 reg; + + if (!vc4_state->update_muxing) + continue; + + if (vc4_state->assigned_channel !=3D 1) + continue; + + encoder =3D vc4_get_crtc_encoder(crtc, crtc_state); + vc4_encoder =3D to_vc4_encoder(encoder); + switch (vc4_encoder->type) { + case VC4_ENCODER_TYPE_HDMI1: + mux =3D 0; + break; + + case VC4_ENCODER_TYPE_TXP: + mux =3D 2; + break; + + default: + drm_err(&vc4->base, "Unhandled encoder type for PV muxing %d", + vc4_encoder->type); + mux =3D 0; + break; + } + + reg =3D HVS_READ(SCALER6_CONTROL); + HVS_WRITE(SCALER6_CONTROL, + (reg & ~SCALER6_CONTROL_DSP1_TARGET_MASK) | + VC4_SET_FIELD(mux, SCALER6_CONTROL_DSP1_TARGET)); + } +} + static void vc4_atomic_commit_tail(struct drm_atomic_state *state) { struct drm_device *dev =3D state->dev; struct vc4_dev *vc4 =3D to_vc4_dev(dev); struct vc4_hvs *hvs =3D vc4->hvs; - struct drm_crtc_state *new_crtc_state; struct vc4_hvs_state *new_hvs_state; - struct drm_crtc *crtc; struct vc4_hvs_state *old_hvs_state; unsigned int channel; - int i; =20 old_hvs_state =3D vc4_hvs_get_old_global_state(state); if (WARN_ON(IS_ERR(old_hvs_state))) @@ -340,14 +385,20 @@ static void vc4_atomic_commit_tail(struct drm_atomic_= state *state) if (WARN_ON(IS_ERR(new_hvs_state))) return; =20 - for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { - struct vc4_crtc_state *vc4_crtc_state; + if (vc4->gen < VC4_GEN_6_C) { + struct drm_crtc_state *new_crtc_state; + struct drm_crtc *crtc; + int i; =20 - if (!new_crtc_state->commit) - continue; + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { + struct vc4_crtc_state *vc4_crtc_state; =20 - vc4_crtc_state =3D to_vc4_crtc_state(new_crtc_state); - vc4_hvs_mask_underrun(hvs, vc4_crtc_state->assigned_channel); + if (!new_crtc_state->commit) + continue; + + vc4_crtc_state =3D to_vc4_crtc_state(new_crtc_state); + vc4_hvs_mask_underrun(hvs, vc4_crtc_state->assigned_channel); + } } =20 for (channel =3D 0; channel < HVS_NUM_CHANNELS; channel++) { @@ -382,16 +433,31 @@ static void vc4_atomic_commit_tail(struct drm_atomic_= state *state) * modeset. */ WARN_ON(clk_set_min_rate(hvs->core_clk, core_rate)); + WARN_ON(clk_set_min_rate(hvs->disp_clk, core_rate)); } =20 drm_atomic_helper_commit_modeset_disables(dev, state); =20 - vc4_ctm_commit(vc4, state); + if (vc4->gen <=3D VC4_GEN_5) + vc4_ctm_commit(vc4, state); =20 - if (vc4->gen =3D=3D VC4_GEN_5) - vc5_hvs_pv_muxing_commit(vc4, state); - else + switch (vc4->gen) { + case VC4_GEN_4: vc4_hvs_pv_muxing_commit(vc4, state); + break; + + case VC4_GEN_5: + vc5_hvs_pv_muxing_commit(vc4, state); + break; + + case VC4_GEN_6_C: + vc6_hvs_pv_muxing_commit(vc4, state); + break; + + default: + drm_err(dev, "Unknown VC4 generation: %d", vc4->gen); + break; + } =20 drm_atomic_helper_commit_planes(dev, state, DRM_PLANE_COMMIT_ACTIVE_ONLY); @@ -418,6 +484,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_st= ate *state) * requirements. */ WARN_ON(clk_set_min_rate(hvs->core_clk, core_rate)); + WARN_ON(clk_set_min_rate(hvs->disp_clk, core_rate)); =20 drm_dbg(dev, "Core clock actual rate: %lu Hz\n", clk_get_rate(hvs->core_clk)); @@ -1056,7 +1123,10 @@ int vc4_kms_load(struct drm_device *dev) return ret; } =20 - if (vc4->gen =3D=3D VC4_GEN_5) { + if (vc4->gen >=3D VC4_GEN_6_C) { + dev->mode_config.max_width =3D 8192; + dev->mode_config.max_height =3D 8192; + } else if (vc4->gen >=3D VC4_GEN_5) { dev->mode_config.max_width =3D 7680; dev->mode_config.max_height =3D 7680; } else { diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index ba6e86d62a77..5749287f6e3c 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -278,7 +278,10 @@ static bool plane_enabled(struct drm_plane_state *stat= e) =20 static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane = *plane) { + struct vc4_dev *vc4 =3D to_vc4_dev(plane->dev); + struct vc4_hvs *hvs =3D vc4->hvs; struct vc4_plane_state *vc4_state; + unsigned int i; =20 if (WARN_ON(!plane->state)) return NULL; @@ -288,6 +291,12 @@ static struct drm_plane_state *vc4_plane_duplicate_sta= te(struct drm_plane *plane return NULL; =20 memset(&vc4_state->lbm, 0, sizeof(vc4_state->lbm)); + + for (i =3D 0; i < DRM_FORMAT_MAX_PLANES; i++) { + if (vc4_state->upm_handle[i]) + refcount_inc(&hvs->upm_refcounts[vc4_state->upm_handle[i]].refcount); + } + vc4_state->dlist_initialized =3D 0; =20 __drm_atomic_helper_plane_duplicate_state(plane, &vc4_state->base); @@ -306,18 +315,47 @@ static struct drm_plane_state *vc4_plane_duplicate_st= ate(struct drm_plane *plane return &vc4_state->base; } =20 +static void vc4_plane_release_upm_ida(struct vc4_hvs *hvs, unsigned int up= m_handle) +{ + struct vc4_upm_refcounts *refcount =3D &hvs->upm_refcounts[upm_handle]; + unsigned long irqflags; + + spin_lock_irqsave(&hvs->mm_lock, irqflags); + drm_mm_remove_node(&refcount->upm); + spin_unlock_irqrestore(&hvs->mm_lock, irqflags); + refcount->upm.start =3D 0; + refcount->upm.size =3D 0; + refcount->size =3D 0; + + ida_free(&hvs->upm_handles, upm_handle); +} + static void vc4_plane_destroy_state(struct drm_plane *plane, struct drm_plane_state *state) { struct vc4_dev *vc4 =3D to_vc4_dev(plane->dev); + struct vc4_hvs *hvs =3D vc4->hvs; struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + unsigned int i; =20 if (drm_mm_node_allocated(&vc4_state->lbm)) { unsigned long irqflags; =20 - spin_lock_irqsave(&vc4->hvs->mm_lock, irqflags); + spin_lock_irqsave(&hvs->mm_lock, irqflags); drm_mm_remove_node(&vc4_state->lbm); - spin_unlock_irqrestore(&vc4->hvs->mm_lock, irqflags); + spin_unlock_irqrestore(&hvs->mm_lock, irqflags); + } + + for (i =3D 0; i < DRM_FORMAT_MAX_PLANES; i++) { + struct vc4_upm_refcounts *refcount; + + if (!vc4_state->upm_handle[i]) + continue; + + refcount =3D &hvs->upm_refcounts[vc4_state->upm_handle[i]]; + + if (refcount_dec_and_test(&refcount->refcount)) + vc4_plane_release_upm_ida(hvs, vc4_state->upm_handle[i]); } =20 kfree(vc4_state->dlist); @@ -538,6 +576,11 @@ static void vc4_write_tpz(struct vc4_plane_state *vc4_= state, u32 src, u32 dst) recip =3D ~0 / scale; =20 vc4_dlist_write(vc4_state, + /* + * The BCM2712 is lacking BIT(31) compared to + * the previous generations, but we don't use + * it. + */ VC4_SET_FIELD(scale, SCALER_TPZ0_SCALE) | VC4_SET_FIELD(0, SCALER_TPZ0_IPHASE)); vc4_dlist_write(vc4_state, @@ -598,10 +641,15 @@ static void vc4_write_ppf(struct vc4_plane_state *vc4= _state, u32 src, u32 dst, vc4_dlist_write(vc4_state, SCALER_PPF_AGC | VC4_SET_FIELD(scale, SCALER_PPF_SCALE) | + /* + * The register layout documentation is slightly + * different to setup the phase in the BCM2712, + * but they seem equivalent. + */ VC4_SET_FIELD(phase, SCALER_PPF_IPHASE)); } =20 -static u32 vc4_lbm_size(struct drm_plane_state *state) +static u32 __vc4_lbm_size(struct drm_plane_state *state) { struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); struct vc4_dev *vc4 =3D to_vc4_dev(state->plane->dev); @@ -649,6 +697,131 @@ static u32 vc4_lbm_size(struct drm_plane_state *state) return lbm; } =20 +static unsigned int vc4_lbm_words_per_component(const struct drm_plane_sta= te *state, + unsigned int channel) +{ + const struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + + switch (vc4_state->y_scaling[channel]) { + case VC4_SCALING_PPF: + return 4; + + case VC4_SCALING_TPZ: + return 2; + + default: + return 0; + } +} + +static unsigned int vc4_lbm_components(const struct drm_plane_state *state, + unsigned int channel) +{ + const struct drm_format_info *info =3D state->fb->format; + const struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + + if (vc4_state->y_scaling[channel] =3D=3D VC4_SCALING_NONE) + return 0; + + if (info->is_yuv) + return channel ? 2 : 1; + + if (info->has_alpha) + return 4; + + return 3; +} + +static unsigned int vc4_lbm_channel_size(const struct drm_plane_state *sta= te, + unsigned int channel) +{ + const struct drm_format_info *info =3D state->fb->format; + const struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + unsigned int channels_scaled =3D 0; + unsigned int components, words, wpc; + unsigned int width, lines; + unsigned int i; + + /* LBM is meant to use the smaller of source or dest width, but there + * is a issue with UV scaling that the size required for the second + * channel is based on the source width only. + */ + if (info->hsub > 1 && channel =3D=3D 1) + width =3D state->src_w >> 16; + else + width =3D min(state->src_w >> 16, state->crtc_w); + width =3D round_up(width / info->hsub, 4); + + wpc =3D vc4_lbm_words_per_component(state, channel); + if (!wpc) + return 0; + + components =3D vc4_lbm_components(state, channel); + if (!components) + return 0; + + if (state->alpha !=3D DRM_BLEND_ALPHA_OPAQUE && info->has_alpha) + components -=3D 1; + + words =3D width * wpc * components; + + lines =3D DIV_ROUND_UP(words, 128 / info->hsub); + + for (i =3D 0; i < 2; i++) + if (vc4_state->y_scaling[channel] !=3D VC4_SCALING_NONE) + channels_scaled++; + + if (channels_scaled =3D=3D 1) + lines =3D lines / 2; + + return lines; +} + +static unsigned int __vc6_lbm_size(const struct drm_plane_state *state) +{ + const struct drm_format_info *info =3D state->fb->format; + + if (info->hsub > 1) + return max(vc4_lbm_channel_size(state, 0), + vc4_lbm_channel_size(state, 1)); + else + return vc4_lbm_channel_size(state, 0); +} + +static u32 vc4_lbm_size(struct drm_plane_state *state) +{ + struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + struct vc4_dev *vc4 =3D to_vc4_dev(state->plane->dev); + + /* LBM is not needed when there's no vertical scaling. */ + if (vc4_state->y_scaling[0] =3D=3D VC4_SCALING_NONE && + vc4_state->y_scaling[1] =3D=3D VC4_SCALING_NONE) + return 0; + + if (vc4->gen >=3D VC4_GEN_6_C) + return __vc6_lbm_size(state); + else + return __vc4_lbm_size(state); +} + +static size_t vc6_upm_size(const struct drm_plane_state *state, + unsigned int plane) +{ + const struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + unsigned int stride =3D state->fb->pitches[plane]; + + /* + * TODO: This only works for raster formats, and is sub-optimal + * for buffers with a stride aligned on 32 bytes. + */ + unsigned int words_per_line =3D (stride + 62) / 32; + unsigned int fetch_region_size =3D words_per_line * 32; + unsigned int buffer_lines =3D 2 << vc4_state->upm_buffer_lines; + unsigned int buffer_size =3D fetch_region_size * buffer_lines; + + return ALIGN(buffer_size, HVS_UBM_WORD_SIZE); +} + static void vc4_write_scaling_parameters(struct drm_plane_state *state, int channel) { @@ -750,6 +923,10 @@ static int vc4_plane_allocate_lbm(struct drm_plane_sta= te *state) if (!lbm_size) return 0; =20 + /* + * NOTE: BCM2712 doesn't need to be aligned, since the size + * returned by vc4_lbm_size() is in words already. + */ if (vc4->gen =3D=3D VC4_GEN_5) lbm_size =3D ALIGN(lbm_size, 64); else if (vc4->gen =3D=3D VC4_GEN_4) @@ -787,6 +964,108 @@ static int vc4_plane_allocate_lbm(struct drm_plane_st= ate *state) return 0; } =20 +static int vc6_plane_allocate_upm(struct drm_plane_state *state) +{ + const struct drm_format_info *info =3D state->fb->format; + struct drm_device *drm =3D state->plane->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(drm); + struct vc4_hvs *hvs =3D vc4->hvs; + struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + unsigned int i; + int ret; + + WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); + + vc4_state->upm_buffer_lines =3D SCALER6_PTR0_UPM_BUFF_SIZE_2_LINES; + + for (i =3D 0; i < info->num_planes; i++) { + struct vc4_upm_refcounts *refcount; + int upm_handle; + unsigned long irqflags; + size_t upm_size; + + upm_size =3D vc6_upm_size(state, i); + if (!upm_size) + return -EINVAL; + upm_handle =3D vc4_state->upm_handle[i]; + + if (upm_handle && + hvs->upm_refcounts[upm_handle].size =3D=3D upm_size) { + /* Allocation is the same size as the previous user of + * the plane. Keep the allocation. + */ + vc4_state->upm_handle[i] =3D upm_handle; + } else { + if (upm_handle && + refcount_dec_and_test(&hvs->upm_refcounts[upm_handle].refcount)) { + vc4_plane_release_upm_ida(hvs, upm_handle); + vc4_state->upm_handle[i] =3D 0; + } + + upm_handle =3D ida_alloc_range(&hvs->upm_handles, 1, + VC4_NUM_UPM_HANDLES, + GFP_KERNEL); + if (upm_handle < 0) { + drm_dbg(drm, "Out of upm_handles\n"); + return upm_handle; + } + vc4_state->upm_handle[i] =3D upm_handle; + + refcount =3D &hvs->upm_refcounts[upm_handle]; + refcount_set(&refcount->refcount, 1); + refcount->size =3D upm_size; + + spin_lock_irqsave(&hvs->mm_lock, irqflags); + ret =3D drm_mm_insert_node_generic(&hvs->upm_mm, + &refcount->upm, + upm_size, HVS_UBM_WORD_SIZE, + 0, 0); + spin_unlock_irqrestore(&hvs->mm_lock, irqflags); + if (ret) { + drm_err(drm, "Failed to allocate UPM entry: %d\n", ret); + refcount_set(&refcount->refcount, 0); + ida_free(&hvs->upm_handles, upm_handle); + vc4_state->upm_handle[i] =3D 0; + return ret; + } + } + + refcount =3D &hvs->upm_refcounts[upm_handle]; + vc4_state->dlist[vc4_state->ptr0_offset[i]] |=3D + VC4_SET_FIELD(refcount->upm.start / HVS_UBM_WORD_SIZE, + SCALER6_PTR0_UPM_BASE) | + VC4_SET_FIELD(vc4_state->upm_handle[i] - 1, + SCALER6_PTR0_UPM_HANDLE) | + VC4_SET_FIELD(vc4_state->upm_buffer_lines, + SCALER6_PTR0_UPM_BUFF_SIZE); + } + + return 0; +} + +static void vc6_plane_free_upm(struct drm_plane_state *state) +{ + struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + struct drm_device *drm =3D state->plane->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(drm); + struct vc4_hvs *hvs =3D vc4->hvs; + unsigned int i; + + WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); + + for (i =3D 0; i < DRM_FORMAT_MAX_PLANES; i++) { + unsigned int upm_handle; + + upm_handle =3D vc4_state->upm_handle[i]; + if (!upm_handle) + continue; + + if (refcount_dec_and_test(&hvs->upm_refcounts[upm_handle].refcount)) + vc4_plane_release_upm_ida(hvs, upm_handle); + vc4_state->upm_handle[i] =3D 0; + } +} + /* * The colorspace conversion matrices are held in 3 entries in the dlist. * Create an array of them, with entries for each full and limited mode, a= nd @@ -1363,6 +1642,412 @@ static int vc4_plane_mode_set(struct drm_plane *pla= ne, return 0; } =20 +static u32 vc6_plane_get_csc_mode(struct vc4_plane_state *vc4_state) +{ + struct drm_plane_state *state =3D &vc4_state->base; + u32 ret =3D 0; + + if (vc4_state->is_yuv) { + enum drm_color_encoding color_encoding =3D state->color_encoding; + enum drm_color_range color_range =3D state->color_range; + + ret |=3D SCALER6_CTL2_CSC_ENABLE; + + /* CSC pre-loaded with: + * 0 =3D BT601 limited range + * 1 =3D BT709 limited range + * 2 =3D BT2020 limited range + * 3 =3D BT601 full range + * 4 =3D BT709 full range + * 5 =3D BT2020 full range + */ + if (color_encoding > DRM_COLOR_YCBCR_BT2020) + color_encoding =3D DRM_COLOR_YCBCR_BT601; + if (color_range > DRM_COLOR_YCBCR_FULL_RANGE) + color_range =3D DRM_COLOR_YCBCR_LIMITED_RANGE; + + ret |=3D VC4_SET_FIELD(color_encoding + (color_range * 3), + SCALER6_CTL2_BRCM_CFC_CONTROL); + } + + return ret; +} + +static int vc6_plane_mode_set(struct drm_plane *plane, + struct drm_plane_state *state) +{ + struct drm_device *drm =3D plane->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(drm); + struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); + struct drm_framebuffer *fb =3D state->fb; + const struct hvs_format *format =3D vc4_get_hvs_format(fb->format->format= ); + u64 base_format_mod =3D fourcc_mod_broadcom_mod(fb->modifier); + int num_planes =3D fb->format->num_planes; + u32 h_subsample =3D fb->format->hsub; + u32 v_subsample =3D fb->format->vsub; + bool mix_plane_alpha; + bool covers_screen; + u32 scl0, scl1, pitch0; + u32 tiling, src_x, src_y; + u32 width, height; + u32 hvs_format =3D format->hvs; + u32 offsets[3] =3D { 0 }; + unsigned int rotation; + int ret, i; + + if (vc4_state->dlist_initialized) + return 0; + + ret =3D vc4_plane_setup_clipping_and_scaling(state); + if (ret) + return ret; + + width =3D vc4_state->src_w[0] >> 16; + height =3D vc4_state->src_h[0] >> 16; + + /* SCL1 is used for Cb/Cr scaling of planar formats. For RGB + * and 4:4:4, scl1 should be set to scl0 so both channels of + * the scaler do the same thing. For YUV, the Y plane needs + * to be put in channel 1 and Cb/Cr in channel 0, so we swap + * the scl fields here. + */ + if (num_planes =3D=3D 1) { + scl0 =3D vc4_get_scl_field(state, 0); + scl1 =3D scl0; + } else { + scl0 =3D vc4_get_scl_field(state, 1); + scl1 =3D vc4_get_scl_field(state, 0); + } + + rotation =3D drm_rotation_simplify(state->rotation, + DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | + DRM_MODE_REFLECT_Y); + + /* We must point to the last line when Y reflection is enabled. */ + src_y =3D vc4_state->src_y >> 16; + if (rotation & DRM_MODE_REFLECT_Y) + src_y +=3D height - 1; + + src_x =3D vc4_state->src_x >> 16; + + switch (base_format_mod) { + case DRM_FORMAT_MOD_LINEAR: + tiling =3D SCALER6_CTL0_ADDR_MODE_LINEAR; + + /* Adjust the base pointer to the first pixel to be scanned + * out. + */ + for (i =3D 0; i < num_planes; i++) { + offsets[i] +=3D src_y / (i ? v_subsample : 1) * fb->pitches[i]; + offsets[i] +=3D src_x / (i ? h_subsample : 1) * fb->format->cpp[i]; + } + + break; + + case DRM_FORMAT_MOD_BROADCOM_SAND128: + case DRM_FORMAT_MOD_BROADCOM_SAND256: { + uint32_t param =3D fourcc_mod_broadcom_param(fb->modifier); + u32 components_per_word; + u32 starting_offset; + u32 fetch_count; + + if (param > SCALER_TILE_HEIGHT_MASK) { + DRM_DEBUG_KMS("SAND height too large (%d)\n", + param); + return -EINVAL; + } + + if (fb->format->format =3D=3D DRM_FORMAT_P030) { + hvs_format =3D HVS_PIXEL_FORMAT_YCBCR_10BIT; + tiling =3D SCALER6_CTL0_ADDR_MODE_128B; + } else { + hvs_format =3D HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE; + + switch (base_format_mod) { + case DRM_FORMAT_MOD_BROADCOM_SAND128: + tiling =3D SCALER6_CTL0_ADDR_MODE_128B; + break; + case DRM_FORMAT_MOD_BROADCOM_SAND256: + tiling =3D SCALER6_CTL0_ADDR_MODE_256B; + break; + default: + return -EINVAL; + } + } + + /* Adjust the base pointer to the first pixel to be scanned + * out. + * + * For P030, y_ptr [31:4] is the 128bit word for the start pixel + * y_ptr [3:0] is the pixel (0-11) contained within that 128bit + * word that should be taken as the first pixel. + * Ditto uv_ptr [31:4] vs [3:0], however [3:0] contains the + * element within the 128bit word, eg for pixel 3 the value + * should be 6. + */ + for (i =3D 0; i < num_planes; i++) { + u32 tile_w, tile, x_off, pix_per_tile; + + if (fb->format->format =3D=3D DRM_FORMAT_P030) { + /* + * Spec says: bits [31:4] of the given address + * should point to the 128-bit word containing + * the desired starting pixel, and bits[3:0] + * should be between 0 and 11, indicating which + * of the 12-pixels in that 128-bit word is the + * first pixel to be used + */ + u32 remaining_pixels =3D src_x % 96; + u32 aligned =3D remaining_pixels / 12; + u32 last_bits =3D remaining_pixels % 12; + + x_off =3D aligned * 16 + last_bits; + tile_w =3D 128; + pix_per_tile =3D 96; + } else { + switch (base_format_mod) { + case DRM_FORMAT_MOD_BROADCOM_SAND128: + tile_w =3D 128; + break; + case DRM_FORMAT_MOD_BROADCOM_SAND256: + tile_w =3D 256; + break; + default: + return -EINVAL; + } + pix_per_tile =3D tile_w / fb->format->cpp[0]; + x_off =3D (src_x % pix_per_tile) / + (i ? h_subsample : 1) * + fb->format->cpp[i]; + } + + tile =3D src_x / pix_per_tile; + + offsets[i] +=3D param * tile_w * tile; + offsets[i] +=3D src_y / (i ? v_subsample : 1) * tile_w; + offsets[i] +=3D x_off & ~(i ? 1 : 0); + } + + components_per_word =3D fb->format->format =3D=3D DRM_FORMAT_P030 ? 24 := 32; + starting_offset =3D src_x % components_per_word; + fetch_count =3D (width + starting_offset + components_per_word - 1) / + components_per_word; + + pitch0 =3D VC4_SET_FIELD(param, SCALER6_PTR2_PITCH) | + VC4_SET_FIELD(fetch_count - 1, SCALER6_PTR2_FETCH_COUNT); + break; + } + + default: + DRM_DEBUG_KMS("Unsupported FB tiling flag 0x%16llx", + (long long)fb->modifier); + return -EINVAL; + } + + /* fetch an extra pixel if we don't actually line up with the left edge. = */ + if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width <= < 16)) + width++; + + /* same for the right side */ + if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) && + vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16)) + width++; + + /* now for the top */ + if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height = << 16)) + height++; + + /* and the bottom */ + if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) && + vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16)) + height++; + + /* for YUV444 hardware wants double the width, otherwise it doesn't + * fetch full width of chroma + */ + if (format->drm =3D=3D DRM_FORMAT_YUV444 || format->drm =3D=3D DRM_FORMAT= _YVU444) + width <<=3D 1; + + /* Don't waste cycles mixing with plane alpha if the set alpha + * is opaque or there is no per-pixel alpha information. + * In any case we use the alpha property value as the fixed alpha. + */ + mix_plane_alpha =3D state->alpha !=3D DRM_BLEND_ALPHA_OPAQUE && + fb->format->has_alpha; + + /* Control Word 0: Scaling Configuration & Element Validity*/ + vc4_dlist_write(vc4_state, + SCALER6_CTL0_VALID | + VC4_SET_FIELD(tiling, SCALER6_CTL0_ADDR_MODE) | + VC4_SET_FIELD(0, SCALER6_CTL0_ALPHA_MASK) | + (vc4_state->is_unity ? SCALER6_CTL0_UNITY : 0) | + VC4_SET_FIELD(format->pixel_order_hvs5, SCALER6_CTL0_ORDERRGBA) | + VC4_SET_FIELD(scl1, SCALER6_CTL0_SCL1_MODE) | + VC4_SET_FIELD(scl0, SCALER6_CTL0_SCL0_MODE) | + VC4_SET_FIELD(hvs_format, SCALER6_CTL0_PIXEL_FORMAT)); + + /* Position Word 0: Image Position */ + vc4_state->pos0_offset =3D vc4_state->dlist_count; + vc4_dlist_write(vc4_state, + VC4_SET_FIELD(vc4_state->crtc_y, SCALER6_POS0_START_Y) | + (rotation & DRM_MODE_REFLECT_X ? SCALER6_POS0_HFLIP : 0) | + VC4_SET_FIELD(vc4_state->crtc_x, SCALER6_POS0_START_X)); + + /* Control Word 2: Alpha Value & CSC */ + vc4_dlist_write(vc4_state, + vc6_plane_get_csc_mode(vc4_state) | + vc4_hvs5_get_alpha_blend_mode(state) | + (mix_plane_alpha ? SCALER6_CTL2_ALPHA_MIX : 0) | + VC4_SET_FIELD(state->alpha >> 4, SCALER5_CTL2_ALPHA)); + + /* Position Word 1: Scaled Image Dimensions */ + if (!vc4_state->is_unity) + vc4_dlist_write(vc4_state, + VC4_SET_FIELD(vc4_state->crtc_h - 1, + SCALER6_POS1_SCL_LINES) | + VC4_SET_FIELD(vc4_state->crtc_w - 1, + SCALER6_POS1_SCL_WIDTH)); + + /* Position Word 2: Source Image Size */ + vc4_state->pos2_offset =3D vc4_state->dlist_count; + vc4_dlist_write(vc4_state, + VC4_SET_FIELD(height - 1, + SCALER6_POS2_SRC_LINES) | + VC4_SET_FIELD(width - 1, + SCALER6_POS2_SRC_WIDTH)); + + /* Position Word 3: Context */ + vc4_dlist_write(vc4_state, 0xc0c0c0c0); + + /* + * TODO: This only covers Raster Scan Order planes + */ + for (i =3D 0; i < num_planes; i++) { + struct drm_gem_dma_object *bo =3D drm_fb_dma_get_gem_obj(fb, i); + dma_addr_t paddr =3D bo->dma_addr + fb->offsets[i] + offsets[i]; + + /* Pointer Word 0 */ + vc4_state->ptr0_offset[i] =3D vc4_state->dlist_count; + vc4_dlist_write(vc4_state, + (rotation & DRM_MODE_REFLECT_Y ? SCALER6_PTR0_VFLIP : 0) | + /* + * The UPM buffer will be allocated in + * vc6_plane_allocate_upm(). + */ + VC4_SET_FIELD(upper_32_bits(paddr) & 0xff, + SCALER6_PTR0_UPPER_ADDR)); + + /* Pointer Word 1 */ + vc4_dlist_write(vc4_state, lower_32_bits(paddr)); + + /* Pointer Word 2 */ + if (base_format_mod !=3D DRM_FORMAT_MOD_BROADCOM_SAND128 && + base_format_mod !=3D DRM_FORMAT_MOD_BROADCOM_SAND256) { + vc4_dlist_write(vc4_state, + VC4_SET_FIELD(fb->pitches[i], + SCALER6_PTR2_PITCH)); + } else { + vc4_dlist_write(vc4_state, pitch0); + } + } + + /* + * Palette Word 0 + * TODO: We're not using the palette mode + */ + + /* + * Trans Word 0 + * TODO: It's only relevant if we set the trans_rgb bit in the + * control word 0, and we don't at the moment. + */ + + vc4_state->lbm_offset =3D 0; + + if (!vc4_state->is_unity || fb->format->is_yuv) { + /* + * Reserve a slot for the LBM Base Address. The real value will + * be set when calling vc4_plane_allocate_lbm(). + */ + if (vc4_state->y_scaling[0] !=3D VC4_SCALING_NONE || + vc4_state->y_scaling[1] !=3D VC4_SCALING_NONE) { + vc4_state->lbm_offset =3D vc4_state->dlist_count; + vc4_dlist_counter_increment(vc4_state); + } + + if (vc4_state->x_scaling[0] !=3D VC4_SCALING_NONE || + vc4_state->x_scaling[1] !=3D VC4_SCALING_NONE || + vc4_state->y_scaling[0] !=3D VC4_SCALING_NONE || + vc4_state->y_scaling[1] !=3D VC4_SCALING_NONE) { + if (num_planes > 1) + /* + * Emit Cb/Cr as channel 0 and Y as channel + * 1. This matches how we set up scl0/scl1 + * above. + */ + vc4_write_scaling_parameters(state, 1); + + vc4_write_scaling_parameters(state, 0); + } + + /* + * If any PPF setup was done, then all the kernel + * pointers get uploaded. + */ + if (vc4_state->x_scaling[0] =3D=3D VC4_SCALING_PPF || + vc4_state->y_scaling[0] =3D=3D VC4_SCALING_PPF || + vc4_state->x_scaling[1] =3D=3D VC4_SCALING_PPF || + vc4_state->y_scaling[1] =3D=3D VC4_SCALING_PPF) { + u32 kernel =3D + VC4_SET_FIELD(vc4->hvs->mitchell_netravali_filter.start, + SCALER_PPF_KERNEL_OFFSET); + + /* HPPF plane 0 */ + vc4_dlist_write(vc4_state, kernel); + /* VPPF plane 0 */ + vc4_dlist_write(vc4_state, kernel); + /* HPPF plane 1 */ + vc4_dlist_write(vc4_state, kernel); + /* VPPF plane 1 */ + vc4_dlist_write(vc4_state, kernel); + } + } + + vc4_dlist_write(vc4_state, SCALER6_CTL0_END); + + vc4_state->dlist[0] |=3D + VC4_SET_FIELD(vc4_state->dlist_count, SCALER6_CTL0_NEXT); + + /* crtc_* are already clipped coordinates. */ + covers_screen =3D vc4_state->crtc_x =3D=3D 0 && vc4_state->crtc_y =3D=3D = 0 && + vc4_state->crtc_w =3D=3D state->crtc->mode.hdisplay && + vc4_state->crtc_h =3D=3D state->crtc->mode.vdisplay; + + /* + * Background fill might be necessary when the plane has per-pixel + * alpha content or a non-opaque plane alpha and could blend from the + * background or does not cover the entire screen. + */ + vc4_state->needs_bg_fill =3D fb->format->has_alpha || !covers_screen || + state->alpha !=3D DRM_BLEND_ALPHA_OPAQUE; + + /* + * Flag the dlist as initialized to avoid checking it twice in case + * the async update check already called vc4_plane_mode_set() and + * decided to fallback to sync update because async update was not + * possible. + */ + vc4_state->dlist_initialized =3D 1; + + vc4_plane_calc_load(state); + + drm_dbg_driver(drm, "[PLANE:%d:%s] Computed DLIST size: %u\n", + plane->base.id, plane->name, vc4_state->dlist_count); + + return 0; +} + /* If a modeset involves changing the setup of a plane, the atomic * infrastructure will call this to validate a proposed plane setup. * However, if a plane isn't getting updated, this (and the @@ -1373,6 +2058,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, static int vc4_plane_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state) { + struct vc4_dev *vc4 =3D to_vc4_dev(plane->dev); struct drm_plane_state *new_plane_state =3D drm_atomic_get_new_plane_stat= e(state, plane); struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(new_plane_state); @@ -1380,10 +2066,21 @@ static int vc4_plane_atomic_check(struct drm_plane = *plane, =20 vc4_state->dlist_count =3D 0; =20 - if (!plane_enabled(new_plane_state)) + if (!plane_enabled(new_plane_state)) { + struct drm_plane_state *old_plane_state =3D + drm_atomic_get_old_plane_state(state, plane); + + if (vc4->gen >=3D VC4_GEN_6_C && old_plane_state && + plane_enabled(old_plane_state)) { + vc6_plane_free_upm(new_plane_state); + } return 0; + } =20 - ret =3D vc4_plane_mode_set(plane, new_plane_state); + if (vc4->gen >=3D VC4_GEN_6_C) + ret =3D vc6_plane_mode_set(plane, new_plane_state); + else + ret =3D vc4_plane_mode_set(plane, new_plane_state); if (ret) return ret; =20 @@ -1391,6 +2088,12 @@ static int vc4_plane_atomic_check(struct drm_plane *= plane, if (ret) return ret; =20 + if (vc4->gen >=3D VC4_GEN_6_C) { + ret =3D vc6_plane_allocate_upm(new_plane_state); + if (ret) + return ret; + } + return 0; } =20 @@ -1439,7 +2142,8 @@ void vc4_plane_async_set_fb(struct drm_plane *plane, = struct drm_framebuffer *fb) { struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(plane->state); struct drm_gem_dma_object *bo =3D drm_fb_dma_get_gem_obj(fb, 0); - uint32_t addr; + struct vc4_dev *vc4 =3D to_vc4_dev(plane->dev); + dma_addr_t dma_addr =3D bo->dma_addr + fb->offsets[0]; int idx; =20 if (!drm_dev_enter(plane->dev, &idx)) @@ -1449,19 +2153,38 @@ void vc4_plane_async_set_fb(struct drm_plane *plane= , struct drm_framebuffer *fb) * because this is only called on the primary plane. */ WARN_ON_ONCE(plane->state->crtc_x < 0 || plane->state->crtc_y < 0); - addr =3D bo->dma_addr + fb->offsets[0]; =20 - /* Write the new address into the hardware immediately. The - * scanout will start from this address as soon as the FIFO - * needs to refill with pixels. - */ - writel(addr, &vc4_state->hw_dlist[vc4_state->ptr0_offset[0]]); + if (vc4->gen =3D=3D VC4_GEN_6_C) { + u32 value; =20 - /* Also update the CPU-side dlist copy, so that any later - * atomic updates that don't do a new modeset on our plane - * also use our updated address. - */ - vc4_state->dlist[vc4_state->ptr0_offset[0]] =3D addr; + value =3D vc4_state->dlist[vc4_state->ptr0_offset[0]] & + ~SCALER6_PTR0_UPPER_ADDR_MASK; + value |=3D VC4_SET_FIELD(upper_32_bits(dma_addr) & 0xff, + SCALER6_PTR0_UPPER_ADDR); + + writel(value, &vc4_state->hw_dlist[vc4_state->ptr0_offset[0]]); + vc4_state->dlist[vc4_state->ptr0_offset[0]] =3D value; + + value =3D lower_32_bits(dma_addr); + writel(value, &vc4_state->hw_dlist[vc4_state->ptr0_offset[0] + 1]); + vc4_state->dlist[vc4_state->ptr0_offset[0] + 1] =3D value; + } else { + u32 addr; + + addr =3D (u32)dma_addr; + + /* Write the new address into the hardware immediately. The + * scanout will start from this address as soon as the FIFO + * needs to refill with pixels. + */ + writel(addr, &vc4_state->hw_dlist[vc4_state->ptr0_offset[0]]); + + /* Also update the CPU-side dlist copy, so that any later + * atomic updates that don't do a new modeset on our plane + * also use our updated address. + */ + vc4_state->dlist[vc4_state->ptr0_offset[0]] =3D addr; + } =20 drm_dev_exit(idx); } @@ -1543,13 +2266,17 @@ static void vc4_plane_atomic_async_update(struct dr= m_plane *plane, static int vc4_plane_atomic_async_check(struct drm_plane *plane, struct drm_atomic_state *state) { + struct vc4_dev *vc4 =3D to_vc4_dev(plane->dev); struct drm_plane_state *new_plane_state =3D drm_atomic_get_new_plane_stat= e(state, plane); struct vc4_plane_state *old_vc4_state, *new_vc4_state; int ret; u32 i; =20 - ret =3D vc4_plane_mode_set(plane, new_plane_state); + if (vc4->gen <=3D VC4_GEN_5) + ret =3D vc4_plane_mode_set(plane, new_plane_state); + else + ret =3D vc6_plane_mode_set(plane, new_plane_state); if (ret) return ret; =20 @@ -1723,7 +2450,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *d= ev, }; =20 for (i =3D 0; i < ARRAY_SIZE(hvs_formats); i++) { - if (!hvs_formats[i].hvs5_only || vc4->gen =3D=3D VC4_GEN_5) { + if (!hvs_formats[i].hvs5_only || vc4->gen >=3D VC4_GEN_5) { formats[num_formats] =3D hvs_formats[i].drm; num_formats++; } @@ -1738,7 +2465,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *d= ev, return ERR_CAST(vc4_plane); plane =3D &vc4_plane->base; =20 - if (vc4->gen =3D=3D VC4_GEN_5) + if (vc4->gen >=3D VC4_GEN_5) drm_plane_helper_add(plane, &vc5_plane_helper_funcs); else drm_plane_helper_add(plane, &vc4_plane_helper_funcs); diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 341a75cf92e5..9226429539cf 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -520,6 +520,130 @@ =20 #define SCALER5_DLIST_START 0x00004000 =20 +#define SCALER6_VERSION 0x00000000 +#define SCALER6_CXM_SIZE 0x00000004 +#define SCALER6_LBM_SIZE 0x00000008 +#define SCALER6_UBM_SIZE 0x0000000c +#define SCALER6_COBA_SIZE 0x00000010 +#define SCALER6_COB_SIZE 0x00000014 + +#define SCALER6_CONTROL 0x00000020 +# define SCALER6_CONTROL_HVS_EN BIT(31) +# define SCALER6_CONTROL_PF_LINES_MASK VC4_MASK(22, 18) +# define SCALER6_CONTROL_ABORT_ON_EMPTY BIT(16) +# define SCALER6_CONTROL_DSP1_TARGET_MASK VC4_MASK(13, 12) +# define SCALER6_CONTROL_MAX_REQS_MASK VC4_MASK(7, 4) + +#define SCALER6_FETCHER_STATUS 0x00000024 +#define SCALER6_FETCH_STATUS 0x00000028 +#define SCALER6_HANDLE_ERROR 0x0000002c + +#define SCALER6_DISP0_CTRL0 0x00000030 +#define SCALER6_DISPX_CTRL0(x) \ + (SCALER6_DISP0_CTRL0 + ((x) * (SCALER6_DISP1_CTRL0 - SCALER6_DISP0_CTRL0)= )) +# define SCALER6_DISPX_CTRL0_ENB BIT(31) +# define SCALER6_DISPX_CTRL0_RESET BIT(30) +# define SCALER6_DISPX_CTRL0_FWIDTH_MASK VC4_MASK(28, 16) +# define SCALER6_DISPX_CTRL0_ONESHOT BIT(15) +# define SCALER6_DISPX_CTRL0_ONECTX_MASK VC4_MASK(14, 13) +# define SCALER6_DISPX_CTRL0_LINES_MASK VC4_MASK(12, 0) + +#define SCALER6_DISP0_CTRL1 0x00000034 +#define SCALER6_DISPX_CTRL1(x) \ + (SCALER6_DISP0_CTRL1 + ((x) * (SCALER6_DISP1_CTRL1 - SCALER6_DISP0_CTRL1)= )) +# define SCALER6_DISPX_CTRL1_BGENB BIT(8) +# define SCALER6_DISPX_CTRL1_INTLACE BIT(0) + +#define SCALER6_DISP0_BGND 0x00000038 +#define SCALER6_DISPX_BGND(x) \ + (SCALER6_DISP0_BGND + ((x) * (SCALER6_DISP1_BGND - SCALER6_DISP0_BGND))) + +#define SCALER6_DISP0_LPTRS 0x0000003c +#define SCALER6_DISPX_LPTRS(x) \ + (SCALER6_DISP0_LPTRS + ((x) * (SCALER6_DISP1_LPTRS - SCALER6_DISP0_LPTRS)= )) +# define SCALER6_DISPX_LPTRS_HEADE_MASK VC4_MASK(11, 0) + +#define SCALER6_DISP0_COB 0x00000040 +#define SCALER6_DISPX_COB(x) \ + (SCALER6_DISP0_COB + ((x) * (SCALER6_DISP1_COB - SCALER6_DISP0_COB))) +# define SCALER6_DISPX_COB_TOP_MASK VC4_MASK(31, 16) +# define SCALER6_DISPX_COB_BASE_MASK VC4_MASK(15, 0) + +#define SCALER6_DISP0_STATUS 0x00000044 + +#define SCALER6_DISPX_STATUS(x) \ + (SCALER6_DISP0_STATUS + ((x) * (SCALER6_DISP1_STATUS - SCALER6_DISP0_STAT= US))) +# define SCALER6_DISPX_STATUS_EMPTY BIT(22) +# define SCALER6_DISPX_STATUS_FRCNT_MASK VC4_MASK(21, 16) +# define SCALER6_DISPX_STATUS_OFIELD BIT(15) +# define SCALER6_DISPX_STATUS_MODE_MASK VC4_MASK(14, 13) +# define SCALER6_DISPX_STATUS_MODE_DISABLED 0 +# define SCALER6_DISPX_STATUS_MODE_INIT 1 +# define SCALER6_DISPX_STATUS_MODE_RUN 2 +# define SCALER6_DISPX_STATUS_MODE_EOF 3 +# define SCALER6_DISPX_STATUS_YLINE_MASK VC4_MASK(12, 0) + +#define SCALER6_DISP0_DL 0x00000048 + +#define SCALER6_DISPX_DL(x) \ + (SCALER6_DISP0_DL + ((x) * (SCALER6_DISP1_DL - SCALER6_DISP0_DL))) +# define SCALER6_DISPX_DL_LACT_MASK VC4_MASK(11, 0) + +#define SCALER6_DISP0_RUN 0x0000004c +#define SCALER6_DISP1_CTRL0 0x00000050 +#define SCALER6_DISP1_CTRL1 0x00000054 +#define SCALER6_DISP1_BGND 0x00000058 +#define SCALER6_DISP1_LPTRS 0x0000005c +#define SCALER6_DISP1_COB 0x00000060 +#define SCALER6_DISP1_STATUS 0x00000064 +#define SCALER6_DISP1_DL 0x00000068 +#define SCALER6_DISP1_RUN 0x0000006c +#define SCALER6_DISP2_CTRL0 0x00000070 +#define SCALER6_DISP2_CTRL1 0x00000074 +#define SCALER6_DISP2_BGND 0x00000078 +#define SCALER6_DISP2_LPTRS 0x0000007c +#define SCALER6_DISP2_COB 0x00000080 +#define SCALER6_DISP2_STATUS 0x00000084 +#define SCALER6_DISP2_DL 0x00000088 +#define SCALER6_DISP2_RUN 0x0000008c +#define SCALER6_EOLN 0x00000090 +#define SCALER6_DL_STATUS 0x00000094 +#define SCALER6_BFG_MISC 0x0000009c +#define SCALER6_QOS0 0x000000a0 +#define SCALER6_PROF0 0x000000a4 +#define SCALER6_QOS1 0x000000a8 +#define SCALER6_PROF1 0x000000ac +#define SCALER6_QOS2 0x000000b0 +#define SCALER6_PROF2 0x000000b4 +#define SCALER6_PRI_MAP0 0x000000b8 +#define SCALER6_PRI_MAP1 0x000000bc +#define SCALER6_HISTCTRL 0x000000c0 +#define SCALER6_HISTBIN0 0x000000c4 +#define SCALER6_HISTBIN1 0x000000c8 +#define SCALER6_HISTBIN2 0x000000cc +#define SCALER6_HISTBIN3 0x000000d0 +#define SCALER6_HISTBIN4 0x000000d4 +#define SCALER6_HISTBIN5 0x000000d8 +#define SCALER6_HISTBIN6 0x000000dc +#define SCALER6_HISTBIN7 0x000000e0 +#define SCALER6_HDR_CFG_REMAP 0x000000f4 +#define SCALER6_COL_SPACE 0x000000f8 +#define SCALER6_HVS_ID 0x000000fc +#define SCALER6_CFC1 0x00000100 +#define SCALER6_DISP_UPM_ISO0 0x00000200 +#define SCALER6_DISP_UPM_ISO1 0x00000204 +#define SCALER6_DISP_UPM_ISO2 0x00000208 +#define SCALER6_DISP_LBM_ISO0 0x0000020c +#define SCALER6_DISP_LBM_ISO1 0x00000210 +#define SCALER6_DISP_LBM_ISO2 0x00000214 +#define SCALER6_DISP_COB_ISO0 0x00000218 +#define SCALER6_DISP_COB_ISO1 0x0000021c +#define SCALER6_DISP_COB_ISO2 0x00000220 +#define SCALER6_BAD_COB 0x00000224 +#define SCALER6_BAD_LBM 0x00000228 +#define SCALER6_BAD_UPM 0x0000022c +#define SCALER6_BAD_AXI 0x00000230 + # define VC4_HDMI_SW_RESET_FORMAT_DETECT BIT(1) # define VC4_HDMI_SW_RESET_HDMI BIT(0) =20 @@ -1115,4 +1239,61 @@ enum hvs_pixel_format { #define SCALER_PITCH0_TILE_WIDTH_R_MASK VC4_MASK(6, 0) #define SCALER_PITCH0_TILE_WIDTH_R_SHIFT 0 =20 +#define SCALER6_CTL0_END BIT(31) +#define SCALER6_CTL0_VALID BIT(30) +#define SCALER6_CTL0_NEXT_MASK VC4_MASK(29, 24) +#define SCALER6_CTL0_RGB_TRANS BIT(23) +#define SCALER6_CTL0_ADDR_MODE_MASK VC4_MASK(22, 20) +#define SCALER6_CTL0_ADDR_MODE_LINEAR 0 +#define SCALER6_CTL0_ADDR_MODE_128B 1 +#define SCALER6_CTL0_ADDR_MODE_256B 2 +#define SCALER6_CTL0_ADDR_MODE_MAP8 3 +#define SCALER6_CTL0_ADDR_MODE_UIF 4 + +#define SCALER6_CTL0_ALPHA_MASK_MASK VC4_MASK(19, 18) +#define SCALER6_CTL0_UNITY BIT(15) +#define SCALER6_CTL0_ORDERRGBA_MASK VC4_MASK(14, 13) +#define SCALER6_CTL0_SCL1_MODE_MASK VC4_MASK(10, 8) +#define SCALER6_CTL0_SCL0_MODE_MASK VC4_MASK(7, 5) +#define SCALER6_CTL0_PIXEL_FORMAT_MASK VC4_MASK(4, 0) + +#define SCALER6_POS0_START_Y_MASK VC4_MASK(28, 16) +#define SCALER6_POS0_HFLIP BIT(15) +#define SCALER6_POS0_START_X_MASK VC4_MASK(12, 0) + +#define SCALER6_CTL2_ALPHA_MODE_MASK VC4_MASK(31, 30) +#define SCALER6_CTL2_ALPHA_PREMULT BIT(29) +#define SCALER6_CTL2_ALPHA_MIX BIT(28) +#define SCALER6_CTL2_BFG BIT(26) +#define SCALER6_CTL2_CSC_ENABLE BIT(25) +#define SCALER6_CTL2_BRCM_CFC_CONTROL_MASK VC4_MASK(18, 16) +#define SCALER6_CTL2_ALPHA_MASK VC4_MASK(15, 4) + +#define SCALER6_POS1_SCL_LINES_MASK VC4_MASK(28, 16) +#define SCALER6_POS1_SCL_WIDTH_MASK VC4_MASK(12, 0) + +#define SCALER6_POS2_SRC_LINES_MASK VC4_MASK(28, 16) +#define SCALER6_POS2_SRC_WIDTH_MASK VC4_MASK(12, 0) + +#define SCALER6_PTR0_VFLIP BIT(31) +#define SCALER6_PTR0_UPM_BASE_MASK VC4_MASK(28, 16) +#define SCALER6_PTR0_UPM_HANDLE_MASK VC4_MASK(14, 10) +#define SCALER6_PTR0_UPM_BUFF_SIZE_MASK VC4_MASK(9, 8) +#define SCALER6_PTR0_UPM_BUFF_SIZE_16_LINES 3 +#define SCALER6_PTR0_UPM_BUFF_SIZE_8_LINES 2 +#define SCALER6_PTR0_UPM_BUFF_SIZE_4_LINES 1 +#define SCALER6_PTR0_UPM_BUFF_SIZE_2_LINES 0 +#define SCALER6_PTR0_UPPER_ADDR_MASK VC4_MASK(7, 0) + +#define SCALER6_PTR2_ALPHA_BPP_MASK VC4_MASK(31, 31) +#define SCALER6_PTR2_ALPHA_BPP_1BPP 1 +#define SCALER6_PTR2_ALPHA_BPP_8BPP 0 +#define SCALER6_PTR2_ALPHA_ORDER_MASK VC4_MASK(30, 30) +#define SCALER6_PTR2_ALPHA_ORDER_MSB_TO_LSB 1 +#define SCALER6_PTR2_ALPHA_ORDER_LSB_TO_MSB 0 +#define SCALER6_PTR2_ALPHA_OFFS_MASK VC4_MASK(29, 27) +#define SCALER6_PTR2_LSKIP_MASK VC4_MASK(26, 24) +#define SCALER6_PTR2_PITCH_MASK VC4_MASK(16, 0) +#define SCALER6_PTR2_FETCH_COUNT_MASK VC4_MASK(26, 16) + #endif /* VC4_REGS_H */ --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 993C2224403 for ; Fri, 25 Oct 2024 17:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876576; cv=none; b=sZbJlEMzpzesnf2trMvaK5E8k5qL9yy76QSvpdJ2v1Jz/TauTq9HKXumYR5VDXd5wvzb2O9w/M37gbdd+y/VsDSGQGeawfpkyncVOHUG2la30h0SVGnKNjs75gAhEaw9Fv4nASRMEDHuIiuW2nusR5+iCD+gJ4IDCJ+8CN0CC0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876576; c=relaxed/simple; bh=AKaxaAWgaWZCuM+ciKXobaTSn9sWMMJz3W069vSvAMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ih3oT2lq9DL98chm4yCGlIh/1EAwSw0STS19AWgSUWxGVoUJ/YYk5vd4YdRjKOGu2sqVJKJKhPCZbrUYNQ+u1dsfSJR70DPVUVgUuJI/AX0Fq73KfrC61TBd1zweC/YvAfKHXuDHWE/q/VQy42dvp+spi8+zRKoPjDfA9+DbLQg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=ZvUp+tuY; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZvUp+tuY" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-43155afca99so22976965e9.1 for ; Fri, 25 Oct 2024 10:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876572; x=1730481372; 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=tsucG0Q0vHPFBy6lzVvgyGm98jkpqjywCenuNv6tqlM=; b=ZvUp+tuYUZYJqY8toc6lmCoT0D06y9gmObug6jz24i5znlBvczxvgxGD7LvkxZKhrl Hq56NCjPxMM9gQG7G2+9VKbC4VNSiRjDgcPsDRP5vlJG98vFBdQ4RY6ZDs4l9xMEUTh+ lqa1dbKGCTJzJ6pVeWCBLx/quLBS+rGFACqNaekeFLQx1BZ4PBmkPP9z67smn8OFbe68 EuaTlNt+ovkkA+soAjBjYqRfty4ZZFrM2vuhGygtu30GRbgSZc3U/S0QW/XUlXg4s8Fr TbttVINMS8tNVNbiBfn+I8Q/ifbV0ieb0ewRccGA2J33CHLEymBbb2HZCwKH0x5pL1UK QuFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876572; x=1730481372; 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=tsucG0Q0vHPFBy6lzVvgyGm98jkpqjywCenuNv6tqlM=; b=hZ8RzBVBaDkhba5OCik7GEPxxpZiz9ZjLHLTK1XTRW4py0LGTpglyN/N21C1KzdsqO NKj6oVgO7bYQ/ZhB5gnamyJmOYNo+bI1CWTgES4nfZh9+Wk4g7o5OuPDeK749W51A67j gPH85MLQXsYcF9yOI15Rz3kXjs3cHcqYWM1qRyDqANNAWY/cj5z9DI2POgUPUeAisyVk SrJj6s60z+2TmDQpqa19DBMb6OuGDL12P7YmunfoA2Adh3TboFIHJD/QWTcwOtYm+vmJ ecHLWfzqpcKXqrlnDDlfv1qpZJqXw3otaCA1aLznW56y94dFMRc6iPWyWFY95lon7B4S ymrw== X-Forwarded-Encrypted: i=1; AJvYcCWEiDoEOU6qIpQmQ3nFWojFc/l4PvMdxNHRAIGHI/7BC5ZpdyRc6th+J8GirzDw7LFki20XU2uEWDIBNyc=@vger.kernel.org X-Gm-Message-State: AOJu0YySBuzYFZHczQNV140/jEA9DYSOxwZo3F36a4J9hcaTQt5FcrF+ WobfjCybQssDkMQxnKLvBwNO11trd590kZJERnFY/ED5WFK25agsnqCBJaNirqI= X-Google-Smtp-Source: AGHT+IGUqMQQsp99SP+bQHGGlASJ4CwqsEZ+AnxXoU5Dx0q1aLWp3syCMzhCcHZAUhr5TKhw7gxREg== X-Received: by 2002:a05:600c:3b1d:b0:42c:b8c9:16c8 with SMTP id 5b1f17b1804b1-4319a58a309mr2507395e9.10.1729876571991; Fri, 25 Oct 2024 10:16:11 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:11 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:42 +0100 Subject: [PATCH v2 11/36] drm/vc4: crtc: Add support for BCM2712 PixelValves Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-11-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The PixelValves found on the BCM2712 are similar to the ones found in the previous generation. Compared to BCM2711: - the pixelvalves only drive one HDMI controller each - HDMI1 PixelValve has a FIFO long enough to support 4k at 60Hz - support has been added for odd horizontal timings whilst at 2pixels/clock Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_crtc.c | 49 ++++++++++++++++++++++++++++++++++++++= ++-- drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ drivers/gpu/drm/vc4/vc4_regs.h | 6 ++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 53bca104d0d5..bfa25efa5db2 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -240,6 +240,11 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc= 4_crtc, u32 format) const struct vc4_crtc_data *crtc_data =3D vc4_crtc_to_vc4_crtc_data(vc4_c= rtc); const struct vc4_pv_data *pv_data =3D vc4_crtc_to_vc4_pv_data(vc4_crtc); struct vc4_dev *vc4 =3D to_vc4_dev(vc4_crtc->base.dev); + + /* + * NOTE: Could we use register 0x68 (PV_HW_CFG1) to get the FIFO + * size? + */ u32 fifo_len_bytes =3D pv_data->fifo_depth; =20 /* @@ -421,6 +426,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode */ CRTC_WRITE(PV_V_CONTROL, PV_VCONTROL_CONTINUOUS | + (vc4->gen >=3D VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) | (is_dsi ? PV_VCONTROL_DSI : 0) | PV_VCONTROL_INTERLACE | (odd_field_first @@ -432,6 +438,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode } else { CRTC_WRITE(PV_V_CONTROL, PV_VCONTROL_CONTINUOUS | + (vc4->gen >=3D VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) | (is_dsi ? PV_VCONTROL_DSI : 0)); CRTC_WRITE(PV_VSYNCD_EVEN, 0); } @@ -446,11 +453,17 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc,= struct drm_encoder *encode if (is_dsi) CRTC_WRITE(PV_HACT_ACT, mode->hdisplay * pixel_rep); =20 - if (vc4->gen =3D=3D VC4_GEN_5) + if (vc4->gen >=3D VC4_GEN_5) CRTC_WRITE(PV_MUX_CFG, VC4_SET_FIELD(PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP, PV_MUX_CFG_RGB_PIXEL_MUX_MODE)); =20 + if (vc4->gen >=3D VC4_GEN_6_C) + CRTC_WRITE(PV_PIPE_INIT_CTRL, + VC4_SET_FIELD(1, PV_PIPE_INIT_CTRL_PV_INIT_WIDTH) | + VC4_SET_FIELD(1, PV_PIPE_INIT_CTRL_PV_INIT_IDLE) | + PV_PIPE_INIT_CTRL_PV_INIT_EN); + CRTC_WRITE(PV_CONTROL, PV_CONTROL_FIFO_CLR | vc4_crtc_get_fifo_full_level_bits(vc4_crtc, format) | VC4_SET_FIELD(format, PV_CONTROL_FORMAT) | @@ -549,7 +562,11 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || of_device_is_compatible(vc4_crtc->pdev->dev.of_node, - "brcm,bcm2711-pixelvalve4"))) + "brcm,bcm2711-pixelvalve4") || + of_device_is_compatible(vc4_crtc->pdev->dev.of_node, + "brcm,bcm2712-pixelvalve0") || + of_device_is_compatible(vc4_crtc->pdev->dev.of_node, + "brcm,bcm2712-pixelvalve1"))) return 0; =20 if (!(CRTC_READ(PV_CONTROL) & PV_CONTROL_EN)) @@ -1292,6 +1309,32 @@ const struct vc4_pv_data bcm2711_pv4_data =3D { }, }; =20 +const struct vc4_pv_data bcm2712_pv0_data =3D { + .base =3D { + .debugfs_name =3D "crtc0_regs", + .hvs_available_channels =3D BIT(0), + .hvs_output =3D 0, + }, + .fifo_depth =3D 64, + .pixels_per_clock =3D 1, + .encoder_types =3D { + [0] =3D VC4_ENCODER_TYPE_HDMI0, + }, +}; + +const struct vc4_pv_data bcm2712_pv1_data =3D { + .base =3D { + .debugfs_name =3D "crtc1_regs", + .hvs_available_channels =3D BIT(1), + .hvs_output =3D 1, + }, + .fifo_depth =3D 64, + .pixels_per_clock =3D 1, + .encoder_types =3D { + [0] =3D VC4_ENCODER_TYPE_HDMI1, + }, +}; + static const struct of_device_id vc4_crtc_dt_match[] =3D { { .compatible =3D "brcm,bcm2835-pixelvalve0", .data =3D &bcm2835_pv0_data= }, { .compatible =3D "brcm,bcm2835-pixelvalve1", .data =3D &bcm2835_pv1_data= }, @@ -1301,6 +1344,8 @@ static const struct of_device_id vc4_crtc_dt_match[] = =3D { { .compatible =3D "brcm,bcm2711-pixelvalve2", .data =3D &bcm2711_pv2_data= }, { .compatible =3D "brcm,bcm2711-pixelvalve3", .data =3D &bcm2711_pv3_data= }, { .compatible =3D "brcm,bcm2711-pixelvalve4", .data =3D &bcm2711_pv4_data= }, + { .compatible =3D "brcm,bcm2712-pixelvalve0", .data =3D &bcm2712_pv0_data= }, + { .compatible =3D "brcm,bcm2712-pixelvalve1", .data =3D &bcm2712_pv1_data= }, {} }; =20 diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index aea585bf83eb..a68cea921c11 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -558,6 +558,8 @@ extern const struct vc4_pv_data bcm2711_pv1_data; extern const struct vc4_pv_data bcm2711_pv2_data; extern const struct vc4_pv_data bcm2711_pv3_data; extern const struct vc4_pv_data bcm2711_pv4_data; +extern const struct vc4_pv_data bcm2712_pv0_data; +extern const struct vc4_pv_data bcm2712_pv1_data; =20 struct vc4_crtc { struct drm_crtc base; diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 9226429539cf..731b13742ef5 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -155,6 +155,7 @@ # define PV_CONTROL_EN BIT(0) =20 #define PV_V_CONTROL 0x04 +# define PV_VCONTROL_ODD_TIMING BIT(29) # define PV_VCONTROL_ODD_DELAY_MASK VC4_MASK(22, 6) # define PV_VCONTROL_ODD_DELAY_SHIFT 6 # define PV_VCONTROL_ODD_FIRST BIT(5) @@ -215,6 +216,11 @@ # define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_SHIFT 2 # define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP 8 =20 +#define PV_PIPE_INIT_CTRL 0x94 +# define PV_PIPE_INIT_CTRL_PV_INIT_WIDTH_MASK VC4_MASK(11, 8) +# define PV_PIPE_INIT_CTRL_PV_INIT_IDLE_MASK VC4_MASK(7, 4) +# define PV_PIPE_INIT_CTRL_PV_INIT_EN BIT(0) + #define SCALER_CHANNELS_COUNT 3 =20 #define SCALER_DISPCTRL 0x00000000 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 F220C224439 for ; Fri, 25 Oct 2024 17:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876581; cv=none; b=aqS6o/x7rQV++1mmD/agTmxg/Lp7bK/pLzVSUJtmi5RMKLJM3rJBcik3mWZtDWV7d8W+rx8XvvQqV6yQ7M+hJ6OfjXmFyWE5s0Ye+POz3aCyMuCqa1iNP9ni0lmgdQffXC6ZwA9Hb09IeQsXZ5iFB9ztmP3WXVnjsORFVgfiX64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876581; c=relaxed/simple; bh=/fZbiJa32QaV9GAfZrCbLMGxOZWrhiFrgBpZ8pW1tyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XK5EuTOS5WmZTroooXg3x0suPub8wKLq4XCngVIfgSoNqNXQmtmGjIGNQXU0WeM+QMULKXEKe1isdb5vrpVt7VvOkDmUN2dD5OyHpSogTtn6UXBb/A6vODcniTiiy3K5lj8bUwGGQSbI4OA8Augua+5hTwvetB+SgFNiR8PNnVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=HFG+NmJy; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="HFG+NmJy" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-37d63a79bb6so1472666f8f.0 for ; Fri, 25 Oct 2024 10:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876573; x=1730481373; 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=2GDWNCHVQarSF1EEwfXlfq36u8DqCBP9Z5agqC+LawY=; b=HFG+NmJytEvsXMs9zycu9NAvr6IQzfrlgH8KSGlie/acgGw3fjgkfcKITod1Qdr6Ac aolvzMlynhKn0tM36QQfIU1j8xwbjK1d6rqyBFJeEEatFtPgFqn77KVj23G/Kv3btyDe WSbho2lIKtK+g5lOnKZRNf855r4G3L/E3SPk7RhMYn0fZxQHKp0oyVS6KGvFLkxqI8iT 6ZksuE60vgHww+q0CX3Jf1mapxxA0GjG8k8lUk/Q+byn4nzxOsZMcSe4Rm1AypRczxYk R6f9B2Ta6Gx7lZgN7xHDKZ/2PfLqiFz/OM1cfL+1ESLUM46IygHh3ORplVU5XhZsgbWT ByIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876573; x=1730481373; 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=2GDWNCHVQarSF1EEwfXlfq36u8DqCBP9Z5agqC+LawY=; b=Opo1DV95fGWa7BxlOZRyW5UK/H5VX1PdqGm9q1iejMg0cnlh887EOibFT2iN8VwE1O Kabea8zT1Dys4vP+ITVneHd9yFEnGEkT1AFn3ZZls3C+QjqE41t+SpCE6RdnCTvgmhGd VW1YVI2P49FqjcBYkAgWF7WFoysLYg8W2mvOFPuF44Pc9ss9fYKZmH9R8MTgsdL/3P2U i1RPCnu4mHrFrmOW7W1L3mQqeboOA/SnCwp18L0Q9XjQbi4RH2+qw7BYDlb9KRmI3b21 Lj+0JoO1H0tGwlRpjhUq/yW1XJQaBt5FBsm6bWuS342KwDKNkjbRZJnUMwnLvpqfSg65 JbpA== X-Forwarded-Encrypted: i=1; AJvYcCXTmnxgDOQe69iXi/aEnd2WC9Qogn3kWXPevkJU7/eU+NfZEUzd+ZGpyQzrstqB9WmNqjGRYCPJC06nKQE=@vger.kernel.org X-Gm-Message-State: AOJu0YzKS04Lu5ghCktA5vc1MklbG1NYXhEHXH5lbaGazz8IO6jvO/YH tLUmoQaaHnkyPDikziGV0Le0Vbq9sYOSkvJ4Nk0FnA/tDkbVeFZDdR4ZoCBULmo= X-Google-Smtp-Source: AGHT+IEY2w+9TLfBawykLbvXXppNoMF/sZiP+gnb+g1AcZiAXcJNlN8xeoUfAV01MsYrcLak/HBITg== X-Received: by 2002:a05:6000:bd0:b0:368:37ac:3f95 with SMTP id ffacd0b85a97d-380611850a0mr133306f8f.31.1729876573071; Fri, 25 Oct 2024 10:16:13 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:12 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:43 +0100 Subject: [PATCH v2 12/36] drm/vc4: hdmi: Add support for BCM2712 HDMI controllers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-12-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The HDMI controllers found in the BCM2712 are largely the ones found in the BCM2711 with a different PHY. There's some difference with how timings are split between registers, and HDMI1 is now able to run at 4k/60Hz. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 88 ++++- drivers/gpu/drm/vc4/vc4_hdmi.h | 4 + drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 640 ++++++++++++++++++++++++++++++++= ++++ drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 217 ++++++++++++ 4 files changed, 943 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 62b82b1eeb36..1456966732ec 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -845,6 +845,7 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct d= rm_encoder *encoder, { struct vc4_hdmi *vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); struct drm_device *drm =3D vc4_hdmi->connector.dev; + struct vc4_dev *vc4 =3D to_vc4_dev(drm); unsigned long flags; int idx; =20 @@ -861,14 +862,25 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct= drm_encoder *encoder, =20 HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB); =20 + if (vc4->gen >=3D VC4_GEN_6_C) + HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | + VC4_HD_VID_CTL_BLANKPIX); + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); =20 mdelay(1); =20 - spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); - HDMI_WRITE(HDMI_VID_CTL, - HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); - spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); + /* + * TODO: This should work on BCM2712, but doesn't for some + * reason and result in a system lockup. + */ + if (vc4->gen < VC4_GEN_6_C) { + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + HDMI_WRITE(HDMI_VID_CTL, + HDMI_READ(HDMI_VID_CTL) & + ~VC4_HD_VID_CTL_ENABLE); + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); + } =20 vc4_hdmi_disable_scrambling(encoder); =20 @@ -1488,7 +1500,6 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struc= t drm_encoder *encoder, goto err_put_runtime_pm; } =20 - vc4_hdmi_cec_update_clk_div(vc4_hdmi); =20 if (tmds_char_rate > 297000000) @@ -1594,6 +1605,8 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct = drm_encoder *encoder, spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); =20 HDMI_WRITE(HDMI_VID_CTL, + (HDMI_READ(HDMI_VID_CTL) & + ~(VC4_HD_VID_CTL_VSYNC_LOW | VC4_HD_VID_CTL_HSYNC_LOW)) | VC4_HD_VID_CTL_ENABLE | VC4_HD_VID_CTL_CLRRGB | VC4_HD_VID_CTL_UNDERFLOW_ENABLE | @@ -3121,6 +3134,7 @@ static int vc4_hdmi_runtime_suspend(struct device *de= v) { struct vc4_hdmi *vc4_hdmi =3D dev_get_drvdata(dev); =20 + clk_disable_unprepare(vc4_hdmi->audio_clock); clk_disable_unprepare(vc4_hdmi->hsm_clock); =20 return 0; @@ -3153,6 +3167,10 @@ static int vc4_hdmi_runtime_resume(struct device *de= v) goto err_disable_clk; } =20 + ret =3D clk_prepare_enable(vc4_hdmi->audio_clock); + if (ret) + goto err_disable_clk; + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); =20 @@ -3273,7 +3291,9 @@ static int vc4_hdmi_bind(struct device *dev, struct d= evice *master, void *data) return ret; =20 if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") || - of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) && + of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1") || + of_device_is_compatible(dev->of_node, "brcm,bcm2712-hdmi0") || + of_device_is_compatible(dev->of_node, "brcm,bcm2712-hdmi1")) && HDMI_READ(HDMI_VID_CTL) & VC4_HD_VID_CTL_ENABLE) { clk_prepare_enable(vc4_hdmi->pixel_clock); clk_prepare_enable(vc4_hdmi->hsm_clock); @@ -3407,10 +3427,66 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_= variant =3D { .hp_detect =3D vc5_hdmi_hp_detect, }; =20 +static const struct vc4_hdmi_variant bcm2712_hdmi0_variant =3D { + .encoder_type =3D VC4_ENCODER_TYPE_HDMI0, + .debugfs_name =3D "hdmi0_regs", + .card_name =3D "vc4-hdmi-0", + .max_pixel_clock =3D 600000000, + .registers =3D vc6_hdmi_hdmi0_fields, + .num_registers =3D ARRAY_SIZE(vc6_hdmi_hdmi0_fields), + .phy_lane_mapping =3D { + PHY_LANE_0, + PHY_LANE_1, + PHY_LANE_2, + PHY_LANE_CK, + }, + .unsupported_odd_h_timings =3D false, + .external_irq_controller =3D true, + + .init_resources =3D vc5_hdmi_init_resources, + .csc_setup =3D vc5_hdmi_csc_setup, + .reset =3D vc5_hdmi_reset, + .set_timings =3D vc5_hdmi_set_timings, + .phy_init =3D vc6_hdmi_phy_init, + .phy_disable =3D vc6_hdmi_phy_disable, + .channel_map =3D vc5_hdmi_channel_map, + .supports_hdr =3D true, + .hp_detect =3D vc5_hdmi_hp_detect, +}; + +static const struct vc4_hdmi_variant bcm2712_hdmi1_variant =3D { + .encoder_type =3D VC4_ENCODER_TYPE_HDMI1, + .debugfs_name =3D "hdmi1_regs", + .card_name =3D "vc4-hdmi-1", + .max_pixel_clock =3D 600000000, + .registers =3D vc6_hdmi_hdmi1_fields, + .num_registers =3D ARRAY_SIZE(vc6_hdmi_hdmi1_fields), + .phy_lane_mapping =3D { + PHY_LANE_0, + PHY_LANE_1, + PHY_LANE_2, + PHY_LANE_CK, + }, + .unsupported_odd_h_timings =3D false, + .external_irq_controller =3D true, + + .init_resources =3D vc5_hdmi_init_resources, + .csc_setup =3D vc5_hdmi_csc_setup, + .reset =3D vc5_hdmi_reset, + .set_timings =3D vc5_hdmi_set_timings, + .phy_init =3D vc6_hdmi_phy_init, + .phy_disable =3D vc6_hdmi_phy_disable, + .channel_map =3D vc5_hdmi_channel_map, + .supports_hdr =3D true, + .hp_detect =3D vc5_hdmi_hp_detect, +}; + static const struct of_device_id vc4_hdmi_dt_match[] =3D { { .compatible =3D "brcm,bcm2835-hdmi", .data =3D &bcm2835_variant }, { .compatible =3D "brcm,bcm2711-hdmi0", .data =3D &bcm2711_hdmi0_variant = }, { .compatible =3D "brcm,bcm2711-hdmi1", .data =3D &bcm2711_hdmi1_variant = }, + { .compatible =3D "brcm,bcm2712-hdmi0", .data =3D &bcm2712_hdmi0_variant = }, + { .compatible =3D "brcm,bcm2712-hdmi1", .data =3D &bcm2712_hdmi1_variant = }, {} }; =20 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index b37f1d2c3fe5..b2424a21da23 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -237,4 +237,8 @@ void vc5_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); void vc5_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi); void vc5_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi); =20 +void vc6_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, + struct drm_connector_state *conn_state); +void vc6_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); + #endif /* _VC4_HDMI_H_ */ diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_phy.c b/drivers/gpu/drm/vc4/vc4_h= dmi_phy.c index 1f5507fc7a03..56e6a35da357 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_phy.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi_phy.c @@ -125,6 +125,48 @@ #define VC4_HDMI_RM_FORMAT_SHIFT_SHIFT 24 #define VC4_HDMI_RM_FORMAT_SHIFT_MASK VC4_MASK(25, 24) =20 +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_BG_PWRUP BIT(8) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_LDO_PWRUP BIT(7) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_BIAS_PWRUP BIT(6) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_RNDGEN_PWRUP BIT(4) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_CK_PWRUP BIT(3) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_2_PWRUP BIT(2) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_1_PWRUP BIT(1) +#define VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_0_PWRUP BIT(0) + +#define VC6_HDMI_TX_PHY_PLL_REFCLK_REFCLK_SEL_CMOS BIT(13) +#define VC6_HDMI_TX_PHY_PLL_REFCLK_REFFRQ_MASK VC4_MASK(9, 0) + +#define VC6_HDMI_TX_PHY_PLL_POST_KDIV_CLK0_SEL_MASK VC4_MASK(3, 2) +#define VC6_HDMI_TX_PHY_PLL_POST_KDIV_KDIV_MASK VC4_MASK(1, 0) + +#define VC6_HDMI_TX_PHY_PLL_VCOCLK_DIV_VCODIV_EN BIT(10) +#define VC6_HDMI_TX_PHY_PLL_VCOCLK_DIV_VCODIV_MASK VC4_MASK(9, 0) + +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_CTL_MASK VC4_MASK(31, 28) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_ENABLE_MASK VC4_MASK(27, 27) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_RATE_CTL_MASK VC4_MASK(26, 26) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_POST_TAP_EN_MASK VC4_MASK(25, 25) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_LDMOS_BIAS_CTL_MASK VC4_MASK(24, 23) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_COM_MODE_LDMOS_EN_MASK VC4_MASK(22, = 22) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EDGE_SEL_MASK VC4_MASK(21, 21) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_HS_EN_MASK VC4_MASK(= 20, 20) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_TERM_CTL_MASK VC4_MASK(19, 18) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_EN_MASK VC4_MASK(17,= 17) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_EN_MASK VC4_MASK(16,= 16) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_CTL_MASK VC4_MASK(15, 12) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_HS_EN_MASK VC4_MASK(= 11, 11) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_MAIN_TAP_CURRENT_SELECT_MASK VC4_MAS= K(10, 8) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_POST_TAP_CURRENT_SELECT_MASK VC4_MAS= K(7, 5) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_LOADING_MASK VC4_MASK(= 4, 3) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_DRIVING_MASK VC4_MASK(= 2, 1) +#define VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_PRE_TAP_EN_MASK VC4_MASK(0, 0) + +#define VC6_HDMI_TX_PHY_PLL_RESET_CTL_PLL_PLLPOST_RESETB BIT(1) +#define VC6_HDMI_TX_PHY_PLL_RESET_CTL_PLL_RESETB BIT(0) + +#define VC6_HDMI_TX_PHY_PLL_POWERUP_CTL_PLL_PWRUP BIT(0) + #define OSCILLATOR_FREQUENCY 54000000 =20 void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, @@ -558,3 +600,601 @@ void vc5_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hd= mi) VC4_HDMI_TX_PHY_POWERDOWN_CTL_RNDGEN_PWRDN); spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); } + +#define VC6_VCO_MIN_FREQ (8ULL * 1000 * 1000 * 1000) +#define VC6_VCO_MAX_FREQ (12ULL * 1000 * 1000 * 1000) + +static unsigned long long +vc6_phy_get_vco_freq(unsigned long long tmds_rate, unsigned int *vco_div) +{ + unsigned int min_div; + unsigned int max_div; + unsigned int div; + + div =3D 0; + while (tmds_rate * div * 10 < VC6_VCO_MIN_FREQ) + div++; + min_div =3D div; + + while (tmds_rate * (div + 1) * 10 < VC6_VCO_MAX_FREQ) + div++; + max_div =3D div; + + div =3D min_div + (max_div - min_div) / 2; + + *vco_div =3D div; + return tmds_rate * div * 10; +} + +struct vc6_phy_lane_settings { + unsigned int ext_current_ctl:4; + unsigned int ffe_enable:1; + unsigned int slew_rate_ctl:1; + unsigned int ffe_post_tap_en:1; + unsigned int ldmos_bias_ctl:2; + unsigned int com_mode_ldmos_en:1; + unsigned int edge_sel:1; + unsigned int ext_current_src_hs_en:1; + unsigned int term_ctl:2; + unsigned int ext_current_src_en:1; + unsigned int int_current_src_en:1; + unsigned int int_current_ctl:4; + unsigned int int_current_src_hs_en:1; + unsigned int main_tap_current_select:3; + unsigned int post_tap_current_select:3; + unsigned int slew_ctl_slow_loading:2; + unsigned int slew_ctl_slow_driving:2; + unsigned int ffe_pre_tap_en:1; +}; + +struct vc6_phy_settings { + unsigned long long min_rate; + unsigned long long max_rate; + struct vc6_phy_lane_settings channel[3]; + struct vc6_phy_lane_settings clock; +}; + +static const struct vc6_phy_settings vc6_hdmi_phy_settings[] =3D { + { + 0, 222000000, + { + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + }, + { + 222000001, 297000000, + { + { + /* 200mA and 180mA ?! */ + .ext_current_ctl =3D 12, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 100 Ohm */ + .term_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + }, + { + /* 200mA and 180mA ?! */ + .ext_current_ctl =3D 12, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 100 Ohm */ + .term_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + }, + { + /* 200mA and 180mA ?! */ + .ext_current_ctl =3D 12, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 100 Ohm */ + .term_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + }, + }, + { + /* 200mA and 180mA ?! */ + .ext_current_ctl =3D 12, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 100 Ohm */ + .term_ctl =3D 1, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + + /* Internal Current Source Half Swing Enable*/ + .int_current_src_hs_en =3D 1, + }, + }, + { + 297000001, 597000044, + { + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* Normal Slew Rate Control */ + .slew_rate_ctl =3D 1, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 50 Ohms */ + .term_ctl =3D 3, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* Normal Slew Rate Control */ + .slew_rate_ctl =3D 1, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 50 Ohms */ + .term_ctl =3D 3, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* Normal Slew Rate Control */ + .slew_rate_ctl =3D 1, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* 50 Ohms */ + .term_ctl =3D 3, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + }, + { + /* 200mA */ + .ext_current_ctl =3D 8, + + /* Normal Slew Rate Control */ + .slew_rate_ctl =3D 1, + + /* 0.85V */ + .ldmos_bias_ctl =3D 1, + + /* External Current Source Half Swing Enable*/ + .ext_current_src_hs_en =3D 1, + + /* 50 Ohms */ + .term_ctl =3D 3, + + /* Enable External Current Source */ + .ext_current_src_en =3D 1, + + /* Enable Internal Current Source */ + .int_current_src_en =3D 1, + + /* 200mA */ + .int_current_ctl =3D 8, + + /* Internal Current Source Half Swing Enable*/ + .int_current_src_hs_en =3D 1, + + /* 17.6 mA */ + .main_tap_current_select =3D 7, + }, + }, +}; + +static const struct vc6_phy_settings * +vc6_phy_get_settings(unsigned long long tmds_rate) +{ + unsigned int count =3D ARRAY_SIZE(vc6_hdmi_phy_settings); + unsigned int i; + + for (i =3D 0; i < count; i++) { + const struct vc6_phy_settings *s =3D &vc6_hdmi_phy_settings[i]; + + if (tmds_rate >=3D s->min_rate && tmds_rate <=3D s->max_rate) + return s; + } + + /* + * If the pixel clock exceeds our max setting, try the max + * setting anyway. + */ + return &vc6_hdmi_phy_settings[count - 1]; +} + +static const struct vc6_phy_lane_settings * +vc6_phy_get_channel_settings(enum vc4_hdmi_phy_channel chan, + unsigned long long tmds_rate) +{ + const struct vc6_phy_settings *settings =3D vc6_phy_get_settings(tmds_rat= e); + + if (chan =3D=3D PHY_LANE_CK) + return &settings->clock; + + return &settings->channel[chan]; +} + +static void vc6_hdmi_reset_phy(struct vc4_hdmi *vc4_hdmi) +{ + lockdep_assert_held(&vc4_hdmi->hw_lock); + + HDMI_WRITE(HDMI_TX_PHY_RESET_CTL, 0); + HDMI_WRITE(HDMI_TX_PHY_POWERUP_CTL, 0); +} + +void vc6_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, + struct drm_connector_state *conn_state) +{ + const struct vc6_phy_lane_settings *chan0_settings; + const struct vc6_phy_lane_settings *chan1_settings; + const struct vc6_phy_lane_settings *chan2_settings; + const struct vc6_phy_lane_settings *clock_settings; + const struct vc4_hdmi_variant *variant =3D vc4_hdmi->variant; + unsigned long long pixel_freq =3D conn_state->hdmi.tmds_char_rate; + unsigned long long vco_freq; + unsigned char word_sel; + unsigned long flags; + unsigned int vco_div; + + vco_freq =3D vc6_phy_get_vco_freq(pixel_freq, &vco_div); + + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + + vc6_hdmi_reset_phy(vc4_hdmi); + + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_0, 0x810c6000); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_1, 0x00b8c451); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_2, 0x46402e31); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_3, 0x00b8c005); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_4, 0x42410261); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_5, 0xcc021001); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_6, 0xc8301c80); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_7, 0xb0804444); + HDMI_WRITE(HDMI_TX_PHY_PLL_MISC_8, 0xf80f8000); + + HDMI_WRITE(HDMI_TX_PHY_PLL_REFCLK, + VC6_HDMI_TX_PHY_PLL_REFCLK_REFCLK_SEL_CMOS | + VC4_SET_FIELD(54, VC6_HDMI_TX_PHY_PLL_REFCLK_REFFRQ)); + + HDMI_WRITE(HDMI_TX_PHY_RESET_CTL, 0x7f); + + HDMI_WRITE(HDMI_RM_OFFSET, + VC4_HDMI_RM_OFFSET_ONLY | + VC4_SET_FIELD(phy_get_rm_offset(vco_freq), + VC4_HDMI_RM_OFFSET_OFFSET)); + + HDMI_WRITE(HDMI_TX_PHY_PLL_VCOCLK_DIV, + VC6_HDMI_TX_PHY_PLL_VCOCLK_DIV_VCODIV_EN | + VC4_SET_FIELD(vco_div, + VC6_HDMI_TX_PHY_PLL_VCOCLK_DIV_VCODIV)); + + HDMI_WRITE(HDMI_TX_PHY_PLL_CFG, + VC4_SET_FIELD(0, VC4_HDMI_TX_PHY_PLL_CFG_PDIV)); + + HDMI_WRITE(HDMI_TX_PHY_PLL_POST_KDIV, + VC4_SET_FIELD(2, VC6_HDMI_TX_PHY_PLL_POST_KDIV_CLK0_SEL) | + VC4_SET_FIELD(1, VC6_HDMI_TX_PHY_PLL_POST_KDIV_KDIV)); + + chan0_settings =3D + vc6_phy_get_channel_settings(variant->phy_lane_mapping[PHY_LANE_0], + pixel_freq); + HDMI_WRITE(HDMI_TX_PHY_CTL_0, + VC4_SET_FIELD(chan0_settings->ext_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_CTL) | + VC4_SET_FIELD(chan0_settings->ffe_enable, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_ENABLE) | + VC4_SET_FIELD(chan0_settings->slew_rate_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_RATE_CTL) | + VC4_SET_FIELD(chan0_settings->ffe_post_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_POST_TAP_EN) | + VC4_SET_FIELD(chan0_settings->ldmos_bias_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_LDMOS_BIAS_CTL) | + VC4_SET_FIELD(chan0_settings->com_mode_ldmos_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_COM_MODE_LDMOS_EN) | + VC4_SET_FIELD(chan0_settings->edge_sel, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EDGE_SEL) | + VC4_SET_FIELD(chan0_settings->ext_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan0_settings->term_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_TERM_CTL) | + VC4_SET_FIELD(chan0_settings->ext_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan0_settings->int_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan0_settings->int_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_CTL) | + VC4_SET_FIELD(chan0_settings->int_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan0_settings->main_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_MAIN_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan0_settings->post_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_POST_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan0_settings->slew_ctl_slow_loading, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_LOADING) | + VC4_SET_FIELD(chan0_settings->slew_ctl_slow_driving, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_DRIVING) | + VC4_SET_FIELD(chan0_settings->ffe_pre_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_PRE_TAP_EN)); + + chan1_settings =3D + vc6_phy_get_channel_settings(variant->phy_lane_mapping[PHY_LANE_1], + pixel_freq); + HDMI_WRITE(HDMI_TX_PHY_CTL_1, + VC4_SET_FIELD(chan1_settings->ext_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_CTL) | + VC4_SET_FIELD(chan1_settings->ffe_enable, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_ENABLE) | + VC4_SET_FIELD(chan1_settings->slew_rate_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_RATE_CTL) | + VC4_SET_FIELD(chan1_settings->ffe_post_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_POST_TAP_EN) | + VC4_SET_FIELD(chan1_settings->ldmos_bias_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_LDMOS_BIAS_CTL) | + VC4_SET_FIELD(chan1_settings->com_mode_ldmos_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_COM_MODE_LDMOS_EN) | + VC4_SET_FIELD(chan1_settings->edge_sel, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EDGE_SEL) | + VC4_SET_FIELD(chan1_settings->ext_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan1_settings->term_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_TERM_CTL) | + VC4_SET_FIELD(chan1_settings->ext_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan1_settings->int_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan1_settings->int_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_CTL) | + VC4_SET_FIELD(chan1_settings->int_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan1_settings->main_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_MAIN_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan1_settings->post_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_POST_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan1_settings->slew_ctl_slow_loading, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_LOADING) | + VC4_SET_FIELD(chan1_settings->slew_ctl_slow_driving, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_DRIVING) | + VC4_SET_FIELD(chan1_settings->ffe_pre_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_PRE_TAP_EN)); + + chan2_settings =3D + vc6_phy_get_channel_settings(variant->phy_lane_mapping[PHY_LANE_2], + pixel_freq); + HDMI_WRITE(HDMI_TX_PHY_CTL_2, + VC4_SET_FIELD(chan2_settings->ext_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_CTL) | + VC4_SET_FIELD(chan2_settings->ffe_enable, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_ENABLE) | + VC4_SET_FIELD(chan2_settings->slew_rate_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_RATE_CTL) | + VC4_SET_FIELD(chan2_settings->ffe_post_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_POST_TAP_EN) | + VC4_SET_FIELD(chan2_settings->ldmos_bias_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_LDMOS_BIAS_CTL) | + VC4_SET_FIELD(chan2_settings->com_mode_ldmos_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_COM_MODE_LDMOS_EN) | + VC4_SET_FIELD(chan2_settings->edge_sel, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EDGE_SEL) | + VC4_SET_FIELD(chan2_settings->ext_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan2_settings->term_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_TERM_CTL) | + VC4_SET_FIELD(chan2_settings->ext_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan2_settings->int_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_EN) | + VC4_SET_FIELD(chan2_settings->int_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_CTL) | + VC4_SET_FIELD(chan2_settings->int_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(chan2_settings->main_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_MAIN_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan2_settings->post_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_POST_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(chan2_settings->slew_ctl_slow_loading, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_LOADING) | + VC4_SET_FIELD(chan2_settings->slew_ctl_slow_driving, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_DRIVING) | + VC4_SET_FIELD(chan2_settings->ffe_pre_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_PRE_TAP_EN)); + + clock_settings =3D + vc6_phy_get_channel_settings(variant->phy_lane_mapping[PHY_LANE_CK], + pixel_freq); + HDMI_WRITE(HDMI_TX_PHY_CTL_CK, + VC4_SET_FIELD(clock_settings->ext_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_CTL) | + VC4_SET_FIELD(clock_settings->ffe_enable, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_ENABLE) | + VC4_SET_FIELD(clock_settings->slew_rate_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_RATE_CTL) | + VC4_SET_FIELD(clock_settings->ffe_post_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_POST_TAP_EN) | + VC4_SET_FIELD(clock_settings->ldmos_bias_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_LDMOS_BIAS_CTL) | + VC4_SET_FIELD(clock_settings->com_mode_ldmos_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_COM_MODE_LDMOS_EN) | + VC4_SET_FIELD(clock_settings->edge_sel, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EDGE_SEL) | + VC4_SET_FIELD(clock_settings->ext_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(clock_settings->term_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_TERM_CTL) | + VC4_SET_FIELD(clock_settings->ext_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_EXT_CURRENT_SRC_EN) | + VC4_SET_FIELD(clock_settings->int_current_src_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_EN) | + VC4_SET_FIELD(clock_settings->int_current_ctl, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_CTL) | + VC4_SET_FIELD(clock_settings->int_current_src_hs_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_INT_CURRENT_SRC_HS_EN) | + VC4_SET_FIELD(clock_settings->main_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_MAIN_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(clock_settings->post_tap_current_select, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_POST_TAP_CURRENT_SELECT) | + VC4_SET_FIELD(clock_settings->slew_ctl_slow_loading, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_LOADING) | + VC4_SET_FIELD(clock_settings->slew_ctl_slow_driving, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_SLEW_CTL_SLOW_DRIVING) | + VC4_SET_FIELD(clock_settings->ffe_pre_tap_en, + VC6_HDMI_TX_PHY_HDMI_CTRL_CHX_FFE_PRE_TAP_EN)); + + if (pixel_freq >=3D 340000000) + word_sel =3D 3; + else + word_sel =3D 0; + HDMI_WRITE(HDMI_TX_PHY_TMDS_CLK_WORD_SEL, word_sel); + + HDMI_WRITE(HDMI_TX_PHY_POWERUP_CTL, + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_BG_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_LDO_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_BIAS_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_CK_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_2_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_1_PWRUP | + VC6_HDMI_TX_PHY_HDMI_POWERUP_CTL_TX_0_PWRUP); + + HDMI_WRITE(HDMI_TX_PHY_PLL_POWERUP_CTL, + VC6_HDMI_TX_PHY_PLL_POWERUP_CTL_PLL_PWRUP); + + HDMI_WRITE(HDMI_TX_PHY_PLL_RESET_CTL, + HDMI_READ(HDMI_TX_PHY_PLL_RESET_CTL) & + ~VC6_HDMI_TX_PHY_PLL_RESET_CTL_PLL_RESETB); + + HDMI_WRITE(HDMI_TX_PHY_PLL_RESET_CTL, + HDMI_READ(HDMI_TX_PHY_PLL_RESET_CTL) | + VC6_HDMI_TX_PHY_PLL_RESET_CTL_PLL_RESETB); + + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); +} + +void vc6_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi) +{ +} diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_= hdmi_regs.h index 68455ce513e7..59bfd69f54d9 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -111,13 +111,30 @@ enum vc4_hdmi_field { HDMI_TX_PHY_CTL_1, HDMI_TX_PHY_CTL_2, HDMI_TX_PHY_CTL_3, + HDMI_TX_PHY_CTL_CK, HDMI_TX_PHY_PLL_CALIBRATION_CONFIG_1, HDMI_TX_PHY_PLL_CALIBRATION_CONFIG_2, HDMI_TX_PHY_PLL_CALIBRATION_CONFIG_4, HDMI_TX_PHY_PLL_CFG, + HDMI_TX_PHY_PLL_CFG_PDIV, HDMI_TX_PHY_PLL_CTL_0, HDMI_TX_PHY_PLL_CTL_1, + HDMI_TX_PHY_PLL_MISC_0, + HDMI_TX_PHY_PLL_MISC_1, + HDMI_TX_PHY_PLL_MISC_2, + HDMI_TX_PHY_PLL_MISC_3, + HDMI_TX_PHY_PLL_MISC_4, + HDMI_TX_PHY_PLL_MISC_5, + HDMI_TX_PHY_PLL_MISC_6, + HDMI_TX_PHY_PLL_MISC_7, + HDMI_TX_PHY_PLL_MISC_8, + HDMI_TX_PHY_PLL_POST_KDIV, + HDMI_TX_PHY_PLL_POWERUP_CTL, + HDMI_TX_PHY_PLL_REFCLK, + HDMI_TX_PHY_PLL_RESET_CTL, + HDMI_TX_PHY_PLL_VCOCLK_DIV, HDMI_TX_PHY_POWERDOWN_CTL, + HDMI_TX_PHY_POWERUP_CTL, HDMI_TX_PHY_RESET_CTL, HDMI_TX_PHY_TMDS_CLK_WORD_SEL, HDMI_VEC_INTERFACE_CFG, @@ -411,6 +428,206 @@ static const struct vc4_hdmi_register __maybe_unused = vc5_hdmi_hdmi1_fields[] =3D { VC5_CSC_REG(HDMI_CSC_CHANNEL_CTL, 0x02c), }; =20 +static const struct vc4_hdmi_register __maybe_unused vc6_hdmi_hdmi0_fields= [] =3D { + VC4_HD_REG(HDMI_DVP_CTL, 0x0000), + VC4_HD_REG(HDMI_MAI_CTL, 0x0010), + VC4_HD_REG(HDMI_MAI_THR, 0x0014), + VC4_HD_REG(HDMI_MAI_FMT, 0x0018), + VC4_HD_REG(HDMI_MAI_DATA, 0x001c), + VC4_HD_REG(HDMI_MAI_SMP, 0x0020), + VC4_HD_REG(HDMI_VID_CTL, 0x0044), + VC4_HD_REG(HDMI_FRAME_COUNT, 0x0060), + + VC4_HDMI_REG(HDMI_FIFO_CTL, 0x07c), + VC4_HDMI_REG(HDMI_AUDIO_PACKET_CONFIG, 0x0c0), + VC4_HDMI_REG(HDMI_RAM_PACKET_CONFIG, 0x0c4), + VC4_HDMI_REG(HDMI_RAM_PACKET_STATUS, 0x0cc), + VC4_HDMI_REG(HDMI_CRP_CFG, 0x0d0), + VC4_HDMI_REG(HDMI_CTS_0, 0x0d4), + VC4_HDMI_REG(HDMI_CTS_1, 0x0d8), + VC4_HDMI_REG(HDMI_SCHEDULER_CONTROL, 0x0e8), + VC4_HDMI_REG(HDMI_HORZA, 0x0ec), + VC4_HDMI_REG(HDMI_HORZB, 0x0f0), + VC4_HDMI_REG(HDMI_VERTA0, 0x0f4), + VC4_HDMI_REG(HDMI_VERTB0, 0x0f8), + VC4_HDMI_REG(HDMI_VERTA1, 0x100), + VC4_HDMI_REG(HDMI_VERTB1, 0x104), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x114), + VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x0a4), + VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a8), + VC4_HDMI_REG(HDMI_FORMAT_DET_1, 0x148), + VC4_HDMI_REG(HDMI_FORMAT_DET_2, 0x14c), + VC4_HDMI_REG(HDMI_FORMAT_DET_3, 0x150), + VC4_HDMI_REG(HDMI_FORMAT_DET_4, 0x158), + VC4_HDMI_REG(HDMI_FORMAT_DET_5, 0x15c), + VC4_HDMI_REG(HDMI_FORMAT_DET_6, 0x160), + VC4_HDMI_REG(HDMI_FORMAT_DET_7, 0x164), + VC4_HDMI_REG(HDMI_FORMAT_DET_8, 0x168), + VC4_HDMI_REG(HDMI_FORMAT_DET_9, 0x16c), + VC4_HDMI_REG(HDMI_FORMAT_DET_10, 0x170), + VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x18c), + VC4_HDMI_REG(HDMI_GCP_CONFIG, 0x194), + VC4_HDMI_REG(HDMI_GCP_WORD_1, 0x198), + VC4_HDMI_REG(HDMI_HOTPLUG, 0x1c8), + VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1e4), + + VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc), + VC5_DVP_REG(HDMI_VEC_INTERFACE_CFG, 0x0f0), + VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f4), + + VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000), + VC5_PHY_REG(HDMI_TX_PHY_POWERUP_CTL, 0x004), + VC5_PHY_REG(HDMI_TX_PHY_CTL_0, 0x008), + VC5_PHY_REG(HDMI_TX_PHY_CTL_1, 0x00c), + VC5_PHY_REG(HDMI_TX_PHY_CTL_2, 0x010), + VC5_PHY_REG(HDMI_TX_PHY_CTL_CK, 0x014), + VC5_PHY_REG(HDMI_TX_PHY_PLL_REFCLK, 0x01c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_POST_KDIV, 0x028), + VC5_PHY_REG(HDMI_TX_PHY_PLL_VCOCLK_DIV, 0x02c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_CFG, 0x044), + VC5_PHY_REG(HDMI_TX_PHY_TMDS_CLK_WORD_SEL, 0x054), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_0, 0x060), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_1, 0x064), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_2, 0x068), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_3, 0x06c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_4, 0x070), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_5, 0x074), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_6, 0x078), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_7, 0x07c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_8, 0x080), + VC5_PHY_REG(HDMI_TX_PHY_PLL_RESET_CTL, 0x190), + VC5_PHY_REG(HDMI_TX_PHY_PLL_POWERUP_CTL, 0x194), + + VC5_RM_REG(HDMI_RM_CONTROL, 0x000), + VC5_RM_REG(HDMI_RM_OFFSET, 0x018), + VC5_RM_REG(HDMI_RM_FORMAT, 0x01c), + + VC5_RAM_REG(HDMI_RAM_PACKET_START, 0x000), + + VC5_CEC_REG(HDMI_CEC_CNTRL_1, 0x010), + VC5_CEC_REG(HDMI_CEC_CNTRL_2, 0x014), + VC5_CEC_REG(HDMI_CEC_CNTRL_3, 0x018), + VC5_CEC_REG(HDMI_CEC_CNTRL_4, 0x01c), + VC5_CEC_REG(HDMI_CEC_CNTRL_5, 0x020), + VC5_CEC_REG(HDMI_CEC_TX_DATA_1, 0x028), + VC5_CEC_REG(HDMI_CEC_TX_DATA_2, 0x02c), + VC5_CEC_REG(HDMI_CEC_TX_DATA_3, 0x030), + VC5_CEC_REG(HDMI_CEC_TX_DATA_4, 0x034), + VC5_CEC_REG(HDMI_CEC_RX_DATA_1, 0x038), + VC5_CEC_REG(HDMI_CEC_RX_DATA_2, 0x03c), + VC5_CEC_REG(HDMI_CEC_RX_DATA_3, 0x040), + VC5_CEC_REG(HDMI_CEC_RX_DATA_4, 0x044), + + VC5_CSC_REG(HDMI_CSC_CTL, 0x000), + VC5_CSC_REG(HDMI_CSC_12_11, 0x004), + VC5_CSC_REG(HDMI_CSC_14_13, 0x008), + VC5_CSC_REG(HDMI_CSC_22_21, 0x00c), + VC5_CSC_REG(HDMI_CSC_24_23, 0x010), + VC5_CSC_REG(HDMI_CSC_32_31, 0x014), + VC5_CSC_REG(HDMI_CSC_34_33, 0x018), + VC5_CSC_REG(HDMI_CSC_CHANNEL_CTL, 0x02c), +}; + +static const struct vc4_hdmi_register __maybe_unused vc6_hdmi_hdmi1_fields= [] =3D { + VC4_HD_REG(HDMI_DVP_CTL, 0x0000), + VC4_HD_REG(HDMI_MAI_CTL, 0x0030), + VC4_HD_REG(HDMI_MAI_THR, 0x0034), + VC4_HD_REG(HDMI_MAI_FMT, 0x0038), + VC4_HD_REG(HDMI_MAI_DATA, 0x003c), + VC4_HD_REG(HDMI_MAI_SMP, 0x0040), + VC4_HD_REG(HDMI_VID_CTL, 0x0048), + VC4_HD_REG(HDMI_FRAME_COUNT, 0x0064), + + VC4_HDMI_REG(HDMI_FIFO_CTL, 0x07c), + VC4_HDMI_REG(HDMI_AUDIO_PACKET_CONFIG, 0x0c0), + VC4_HDMI_REG(HDMI_RAM_PACKET_CONFIG, 0x0c4), + VC4_HDMI_REG(HDMI_RAM_PACKET_STATUS, 0x0cc), + VC4_HDMI_REG(HDMI_CRP_CFG, 0x0d0), + VC4_HDMI_REG(HDMI_CTS_0, 0x0d4), + VC4_HDMI_REG(HDMI_CTS_1, 0x0d8), + VC4_HDMI_REG(HDMI_SCHEDULER_CONTROL, 0x0e8), + VC4_HDMI_REG(HDMI_HORZA, 0x0ec), + VC4_HDMI_REG(HDMI_HORZB, 0x0f0), + VC4_HDMI_REG(HDMI_VERTA0, 0x0f4), + VC4_HDMI_REG(HDMI_VERTB0, 0x0f8), + VC4_HDMI_REG(HDMI_VERTA1, 0x100), + VC4_HDMI_REG(HDMI_VERTB1, 0x104), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x114), + VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x0a4), + VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a8), + VC4_HDMI_REG(HDMI_FORMAT_DET_1, 0x148), + VC4_HDMI_REG(HDMI_FORMAT_DET_2, 0x14c), + VC4_HDMI_REG(HDMI_FORMAT_DET_3, 0x150), + VC4_HDMI_REG(HDMI_FORMAT_DET_4, 0x158), + VC4_HDMI_REG(HDMI_FORMAT_DET_5, 0x15c), + VC4_HDMI_REG(HDMI_FORMAT_DET_6, 0x160), + VC4_HDMI_REG(HDMI_FORMAT_DET_7, 0x164), + VC4_HDMI_REG(HDMI_FORMAT_DET_8, 0x168), + VC4_HDMI_REG(HDMI_FORMAT_DET_9, 0x16c), + VC4_HDMI_REG(HDMI_FORMAT_DET_10, 0x170), + VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x18c), + VC4_HDMI_REG(HDMI_GCP_CONFIG, 0x194), + VC4_HDMI_REG(HDMI_GCP_WORD_1, 0x198), + VC4_HDMI_REG(HDMI_HOTPLUG, 0x1c8), + VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1e4), + + VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc), + VC5_DVP_REG(HDMI_VEC_INTERFACE_CFG, 0x0f0), + VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f4), + + VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000), + VC5_PHY_REG(HDMI_TX_PHY_POWERUP_CTL, 0x004), + VC5_PHY_REG(HDMI_TX_PHY_CTL_0, 0x008), + VC5_PHY_REG(HDMI_TX_PHY_CTL_1, 0x00c), + VC5_PHY_REG(HDMI_TX_PHY_CTL_2, 0x010), + VC5_PHY_REG(HDMI_TX_PHY_CTL_CK, 0x014), + VC5_PHY_REG(HDMI_TX_PHY_PLL_REFCLK, 0x01c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_POST_KDIV, 0x028), + VC5_PHY_REG(HDMI_TX_PHY_PLL_VCOCLK_DIV, 0x02c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_CFG, 0x044), + VC5_PHY_REG(HDMI_TX_PHY_TMDS_CLK_WORD_SEL, 0x054), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_0, 0x060), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_1, 0x064), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_2, 0x068), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_3, 0x06c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_4, 0x070), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_5, 0x074), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_6, 0x078), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_7, 0x07c), + VC5_PHY_REG(HDMI_TX_PHY_PLL_MISC_8, 0x080), + VC5_PHY_REG(HDMI_TX_PHY_PLL_RESET_CTL, 0x190), + VC5_PHY_REG(HDMI_TX_PHY_PLL_POWERUP_CTL, 0x194), + + VC5_RM_REG(HDMI_RM_CONTROL, 0x000), + VC5_RM_REG(HDMI_RM_OFFSET, 0x018), + VC5_RM_REG(HDMI_RM_FORMAT, 0x01c), + + VC5_RAM_REG(HDMI_RAM_PACKET_START, 0x000), + + VC5_CEC_REG(HDMI_CEC_CNTRL_1, 0x010), + VC5_CEC_REG(HDMI_CEC_CNTRL_2, 0x014), + VC5_CEC_REG(HDMI_CEC_CNTRL_3, 0x018), + VC5_CEC_REG(HDMI_CEC_CNTRL_4, 0x01c), + VC5_CEC_REG(HDMI_CEC_CNTRL_5, 0x020), + VC5_CEC_REG(HDMI_CEC_TX_DATA_1, 0x028), + VC5_CEC_REG(HDMI_CEC_TX_DATA_2, 0x02c), + VC5_CEC_REG(HDMI_CEC_TX_DATA_3, 0x030), + VC5_CEC_REG(HDMI_CEC_TX_DATA_4, 0x034), + VC5_CEC_REG(HDMI_CEC_RX_DATA_1, 0x038), + VC5_CEC_REG(HDMI_CEC_RX_DATA_2, 0x03c), + VC5_CEC_REG(HDMI_CEC_RX_DATA_3, 0x040), + VC5_CEC_REG(HDMI_CEC_RX_DATA_4, 0x044), + + VC5_CSC_REG(HDMI_CSC_CTL, 0x000), + VC5_CSC_REG(HDMI_CSC_12_11, 0x004), + VC5_CSC_REG(HDMI_CSC_14_13, 0x008), + VC5_CSC_REG(HDMI_CSC_22_21, 0x00c), + VC5_CSC_REG(HDMI_CSC_24_23, 0x010), + VC5_CSC_REG(HDMI_CSC_32_31, 0x014), + VC5_CSC_REG(HDMI_CSC_34_33, 0x018), + VC5_CSC_REG(HDMI_CSC_CHANNEL_CTL, 0x02c), +}; + static inline void __iomem *__vc4_hdmi_get_field_base(struct vc4_hdmi *hdmi, enum vc4_hdmi_regs reg) --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 22490224DA8 for ; Fri, 25 Oct 2024 17:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876582; cv=none; b=NrqaIx6uKbjyackaOwvImNR1EWtxhCe/WZVAuXA2v+b6XwXq/QmbXU9WvOaCEUGVtCFufZixh/NrG6gQBo8VYbc4tkkIl14Z0sKAY1eE4+gm6BGAY4NiVr01Fo53rZGQNoYyLghLnW0aIhES+fb4jZXuAjxIIdiUPVyZ0ZP2+PY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876582; c=relaxed/simple; bh=WV/UFQyvWXojwAqHvOtHxgMXrfRl7lw3BEm8g+qz5Yo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tNCjxiXnFJ+SFkE6uqyW3ibvKZAt2bBL4c/k8Bi6Jz+FdTcin4me713BtxAnUgazxC42jjL4ntXx+ni43sV3ikxsdX9vEeluxdZMvdi0LmieVYUO8QH3wrzmCNYrP9/iMR/c+DbFAnV0lhNCI8V6bfO6ch+w0/FLUNFzUaaOAz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=f9CD0WTz; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="f9CD0WTz" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d58377339so1728738f8f.1 for ; Fri, 25 Oct 2024 10:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876575; x=1730481375; 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=xZSl/F4a59d6cGzaQ8UBGb7tAkWNLG3z9Ozwy3jDhoY=; b=f9CD0WTzvGO49lrQw333IymYW+nanWfJp+vvAhUi9bwAfgrFeG1nrBUEkak7l1HBK4 MGojIt1LP2vIGUR2E1UwIYCbHLgKXxH/XZSsmdMIC3ITeuIDMie6m++59oac7Fy9km0L 1y3wTGGvwja9cdfmp+ORo2dMIcARj0uAmHO0zlI/6O6TisopvwEOs6GcVJijmybHa+9T bl4Y4u+zW/LQrurvUZcrMgHW14TAZRacfQ9tRsvi4GDBmmTdXCqvQNO5VzSy+WZ5uWz8 k2PeiWktYT4PlFBIcgcm27kB8e1aNjn1gykRFhVlKl3I+5BMV0E4QRCein+xtlCvz1gf OCvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876575; x=1730481375; 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=xZSl/F4a59d6cGzaQ8UBGb7tAkWNLG3z9Ozwy3jDhoY=; b=pRq67gmnsA7sTxn/t7LTqz9hAH6fdg+ZHouKLaRG2bK2+OmEKfVqykrmLHBdwhG1lZ Ifbhj+aSYTElCbFh6BYVMdOoJCWC4u1sapOlrMBBue+59QfNPJh8g/aSljmSDhqEeNUU oqaoUbWoFVl4/MIpsT7fyQi5ApQ3gX6q2VFiGKpcMIzk1Y5ZOMkM/XzZvxhCCGDZ0UdM SX3XsmqhUjO4r6fda6f+tSOaUIQhRn5R2+FK4z4TH+YBWkFq7qlVziI0wI4DwKe2chqs c1e5+rr1eAEKNCLyh5Rtp+wIFYrXmHv0sQzmm62QdHzVQ7q7nHIPwTNzOxZQkqga6so3 luqA== X-Forwarded-Encrypted: i=1; AJvYcCXtOBgL74K40tahj9CssLX4C4anYEJkFTEMyWz6I3GYa6SOUEuDZft/8LfWgAl+wYdpcKDkiIo4DJ5+un4=@vger.kernel.org X-Gm-Message-State: AOJu0YzwDhadl2KkrLZChYpMwzMN7xEN6nl3aEsaGPLN6H5+UDH5CEGT /hvqG+2EmaJfXgqTj+BJaiYgUZzCAsdcR0GlImnrQAdNzohWyTqpkux3Z3EBnjk= X-Google-Smtp-Source: AGHT+IGYCJwSrz9ld715UfDoH5XKNaydjNgYU5P9irKdws9FIn39XqxjXFv+TI0I/O8NtYhIy9aKqg== X-Received: by 2002:adf:f850:0:b0:37e:d2b8:883a with SMTP id ffacd0b85a97d-380611409c4mr151148f8f.12.1729876574029; Fri, 25 Oct 2024 10:16:14 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:13 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:44 +0100 Subject: [PATCH v2 13/36] drm/vc4: txp: Introduce structure to deal with revision differences Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-13-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 will have several TXP with small differences. Let's add a structure tied to the compatible to deal with those differences. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/tests/vc4_mock.c | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.h | 6 +++++- drivers/gpu/drm/vc4/vc4_txp.c | 23 ++++++++++++++++------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tes= ts/vc4_mock.c index 6527fb1db71e..c7b91c87f1bc 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -51,7 +51,7 @@ struct vc4_mock_desc { =20 static const struct vc4_mock_desc vc4_mock =3D VC4_MOCK_DESC( - VC4_MOCK_CRTC_DESC(&vc4_txp_crtc_data, + VC4_MOCK_CRTC_DESC(&vc4_txp_data.base, VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), @@ -77,7 +77,7 @@ static const struct vc4_mock_desc vc4_mock =3D =20 static const struct vc4_mock_desc vc5_mock =3D VC4_MOCK_DESC( - VC4_MOCK_CRTC_DESC(&vc4_txp_crtc_data, + VC4_MOCK_CRTC_DESC(&vc4_txp_data.base, VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index a68cea921c11..1ed1fb5aa7e8 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -536,7 +536,11 @@ struct vc4_crtc_data { int hvs_output; }; =20 -extern const struct vc4_crtc_data vc4_txp_crtc_data; +struct vc4_txp_data { + struct vc4_crtc_data base; +}; + +extern const struct vc4_txp_data vc4_txp_data; =20 struct vc4_pv_data { struct vc4_crtc_data base; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index ffe1f7d1b911..dcb1b3fd37de 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -159,6 +159,7 @@ =20 struct vc4_txp { struct vc4_crtc base; + const struct vc4_txp_data *data; =20 struct platform_device *pdev; =20 @@ -484,17 +485,20 @@ static irqreturn_t vc4_txp_interrupt(int irq, void *d= ata) return IRQ_HANDLED; } =20 -const struct vc4_crtc_data vc4_txp_crtc_data =3D { - .name =3D "txp", - .debugfs_name =3D "txp_regs", - .hvs_available_channels =3D BIT(2), - .hvs_output =3D 2, +const struct vc4_txp_data vc4_txp_data =3D { + .base =3D { + .name =3D "txp", + .debugfs_name =3D "txp_regs", + .hvs_available_channels =3D BIT(2), + .hvs_output =3D 2, + }, }; =20 static int vc4_txp_bind(struct device *dev, struct device *master, void *d= ata) { struct platform_device *pdev =3D to_platform_device(dev); struct drm_device *drm =3D dev_get_drvdata(master); + const struct vc4_txp_data *txp_data; struct vc4_encoder *vc4_encoder; struct drm_encoder *encoder; struct vc4_crtc *vc4_crtc; @@ -509,6 +513,11 @@ static int vc4_txp_bind(struct device *dev, struct dev= ice *master, void *data) if (!txp) return -ENOMEM; =20 + txp_data =3D of_device_get_match_data(dev); + if (!txp_data) + return -ENODEV; + + txp->data =3D txp_data; txp->pdev =3D pdev; txp->regs =3D vc4_ioremap_regs(pdev, 0); if (IS_ERR(txp->regs)) @@ -519,7 +528,7 @@ static int vc4_txp_bind(struct device *dev, struct devi= ce *master, void *data) vc4_crtc->regset.regs =3D txp_regs; vc4_crtc->regset.nregs =3D ARRAY_SIZE(txp_regs); =20 - ret =3D vc4_crtc_init(drm, pdev, vc4_crtc, &vc4_txp_crtc_data, + ret =3D vc4_crtc_init(drm, pdev, vc4_crtc, &txp_data->base, &vc4_txp_crtc_funcs, &vc4_txp_crtc_helper_funcs, true); if (ret) return ret; @@ -579,7 +588,7 @@ static void vc4_txp_remove(struct platform_device *pdev) } =20 static const struct of_device_id vc4_txp_dt_match[] =3D { - { .compatible =3D "brcm,bcm2835-txp" }, + { .compatible =3D "brcm,bcm2835-txp", .data =3D &vc4_txp_data }, { /* sentinel */ }, }; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 940C5224D9A for ; Fri, 25 Oct 2024 17:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876579; cv=none; b=DNMah+nJ8U2SPzASJh1IOa7nS1+8VTXWaj0zZ4y34HqAG+lp1apZOLLNCmPYTWVvseSu+lG3rsbdlHMINM7x4gTKBho1PFbhiIzgLM9BGL5c2QwHMRa2jqgXGhlSTykJcR9iiPog+l4PSpqlZxBEHPO2ytkl8tdVov2vGbbBR6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876579; c=relaxed/simple; bh=HzQCBtQCnxLWR4MqnTAho9PePXTWdc9dHx/+VUH7KOw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Do/zHk6xbBozNKIxPeq4nAQYPCTUcKuMogynGGdNHgb1sVCyMwtDOP9XRqtY5laSse+TqxO1sNcJqklgQk3rHy7ktL0IYinnx+S0Nga2wWD7aPtaHpNqj5LtS4l890vgBpFkVkwgQ8oiTwB3rCp1B9I2XVfLPgipBaWXl7qaORg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=eA++Rmc9; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="eA++Rmc9" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37f52925fc8so1553000f8f.1 for ; Fri, 25 Oct 2024 10:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876575; x=1730481375; 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=7dnZzxFDSzNZ2XOSUDTFMzhrUG7dVfBzR4nm1WX8rOk=; b=eA++Rmc9Cr3PuXdV9NRYMWMpBZZu2OmYUoUBTEQa0PdVJlEsCHA0K83L4KG+qmHIfH rcsDAkMczlZu6aCcVt2Tv3kZj3ytGuf5BHbF1aWP/XM8o3ivHy1iNGyIz3KtWEvgPQTv mG3idPc2FthMP20xMHPKZCRG9Xm26kvb6lU4r+3Q1X7wprW8oyhmuxRCgaTHqYUzIhrg VqMOnsjrtgm/thShwrBSU4UAez63PclHm26SbsJG0WCdiUVHYTu8mMxaAxFdp+uS660Y qhio0RWopb22W2XewFUsOY9qAZ2IZ4p7ef3wFl+OgBLDr7RK2ptlkQTehvt/nmVPZa5X 2lCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876575; x=1730481375; 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=7dnZzxFDSzNZ2XOSUDTFMzhrUG7dVfBzR4nm1WX8rOk=; b=TWjXeEgaWMwZ9+vCDT0YL6jP5BgYHgmxwOH7dTpreQxAms4dQeHb1Gnb92fl4ujDCS CfITsf3+khx9jcuYK9V3NmPIeypCUD3pC5I01sTphb/wOhhO9Ec5PVo+lGkIlctX43MJ JGd++b2MM/cANNELiLs8gqau5kORkrWpsWE4pLcizSdZ8+udXAYH4IwsTEXQGFJwv1qp SJFqwsp3Z2599oY8x9z3V7/kD8r6P7KQHDnk56CnNV/6GgFuz0cpERimwwU5vVjjFc3L iFOcIPcAgFY84cim9HzmoC4aYOaXYhUQoZleapp0erQLJ7f1HbcSiQnbGRYBb0lAb5Id xCzw== X-Forwarded-Encrypted: i=1; AJvYcCW3On9r8hpjlYZNuy0qLN+A0B2FNxeds8IVBFpsxgXarNgMevCvNoZ0L86ZywwHw6sxQcz2X2sAxqtWKp8=@vger.kernel.org X-Gm-Message-State: AOJu0YzUKTsmQxUIesqerh3k2tZ4z1xb0iul3ANRyI1U6cYjCf5flkq4 SC0hFSjBJFt/rR8fIFBk1bT9csAtAvkR/zMxfw5OwB8ZxZbjMRe3+VdxtmiVkTs= X-Google-Smtp-Source: AGHT+IFDbWZLs/VvibvWZkwt87XWxzo90576NNCfQK9i5q2/H1vvN4cuvfjgITpZV+qwWj/4uAridw== X-Received: by 2002:a5d:43c7:0:b0:37d:32ba:ee76 with SMTP id ffacd0b85a97d-3806120db6amr90981f8f.57.1729876574913; Fri, 25 Oct 2024 10:16:14 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:14 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:45 +0100 Subject: [PATCH v2 14/36] drm/vc4: txp: Rename TXP data structure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-14-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The TXP data structure has a name too generic for the multiple variants we'll have to support. Let's rename it to mention the SoC it applies to. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/tests/vc4_mock.c | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- drivers/gpu/drm/vc4/vc4_txp.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tes= ts/vc4_mock.c index c7b91c87f1bc..372482fcd6c7 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -51,7 +51,7 @@ struct vc4_mock_desc { =20 static const struct vc4_mock_desc vc4_mock =3D VC4_MOCK_DESC( - VC4_MOCK_CRTC_DESC(&vc4_txp_data.base, + VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base, VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), @@ -77,7 +77,7 @@ static const struct vc4_mock_desc vc4_mock =3D =20 static const struct vc4_mock_desc vc5_mock =3D VC4_MOCK_DESC( - VC4_MOCK_CRTC_DESC(&vc4_txp_data.base, + VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base, VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 1ed1fb5aa7e8..e08c90245f94 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -540,7 +540,7 @@ struct vc4_txp_data { struct vc4_crtc_data base; }; =20 -extern const struct vc4_txp_data vc4_txp_data; +extern const struct vc4_txp_data bcm2835_txp_data; =20 struct vc4_pv_data { struct vc4_crtc_data base; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index dcb1b3fd37de..6fe378b454ca 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -485,7 +485,7 @@ static irqreturn_t vc4_txp_interrupt(int irq, void *dat= a) return IRQ_HANDLED; } =20 -const struct vc4_txp_data vc4_txp_data =3D { +const struct vc4_txp_data bcm2835_txp_data =3D { .base =3D { .name =3D "txp", .debugfs_name =3D "txp_regs", @@ -588,7 +588,7 @@ static void vc4_txp_remove(struct platform_device *pdev) } =20 static const struct of_device_id vc4_txp_dt_match[] =3D { - { .compatible =3D "brcm,bcm2835-txp", .data =3D &vc4_txp_data }, + { .compatible =3D "brcm,bcm2835-txp", .data =3D &bcm2835_txp_data }, { /* sentinel */ }, }; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 A2E52224DB0 for ; Fri, 25 Oct 2024 17:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876580; cv=none; b=UKNffLrQY8UR3lGlGeVvw064muG9rMMTzgJWwCoEIpTXaHxv49JM7Ho/kYYGqI4A3fuGCyOMCxTZQ/hdgcS7NbjnzTJeGU5e/sLdAXK8fu8DpXaBM0ePwNpsrOyBwibsIqzdWgMiVWIJSApLFaTyL366Sbq6i0uW64MFo96E5kM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876580; c=relaxed/simple; bh=UWJvMv3Z0a1PpjzyOCbjoPTg3oDPbd1fp/cxOBSwg9c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NNr3L1WPhoPwveebtI1CDa42r1+2lXf1kp4CjJ3/kRuUVN9WxwmNVT+lbswlyDudcKfNwiRRqmWTz/sctK1E9UB7GrEkCqUzXS4CPZKsGQCvSXjypmlEj0c30ArKZ0TFSBTB9x4R772khQTOrvneisEUFkXZkyK0anYbz43ZOiI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=ttlZGNZV; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ttlZGNZV" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43158625112so22707395e9.3 for ; Fri, 25 Oct 2024 10:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876576; x=1730481376; 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=QATmMbNk3c4g4hXx1UR19WiwFTrUbM+WoGxURwc9BNY=; b=ttlZGNZVB0Ams2NBquHqNmmwhH2GPS2xxMSvClEwatkCAy98C8hAa9vgvRVCQof+fW kblThihRuEMi4SiKp6jeboYyp5rAA7TXXBgw4YJp4r0dtq6GJe2uRZvpumiiH+1PoaFX cnMExDFQj7OHPDdhVKPeA/nGKLJXHXtznyhBgMw6eSDsg4LLS3kmhYOoW4SKfU4j1rkV slAZNqP1IgMXmh/NHPa/2ndn6LMRyUbBe6W4LomXg1ErtX2bPvWa1dz2kJ7oWUSlYjOF OlfrqdujKiZ5xbSjAgPRiY0gj72f2eKFqx4LyxQVaxU6pUcltNKM2H5QUAj5/N4kU839 pmeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876576; x=1730481376; 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=QATmMbNk3c4g4hXx1UR19WiwFTrUbM+WoGxURwc9BNY=; b=ZjHSec+JbJpJ4I1UZFZC6K4DtR4AokmIR/ry1eduLlPh3CduAObySQN3Pr4kROwLYE Ri9OeILg3j3ExYBQ6PvzPHrF6nsDtdr7GEbAwBen4BUmt8fK92ynIH2L1Pq1s1vlc159 9lV4ZCR1MIDcsacggoNKDCZtYBVwVMqeB5LV+sz3+KKVRTR8Td6Zb/ZO7euT466P49Bc ofsORtMqYi7f+VczVHGVYfYdwgZm02U/cDVoilGGfiEDJm/0yRAUXnW+igQyIFfmGDCq JnudDCYb4i8mljfrdhVzn4HNfXYMDn0FciaTswWGJgO2Ds99czNXEqohyagCTwDxFc0o KhcQ== X-Forwarded-Encrypted: i=1; AJvYcCVp1SPFkyaZMw6WzV940hfboyVvnnCUeKDDTF9E0giC7zRdVQaCpopIbOXuQeyttevnaqjktk4JmC2D5Mc=@vger.kernel.org X-Gm-Message-State: AOJu0YwpXV/QUzOdsj1+9+xlO8b0zLtQ5HVi2pmQ6f84dHoi58IHnpIS MUEFfwncXFfWxKmdEXv4fxPGa/cFUgQ6HS0+Ji0BAYZxcnpjNYBQU3S31KDKTgA= X-Google-Smtp-Source: AGHT+IE/VfikFrZHBGY91VEfdMxjOv4Me9kCVd0mDGc13MQEknYwxLSPdeWAl2uAqA6slK2aB7I+ww== X-Received: by 2002:adf:fa83:0:b0:37c:d299:b5f0 with SMTP id ffacd0b85a97d-3806120c614mr82922f8f.59.1729876575760; Fri, 25 Oct 2024 10:16:15 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:15 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:46 +0100 Subject: [PATCH v2 15/36] drm/vc4: txp: Add byte enable toggle bit Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-15-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The MOPLET doesn't have the BYTE_ENABLE field to set, but the TXP and MOP do, so let's add a boolean to control whether or not we need to set it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_txp.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index e08c90245f94..27deb4cde02d 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -538,6 +538,7 @@ struct vc4_crtc_data { =20 struct vc4_txp_data { struct vc4_crtc_data base; + unsigned int has_byte_enable:1; }; =20 extern const struct vc4_txp_data bcm2835_txp_data; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index 6fe378b454ca..eaf30b2cfb5b 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -287,6 +287,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_= connector *conn, struct drm_connector_state *conn_state =3D drm_atomic_get_new_connector_s= tate(state, conn); struct vc4_txp *txp =3D connector_to_vc4_txp(conn); + const struct vc4_txp_data *txp_data =3D txp->data; struct drm_gem_dma_object *gem; struct drm_display_mode *mode; struct drm_framebuffer *fb; @@ -309,9 +310,11 @@ static void vc4_txp_connector_atomic_commit(struct drm= _connector *conn, return; =20 ctrl =3D TXP_GO | TXP_EI | - VC4_SET_FIELD(0xf, TXP_BYTE_ENABLE) | VC4_SET_FIELD(txp_fmts[i], TXP_FORMAT); =20 + if (txp_data->has_byte_enable) + ctrl |=3D VC4_SET_FIELD(0xf, TXP_BYTE_ENABLE); + if (fb->format->has_alpha) ctrl |=3D TXP_ALPHA_ENABLE; else @@ -492,6 +495,7 @@ const struct vc4_txp_data bcm2835_txp_data =3D { .hvs_available_channels =3D BIT(2), .hvs_output =3D 2, }, + .has_byte_enable =3D true, }; =20 static int vc4_txp_bind(struct device *dev, struct device *master, void *d= ata) --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 90049224DBA for ; Fri, 25 Oct 2024 17:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876581; cv=none; b=Mtdhk2M+7eSxsfFZ1m4HPLg+V6R/9DmBO8eaNyoM50Em372gLii2IC/SpJ/4hA9Wduc9V+bNNFkKNZonh2CEdci98rHTTL77D7FEgyGRAyIwm9F6gxldNZ1DtAitwMZNzztbhfQAq1HC+i+2LEAiC151gJF9TIvmNIoIeCPBC4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876581; c=relaxed/simple; bh=1hF1PhNYP2/A1x5AcjvXgQw18E7kHCNzlJ5ort+1kbE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ik7h9zlmMWtVRsEvRVGDdW+r7OX101Jt1MNWNMhS9dq5WS/ijBzfzrnxsbbKzUFJW3ZCFTPgQP5XUNTQSD8u8d8U54PPriMdyyJxtElGf0PUyhF9TkBwx1xvGh1KAG9rcUrcODIdFexeLXkurWw886W9hQByIrEEzEtvwfpHGu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=flgudHfK; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="flgudHfK" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d473c4bb6so1934805f8f.3 for ; Fri, 25 Oct 2024 10:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876577; x=1730481377; 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=AjLOa+CYvpz+BpNsMyaYFjyUkwYrQkclw8bv+vdgZA4=; b=flgudHfKR+/M1jPSRe9pxlsWsmYIHK9Qf352b48S9UIHZ67usBxD52NYz0YAU1Apaz wlOuaz3yKQoxgD1pO8zMGMJX4gy+2OxYQR4WgEQ3vQ/EUnlfdZAxduoAaH+kZfSQRHMs Kk+7rJ9UyFaQi1aM3MDL7t2SC+JMCYikqKtrjgddNAsQCbdPBvKYMfZwvdLSly0PQ/6o GdtpdloyLwiMpT1ek33V1fE293BYgAuvMp+Dxfcb/BAGIVqZzO5Q14aci+vMQe8UaJeF +ifHvfK/aJppPM+JULtjRxSlExUvZ5rwqLP1qtDveEyZXfECl5S5BWiyNmHr19vNlypp jkfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876577; x=1730481377; 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=AjLOa+CYvpz+BpNsMyaYFjyUkwYrQkclw8bv+vdgZA4=; b=eK5Zz4oRfqsbxl0mYp7GIQorgq/L0lWPEopnyXSI/yA3nGmRM2QYw6A57JF1Drq+++ pSoSg/Js+qAuNlq8zbAN5U1RsKdlfkBPFoU72ZCgqPUe9NX6c5tBs3vLhbqehKfpahPv VaQef1l5+7cwamMczDOIK8TjQVTsmbxsnN6EQQpqtdRcIDwiRK8YQZP3HDthSWLKfXcT pdnzgKhsrh6vxUHWos1fBSRFggIaOOk1UbGyZSQ6vcrI7uD2jvlW7zxppDKR8lJJZlrg E8IBx3btXJvgFspUThhZ7c5RAZdz8+uHQAirPyMsSHZp9lMNnOH9jpF76SwbIBPKqfIr 3xeQ== X-Forwarded-Encrypted: i=1; AJvYcCUchxJnF2dNryUaij3lGcy7NQn9jmAKL7VLNJwc4WfxBtjBrS09zc2b238Bc7Pzp+hWUAqYWF+MdnFWhzc=@vger.kernel.org X-Gm-Message-State: AOJu0YwSHUCVB4Ee5FMfs/p2Z2SqLPaqfwubGq0CHSXB+isOn1z4XpA2 0v4nWw4GyLPId/u5564wMnxuRqUstYSgtdfC9Trzqt8SNvaRBrqsAmH1pQ1/u0c= X-Google-Smtp-Source: AGHT+IGP9nRcQ2kzvdL+ddPuHATxPAjofcN1yD5KA+iaTZo+WrIoFCmEwqLiAauQ9eDZll9Qzpuj9A== X-Received: by 2002:a5d:444f:0:b0:37c:c832:cf95 with SMTP id ffacd0b85a97d-3806123eecfmr110629f8f.50.1729876576741; Fri, 25 Oct 2024 10:16:16 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:16 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:47 +0100 Subject: [PATCH v2 16/36] drm/vc4: txp: Add horizontal and vertical size offset toggle bit Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-16-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The new writeback controllers that can be found on the BCM2712 require to have their horizontal and vertical size reduced by one. Let's tie that behaviour to the compatible so we can support both the new and old controllers. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_txp.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 27deb4cde02d..984fddae0048 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -539,6 +539,7 @@ struct vc4_crtc_data { struct vc4_txp_data { struct vc4_crtc_data base; unsigned int has_byte_enable:1; + unsigned int size_minus_one:1; }; =20 extern const struct vc4_txp_data bcm2835_txp_data; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index eaf30b2cfb5b..d2ee872e9c0b 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -291,6 +291,8 @@ static void vc4_txp_connector_atomic_commit(struct drm_= connector *conn, struct drm_gem_dma_object *gem; struct drm_display_mode *mode; struct drm_framebuffer *fb; + unsigned int hdisplay; + unsigned int vdisplay; u32 ctrl; int idx; int i; @@ -330,9 +332,17 @@ static void vc4_txp_connector_atomic_commit(struct drm= _connector *conn, gem =3D drm_fb_dma_get_gem_obj(fb, 0); TXP_WRITE(TXP_DST_PTR, gem->dma_addr + fb->offsets[0]); TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]); + + hdisplay =3D mode->hdisplay ?: 1; + vdisplay =3D mode->vdisplay ?: 1; + if (txp_data->size_minus_one) { + hdisplay -=3D 1; + vdisplay -=3D 1; + } + TXP_WRITE(TXP_DIM, - VC4_SET_FIELD(mode->hdisplay, TXP_WIDTH) | - VC4_SET_FIELD(mode->vdisplay, TXP_HEIGHT)); + VC4_SET_FIELD(hdisplay, TXP_WIDTH) | + VC4_SET_FIELD(vdisplay, TXP_HEIGHT)); =20 TXP_WRITE(TXP_DST_CTRL, ctrl); =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 33DF7215C60 for ; Fri, 25 Oct 2024 17:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876584; cv=none; b=gxsnnAH5//W1fpqpNTVgL8DLu4kzl4M5pdiNih+GLNPkmvgvFDNZIuRa8pXdeRStr1Mn87hGGokJb8RJT7/8aOlPJcfvhdSk7VPKc1d4os3NCv7+lUU0DXOWtSxWGnW3YbvLDR8962UbSdr6/UskhAypGWQ0slyluJai2nZA5zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876584; c=relaxed/simple; bh=6/0MGSFMLpItvDKAiuH9HB3iIfeafKjYJItOtt2uxf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dpdLZMavDbnvwh7SJFqItbCiMY1ckfX4xcFuDxwlNagEpis8ELESINrqIfAlclBQw8AbHagXo10jMe2y3TqiXpGAe1vCa5tG1f1dlgkGKldz6EZX1LszAQf5CXdheOLlioHa9SAZ0OO1EhcI94tYrdiG0RKJET06wlPyAQr3jV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=e95752CD; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="e95752CD" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-539e13375d3so2780566e87.3 for ; Fri, 25 Oct 2024 10:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876578; x=1730481378; 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=HAmGnbsXlsT4wTydGcek4ZEoMBRAPW62Dt7gooaokpo=; b=e95752CDNGOsjvXHH83FuVLfyhDlT0zRrA3oYZ/qC3GgiuH4GgBuP88l/+9Icy2A5N EsZTER09kHoZuQT2vVcBlr6ny1ZNF4blk/lRcj1LnY7ees+2BoZ4uPdrB1zAFlH6Pww6 W6pNo0lfZViK1puGq94aw4hSqsfgJeSuZy8QVEC2/ENGZ5OvYxK3roOs+cEq4jVcf33M 5XactLso+8tAdCWBxB5KrToCXrOmyVAOpILlekTuDzEVY03U/CK+4M3m3Pt+uRU4aXO2 HHhSli1I/sGvxOU5tTaDeVLwFjuAAqO+DVwRYKEju48WIFUnX58KZAAhvbW/pffeNlJ/ YlSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876578; x=1730481378; 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=HAmGnbsXlsT4wTydGcek4ZEoMBRAPW62Dt7gooaokpo=; b=WXdtcAN91gQ9nGuj79NMof0liFMgZhU7Nb4njixc1mTebcxqF/g5CZ4thqP4lZPxMy 5n4DeuncA3UfSTtQll3Yr/3i+BNiIZYFGJ3ZKULsePZzev25Nd59xDzbQa3RU9Ui8QJk W88mp2Gz35AvgkWT/R0zcwjEqdYNQdQ30EaHOGTtruUqu+R0NmAaNdrceOGoipqEadlP WANd+pt3o8U6Ok9iTbNCNCwd5qAjuqb4ki1uBhRvTHJYuMRvEG11V6TV3JHvEt9JkWxz zqnYUMTpTFpyKkZ2pyystL4vF7LnBUAhBNxOHDU9ckHR41qtIH90wdbSp5EfeOhqYkKk SOgQ== X-Forwarded-Encrypted: i=1; AJvYcCVF+T8OSWF2RNch1QD1vgWt/MJ1p4ADS7uPqfCWWPoFpDGes0RQ20HX7PGmkbpikkp4EG/Eka+A7VR6cF0=@vger.kernel.org X-Gm-Message-State: AOJu0YwGTf0ht4fxEkr+k2Mo901b4HzPbgDuAJinz7CjZ6Iue3BtF31Y 8hyBLt6OPMBP2M9adgLG3gDY0sADknHUeu8NJMAO7hP45zQMRXxFgtV9TOA85K4= X-Google-Smtp-Source: AGHT+IFFnG99FDg0tbPUCrnuJ+5q39hROU6G1I7WeeX7XFXM8eg9WZcnUlhOo1IjHc3SXaTvZYJUzg== X-Received: by 2002:a05:6512:138b:b0:539:f1e3:ca5e with SMTP id 2adb3069b0e04-53b1a391ed0mr5911852e87.44.1729876577643; Fri, 25 Oct 2024 10:16:17 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:17 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:48 +0100 Subject: [PATCH v2 17/36] drm/vc4: txp: Handle 40-bits DMA Addresses Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-17-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 MOP and MOPLET can handle addresses larger than 32bits through an extra register. We can easily support it and make it conditional based on the compatible through a boolean in our variant structure. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ drivers/gpu/drm/vc4/vc4_txp.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 984fddae0048..34e72e711a17 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -538,8 +538,10 @@ struct vc4_crtc_data { =20 struct vc4_txp_data { struct vc4_crtc_data base; + unsigned int high_addr_ptr_reg; unsigned int has_byte_enable:1; unsigned int size_minus_one:1; + unsigned int supports_40bit_addresses:1; }; =20 extern const struct vc4_txp_data bcm2835_txp_data; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index d2ee872e9c0b..c2726ccde1cf 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -145,6 +145,9 @@ /* Number of lines received and committed to memory. */ #define TXP_PROGRESS 0x10 =20 +#define TXP_DST_PTR_HIGH_MOPLET 0x1c +#define TXP_DST_PTR_HIGH_MOP 0x24 + #define TXP_READ(offset) \ ({ \ kunit_fail_current_test("Accessing a register in a unit test!\n"); \ @@ -293,6 +296,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_= connector *conn, struct drm_framebuffer *fb; unsigned int hdisplay; unsigned int vdisplay; + dma_addr_t addr; u32 ctrl; int idx; int i; @@ -330,7 +334,13 @@ static void vc4_txp_connector_atomic_commit(struct drm= _connector *conn, return; =20 gem =3D drm_fb_dma_get_gem_obj(fb, 0); - TXP_WRITE(TXP_DST_PTR, gem->dma_addr + fb->offsets[0]); + addr =3D gem->dma_addr + fb->offsets[0]; + + TXP_WRITE(TXP_DST_PTR, lower_32_bits(addr)); + + if (txp_data->supports_40bit_addresses) + TXP_WRITE(txp_data->high_addr_ptr_reg, upper_32_bits(addr) & 0xff); + TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]); =20 hdisplay =3D mode->hdisplay ?: 1; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.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 B6CDA212193 for ; Fri, 25 Oct 2024 17:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876583; cv=none; b=b3wD/C/EaHAs57n8Mryi+qAvhFBbFudE46V9JC1NVk2zMshzdhwYHHMZaMXOaKZvSKbHktic1eQxRgIxa1kFJ9ZJ1wBHnLsz0rGLtJCWquHzjtRD0dpkPc4EeCP6/J+bDMgVQHOqLFZ3s6Q8hka06W1NPZEo9ec68r7CRzzX09s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876583; c=relaxed/simple; bh=R9RFlDE7CyX8MJ0zzwylUHAIJONhAEoeNvhpIVWQ/rg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CfC9gURonMi/+G0d0HmoxnTP96utpJSSxtMzNuAx3yLtKHZaqoIq5eEUyPlOQ1dWXuMwYt7Btn8BNP6DeILrsU53GJZ+cqbAcmCbu0q53n3okssOg5itLPekvbqM3PEcHeoLHfARTBnDjuyXYJvqsJQ6SknV5wogpKQXzDHQUQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=noS417Vt; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="noS417Vt" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-431616c23b5so16376135e9.0 for ; Fri, 25 Oct 2024 10:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876579; x=1730481379; 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=HIP++Qp2TfBreng6r9lHSlSqd+05ynFmHtOfFUyYoyw=; b=noS417VtHrEuwOBe0GW6/HcX9bwU6/op44vU0B4OM/zOcGzn0mhPT1o0ad6j7J975V 96PrBAga5iLUAEL1JjBelTAaKCugGFyg1FLdYyDF7S6Z162L+WBxuewIntBW2o/KqScU K24j6diI1Hp94Aq4D7b1nLLxKbVDCa7o6SiNV8Po9ztiEC5wwymqnCTmHb5sWUhx+xz0 PJ6h+SfZ99Z0UwWGzz/eMytg9GzC9vMMA4cPYodmFA7R1IDIJjB2vl2e86MJH9iZARLD 6JumseQq+vS2nvu4nZRj0rh7wWOSptf3ExD22K+uoxAPLHyGDGmrWCM7qbWp/L2fsxe9 9/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876579; x=1730481379; 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=HIP++Qp2TfBreng6r9lHSlSqd+05ynFmHtOfFUyYoyw=; b=q0xx7hxJEP6tr8biSuBbbYxRyQfeuECgf9GwW9VYtEmYTXBvIXCLl/ATTPkubEjXFg d7tTXFdjY8FWsc2smXaAQSijj4D3KLDngv2i7RHyLal1dz+S1ck6f1TbzIFMXQgH8wUP taNbpa/Xddj6pBvCQZqYY9O9agnY/Xx12742W3YV2Ov2Nij8fZXc8zYgmC8r2EmM4uuy VCYTd3Hbectrmkh3kZeynEPocmT/9ptq/nVGxHUf15tT6BDR3V6oN0BHsfMy9PnSNBlo U6kJP8ONMQYAK5kJjvDZ2C0hCfI3ffMGNxDVEk3Bi5YIfSUqoheXexDLCxB2SVpOJrZF Y/Zw== X-Forwarded-Encrypted: i=1; AJvYcCUng/bdbD3wgh1Jr8ydqrOCD++5umTdiChzNNgQKkF/D/pj9EKmRINb9GgOnEco3o6b5U9v9dVqJ1ZjeNQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0h/zBKRZrqFMUmtC1VNv8vGJ1Oq/LJnul3xPNDIc9/2RxdvKS XIqeKXVpa7ZsCd0OjTAhb2x0/NgRJEfmiwGfLh52tYp419nWSwWTKeaF8DmIIPI= X-Google-Smtp-Source: AGHT+IE91xtUCxvlR1lRvpTqnlZWaqwRX+o7PpgAGm30e7rVreFkYxn6n2RZsnu9N6JSHjePT4SHEA== X-Received: by 2002:a05:600c:1c98:b0:426:5e32:4857 with SMTP id 5b1f17b1804b1-4319a44e698mr2888895e9.0.1729876578594; Fri, 25 Oct 2024 10:16:18 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:18 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:49 +0100 Subject: [PATCH v2 18/36] drm/vc4: txp: Move the encoder type in the variant structure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-18-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard We'll have multiple TXP instances in the BCM2712, so we can't use a single encoder type anymore. Let's tie the encoder type to the compatible. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_txp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 34e72e711a17..70b7a771ff47 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -538,6 +538,7 @@ struct vc4_crtc_data { =20 struct vc4_txp_data { struct vc4_crtc_data base; + enum vc4_encoder_type encoder_type; unsigned int high_addr_ptr_reg; unsigned int has_byte_enable:1; unsigned int size_minus_one:1; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index c2726ccde1cf..ecd2fc5edf45 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -515,6 +515,7 @@ const struct vc4_txp_data bcm2835_txp_data =3D { .hvs_available_channels =3D BIT(2), .hvs_output =3D 2, }, + .encoder_type =3D VC4_ENCODER_TYPE_TXP, .has_byte_enable =3D true, }; =20 @@ -558,7 +559,7 @@ static int vc4_txp_bind(struct device *dev, struct devi= ce *master, void *data) return ret; =20 vc4_encoder =3D &txp->encoder; - txp->encoder.type =3D VC4_ENCODER_TYPE_TXP; + txp->encoder.type =3D txp_data->encoder_type; =20 encoder =3D &vc4_encoder->base; encoder->possible_crtcs =3D drm_crtc_mask(&vc4_crtc->base); --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 05907216DFF for ; Fri, 25 Oct 2024 17:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876587; cv=none; b=a/4T5aiA+sMPuzFl7iIHaUOacI1gKXiBJ31R7VA3DLysryypOsXo5efZPu7CoNRlmQlNJXeEMFTlpF94WmybJB74FaA/pCoRbe38ehaScfYCIxij13FfZlZ9d+gkK4YbYivDUhWv5+IXMnMZUOufoA0/eWWQMykb3ujaCVwXER0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876587; c=relaxed/simple; bh=a9c8NZjPiglfcmZ2WXHJt/neelf0VsgLA++tb0FKY8k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bOs9+WDY5YUhZ6m562mCRKRh6P9QPydIbEDZkEaG+RzzN4m5PHzBm6CUOgzaSKmJ8V0wJB6q3erQyVFIu9noQ/DV23PrvCBc6cqqrOqPDawAjYgrIBhBxifmYiZ5fgrGjPQZOk0cP8xwlPnJd2LSgSSd9D0Eg4WqR343bVFH+Jg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=fsqpT93d; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="fsqpT93d" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43161c0068bso22043555e9.1 for ; Fri, 25 Oct 2024 10:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876580; x=1730481380; 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=ND5qe7OBv3VTVRpCDuAboIPK8dxpxdN+CM3FHGRXNAw=; b=fsqpT93dMDd3RdadnzCHcvZjg/2w+KmJ2LaUNOp/nwX7o+Ov4bqvJYbFUdVmMeE/Yn NdwUMGplUj/jZeoux5LZcwHgtTdD8wO213tnIVXv5ReZZCCLnZ7qa95OXK0ZzOgX0xYs N4TO2wPJWhIP31GZVwXS6Wa0ZFlTbgY9M7ZuRtCmhFh2khSNjaIPyAj7ROj2Gyxfw2Ct aFudAAW2BM4ISUpT9+62wIIdvVfg9UURIMv6+678fNjFkN+yYcjujBHhsDQ2ew0kaAmU z/xpshT43k+Ghr0d21UY5patP7UFy+yXlgIY6Ctpa7UzZ2hAL5OmQJbMhaiQCneZFjJ+ 8+AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876580; x=1730481380; 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=ND5qe7OBv3VTVRpCDuAboIPK8dxpxdN+CM3FHGRXNAw=; b=L+ZBTxoOGCGhr99e97phSM+oP6UjfsnvPKB1/wu5M0+uy92yJnXjBVBJYFL9gDoep0 qWTszVAbHsY05SWyVChek56QAzdLxoX52rjNecpfc5fVHlyKjLwCvSybophfM7fw53NH TD03a6rIR+G+pon1MvdmZ4kFo2VVlZnQyvvc+m3f245ktRhgK4WsM3W6TbXlLqhGCv0w XpPCNib/OoRQeXOxlo0k3gY5tSCZT+W9iRp9/F1gFFESFK7aKwTrKD4qNztIf0aUMip3 95/1C6oV8aK4W0KlVIEUA6BkixuV9lKVCPBradZVTHZ6rz5P37GCcEBH6WNP2I4Tut7n STRA== X-Forwarded-Encrypted: i=1; AJvYcCUrP3/o7W6Tirbu+0200N8OsHqys2xfcyb1pg2exhA89LFY3TogTiA+y+j+D6eKymmNqKO2eMPm7k4hq1o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2xDiou4IVvcYV7QY1snHG1I5UwqTnCdh1VXFtMPQ/0K6tIPt0 V7xb6EqOGhJP89ymI5H8cLUrSsf56LDQLWRnH701+tdFHb7n8+SFQURJeidnEzFUqoxVOJ9Se0Z MnyU= X-Google-Smtp-Source: AGHT+IH6OtEiwFMpJgenp0RKgtUcQ2xa79UJzkJTMiVDfTU9tdYzxLD3qQqnLPLck4wyddL0IEmq3A== X-Received: by 2002:a05:600c:46c8:b0:431:44fe:fd9a with SMTP id 5b1f17b1804b1-43184209b20mr90133795e9.19.1729876579764; Fri, 25 Oct 2024 10:16:19 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:19 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:50 +0100 Subject: [PATCH v2 19/36] drm/vc4: txp: Add a new TXP encoder type Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-19-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard Starting with BCM2712, we'll have a two TXP. Let's follow the HDMI example and add two encoder types for TXP: TXP0 and TXP1. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/tests/vc4_mock.c | 4 +- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 106 ++++++++++++---------= ---- drivers/gpu/drm/vc4/vc4_drv.h | 3 +- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- drivers/gpu/drm/vc4/vc4_txp.c | 2 +- 5 files changed, 59 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tes= ts/vc4_mock.c index 372482fcd6c7..e276a957b01c 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -52,7 +52,7 @@ struct vc4_mock_desc { static const struct vc4_mock_desc vc4_mock =3D VC4_MOCK_DESC( VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base, - VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, + VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP0, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), VC4_MOCK_PIXELVALVE_DESC(&bcm2835_pv0_data, @@ -78,7 +78,7 @@ static const struct vc4_mock_desc vc4_mock =3D static const struct vc4_mock_desc vc5_mock =3D VC4_MOCK_DESC( VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base, - VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP, + VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP0, DRM_MODE_ENCODER_VIRTUAL, DRM_MODE_CONNECTOR_WRITEBACK)), VC4_MOCK_PIXELVALVE_DESC(&bcm2711_pv0_data, diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/d= rm/vc4/tests/vc4_test_pv_muxing.c index 61622e951031..40a05869a50e 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -90,7 +90,7 @@ static const struct encoder_constraint vc4_encoder_constr= aints[] =3D { ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_DSI0, 0), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_HDMI0, 1), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_VEC, 1), - ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_TXP, 2), + ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_TXP0, 2), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_DSI1, 2), }; =20 @@ -98,7 +98,7 @@ static const struct encoder_constraint vc5_encoder_constr= aints[] =3D { ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_DPI, 0), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_DSI0, 0), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_VEC, 1), - ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_TXP, 0, 2), + ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_TXP0, 0, 2), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_DSI1, 0, 1, 2), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_HDMI0, 0, 1, 2), ENCODER_CONSTRAINT(VC4_ENCODER_TYPE_HDMI1, 0, 1, 2), @@ -207,7 +207,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_PV_MUXING_TEST("1 output: DSI1", VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("1 output: TXP", - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("2 outputs: DSI0, HDMI0", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_HDMI0), @@ -219,7 +219,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("2 outputs: DSI0, TXP", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("2 outputs: DPI, HDMI0", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_HDMI0), @@ -231,19 +231,19 @@ static const struct pv_muxing_param vc4_test_pv_muxin= g_params[] =3D { VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("2 outputs: DPI, TXP", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("2 outputs: HDMI0, DSI1", VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("2 outputs: HDMI0, TXP", VC4_ENCODER_TYPE_HDMI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("2 outputs: VEC, DSI1", VC4_ENCODER_TYPE_VEC, VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("2 outputs: VEC, TXP", VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("3 outputs: DSI0, HDMI0, DSI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_HDMI0, @@ -251,7 +251,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_PV_MUXING_TEST("3 outputs: DSI0, HDMI0, TXP", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_HDMI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("3 outputs: DSI0, VEC, DSI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, @@ -259,7 +259,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_PV_MUXING_TEST("3 outputs: DSI0, VEC, TXP", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("3 outputs: DPI, HDMI0, DSI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_HDMI0, @@ -267,7 +267,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_PV_MUXING_TEST("3 outputs: DPI, HDMI0, TXP", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_HDMI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("3 outputs: DPI, VEC, DSI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, @@ -275,7 +275,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= params[] =3D { VC4_PV_MUXING_TEST("3 outputs: DPI, VEC, TXP", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), }; =20 KUNIT_ARRAY_PARAM(vc4_test_pv_muxing, @@ -287,7 +287,7 @@ static const struct pv_muxing_param vc4_test_pv_muxing_= invalid_params[] =3D { VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_DSI0), VC4_PV_MUXING_TEST("TXP/DSI1 Conflict", - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1), VC4_PV_MUXING_TEST("HDMI0/VEC Conflict", VC4_ENCODER_TYPE_HDMI0, @@ -296,22 +296,22 @@ static const struct pv_muxing_param vc4_test_pv_muxin= g_invalid_params[] =3D { VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_DSI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, DSI1, TXP", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, VC4_ENCODER_TYPE_DSI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("More than 3 outputs: DPI, HDMI0, DSI1, TXP", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_DSI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC4_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, DSI1, TXP", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, VC4_ENCODER_TYPE_DSI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), }; =20 KUNIT_ARRAY_PARAM(vc4_test_pv_muxing_invalid, @@ -342,7 +342,7 @@ static const struct pv_muxing_param vc5_test_pv_muxing_= params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("2 outputs: DPI, TXP", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("2 outputs: DPI, VEC", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC), @@ -360,7 +360,7 @@ static const struct pv_muxing_param vc5_test_pv_muxing_= params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("2 outputs: DSI0, TXP", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("2 outputs: DSI0, VEC", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC), @@ -372,7 +372,7 @@ static const struct pv_muxing_param vc5_test_pv_muxing_= params[] =3D { VC4_ENCODER_TYPE_VEC), VC5_PV_MUXING_TEST("2 outputs: DSI1, TXP", VC4_ENCODER_TYPE_DSI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("2 outputs: DSI1, HDMI0", VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0), @@ -384,7 +384,7 @@ static const struct pv_muxing_param vc5_test_pv_muxing_= params[] =3D { VC4_ENCODER_TYPE_VEC), VC5_PV_MUXING_TEST("2 outputs: HDMI0, TXP", VC4_ENCODER_TYPE_HDMI0, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("2 outputs: HDMI0, HDMI1", VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), @@ -393,14 +393,14 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_params[] =3D { VC4_ENCODER_TYPE_VEC), VC5_PV_MUXING_TEST("2 outputs: HDMI1, TXP", VC4_ENCODER_TYPE_HDMI1, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("2 outputs: TXP, VEC", - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_VEC), VC5_PV_MUXING_TEST("3 outputs: DPI, VEC, TXP", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("3 outputs: DPI, VEC, DSI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, @@ -415,15 +415,15 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("3 outputs: DPI, TXP, DSI1", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1), VC5_PV_MUXING_TEST("3 outputs: DPI, TXP, HDMI0", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("3 outputs: DPI, TXP, HDMI1", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("3 outputs: DPI, DSI1, HDMI0", VC4_ENCODER_TYPE_DPI, @@ -440,7 +440,7 @@ static const struct pv_muxing_param vc5_test_pv_muxing_= params[] =3D { VC5_PV_MUXING_TEST("3 outputs: DSI0, VEC, TXP", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP), + VC4_ENCODER_TYPE_TXP0), VC5_PV_MUXING_TEST("3 outputs: DSI0, VEC, DSI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, @@ -455,15 +455,15 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("3 outputs: DSI0, TXP, DSI1", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1), VC5_PV_MUXING_TEST("3 outputs: DSI0, TXP, HDMI0", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("3 outputs: DSI0, TXP, HDMI1", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("3 outputs: DSI0, DSI1, HDMI0", VC4_ENCODER_TYPE_DSI0, @@ -490,17 +490,17 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, DSI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, HDMI0", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, HDMI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, DSI1, HDMI0", VC4_ENCODER_TYPE_DPI, @@ -519,17 +519,17 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, TXP, DSI1, HDMI0", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, TXP, DSI1, HDMI1", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, TXP, HDMI0, HDMI1", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, DSI1, HDMI0, HDMI1", @@ -540,19 +540,19 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, DSI1, HDMI0", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, DSI1, HDMI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, HDMI0, HDMI1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, DSI1, HDMI0, HDMI1", @@ -563,24 +563,24 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, TXP, DSI1, HDMI0, HDMI1", VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, DSI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, HDMI0", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, HDMI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, DSI1, HDMI0", VC4_ENCODER_TYPE_DSI0, @@ -599,17 +599,17 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, TXP, DSI1, HDMI0", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, TXP, DSI1, HDMI1", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, TXP, HDMI0, HDMI1", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, DSI1, HDMI0, HDMI1", @@ -620,19 +620,19 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, DSI1, HDMI0", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, DSI1, HDMI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, HDMI0, HDMI1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, DSI1, HDMI0, HDMI1", @@ -643,27 +643,27 @@ static const struct pv_muxing_param vc5_test_pv_muxin= g_invalid_params[] =3D { VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, TXP, DSI1, HDMI0, HDMI1", VC4_ENCODER_TYPE_DSI0, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: VEC, TXP, DSI1, HDMI0, HDMI1", VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DPI, VEC, TXP, DSI1, HDMI0, HDMI= 1", VC4_ENCODER_TYPE_DPI, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), VC5_PV_MUXING_TEST("More than 3 outputs: DSI0, VEC, TXP, DSI1, HDMI0, HDM= I1", VC4_ENCODER_TYPE_DSI0, VC4_ENCODER_TYPE_VEC, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_HDMI0, VC4_ENCODER_TYPE_HDMI1), diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 70b7a771ff47..de2107e593c2 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -489,7 +489,8 @@ enum vc4_encoder_type { VC4_ENCODER_TYPE_DSI1, VC4_ENCODER_TYPE_SMI, VC4_ENCODER_TYPE_DPI, - VC4_ENCODER_TYPE_TXP, + VC4_ENCODER_TYPE_TXP0, + VC4_ENCODER_TYPE_TXP1, }; =20 struct vc4_encoder { diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index aa0b50d6c9fd..3fcfc265e1e2 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -350,7 +350,7 @@ static void vc6_hvs_pv_muxing_commit(struct vc4_dev *vc= 4, mux =3D 0; break; =20 - case VC4_ENCODER_TYPE_TXP: + case VC4_ENCODER_TYPE_TXP1: mux =3D 2; break; =20 diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index ecd2fc5edf45..2979d141f3bb 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -515,7 +515,7 @@ const struct vc4_txp_data bcm2835_txp_data =3D { .hvs_available_channels =3D BIT(2), .hvs_output =3D 2, }, - .encoder_type =3D VC4_ENCODER_TYPE_TXP, + .encoder_type =3D VC4_ENCODER_TYPE_TXP0, .has_byte_enable =3D true, }; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 66A2622443A for ; Fri, 25 Oct 2024 17:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876587; cv=none; b=U9xmHtywqxx5lxHnLzAAuSOwp+JC+M0QYKq5LMidwUgClUMMDdTUYwl52IF1sK4U2SuYKm4UqI4Hwy6yuCmIHGQkvLJIPzkfvLmpl0LnB5RSAG0jRUEtzY7QwoH1HkN/WJjOxV66wp0BUBVUqiag6QVzfFAn+3We3TBmY3ypv8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876587; c=relaxed/simple; bh=7jLpEAJMVrLhmXPp9ULrFW+zzw3Aoy+OpTHf16ixobE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ctsT8B9DbyaoLySCmflbRP3/rijfrqaw0lQJ2jVtj2r2KsiB9bbVUqlT09+nlqCcK9KXTog/0QYCEFiCUV48QDxmNt1lxRBQWjUtgOJt0oDtQ+gabH8PmBzQkG8XEAOqI5AUjJQ2p+VBHhYx/wXOokZ6WA3YNlJHR3tPH6CwhwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=T7HRAHIN; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="T7HRAHIN" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4316cce103dso29104485e9.3 for ; Fri, 25 Oct 2024 10:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876581; x=1730481381; 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=045viQzx57IhwQQsyT6qqiu42hT8ZIqMYzIaAsSMK5k=; b=T7HRAHINzktXA1XrsAaYbiGJuoeS5NR4yxGnYpZq8ZP+Bx2pBgTcgJEABmrW7gFV/7 p5/8+qYfu7PYdAmAMLJJj4ZOhDQfmhi5sXJfeec5sCVlepzniuIyb8+3QahiUuOiI7SY rGowXAoeV3e482CRQxLtv2AqLOeCsHmALrVk0CbPN6c9w4pe7QhdI5TQg8y3ZDI6DQm2 3gMgsoHI3QASwQjlJAXGjBkh1qMjY+uZ9V6KLiopSgZRQkoGbuf0vLoiPcOSvV+XCrOT yGgmkUFLZd/CsE27XjheclWY7lZXAZGLBkeYUa6uphRTEVPAoHd10Sik+TnXIu2owMkQ stYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876581; x=1730481381; 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=045viQzx57IhwQQsyT6qqiu42hT8ZIqMYzIaAsSMK5k=; b=ic8qFd2mc0j+PEgXjEwRKNV0v4IxqusQ0BWk8Rf50s+DGc6QAeru9mTg3Vc6+Nq0PK qbDLJ6oGvgN8f9s6trp7ui0ECSFdzprskasedcFUxvQghtb1K3uyDcmtxWfpv+JjOIrH V2l3RDg38sY2/5f2usx7XMyhXMoUDj2U1BH07XlvPpdsPcxMeEEsIpeL8U+NfZPDSysA kN7kkMeXaWKWg5wtClzM3nxmI4592YH1JrnKq1rRceLHvo61ZwxOmtg9fBTOzQLzpFJ0 9dS8CqczlCsCj7NtvhBvcXiLp4eBFh0X1PH4hopcrhOoqMUDocQprAcHeHBk7I626q/R CDrg== X-Forwarded-Encrypted: i=1; AJvYcCV5Kca/FWDOu+Ucr+Ogty7k69NNrei/QkSX7gYoGs1bqRE+OuD9lb0BL7mkbOyENrdPfd5Az0PQpj2hJvc=@vger.kernel.org X-Gm-Message-State: AOJu0Yxg1X2az6pvOVCHLT/tN93EKwOO5TN2HiLi+vEJzVWzX8NtN9E1 RTlPVTE6gKhKvBzpftgQND5yhQdIaHTe+l+egpoNQJN+W2JjpZOgizYoU4Trom8= X-Google-Smtp-Source: AGHT+IFq8aW9+AJOypAF2zuR/gJf+QmQVgnYrUJ9N0n4pCykY2oKrjKRG8wAcTrjRRvZiRW4wqZj4Q== X-Received: by 2002:a5d:61d2:0:b0:37c:cc4b:d1d6 with SMTP id ffacd0b85a97d-380611a495cmr139300f8f.27.1729876580783; Fri, 25 Oct 2024 10:16:20 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:20 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:51 +0100 Subject: [PATCH v2 20/36] drm/vc4: txp: Add support for BCM2712 MOP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-20-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 has an evolution of what used to be called TXP in the earlier SoCs, but is now called MOP. There's a few differences still, so we can add a new compatible to deal with them easily. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_txp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index 2979d141f3bb..0fb8a57652b5 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -386,6 +386,7 @@ static const struct drm_connector_funcs vc4_txp_connect= or_funcs =3D { static void vc4_txp_encoder_disable(struct drm_encoder *encoder) { struct drm_device *drm =3D encoder->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(drm); struct vc4_txp *txp =3D encoder_to_vc4_txp(encoder); int idx; =20 @@ -404,7 +405,8 @@ static void vc4_txp_encoder_disable(struct drm_encoder = *encoder) WARN_ON(TXP_READ(TXP_DST_CTRL) & TXP_BUSY); } =20 - TXP_WRITE(TXP_DST_CTRL, TXP_POWERDOWN); + if (vc4->gen < VC4_GEN_6_C) + TXP_WRITE(TXP_DST_CTRL, TXP_POWERDOWN); =20 drm_dev_exit(idx); } @@ -508,6 +510,20 @@ static irqreturn_t vc4_txp_interrupt(int irq, void *da= ta) return IRQ_HANDLED; } =20 +static const struct vc4_txp_data bcm2712_mop_data =3D { + .base =3D { + .name =3D "mop", + .debugfs_name =3D "mop_regs", + .hvs_available_channels =3D BIT(2), + .hvs_output =3D 2, + }, + .encoder_type =3D VC4_ENCODER_TYPE_TXP0, + .high_addr_ptr_reg =3D TXP_DST_PTR_HIGH_MOP, + .has_byte_enable =3D true, + .size_minus_one =3D true, + .supports_40bit_addresses =3D true, +}; + const struct vc4_txp_data bcm2835_txp_data =3D { .base =3D { .name =3D "txp", @@ -613,6 +629,7 @@ static void vc4_txp_remove(struct platform_device *pdev) } =20 static const struct of_device_id vc4_txp_dt_match[] =3D { + { .compatible =3D "brcm,bcm2712-mop", .data =3D &bcm2712_mop_data }, { .compatible =3D "brcm,bcm2835-txp", .data =3D &bcm2835_txp_data }, { /* sentinel */ }, }; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 9B458224DBB for ; Fri, 25 Oct 2024 17:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876588; cv=none; b=M9t+pSs3xIodm0wqE6Cxk4Pxnx4eV0+1mrHxJQuGQpNzl+HwH/7HkuSGUwDjtdIhz46Q70lkpxDv7cVipv+a++itzm6wVfDb9uIzCSJcAFEd4gcm2gtI6Km7NGNlbuZsJstmCBPSxZx4w7P5WuFrzC8+OfLIKJmGzLyxlYIeiVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876588; c=relaxed/simple; bh=F0XAo5mz5eUCdJ+Qp7hebNYu4JuOVVuD+OJwvRorfLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M6YQ2Xk9jd7Q6vHKvf2aewW59/pVqFkEsg0W43O4hNsl2pLwXhROyaZIFec6SROIWaRCF+WVnTXN/88e9gJayWwS+3o98QMS8S+DJJSM5bUas+30RwMLhuRwsD3iUA6qphOt2DdTCCRHFJx04BgpXM3X/8WFwaK6Qgre2vaXia0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=gZxP74nX; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gZxP74nX" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-431616c23b5so16376465e9.0 for ; Fri, 25 Oct 2024 10:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876582; x=1730481382; 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=xU//JPSDEyUFE1ZFqfKvgV23VREouvKrVYoOcahlOXU=; b=gZxP74nXhgSkHewcRkTkJ7WbuoBNnobywlAlcWcbyGnAqsywOBrarRVJFBwrh2bvYQ xsd4+J4Zrsx9+f7JQJmVRIRGvrA9mYWbiq9CBxZTOBxYZ63ny52dlgGXDnWjAnqIxksM SsxFU/vhgA9x0ajzGqMfrwecaukSXcHMK3W5bKFXWXxi9IIpDehSQt2MvDltC0DcpoU6 eGFZSsPyi9yN9yBcJFR2st77Z0AX0DLyoOaeZvJbr1iOAX198NQKxRvqZti+AysKhc+Q 4rw3QhqpQK03bM7JDBs6AbA6ULY0+VrM2x2mIlhCG+Q59CurEquO9f7NPBadtndyosUm 4bhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876582; x=1730481382; 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=xU//JPSDEyUFE1ZFqfKvgV23VREouvKrVYoOcahlOXU=; b=ObGOjJfIh1p0GmcHBu9Nny6EfDx4bpOQpDmEubpujT8hQGLMWAimAKjkQUPc8MMpyr 8wLR7e++adhBmNih5rytS+7yQnyYkrVC6JvGKWIrhuZM1Z1k3C0agLdGAdXP0q46pA+U XMY1oHrVF0iqpOjpsIksDpwF5e9BtOjzx+obycGecb0pyaujS/xU7hUD7okv9053Ng7g 2IcL8jCt7O2KmPNw5MrL72AuiyUhsgU5KJkoOxAP7ZaNmuoepwAM5Uhz8ct0cGbqM98L d+Pl/faU7yyLUztJ8pDqTGg5obBVVW26fgHkQnnk9DNQv289V+erELU9YOwKYT55dSiI bv6Q== X-Forwarded-Encrypted: i=1; AJvYcCUYIYZEf5cRXAQ7OPwrBAbwyuyjSnGISh5VBF+Qm+/1M2A8hfgG2YQrmWmwwdjIU3DP1rVt/LiDjRlaT6Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzvPga+DvHRg+8P8QQXFputu7PDM0RG2Yke7LzW0fd4jRkL4Kyp BkLn/GTwSeuMHr7AzoWkAcNeUdnQqdRSC/HERgcAMQSrCaaBhMXsmrq++RLXthc= X-Google-Smtp-Source: AGHT+IHAWpLHmHwxEQ7ZVCnrScJ+3akRtweGAEi8Ve0sUsAzGKfVQQMDJC1MG28sgbwB6TwBnzAs5Q== X-Received: by 2002:a05:600c:1e1e:b0:431:5226:1633 with SMTP id 5b1f17b1804b1-4319a576ba8mr2501215e9.6.1729876581722; Fri, 25 Oct 2024 10:16:21 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:21 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:52 +0100 Subject: [PATCH v2 21/36] drm/vc4: txp: Add BCM2712 MOPLET support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-21-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The BCM2712 features a simpler TXP called MOPLET. Let's add support for it. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_txp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index 0fb8a57652b5..f6b6f8627f61 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -524,6 +524,19 @@ static const struct vc4_txp_data bcm2712_mop_data =3D { .supports_40bit_addresses =3D true, }; =20 +static const struct vc4_txp_data bcm2712_moplet_data =3D { + .base =3D { + .name =3D "moplet", + .debugfs_name =3D "moplet_regs", + .hvs_available_channels =3D BIT(1), + .hvs_output =3D 4, + }, + .encoder_type =3D VC4_ENCODER_TYPE_TXP1, + .high_addr_ptr_reg =3D TXP_DST_PTR_HIGH_MOPLET, + .size_minus_one =3D true, + .supports_40bit_addresses =3D true, +}; + const struct vc4_txp_data bcm2835_txp_data =3D { .base =3D { .name =3D "txp", @@ -630,6 +643,7 @@ static void vc4_txp_remove(struct platform_device *pdev) =20 static const struct of_device_id vc4_txp_dt_match[] =3D { { .compatible =3D "brcm,bcm2712-mop", .data =3D &bcm2712_mop_data }, + { .compatible =3D "brcm,bcm2712-moplet", .data =3D &bcm2712_moplet_data }, { .compatible =3D "brcm,bcm2835-txp", .data =3D &bcm2835_txp_data }, { /* sentinel */ }, }; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 10008226B6B for ; Fri, 25 Oct 2024 17:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876589; cv=none; b=LEQyg3aAiy/k03NhCDgyOy+JdPuQd27H04hWp9F+qYqZrtrb+qTuyNVuEYgE3jlSmASrTkiXj9MFJTytH1CRzsJ2ooT7bMrng19fsZnxvRLYRKBXXA5VHyguyBpNJuOLVnHFB1RPFiwxd3tZjZURXLihwdqdrVF2zLylaHixLd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876589; c=relaxed/simple; bh=wRgRhlnNUNPcgFsjntpdMYGQbwOlM1DXbBRSrIRrGz0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TzbPPYFjidpI0n1mO5VZ43y4D7uAnblbUpYW0Ut/R89NQouRe7yvvW2wFaW+0mm3CUcDe46yfuzlBReSvmb5tUjdFU+masjNj9VdacKSlul/kEQHCYgoA0fWdR8EBM3gcCnJ6H/HsvtzTTx7n3JvvlnIAlQwaXxtMoQMNVi8kk0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=qOSkwLvf; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qOSkwLvf" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-37d4821e6b4so1429586f8f.3 for ; Fri, 25 Oct 2024 10:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876582; x=1730481382; 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=jjqh1NzzsNxf2iCinOb01EHYKOcZAWco0gW1TtgVpxE=; b=qOSkwLvfRw3ZLCz92FolT+GjyREsSrbqN7BPng1ITrWtd/5eD5iTITmVMnDCK1VZFV Fh/A4iwAFCR02MJRGCudw3sBtcVwwf9VHKQ4fhgry6UYFbZPQ6F+Bw94sbubhTj97Qrx Y9Rx9lIiVIRfOuUWwHUpbaQELtg2xQ5/DCZkYv8RTOR1JyJU5UXMXdGII+XIjazB8/Rz HBuUorpZ5LNTP5akUsEyOPIOElTxFsw4/fW0cJGyu23zR2x2aisAIwKmFGJDzt6dS+Fm BLWabAHfkNXUOXZlVv6C5cQ4wdzUei7q4FoJ+SubtYKHHF6rVpbgeM6UqhvvKeWCMtIY AuUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876582; x=1730481382; 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=jjqh1NzzsNxf2iCinOb01EHYKOcZAWco0gW1TtgVpxE=; b=adk7WFl8B66jhj2L06n6nU0eLKizV9+HP8avTeHp0uptQnO/uxrXPLNOxlL3yJ/KUA Pr4tVFy9oPOv31/0Azq6W3LpC0ci6fe7et+leks/39QdlelmG6GCqZnOwZjknGsezitG KHV9zRiGnJzy4VOqHJCksP3EXajqiTFUpFlDD/xD5SE3k+ODNRFccrAPQGib9wxhB4Fo go2J3GyyV9EXohjiXefHFG85cpYZcZhfe6nYOtvz6u3HT8LsoN+2dj0ZdT7mnKUF0Mws F3bKpRXPyGVRjMhlEF4SqjXjEDEm+zuHK5zNe0N/O6qNyIkzcg9L6ZjylFS0OUn+J+nU qGWg== X-Forwarded-Encrypted: i=1; AJvYcCX4BEoCDqhyqGZqNHYdSRqvAJUZSBiVLsa4RYsD03ighfkwQoAS6HuLv7PW2k6N/jnbe0lOEH0jgybBV54=@vger.kernel.org X-Gm-Message-State: AOJu0YxPxA7sSTqXaFzUCexdHi8kTxs9NR+kp4G8CZ68Te7xRYMnhMyT PGJroUo8fCK2RBMPq8ET98E5zzH9quLDS9ix+ea9ZlsYiDAyfi5RdsneXkhPxIc= X-Google-Smtp-Source: AGHT+IEQsz/ieGCoAjrNeStjHY3m+yeckCVb8DDV3/P3RxReILzsgdvSRPsp1dMVqLFx8R4lAqslJA== X-Received: by 2002:a05:6000:b0e:b0:37d:4fab:c198 with SMTP id ffacd0b85a97d-3806115a9bfmr105090f8f.26.1729876582551; Fri, 25 Oct 2024 10:16:22 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:22 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:53 +0100 Subject: [PATCH v2 22/36] drm/vc4: drv: Add support for 2712 D-step Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-22-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 Add in the compatible string and VC4_GEN_ enum for the D-step Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_hvs.c | 4 ++++ drivers/gpu/drm/vc4/vc4_regs.h | 3 +++ 4 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 94e01ce2b1ef..fb91e771e345 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -466,6 +466,7 @@ static void vc4_platform_drm_shutdown(struct platform_d= evice *pdev) =20 static const struct of_device_id vc4_of_match[] =3D { { .compatible =3D "brcm,bcm2711-vc5", .data =3D (void *)VC4_GEN_5 }, + /* NB GEN_6_C will be corrected on D0 hw to GEN_6_D via vc4_hvs_bind */ { .compatible =3D "brcm,bcm2712-vc6", .data =3D (void *)VC4_GEN_6_C }, { .compatible =3D "brcm,bcm2835-vc4", .data =3D (void *)VC4_GEN_4 }, { .compatible =3D "brcm,cygnus-vc4", .data =3D (void *)VC4_GEN_4 }, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index de2107e593c2..e3983a44e35e 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -85,6 +85,7 @@ enum vc4_gen { VC4_GEN_4, VC4_GEN_5, VC4_GEN_6_C, + VC4_GEN_6_D, }; =20 struct vc4_dev { diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 7c2dccfdb58d..a353b51243a5 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -1532,6 +1532,10 @@ static int vc4_hvs_bind(struct device *dev, struct d= evice *master, void *data) if (vc4->gen >=3D VC4_GEN_6_C) { hvs->regset.regs =3D vc6_hvs_regs; hvs->regset.nregs =3D ARRAY_SIZE(vc6_hvs_regs); + + if (VC4_GET_FIELD(HVS_READ(SCALER6_VERSION), SCALER6_VERSION) =3D=3D + SCALER6_VERSION_D0) + vc4->gen =3D VC4_GEN_6_D; } else { hvs->regset.regs =3D vc4_hvs_regs; hvs->regset.nregs =3D ARRAY_SIZE(vc4_hvs_regs); diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 731b13742ef5..df44a4a4009f 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -527,6 +527,9 @@ #define SCALER5_DLIST_START 0x00004000 =20 #define SCALER6_VERSION 0x00000000 +# define SCALER6_VERSION_MASK VC4_MASK(7, 0) +# define SCALER6_VERSION_C0 0x00000053 +# define SCALER6_VERSION_D0 0x00000054 #define SCALER6_CXM_SIZE 0x00000004 #define SCALER6_LBM_SIZE 0x00000008 #define SCALER6_UBM_SIZE 0x0000000c --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 ED65F226B95 for ; Fri, 25 Oct 2024 17:16:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876591; cv=none; b=gySbKoUIyjrK/nejS/pwGPvtJxN5YIOzw1Z2HlpimJfQwkNtGDAHXFDPm2pQFfxm5rhVXcMxNRG1jFj400/h7ZrlinG97qbcWSQ4/yvyiefF8NO65fh3w7t9H+mrZbVzN8dodtOv2l1Ad8J+twB8H2sPLIJSQuo4NFq/f+JlRgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876591; c=relaxed/simple; bh=dIiXg2IkK17MB4/Z/b9r9NYHWb0vw5uyptH5OR8XYWU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RSylQxQ3rjdK7gnrR9hPl/rutgckpV865z/ipuqnmvDv4qBK7o6I2iBTyyglfNz7aZbVCqhMlHnyGH0sAiJ2bGBGL62rIkKMBFxsBw214IPieMtkalL/KmQ/ZsJs9C350UqMufXvN1zf6qbiZ+S0niycLJZRWJAQI44r0NISI+E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=hnpJOZR6; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hnpJOZR6" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-43158625112so22708525e9.3 for ; Fri, 25 Oct 2024 10:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876583; x=1730481383; 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=Ek3mxYSYhYna122gmUrC8WnJPGqGM50a8fUQF8IeHiM=; b=hnpJOZR6r4f7+N8Ns6DBozags1gmyd5BJiguZhYtx1ycy7Oc97hY++0MEauF5IlNoE 6+SafF/t023kXcSmItmgtuLVPESsdw+9OBphTDN9cT6S3n9H4M5fhoiJBYHz7qtjW2L3 4CBc5y5nm1wceN57LdCae6aYkmHchKGjo9pK4323Hcvhapiqp5gOlrhptwgmy7RRQU/S 4zPEHNAOyFDWnIHtAECOIqOxZAyhkv3l6Auz2dvjxDxYM4cKvakuK54PkWpCNPyMeGvf UYg/YvcE3+PFZmfteW6Gqz2xN8c7e5GBtzM2msFYyIsfHEZUENUHwobWwNVI4jy2CLbY Adgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876583; x=1730481383; 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=Ek3mxYSYhYna122gmUrC8WnJPGqGM50a8fUQF8IeHiM=; b=MnNJjdj9eA5En5Bf7nCG5S429a3vw3Y7buZRcwgWWqH25P09OZiLTJ5soV6T4c2wPk D39H22LJR4mq+TmN2z/x2LH3g5ViDdVZYNUlXxX1EX/ArphXNZmVrCx/ASKRPPDiZR2s XRKUIpIhK0BV730Dxj+Uyi0zhpQJIWdP4XCB4QOMzXl+obxGD4hO/uzupYHBrxnXY0JC auuW/3cigXcXFyjg+oxsyh1Fe+ClZcQrItSqbcmkZ7wGGZ1DuCxI/nTs5kKic6cpwlrE oL18JGv3FzhA5ly/EhmcQphf7qIk6TgTcn4nsB6hF3O9yWl5+AcwDG2ubytwkSqakrx2 T0kg== X-Forwarded-Encrypted: i=1; AJvYcCV4XkAPUSt0cFvcy4lqNT/QGTLHndXmLnP75+DDLtJsBPLG3OWpJJ1D9aXzvlHiBQc663U/hBUmhi1Uey8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0KKJB2dZInbUwTiz/o1q3Hd49/3qwBXQYiFwRxsFvOHFcQp/Y KF38VwVehv4OzRVH9GC+nIflZCg1GzeniIRk0qq41EB1caqsYRsOkr6EJICIWpPREVnHl1Nqbmm h8iA= X-Google-Smtp-Source: AGHT+IEh5S35F22jG7pmMin7cecoBC/sDB1bugdOwOW0if6TZa4rpFYAItxgFZ5Ka7Sc9rRaMFXIhA== X-Received: by 2002:a05:600c:354b:b0:428:1b0d:8657 with SMTP id 5b1f17b1804b1-4318424df9bmr96184485e9.22.1729876583518; Fri, 25 Oct 2024 10:16:23 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:23 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:54 +0100 Subject: [PATCH v2 23/36] drm/vc4: hvs: Add in support for 2712 D-step. Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-23-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 The registers have been moved around, and a couple of minor changes made, so adapt for this. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.h | 6 ++ drivers/gpu/drm/vc4/vc4_hvs.c | 154 +++++++++++++++++++++++++++++++++----= ---- drivers/gpu/drm/vc4/vc4_kms.c | 3 +- drivers/gpu/drm/vc4/vc4_regs.h | 117 +++++++++++++++++++++++++++---- 4 files changed, 234 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index e3983a44e35e..4a078ffd9f82 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -681,6 +681,12 @@ struct vc4_crtc_state { writel(val, hvs->regs + (offset)); \ } while (0) =20 +#define HVS_READ6(offset) \ + HVS_READ(hvs->vc4->gen =3D=3D VC4_GEN_6_C ? SCALER6_ ## offset : SCALER6D= _ ## offset) + +#define HVS_WRITE6(offset, val) \ + HVS_WRITE(hvs->vc4->gen =3D=3D VC4_GEN_6_C ? SCALER6_ ## offset : SCALER6= D_ ## offset, val) + #define VC4_REG32(reg) { .name =3D #reg, .offset =3D reg } =20 struct vc4_exec_info { diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index a353b51243a5..11acc56ab92d 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -141,6 +141,66 @@ static const struct debugfs_reg32 vc6_hvs_regs[] =3D { VC4_REG32(SCALER6_BAD_AXI), }; =20 +static const struct debugfs_reg32 vc6_d_hvs_regs[] =3D { + VC4_REG32(SCALER6D_VERSION), + VC4_REG32(SCALER6D_CXM_SIZE), + VC4_REG32(SCALER6D_LBM_SIZE), + VC4_REG32(SCALER6D_UBM_SIZE), + VC4_REG32(SCALER6D_COBA_SIZE), + VC4_REG32(SCALER6D_COB_SIZE), + VC4_REG32(SCALER6D_CONTROL), + VC4_REG32(SCALER6D_FETCHER_STATUS), + VC4_REG32(SCALER6D_FETCH_STATUS), + VC4_REG32(SCALER6D_HANDLE_ERROR), + VC4_REG32(SCALER6D_DISP0_CTRL0), + VC4_REG32(SCALER6D_DISP0_CTRL1), + VC4_REG32(SCALER6D_DISP0_BGND0), + VC4_REG32(SCALER6D_DISP0_BGND1), + VC4_REG32(SCALER6D_DISP0_LPTRS), + VC4_REG32(SCALER6D_DISP0_COB), + VC4_REG32(SCALER6D_DISP0_STATUS), + VC4_REG32(SCALER6D_DISP0_DL), + VC4_REG32(SCALER6D_DISP0_RUN), + VC4_REG32(SCALER6D_DISP1_CTRL0), + VC4_REG32(SCALER6D_DISP1_CTRL1), + VC4_REG32(SCALER6D_DISP1_BGND0), + VC4_REG32(SCALER6D_DISP1_BGND1), + VC4_REG32(SCALER6D_DISP1_LPTRS), + VC4_REG32(SCALER6D_DISP1_COB), + VC4_REG32(SCALER6D_DISP1_STATUS), + VC4_REG32(SCALER6D_DISP1_DL), + VC4_REG32(SCALER6D_DISP1_RUN), + VC4_REG32(SCALER6D_DISP2_CTRL0), + VC4_REG32(SCALER6D_DISP2_CTRL1), + VC4_REG32(SCALER6D_DISP2_BGND0), + VC4_REG32(SCALER6D_DISP2_BGND1), + VC4_REG32(SCALER6D_DISP2_LPTRS), + VC4_REG32(SCALER6D_DISP2_COB), + VC4_REG32(SCALER6D_DISP2_STATUS), + VC4_REG32(SCALER6D_DISP2_DL), + VC4_REG32(SCALER6D_DISP2_RUN), + VC4_REG32(SCALER6D_EOLN), + VC4_REG32(SCALER6D_DL_STATUS), + VC4_REG32(SCALER6D_QOS0), + VC4_REG32(SCALER6D_PROF0), + VC4_REG32(SCALER6D_QOS1), + VC4_REG32(SCALER6D_PROF1), + VC4_REG32(SCALER6D_QOS2), + VC4_REG32(SCALER6D_PROF2), + VC4_REG32(SCALER6D_PRI_MAP0), + VC4_REG32(SCALER6D_PRI_MAP1), + VC4_REG32(SCALER6D_HISTCTRL), + VC4_REG32(SCALER6D_HISTBIN0), + VC4_REG32(SCALER6D_HISTBIN1), + VC4_REG32(SCALER6D_HISTBIN2), + VC4_REG32(SCALER6D_HISTBIN3), + VC4_REG32(SCALER6D_HISTBIN4), + VC4_REG32(SCALER6D_HISTBIN5), + VC4_REG32(SCALER6D_HISTBIN6), + VC4_REG32(SCALER6D_HISTBIN7), + VC4_REG32(SCALER6D_HVS_ID), +}; + void vc4_hvs_dump_state(struct vc4_hvs *hvs) { struct drm_device *drm =3D &hvs->vc4->base; @@ -419,6 +479,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, un= signed int fifo) =20 switch (vc4->gen) { case VC4_GEN_6_C: + case VC4_GEN_6_D: field =3D VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_STATUS(fifo)), SCALER6_DISPX_STATUS_FRCNT); break; @@ -525,6 +586,7 @@ int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, u= nsigned int output) } =20 case VC4_GEN_6_C: + case VC4_GEN_6_D: switch (output) { case 0: return 0; @@ -1132,6 +1194,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, break; =20 case VC4_GEN_6_C: + case VC4_GEN_6_D: dlist_start =3D HVS_BOOTLOADER_DLIST_END; =20 /* @@ -1177,6 +1240,7 @@ struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, break; =20 case VC4_GEN_6_C: + case VC4_GEN_6_D: /* * If we are running a test, it means that we can't * access a register. Use a plausible size then. @@ -1317,6 +1381,17 @@ static int vc4_hvs_hw_init(struct vc4_hvs *hvs) #define CFC1_N_MA_CSC_COEFF_C23(x) (0xa03c + ((x) * 0x3000)) #define CFC1_N_MA_CSC_COEFF_C24(x) (0xa040 + ((x) * 0x3000)) =20 +#define SCALER_PI_CMP_CSC_RED0(x) (0x200 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_RED1(x) (0x204 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_RED_CLAMP(x) (0x208 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_CFG(x) (0x20c + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_GREEN0(x) (0x210 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_GREEN1(x) (0x214 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_GREEN_CLAMP(x) (0x218 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_BLUE0(x) (0x220 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_BLUE1(x) (0x224 + ((x) * 0x40)) +#define SCALER_PI_CMP_CSC_BLUE_CLAMP(x) (0x228 + ((x) * 0x40)) + /* 4 S2.22 multiplication factors, and 1 S9.15 addititive element for each= of 3 * output components */ @@ -1384,31 +1459,46 @@ static int vc6_hvs_hw_init(struct vc4_hvs *hvs) VC4_SET_FIELD(15, SCALER6_CONTROL_MAX_REQS)); =20 /* Set HVS arbiter priority to max */ - HVS_WRITE(SCALER6_PRI_MAP0, 0xffffffff); - HVS_WRITE(SCALER6_PRI_MAP1, 0xffffffff); - - for (i =3D 0; i < 6; i++) { - coeffs =3D &csc_coeffs[i / 3][i % 3]; - - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C00(i), coeffs->csc[0][0]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C01(i), coeffs->csc[0][1]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C02(i), coeffs->csc[0][2]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C03(i), coeffs->csc[0][3]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C04(i), coeffs->csc[0][4]); - - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C10(i), coeffs->csc[1][0]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C11(i), coeffs->csc[1][1]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C12(i), coeffs->csc[1][2]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C13(i), coeffs->csc[1][3]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C14(i), coeffs->csc[1][4]); - - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C20(i), coeffs->csc[2][0]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C21(i), coeffs->csc[2][1]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C22(i), coeffs->csc[2][2]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C23(i), coeffs->csc[2][3]); - HVS_WRITE(CFC1_N_MA_CSC_COEFF_C24(i), coeffs->csc[2][4]); - - HVS_WRITE(CFC1_N_NL_CSC_CTRL(i), BIT(15)); + HVS_WRITE(SCALER6(PRI_MAP0), 0xffffffff); + HVS_WRITE(SCALER6(PRI_MAP1), 0xffffffff); + + if (hvs->vc4->gen =3D=3D VC4_GEN_6_C) { + for (i =3D 0; i < 6; i++) { + coeffs =3D &csc_coeffs[i / 3][i % 3]; + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C00(i), coeffs->csc[0][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C01(i), coeffs->csc[0][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C02(i), coeffs->csc[0][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C03(i), coeffs->csc[0][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C04(i), coeffs->csc[0][4]); + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C10(i), coeffs->csc[1][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C11(i), coeffs->csc[1][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C12(i), coeffs->csc[1][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C13(i), coeffs->csc[1][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C14(i), coeffs->csc[1][4]); + + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C20(i), coeffs->csc[2][0]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C21(i), coeffs->csc[2][1]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C22(i), coeffs->csc[2][2]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C23(i), coeffs->csc[2][3]); + HVS_WRITE(CFC1_N_MA_CSC_COEFF_C24(i), coeffs->csc[2][4]); + + HVS_WRITE(CFC1_N_NL_CSC_CTRL(i), BIT(15)); + } + } else { + for (i =3D 0; i < 8; i++) { + HVS_WRITE(SCALER_PI_CMP_CSC_RED0(i), 0x1f002566); + HVS_WRITE(SCALER_PI_CMP_CSC_RED1(i), 0x3994); + HVS_WRITE(SCALER_PI_CMP_CSC_RED_CLAMP(i), 0xfff00000); + HVS_WRITE(SCALER_PI_CMP_CSC_CFG(i), 0x1); + HVS_WRITE(SCALER_PI_CMP_CSC_GREEN0(i), 0x18002566); + HVS_WRITE(SCALER_PI_CMP_CSC_GREEN1(i), 0xf927eee2); + HVS_WRITE(SCALER_PI_CMP_CSC_GREEN_CLAMP(i), 0xfff00000); + HVS_WRITE(SCALER_PI_CMP_CSC_BLUE0(i), 0x18002566); + HVS_WRITE(SCALER_PI_CMP_CSC_BLUE1(i), 0x43d80000); + HVS_WRITE(SCALER_PI_CMP_CSC_BLUE_CLAMP(i), 0xfff00000); + } } =20 return 0; @@ -1479,26 +1569,27 @@ static int vc4_hvs_cob_init(struct vc4_hvs *hvs) break; =20 case VC4_GEN_6_C: + case VC4_GEN_6_D: #define VC6_COB_LINE_WIDTH 3840 #define VC6_COB_NUM_LINES 4 base =3D 0; top =3D 3840; =20 - HVS_WRITE(SCALER6_DISP2_COB, + HVS_WRITE(SCALER6_DISPX_COB(2), VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); =20 base =3D top + 16; top +=3D VC6_COB_LINE_WIDTH * VC6_COB_NUM_LINES; =20 - HVS_WRITE(SCALER6_DISP1_COB, + HVS_WRITE(SCALER6_DISPX_COB(1), VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); =20 base =3D top + 16; top +=3D VC6_COB_LINE_WIDTH * VC6_COB_NUM_LINES; =20 - HVS_WRITE(SCALER6_DISP0_COB, + HVS_WRITE(SCALER6_DISPX_COB(0), VC4_SET_FIELD(top, SCALER6_DISPX_COB_TOP) | VC4_SET_FIELD(base, SCALER6_DISPX_COB_BASE)); break; @@ -1529,13 +1620,16 @@ static int vc4_hvs_bind(struct device *dev, struct = device *master, void *data) =20 hvs->regset.base =3D hvs->regs; =20 - if (vc4->gen >=3D VC4_GEN_6_C) { + if (vc4->gen =3D=3D VC4_GEN_6_C) { hvs->regset.regs =3D vc6_hvs_regs; hvs->regset.nregs =3D ARRAY_SIZE(vc6_hvs_regs); =20 if (VC4_GET_FIELD(HVS_READ(SCALER6_VERSION), SCALER6_VERSION) =3D=3D - SCALER6_VERSION_D0) + SCALER6_VERSION_D0) { vc4->gen =3D VC4_GEN_6_D; + hvs->regset.regs =3D vc6_d_hvs_regs; + hvs->regset.nregs =3D ARRAY_SIZE(vc6_d_hvs_regs); + } } else { hvs->regset.regs =3D vc4_hvs_regs; hvs->regset.nregs =3D ARRAY_SIZE(vc4_hvs_regs); diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 3fcfc265e1e2..ce65e152876e 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -328,7 +328,7 @@ static void vc6_hvs_pv_muxing_commit(struct vc4_dev *vc= 4, struct drm_crtc *crtc; unsigned int i; =20 - WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_6_C); + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_6_C && vc4->gen !=3D VC4_GEN_6_D); =20 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); @@ -451,6 +451,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_st= ate *state) break; =20 case VC4_GEN_6_C: + case VC4_GEN_6_D: vc6_hvs_pv_muxing_commit(vc4, state); break; =20 diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index df44a4a4009f..0efe340f99d4 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -19,6 +19,20 @@ =20 #define VC4_GET_FIELD(word, field) FIELD_GET(field##_MASK, word) =20 +#define VC6_SET_FIELD(value, field) \ + ({ \ + WARN_ON(!FIELD_FIT(hvs->vc4->gen =3D=3D VC4_GEN_6_C ? \ + SCALER6_ ## field ## _MASK : \ + SCALER6D_ ## field ## _MASK, value));\ + FIELD_PREP(hvs->vc4->gen =3D=3D VC4_GEN_6_C ? \ + SCALER6_ ## field ## _MASK : \ + SCALER6D_ ## field ## _MASK, value); \ + }) + +#define VC6_GET_FIELD(word, field) FIELD_GET(hvs->vc4->gen =3D=3D VC4_GEN_= 6_C ? \ + SCALER6_ ## field ## _MASK : \ + SCALER6D_ ## field ## _MASK, word) + #define V3D_IDENT0 0x00000 # define V3D_EXPECTED_IDENT0 \ ((2 << 24) | \ @@ -548,8 +562,9 @@ #define SCALER6_HANDLE_ERROR 0x0000002c =20 #define SCALER6_DISP0_CTRL0 0x00000030 -#define SCALER6_DISPX_CTRL0(x) \ - (SCALER6_DISP0_CTRL0 + ((x) * (SCALER6_DISP1_CTRL0 - SCALER6_DISP0_CTRL0)= )) +#define SCALER6_DISPX_CTRL0(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_CTRL0 + ((x) * (SCALER6_DISP1_CTRL0 - SCALER6_DISP0_CTRL0)= )) : \ + (SCALER6D_DISP0_CTRL0 + ((x) * (SCALER6D_DISP1_CTRL0 - SCALER6D_DISP0_CTR= L0)))) # define SCALER6_DISPX_CTRL0_ENB BIT(31) # define SCALER6_DISPX_CTRL0_RESET BIT(30) # define SCALER6_DISPX_CTRL0_FWIDTH_MASK VC4_MASK(28, 16) @@ -558,30 +573,34 @@ # define SCALER6_DISPX_CTRL0_LINES_MASK VC4_MASK(12, 0) =20 #define SCALER6_DISP0_CTRL1 0x00000034 -#define SCALER6_DISPX_CTRL1(x) \ - (SCALER6_DISP0_CTRL1 + ((x) * (SCALER6_DISP1_CTRL1 - SCALER6_DISP0_CTRL1)= )) +#define SCALER6_DISPX_CTRL1(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_CTRL1 + ((x) * (SCALER6_DISP1_CTRL1 - SCALER6_DISP0_CTRL1)= )) : \ + (SCALER6D_DISP0_CTRL1 + ((x) * (SCALER6D_DISP1_CTRL1 - SCALER6D_DISP0_CTR= L1)))) # define SCALER6_DISPX_CTRL1_BGENB BIT(8) # define SCALER6_DISPX_CTRL1_INTLACE BIT(0) =20 #define SCALER6_DISP0_BGND 0x00000038 -#define SCALER6_DISPX_BGND(x) \ - (SCALER6_DISP0_BGND + ((x) * (SCALER6_DISP1_BGND - SCALER6_DISP0_BGND))) +#define SCALER6_DISPX_BGND(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_BGND + ((x) * (SCALER6_DISP1_BGND - SCALER6_DISP0_BGND))) = : \ + (SCALER6D_DISP0_BGND + ((x) * (SCALER6D_DISP1_BGND - SCALER6D_DISP0_BGND)= ))) =20 #define SCALER6_DISP0_LPTRS 0x0000003c -#define SCALER6_DISPX_LPTRS(x) \ - (SCALER6_DISP0_LPTRS + ((x) * (SCALER6_DISP1_LPTRS - SCALER6_DISP0_LPTRS)= )) +#define SCALER6_DISPX_LPTRS(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_LPTRS + ((x) * (SCALER6_DISP1_LPTRS - SCALER6_DISP0_LPTRS)= )) : \ + (SCALER6D_DISP0_LPTRS + ((x) * (SCALER6D_DISP1_LPTRS - SCALER6D_DISP0_LPT= RS)))) # define SCALER6_DISPX_LPTRS_HEADE_MASK VC4_MASK(11, 0) =20 #define SCALER6_DISP0_COB 0x00000040 -#define SCALER6_DISPX_COB(x) \ - (SCALER6_DISP0_COB + ((x) * (SCALER6_DISP1_COB - SCALER6_DISP0_COB))) +#define SCALER6_DISPX_COB(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_COB + ((x) * (SCALER6_DISP1_COB - SCALER6_DISP0_COB))) : \ + (SCALER6D_DISP0_COB + ((x) * (SCALER6D_DISP1_COB - SCALER6D_DISP0_COB)))) # define SCALER6_DISPX_COB_TOP_MASK VC4_MASK(31, 16) # define SCALER6_DISPX_COB_BASE_MASK VC4_MASK(15, 0) =20 #define SCALER6_DISP0_STATUS 0x00000044 - -#define SCALER6_DISPX_STATUS(x) \ - (SCALER6_DISP0_STATUS + ((x) * (SCALER6_DISP1_STATUS - SCALER6_DISP0_STAT= US))) +#define SCALER6_DISPX_STATUS(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_STATUS + ((x) * (SCALER6_DISP1_STATUS - SCALER6_DISP0_STAT= US))) : \ + (SCALER6D_DISP0_STATUS + ((x) * (SCALER6D_DISP1_STATUS - SCALER6D_DISP0_S= TATUS)))) # define SCALER6_DISPX_STATUS_EMPTY BIT(22) # define SCALER6_DISPX_STATUS_FRCNT_MASK VC4_MASK(21, 16) # define SCALER6_DISPX_STATUS_OFIELD BIT(15) @@ -594,8 +613,9 @@ =20 #define SCALER6_DISP0_DL 0x00000048 =20 -#define SCALER6_DISPX_DL(x) \ - (SCALER6_DISP0_DL + ((x) * (SCALER6_DISP1_DL - SCALER6_DISP0_DL))) +#define SCALER6_DISPX_DL(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? \ + (SCALER6_DISP0_DL + ((x) * (SCALER6_DISP1_DL - SCALER6_DISP0_DL))) : \ + (SCALER6D_DISP0_DL + ((x) * (SCALER6D_DISP1_DL - SCALER6D_DISP0_DL)))) # define SCALER6_DISPX_DL_LACT_MASK VC4_MASK(11, 0) =20 #define SCALER6_DISP0_RUN 0x0000004c @@ -653,6 +673,73 @@ #define SCALER6_BAD_UPM 0x0000022c #define SCALER6_BAD_AXI 0x00000230 =20 +#define SCALER6D_VERSION 0x00000000 +#define SCALER6D_CXM_SIZE 0x00000004 +#define SCALER6D_LBM_SIZE 0x00000008 +#define SCALER6D_UBM_SIZE 0x0000000c +#define SCALER6D_COBA_SIZE 0x00000010 +#define SCALER6D_COB_SIZE 0x00000014 +#define SCALER6D_CONTROL 0x00000020 +#define SCALER6D_FETCHER_STATUS 0x00000024 +#define SCALER6D_FETCH_STATUS 0x00000028 +#define SCALER6D_HANDLE_ERROR 0x0000002c +#define SCALER6D_EOLN 0x00000030 +#define SCALER6D_DL_STATUS 0x00000034 +#define SCALER6D_PRI_MAP0 0x00000038 +#define SCALER6D_PRI_MAP1 0x0000003c +#define SCALER6D_HISTCTRL 0x000000d0 +#define SCALER6D_HISTBIN0 0x000000d4 +#define SCALER6D_HISTBIN1 0x000000d8 +#define SCALER6D_HISTBIN2 0x000000dc +#define SCALER6D_HISTBIN3 0x000000e0 +#define SCALER6D_HISTBIN4 0x000000e4 +#define SCALER6D_HISTBIN5 0x000000e8 +#define SCALER6D_HISTBIN6 0x000000ec +#define SCALER6D_HISTBIN7 0x000000f0 +#define SCALER6D_HVS_ID 0x000000fc + +#define SCALER6D_DISP0_CTRL0 0x00000100 +#define SCALER6D_DISP0_CTRL1 0x00000104 +#define SCALER6D_DISP0_BGND 0x00000108 +#define SCALER6D_DISP0_LPTRS 0x00000110 +#define SCALER6D_DISP0_COB 0x00000114 +#define SCALER6D_DISP0_STATUS 0x00000118 +#define SCALER6D_DISP0_CTRL0 0x00000100 +#define SCALER6D_DISP0_CTRL1 0x00000104 +#define SCALER6D_DISP0_BGND0 0x00000108 +#define SCALER6D_DISP0_BGND1 0x0000010c +#define SCALER6D_DISP0_LPTRS 0x00000110 +#define SCALER6D_DISP0_COB 0x00000114 +#define SCALER6D_DISP0_STATUS 0x00000118 +#define SCALER6D_DISP0_DL 0x0000011c +#define SCALER6D_DISP0_RUN 0x00000120 +#define SCALER6D_QOS0 0x00000124 +#define SCALER6D_PROF0 0x00000128 +#define SCALER6D_DISP1_CTRL0 0x00000140 +#define SCALER6D_DISP1_CTRL1 0x00000144 +#define SCALER6D_DISP1_BGND0 0x00000148 +#define SCALER6D_DISP1_BGND1 0x0000014c +#define SCALER6D_DISP1_LPTRS 0x00000150 +#define SCALER6D_DISP1_COB 0x00000154 +#define SCALER6D_DISP1_STATUS 0x00000158 +#define SCALER6D_DISP1_DL 0x0000015c +#define SCALER6D_DISP1_RUN 0x00000160 +#define SCALER6D_QOS1 0x00000164 +#define SCALER6D_PROF1 0x00000168 +#define SCALER6D_DISP2_CTRL0 0x00000180 +#define SCALER6D_DISP2_CTRL1 0x00000184 +#define SCALER6D_DISP2_BGND0 0x00000188 +#define SCALER6D_DISP2_BGND1 0x0000018c +#define SCALER6D_DISP2_LPTRS 0x00000190 +#define SCALER6D_DISP2_COB 0x00000194 +#define SCALER6D_DISP2_STATUS 0x00000198 +#define SCALER6D_DISP2_DL 0x0000019c +#define SCALER6D_DISP2_RUN 0x000001a0 +#define SCALER6D_QOS2 0x000001a4 +#define SCALER6D_PROF2 0x000001a8 + +#define SCALER6(x) ((hvs->vc4->gen =3D=3D VC4_GEN_6_C) ? SCALER6_ ## x : S= CALER6D_ ## x) + # define VC4_HDMI_SW_RESET_FORMAT_DETECT BIT(1) # define VC4_HDMI_SW_RESET_HDMI BIT(0) =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 DA5C4216DE4 for ; Fri, 25 Oct 2024 17:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876590; cv=none; b=r2K/l6XN5dzbFNsjbJit5Sxl3sJFrwwhn6v1Q8FHIVmU2ESrVmKPjOESvYDkkQ1zTeDI5ssXsqZcveek7tymCMKhxEn73OpbmjypY+tAGUd75K13iCkw+c3xCUbGHh7Rq95jJGa15OTQRks5RKzt95doNvONWrNEzxHYuJcIEfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876590; c=relaxed/simple; bh=28fr7uvMBpZYxXaf6t74o1B6u0IzpxyUUElRCfLdqK4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HCgiJwqMSF8JbMyYQkCky4whG2mO6VvWPsHg/AtSTawCdTPzTpIjLrC5eWmXAgSw3cNrblkvNz1XAi8WR68WMQQPwLk81lOCf6WV8Sp9PnVg3nF5f8t4SW+2cygTVw0tn94SSk6TPRHoub8HdAL0AsL39mcnvI4CfS3yPTxoV10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=CyPAcnns; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="CyPAcnns" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d4c482844so1395562f8f.0 for ; Fri, 25 Oct 2024 10:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876584; x=1730481384; 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=yRFd61DSpngeCNNfWF0bSZlBVGY7r+lkqUcR/WDRUy8=; b=CyPAcnnsKxP8arfKKgfo6JiGfLj64y25GAefEGmyI6Sf1SsxypOcEE0VOs+MTymUa0 zRiUFeBFmRRApE9NTLgQJLI/9TtO/1z59O1JD0UV52LbDqOsnDNxzPHK72bFH3PcCLIg +NVNqyYki85ruN8dh3gtUH2dAs99TTN//CcY6PhckbeF26Cp+uPaIFHRgUKT6yPv2dbT z7Hnd0Y3ORjz6GqJa4xMAyXUo4qE8xNpiMCQghqxMF55llnYd8etayWr4SlcX6u6mjud S9LlUyXy60FAVjg1A7GFwnCSz+3GW5OF6IAFrDwx9KxkVxSobIN/wkO8DXZcqZQqnMHt oh1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876584; x=1730481384; 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=yRFd61DSpngeCNNfWF0bSZlBVGY7r+lkqUcR/WDRUy8=; b=LnTUoxtJ4yuBCF09jr44BE9Rj62oPSkaEYJwcrj4yFoqbOM2jJcHo8ZXavMsT50UBK JP1DrkiVOc+D5uzYI4aVuoCmg4ECM76Nlgt2FYKWJeFGKTbwfR4RkQxLpk1gOKz9qgNR aFJ5mx4rO2Okf9lr/Aoy6jNlo75JZ3Hv39aLQzIYlD3k4fZ1CoYlUgpHI4QgQEoQ1O8R rAGhGWJUSjudrIoLImRplDcWyCifa6S90BOl0CVn7W0r3WJmJLM9mOpj6i+6w67Qyy14 tRyV9jy3d4tvWXXXixO7U8IREduJHbfBNou1c8BpxOVnALjsqpkVjaZSfWr1c+iaykWv BxPg== X-Forwarded-Encrypted: i=1; AJvYcCXrkGZOLdgAB33erZeDu+KU5J5HPVMXj/PRq0hWkqRlIpzIDVKIMkMZ0GnRxAxnV6+aU+DMi2JdMdQ5II4=@vger.kernel.org X-Gm-Message-State: AOJu0YyYgarIVIVnZ+nzSA7uRpvuJ8S1R7pdUvgLv9LabEdY159RGCDD l8yF9i9wm7qG8HxREuyrApw3XUp2xvNZADz8CIelHNsk+F+UmD84YgqfyMWcYPg= X-Google-Smtp-Source: AGHT+IE5ggZ/+MnjT/M2pSrBXb7CHgqVlwXWTb2QVua+jciV8EenwyStxQYCUAAVVRcTsB77bKhFsQ== X-Received: by 2002:a5d:6946:0:b0:37c:d2f0:7331 with SMTP id ffacd0b85a97d-38060fff529mr184356f8f.0.1729876584546; Fri, 25 Oct 2024 10:16:24 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:24 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:55 +0100 Subject: [PATCH v2 24/36] drm/vc4: plane: Add support for 2712 D-step. Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-24-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 There are a few minor changes in the display list generation for the D-step of the chip, so add them. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_plane.c | 72 ++++++++++++++++++++++++++++++-------= ---- drivers/gpu/drm/vc4/vc4_regs.h | 9 ++++-- 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index 5749287f6e3c..205aea3ed419 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -1134,25 +1134,53 @@ static u32 vc4_hvs4_get_alpha_blend_mode(struct drm= _plane_state *state) =20 static u32 vc4_hvs5_get_alpha_blend_mode(struct drm_plane_state *state) { - if (!state->fb->format->has_alpha) - return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_FIXED, - SCALER5_CTL2_ALPHA_MODE); + struct drm_device *dev =3D state->state->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(dev); =20 - switch (state->pixel_blend_mode) { - case DRM_MODE_BLEND_PIXEL_NONE: - return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_FIXED, - SCALER5_CTL2_ALPHA_MODE); + switch (vc4->gen) { default: - case DRM_MODE_BLEND_PREMULTI: - return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_PIPELINE, - SCALER5_CTL2_ALPHA_MODE) | - SCALER5_CTL2_ALPHA_PREMULT; - case DRM_MODE_BLEND_COVERAGE: - return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_PIPELINE, - SCALER5_CTL2_ALPHA_MODE); + case VC4_GEN_5: + case VC4_GEN_6_C: + if (!state->fb->format->has_alpha) + return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_FIXED, + SCALER5_CTL2_ALPHA_MODE); + + switch (state->pixel_blend_mode) { + case DRM_MODE_BLEND_PIXEL_NONE: + return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_FIXED, + SCALER5_CTL2_ALPHA_MODE); + default: + case DRM_MODE_BLEND_PREMULTI: + return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_PIPELINE, + SCALER5_CTL2_ALPHA_MODE) | + SCALER5_CTL2_ALPHA_PREMULT; + case DRM_MODE_BLEND_COVERAGE: + return VC4_SET_FIELD(SCALER5_CTL2_ALPHA_MODE_PIPELINE, + SCALER5_CTL2_ALPHA_MODE); + } + case VC4_GEN_6_D: + /* 2712-D configures fixed alpha mode in CTL0 */ + return state->pixel_blend_mode =3D=3D DRM_MODE_BLEND_PREMULTI ? + SCALER5_CTL2_ALPHA_PREMULT : 0; } } =20 +static u32 vc4_hvs6_get_alpha_mask_mode(struct drm_plane_state *state) +{ + struct drm_device *dev =3D state->state->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(dev); + + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_6_C && vc4->gen !=3D VC4_GEN_6_D); + + if (vc4->gen =3D=3D VC4_GEN_6_D && + (!state->fb->format->has_alpha || + state->pixel_blend_mode =3D=3D DRM_MODE_BLEND_PIXEL_NONE)) + return VC4_SET_FIELD(SCALER6D_CTL0_ALPHA_MASK_FIXED, + SCALER6_CTL0_ALPHA_MASK); + + return VC4_SET_FIELD(SCALER6_CTL0_ALPHA_MASK_NONE, SCALER6_CTL0_ALPHA_MAS= K); +} + /* Writes out a full display list for an active plane to the plane's * private dlist state. */ @@ -1645,14 +1673,13 @@ static int vc4_plane_mode_set(struct drm_plane *pla= ne, static u32 vc6_plane_get_csc_mode(struct vc4_plane_state *vc4_state) { struct drm_plane_state *state =3D &vc4_state->base; + struct vc4_dev *vc4 =3D to_vc4_dev(state->plane->dev); u32 ret =3D 0; =20 if (vc4_state->is_yuv) { enum drm_color_encoding color_encoding =3D state->color_encoding; enum drm_color_range color_range =3D state->color_range; =20 - ret |=3D SCALER6_CTL2_CSC_ENABLE; - /* CSC pre-loaded with: * 0 =3D BT601 limited range * 1 =3D BT709 limited range @@ -1666,8 +1693,15 @@ static u32 vc6_plane_get_csc_mode(struct vc4_plane_s= tate *vc4_state) if (color_range > DRM_COLOR_YCBCR_FULL_RANGE) color_range =3D DRM_COLOR_YCBCR_LIMITED_RANGE; =20 - ret |=3D VC4_SET_FIELD(color_encoding + (color_range * 3), - SCALER6_CTL2_BRCM_CFC_CONTROL); + if (vc4->gen =3D=3D VC4_GEN_6_C) { + ret |=3D SCALER6C_CTL2_CSC_ENABLE; + ret |=3D VC4_SET_FIELD(color_encoding + (color_range * 3), + SCALER6C_CTL2_BRCM_CFC_CONTROL); + } else { + ret |=3D SCALER6D_CTL2_CSC_ENABLE; + ret |=3D VC4_SET_FIELD(color_encoding + (color_range * 3), + SCALER6D_CTL2_BRCM_CFC_CONTROL); + } } =20 return ret; @@ -1880,7 +1914,7 @@ static int vc6_plane_mode_set(struct drm_plane *plane, vc4_dlist_write(vc4_state, SCALER6_CTL0_VALID | VC4_SET_FIELD(tiling, SCALER6_CTL0_ADDR_MODE) | - VC4_SET_FIELD(0, SCALER6_CTL0_ALPHA_MASK) | + vc4_hvs6_get_alpha_mask_mode(state) | (vc4_state->is_unity ? SCALER6_CTL0_UNITY : 0) | VC4_SET_FIELD(format->pixel_order_hvs5, SCALER6_CTL0_ORDERRGBA) | VC4_SET_FIELD(scl1, SCALER6_CTL0_SCL1_MODE) | diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 0efe340f99d4..0046bdb7ca32 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -1194,6 +1194,9 @@ enum hvs_pixel_format { #define SCALER5_CTL2_ALPHA_MASK VC4_MASK(15, 4) #define SCALER5_CTL2_ALPHA_SHIFT 4 =20 +#define SCALER6D_CTL2_CSC_ENABLE BIT(19) +#define SCALER6D_CTL2_BRCM_CFC_CONTROL_MASK VC4_MASK(22, 20) + #define SCALER_POS1_SCL_HEIGHT_MASK VC4_MASK(27, 16) #define SCALER_POS1_SCL_HEIGHT_SHIFT 16 =20 @@ -1347,6 +1350,8 @@ enum hvs_pixel_format { #define SCALER6_CTL0_ADDR_MODE_UIF 4 =20 #define SCALER6_CTL0_ALPHA_MASK_MASK VC4_MASK(19, 18) +#define SCALER6_CTL0_ALPHA_MASK_NONE 0 +#define SCALER6D_CTL0_ALPHA_MASK_FIXED 3 #define SCALER6_CTL0_UNITY BIT(15) #define SCALER6_CTL0_ORDERRGBA_MASK VC4_MASK(14, 13) #define SCALER6_CTL0_SCL1_MODE_MASK VC4_MASK(10, 8) @@ -1361,8 +1366,8 @@ enum hvs_pixel_format { #define SCALER6_CTL2_ALPHA_PREMULT BIT(29) #define SCALER6_CTL2_ALPHA_MIX BIT(28) #define SCALER6_CTL2_BFG BIT(26) -#define SCALER6_CTL2_CSC_ENABLE BIT(25) -#define SCALER6_CTL2_BRCM_CFC_CONTROL_MASK VC4_MASK(18, 16) +#define SCALER6C_CTL2_CSC_ENABLE BIT(25) +#define SCALER6C_CTL2_BRCM_CFC_CONTROL_MASK VC4_MASK(18, 16) #define SCALER6_CTL2_ALPHA_MASK VC4_MASK(15, 4) =20 #define SCALER6_POS1_SCL_LINES_MASK VC4_MASK(28, 16) --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 1B6EC228034 for ; Fri, 25 Oct 2024 17:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876591; cv=none; b=Uiy61PHWCAVlusADNMVIdWZkExu15mrE2gZXt/RxzqJ0JiE49KCX4K+ktZJH3aKIjwPjMoV4mStxavkBwlDb+LyhwKY1sQidbJG22iH/HvjhHr0ZWVqy2/utP3sHjO4nDOJiaRoJW1em5vSK6k/r960IIR71gAEIAaQQsKS4Z8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876591; c=relaxed/simple; bh=i2OCo1FfMzQGcFXr+C+kMhl9+qGLNMJKAixqjTN6j7g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D+B2Wt+Hri/6z0sR3uDegOAl7XWFWU45D0zPAwZnHsL3OBPPOjZWiO40SJ+up6fuK3Vz6UpLksXtaRuSkWADwUcmqd1P7jDrKSh6rTZQNLwzoNk+PRJX7mc8RXjBdTZIFc4gUvbzHZUtC1cPAtkBT2MlVE7kSxUVIUF7QIaBzCo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=A3YiUSVe; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="A3YiUSVe" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4314f38d274so29265745e9.1 for ; Fri, 25 Oct 2024 10:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876586; x=1730481386; 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=hzwKuwbOKIs7buN3elcmt1B0UWigEPFh+7jf57NrLvk=; b=A3YiUSVePoo/LnVkHb1HA39PgQGTvOrLMFuAi/6jYhzWHC7+51TuxUxRpEN+FMAuET LwJV0Jzp3KEyETNWVmdEUkUmIN4UgBS5CaR6eCSrOExWWDbJuqb+deNluPWz9EsZYAPy sMG5IH9OW/hHdiwmUTjzmjVG8N9Mz7hi4JZ7kdCl4nm2vXkr9nHhsDz770mrwzNBkHVo dYs4gPj77UdMbWTPAZ1bZGwiVvIKIoo+7Y8jeAqgvfYYOC9P2O8kHIWWsPvspjnFcSwn E+4lA9pE6/lCw6ByZq5KmH6wI0VIgFpuiA6gxumz+TRI3LZ6YXwH76oA2mjaDMko9WVK sg2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876586; x=1730481386; 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=hzwKuwbOKIs7buN3elcmt1B0UWigEPFh+7jf57NrLvk=; b=Pq9VdndRCwwDc6tLE63qekCJtRtoy+WMPU+ykrRJA93sS9/0QcVTnkZ9LQ3qT14qXz /xkW1CShl0OkqezdmQnP2c2kqQs/YdjFsYYbKtiYiY66F4MTqx1Kw2XRuTOK825h14vf seKWoI03/FaN6cu0Ga+5CPFWf8EAy251oNIxBtN8vufv4vdo+FN4vA61wKFg7xf6P0Jt R8qGiSYzBoUpHnW5eE3qzWmY10JJpEEFLyyeRqJUgBw1dxieDb2DX+xQPAJrEEmCPk/X 0xsHCXmzxqL/3ixv4hnfKAaaEAR5bS+SsDSc7wrzzrVjAhSy4nkNsiDLlt4ZThKxE8Og xYwQ== X-Forwarded-Encrypted: i=1; AJvYcCXq69u6jLh4C0TH+6lWETDZFZW1Oxh6jmHXhz8xr1bJdjj8oMRichUzucISTZmSWlMUeFwG8qLcS+8gLSg=@vger.kernel.org X-Gm-Message-State: AOJu0YyZrQs594Qyct093aKDaZNu9gtOR7quAeSzcRwccW6H16YjBZUa 5+T2f8IsBpy01eUkRCK8lA5UF4QdXwZchdfGJ/BfWrYhSD5gfAeGVschS1NR4Y4= X-Google-Smtp-Source: AGHT+IH7L5gaDfJvqohyrKgLBPDvmZg9d0+cQq0c6/lsK6b6rkJJPh7+KHzVz4tGoS7jUbr1/odWlA== X-Received: by 2002:a05:600c:4f86:b0:431:52a3:d9d5 with SMTP id 5b1f17b1804b1-43184157850mr112895305e9.0.1729876585617; Fri, 25 Oct 2024 10:16:25 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:25 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:56 +0100 Subject: [PATCH v2 25/36] drm/vc4: hdmi: Support 2712 D-step register map Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-25-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 The D-step has increased FIFO sizes of the MAI_THR blocks, resulting in changes to the register masking. Add support for it. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 19 +++++++++++++++++-- drivers/gpu/drm/vc4/vc4_regs.h | 9 +++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1456966732ec..b9fc4d981cf4 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2123,18 +2123,33 @@ static int vc4_hdmi_audio_prepare(struct device *de= v, void *data, VC4_HDMI_AUDIO_PACKET_CEA_MASK); =20 /* Set the MAI threshold */ - if (vc4->gen >=3D VC4_GEN_5) + switch (vc4->gen) { + case VC4_GEN_6_D: + HDMI_WRITE(HDMI_MAI_THR, + VC4_SET_FIELD(0x10, VC6_D_HD_MAI_THR_PANICHIGH) | + VC4_SET_FIELD(0x10, VC6_D_HD_MAI_THR_PANICLOW) | + VC4_SET_FIELD(0x1c, VC6_D_HD_MAI_THR_DREQHIGH) | + VC4_SET_FIELD(0x1c, VC6_D_HD_MAI_THR_DREQLOW)); + break; + case VC4_GEN_6_C: + case VC4_GEN_5: HDMI_WRITE(HDMI_MAI_THR, VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) | VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) | VC4_SET_FIELD(0x1c, VC4_HD_MAI_THR_DREQHIGH) | VC4_SET_FIELD(0x1c, VC4_HD_MAI_THR_DREQLOW)); - else + break; + case VC4_GEN_4: HDMI_WRITE(HDMI_MAI_THR, VC4_SET_FIELD(0x8, VC4_HD_MAI_THR_PANICHIGH) | VC4_SET_FIELD(0x8, VC4_HD_MAI_THR_PANICLOW) | VC4_SET_FIELD(0x6, VC4_HD_MAI_THR_DREQHIGH) | VC4_SET_FIELD(0x8, VC4_HD_MAI_THR_DREQLOW)); + break; + default: + drm_err(drm, "Unknown VC4 generation: %d", vc4->gen); + break; + } =20 HDMI_WRITE(HDMI_MAI_CONFIG, VC4_HDMI_MAI_CONFIG_BIT_REVERSE | diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index 0046bdb7ca32..27158be19952 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -987,6 +987,15 @@ enum { # define VC4_HD_MAI_THR_DREQLOW_MASK VC4_MASK(5, 0) # define VC4_HD_MAI_THR_DREQLOW_SHIFT 0 =20 +# define VC6_D_HD_MAI_THR_PANICHIGH_MASK VC4_MASK(29, 23) +# define VC6_D_HD_MAI_THR_PANICHIGH_SHIFT 23 +# define VC6_D_HD_MAI_THR_PANICLOW_MASK VC4_MASK(21, 15) +# define VC6_D_HD_MAI_THR_PANICLOW_SHIFT 15 +# define VC6_D_HD_MAI_THR_DREQHIGH_MASK VC4_MASK(13, 7) +# define VC6_D_HD_MAI_THR_DREQHIGH_SHIFT 7 +# define VC6_D_HD_MAI_THR_DREQLOW_MASK VC4_MASK(6, 0) +# define VC6_D_HD_MAI_THR_DREQLOW_SHIFT 0 + /* Divider from HDMI HSM clock to MAI serial clock. Sampling period * converges to N / (M + 1) cycles. */ --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 1CB7B22804C for ; Fri, 25 Oct 2024 17:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876594; cv=none; b=RdibVsWa+Sz9htG44+6VpnwVetxFpAZxWZaM2Y8b2nCXypNxnGFG5JGqHgJ3IafRcJtZO5jFvAG1drMjXPKjM162myxNLfaytdDwT3qSNW+Fi2gGZfc0F+aS4Tkq2HgHI/FP22w3HCAOa0CcBszDaYGg+pGLj1OnOtVI2+ybmr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876594; c=relaxed/simple; bh=IRVZ6Owu3T+A91WqZIsgEYkin9Y418WN74j99JtCWmY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sKkqr5iGhmk1jEvrhk6MxhkS7obrPEUolNNW75CyrX6pIn14npA+i4wFYlJHTwY/9ZC8Jher+gSWZdSUXflYh1ouxKCjASgSF0CSmDv8hts4ouFc3fQrbtx2Igo8z/T/YWN5qic+Z+6QjXfmD+Oua74zkZ2xRttvjVtUPJSFyww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=qT2re+Nx; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qT2re+Nx" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d8901cb98so2244154f8f.0 for ; Fri, 25 Oct 2024 10:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876586; x=1730481386; 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=FpgFdk3JtzocDW3WFzPDdBLFBiWF0X+yqUm+UTtblgc=; b=qT2re+NxFvZ75UR35dfmWb92+GcYbABMwrRPD6Zi9JsLbJTqcjbgi/Q2sBOOwEU3AD M6nKc2QmszPPabtEMdUS3PdHJM5smssb6OJGsz7H+L1gLMUOw98sCJdqeShCAR3aDb1d S3fq0KjrhE+KhrStX5ijFN/yZu91YUOPZzRac15DtWUVB/xe0PfDjRXWGBxR7Vu3HDQl CWSydZjxEQb5ZssLQZFoeI//3QoloV8h3eQTGelj3fZdT59DSOEZ8BV8z5rZ6Z358rI9 n9hhSa/Ah3KGtNCFfs70qL9cyQ/70PbgQVRwOkCgEmkFsWIP532TIFvEn489okiiBql9 d9GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876586; x=1730481386; 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=FpgFdk3JtzocDW3WFzPDdBLFBiWF0X+yqUm+UTtblgc=; b=UvNfyOONyjbY7/Lm9hrim1xZJLkdMrwtWXFCmUTGszmDWWlKIXoy+PHc1h1q4Pi6kX FDEUIy6rxAZh1chneVRKKn+sb4k8Cz3IywjujYnvGOGIQNTlgEzXISjJVx8djCdqI8yn 1vN4jeQFInL0NbmG2dqaTi4GHg9kq9gARXk9XRj39BPYizrOBLUlupCl/NQaYN3unSej Npe3NkUvM2ZBSYZp8QQlThRw/CPi2ras7ZfI+9ClIZDVlbcOM311Lz719Tbwft2OyiVp 1Cwsyof6tdApV1R4zIlTpn9g7+cnbq7SFojquUHk8ZxqeLEzpnZM5Nu727vj/4cgGpiZ mdGg== X-Forwarded-Encrypted: i=1; AJvYcCXOUJ7+UU7fwzz/9a08X4dAhrG6R2YqP8MBskvyYOhd5hSVUsi/TD++/2LQK2dgX3Ic1sSvH7UBwMBtRyE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxz6fXaSkoaYfnQdmV+xoI71Fge0O8rxBz/cCp+iR60F4zUbbMD vvWg5/A25Q8yqT11J6QeHRQ3wioxuK6uv54SKhYqomPLOVVFpGsCBgvpNCj83DA= X-Google-Smtp-Source: AGHT+IEjGuncFTNT/SZ4zceoos60e4tV8diFXOXGxrnPO4HgWUpl+fjYGjtIIh1LWTqEDG68tqrqAQ== X-Received: by 2002:a5d:40c6:0:b0:37d:2d6f:3284 with SMTP id ffacd0b85a97d-38060eb2031mr225091f8f.9.1729876586551; Fri, 25 Oct 2024 10:16:26 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:26 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:57 +0100 Subject: [PATCH v2 26/36] drm/vc4: Add additional warn_on for incorrect revisions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-26-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard Some code path in vc4 are conditional to a generation and cannot be executed on others. Let's put a WARN_ON if that ever happens. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hvs.c | 30 ++++++++++++++++++++++++++++-- drivers/gpu/drm/vc4/vc4_kms.c | 6 ++++++ drivers/gpu/drm/vc4/vc4_plane.c | 17 +++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 11acc56ab92d..2493ac17d78f 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -419,12 +419,15 @@ static int vc4_hvs_upload_linear_kernel(struct vc4_hv= s *hvs, static void vc4_hvs_lut_load(struct vc4_hvs *hvs, struct vc4_crtc *vc4_crtc) { - struct drm_device *drm =3D &hvs->vc4->base; + struct vc4_dev *vc4 =3D hvs->vc4; + struct drm_device *drm =3D &vc4->base; struct drm_crtc *crtc =3D &vc4_crtc->base; struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc->state); int idx; u32 i; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_5); + if (!drm_dev_enter(drm, &idx)) return; =20 @@ -474,6 +477,8 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, un= signed int fifo) u8 field =3D 0; int idx; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + if (!drm_dev_enter(drm, &idx)) return 0; =20 @@ -530,6 +535,8 @@ int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, u= nsigned int output) u32 reg; int ret; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + switch (vc4->gen) { case VC4_GEN_4: return output; @@ -621,6 +628,8 @@ static int vc4_hvs_init_channel(struct vc4_hvs *hvs, st= ruct drm_crtc *crtc, u32 dispctrl; int idx; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_5); + if (!drm_dev_enter(drm, &idx)) return -ENODEV; =20 @@ -682,6 +691,8 @@ static int vc6_hvs_init_channel(struct vc4_hvs *hvs, st= ruct drm_crtc *crtc, u32 disp_ctrl1; int idx; =20 + WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); + if (!drm_dev_enter(drm, &idx)) return -ENODEV; =20 @@ -707,9 +718,12 @@ static int vc6_hvs_init_channel(struct vc4_hvs *hvs, s= truct drm_crtc *crtc, =20 static void __vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int chan) { - struct drm_device *drm =3D &hvs->vc4->base; + struct vc4_dev *vc4 =3D hvs->vc4; + struct drm_device *drm =3D &vc4->base; int idx; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_5); + if (!drm_dev_enter(drm, &idx)) return; =20 @@ -740,6 +754,8 @@ static void __vc6_hvs_stop_channel(struct vc4_hvs *hvs,= unsigned int chan) struct drm_device *drm =3D &vc4->base; int idx; =20 + WARN_ON_ONCE(vc4->gen < VC4_GEN_6_C); + if (!drm_dev_enter(drm, &idx)) return; =20 @@ -927,6 +943,8 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc, bool found =3D false; int idx; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + if (!drm_dev_enter(dev, &idx)) { vc4_crtc_send_vblank(crtc); return; @@ -1011,6 +1029,8 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc, if (crtc->state->color_mgmt_changed) { u32 dispbkgndx =3D HVS_READ(SCALER_DISPBKGNDX(channel)); =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_5); + if (crtc->state->gamma_lut) { vc4_hvs_update_gamma_lut(hvs, vc4_crtc); dispbkgndx |=3D SCALER_DISPBKGND_GAMMA; @@ -1040,6 +1060,8 @@ void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int c= hannel) u32 dispctrl; int idx; =20 + WARN_ON(vc4->gen > VC4_GEN_5); + if (!drm_dev_enter(drm, &idx)) return; =20 @@ -1060,6 +1082,8 @@ void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int= channel) u32 dispctrl; int idx; =20 + WARN_ON(vc4->gen > VC4_GEN_5); + if (!drm_dev_enter(drm, &idx)) return; =20 @@ -1094,6 +1118,8 @@ static irqreturn_t vc4_hvs_irq_handler(int irq, void = *data) u32 status; u32 dspeislur; =20 + WARN_ON(vc4->gen > VC4_GEN_5); + /* * NOTE: We don't need to protect the register access using * drm_dev_enter() there because the interrupt handler lifetime diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index ce65e152876e..f5b167417428 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -138,6 +138,8 @@ vc4_ctm_commit(struct vc4_dev *vc4, struct drm_atomic_s= tate *state) struct vc4_ctm_state *ctm_state =3D to_vc4_ctm_state(vc4->ctm_manager.sta= te); struct drm_color_ctm *ctm =3D ctm_state->ctm; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_5); + if (ctm_state->fifo) { HVS_WRITE(SCALER_OLEDCOEF2, VC4_SET_FIELD(vc4_ctm_s31_32_to_s0_9(ctm->matrix[0]), @@ -213,6 +215,8 @@ static void vc4_hvs_pv_muxing_commit(struct vc4_dev *vc= 4, struct drm_crtc *crtc; unsigned int i; =20 + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_4); + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); @@ -256,6 +260,8 @@ static void vc5_hvs_pv_muxing_commit(struct vc4_dev *vc= 4, unsigned int i; u32 reg; =20 + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_5); + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { struct vc4_crtc_state *vc4_state =3D to_vc4_crtc_state(crtc_state); struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index 205aea3ed419..c084967d3527 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -566,8 +566,11 @@ static int vc4_plane_setup_clipping_and_scaling(struct= drm_plane_state *state) =20 static void vc4_write_tpz(struct vc4_plane_state *vc4_state, u32 src, u32 = dst) { + struct vc4_dev *vc4 =3D to_vc4_dev(vc4_state->base.plane->dev); u32 scale, recip; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + scale =3D src / dst; =20 /* The specs note that while the reciprocal would be defined @@ -593,10 +596,13 @@ static void vc4_write_tpz(struct vc4_plane_state *vc4= _state, u32 src, u32 dst) static void vc4_write_ppf(struct vc4_plane_state *vc4_state, u32 src, u32 = dst, u32 xy, int channel) { + struct vc4_dev *vc4 =3D to_vc4_dev(vc4_state->base.plane->dev); u32 scale =3D src / dst; s32 offset, offset2; s32 phase; =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + /* * Start the phase at 1/2 pixel from the 1st pixel at src_x. * 1/4 pixel for YUV. @@ -825,8 +831,11 @@ static size_t vc6_upm_size(const struct drm_plane_stat= e *state, static void vc4_write_scaling_parameters(struct drm_plane_state *state, int channel) { + struct vc4_dev *vc4 =3D to_vc4_dev(state->plane->dev); struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); =20 + WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D); + /* Ch0 H-PPF Word 0: Scaling Parameters */ if (vc4_state->x_scaling[channel] =3D=3D VC4_SCALING_PPF) { vc4_write_ppf(vc4_state, vc4_state->src_w[channel], @@ -1113,6 +1122,11 @@ static const u32 colorspace_coeffs[2][DRM_COLOR_ENCO= DING_MAX][3] =3D { =20 static u32 vc4_hvs4_get_alpha_blend_mode(struct drm_plane_state *state) { + struct drm_device *dev =3D state->state->dev; + struct vc4_dev *vc4 =3D to_vc4_dev(dev); + + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_4); + if (!state->fb->format->has_alpha) return VC4_SET_FIELD(SCALER_POS2_ALPHA_MODE_FIXED, SCALER_POS2_ALPHA_MODE); @@ -1137,6 +1151,9 @@ static u32 vc4_hvs5_get_alpha_blend_mode(struct drm_p= lane_state *state) struct drm_device *dev =3D state->state->dev; struct vc4_dev *vc4 =3D to_vc4_dev(dev); =20 + WARN_ON_ONCE(vc4->gen !=3D VC4_GEN_5 && vc4->gen !=3D VC4_GEN_6_C && + vc4->gen !=3D VC4_GEN_6_D); + switch (vc4->gen) { default: case VC4_GEN_5: --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 3D30222804F for ; Fri, 25 Oct 2024 17:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876593; cv=none; b=FDNflDYtOF4WB7coFXoB67OqF3qR8km3iBTSNcq+guCMyZKsE0dKyc4lC/saQHaXxX7IKhj/iFrpj5OkPZQiJ/ihl8Z9q8doeqF4lPbf/n+krbJO3Qn2UvFo28YN/Pfu6I0+OG3zKEww+HNO97CGDXka/vo1e7muhoojQUkIi2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876593; c=relaxed/simple; bh=m3UAiUE0biP1FsK0/13FGVcYEVRBGrRWaA1DplqidxU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FMMdD51/Z4uK8STC2yNfHwIdbzXG3Koj/eUzSqponaB0px70ooB8i0ERkoiGV0CW3Y9e0Qul9irse0kHQprZiGNGj5b5NEno2ooCX6o+WMbP53etWrgpLcx4+4AruZnUYcBQt96D8f5OB4+CGr29q5qFOTSS8ICB86RcNLlvgnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=bM51e3JL; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="bM51e3JL" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-37d41894a32so1759593f8f.1 for ; Fri, 25 Oct 2024 10:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876587; x=1730481387; 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=0vbQi4zffHZmgrFZhlEz3qZo9PncYkAwxBP66oHpwT0=; b=bM51e3JLX/AblHVdshfApzC+P3lV2ccqvqstnX92nceI9sTCgzG3LK3S52Om0udVM4 PslHaFUlOQ8bLeL1gYlxsRMd940QP6RsyAPAnJR8rvdH/knsXFky7/6XW/Ma3jrcZPdD t6LLE0zfnYk3IojsPCFnKIl8zC1T+tWQhWjAUfz3u8JDgDnniRYRCUTgZJmUnHH42BKA /DZEZGDKPIpqju49ZUty18+6BFlSQUTa5LOcsBOvUIz8U9Ro0XwdVzMmg6QHwksRRBXa 8XlagxmE4NFp3F5i7riHt1Bzq8RNqL8fRn2pHIKM/gtn/hMeU4KIkZMV7mf1l2lM5hMR L3Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876587; x=1730481387; 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=0vbQi4zffHZmgrFZhlEz3qZo9PncYkAwxBP66oHpwT0=; b=H4eHavuRoFQz1DscwGDAxO0/ezogXb8+UqtlHSUKEWq2/PxEzV6j7C8uZ3TQFWzTBP Mlf/QgNX75CAW2XhLbd1FvI98gn6YZlun4ewF2zs8g3lTcvLgBpbn5gX12OB8AtwC3EH lxGAFTZyqRXAEf1YRw7glNb3WDX39qbd5ZXWhWOt83Pyq4Jq+RY30rYbrpzMLAnio53A 59YXzVMvzz41W7Ytq58K5nLzvKnuxKZneHvVYe+Cbn3JUThatV6Q7Mssr5G+OMFvd8to jt5f9DzlzGSREe8ma6CcmrZAjvlQpSfLyGqutVwjs/hmF9jlE/CVtnZf4PeV+FsKWZP1 r1bA== X-Forwarded-Encrypted: i=1; AJvYcCXHmrCkKTjsLhCmdKpgYcZB0FCEzcY68illF70CeVU1StQRw5bXhEh3ICUM6Y9PpnqU3fOLnp3zl+FDZKs=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+30AqaU1uYzeLJaWzllWg9HFWS8WhqY0cpA1bEJYOQtUQTRYo j4+ztq2wffQZGGLQ+1Pv+nZq5MfXPhXN7u39gIq1NoIp+uoPRvhjBVrFv1S8CLY= X-Google-Smtp-Source: AGHT+IH+29oPVsRqs2fqHrAWDnK5QD/g1okRZ89yJvrj7HxIWsx6pgAGD3QO00ZuQ026KdKRThmfow== X-Received: by 2002:adf:ec8f:0:b0:374:cd3c:db6d with SMTP id ffacd0b85a97d-3803abc51c6mr5147977f8f.6.1729876587557; Fri, 25 Oct 2024 10:16:27 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:27 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:58 +0100 Subject: [PATCH v2 27/36] drm/vc4: Enable bg_fill if there are no planes enabled Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-27-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 The default was to have enable_bg_fill disabled and the first plane set it if it wasn't opaque and covering the whole screen. However that meant that if no planes were enabled, then the background fill wasn't enabled, and would give a striped output from the uninitialised output buffer. Initialise it to enabled to avoid this. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hvs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 2493ac17d78f..c8bc2b48648f 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -936,7 +936,7 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_plane *plane; struct vc4_plane_state *vc4_plane_state; bool debug_dump_regs =3D false; - bool enable_bg_fill =3D false; + bool enable_bg_fill =3D true; u32 __iomem *dlist_start =3D vc4->hvs->dlist + vc4_state->mm.start; u32 __iomem *dlist_next =3D dlist_start; unsigned int zpos =3D 0; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 7745C226B6F for ; Fri, 25 Oct 2024 17:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876594; cv=none; b=QUSUoVmRKtiFUmeBcmPt5Et8Zmlcp7D3ZO0HDt/9SLWoSuja1ewV4aKTg4oId7vC1i9YsiAjW1SdHGDfKehnRRDi4d3B/PxppP+/MhDuJKuhKh6FgWbG17wz3tCUAw7GBREADVe87Q81pPSmumOaZVYVr0G8skgnN9tBv0ar9vk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876594; c=relaxed/simple; bh=8pKCgnrveM4lke8y9auZuEMqMV0HyweQ1m8QIRmnZ4g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MrOxI6c5Q+zUmTdRPntNNosC121hEoDObKGlcrQu2cnNYrEzRd5ii1gUyIZfoQYZFTs+lg9sE7L0DH02D0xudDSzvPYghkAxABsT5PYcbIputWP6EBZygtBzTKh+ffqk6oQ1RkiPvu7ix4zMEFUPYEVEZXPzme4pzRRtMtXw5Ds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=GOQxvUU8; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="GOQxvUU8" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d70df0b1aso1770576f8f.3 for ; Fri, 25 Oct 2024 10:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876588; x=1730481388; 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=/ucVW7j3VRo2xghhoJqgDsgYFtjK370Q9Kpp51qjXUY=; b=GOQxvUU8F8mEP3lyd810QdzFXCl2FUCcJPygu3fmmZYuWDdSbg1iqg7eDixL5PUHZ/ v6z1UQyDTsguZGsUC8lKqPpS/YJna6JoNrCXWGzN/oTU2kOTHpnfwjEcC+jLdWui10wt 7FWsWN2s2VYFxPpgw3COBRK+EcjZ4tkL3Czfa4TL59Ktw782JjjS4w6r7xRUgqxHXZRm oat/DShaZbgtPunhFgrv5Vlkz5/BPmCZ6LStffCmqupAjNr8WyJZRbHloVbJBQyltnPa iFi29i+hC/7rUAZmATFOUbp8AkdrSZWVf4VeTGe4gIWrOleDch7KWVmlsdIx6jQlxmPW lXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876588; x=1730481388; 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=/ucVW7j3VRo2xghhoJqgDsgYFtjK370Q9Kpp51qjXUY=; b=LxJGZp2gqfeLE3nxR5nuqAZoqvo/+x7xTY/otkOqWFJboMcyacxEpbWdNBgL8Nxnh7 Q2Ul2lzoIqlW4iqdgQ0B4kO+TMNuydwYUBfBPeAVXXOQjBJXaSQsKjXTOtquhu2yRhgJ XoXH3G01HFxgCt9/Fwd/eGLHYNKZuCIDdNbmr0x5a4CKggSNC1XVyVtFsL9UmUtl0J4i WRk3i27L4KcOqSOt8D1sJ2BbLIpfDMZoEagRHVTpqI/etfE+7c1cVNVh/TC3IUpqWgaJ K6IcV8Y77uI9umUyNzxwZEqnnwp34orVhS9ZHZYL5E/DXhJsHuhSrt85JrgEXjtBzp0J orkg== X-Forwarded-Encrypted: i=1; AJvYcCWKD0bbCXmpsDOHH1vwktWIo2MWkcTjjOs0atE9diI19Yr4tue4lAsURWEN0RHLgkMe0DmjZ08ylgr7fno=@vger.kernel.org X-Gm-Message-State: AOJu0Yzp60HAIxzWXmfR4B3EvHKi1pwptTsSL5em8vJN1EHWCiJ/AbC3 X+tV7VkU572NZ/c1AutHYMiEs2UQPTjxYPtkZDq3EaXhbOaRNvkWPxE5XnDG7d4= X-Google-Smtp-Source: AGHT+IHith+nby6S+6PBCDtMGCYXz8WWaZpZndzlrwLswYlE/kRFwhddJaPxJNnioSkaK9oic7PjTw== X-Received: by 2002:adf:9bd4:0:b0:37d:4e74:687 with SMTP id ffacd0b85a97d-380611e1392mr111135f8f.41.1729876588429; Fri, 25 Oct 2024 10:16:28 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:28 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:15:59 +0100 Subject: [PATCH v2 28/36] drm/vc4: Drop planes that are completely off-screen or 0 crtc size Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-28-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 It is permitted for a plane to be configured such that none of it is on-screen via either negative dest rectangle X,Y offset, or an offset that is greater than the crtc dimensions. These planes were resized via drm_atomic_helper_check_plane_state such that the source rectangle had a zero width or height, but they still created a dlist entry even though they contributed no pixels. In the case of vc6_plane_mode_set, that it could result in negative values being written into registers, which caused incorrect behaviour. Drop planes that result in a source width or height of 0 pixels or an on-screen size of 0 pixels to avoid the incorrect rendering. Signed-off-by: Dave Stevenson Reviewed-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_plane.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index c084967d3527..94737c587f20 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -1230,6 +1230,13 @@ static int vc4_plane_mode_set(struct drm_plane *plan= e, if (ret) return ret; =20 + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || + !vc4_state->crtc_w || !vc4_state->crtc_h) { + /* 0 source size probably means the plane is offscreen */ + vc4_state->dlist_initialized =3D 1; + return 0; + } + width =3D vc4_state->src_w[0] >> 16; height =3D vc4_state->src_h[0] >> 16; =20 @@ -1753,6 +1760,15 @@ static int vc6_plane_mode_set(struct drm_plane *plan= e, if (ret) return ret; =20 + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || + !vc4_state->crtc_w || !vc4_state->crtc_h) { + /* 0 source size probably means the plane is offscreen. + * 0 destination size is a redundant plane. + */ + vc4_state->dlist_initialized =3D 1; + return 0; + } + width =3D vc4_state->src_w[0] >> 16; height =3D vc4_state->src_h[0] >> 16; =20 @@ -2135,6 +2151,10 @@ static int vc4_plane_atomic_check(struct drm_plane *= plane, if (ret) return ret; =20 + if (!vc4_state->src_w[0] || !vc4_state->src_h[0] || + !vc4_state->crtc_w || !vc4_state->crtc_h) + return 0; + ret =3D vc4_plane_allocate_lbm(new_plane_state); if (ret) return ret; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 C0EC4229B42 for ; Fri, 25 Oct 2024 17:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876596; cv=none; b=VcqT9/nHYrnnHeZDVfRr2GojkfamW4t2WKPX7h9DZDGw0UpXTC5zK2KAqOcNJZvVxQXdc81120hTfblL2p89Bk82bSMaUJ+WkVhq6OPO51Ka7ueKyn0b0SCHm9qYE2Xdn6L2QbPZTEQDoAUDy/sOM8uhKTStjeRlZDlLexdwCxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876596; c=relaxed/simple; bh=0je9Y0xbsCwGhDIv3Ukq4aSt2NhWmJSUC9xO7wwoU+Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nUQ4aGRYTyiSrOWyf69aACo/30WmePkMBsS2/7TsmqoXUmKoYundNfSz3BjAuane6erD1xVBnY4MkbVnb0JOkDuFBeuurhIlcC3tOQoQl6m94zcJixa98TvWUxMZZZSoBvDcHRJFiIeQBWNOdmYu49tfpKGTVnsrOQFazBrtBmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=hgtYN84U; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hgtYN84U" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so1734127f8f.3 for ; Fri, 25 Oct 2024 10:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876589; x=1730481389; 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=5HllG+0A2vmKjdDSzHIHJZeNfO9C2BUneILRyscFdw0=; b=hgtYN84UMLRxLRy3AfPk6vxJa3y5IDiRJTzQJNl3qMKqaQRKQpVMSJJHjuRk6H27Aa 7GOT2N2SZodJGvmhEvb0R6Jq3q3T3p1g++C1Py2yXIRu7X5syfoe+T60fXeYiXDqzIJ8 GSR5HqrWVmhxOTdFPkrXhapaq4X0wiSvSE3v56hqV6e1Ro6hQYGlyYzc0+JR6g9S4jbI Q0wRwq+k9Kvlvq1ea+6f02/G30QqD8FY7Sl+/zUpKiU92sH6fOPWff1KB49adwYPsIlK 8TEW9PoWh7uHhQoanpsFi/LqLV/k7bXsfli0ZpKCrFKg0ZNzOXuBWbVOlHNwqmRKUx86 mXvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876589; x=1730481389; 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=5HllG+0A2vmKjdDSzHIHJZeNfO9C2BUneILRyscFdw0=; b=PKQQeiEro8GaLRpmMvnyKgyHUiZ5oU7DxU4UjAErWghJ1vWxwzyzvyetklNbxxmihQ OCIjp6IellF3PtDAFabYEnX7GDD1UP1DP33XWOsupCslR7x40Cn2LgNsuRwYHve8HJBX NrsaQSf3rw30Ppt0NSlUhL/rxPKTqXxW0zpPKXdvFyqRe/tdZmojJzDYXwtzbs9/D1/1 F8nbEuLRl2ztN9S2hy8fNJ/f8MAL/9kXxN3Ev/Ou+ROCjoYaSO2x2e3mTHEVP9uVrPS2 6xceAXoZlP6a08+vypvlW+t4srPkz2hOvWl093tEPcJH2V81opVLRZ7PH856RokWvAGz 2nFg== X-Forwarded-Encrypted: i=1; AJvYcCXkSICt0b4r/fiAn1WTq0q4a4pU2NtzTRnqYdzxBsvHdPMybqLplOKF5jLNb3XwJcPgK/mjQd6m3w1Vg/U=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/ll2cm1BQ34J6tR8pZP6eA1uBnAcoTOGlcaR1IMwi7EEPoOt5 6ybtUtYN8HapOWg1yu7x55u9tIZ5NpkrfZYBnEaZvOr+0P1A38dHkcg/StOgopc= X-Google-Smtp-Source: AGHT+IF1bjTItLZYzib0RmBwDucZt/dcZd/G2s0GqNKrDbIpCMPlI0IgZqsUCGHdxbWn04sHiWM6eQ== X-Received: by 2002:a5d:440a:0:b0:37c:d1b6:a261 with SMTP id ffacd0b85a97d-3806122feefmr91002f8f.59.1729876589515; Fri, 25 Oct 2024 10:16:29 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:29 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:00 +0100 Subject: [PATCH v2 29/36] clk: bcm: rpi: Add ISP to exported clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-29-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson , Dom Cobley X-Mailer: b4 0.14.1 From: Dom Cobley The ISP clock can be controlled by the driver, so register it with the clock subsystem. Signed-off-by: Dom Cobley Signed-off-by: Dave Stevenson --- drivers/clk/bcm/clk-raspberrypi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index a18a8768feb4..6d5ee1cddded 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -118,6 +118,9 @@ raspberrypi_clk_variants[RPI_FIRMWARE_NUM_CLK_ID] =3D { [RPI_FIRMWARE_HEVC_CLK_ID] =3D { .export =3D true, }, + [RPI_FIRMWARE_ISP_CLK_ID] =3D { + .export =3D true, + }, [RPI_FIRMWARE_PIXEL_BVB_CLK_ID] =3D { .export =3D true, }, --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 E248A229B5E for ; Fri, 25 Oct 2024 17:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876598; cv=none; b=CoDWmytLubu6HH6y+dUL+eFjcsF1lw2S5v/Yb4LciDoDbJmSTKbBretUZEKJknd+DIXh1zCkHDpPGP4Z+u0Ti41Ow/khKxAb5J2rP9zBUczWd7XIJF/nA5vkY2RWHFI6HhUxa6jzxDhH5FS25wOLlw1pAe8ZIstDdoEQHtAtPTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876598; c=relaxed/simple; bh=SjVwsOGppg/2aMc/EjblXpBI+5dLiqOiAgVLBX/FLjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ufGIUMQcpbtOyq+sMe/xAYWaUrVyPbjOlxY955lMXHeoDDqugXN7xyZyDfRJ9gfKWc/rIo3UlPCbC6NNAcsO+8aleUEyiMUiFt+13JH4AAVRqQKq4YrfMlqxjGR10oVivpxoYNrefcSSGF51fGe0QObVIdb8JBitY3FHXUwu1+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=nscASpWN; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="nscASpWN" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37d518f9abcso1664434f8f.2 for ; Fri, 25 Oct 2024 10:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876590; x=1730481390; 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=RbWeszNg1J6sxJWK/VxJPpcVrMqaA756zdsXOCwMWo8=; b=nscASpWN62rI3D3OGjJsawD0pakTkw02JI4PNGo7mhlMvdQI9GNdxKlfxn+iCFzikT vIPkqzaVmlOqvfa0vJH/6bSWvGkdANytMsXaNrAuMjQjhfW7SJXOiWnB9hxyrZ/s8G6m R2wHQghhb+raBag/Bb8o2OzYqatNWOEY4UmOz7lpMPmFzaQMA4FFAJIfWpVB5de6trfv AXQYnWrfcWN4mcSY7GL1Rk2FQO/p8NBQqL0qyaJURh7Tv2s4U6op2aTQkiG01eV6X/+b dn4/X9r778R6/vHdBp5wDVUe/Jd3VUjXlig8cfEYiuCDnQ71TYVGFy/twA3xlj7g7vSk uZQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876590; x=1730481390; 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=RbWeszNg1J6sxJWK/VxJPpcVrMqaA756zdsXOCwMWo8=; b=ezcR1MnhniJcOSZ2svGygyPQa/IycfSOlLiz2K8kpbR317j+M+gCHgv6Cv0LASKdMR fZRl9aqmi+I5/oyvdpFnOlZB1YgcXWR10wDx9X8R0dl3lebqHTFyg21M99Y9VCSdMG08 YtNU4VRvtOkpdwBaAEofrg7Fs5rhbHuWmkDhj7Fllv0iXHtmUQH1nGs7qvEw4j5H9Lx/ MssLrf3ZdJJIwjaloJjpoG8NeBSRQH7+rPq/FgIl6q/JxFsBDh07cYdkY6e9DN7/JbkN l2/E7RMWw7bPgw4tKIl0WG7+aTzjf+GKCWj4XIbV5NOPn2oHQsrja9e9BjLfdU550Il7 7UgA== X-Forwarded-Encrypted: i=1; AJvYcCVgk3jELe9ldwa+wKtQOTNSJTXG1kDISmB3m7tCSfid6N6crWVzO3k0NwbDBDZks14SLpSaQtd/6DRFBC4=@vger.kernel.org X-Gm-Message-State: AOJu0YxecEoNctu+mGOPcOq6qq+gDr2OVoqwBpiH/mfSqi9kYSI+Gcoz CosoN4EBYrtOlnm6HduText/4QvxSoq/bqQKmGg7g4sHAZlZcZ7NR+VRQ+YqexA= X-Google-Smtp-Source: AGHT+IFzLQpTgUQ1GGNf1FFbit3NR6SLMLyJmHIlrv1yJ02k6Akx4PaydsdQXONZLxuVWGUKuRmYsg== X-Received: by 2002:a5d:5224:0:b0:37d:53dd:4dec with SMTP id ffacd0b85a97d-38061137a3emr110320f8f.15.1729876590408; Fri, 25 Oct 2024 10:16:30 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:29 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:01 +0100 Subject: [PATCH v2 30/36] clk: bcm: rpi: Allow cpufreq driver to also adjust gpu clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-30-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson , Dom Cobley X-Mailer: b4 0.14.1 From: Dom Cobley For performance/power it is beneficial to adjust gpu clocks with arm clock. This is how the downstream cpufreq driver works Signed-off-by: Dom Cobley Signed-off-by: Dave Stevenson --- drivers/clk/bcm/clk-raspberrypi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index 6d5ee1cddded..d374538e7108 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -156,7 +156,6 @@ static int raspberrypi_clock_property(struct rpi_firmwa= re *firmware, struct raspberrypi_firmware_prop msg =3D { .id =3D cpu_to_le32(data->id), .val =3D cpu_to_le32(*val), - .disable_turbo =3D cpu_to_le32(1), }; int ret; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 3ECEA22AD9E for ; Fri, 25 Oct 2024 17:16:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876598; cv=none; b=QZPoE+tlEG3KiA4zrMOJC2uwRE3BYenjFRnfZbpwOsnzK2S/vZXzBKh4VqqYO8VfXEx5Vgg4BY6fVbbHmpiyuGvSV34tSeXhvdAC1wqHR1EWR6w1GI2+Z5ossuyQIU/WQLZHycF//6HkoutptO+6ZN1yMax5kHk6kjpZp0O9qgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876598; c=relaxed/simple; bh=XBzj1denapOs56Du29PEQKEZahYGIqXLFsG73uRG2VE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OiU1EgnwNNlWXAewQxHhSZLQYUS87IL4OkolwkOb9aiH4Q0TxkuZfgr0E4+8LDZwhbRVQWGXGZyJv6koQUD8U0xmUwnHlKKAydedEHQ0K0pCxLfRpNc4BtkBSRHHKALq8iUeGgbdpjEMPKMWDBsnX/CL3jOXdRZV403RbprePuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=kNdafAIY; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="kNdafAIY" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so22546315e9.0 for ; Fri, 25 Oct 2024 10:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876591; x=1730481391; 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=RLNEe24VVIwAaP5agwCiuxY7rB4nwlR4wJvUVCZVQ/E=; b=kNdafAIYshrHa6sbvPV0peVIFCgeHSpHEHygIXhw87zhQ/hIrUZmEU7zMi3WKFq+z4 lUHKxwNB0k3dFJetKPrXlxp2zbshMp1zjPolYYPBN478inYGDi2iD/GhvqL9hXrD/HUW jJ7emcdeurB9AXrwN5l6b3fAB0D6K4RJTQmQ+W67IW9O/00SI6l+7FUnBeGW+BQRHxCK TmhWzKZv1S2ZwIKdyV0jsjOu0hwK0SutmoQxWWXYbjtaxb8ll0rP4YRYYHNa1g+BjMPs RlzxnMavvYF7VBm075frWU2S0nSRohtfEjRBI0jXsQgeKJ+8J/6UPPaHFcnZxGUXDvo6 U6Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876591; x=1730481391; 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=RLNEe24VVIwAaP5agwCiuxY7rB4nwlR4wJvUVCZVQ/E=; b=WbM6/3DS9gftirHUfqiQ0eefAadI9T3j+IFwiZf0biJv+Myy2wi+UPrqTNLGc+vJty +n9BWxJZ7FjY9X1tUNDWUdPeYxVohdfw/3QIhM8YAfPzWIem3F+iWVrnADUJzhbv3RAF jUMTBJUHrsWjrS2clEDAOTuyu6uPFrd6Bbyfe/Vemf9lmiEP0dWLApqWoTx/QOC2h4hX U7E5VHFZNx87mRUbuCODV+m7QP1HfzBTHAEltwSueKodnR/ScXgwKz/lIj5R0kom1JU9 D5JbUaJGOz6VBP3Ij0CXSMCKSMVYdm8wBM5IG+0y6/n/bMZIrwOSGnCwzuehcAqVWyEk m24A== X-Forwarded-Encrypted: i=1; AJvYcCXQ2KbUTrjp+6/AJextQZwAyHrrt1AYl1IS/jF4QvfE/xC1gMGpb+30memx1KtSNCD1KU033sePaQy0vqM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywc4muamr9oKpEQEMzFRtQPZftAP8fE9vhfZU+iVIy2KGx8MxTP ZqXocJv8Rgmr+jxExRlJd8gBqsF14IMYpGh18aygJwL4HqlC5B6YYkpRw2wMCXI= X-Google-Smtp-Source: AGHT+IEf4KZxMhq0qk7/lCgwke2nZYw7jfKwbBRjQajizbRblmsymhNJTGNxxKLe3CTSVhp57vlUig== X-Received: by 2002:adf:f411:0:b0:37d:4e59:549a with SMTP id ffacd0b85a97d-380611418abmr124517f8f.16.1729876591324; Fri, 25 Oct 2024 10:16:31 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:30 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:02 +0100 Subject: [PATCH v2 31/36] clk: bcm: rpi: Enable minimize for all firmware clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-31-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson , Dom Cobley X-Mailer: b4 0.14.1 From: Dom Cobley There isn't a reason not to minimise the clocks, and it saves some power. Signed-off-by: Dom Cobley Signed-off-by: Dave Stevenson --- drivers/clk/bcm/clk-raspberrypi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index d374538e7108..9f716b2223ae 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -111,21 +111,27 @@ raspberrypi_clk_variants[RPI_FIRMWARE_NUM_CLK_ID] =3D= { }, [RPI_FIRMWARE_V3D_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, [RPI_FIRMWARE_PIXEL_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, [RPI_FIRMWARE_HEVC_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, [RPI_FIRMWARE_ISP_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, [RPI_FIRMWARE_PIXEL_BVB_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, [RPI_FIRMWARE_VEC_CLK_ID] =3D { .export =3D true, + .minimize =3D true, }, }; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 720C922ADBF for ; Fri, 25 Oct 2024 17:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876599; cv=none; b=c0Assqo98wlAr/ejqZixXwVXQg4RAVDvs4LO0+EnV8cdXw2htbgRC4o5wA1+bOFdcrTZ3XNBhloTDitGF0YCFcsZr03Q+aKCKhA/atKBWqTQc8F2vByYSggACDgQlt1rQtgG9Ihz89Ieo0aI2XYgGm1F4H8uWlwF68A1AtvxZUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876599; c=relaxed/simple; bh=gDetkg9bcTzrR7O835LrIsBPAY/4zF75oSJMNh2My2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iWgpQxoTWg2C1loMG0+/gT6nlmSksD7wMDn19N7aTSN/zY6BEYhi0T/exyJIM5QK48zQryoA9jMobhJSczjFnLbeBkIWlaH9TYDXPRcVQV1pO0ORobek5FRbNBgNV4WaEJZNlqK5ydxvfJpNHRB8Otn7LXfebaJm5vnUzIVAhXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=QkROaNsk; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QkROaNsk" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d70df0b1aso1770648f8f.3 for ; Fri, 25 Oct 2024 10:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876592; x=1730481392; 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=yUMbW8c4fnS4xc6t+S+xmsFii0Nh8WSEhqluNBn7tHo=; b=QkROaNsk7CrE2+ZJ9WwKDE+K172he2S2K1jv/3GHo7jFJIkcLwtK31dPp3dLDSQT1e 0qdc3/XkpTfYBDQKX7d0lsD3L1gGH6csAMO0SqU0EtFS3HRg4APiCBp+KU53W1nTAY27 eZfClYZnvjLxbrWJZs57VP/zgqU3OD4X8lFHZ/isn4qgRPWm/YRLAYyBFhF8tISR8qSu +o9ssVYqaHJcOAW09eZP2uIgmXFiWJH2u5/OZbbcBwT+nHyuV3Oiw8UN+PRmCFWgkkJa jiSkBxL72vsaKnmXksuiCkLMfaPMpFHk31i/2fFJ9vpKKfwUH9T3UL9wOPPrBAHP8jqQ 79tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876592; x=1730481392; 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=yUMbW8c4fnS4xc6t+S+xmsFii0Nh8WSEhqluNBn7tHo=; b=LqozPqQ+tYApydE9mzRFdPayIh9e+OFeaDMYjzB/rmHC20ZBKH/DhIELYk/dD7TlzY raQ5PmSrsvt0X50XXp4A6KIwpm3NxDm8x+Z/om2HejBRfyYdsBraaJZ4s3Py+ueWaifR jtl0sNInNAwRL66JD1Iln+UUYHzvJRxRUPCWMQfDlPGcpIhx5lfAMLxOBRSGkRWXCuFk q76/xCvrWUbQXyjuMWPZMQCYjog/zdTb6L9hlELLsqb60UmwLMzZGa6tU8y18rb8HXw4 2QI/oUAHsATwl4llg1dxtk0eFA8+HjSYW40RMbaGfP2FycM0iSmsneYcIe0gzivJETOG XLiw== X-Forwarded-Encrypted: i=1; AJvYcCVkQu0yc5oGCi2umToAuMFCK/NDZ+sCZqV7D44fN2k2/yZaIU3WIYS2l4YYDI7DR9HJMrRwnwcra5hW9HA=@vger.kernel.org X-Gm-Message-State: AOJu0YzJ17A+coKYKbFxwcQR6jDOP9dlvBEeBiSso3kOu3xD0dmub7Xo BH2vWFBzudGHljAUe+09OM0Fwh+WoIrgyQnhj9sGd4TEyi3VV9RoqwIAUpfZKo4= X-Google-Smtp-Source: AGHT+IGlWiJn7Ozkgg+McXgEdyvgzuVLywKtK/tT5oVLgmb42gKrNvsGZclRa3uCRrKPuzJCn2aCmA== X-Received: by 2002:adf:9bd4:0:b0:37d:4e74:687 with SMTP id ffacd0b85a97d-380611e1392mr111275f8f.41.1729876592186; Fri, 25 Oct 2024 10:16:32 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:31 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:03 +0100 Subject: [PATCH v2 32/36] clk: bcm: rpi: Create helper to retrieve private data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-32-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard The RaspberryPi firmware clocks driver uses in several instances a container_of to retrieve the struct raspberrypi_clk_data from a pointer to struct clk_hw. Let's create a small function to avoid duplicating it all over the place. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/clk/bcm/clk-raspberrypi.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index 9f716b2223ae..b12d86720207 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -56,6 +56,12 @@ struct raspberrypi_clk_data { struct raspberrypi_clk *rpi; }; =20 +static inline +const struct raspberrypi_clk_data *clk_hw_to_data(const struct clk_hw *hw) +{ + return container_of(hw, struct raspberrypi_clk_data, hw); +} + struct raspberrypi_clk_variant { bool export; char *clkdev; @@ -176,8 +182,7 @@ static int raspberrypi_clock_property(struct rpi_firmwa= re *firmware, =20 static int raspberrypi_fw_is_prepared(struct clk_hw *hw) { - struct raspberrypi_clk_data *data =3D - container_of(hw, struct raspberrypi_clk_data, hw); + const struct raspberrypi_clk_data *data =3D clk_hw_to_data(hw); struct raspberrypi_clk *rpi =3D data->rpi; u32 val =3D 0; int ret; @@ -194,8 +199,7 @@ static int raspberrypi_fw_is_prepared(struct clk_hw *hw) static unsigned long raspberrypi_fw_get_rate(struct clk_hw *hw, unsigned long parent_rate) { - struct raspberrypi_clk_data *data =3D - container_of(hw, struct raspberrypi_clk_data, hw); + const struct raspberrypi_clk_data *data =3D clk_hw_to_data(hw); struct raspberrypi_clk *rpi =3D data->rpi; u32 val =3D 0; int ret; @@ -211,8 +215,7 @@ static unsigned long raspberrypi_fw_get_rate(struct clk= _hw *hw, static int raspberrypi_fw_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - struct raspberrypi_clk_data *data =3D - container_of(hw, struct raspberrypi_clk_data, hw); + const struct raspberrypi_clk_data *data =3D clk_hw_to_data(hw); struct raspberrypi_clk *rpi =3D data->rpi; u32 _rate =3D rate; int ret; @@ -229,8 +232,7 @@ static int raspberrypi_fw_set_rate(struct clk_hw *hw, u= nsigned long rate, static int raspberrypi_fw_dumb_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { - struct raspberrypi_clk_data *data =3D - container_of(hw, struct raspberrypi_clk_data, hw); + const struct raspberrypi_clk_data *data =3D clk_hw_to_data(hw); struct raspberrypi_clk_variant *variant =3D data->variant; =20 /* --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.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 6F0B022ADBB for ; Fri, 25 Oct 2024 17:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876600; cv=none; b=UinVxfYNseOEqE0km5HnseqYbcjkB+zH/JdAtO8qU6fCCd81n+wLjt8WVspxb47AQriz6f/BGGOgYPum2uqkoHPQap3f7wivt7TgFn0ZMdJhhwcDL/7VmzsHOpjnRpDOgGAGFxCBfSduhoR/U244krDmsD39umN/ItvTQ9lP2SI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876600; c=relaxed/simple; bh=dgB9TDqOjPHC53NYjTeAKDgaQq5QKMSxepqaspF/csI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J9MVZrVjb5WVij3mfjHAa8hNvzxw7bHy2/DNUvSUF9/0X4mmMO4oiiEY41I6VuENabun7GjbYvdMzVpmUdHZ/5jzPRAxw3ggRgT9NOJv7xJGSERkIYsbzE2LQbSwm6axyZbSM4qBzUaYu0uMRmqV0tDiqlMg42jBiIqSuNLf8lg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=T41xgAoi; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="T41xgAoi" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4315839a7c9so23004225e9.3 for ; Fri, 25 Oct 2024 10:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876593; x=1730481393; 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=k+NR5LKr4OxeWQLlNj8flZMDifFbPCFEGLf/3iSNdew=; b=T41xgAoiYjYRG2N0x87OEJB+S31juJxn6G+S//lU9tdYfEjy/tTmCFzAYtgNiI9b69 Uk3Sok50qteYAYGjcy5syzXCi6NAxM+1wrcG/FuiSrm4v88Bx92DjjrbvPUAmNeKDBqm rVwU/7fAtV8TqbQhclQXxnJmoWqPnb7rkSA5Zqh7vJqplG3s/e4GtNen2iJkTvxuVC/Y RVUx+TsxLJ2BLAh2wRe7a3wqeJNfx25bB6OSF+YSiqoHJ56vXpA1wORCG886l6G45gP1 bwbxxCQbIfFIHlmCHZ2PG0AgbfbyuogSQ+wRCBCg3HlxMFGrWa1mxJ40w/iAPbMaLfUi 3TEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876593; x=1730481393; 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=k+NR5LKr4OxeWQLlNj8flZMDifFbPCFEGLf/3iSNdew=; b=sqFnnYB8ZgMeH1Edt/gNCkPtI+CWRebLodIuzCsleIClw24lUQVPILjTGoj8Nu/cpQ rtaPT6QpuOzUGXQqk9NHsJWIekaX0bp1HkfMYMP+PT5YHRy0Wseo12wt/TVWY2Jszn1b bDPyXh4QvxvigoSzHnWCGr/qaNW5EOOp1PWxjI73BBAfeuVdpLd8hlotSx5Eyh9EjlVU g6Mgc7n19/LoTaiabMLmuHcNxuwTjwDkSgtObEEShy3vKfnqS2brMI2JlJoYXL0CwyVN T/p9YgCjjyzWdpmC8wtTPY2rcPYS/Fc2uUnd88Z2YFtGBnmH7KySD0eVRFtxzdmpb9rg HyoA== X-Forwarded-Encrypted: i=1; AJvYcCUzGiAOJ0dQUBF7qf/D343AaoqBqKbpPyeZ8zUtP2b0ZNn6y9bMqobhBUngzT7rB30usSre4DbgtHjyef0=@vger.kernel.org X-Gm-Message-State: AOJu0YzgAniYyJ7IQyRSISLe9n2pavbru1F2HSzXyqeNRIlmMJbtlyNR RYxCqwNoEgtOV2Te2dy3I8dEypHcvC7ZTy2Odr213LqvOCfbs/8mORgwkXyFQU0= X-Google-Smtp-Source: AGHT+IHe5tCoSz92UO987eOIzi01b4rnj6tRANtMPS83mpXtoleIp32yTkc1Cq0CRABNQvTNNn9/Eg== X-Received: by 2002:a5d:63cf:0:b0:37c:d57d:71cd with SMTP id ffacd0b85a97d-380611ff862mr97480f8f.52.1729876593018; Fri, 25 Oct 2024 10:16:33 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:32 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:04 +0100 Subject: [PATCH v2 33/36] clk: bcm: rpi: Add disp clock Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-33-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 From: Maxime Ripard BCM2712 has an extra clock exposed by the firmware called DISP, and used by (at least) the HVS. Let's add it to the list of clocks to register in Linux. Signed-off-by: Maxime Ripard Signed-off-by: Dave Stevenson --- drivers/clk/bcm/clk-raspberrypi.c | 5 +++++ include/soc/bcm2835/raspberrypi-firmware.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index b12d86720207..0e1fe3759530 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -34,6 +34,7 @@ static char *rpi_firmware_clk_names[] =3D { [RPI_FIRMWARE_M2MC_CLK_ID] =3D "m2mc", [RPI_FIRMWARE_PIXEL_BVB_CLK_ID] =3D "pixel-bvb", [RPI_FIRMWARE_VEC_CLK_ID] =3D "vec", + [RPI_FIRMWARE_DISP_CLK_ID] =3D "disp", }; =20 #define RPI_FIRMWARE_STATE_ENABLE_BIT BIT(0) @@ -139,6 +140,10 @@ raspberrypi_clk_variants[RPI_FIRMWARE_NUM_CLK_ID] =3D { .export =3D true, .minimize =3D true, }, + [RPI_FIRMWARE_DISP_CLK_ID] =3D { + .export =3D true, + .minimize =3D true, + }, }; =20 /* diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm28= 35/raspberrypi-firmware.h index 73cac8d0287e..e1f87fbfe554 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -152,6 +152,7 @@ enum rpi_firmware_clk_id { RPI_FIRMWARE_M2MC_CLK_ID, RPI_FIRMWARE_PIXEL_BVB_CLK_ID, RPI_FIRMWARE_VEC_CLK_ID, + RPI_FIRMWARE_DISP_CLK_ID, RPI_FIRMWARE_NUM_CLK_ID, }; =20 --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 8A42E217655 for ; Fri, 25 Oct 2024 17:16:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876599; cv=none; b=NRBii2LFExDAHVEbdkrkWpks9zeMFsq7f4OTTyiV0pxrGzCSuJ7TL+TnaqS+yZVItQF54aSznXKqVNHIIPNcuRYFv4SUVD/afM0aseRWaahCecy9pTZw86K/qdw3Qnsp6RDjL9nmv1aWudMvyKxo+YYPJrzmZKvIWmSjHntqMqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876599; c=relaxed/simple; bh=6GIQGcktZBfb3EW9sCT/3N7/H28SyLep9RyAXNQs71k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Oi8JAdpKBzBCdzrJ1u/msOWvzcE9un6hyRqO57oug9irFYueOzXYM5YvZLIQZa/UkZFrBYHwdLdRehmzy6XprBoWxpe2z9zU4mV5vxqA0LTh7Atiq+qaEdm3PHmzfbYh3/Sfdd6U6CeGW9VGjs1Igf1MTq8PVCVf9lJV94DC9sw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=FT+Y3A8V; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="FT+Y3A8V" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539e7e73740so2082077e87.3 for ; Fri, 25 Oct 2024 10:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876594; x=1730481394; 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=n6ynqPw+aFyVqyQgEAy8+ChgZ/7ftlVoUYbZGJVl5Fw=; b=FT+Y3A8V/+YGlObiLixX4Rziq0wpuA9Q0vDpxFpaNSNq63BBHs0rMZ8gINxTHCd19J IA+D/5jVhSip9X/QBrwJCuYOuQa3CB/xfgypAspMJ8hegbSHoy/ZX7bV++OTi3Wd8/va gK0gzA74gjwJIRxcHUxlfzol7KJKUXqGuNsmZx/8IfGg1rbVrCqdGf3xHjgowpcApjAD o4upqzf5nAQWEJtLiQGmSAI3sALU+1kD8NX35I3HJa3rW4VW5xrdVNWUZlejlg5R26bw MhABhqPprno/lpTtNhADc5Mr6Gna93XcRpRUao76OUlRYcJKQmo0wsnd001niVNcSSC6 dkfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876594; x=1730481394; 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=n6ynqPw+aFyVqyQgEAy8+ChgZ/7ftlVoUYbZGJVl5Fw=; b=NL0nOZTN7qTFyYdG96Jk8yigHObcdut0NEiCJCDJ/ifebQ4zo2CCRWJ5RxTkc2Pzgw D0eigT+x6Y0Q8OYj1F4B1fUFjkFtk5hzKbjnRH5/+6kcJp6lfXkFa9SCww213v0yRBb0 9y4rByA5RquVBDA8qIR2I0KynisXI8H0YG9+5BuD8fgFLWdRd9RfyaWVc/XzKhl27B3P nJfo0ZCPibHMtHaJOP9WH2gI3A5nu0+YsRaftB+Et5uCz6e+6cPnh04yk+5wFI3v23F8 OWCIm9q4kwQSN3hScJJQ4ODNZq3xRxk127giPLphFXD5mD7ehgO6xjQUjlrthAw6RFpH 0ScQ== X-Forwarded-Encrypted: i=1; AJvYcCXiDOA59s8lU6JNed1uqEhcNITr4cQ9wyCn5FWGd139DYAVPQkCbuA+M89aQrYcboNWpVF1/ao7w7fgv4c=@vger.kernel.org X-Gm-Message-State: AOJu0YwwzYc7/qma0rrt3zg7r3qLZ3871cUiwEFb9YQFR0epuwv/tKNd mYwa4V8vFt4BynkIUo8owMTdnaRBQccIKy58SxnB+CmFAz8bQlI0XG84ir17b0g= X-Google-Smtp-Source: AGHT+IHK/c1INay68uUhSO5TRsMi7vzJxRxlcdjPaei9dfk9EKPm8CK9FYYjgLp5rLJi/EGzMMN1vQ== X-Received: by 2002:a05:6512:398a:b0:539:f2f6:c70f with SMTP id 2adb3069b0e04-53b1a2fed80mr5844694e87.8.1729876594028; Fri, 25 Oct 2024 10:16:34 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:33 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:05 +0100 Subject: [PATCH v2 34/36] arm64: dts: broadcom: Add firmware clocks and power nodes to Pi5 DT Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-34-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 BCM2712 still uses the firmware clocks and power drivers, so add them to the base device tree. Signed-off-by: Dave Stevenson --- arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 28 ++++++++++++++++++++= ++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/= boot/dts/broadcom/bcm2712-rpi-5-b.dts index 2bdbb6780242..92a2ada037f3 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts @@ -62,3 +62,31 @@ &sdio1 { sd-uhs-ddr50; sd-uhs-sdr104; }; + +&soc { + firmware: firmware { + compatible =3D "raspberrypi,bcm2835-firmware", "simple-mfd"; + #address-cells =3D <1>; + #size-cells =3D <1>; + + mboxes =3D <&mailbox>; + dma-ranges; + + firmware_clocks: clocks { + compatible =3D "raspberrypi,firmware-clocks"; + #clock-cells =3D <1>; + }; + + reset: reset { + compatible =3D "raspberrypi,firmware-reset"; + #reset-cells =3D <1>; + }; + }; + + power: power { + compatible =3D "raspberrypi,bcm2835-power"; + firmware =3D <&firmware>; + #power-domain-cells =3D <1>; + }; + +}; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 0DE5E21767A for ; Fri, 25 Oct 2024 17:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876602; cv=none; b=Apk0YJocpvtZv5yL8sL0Oi7h3iq/fKlu6EKpy1ddTnp7LF0KDjMJd0xJJj74JRPzlZYYnWIMn6tWd3j7VkwVepp0TI5Rr5Eyu3W4aq4RKILrTsahDIkh0ieb4UKf+qvNkmLq5hkE4Px0I40Q3h3yPcLq3tdj73aGpGLPvtGDh7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876602; c=relaxed/simple; bh=nMBH0rWLQkU2soF+Cg2c4yz0aba3rmak7d2lggM5H44=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C2YnKqAmj+vaklOVLHs/0SP5AAesN02Q6fO7nuEn0PeNLWJg9X9iu/x/BP05H7s2+JHZD+y+ieIU3fvO1iZcR6iide10pztbFAGnhjZjJLQF56iBehwZs2iziDcldsJRyBLVdMEReZG1nRKEBsVWvPDhtKqA+Rp179k0YHPESXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=iPiniljf; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="iPiniljf" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so20855915e9.0 for ; Fri, 25 Oct 2024 10:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876595; x=1730481395; 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=UZEz4/9qLe30swJeAKIBBvm5fHc5WeQ4yezYVAmOgKA=; b=iPiniljfvGf/M21704gt2l1jqwdzOlJjIRhoKQ1Rjy1jM7lt9JQWHkB+l9adU39vMz /vs4mzTcsLlNuqt0YI0skXwAGblcUVOlXVZ7yvBUfY6ZvGmZ1JEFeX/CmoeRfg6MRob2 qilHyEMud8J/o5Zc7EFZlMg4hMFW0SmB5jEuc/bC97vYUkT8Cc+xJfTC5UxBus1sGjy6 Md5fJ5/HzZFtKi2VoCwVtLj0Wxcm1IABHRH2PhX5VIK2TDk10DgHONAKawU5HbXo3Dn4 fjNHX79iiWpJcuRBI2DvT8I4xvlnlf1CKGUxvFCknVtv++uzkSPSdiBiwEv69ZeWX1zD Wm3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876595; x=1730481395; 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=UZEz4/9qLe30swJeAKIBBvm5fHc5WeQ4yezYVAmOgKA=; b=hPHHm/Z9EPI6NDcSnRMMeAJueYwSKiRga03mFItobSCpedtAb1ne2B6o5ycEShHQD6 uNMchevgv5bkORhheGaCwRdj4oKoT41fUzPGT4Kk00HbtI3QnQhCQWNV1yP8b2fEqCQu VAza6BIz3xBrs08x9E+xCYBuRJR8RJs/0rrcg9sGmwwZ80oy4wz3aLMEBz5pWBIytvHf 0q9sMft5Gi3UAJysS/mobFKA3ePPRLArgNzF+dLrDglGggz32O+haTgChJiOYQC7Tqyi qpCvgPhb+MbpuN0BA8o09zAEQXc62OQifnGEI6cf0AV9+cR2P+KibAvy22cPJrKp4oY9 YieA== X-Forwarded-Encrypted: i=1; AJvYcCWFZ3h/wA1oPi7yTo7+h5ZeWosoFm42odMM/0WzuxwMgyFHhLKkTemmAUjRO48AScI9GLx3+RBe/yumMlI=@vger.kernel.org X-Gm-Message-State: AOJu0YxOOYgh2U5b6N4I5zK/nZJfDRS73He6aHc6JGIl/d5pWMfj0cxg geTEcECSVaXKXI0ERsU8WPir4oWGd0Zcoo88x6hbtLbKY/iE9q+AtqniQThRNqk= X-Google-Smtp-Source: AGHT+IFIR9g4wPz9AIYx6zXI6mtmRWJRoukoFOA0zSanhmararEgIJGNhppbZKvOIcKdNVw/sX50cg== X-Received: by 2002:a05:600c:1d84:b0:431:51e5:22fb with SMTP id 5b1f17b1804b1-4318413f0a8mr100184415e9.14.1729876595075; Fri, 25 Oct 2024 10:16:35 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:34 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:06 +0100 Subject: [PATCH v2 35/36] arm64: dts: broadcom: Add display pipeline support to BCM2712 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-35-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 Adds the HVS and associated hardware blocks to support the HDMI and writeback connectors on BCM2712 / Pi5. Signed-off-by: Dave Stevenson --- arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 14 ++ arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 188 +++++++++++++++++++= ++++ 2 files changed, 202 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/= boot/dts/broadcom/bcm2712-rpi-5-b.dts index 92a2ada037f3..fbc56309660f 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts @@ -88,5 +88,19 @@ power: power { firmware =3D <&firmware>; #power-domain-cells =3D <1>; }; +}; + +&hvs { + clocks =3D <&firmware_clocks 4>, <&firmware_clocks 16>; + clock-names =3D "core", "disp"; +}; + +&hdmi0 { + clocks =3D <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_= 27MHz>; + clock-names =3D "hdmi", "bvb", "audio", "cec"; +}; =20 +&hdmi1 { + clocks =3D <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_= 27MHz>; + clock-names =3D "hdmi", "bvb", "audio", "cec"; }; diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dt= s/broadcom/bcm2712.dtsi index 6e5a984c1d4e..39305e0869ec 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi @@ -265,6 +265,172 @@ gicv2: interrupt-controller@7fff9000 { interrupt-controller; #interrupt-cells =3D <3>; }; + + aon_intr: interrupt-controller@7d510600 { + compatible =3D "brcm,bcm2711-l2-intc", "brcm,l2-intc"; + reg =3D <0x7d510600 0x30>; + interrupts =3D ; + interrupt-controller; + #interrupt-cells =3D <1>; + }; + + pixelvalve0: pixelvalve@7c410000 { + compatible =3D "brcm,bcm2712-pixelvalve0"; + reg =3D <0x7c410000 0x100>; + interrupts =3D ; + }; + + pixelvalve1: pixelvalve@7c411000 { + compatible =3D "brcm,bcm2712-pixelvalve1"; + reg =3D <0x7c411000 0x100>; + interrupts =3D ; + }; + + mop: mop@7c500000 { + compatible =3D "brcm,bcm2712-mop"; + reg =3D <0x7c500000 0x28>; + interrupt-parent =3D <&disp_intr>; + interrupts =3D <1>; + }; + + moplet: moplet@7c501000 { + compatible =3D "brcm,bcm2712-moplet"; + reg =3D <0x7c501000 0x20>; + interrupt-parent =3D <&disp_intr>; + interrupts =3D <0>; + }; + + disp_intr: interrupt-controller@7c502000 { + compatible =3D "brcm,bcm2711-l2-intc", "brcm,l2-intc"; + reg =3D <0x7c502000 0x30>; + interrupts =3D ; + interrupt-controller; + #interrupt-cells =3D <1>; + }; + + dvp: clock@7c700000 { + compatible =3D "brcm,brcm2711-dvp"; + reg =3D <0x7c700000 0x10>; + clocks =3D <&clk_108MHz>; + #clock-cells =3D <1>; + #reset-cells =3D <1>; + }; + + ddc0: i2c@7d508200 { + compatible =3D "brcm,brcmstb-i2c"; + reg =3D <0x7d508200 0x58>; + interrupt-parent =3D <&bsc_irq>; + interrupts =3D <1>; + clock-frequency =3D <97500>; + #address-cells =3D <1>; + #size-cells =3D <0>; + }; + + ddc1: i2c@7d508280 { + compatible =3D "brcm,brcmstb-i2c"; + reg =3D <0x7d508280 0x58>; + interrupt-parent =3D <&bsc_irq>; + interrupts =3D <2>; + clock-frequency =3D <97500>; + #address-cells =3D <1>; + #size-cells =3D <0>; + }; + + bsc_irq: intc@7d508380 { + compatible =3D "brcm,bcm7271-l2-intc"; + reg =3D <0x7d508380 0x10>; + interrupts =3D ; + interrupt-controller; + #interrupt-cells =3D <1>; + }; + + main_irq: intc@7d508400 { + compatible =3D "brcm,bcm7271-l2-intc"; + reg =3D <0x7d508400 0x10>; + interrupts =3D ; + interrupt-controller; + #interrupt-cells =3D <1>; + }; + + hdmi0: hdmi@7ef00700 { + compatible =3D "brcm,bcm2712-hdmi0"; + reg =3D <0x7c701400 0x300>, + <0x7c701000 0x200>, + <0x7c701d00 0x300>, + <0x7c702000 0x80>, + <0x7c703800 0x200>, + <0x7c704000 0x800>, + <0x7c700100 0x80>, + <0x7d510800 0x100>, + <0x7c720000 0x100>; + reg-names =3D "hdmi", + "dvp", + "phy", + "rm", + "packet", + "metadata", + "csc", + "cec", + "hd"; + resets =3D <&dvp 1>; + interrupt-parent =3D <&aon_intr>; + interrupts =3D <1>, <2>, <3>, + <7>, <8>; + interrupt-names =3D "cec-tx", "cec-rx", "cec-low", + "hpd-connected", "hpd-removed"; + ddc =3D <&ddc0>; + }; + + hdmi1: hdmi@7ef05700 { + compatible =3D "brcm,bcm2712-hdmi1"; + reg =3D <0x7c706400 0x300>, + <0x7c706000 0x200>, + <0x7c706d00 0x300>, + <0x7c707000 0x80>, + <0x7c708800 0x200>, + <0x7c709000 0x800>, + <0x7c700180 0x80>, + <0x7d511000 0x100>, + <0x7c720000 0x100>; + reg-names =3D "hdmi", + "dvp", + "phy", + "rm", + "packet", + "metadata", + "csc", + "cec", + "hd"; + resets =3D <&dvp 2>; + interrupt-parent =3D <&aon_intr>; + interrupts =3D <11>, <12>, <13>, + <14>, <15>; + interrupt-names =3D "cec-tx", "cec-rx", "cec-low", + "hpd-connected", "hpd-removed"; + ddc =3D <&ddc1>; + }; + }; + + axi: axi { + compatible =3D "simple-bus"; + #address-cells =3D <2>; + #size-cells =3D <2>; + + ranges =3D <0x00 0x00000000 0x00 0x00000000 0x10 0x00000000>, + <0x10 0x00000000 0x10 0x00000000 0x01 0x00000000>, + <0x14 0x00000000 0x14 0x00000000 0x04 0x00000000>, + <0x18 0x00000000 0x18 0x00000000 0x04 0x00000000>, + <0x1c 0x00000000 0x1c 0x00000000 0x04 0x00000000>; + + dma-ranges =3D <0x00 0x00000000 0x00 0x00000000 0x10 0x00000000>, + <0x10 0x00000000 0x10 0x00000000 0x01 0x00000000>, + <0x14 0x00000000 0x14 0x00000000 0x04 0x00000000>, + <0x18 0x00000000 0x18 0x00000000 0x04 0x00000000>, + <0x1c 0x00000000 0x1c 0x00000000 0x04 0x00000000>; + + vc4: gpu { + compatible =3D "brcm,bcm2712-vc6"; + }; }; =20 timer { @@ -280,4 +446,26 @@ IRQ_TYPE_LEVEL_LOW)>, ; }; + + clk_27MHz: clk-27M { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D <27000000>; + clock-output-names =3D "27MHz-clock"; + }; + + clk_108MHz: clk-108M { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D <108000000>; + clock-output-names =3D "108MHz-clock"; + }; + + hvs: hvs@107c580000 { + compatible =3D "brcm,bcm2712-hvs"; + reg =3D <0x10 0x7c580000 0x0 0x1a000>; + interrupt-parent =3D <&disp_intr>; + interrupts =3D <2>, <9>, <16>; + interrupt-names =3D "ch0-eof", "ch1-eof", "ch2-eof"; + }; }; --=20 2.34.1 From nobody Mon Nov 25 15:41:36 2024 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 36C51228055 for ; Fri, 25 Oct 2024 17:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876603; cv=none; b=rE7jP//oZHMDi9r7XGwhFT8WDuZazIoqfSF2wUWcX10BsoTqteWsbR1Qius7Enj31xvdyUC6rbxMJODpIO43YLbL1nFC8sZg+IHt1I/q1pA0U6259PGyB6G9LAG4BR45vmitBbAMezu1sSyYjxNSWdwdhD8mIauk3xD4HF1LDuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729876603; c=relaxed/simple; bh=YzyDLNl8va/xJl47EHT+vId7czfsGNnbHYHobDKQTlg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XFuEMqs+VmSxyBVYAa/zPoxWOw3PXZmiV/e+SoQcDlrz8vC2j4d6WAdNYNFijH9QcKxZKKAc8Na76F2gbI+xMuHQwPb0FmIj0Nzm7026+2wru2Jq1OzC897G4VJUqqN8fqqR9SG8tMc1xEYqYtALbEGsvvc+kfWsttSEVAvBDCo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=Gx05/4Ot; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Gx05/4Ot" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d3e8d923fso1438126f8f.0 for ; Fri, 25 Oct 2024 10:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729876596; x=1730481396; 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=SOV7jAWhbFwwjw/OJ7O7LtE/DWvJ9qhDH2QMAsU+FWw=; b=Gx05/4OtPlxFfZSmKt5wry6KA1iBI3l2cM58HJsFS0sukwTmrSbjdiR6BRbnpnuM2Y VjLk5MbiZ/ITHNJDC2ezGMsCqCHORpMAiUGUx7bOQhTY7Oa+/7UGZpJQ7lbXUH2JOfvF ycTW+8iwckQCqtTbdCLp7P4ogreh1MH7IcFTqA/wQLMmNDgbU3r29A2dq1RuPZ1CCqzj qxe9jAlSU2JNraQPIh5aQ1CUOGWtGxqZr1KyjEtvTeRKN4d/ThyTkjypysckrC+SnZ2E cW/YNjThFtZnFftpG1D5DnftzxJP5RJFDAeh12k9CEVd+V3LsolACACs3O4xIqIMSIa/ bbVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729876596; x=1730481396; 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=SOV7jAWhbFwwjw/OJ7O7LtE/DWvJ9qhDH2QMAsU+FWw=; b=i1XU3KKLV0cHndT9wZAHGfCGr6GbCGbvHMy0WyzBq20zwqAngaAZVeLF6oDVrVIzWw FfnyI426LpmmIWsAt98oXz5rJyvPYL0lydIjbmVfQBLsD04n0MSccR2G6+9RoHEuVJGj iTjo9IEgGrkiaWOjlE6V4egrYeeEcTmV9dlgZKD43fXpmsltkU1TWtWs3h1PsYYdPwv9 0S6DvfRUDY5GlaTSejWPxLyJQzPfxrZIJEgg5yyltF5Gt9OZ9fv99ABiwz0A0Wr+fiQk XUk/8gpkMTBKQCfg6QdEekxsI61vdf6+8PEZJJNlCrEsKOlteB5uVgoFIhGIUAWtr6cZ bMpA== X-Forwarded-Encrypted: i=1; AJvYcCU2w3vAN6cL8sMe1JAOkSEJC/aZbv201cI4+iAe958lzQ4ly2gZB0JLg3RwHAj9WPH4xvFc9ETEQwkunkY=@vger.kernel.org X-Gm-Message-State: AOJu0YwTUEjauj+Je5AcYi6XMiPoxEpCwWXlMFgoq86ROefJ4jlbMhrt 5znDPgOQiaFkE7FkGcFp00fR8UtV0yY+Bj/Bg7r+WLrTgxqlvx4p2U9bUGMVT6Y= X-Google-Smtp-Source: AGHT+IHM4SY0KfVAQSpJ1+ccDJ+C4lsK7yh/l9hYanouQQltriHwErlFPV65caR05fmBTRpW7n50vQ== X-Received: by 2002:a05:6000:e42:b0:37c:cec2:23c6 with SMTP id ffacd0b85a97d-38061208e5dmr101866f8f.57.1729876596081; Fri, 25 Oct 2024 10:16:36 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38058b91f50sm2013649f8f.94.2024.10.25.10.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 10:16:35 -0700 (PDT) From: Dave Stevenson Date: Fri, 25 Oct 2024 18:16:07 +0100 Subject: [PATCH v2 36/36] arm64: dts: broadcom: Add DT for D-step version of BCM2712 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241025-drm-vc4-2712-support-v2-36-35efa83c8fc0@raspberrypi.com> References: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com> To: Maxime Ripard , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Michael Turquette , Stephen Boyd , Javier Martinez Canillas , Catalin Marinas , Will Deacon Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Dave Stevenson X-Mailer: b4 0.14.1 The D-Step has some minor variations in the hardware, so needs matching changes to DT. Add a new DTS file that modifies the existing (C-step) devicetree. Signed-off-by: Dave Stevenson --- arch/arm64/boot/dts/broadcom/Makefile | 1 + arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts | 37 ++++++++++++++++++= ++++ 2 files changed, 38 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/br= oadcom/Makefile index 92565e9781ad..3d0efb93b06d 100644 --- a/arch/arm64/boot/dts/broadcom/Makefile +++ b/arch/arm64/boot/dts/broadcom/Makefile @@ -7,6 +7,7 @@ dtb-$(CONFIG_ARCH_BCM2835) +=3D bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2712-rpi-5-b.dtb \ + bcm2712-d-rpi-5-b.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \ bcm2837-rpi-3-b-plus.dtb \ diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts b/arch/arm6= 4/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts new file mode 100644 index 000000000000..7de24d60bcd1 --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/dts-v1/; + +#include "bcm2712-rpi-5-b.dts" + +&gio_aon { + brcm,gpio-bank-widths =3D <15 6>; + + gpio-line-names =3D + "RP1_SDA", // AON_GPIO_00 + "RP1_SCL", // AON_GPIO_01 + "RP1_RUN", // AON_GPIO_02 + "SD_IOVDD_SEL", // AON_GPIO_03 + "SD_PWR_ON", // AON_GPIO_04 + "SD_CDET_N", // AON_GPIO_05 + "SD_FLG_N", // AON_GPIO_06 + "", // AON_GPIO_07 + "2712_WAKE", // AON_GPIO_08 + "2712_STAT_LED", // AON_GPIO_09 + "", // AON_GPIO_10 + "", // AON_GPIO_11 + "PMIC_INT", // AON_GPIO_12 + "UART_TX_FS", // AON_GPIO_13 + "UART_RX_FS", // AON_GPIO_14 + "", // AON_GPIO_15 + "", // AON_GPIO_16 + + // Pad bank0 out to 32 entries + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + + "HDMI0_SCL", // AON_SGPIO_00 + "HDMI0_SDA", // AON_SGPIO_01 + "HDMI1_SCL", // AON_SGPIO_02 + "HDMI1_SDA", // AON_SGPIO_03 + "PMIC_SCL", // AON_SGPIO_04 + "PMIC_SDA"; // AON_SGPIO_05 +}; --=20 2.34.1