From nobody Mon Nov 25 22:39:03 2024 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 E4CEC12F399 for ; Wed, 23 Oct 2024 16:50:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702212; cv=none; b=Mqb9ZtPrHj4Ss4trWya5AeCfULA54M3Ep4xJ6BIidQubLxYI4dsCSarHRKzcYMxIYoIW375rMvekghwsS9rqw0+6uuhbjz7pQVxq+r10XW8Qh4JAgoA46cJ0jHksRrw2pejbovMRVZFEHGmZUAOLbkgXTYYRz93fd6KN4h3G7pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702212; c=relaxed/simple; bh=91Jie+ws5L+cGWdYzocLxQpP0tGJPoUasR/nJIADUQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r3wj4TIv1HJCqlbFt5SZFTaoI+eJISABaNGCiSgBObMKUCkUNsOg0dUu4KzezdEY8IctEn+DZBp8JwQspp/SEdujV+06aE5pV48xV+YzJLj0W10VWzxWu4QxlepLpSnpWdFovT5hUjPlqM86rANlGWPQq8GQBN2CGLq7vtF58xI= 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=AoNGYgDR; arc=none smtp.client-ip=209.85.221.46 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="AoNGYgDR" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37d4d1b48f3so5079414f8f.1 for ; Wed, 23 Oct 2024 09:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702209; x=1730307009; 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=m0VXG7M0+edMYKBQpiJHMGtp1VEyRPMm6kVJ0JBtPBU=; b=AoNGYgDRf4cCSy/ypmkqOeYZGGHj0JpGHYovU2YZWsN+BXHHSlLH/6uAj841BB+tfq GpHMQdcMJFzpORh1GyKbZV/0QlytVt71Tr0eVWjdFRaAo54UukceSq5HAIjXautmQb/I lWOSMhEoDFl1sTtFPEFe8zGb8pTSfjwGvsYgfUXrMYcn6iRJmA6CpNz+aG1Kv902jspB XrfVqgM/piC+rmsSGWQBqE5c8xW3ybhTJg1fZguqmO3pCaGhzDaXwY07UQNhF4SfTM2Z oaV84G5Ltc15MkZvjGDuU3j6gcNARUKzfNiJvJPcWcAnrEYnip6OyjCkiqtzNp+RDU/X S9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702209; x=1730307009; 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=m0VXG7M0+edMYKBQpiJHMGtp1VEyRPMm6kVJ0JBtPBU=; b=Pt2msi6pHEqXR4rJSfmEW4kh1sUvdRMLiYcBfugpdDermYMVZS0ot6cf4+Xby4LqJ1 UECPNpIQ1LNCOJSGkX3hMwjHoeNvUBoUsF1fnni5OczXuFaQOqUY4i6m+AblIeXUAQqf mJhMMVUMc6BF/KA+P6qF4G6sWfh+CCCOC49lmC1jaOiWDb9EwZSV/FDn332E+tOKt3lh ki/5ipnq1AKrBPCm9T5zr8wdIHom/DNwIodvB5EWvlmXxLyrn+O8PIO7Zs/tZTVgsuuw ikm0gtUQqlTM4nN5DGf/7tboYhdIhpO+xu4euOAOnQub01unC8ONsOV8TdmqQujURL1g KqRQ== X-Forwarded-Encrypted: i=1; AJvYcCX7BJrvdUZwi13j3Kw4bAGFQYPoF9O3VxAm8DiaJgz3u/WoShCKF7Rx6u81uobQeZnJzZYoD2sjwFNOu+0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+j9BNgBjuDQnQgK2uDLXG6CVfiUcwTvqSvWNcIG8ta+B5jp2p w2BLhk7pJ4Wlf96emdnDH/iCw3ird3nXIepA0Paam4BUNdJuyf2EO+bFO3YhcQs= X-Google-Smtp-Source: AGHT+IERCELF/aNULiFYaJhFKCUgkKnhHnsR2hcb6th/CbnCs93DrujrebahUME8WNgVcpsKAm29Eg== X-Received: by 2002:a05:6000:1887:b0:37c:f933:48a9 with SMTP id ffacd0b85a97d-37efcef117cmr2285226f8f.1.1729702209268; Wed, 23 Oct 2024 09:50:09 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:08 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:49:58 +0100 Subject: [PATCH 01/37] drm/vc4: Limit max_bpc to 8 on Pi0-3 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: <20241023-drm-vc4-2712-support-v1-1-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Pi 0-3 have no deep colour support and only 24bpp output, so max_bpc should remain as 8, and no HDR metadata property should be registered. Fixes: ba8c0faebbb0 ("drm/vc4: hdmi: Enable 10/12 bpc output") Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 62b82b1eeb36..6ebcc38be291 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -640,6 +640,11 @@ static int vc4_hdmi_connector_init(struct drm_device *= dev, if (ret) return ret; =20 + if (vc4_hdmi->variant->supports_hdr) + drm_connector_attach_max_bpc_property(connector, 8, 12); + else + drm_connector_attach_max_bpc_property(connector, 8, 8); + drm_connector_attach_encoder(connector, encoder); =20 return 0; --=20 2.34.1 From nobody Mon Nov 25 22:39:03 2024 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 3BDE61CDFB9 for ; Wed, 23 Oct 2024 16:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702214; cv=none; b=A/9y8wj1jj93Cnk51A2ebMd6oOhYPm8HG9Kqts9zQX16oEY4wj5n21qfUUPxWmtzaHkKBSUVvGiPQGp4Q83Y833suGPcjzRDnPvO+W+OKVomqksdNggv1MwIys1k6aNWNyI0FXKeuGrLiBm2cRunhAmMcU7Hrr1A81SuosejaN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702214; c=relaxed/simple; bh=z2Q86fa2Du2WubOBnMYnrPBais8ImpM0cuAR16G5yvQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JcWg5l2jaTDtr87Xk6j9QlS9wXkWzdUXKZabw/G7Rh9mjtaAWWpL07XUrTdmmjBufsFgloWIzZ2HItcYCUSXvHbLnnrHyqz2vT7ch08Q5bv828S51kNPnAa3TkbdLtafpUg/KBc8SMdcpujJ2Gc8HC0fmlnB/sYNS5FmmZ081O0= 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=GLtAHcO+; arc=none smtp.client-ip=209.85.221.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="GLtAHcO+" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d518f9abcso4769533f8f.2 for ; Wed, 23 Oct 2024 09:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702210; x=1730307010; 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=5WK3Wcz0LjTp23A2ibh778TvWVk0jVp3LvtNmMQecJo=; b=GLtAHcO+e1HFV5Tnr97fdErOsmw5Ie8YWCkCRP2bblDohwQJ+JDTjMfqNrqjE3Qe8x OBu9G+1uPncPJgoku+rBh3cGnwhQLwkynsg2A6f+6eSIEXu6NINR+Un5ALxKGVmwbg81 cPbF97IXEjJK6fNEDWGFx+oudqR2Qa4FK8jpsgk5qWISX+jkR3u359HmD7QYZyUfV1Ff yR1V8PYPexyrVNepFQ9qi5QAYF0KCuLSXIpapfmBXPl+vqVmcmUxHFJwdPSBFSeis8Ki itVyNo5517W2B56ORIU7q1troRRjOS8veUX4RbVsw0PJyTK1Fnsx3U0fjx35pjE7ZXsl XqXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702210; x=1730307010; 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=5WK3Wcz0LjTp23A2ibh778TvWVk0jVp3LvtNmMQecJo=; b=b9BAOv0VLb6isyyujGQ+Tcvb23JolPkWwcsnwHEV43tST2p7+5+5gnXjlPkwASZ+iV O10EpeXZyo6xlVIe+fdZE1Na02GA4yJlEIJTRcqtqzwbAvWkXjUfBIq6aa/nXWH/L960 zVUyO3KKm5SttbwkKoscBnM1Ai6/noVUHR+yhcG+0CE+QKKJJXA0WrST86/D2oOykGoI hu2wIMT+ipCaZH/jb6jQfm3bbBRi5TD7tkVo8j64HdFESkNMpqz3HVddSyowQt6dlD4f zDOKHY+95WF4J8YeBp33ixZC9lf6UqvDVpxoHV4tDGWHFLnPbMsc6AxGdqH+ziTPj5ht DDGQ== X-Forwarded-Encrypted: i=1; AJvYcCVgH5ilGpLp/YKZmuLBD7l6K8PWNd02M3S7sKdmFiOwFTLrWpn8FbqKgOJ6wD5wmPunQ1M/bhMDePpMvus=@vger.kernel.org X-Gm-Message-State: AOJu0Ywo/KmN5JCKT/eJRiTwO/52NBgIGI8TQLbI3Y+awE4MkaouPaLz wF6hjzpSFYClKPELIhF8N2wD83QsDwvxZ1eza0NtBQwbxlcDU00RYP/+MLf/9ak= X-Google-Smtp-Source: AGHT+IF8V/3kWZEsM033mvmCNVLqu8ni3b3xlel5RuPa1mpKVOt5Sj94RWpbn1HR47WB9YguGyyFfQ== X-Received: by 2002:a5d:420f:0:b0:37d:47d8:5fff with SMTP id ffacd0b85a97d-37efcf7ecc8mr1949275f8f.37.1729702210382; Wed, 23 Oct 2024 09:50:10 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:09 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:49:59 +0100 Subject: [PATCH 02/37] 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: <20241023-drm-vc4-2712-support-v1-2-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 F09D11CEAD4 for ; Wed, 23 Oct 2024 16:50:12 +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=1729702214; cv=none; b=UM5ZVSTp5y1kcp3m7p5g6by/zoGDMLIsHmvF+mZq9GdYGXYgVGh9rUR7VopQVWtuI7fZkeZiFAU0XANPcynZoKjuxIy+1hH0JbOCj6POByvmof9SCK97rCHeTpzHqxbjYBRcj3AgYt5oxmRW9ByeMJ5Iua+YDmqvrUbJyYdz9y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702214; c=relaxed/simple; bh=Dqczlx+ynt3PAOikWn3MGYfXWnzVie5xe2exXcESs0k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eVw+Ktvlv5sQnVAwlYVxJ9IZ/agJOVQ2P1I4IxihPIKiS6OfU8iv+6zTblmg38jN8lBa6pu9L9uqo1a1HZGyIUvAq198rl/wM0/7Rgsl5/4B4jFXWl8pQT0LnthoJpIJOn/x/qITiTazvZJo60PnyiDEikdIiceOeZdf6IQvRCY= 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=YBY3BT7D; 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="YBY3BT7D" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43161c0068bso56785945e9.1 for ; Wed, 23 Oct 2024 09:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702211; x=1730307011; 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=DHsrd+uLJ3zzJTfflluftUpg1xM7uGde28YhgXiEaII=; b=YBY3BT7Ders9IQVnJW1XIBS/YZ4DIId78A5axYD8sm3qKISBZ4B3LObGvyuy1OTAXp rD+92JrCd1Dnx/bvp0sp+7S6USQlnXjQA53lqEY9IOd3kH8e95DWOHNFnecuI21OZYv2 faJ0Dcn879PZoqLiB2ryU36CPyZ+UGrAcUGNQ2ImwYx3+5JXlYnuDhV/lQv29ziWFfQ1 S2DMPZ36csc/xQxPQjpJUntPYKZqjW00WgyWif5hrFW9A6zX9WXOYOsg7j/eDDdBspry 1iquv38rlHasvp2llhg5cdWSKuJOAYMcCFvkV4oztSFiJe5+4QGcUnzpJD20GYSCNXUb sSxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702211; x=1730307011; 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=DHsrd+uLJ3zzJTfflluftUpg1xM7uGde28YhgXiEaII=; b=L/CDLDOeL7sU2OTOkhhl7mWXQ9dpp6gwqa5PgM9kt7gVJpYKEOnVYPWS32xGJuLZAH dWSvsoph/UO3uhlh+pN9BpilbCDgn71GGFIhhZlRJKR7aUwwNTHxTDKP9b6Gi/l8sRib 4lr3QtcX6JkG6ElXb2oWlufM2sfHh8Wioz/Eeu6KHxOta/9f6XG4PJsFpLwmZjbEdNLo 8uGsk8ORjwHIX/LevcG0DZ6j3a9jyg8yRaG/KfMNF2NT8wgye7rEvlTIH2aFUeibXzLd ls4yiGtlAufUvBBBBu50UOhw068rTlN276ZAkaO5bccES0XHTeX+pHa9Egu9YGiyxLEb CnsA== X-Forwarded-Encrypted: i=1; AJvYcCX2Ktifichk3q1ChDFRec/9l+ewp/1RSAWMW/o3d8X1LRNryCOMXzvUwghf/oTmSOBvTYnxmEB/azhszjU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0AftF5DjLdVMnazXuuBPIw175HZ04bAY4Sexy6BfOkGyXdRgs s3rgWfImfqLbLeSNO5TLMHEG+urd0uJ08eJ6OCQTL+Y1JhpOyNr9hgszVZsHsQQ= X-Google-Smtp-Source: AGHT+IERhAzD85giYVwWPW2yr0xeM1afTBRNEqyh3+VJ9Dt+uRH4uKHHawanviz9+PlgBvlZWTrZUA== X-Received: by 2002:a05:600c:3b07:b0:431:5c1c:250b with SMTP id 5b1f17b1804b1-431841e0ff1mr27913915e9.1.1729702211354; Wed, 23 Oct 2024 09:50:11 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:10 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:00 +0100 Subject: [PATCH 03/37] 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: <20241023-drm-vc4-2712-support-v1-3-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 EB4BB1CEEAD for ; Wed, 23 Oct 2024 16:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702215; cv=none; b=KVBfdzS08DmOl9IbAwRA6DwoHMf0smnT3lm1fXXI6N0xnMfI3XGwkhAtZcjtLE87LhlVj2cxpr51sphHW/8fg1PFSIhzdp0A+4qzU0rDg/Rz+9FqSC8wz9PKU/8mjRE4/6ydf5GMr5eY42eM0tVNd+rUbjuwLQxEa9EweyAKz+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702215; c=relaxed/simple; bh=/unp98Ik2tbTzl0j/4id2arkguKjBRGpeMQXneVg42Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=alJ7ihsraOPEuem67eOuDhK9RnJ0VCBZ0E2nxNldqWpezCnF8d0CmA7bnm2PB017Uv5fusmdHPOZa1mK33MaAGT7qGCWBo/+vRl7vZOrvkDKxiXG1+xD33E8CZ1VBD4WZ+uXC13Ls1W5lMhg3XlTXpslp6848/RCKQIoMSqDJWM= 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=Kq5c5wsy; arc=none smtp.client-ip=209.85.128.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="Kq5c5wsy" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4316cce103dso60307985e9.3 for ; Wed, 23 Oct 2024 09:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702212; x=1730307012; 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=UraO/WfabHwA0kcDmdostvPDiMjVW2AKFSzHSQZmNBs=; b=Kq5c5wsyMGN7tefrhCENcY+nIqx/2JDgvdVghfH7hjkdMC5nQLyivbVv6fXzrHByD/ vnkkBMA8pCzu4Lt6KZmb+2yHe1suV5L0nK/3uu/U4ZMjCh5zqgbvv4ASx97b+aH3l3vM 4QhFCtIZQQb9xKL7faNBrap3zU0zbrWePGmaDH5mEV2XcFtq0pzJBYNWAm9+qCK/wG5S mFnO4hvR7CkllcVV4Sdad6GC1BrJvFoyxJTwvZzbhizJ9t7GzGRh6ate1OE9eN+e8x0i 7nqKswxTnp6+MVHFEZk5m1eNSTv0eCwS3J4DcD644JHtuEqSxM0ySJhSwnyL/9Ufo33j 5lmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702212; x=1730307012; 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=UraO/WfabHwA0kcDmdostvPDiMjVW2AKFSzHSQZmNBs=; b=MXfJXXiSpVzSbHfH5OZRdKrh1BsQm25D3muveKrBAA2y1wEbpFY9k2aNj6VVSvJZ1N WImtMVAznTiSqZyqzZ7vxwpN4R3edflBqXQmpxDhDC3j3xIC8PJzQRO16H77Nzlpv780 7Maq8h9/a2UfwictuhbtfsUr1PNQvf9UGo6ofMp9zuiI3UJDYUoZMJu83a+GOFUqboiI OxK6TrihVC3D1fjyWF4RGMjfnIpvP5JIn63uxq10g+wq8HapjLuluEdcCdp0bj+i4WTo Gs1QUBqWC4laWO3NAniKVg5SHsxIBzGlcbiPyTKhlLHVjJSLJsX07BluEcxV+wRPkP8n dMdQ== X-Forwarded-Encrypted: i=1; AJvYcCVxxEq9bISFTLU3IKPs+snFbHm0As3GuY1ldNO9qzt8um+JfrNaDeHUuwIHFRXfDR4mLI9o25/QZlGfztM=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt3NRz096TFZmzQvHSiF3JUeZCoTAYy3SaptYsxAgc2LAOhnlF pzuD1FHSW6uaSYtYmqfLWfaLt6dSUyyrpUqMDONJK4hZ7Nx+QeqFVS244h6OJVs= X-Google-Smtp-Source: AGHT+IEZ2TQIiD2rD7dtSbDNYkDUqcAgoqtisqjGeExVyCYGMYZ5lugyYr5OzlQS2JdAABbh9QpYMg== X-Received: by 2002:a05:600c:4ed3:b0:431:5c3d:1700 with SMTP id 5b1f17b1804b1-43184213763mr34326675e9.21.1729702212298; Wed, 23 Oct 2024 09:50:12 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:11 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:01 +0100 Subject: [PATCH 04/37] 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: <20241023-drm-vc4-2712-support-v1-4-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.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 A88C91CF2B4 for ; Wed, 23 Oct 2024 16:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702216; cv=none; b=loZLnzs6pNf8OEn/6uhmE0H4uHVNB/QiiGACC5ZbvKY+5Jm0LD/1k2C1SiCfajCpydC8NzwAF6dXuPDNLXgY0RYOEu2PQZPPDHs/ke68y0yXWdsfU68UWspp8+7zfH8tAH0X9kpOIZqpxuLZDFyNIGPDoCp9rmylq9Po/bZ5oAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702216; c=relaxed/simple; bh=uQSMO7Abrb3EmzD4lBlPnbiRh9+yEgOVzcHKKpTIN68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bmghu7VqaUgyFMDWa+srDQNZ/9wjUCN/jx5WZPsZRek3sPgjkprvcot1EWz/hiQIWVARMkquvDQwn0RD64T6n/EHZ5tYQILvGl6ohIG84GWjy3c+GAcloeg4vAdqvQq6Ieq8cIJT8hA+x3a9ZPWV7mB5Sjdzy9cWNH4GbCBLUVY= 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=TBBTcN3g; arc=none smtp.client-ip=209.85.128.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="TBBTcN3g" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so66101265e9.1 for ; Wed, 23 Oct 2024 09:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702213; x=1730307013; 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=IRsyBqkiezxBnssjhK1B67iF/aAHVHcHQNujZZby09I=; b=TBBTcN3gkZVnsW1VIOSAIx+SFkKAgyzDX0LIE121/TX1NlAPfmfHHHTDKV3dMNEb5C J+Ezd5nzHkXYK96ezwnLQ69hXXhn9KWCkX1VUXA396ChiFB/W5IYPbbaVMHjkMcp009H 0ZcoVpkmVZCaOFEIuWi3y52BVhmm50qKFixF67beDQpPlJb44Plflqs/eEdGZneIiHFD bx7Pn1593P0nWHd3XUl/iSQ739sUyxYc4BP70hGxiYlTOmwAsHdxV7qAzarCZKzyKXDh RUxttddCRvhzpJXKJbHdbAYgUQzLhTcHAo9Tvc8Iio/FS1v2lHXdGEl3k73sX3idM6hQ Giwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702213; x=1730307013; 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=IRsyBqkiezxBnssjhK1B67iF/aAHVHcHQNujZZby09I=; b=ahGltachWxdJsGNbNAvDJ9i79r0Lsal/eeNwGVa4LyF0+vutGHfe7kqR1Ix8HUT4HS fq8Q+iBZzDsupWt/qRRtbRzB8wG/tmh9lI8axj8syRt4Ie+ZVL9AMVgSWAGlB0RwlDaO YblkCYmP3djOCpY2e3OwbEUKubyLMpRHh781O1O3l5ma64tBrcAYE1U+3nhuiikDcl5o AVwN0e6yVyIxn66bgVqmWIV1ki49YkRVd7S7PvL+sR12In4dVQy74dFp//6RYQRWyhR/ KPC9RyJSd5OmbAZPfNzMESuHgfGR/SX22h+YB5bAsw1GCD7gfa5WboBR7Ftkrh/0jUAd Vlkw== X-Forwarded-Encrypted: i=1; AJvYcCU2Jci9alisOLmlFLG5OP8eYsWSlzRSDalx4NYXR2GXPNw72wv5YaNNm7CMPp89etA36YmKffvx02DGOHM=@vger.kernel.org X-Gm-Message-State: AOJu0YwDWmNbZePpwCdS9D51TUZgrhpqK6gpgL6QGANZy3BCcWf0IjKT 1ZXKpJZz8aC+N6wVfqJMVBXKvrByzCBZUxVeqpqMXkcUNkjSElD03qAjQefwP5Y= X-Google-Smtp-Source: AGHT+IGDZgGkDPQj1asKApxHb+1RRVP4pBKwGrn8gf3ud6Z4Zj4ffcb+iWXuf3VXHoFcZCsz0HsC3w== X-Received: by 2002:a05:600c:35d3:b0:431:1575:2e83 with SMTP id 5b1f17b1804b1-43184201b28mr30823345e9.10.1729702213156; Wed, 23 Oct 2024 09:50:13 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:12 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:02 +0100 Subject: [PATCH 05/37] 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: <20241023-drm-vc4-2712-support-v1-5-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 BC4D91CFEB1 for ; Wed, 23 Oct 2024 16:50:15 +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=1729702218; cv=none; b=f0Ff//wRbmS4IIU7Ua4lW4sCG5xJvZf0KLz931L4PYXSpMN2gIBX/DpYOxKu9M4i0k8HY4cnoU/GW19nf/FwVHq/LPpZ9dd3VGP6qVk/+/RwYpSq/0QCn93Nljq4xvawx2i1tMVVo4MwkSiVDHHv1b8n3hGfk8Nu4xJlVs1HikE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702218; c=relaxed/simple; bh=wluIXe1MEVk5FSOrqpni5YIVgNcieamBPIp5PPJnleI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wu9/28W2Gfw7TzFgl2j6sfFH6yT/Zz60v3YKMpvmE1dOUwn4YuJ7oC7cQEWwNupYfNt26n2BA1eY0ABK5cU+Oau9reyDHZef3yLHQcAcITL9gdUisR8RyWtgs1fJtMOvTtnRVisb2LdPkSwf8hU4pQ6G/gbgp6DI0uQ2gI5ZYIo= 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=j7qqNL/+; 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="j7qqNL/+" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d3e8d923fso4873746f8f.0 for ; Wed, 23 Oct 2024 09:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702214; x=1730307014; 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=KsBVoQZ8zap5DslrzzzsVJMIsK4Q16E87oM6AvNUOjA=; b=j7qqNL/+xrIYdn9KSKRvQMw83pePtN17jJbIwI091MkoiU/67TnyqcXlAas396Qb/7 uvwCbe3ONyzWYMkGfDwUJK6hPURPphm3kmkDq50p1nEstc8eQwhdUKSG7hpx1NkbzHLf 7Hag0IJJohewIfsD7KnB8gHvCkvjCGn+SLc72bMQZfiPa06MCFsKhXXR0oxBr86ThXWt L1UNsTpQHxWlnE+X6RfZmCmqDkwJOqBLUApPQ5Qzrrn+aJxE8Lj7Fey5N5HUqWynzrMu FQF7Y+QMnCxWVa/uZkTZYNozoA1grafJXUlKvmkYWm2NAcdp6B9bmmwxcDW8qtrBAjhA BWzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702214; x=1730307014; 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=KsBVoQZ8zap5DslrzzzsVJMIsK4Q16E87oM6AvNUOjA=; b=OaRBk4XyFWZDqDpCkhH2v8H3UAbt1M8B4BykeVN8Ym91G4r4B+Nbl/IX5P3lb3POnE AVYX2ntuaK7Ezqxt5D49a0/CPweH8EF3UrYsmOL2jJc6h3bwZ0hFFadA2KPATm43SVk5 hL5n+Z94D2rp74KlRxE7rapxzHuV3JXeTJX7/yyY08HHZ28I05Kz0saY8gi+pRkbapC7 NBhOzlYR7VT/IYYwiciPRw4oPh6ZyLCCk24uejnrhJkUKEZwXTJn+eGUlY4GlJVmr4Kp RUK7XA26EbcayGtF2U749PoTEGIkCuWF8fJ1i1R+Sl7DZVq/+nCoO/I9xuRE2pwJbGTM BaJg== X-Forwarded-Encrypted: i=1; AJvYcCVbUvKQqjhMRNn7WNWuOLq+lYwd1TBL2XZSG5eXc1M9DNtotCyDrvqpuQvmygBDAGGR4JxSE4E3msMaQ/A=@vger.kernel.org X-Gm-Message-State: AOJu0YzfGt+UuabXubrAtu1d7mSzwh88ZvFTBdGKUlPqEBKzAgUQVHq7 4TE/FA+jqGdPwtdpRTKK2TnHujCBD4gSSPb0HFbUs8q396abzrvRxyv78bxFSnk= X-Google-Smtp-Source: AGHT+IEPMevLaP10jHP2kjP5QjuvQyoeAseVICs2i6vuIJvW5BstXAY25poTAtlyrCUn0K4+h2nj6Q== X-Received: by 2002:adf:f6d1:0:b0:37c:cfba:d16b with SMTP id ffacd0b85a97d-37efcf84673mr2298249f8f.44.1729702214024; Wed, 23 Oct 2024 09:50:14 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:13 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:03 +0100 Subject: [PATCH 06/37] 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: <20241023-drm-vc4-2712-support-v1-6-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 B33761D041B for ; Wed, 23 Oct 2024 16:50:16 +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=1729702218; cv=none; b=rU8xd8Fzb9HfE4P8gWoKk+RKk8LZ2hF6Bpn90DB50PphgU7dz+hKEa04Y5BjyIysX2hh/8AAfZ3xpzPrqnZzAIuRcZgGKbUVYSPTtugDKa+PPfbsAU4KK/5ZarG8hA/5dkTHYMpQh7RW9C6gMPFH7Bad9xGbftoFU3J7GbDk5I8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702218; c=relaxed/simple; bh=myDXwEj4/Pt7bXQuFI1piwvvg+1lI7X2Hera6uIfya4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r9cQO4P+4sgJDfQzVEKnktRLQ1Vdt4c2u8B1GgbCAdw/K5bcrVtVT53fHDnMV/eFaC0APpaMwD5rWlF91qyKQ+RetEFtJB7zYF7hn0JZ5XFNCmc2G5kEVNOcirdvp2KGPSx5ATXf/STJG+pEmMmfEeZKnjmdQCpL+smzX29iZkM= 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=W+PXNxnh; 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="W+PXNxnh" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4315839a7c9so77162185e9.3 for ; Wed, 23 Oct 2024 09:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702215; x=1730307015; 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=4FUFXgI6QaPA6jQr/YtcQOxmD1Pid9zdxxQkfAdgTGE=; b=W+PXNxnhN8h1lQ7mkzzKjvXotM4YF1gk4xIbYjqq3w016pK8fLAuWoIVale+OTV1oB 4yucW4Co60DjOp3wH0HNbp/D+VZEJOmyQ6fGcfCQMTylAvjNQVN4pIUm4mk1mazDlOj4 FjCepovdhQr04IIz8LTmkXr4Pm6jRH8djJGI6idxK8Uexq78v8ZHtLFqPt5Z0I3QW/Pz LWPpQu7GAY9Ky4PgIsZixLAxfs/33wgKvQGOYqOvfw9AZVaqju4hv03FyMEUV0tkkcDa AnRXFCvOGlL4HyXrwJK5ZuvvQy+zt4O2QXpQu6SrC+t/pZwMX9oOBRIVGhe12mG4pMj8 Lp8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702215; x=1730307015; 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=4FUFXgI6QaPA6jQr/YtcQOxmD1Pid9zdxxQkfAdgTGE=; b=OEsRNtux+8BY9hbTDQwS76IERToPRXlXzmR0gJrAzv6A1tNOkrgPISEKiqwUtw+t/Q TuS+yaE/aSfqHDjvNInUIneMvpZ7acN5gIUzjtVS/NhNETPizG3y4BEyybPnmKRBV5WV KFE4NUiQrZR/XZztxbo5EYXkefRyHg0KjgwTRdWCf7EzFGJB7tpOp0h4kQfassLV6IL4 YOZAWKuAzEkCon98rqWiYrBJ0CBXnjqE2MEMAjdTqOjVjZP0buaJ3NjmGNDT92OhQdez A4uECo4bBfUisr7QLO4nWV1NNViuFsRqebmctS1zYOPlloampfsUJVGSF0ggAWu15EDE HTjw== X-Forwarded-Encrypted: i=1; AJvYcCW9AurFj8lQlGZOvmx08w9LoKfW1RD+Y3NOJt1jDuBUVjUQkTSt1LS8r2Qi0VAO1O1lbRbi8LTlbR/YnNM=@vger.kernel.org X-Gm-Message-State: AOJu0YxIyqmL+nybgGBxpR8AEMXiuOcpnkorMqkS76Ar9OJQMv/hhHnn 7iInLJFC0nxXkA28lc4VzdSYIgush9XgPGY+GKhkx/5D5v5lmdbir27UrLik0yI= X-Google-Smtp-Source: AGHT+IHIUSOHmyQPqkYRz55BazSmKBq/h2kF4iw8nhK8CZovAtLyhCKZ0YMIVAUaEiQvYpcstK2LyA== X-Received: by 2002:a05:600c:4f86:b0:431:5df7:b337 with SMTP id 5b1f17b1804b1-4318413e293mr25123795e9.8.1729702214888; Wed, 23 Oct 2024 09:50:14 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:14 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:04 +0100 Subject: [PATCH 07/37] 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: <20241023-drm-vc4-2712-support-v1-7-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 917371D04A4 for ; Wed, 23 Oct 2024 16:50:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702219; cv=none; b=F39Rs18Q8C9x8wEbRDqvzxcFT89/MpuAVJoFidsyr8M+othwI9jgbC6GUjgWGE2AHk4xAiuxsZyjKDhju2m+COytlclCDUBsYDrBbEFhtE/rk+W3lmaRaafT5KLEF0YcBZLLNxR15CDroSFE4+f+SLv4qh+RyYpgJZqrVfMRJK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702219; c=relaxed/simple; bh=PqbtIeM1IDQ5KL+eRzNbFyF6Q4wW+TRVdMlqsWJ1620=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ukomSi/tt6vFa9ehsqRMB6nuFoa4T/ONg8KyTUSSLMPKd2ufTuAlkiw3shNfbnm5uFHyoulF/t12xDdUcg2h/KYH0rfytBtD7mUdKyPQOkKueDn34a8NhD/UUnqHeG+pzDL7wAPZJr5HPFu8uAn+a0Bw3mLdxTvXCDrkujLF7YQ= 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=pPbrKSQK; arc=none smtp.client-ip=209.85.128.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="pPbrKSQK" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so72277595e9.1 for ; Wed, 23 Oct 2024 09:50:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702216; x=1730307016; 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=5yIqSMQIbhgYZ5JV0ptgvT7eERweCUm7MDofNLmccWE=; b=pPbrKSQKy+79QbP1q30QHQyjPdMFTSRdR+AK9u/8j3rdMev44zdO7XJwVoxLEHlfIE suDOWddVxjP7vN5kNretijz7HhYtGGp9AOHd7R+0Ve8Nhm7QEtV5tuHu8mJlWIj64siZ CPFCpJTKtJfXxKo6yPvY4dtcJp8y9UoOr+sY0pLasNlRYF5QDAcywk3kYFaeGVw4ugkN udqCyndtIJPtlgYKizcEPCA7CwZCHtqJjx1IYZqSN5h2Y0luijFAV/go+DV5tX5nDYDs wMqFFIIiZC5OaFqvd3VASi3GVHThr/8TwHdhrBnfVnYzS+fW160SVw01ardZqElg7Vf2 Xj9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702216; x=1730307016; 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=5yIqSMQIbhgYZ5JV0ptgvT7eERweCUm7MDofNLmccWE=; b=dTq+/QG0D3gy01wJIrT5/m9/fBXO5JFFt86rB651Tg7o3GBc6uT9R6g39OSkAT6Dnc X1S593/vDTqBeRAIyo+wokPLkTMXSvmj4N5QA0g7FZaEB0RPnmrQ6r76RoknPER3LfqR P2zj83gBN0irKmv56CTHuxISJsBL10xq1Xkds6TqU1N6Fz0LaKcfe10mQ+H/rGChfPKe IWdouoDYw+/DF+FFZll8f1nJvLaPqgvK3ufjBWTyxaaaKcxYYH0pksujfha9depyRgSg OVvq/PESdbYjJaFvqZ+WzBTTD6bQAO54Dkx6vjNnGz7oBJJ8S3VVCwo8Pq5ES+/ssfbU 0jfw== X-Forwarded-Encrypted: i=1; AJvYcCUkRTMMBSXtqWkEIaEDCX48Y+dy89+lJGGY2CDJL2cJbvEHufncg1QQBWUqzdITG+YFBeScpQ08mr8sB/U=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2l1fZsa/MUtrZu9WfTQjQg0yrZiWiDxSB4KdxqxsHxTxm+HiM XUoTQjOywPwLD19bylpn8U4ys83xLbOtQ8TrmBqn2CEtaJvciWDgkdpD43qGI3Q= X-Google-Smtp-Source: AGHT+IFhoWS1TvVBeb/zedIzvkvu/wsYZ/e4vvOHGOZFIjQ6RHyIgZHgWxuLAsd/TW4PoufcpONuBQ== X-Received: by 2002:a05:600c:3b86:b0:42c:b80e:5e50 with SMTP id 5b1f17b1804b1-4318408b348mr29910635e9.0.1729702215724; Wed, 23 Oct 2024 09:50:15 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:15 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:05 +0100 Subject: [PATCH 08/37] 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: <20241023-drm-vc4-2712-support-v1-8-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 4EED41D0946 for ; Wed, 23 Oct 2024 16:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702220; cv=none; b=ciRwl5+2S82dGSPyrl8di5jR/pcDan7kWhn9nrkVYB2/yVhHPfFc91PCFVAX7QJeXIqTB1QHrhwFr9Ma8civ3BNn9fMEHiIACTkpWEuzcpudtMKSmYGQOW5WY6Nz9PLp37LNTHHTtCfZ4yP+Tm8b6NJdPmuzjv/BYLHH0KOmMVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702220; c=relaxed/simple; bh=ApuGSaPtjA2ma9AXolR9QTW6QitKycIfOSZu386qHHc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZFOGts+Ibow/O2WwekcX0YeyOTbDHd4PsBoU2iecMsTyZQD3XNnuOL/3Fe5/d/6GRB647hvHjm4eUqFW3nI7V6zQqoyHzddfIm0Adz468hsooRaNIUdsTYEvstro1AEDTWDzL8mNi2DV0UZwR5xA1Z4bKhUox0F9AAQ1wJA3WUQ= 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=FPQlmBwA; arc=none smtp.client-ip=209.85.128.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="FPQlmBwA" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4316cce103dso60309175e9.3 for ; Wed, 23 Oct 2024 09:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702217; x=1730307017; 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=CAjOVOm4fq5ab1k5/gNzUlva5QRzYnK+y6SB2b/LE7w=; b=FPQlmBwAM3klDjAltHEb4c/HxtkGK2YolRJQ2OAz8DzRYXs5wvkdY3kcl/OWZFvMoE AkVbla8fuu8DmFY6dOMHRjEtpq7a8+w5jHw8zWVawQ7Bh0mQwIfcv2y1Go1LQ6aEpPWi A64YENq70f8tP8ZksdyT8LYmSLW9ne11DtDkIA5CJkH3M/BpOqAK+PJEeuO0xIGGs9Ce T/0nPBzcYwY1uEWX4X5mPIgerGq6ckq11PJa3FPn+R2xRbU4Uu+DhDXL6PRLvLpoTgrQ d+FJB+2OAdsf9KHSiPiZ7bMIEdZKjPVgWN1sNhkpBoiiIM+QF0FMyNNlcN1Qc8AjlSW9 TDog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702217; x=1730307017; 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=CAjOVOm4fq5ab1k5/gNzUlva5QRzYnK+y6SB2b/LE7w=; b=LQpn+PF03h+HVBrknxS5FYi1+0yv0JApLoimHx9fejk3TnFkGRz6s8VtI6vJa9ykk+ 7mm7tyRWAECTKb7GHlvBtdIn5Fe4GVjSA9VqgGIbiD/l8O3mR2FX0ATeHfL7ENjuXPyb pndQDxNSD4vGGfBbD3X7OUMCJGqzW+8lTYfPfSEa3MhtmtTMNLKlPFH77ourqOoW0oWL d3aFay5AxB9vOGiftcnDGlIrgU3HzeBLPYa+ApmzAK++ezzXDEitoPPxY3N9UIHQJuDH ZD7ip8sFGqqa0ch+7nwoeK23517RODzCPpKKCebVqfSpPRAPI0D+V2nLkpV5zBPOVZ97 O3JA== X-Forwarded-Encrypted: i=1; AJvYcCUdXRyuKlNuVYvjiixMkkY/KXP7/JOvtslTJD5CBoIk1hmtOaYiWxlKkQVxrOr9Uc0CsvArp18ys3HsNug=@vger.kernel.org X-Gm-Message-State: AOJu0YyVEsSb8TLbHmu4qHOaXfX/UjCoG+SlyScMZrtLweZHL18avl1i cNus+VnXFu4jZIOEp1haZPamtbXPeyrboXDH6lPUByFtDjxI0M8kx7Iez8L2xw0= X-Google-Smtp-Source: AGHT+IHVp9QeS4FFrjIcAc7te/fMFNp+o2nMTjsFY0IqZ4kCDK5fJrYCjN0EL5R16sqRCOtTkRC5yw== X-Received: by 2002:a05:600c:6b06:b0:431:557e:b40c with SMTP id 5b1f17b1804b1-43184241fa3mr29032185e9.27.1729702216599; Wed, 23 Oct 2024 09:50:16 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:16 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:06 +0100 Subject: [PATCH 09/37] 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: <20241023-drm-vc4-2712-support-v1-9-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 530F21D14E9 for ; Wed, 23 Oct 2024 16:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702222; cv=none; b=cHQy2P5kaA7S2uqQ5jcHFPk1TPXmcgD7U+ofcV5klushIeVLgh5Ac/CSyqgsSaLKg/gLiOh3KHh9KVNNTGGq9ab46KmnpsUrsYD5B+xXzpt7NF8S/kphcBu6x/Wlg0tI/x2WXerqj8+dYFeSWHJx13LqX7GokNvDLSCHirwCGjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702222; c=relaxed/simple; bh=qbTXGGCtCxRZYwnAfxwA9KNcR/Ug/Ds7SZHmLf1ddZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iuTkmHxYmYx7Ov5Hf/esz9rNAL48ywXLAP5G8tkTucIw/pab7OQObf/tvOwnWFWs6IgScCQpPJ6db2OssKh4Prdc3QngIuM5pxLMW+nAzRor2Ckt4wMRtTavIYChyL19m3YveIsLg6LBkAOpEdfEJ8d8IbK88bwMfN2NTaBeH2k= 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=RIEZOMkg; arc=none smtp.client-ip=209.85.128.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="RIEZOMkg" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4315baec681so73398115e9.2 for ; Wed, 23 Oct 2024 09:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702218; x=1730307018; 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=RIEZOMkgwOIyuGJ99o+X87X1vK6Hjd4OClbW5nexDC6RDF/0yg0raqiVuSIvWin9rs jfdU+4tL1vl5JRBELY5DrInBm2o/k5Qmz2sWszTQ2Y55gq6nMqDOCKTkeyOu1eacL9P4 PbQCTV6758NrkNavjG/lm/yfwnk7Gy78oc0WLkfEb4hNh7dKQqKg2qATWJ4iOeLjaVGS 7VeDUhfCeDEmVffJf8k1eOvKwb8suzfxbNxlIPBI1+NfSJHn5CMXSlrc2Dj7VzVYxeT0 MI65NTxg9ZheR+IWd+kEC/0YVVObNdK4/AI70/0mHfqRDP3YxxI61+6UvgV0SsbSx87M oBpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702218; x=1730307018; 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=Wpfa5nXFfcJGWc5HTR3n0Dg96vIf7Vf1f1WZTC4QNBnA4plZiRaBw0Q33EGB6Qkjv+ yiPrFAoEDv3ceOtB2mue1zWzGcCrsDlSg80GSm1I/tny2kiopPrbJsH9myV9ccKFir7w y/g690UdaTvaIxrIOZPROPBVaKFiUTcdPdjeSq1yHknkXh1j1c9D+rNoRKMjqx/0rmQ2 vjZnzgMuf85YOiL3yDPTmhulld5/VGpUmXgqoJRcppY6J8OO0qj7P/QflQNN/cUIX0L+ A6NdmPsqLnRjSL6n2O0M+iFEpZEoZYpcFvgBnkYa3Z9AJyhF88VqtP3qDjJw8OsqhU/y DNQA== X-Forwarded-Encrypted: i=1; AJvYcCWC1Gng3iIFJqsE13A7MnsXzfsryfKOjwxFJxLAc8L8lFFbw16DmZsEgUpcsSY8FgP5P8+cV8bdzQcXxgA=@vger.kernel.org X-Gm-Message-State: AOJu0YyILAQ1b5l4m6zeEVvWPd3a2g0+88JCttGyA74SS/rdAm9G5tlL jFA9cdFEsLfBhPjVoJ1Xj10zoXpzU9B9BOxKp/ancfpnfkpV8UKi5cf9Hw1I4dw= X-Google-Smtp-Source: AGHT+IGRXt+xjnUqmt434Ic5Jf/wCUKhHYDJmvv7fkNd+2lWuUEM38OLLC7VPFEj10VF2wQhrQ46vw== X-Received: by 2002:a05:600c:1d9b:b0:431:4e82:ffa6 with SMTP id 5b1f17b1804b1-43184188334mr32238395e9.24.1729702217658; Wed, 23 Oct 2024 09:50:17 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:17 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:07 +0100 Subject: [PATCH 10/37] 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: <20241023-drm-vc4-2712-support-v1-10-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 15C161CEAD1 for ; Wed, 23 Oct 2024 16:50:20 +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=1729702227; cv=none; b=f3lbBjLT8Ke6t1yov0xQwfmXAvYmwwq115Y1iWUVuwbqq4fB11xSLTSABbBB64dhRalwJksbh0cQBBvPSh0WzPfobd70OMvo7Gxb9KJ2hpkRFM/FYgoqC1nSYYbxgdvJVJ318Bf39Nbjm1PnUNFA+5ozRibpO8yWUrxadpbRV1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702227; c=relaxed/simple; bh=ecnDLRcDlyYm0wBfzThIcZutVDkeubf1k2JgV/PbHsY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CdKlhWRrzszqlCB1ZMH1EcBBYI130mYXXXBV2Yuro+Qhne2gQJS8+sNxHf/2U/GIAcWGtqxlOBYHKHY4O7jYHUG+i2xVVHpqlYKIGs/eHQAIFxsELi0PdRH6cN7J/9Uw6lY+vXzE3PpJXMUP6lOeJqCWNdJ215aCOd9e45gxGg4= 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=pfh1i+ar; 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="pfh1i+ar" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-431688d5127so47404255e9.0 for ; Wed, 23 Oct 2024 09:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702219; x=1730307019; 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=/CSPRblkhTO8rG0021Sig/xg0pFYEX2HR8PV/WJ+JoE=; b=pfh1i+arXhLX7cntdvPR17tU+WSIsuH+uvLsnK0fE6LW/et+TbJRBGpNOUdxCPj+Is OMYIvHWT4zDx8K/yM8fBbzPW7eG/IxuJt/lu7cvPFgVxHcjtyBTP3xib6ygCgxw2E5Uj E+Rz2D1gvu/xnq0afUzBTjb4D7nRNxPaR2k2atGxhjrtOJg0QVoPiNEv5v/Ggt7UMG5S d5BBXvwZIBDjOh55o/IbN8nRDQMvaJ5fFLbxhpVhUd712ciy5J6a8dk7W+44kZe98ABX nm6Aoj+UozHkWAhKj88t6JEFNWXNBIeXPjqlYswjma1TmsUHZeDMGjXgSfYSS/qHW5ig p09A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702219; x=1730307019; 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=/CSPRblkhTO8rG0021Sig/xg0pFYEX2HR8PV/WJ+JoE=; b=PvrBy92IbSvd6NBQ+RRa1NY0ytPDZZITHpiEAYmG0xGmNV4wbgOvY44OGhRUNIl7RI fJnPTbMn/2JNxhnizCL+4PxwxoUzlDjHGfPW1cJMJQ2bZLDVKZuFoVtmOXrHEwc2V0X8 39VC43iOMustgrDk5tWjoSLPV16Vu/vsANOjnFAY169ksJvmETIQ3meIcOP+HO2rKNC+ b/mmipdpgwRwUWsu4CvaZgSvX5qPiRSWspSaef0I/ffmqzc0251Ord7vqZC9YTcAhyuz +Z3sX2FpUd4bPZ+pP4hA1WwyoTBk4xroSVCQQmanOGwKZ7dmnpve/OQ+mDMmsgu28nRS f1cA== X-Forwarded-Encrypted: i=1; AJvYcCWe7jXTCKo9gyR55nEP7MKrvgCT53AQmdCOV9iq8hoH5iG7wyoOYhXAK9Tl4PNd9E9dxAYlXhBfvBs0u4s=@vger.kernel.org X-Gm-Message-State: AOJu0Yy55zl7cySGtwbdptpi6FK2Ezh+H69cFv7ldCRK7o9xYmu2XAdn cKr5oRsx/OW3QeOu9/69WaQnqbbkIaLS8u9MC+ExvNPiNcS0yjVum7RcpKBn098= X-Google-Smtp-Source: AGHT+IFhcREH5WyguN2BpkQSvGzo6i/YMXNpbOrOwRk95FtJ99WuGZ5Y/qS5643uN3+kEDqyZrDnvg== X-Received: by 2002:a05:600c:1907:b0:42f:7e87:3438 with SMTP id 5b1f17b1804b1-4318407f750mr30191515e9.0.1729702218810; Wed, 23 Oct 2024 09:50:18 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:18 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:08 +0100 Subject: [PATCH 11/37] 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: <20241023-drm-vc4-2712-support-v1-11-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 | 95 ++++- drivers/gpu/drm/vc4/vc4_plane.c | 767 ++++++++++++++++++++++++++++++++++++= ++-- drivers/gpu/drm/vc4/vc4_regs.h | 181 ++++++++++ 7 files changed, 1613 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..5606ded928e4 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 + reg =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..a5cd9da5d6a6 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -320,17 +320,59 @@ 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: + 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 +382,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 +430,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 +481,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 +1120,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 22:39:03 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 84AA81D9684 for ; Wed, 23 Oct 2024 16:50:21 +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=1729702223; cv=none; b=K3jy3UYXTtFkuGIYFy/CH4nkDdckMdjSflGM0pwCARwipPHGnTdYlzScFk7qsrJ+Ax1CEBwGxLzNuGkLXMYYsKwxkIMRtJvky5/M4zxHD9m6NabsD5NKhP2uO0geRM2hEU8idiaPj+DSslxs9k3AfOn4Vt0m7iG31ChKW3UCt4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702223; c=relaxed/simple; bh=AKaxaAWgaWZCuM+ciKXobaTSn9sWMMJz3W069vSvAMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MSry07qq3TDlVbFxj+3/wjXwSvI3AmuuTe1/f5FiT1P581dYvP+tBUO4amFlJm3a4IS65zEVx+NxoncgJbpDdsveYBqxUhVUyFz38ZDH7diNqHH7q8xtHGq7b9MTKuH+OxYGZRdqd8fbwN3KPOHXpgU3B3lfRYQ6NQIWluw5E1U= 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=A+TmNm+N; 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="A+TmNm+N" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so61814865e9.0 for ; Wed, 23 Oct 2024 09:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702220; x=1730307020; 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=A+TmNm+NbgIBV6bhacgYlndPnYC2lHQRjbHDemkWH8qtuL0dnskaV+Alg/4vCsMNuG nTdsaxdOVEN4VCERFjS1w5PZuAToemcdKD/PMD/C+A+ChqZqGZrziKm8flevUkNfiKDF p+qhFz2MQgyBj29e+dWZMHyMZjUOD3+YNNZMKpfOFFf2PPMyyIHJZX/naD2aemvexLcM StW4Cl5v3XkiTgCYcp7TtRrnnytX8FoEWyjPVH6CmVzrTTg7SHywB1gcowxe36yxN9q4 t+D4DER4+bU3cbGHt2/bNPlMlgi57UtjIwDhbh2ZWRcnMD7M2Wg0nnWP9RrQahJxIAd1 W5Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702220; x=1730307020; 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=cOAv+vCX3KjwBwXwXoUwJWptY85WGrldUD1yIQSOpSiyIgMxkRwCt/l/QDOrBfDnMo QvDdbBt4ka71eV4AWT9kfsyYzPs0RCnOVGx+qn3L/IkUnw29K3cdVLpnEy1LcRo4NAeM JiwzOiYw6tGVwOzPE6DIat6gTWtSFzkBInz2pWidaP50yvnzzZ2AjQZ1cdVSh3Ri25kI lig6Ms3T2t5CboV2AAFjwlA1RYgWygCjskIaTUYhR8kUrZNgsCgNnWW3cBJVDxOQf9HS XCJiRkVXH3mIUts/Eem0/AG1zB+KnnMAdJLaGDwkYdS0JODqdFVUZ5XYGtny6MyeVT/h 5NoA== X-Forwarded-Encrypted: i=1; AJvYcCWlfeUN8PTbuW05QV+g4ymzsxowUWA0VDPV+z5q09zfln0PqTXTEdmwBA+qMa2TfFK4pCqGPUwq/Eh10QE=@vger.kernel.org X-Gm-Message-State: AOJu0YzywmfEdlrWGEx62OVOAyWeiysDWu5dZPuvHkXBncIMB+5732PC yGvyV59tz/avt/bWj6r0Wyfequ8czIlFFB/hTnN+W7ROxX0zLK0CzUtpHMoTsYA= X-Google-Smtp-Source: AGHT+IF+z5G2SpbBJXEoTC4AhNnyHaZc8I8tY/B+b0FqCsjD1XtrGZGyhc0Zli024GaKfZ4+HiMwEw== X-Received: by 2002:a05:600c:4fcd:b0:431:508a:1a7b with SMTP id 5b1f17b1804b1-431841a3efbmr26173175e9.34.1729702219677; Wed, 23 Oct 2024 09:50:19 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:19 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:09 +0100 Subject: [PATCH 12/37] 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: <20241023-drm-vc4-2712-support-v1-12-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 CBC701DE4F7 for ; Wed, 23 Oct 2024 16:50:22 +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=1729702227; cv=none; b=X9ElfuEZzhow8KlfL1HH+SJZPEFUObBzEm7sI5nOqB8D5yTbO4TNy7PVslajMx6L2LYy4jAm+r+QAJNMpDiYS5Sr+lCCh2zRUPk9N7FGaCiLSztf3fPAnbhd9sItSTElCvmhtu0ALfnq/0Lfc2SEY5louRI9KC5wJqRbiC1+5iQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702227; c=relaxed/simple; bh=QKjWkaLdw80x5ddiItxQBnAgbZO05OcdYIajPbxmLnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BqeSUIVq+OBdhvz96dnPiEWHxLKIvBmJ6bnV2+a3XVcPdkrxoE4YoQElLVfNU03CwXCSaT1SU82pv+fNxhI2JhuTToxnseYvR74hZ4d/XCsG7rRUHnnfk0/rZho28T9Bq/YzvWYFAQ0EPhuxU1jJu6DCI3+3RyaU86J/gDoQWcE= 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=o9cYUa/N; 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="o9cYUa/N" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4314b316495so68471105e9.2 for ; Wed, 23 Oct 2024 09:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702221; x=1730307021; 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=uRMROEoKr0rDFjVemBolHcqN+oJwuxutLEOlAUqUBqw=; b=o9cYUa/Nfg/R5WBi7xpd4Z2iWxw72AfoE2uh4anAEMkTYkartAvkRljH3AjhiUzUhs ZyGBISkBE6y1KQOTmzXnhrvmRhiKUg6uLjXKte+qiTYMrsnx7PqzzpFJoXJBC0JXOhzl BDzLZh4czKbtXvHcI7P4pkuyVObSVA/IywU2WMEZSS8Vqo3YX7GuEgi+3LBIF9XS5vhT KqP01IsvTH1goRUs76JEkyTW/oQKMGzUaWE5GoSYhH8+HmwnrsWd18qOT5zdbrv5Lhnt f8dKzsHL9PgDWUCSNPxMpt0thDf6ELhedlHbeBDDHz8WFOGjO+3Bq6Wr3kaNMsAsPR91 FMPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702221; x=1730307021; 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=uRMROEoKr0rDFjVemBolHcqN+oJwuxutLEOlAUqUBqw=; b=UXxokCkGvdAevfBNg+WIT7iMIufRU5RVIF5lQZWqhMSxhK15SivVRK8n8FwnzVjUc/ QajAeEBBMlxNOI6eDzjZSpaGZLQFfm/NrAa2pnnIUgFyAq5lOYIXzwI6W75W/QZaDn1M n9+uWusN7o6goionDyF+RxYbTLHk+4MRAPyfONTFDviOUAE2Ojp7MtSlwejabDT5mPh/ vkdEi+Zy58Q2xHwxGVpSprp0+i+J++4v5LhXDVk7nmv+91I2W0l0R0Fsp7NGxnk255El VVcRRu5OHCylhwmO2fKpGqDwYzWzlHgodkkZG8GDPdzMNu1qcxpFsPDY2XLngHbNwICe i//g== X-Forwarded-Encrypted: i=1; AJvYcCW+sa/jdjyZHKDUA3cnV0fxwQApHxsfUIzQDWR7JnB7/mReiJIj5RVYTdHeD8GDJyW3StysCBsIzmm8TNI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg9SQTQowlPeTuIZZXjnK1KmS1R6B37SJOhvSl7uTj8b7HLc4c E7loCLYzKpnnWP8wadJhaC8Wa8O95r/xQSpbABSm9Jtr4KWrK+9xAMjI/ErHjt4= X-Google-Smtp-Source: AGHT+IFuaROuQk5cS7DoBg6X5wuHniwTxNvu9tgjTcocksvunUgVLgP4kiniiwK/pOtjWFurEdleNw== X-Received: by 2002:a05:600c:5114:b0:431:5f9e:3f76 with SMTP id 5b1f17b1804b1-4318415bd5amr30765245e9.16.1729702220863; Wed, 23 Oct 2024 09:50:20 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:20 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:10 +0100 Subject: [PATCH 13/37] 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: <20241023-drm-vc4-2712-support-v1-13-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 6ebcc38be291..95ef8bbe6439 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -850,6 +850,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 @@ -866,14 +867,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 @@ -1493,7 +1505,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) @@ -1599,6 +1610,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 | @@ -3126,6 +3139,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; @@ -3158,6 +3172,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 @@ -3278,7 +3296,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); @@ -3412,10 +3432,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 22:39:03 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 7683F1E1322 for ; Wed, 23 Oct 2024 16:50: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=1729702226; cv=none; b=A5bGpuA8N+9pdByINJTECAFE8r5dchmxCy8qOXoWYGQl1kQhqfCDKVyQBijpmW58IFXJn3LxeTSTR/msJDYYCmKcfrUztsY00qo6UltuEUbpu0uC5oFa0j0HKwwa4CztYEclLy7qfG27fRchQ7j3U7bYCbFtMrtF8cjgRjRopqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702226; c=relaxed/simple; bh=WV/UFQyvWXojwAqHvOtHxgMXrfRl7lw3BEm8g+qz5Yo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iv9dm9wMSq/4+UOcVHE1494aRhIC5i3TXVa+rMMRRsoWc2FGDXUebKjU6+OPvl+PLNKcEsDR3buaIQ3TOBtMixJ5qXXbPr/xRUnr0/kb3UFy7OO8dd37wtZOLhTbakZOaiRu/aPByl3Mbp9YWcXPh1cIvKMcU7hu3SwvDPkfmCo= 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=rHqEfdND; 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="rHqEfdND" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4316e9f4a40so45418265e9.2 for ; Wed, 23 Oct 2024 09:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702222; x=1730307022; 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=rHqEfdNDHWs8l6p1juhQDS4IGrQcuP4dgfLM/VgLcbRQMz3zDaZRT1p5RMXDpOEXpr UDxWLYi9h8n/HpTlwwRyX2Tlfg8k0e5lDWcsJOWr3TCYc++OBfcSmbHeg1rDjvlZLH2e TyLWqVNkmbp4bxSoexWNVEsRgK2CFGmmm2aTDx96nF5iIKUZojHwqPW6pvZv1OYQKoFr 24rv5Whs1h5px3kTlL+9TN5idLSE6gV61VEmGkx9Bb/I6i3a7AaScjyCyRBKpMzVYtn4 CGCYpX43Krw13XIraH0tu9VSoQgWv1yueZhmIKhrapl+C6qiTFLuX7xjFdrqJqGr9c8K NhYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702222; x=1730307022; 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=HeHkLBFQ1VD1DR1ZMJ1T9PIjU/4C7pDJIJuUzzqRTCBSkKZuu9yQGLWWn2uEjA0iGy 4a+WmgAzvWZhQls5NEc8Jynnd8cPPjQgWPwTdD/8SWF0jQbi1GuMj+zX29NcPLhKIWgG nvJcFsuBeDVBgvcsqvEa5uVZeuwug+pZIO8YLZqKqbf5diPw7bxy1UHYXGt03sAySF6B ZxxYfDohyTmr8LFkHo0Zf6QOLjWQNQIQlRiob7Y2Gjon5u5xv91Tz5FRb4MB47WIni+V r74fdsOaF/sJH3dCIJVYAVenTNLeGVyUo74wV3vzLtV/ar+uOhmsQK3se7K6FvwCLjyi mQEg== X-Forwarded-Encrypted: i=1; AJvYcCWiFQP+f307/uKloKn48ttyMXhEhm3VU55tSHfCQE7ooVvB0kwowYvJ3SwQFMA10UPHq25ZcwT/OQ9hxVQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9z5MiFbO4OAjxL7XFQfRblSXQEomTLPPEArbNdtsYIWyKayhL CzUYYQcTL+tS0r5iTMqL3L0F3SRM7z8kPKCkp30IayIEcnKlM9q5vazzaNu1GFk= X-Google-Smtp-Source: AGHT+IGVp4GJMwBRKlS9Q12L5xPs/An67Q2sllEQsQWhIVdFiJ7lcu6JT07uXS8WxSxC/y5+CBUMhw== X-Received: by 2002:a05:600c:1c29:b0:431:5df7:b310 with SMTP id 5b1f17b1804b1-43184142c50mr24298445e9.8.1729702221727; Wed, 23 Oct 2024 09:50:21 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:21 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:11 +0100 Subject: [PATCH 14/37] 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: <20241023-drm-vc4-2712-support-v1-14-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 4B28D1E22FE for ; Wed, 23 Oct 2024 16:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702226; cv=none; b=UfYwCvOOs1YlTuKz8NXSM/s2Y8px06Ht5LOQGvix5HyI+rOSjoq2wE4fVPUtHWdFvVR6CwNaeAw+QhuF3jbgRcppwvOyvuGEnOReSjjkyIjirPm2D/ctr4DE3L5ST7L8r0b/V9rsagfPQAZgcdEsPhJpD8pKw08MeF/bg2ZAL5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702226; c=relaxed/simple; bh=HzQCBtQCnxLWR4MqnTAho9PePXTWdc9dHx/+VUH7KOw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hAKV8pQSMz+Uetq2GWHMg+UkIa09tK4KODEGe5q8CbD/Wyj8WBv4rzvpnqCVr5v0aYeVC09BKgL44QyTYuocVNDah5N/ac/wYlgO6S1rbNSmYy+bEUr2IiAcL/SHppBMr00EtBkMWKo519q7ttr22SScwM/SRqsOZD0yp1ynftw= 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=fM8h8mvf; arc=none smtp.client-ip=209.85.128.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="fM8h8mvf" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4314b316495so68471445e9.2 for ; Wed, 23 Oct 2024 09:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702222; x=1730307022; 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=fM8h8mvfBJZ4oIuFYDsNRLufvReN2CL95yJ/pGXcr+kHnuDq5DnpyHzOwT7Bf/hJKp NDG9/WjCwxPf3LUKE108J/nkCAzYkpGVTU95CqIgZkkTxgpZMxOamakMGNbzSUsAquMG rOh3W+VYLReS+3MfhNZ4W75pquKnpZykOivbaOz8uSocIx/T/TV3Y3/y6MKzGmDWbB63 klKOIJI1UdLzelOaa1st9Snvb+BlthGUbEk8irm5dcOkrEtpHrWDuA6Mv5nGUU7PjzlP SENsD94r2L58GO6BMQkFiPjQEi+Sc6vBAkhFfwibaoRX0pjTX9ARF+qcJklrRJhE09KW I90Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702222; x=1730307022; 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=i59/fr3KIUVdbyrKAWbwfHg9WAx6LXgQlaaEJ0fnqxwnWw8XtryqdGv3kzA3f6Eg66 4tpxcddsmMRe+LckghC821SmBU43I+04Bpj8GJuHFlG8Gcy0U4We/GJK9g2e31bfAf/+ +oiamy3ADwLYijilTjqo7p0se9E4t7idLLNJ1OL1+9LIXc6KrZHNZbOd2ucv/UaViGrr SUc0f9Mn22jhiISKvwPOU82/DIt4QQTKWKmsS/yzZJKputyf/mn28VD59Gu2wFYbvAuk hJ75O0W5YMJ0utoujmLplbvv/XDqRJBL1dBsO9BGl8IzTdM3aM0HDWWyn0foQvDuO2YU X/Pg== X-Forwarded-Encrypted: i=1; AJvYcCV035p9DN7xncGq6g25O/4OS/AZVIrEZibhHBj8DY80KvmsoVn0ZEP4Ht4Ci5/9l3/ejHR8sP5ru0LPxwE=@vger.kernel.org X-Gm-Message-State: AOJu0Yzu2D3/VtOfcxejyEs9O9Rr47z7Ocb4qbgWUbQYYQm0o8+u6u/D w+5kmH/otjsNzBNFvdAengZ1dJGftfJhnHOSZ/KbSqngPJY4wttvufAbcTuA59Y= X-Google-Smtp-Source: AGHT+IFI36WmNXTRV4DxPlE9LTtOwItl4jqcDI9buc5n49Q8WtFQEB6vJFj2nzepFaAVYzIFdCfs7w== X-Received: by 2002:a05:600c:3b9b:b0:42c:bd27:4c12 with SMTP id 5b1f17b1804b1-4318413e4d1mr30434035e9.10.1729702222575; Wed, 23 Oct 2024 09:50:22 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:22 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:12 +0100 Subject: [PATCH 15/37] 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: <20241023-drm-vc4-2712-support-v1-15-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 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 8374C1E2828 for ; Wed, 23 Oct 2024 16:50:25 +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=1729702228; cv=none; b=dCs64KtVRPPT2iTvOqWGhsa2C0B/S95rufBWhyee4FUndQu2nK57U5yaD0Nqa9X/hhvbaTPjQhn5qC+RrpDNMEuVUMBPmOp0H4VhdnBnk1P3qiIWvCUXWfDqU2cXTTgkQg+2qHrlffpLkMfup8ztmSn7ImbCi4o9brOrILRy7lE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702228; c=relaxed/simple; bh=UWJvMv3Z0a1PpjzyOCbjoPTg3oDPbd1fp/cxOBSwg9c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DD1OoO2vziCgzjU6mmN2/z9E21fmTtExbeElWAr3/oD/deSMJGflbrf4+B3h1yqBjdutCROKvxlG44n1+RDCD5EOc6Tw6rlY8ZPGVy86KgUYp1NpDS6OsPoj47IXx83+fnSBkd3TnoD817y2SQq6Mnp0whgg9jsgQUZwVA7MhHk= 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=WVyScaqg; 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="WVyScaqg" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-43169902057so46654405e9.0 for ; Wed, 23 Oct 2024 09:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702224; x=1730307024; 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=WVyScaqgL6Kb4RZC86dG6CNTPk9F8zekv0aIf3b+HftV8AUm41975mwhCYe0WBWsmk EwoOQv4sb9dKrtJuCv70S+RhmLEqyInEY07VdWUxbv/s3tTBOt/jZ3G0kk6/9cKvdnqF lnXf+GHxUmws6MawYEH0L4oWRy65exccsEoFHCaa3/OHkRcoUXCENYp6GXSpv11Ahn+L R8BFaQbg00GDzRTa9KCfFueGeF6kXrMD68KVsd/Hs7fzSNtT7WCStkmn/lMxpgFWLHXd u2ETcUPeKCC9U9uLvXwUSPJ4oCew84rRn95TgvM5NjLGn85EQeaSwkgmaIBTM/pi5EAf 4Cug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702224; x=1730307024; 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=c8BPEDPIdxq+HZlFQqDyn8SX1FvUTeOrdooV4hbhQ4Sb4O/IATaXzDeIbjjomvHabN klS93IDdEqAUIWW7OqjA7FXYOElnW24eL05jIYH2oN0dRCgVCiXBfcjT2+xtzu4nMmRF xH1Zy/+jqywskPTDsgC5lCshtElMwUoZjF1+MzSgcHr9L1ExhvzZlbLO2cu4oQKW6J8b VnROoFHVbtsaoH438gA6X2fZm7hVPYFZ0Yi9GofPZCqxWicSwdGG6kLPbr5iehIE5GmQ 65PfQmZvznVOerTdrPjH/zZLNKX/7/iR/P8VsWK1S7pvIEdyXd/aMtovJkDgVlStDr5F jsnA== X-Forwarded-Encrypted: i=1; AJvYcCVUoewVJ3KSUpMygN0bvK8n34h4ydw0dKro4Uf71enAuydpmPATA5PfDCzCM7qOBgr7VpmZFiKuriuOw9g=@vger.kernel.org X-Gm-Message-State: AOJu0YyjWrZpIygjkLg+pfclgtfyHOYFGsJzWnz66KjMbBlWsQqZIc8M zeLzlnF0CZ0LQlAhdPaN5FAsOcDJxjfEblfvf6Gvlxv/KpVz/A0skHWVbLbOOMc= X-Google-Smtp-Source: AGHT+IFQpdDu/f44Xgfd+NG6WrKmi4zfDWeKblhsLQsMneFB4Oq57+PB7CTMU6NnjVTgfyxomcFzlA== X-Received: by 2002:a05:600c:3b16:b0:431:5ed4:7e7d with SMTP id 5b1f17b1804b1-4318415b482mr26031435e9.18.1729702223590; Wed, 23 Oct 2024 09:50:23 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:23 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:13 +0100 Subject: [PATCH 16/37] 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: <20241023-drm-vc4-2712-support-v1-16-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:03 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 71C4A1E47B3 for ; Wed, 23 Oct 2024 16:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702228; cv=none; b=hW7QCjWYoG1GAPBU0Qo2AKvU5sqwc192cIcABqBn8jMy2A+C9C0eStijajX/hL9xFIMzjJCr8oHjJVpStoP671Yo4NYr3nLhee1y6ZfLDY+AzHO038nO7LrSjwNizmHn6u9X67IabJQgETlJGfZZEiCA5ugpIMFN38lT0L846y4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702228; c=relaxed/simple; bh=1hF1PhNYP2/A1x5AcjvXgQw18E7kHCNzlJ5ort+1kbE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W5UJxIEbINNrQAZnIB/vg8cilh9E1vb/dxE4gKHD8+mdoSPcE7qRFs4vV2uU/72/yeszV7dH3HYXrkG4FQEJDfqkZSWH9LYEGe8bjmtCRRNU63uDXGKJrfVd5BET9VjCk7QKUg0Y6z7G/ynh7P+hAy0KvX2YHiODM1asBGluk/0= 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=cHwryQcV; arc=none smtp.client-ip=209.85.128.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="cHwryQcV" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4315eac969aso69675e9.1 for ; Wed, 23 Oct 2024 09:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702225; x=1730307025; 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=cHwryQcVjT6hHhUCg1DrGAv88Qk7t8+awkpMmAQeJkJsvn9spH6X9LT21CYaFIhkvm kxrRBGqn/39bIVDKrs8Rfa3Zsduls1EH/FU7chZcWzX6U/swiwZW9wsly3IiDk4NR87l i7iGbXLFAVi6U8+MHQK0XgTC0mu/4AicGkwbgUIVjBALIL9TVwtJbJAHqu4927UFkYZE 6FalQF6exRvY85LkQ+mVT1lMlUBBj2l1GzI3eIq6ur7ZmO9aOYDVaY04pttrQRELlrw2 uyCFSlnhiMXiPgajJRhOu/NkxIJOtUgL5IUlAILtJg37vVxXNegqZx/JhRHFHONsGOmk i4kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702225; x=1730307025; 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=Pla0xWyx2RtS8Y++xU4yZqHcTelM8am4yY9g1JJyI7Yu4Bmmbi5z1uRkQ5V3OLSJ4V 5XAfxI3Tjb6tEcift5v3BnhHJFFfjtozlnBjLXJECLHWdWJmVKGov7D+59yPOcWVSn2/ 91BBAAUOKQKxkyj41al7PL8Yafy8UzKIm55X6jADuiLk8IxHeJkjy9v5Ea+IsZvCjZvO inI0sIPSoCViz5Zx7gB+nDLV7PCCjXbvn8roOPijjEr51TLANOXjBQQ3t0pgsvnw11NW jl6hEb8IDdNgh9yiYsbq49K5yptVKE0355r/Zd16Z9PoroQs5oYUEavqANv8GztF1Ytz d1Jg== X-Forwarded-Encrypted: i=1; AJvYcCU8bHOvZBQz/yrlVZ7b71iBEI8Z026WTmTFkd10tbmZuaNzrvIJ8xOZPzNBueRyQ+wdH38kT+Gwes1Tjg0=@vger.kernel.org X-Gm-Message-State: AOJu0YxfXjUMrcA3SdKU64sVYiPXQ3Por/oGuSyO7xkLDkKoWyZB0tYP 14zb3go42k7gkFmmRYtStEorQ9lpTI6hMnQgmSGgSct25rsCkTQknbGu9nTztmU= X-Google-Smtp-Source: AGHT+IGF/wmrQgX6tkn2u2UHI/gHpOuI8sr3sYRtr4SIzuUG0YYH6LOTQMbTm4H44/RrLqlF3LH1FA== X-Received: by 2002:a7b:c455:0:b0:431:7c25:8600 with SMTP id 5b1f17b1804b1-4317c2586e2mr46271995e9.2.1729702224583; Wed, 23 Oct 2024 09:50:24 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:24 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:14 +0100 Subject: [PATCH 17/37] 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: <20241023-drm-vc4-2712-support-v1-17-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 2024 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 444591EF932 for ; Wed, 23 Oct 2024 16:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702230; cv=none; b=qq0+Lf1GB1MGTOwEneuD68es2qtxAv15pzZk9c3L6/1zVLyqWiKZ3O8eKfaJ1zsENh8/nGUTEdt3pLqpRF/iX5OO3FCleFDcUA4WLlqFb/b4CDI778z7kqK1mqUkr3wVEA5paxUwucRDYXNMBYeeRXJWvtzLCfezdTe1AHadrbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702230; c=relaxed/simple; bh=6/0MGSFMLpItvDKAiuH9HB3iIfeafKjYJItOtt2uxf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RiVFbbtxfmbMwI5rSI76yb4qXjYOKeW6nTY5UdY0XH2FKGd7SpkDIYEAnPlQrh9qv/7cQhAHqceo+t1oMtvQMJAIBYhaKvLOEFbYpWI/PGpzWI6rEyjpM8K6jLeoMAPfVu+d2JB7L9fswQf+BM5XduQOWajOn9kGP/35zWqYqpI= 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=VXForXIL; arc=none smtp.client-ip=209.85.128.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="VXForXIL" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43155afca99so7805855e9.1 for ; Wed, 23 Oct 2024 09:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702226; x=1730307026; 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=VXForXIL+L0Yxw5Xa3XkrHUozggT0qXgvseXOGWMxc9HrdbiQVio2LKXozBHMJUT9Y hKJVcRaCzSRX3Sku1tskS7gOb+hKRlT9IFKvVQkCBwz9OLIqOq1AG3Oq0Uy0C1ItT2Mf TBZ3Bd9zO1YO1qqI7ejyzM2Jnb8GsC3IX1PafLfWDDFxI4Fdrpx/KT55+NLmkRpo9n8M JOIzuEI4BcuSXn95suxgPVdbTVKux21VYDcziqsPT19vDinErCvLLmp9dPpRGhzkJo7y CqzedaFsakVqKsFzRXgEZ8+9FXCCLl4yzh6Z8Arr7MOGVDouwGN5Yq+IYygL+QpSnGh4 HBLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702226; x=1730307026; 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=DjRjcGqOlnJTUB8II37Kfc6qV92bA6ts3L5d2PE2dSDYX6+BqD3novC1IKHD2OY467 7H5I+yZ/3CuFAdjHkkneTlxsf3BTE0QfGXmqMwoA/JFNwuB0L49d96YoFvKs/4wyw3Cm nH1VONqknuxEUCWUOK9OzO8/O5KhjZag7PCuiUP2ergyZC6EjooXdw8w9BLlGlvjYCF+ 4SgSTLsmk/ztX+yAfDnmb125/zoYqko5c3GgqszWHu7aAw8WxZoZpOHrL/QxlSpLWqMP zONIIeY05XwgLPtwLu/b+CgcxOhx4lVkgDQsEeIuihMCk+bQSUt92kYqUhg+ZlaFrugp eZjw== X-Forwarded-Encrypted: i=1; AJvYcCUV7iO8ufu0/C03EY7RqlngHDWa7YLUWclA4685ts5vrlpNLL+WV870w9lDV9jRlXqKVska6+Zh/ez5edE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxdw4Z3TpJmRBrqG7h9qo6pN/gYEEMEKaUBFdLHGsKrP+dLWO6+ 8U/G5uU8ugmyUv7z/shosLWvrqDbpF/DK6GpyD4u5jGb+5HClABxKujMJPASXKk= X-Google-Smtp-Source: AGHT+IHL2wgt75iB2bh0ZhjUQkAbPcOQbonRHG1SD5jdc74+CwqD//SyS484BHiLP8yrR7PCt0OkEA== X-Received: by 2002:a05:600c:354f:b0:431:57cf:f13d with SMTP id 5b1f17b1804b1-43184337402mr22456585e9.3.1729702226319; Wed, 23 Oct 2024 09:50:26 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:25 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:15 +0100 Subject: [PATCH 18/37] 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: <20241023-drm-vc4-2712-support-v1-18-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 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 17D521E412A for ; Wed, 23 Oct 2024 16:50:28 +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=1729702231; cv=none; b=Unh6GMD4620wrVGzAANNBCNOWdWK/bAitLSAv1yB+j25/dEX3BmhiKXDT7+sauxqnLkS9L/rU2j7o7uTJVX2vua3pgJxhk8S35hJJwOJNfnG02bl4bof7QDJ5mbj3nf2wbcp5vKRlJFc+yGEiHmxmAkK0/ILa6WzPdUJt4beqHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702231; c=relaxed/simple; bh=R9RFlDE7CyX8MJ0zzwylUHAIJONhAEoeNvhpIVWQ/rg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KhNz4Lrc7FUbdoxQky9AeACJE14g3x/lVKKerIAp6EGHJ+kiNTTWk2DPkUTqGvPHOCDOXydKd7MaKPetuxqem0UcTEc2HvhdX5l0QRY4fV6yvTxlTnoOe7wpK/VbhUVWF+kYgIFvT/abKFnjHGpAmISZ4igTOv6yg6oLnq2NuEM= 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=HdDumYZO; 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="HdDumYZO" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so72279585e9.1 for ; Wed, 23 Oct 2024 09:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702227; x=1730307027; 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=HdDumYZOpCN4yg16gSynPKMlYM5Fuekx46ab+giL19MgxFh0Hc7N9QWzU0/dS0v8e5 jly3GmJieP79nvUjDEQHz1Do/tw4Y4cxtXVawrWRsYcmvdzijqelZF3j27nWLCkUJgee ujNY3pfieUPmUwWkFbNybQXWYfEsTmA1ZI0Yk4LROiMNnsnQ0xI0i4M0OJvWkBkPJD2W v7rwwtPC7ru4qySdo+Ruqydmv5GZap5+5ZsQOZmGRAEyXFsDLDE8upegjKRwJgMWD5Nf xh6DqtVrAM0WtTx4rFyIqJP+GqmCrPmQAzQC3xgHE1oCwqEd20zVlG3SrVAf6YjRrrpr BmZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702227; x=1730307027; 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=ZkZ3UNk/3OwlomW5ac5RrsFClDDcC1izQYdfh4jD5/kGXobX0bzer0X2pjzWexdyGR 8IWDgdF9ts2vti7BK/hM6qeCFw1vGbKEA/icZ6lTNv0k9tfnyH8kW7jw3FaOUc+VzAVT uzoSUoi+zSLayN820xNZc8MjqBKa55Nec6xOt6k7c0tHtQthWUdNxPeIkpeLQmiXMPSv QOXrhvPBybpcs6AsG6V+B2GHo+cLHi8Um59ye3gA2OlEvvFpIfFaIdpx40MR1iUsKP0u geSdq4zxvpmZim1xs6QekuLJB9X/RHFNPy51VrpCo+X6FTwz18h7rn29oa0daQcwmIWR y+iQ== X-Forwarded-Encrypted: i=1; AJvYcCXPi9vydgoI3lcezTUTeJJnjLChKR9Z8A1pAo7uMrADd7kTgUb8xRhdADAwyhwsNAKsxV5kB3aDWcAyJmM=@vger.kernel.org X-Gm-Message-State: AOJu0YzRomiEwxuXCCA5vlywCx9AmkBhg3bPxz/T4Z91z188KWJWkpHQ s5Fsa8TBqn733Q4imrZBN60ucofXt71bJCeny+DhdUgwli+OEChqX70D7N4T2Ns= X-Google-Smtp-Source: AGHT+IFv4syC1FFikZ8gruyh5lMTHnF9kDQfrU5MuNhEjDl7pLUYMo9HHAxXod5ZqqEK/UZfyyrovw== X-Received: by 2002:a05:600c:4ecb:b0:42f:8287:c24d with SMTP id 5b1f17b1804b1-4318415cfccmr28210645e9.21.1729702227166; Wed, 23 Oct 2024 09:50:27 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:26 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:16 +0100 Subject: [PATCH 19/37] 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: <20241023-drm-vc4-2712-support-v1-19-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 C7C0D1F8F1B for ; Wed, 23 Oct 2024 16:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702232; cv=none; b=ifyxf1xQV3TTBdjvQYOsdQrWbDRU91subBDdlFg7c//nj7M8GS6FX3n+Fr/2SRLlapVJ3rvZrRopePvFVeau6+6XBLgvUjqy3R0HIq+78wSI8P/AnFKdXvm1DOnOM8IsRD1g/4X6LaBWN/kahe56QXKnPYoSj4HZtVeMoTTOLb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702232; c=relaxed/simple; bh=FoDTmoKj86GggdhHgaL5iFjtkw3aCxNXnx5OxNjr+l0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VZwqv3zkuHBjNjAGtxSdkR4nJwvnoVcsoXQ3XoetRqSmrlV6mwDDREAH/WCw12z7n4J39mpPEf+yeyRi/41CUADM5cchmJGPZ7y45Vi/suJmWI1PdW5THS5x5pLxicZ8cwTltCkw0BWuVrUuBXxYmEK02RXWiWEyD2tV26g8LpI= 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=NjyeBKG1; arc=none smtp.client-ip=209.85.128.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="NjyeBKG1" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so77554185e9.1 for ; Wed, 23 Oct 2024 09:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702228; x=1730307028; 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=aR3ccJeL4HxyxPZlSDJvOHeahmWhAae+eo+r1fakok4=; b=NjyeBKG1C7u9b+BJOtUj8C9G2CdU8odHLPGFUTO+WhSyVoxN03pPYyPnMi6r0cqO+E xWOlufywOOmeFn8RSJg2YlijNDXPrwzDx5UrC8rtwRbNt0qMRkMEW+8K+MEVuQCm6kix kRLhTNjIEG+GFag8iRbjH2fupBFV34/SnW+buaPa+ySjehIoOzoyp22MI/bY9JfyxJ6j 9YRRCppujbIhsL5YbgQVgqq6Tw1cvnGbuqJmjPR3+viU6ZYvS6cAxyDAFbzMcnq4ZtEE OpJXcc8R10tGXgq5Wid4OqpfPtT3jGiZNOG3i7yLzHZISyQpP6TmJaf1fYHprXXcP4XD PLDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702228; x=1730307028; 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=aR3ccJeL4HxyxPZlSDJvOHeahmWhAae+eo+r1fakok4=; b=gZJzm/gVMVsL3RHdZeADYvPm4loAW/cTIDOSrAmnrl5kOoN764F48q1ncIPNUo8Tvk hbOEVNrWCL1pnpCUjA0h3pq3ucqBmlqp8I1kDPXCwLizd9vjwWqCov8oZCmF104NK/zA 04JPn8C/4S2nGtpMpUDZ2ynPkcY8DiwBaUV3rTdf2PT9b3KoY6SVnb2qgHpYfkNaPAol J0VwQEw+HQd5mbYY8mF/ed8Gqsoi0TKBOozP00LEZ7AYFM4rroHyC9tNxjkDjkYfEJ1J Rh56h6eedog1I5NxzQn0KEL6p9gXWCWyFnss+LqJ8hSQBGn3gOEHjVJGtXhsrdJrGHfe WTHQ== X-Forwarded-Encrypted: i=1; AJvYcCURo/s7wvzChZG4OrS2PSdswQmZ7rkxbvDq06VPjyIA7BEN2GwCD2FifU8XIJIw5kB4Ikp/zV8TnkcjXck=@vger.kernel.org X-Gm-Message-State: AOJu0Yzu0tHMlD701k0mWPJlnXSPQZccI85xuacKj4cI38aLNILfp+Wr 0jTJnaCNStOTxz1Y74UofxYKDyITqJzUBoRddzteXON63A3zXAkOtmMXE947PUQ= X-Google-Smtp-Source: AGHT+IEOy2zNXTO+qZ1pnkj3ZxfwjmFB8Lyi/Hjl1VbMlKymDIO9YzNaeAU/T3UkTjjwbJe440glJA== X-Received: by 2002:a05:600c:55d5:b0:431:46fe:4cc1 with SMTP id 5b1f17b1804b1-431841440c2mr30585085e9.10.1729702228114; Wed, 23 Oct 2024 09:50:28 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:27 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:17 +0100 Subject: [PATCH 20/37] 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: <20241023-drm-vc4-2712-support-v1-20-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 a5cd9da5d6a6..28346729c2dd 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 22:39:04 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 C1A1D1EF08A for ; Wed, 23 Oct 2024 16:50:30 +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=1729702233; cv=none; b=A8rYQQmFlbH6e1JTKWvlRfa172cWxespW9SZu5iMcTWsmZEsJpRktKeaMMaFUBskPInfpMOXVnFJBC2h9MzsCIRhGerITB8Ei061xQBIj9HMwgfAoH/GhT+PnNebtCglQN6ugsHeLitZNO3yiwv49VPZ/jEn+Xk4ehGPuuXIcIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702233; c=relaxed/simple; bh=hZp2dsgRak+DBUpRPMdUqcENCDOCbZSvFgD7/5lYk1s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h0FIr0Ksi2qMSimOs5H3aSzuy+KYW5pK8Y9UaOzXK0J6qJ+DgVyrjsrERiRXeNanMbFKSG5N0WKzCCY/JwoKsgIj7NkqX39Fx2PM9fybTpk2czdNgP/Io2ajZb76lvqdVqUne6Ou2gmG7FBpL5OKMcPQxyZNXeSoKGH9IHZl25A= 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=pfFaTwNh; 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="pfFaTwNh" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so66104125e9.1 for ; Wed, 23 Oct 2024 09:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702229; x=1730307029; 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=7edjMwM9R4r+Uxc3cqOP0qRuD6L2fQT2FKa6L1QAhs0=; b=pfFaTwNhsfRAQUzwML/A9daIQ0TMLS6LVKojlN1B0+qkb2jJNKIl7O0v/cgFOdjgdt vYDzyD3eyN3rapyV2XN5R/sQSfCOhBYyRNvIO08bGpH0YOM1lNyntbfGPbpLLxkOroiZ rBwy+1xjSuyd+f1MYAhYVVR9E7HCjwjcdaKduc11isaH9muOe4dSt40vavtPVg3/zp0x e/GSalyUmYa4iPeoU5yC5YwopDJdq85v4SNKHmHVWPcFqFmEXIxvl4BMXTLg3kdCT2y1 cv/HSgfL7Ai6TCN7/yiyfOJlOmLvJaiJDGcWjN3uwBpS2xVp/kIFznU8reCJhxqyHb3g el9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702229; x=1730307029; 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=7edjMwM9R4r+Uxc3cqOP0qRuD6L2fQT2FKa6L1QAhs0=; b=N6JboG2RLhlK+aSWF3jLAgVPDIkkpK9XnMn+lWb/3rbbkTpC7d3v7WoS3+MuoMEj1f 1ettNnPunmd4LbW91ceYqiHhLm5IyOnvD3zbzdzifX7KoePNpVH00OAaktP+VuKyWyaP //jt8sT3YYdhxXdUfS8mK+x49MJKPfFAKfozSJQ0YJFQjNkgzZZVEemAkNV3roHgAQ7F PUzmBRxx/s99Ckllk2+PtYgqO1P+jJHrUGeQ4fSuECRKlVhTVdSEepanl60XC+RjrRlO TO9/2rhuTKlzjg9NYCV5WnEOOE9AGwLEITK1a7OT+KDej6OC32SESD6d01+dD4m162mZ cVSQ== X-Forwarded-Encrypted: i=1; AJvYcCU2AIl2ZSWWLo1fmeoL8Ul4RxOMvSLQ+TDl3rBfnLHg2vkZfPxnu3cUnYGerbkDVjeF8Una6LSwFSs5lOE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9n5WlpV0tNFwVgqR3lV3XBs6tovkZ3cUjwXRSd7kCKo2sbvvg UNmqRYtNuWV3u0ecRSXuFP6pjwmSMQ7/U9VI+If37TnUOctJGDsEHQ3163Fncbs= X-Google-Smtp-Source: AGHT+IHmnnBF1XbicsZZSX63ufvz1Ey37usN3AVArfITs1P5URFwomZVlyoIAXXLcYHQj75m7dMF0g== X-Received: by 2002:a05:600c:5802:b0:431:5f8c:ccbd with SMTP id 5b1f17b1804b1-431841ee182mr25601835e9.4.1729702229220; Wed, 23 Oct 2024 09:50:29 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:28 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:18 +0100 Subject: [PATCH 21/37] 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: <20241023-drm-vc4-2712-support-v1-21-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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..befb99c9b5bb 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 +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 22:39:04 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 52DAB1FE0FF for ; Wed, 23 Oct 2024 16:50:32 +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=1729702234; cv=none; b=HZgjwcScANYZmpxmodyTBaL5qhGGGsUwsXUSLB91Q4Elpwmr+EdJ+PfHkm0b0AuwuX2X2+fQZi8C8Q617FgZaNU6dzvGBWG3/VrJkJA22vjN857iZolov3I9YgH8ank2Dg6BbzILY/y/u/dRvQL7PAnih+HMPMCFo8xJua4YQng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702234; c=relaxed/simple; bh=IyKHYiKufeoyyf7FtpOer1Zd2Wmz7XPsqevI2dedQSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PBfrkudi1tBSLjcUk7Kp3n3AuXBJCiCZnYuZSA4w6Cot5b8TVLKckn00/SyzXaDC8N25OpcOkZfO0pK/BPqvNUERbShBLeZNSPnG+p/niXaaiQD7szm8tdw1R6Wn6FWlPDcvgZuV5bDL0m20XfFKV1UdBP7CHtk40pK6C/INHKw= 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=J91/iyfs; 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="J91/iyfs" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43158625112so69899015e9.3 for ; Wed, 23 Oct 2024 09:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702230; x=1730307030; 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=eMBkh/eftMTOn1DNe16yd6Y0TGrb136mnMNPmU1BY5A=; b=J91/iyfsg+CzZQR8GXC/DxTzbxJXbrebeMmANvX5pg3aaKJk4emEWH836o7FlWUSeJ ygxQXBw+7+84s+b1MnPG6DlSo4i5FQINu7d4MItSSzf0XHCNtLuRLlhE5vVMizimH2/+ T43dWe0cjER1F8I0PgqHkl9iBtxxv3rJDS91LkdQ2Xy6zPLybSTRs8QTnZnv0qNNpkef O8ITp+fPzSgivJcTEJP65iKTJ4IoY8Ic6GOqUZpU29UpyV6rBymVNMk/SPPNEXIyyB1H zlI8Sgzs4jjyMIEwtC7SAScO65rk1TjlEcjn3guI242y0LsLFReKf1qIByZznk42rb0W rOiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702230; x=1730307030; 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=eMBkh/eftMTOn1DNe16yd6Y0TGrb136mnMNPmU1BY5A=; b=AGWfXxs2XGrj1XLRUoFwpz93sTUHM2Q9qu1Hmr7Tyizo1y8G7mVCPmiJb7vCPSiFYP vBqLX/TRR3YQQ9drm3Lpvw29OAJ5BrOoDXZWunM4LOdov/WRXL1l/QepsKQ2lc8v6xSQ suLb/A4chc7G/8T2dL6zMU4cWJhCfkJZIv/9dyaWaCCZT/R1oFVALHrafSVrk4MU9+wy 3VaBG0UZryxE3qkxeq+HVRCgZx9XA+9gnwUBsmMFfgImJcRsi5uvTntongsIpyq306rk 0S3TqCQDMeI96/hx2VON9H1TBCQX1zqGVDWldGMXHWx81CkflO9wWgzKZO0E4aetBNWX 9OMw== X-Forwarded-Encrypted: i=1; AJvYcCV+/Zp6DPnhjFEtLEt/Pzv87rDkHgVb+yT6Y2Ar7SA+6eTTtg7dfwD66kMJ4w2/jRwIFlo4MoMqtDuG9Sw=@vger.kernel.org X-Gm-Message-State: AOJu0YztvbcESDXYBi4C+d/yPRZ3F4z6HLbPevK8c+vJjqxMFA79Ujfy /8L2d77sbVc73rMmJuAbuItYOF75zysOJpg3pHBnAxRhBMRw2jF5KFMQCpCE6Og= X-Google-Smtp-Source: AGHT+IFCvi+5ahxplV53y8LUMCNwv9cz+F40idXE3AmypoYPX6CS2lFPTrKeznboS3XkfQRNLTCaGg== X-Received: by 2002:a05:600c:46c4:b0:42a:a6d2:3270 with SMTP id 5b1f17b1804b1-43184224094mr28879375e9.21.1729702230506; Wed, 23 Oct 2024 09:50:30 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:29 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:19 +0100 Subject: [PATCH 22/37] 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: <20241023-drm-vc4-2712-support-v1-22-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 befb99c9b5bb..aab6fa7a8838 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -524,6 +524,19 @@ const struct vc4_txp_data bcm2712_mop_data =3D { .supports_40bit_addresses =3D true, }; =20 +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 22:39:04 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 341261FEFD9 for ; Wed, 23 Oct 2024 16:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702235; cv=none; b=iwIpJPQwsWHp/fMh3pCSYnGiNkLvTIWGMPS51FnE9OIgimYo7ftKslrGCDaZ0b/9If6N1f0IZCV4p54+eWlkB/WMEnhpbDNrY3XV1/3de4qIpgQsYDFgRb6hdegFvN83HlVd4fYxI/MjeqbEhE0POrTqYy8A+hYFeE+cw0JuVxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702235; c=relaxed/simple; bh=QAgLZexOXOfeZrmTJXiUrgHWdMT4l6zXGD6c1pRKTQs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DJuD58aGr40Y9Fc5G5KSPR1JDEsgCVFzacg+d0y6vmlScnwO25zzVfaYhAM7HoIcPuA2GOQiZSj2EMJMt6aWuipUKeUiuGSon5WeLPJfplW9lUXcO5a+f6u4qoO/3Uq6mNaPQwdedlgthCZnlMN+aduW02aeoSDNGttiNRdZCvE= 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=DBHmfjx4; arc=none smtp.client-ip=209.85.128.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="DBHmfjx4" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4316a44d1bbso42937555e9.3 for ; Wed, 23 Oct 2024 09:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702231; x=1730307031; 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=RWOdbW9r291k0JLZ0WclOypLE+F7cuj+vNJzDbk38ZI=; b=DBHmfjx4b/ykWFYhNxIkr2ZKtR6DyqQ5kMjyiAmtI0S/8ajySTewr+tw1H8RVd2Za2 +P0QE+PXYbH83r91fMZeftJhuQb56Fil6vpv1byq04GwAwvSthUhxs8S5/GNtLZC4wbY I+2msnBKlLM4sEaowwtY4QYh21VkSNrLgpHc4qIjf0guu5+NXNVmomBFrNUtV3ONNfu8 I/pfxthwtmOJoWnuE026Jd4zvaRlgRkUPIEyTl252GtyWj834HYWzPp+yAS73CEqFvgC 8EWgRp/EFg+tdkI+lUnCSY9pz7b5k1PWPyu+4MQJS7vur3jFH65CIIFOXpgWAWv7ytVx 99xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702231; x=1730307031; 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=RWOdbW9r291k0JLZ0WclOypLE+F7cuj+vNJzDbk38ZI=; b=koNXTE8Pg5L7SDkeDYg+XkM1ial8crfY3DxMi196kj/u3rKwYDfLcfyzbvt9muTSxM kEgxYFKPacuhsLbg00Pqj7vxob9gb8zQJDE1qadR5fnVvniWau1wBWpQt8OuWx+1kQhb L/daCb5ynbyxmr/RqdZm+DR5Udh31GLU1qEIi1n47o5Ze8Bf9pNWBsYRMy/gAlyGDG4y MREJmbAxLDaWJuxA/VbHcUirCoK3FrXcGi9PZ12oqs5X7o2Uhsc5YSXSTmgurs78pAI8 xhF9LA0+GNSplSkwRZawjDqd116DNL4mWA8auT3nII1XztlC4tsIyY9YJb5+8ovDk6M+ ZQfA== X-Forwarded-Encrypted: i=1; AJvYcCXbKYATRybFVFRkn3Ul1TTTkHcC/OWEgFpIMmK+tjMbIASGhb+Mon6Ez/C+G8vVMH4jGbA9wrPcSl1CFjg=@vger.kernel.org X-Gm-Message-State: AOJu0YxRHYDX0h+beeL4hG7ZYx91UqrXTy+7FQjVxeMFhmqH58D030b8 bbFl4FpBXfXLaoGuKB+Hu3ZPP9bBhFCypHMMVVySOvQq42ULv2K5+2v5JlPd3qQ= X-Google-Smtp-Source: AGHT+IGFlT9aIT0ELBQ3fGLuocjkqWYAz5lioaoVMV3JghaR5fVi3lzSzAvTX/9JlAsFJlj3SG7awA== X-Received: by 2002:a05:600c:4f10:b0:431:5bf2:2d4 with SMTP id 5b1f17b1804b1-431841a2ee1mr29394055e9.29.1729702231586; Wed, 23 Oct 2024 09:50:31 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:31 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:20 +0100 Subject: [PATCH 23/37] 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: <20241023-drm-vc4-2712-support-v1-23-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 5606ded928e4..b698f7070510 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 22:39:04 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 C606D2003A1 for ; Wed, 23 Oct 2024 16:50:36 +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=1729702239; cv=none; b=YUZvlqbbdhGKqwJybTEt6ItPZBWTY7KSLvVIhr7Hx9r9OOw42kGgWDlR3vyefy3Kphy3Er8cYDva3rHQU+IhHcSLQv2WtZ95WE7x+BGSsU/KBWAEGJYOwJZHXpfSt4bRzY+XEBZssK6+2SFPZJ/Lq5FahjjhpdMYXZPWa/ehssI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702239; c=relaxed/simple; bh=Q5/4g8DvZaCkG5nIfpxW2Hd8vssKUHiSAwdKiJBJ0qQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UbOc9OvBdQ7WDpuo4E0iZvyHD3dMeb9QtMuHQkNzHUFaIOD/UivLiKQx4Zf7uz3ZDllvL5ow1r+iv1gCQGUyvi5elTZLQQe38r30A1rPdMWB0LE9/PPw54iGld8k3mKS7jQQadjlPkLj7iWZJeszHqQdNPYjD4Vi98CKuunXQyE= 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=obYJw7Mj; 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="obYJw7Mj" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so4919939f8f.0 for ; Wed, 23 Oct 2024 09:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702235; x=1730307035; 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=ovlO1rlLKJUJX1wYferF0T6vJ4RQ8e45dURb9n1UcwI=; b=obYJw7MjxvgAx2Uh5YaOdH9wj8T4JsfAlLCuyPj1yaJz6bx6pg+HxoubG0e88SyAg0 MOmY/gBks0mXE8SRp+TqeTkWMrkqyE4jE8bmxo6uaat2BJeBtXhNJOBZiVN8wlgu7asT Krd/mG4DTZcPG/Gf+gEarHUBXsFGPv2m8s3ggoJeckLErjBhdp1Q4he7XcFmBLt8/rfp qXWsgMsC87ec+Ypr3D+IzIcZkMDn5fb3Q/CxxKVLjZ21YcBx5fqADVFIkAHus6vj1S30 S1a524scMHsCNVsNnfiFTwdN6Xhle04swgwJfdGcZub6lfUQqOTPlSM31yR9eMxNc+Jn 8pJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702235; x=1730307035; 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=ovlO1rlLKJUJX1wYferF0T6vJ4RQ8e45dURb9n1UcwI=; b=wEiYTf/22SLEM/46fs0LkIf5KZL7rLJ7rCYSii+VLTaTobbxkbCSNYLiiKpKwjz3GD qnUCXVajraW4o76YdAMaU4WNu0MJ3cCUAc92UwEbMGNjSeBmf3UmgiZjZ/iuxoY5AwVL l/Bz3Fe7m6z+NnXQMYdzVQLomc21oPKiHld/FhFmcYmd1+3J11vynyqSk/iGrtuh6fap vEYPelgOMD3nFjqm71qxgkWm2OdeFpu45ujj5cIMALFXws3UCL/PKNYzDojRnaMDmTO4 uDBQ9TbXWQptVM92sBn0oU0T/sK2p0nAN6bYB21wW4crKhrjjj+AL6kpVYzNxkg0ur2/ deyQ== X-Forwarded-Encrypted: i=1; AJvYcCUexLGryVaHO4Dx+eNXMUq6uYUyog15bxMXuHc3IL+yMbGdaQEysBt7GDEKSXA7iTcOndK+PrMdhohOKuU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/cQneuNOByeY2vSATD3IXiKZBe3iBpjB9NqUqkRjl5hl3kK5J 2+3u+HopFyfgwuC+QPa+BiCI6dDCK13XBVd44770/Ex+cuHAMW2tGua768rcU1s= X-Google-Smtp-Source: AGHT+IH4otId80GG9o3ZDhc8LO1QdOrljEks8PDmdlJx1ZkOlo5e4sfIOSj9pzTreVPAVgwLCJZ89w== X-Received: by 2002:a5d:63cd:0:b0:37e:d2ba:6f11 with SMTP id ffacd0b85a97d-37efcf8cbe3mr2193817f8f.47.1729702235063; Wed, 23 Oct 2024 09:50:35 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:32 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:21 +0100 Subject: [PATCH 24/37] 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: <20241023-drm-vc4-2712-support-v1-24-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 b698f7070510..e4717ccd0730 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 reg =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 28346729c2dd..ce1154c463ef 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); @@ -448,6 +448,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 22:39:04 2024 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 08C79200BBE for ; Wed, 23 Oct 2024 16:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702243; cv=none; b=AviEBhIXx99tzq4vhu4tLge/aT+P7AbpaoRApUpR2yXWWaJAAZEY1TKePHdcvkEmfl7enTYd4C+fTO6nYeJ+wdvwDkiGgfHhtTzagiFI9FidSmfEu7LC+0Sl1Et6rk9urFCjFko2V3peI7se/Vr1pPcTQJ30amEyeLkDKYDpGvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702243; c=relaxed/simple; bh=DYHjynHnrJw2pAUShIpjI0+K9GfX4BYApTDG36teiHs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IECh4dKDpSC4Cv4O8I1Q0PvL4KR64K4fvzJMEh4YJW0AVr12wI9G+iCeUs+0xOVai6Wbp3GE4zq53x2eoErUdgLwrvGQsIsLeaEqnkRWrAnBLbd77L/g/uBujauRemt2sKO0XPhd3QY8FhgIGpLnD192ZtNXdQ98bpd03lCP1EY= 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=E8BexYda; arc=none smtp.client-ip=209.85.128.46 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="E8BexYda" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4315eeb2601so85345275e9.2 for ; Wed, 23 Oct 2024 09:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702238; x=1730307038; 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=dBtpzJ58MvH71lujIXadct9yB3QEBe2KV1KLdTieHZ4=; b=E8BexYda+5K4NW6eJW8DIi4QXk3IqdWApJcDiOW6gA+fwAbeN38HjXzw0CbFQ6IWcZ EW30kHG7OKQJTSvq82nSw0A/k3xgg4yoi9GU8g1H1zdqrgLVD0AklqtS7FgcwSyvrLsw SArbdLM1TyhGzdSsE2BkMJL040GnrXIyFTVMX1YcxtQctkQ/R8jljZoNRWBE9355lBT5 ScRqIAK4txckhdOll+7qxrO9gUB83nEZ29zSKR8sKf4HSbK0yPEI3Bi7FK0m32gBFvqF XwfwtDWoFN6HFmn1Z6MoamlyVCec9LSu05CQC3ciQBtF83wtFZ4d30xEDCu5I2YhjYUw pf6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702238; x=1730307038; 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=dBtpzJ58MvH71lujIXadct9yB3QEBe2KV1KLdTieHZ4=; b=qbo2fw+u0KMXCQZUotHLp0vvvIbuTCPMhNPCZHIEysZzlIF/V5OVhgIbjh598FLZhh KKtuObX7t8pZn7MBqRiI1DiGUnSIna+4xA2FW7WVQNWWmAJ1uiGQLtEzgauvdSCcfGnB pLHHV+TWX1Z297fBou7Dc5eMsV1m/+jYOXL62sIQHnP7FoAnWNrc9CWEeF9RjF8BpMol KHn1ISydqwbVnOIbqAwpE0CDvLiBnnFxcPDe5R/n66rC+I1jzEYmxvJmGVFkI797Z3EN dADRjlTFgLOKJw23K7sNY9ppPVZl5sa4pF7ghSaoIuDQT0FihlG8OO+5lQ4xnV1ytwoL e7iA== X-Forwarded-Encrypted: i=1; AJvYcCWCTS5+3gjCFWh2IFWnXhPND2JlRlHGwXJXlE8ASt5N9LwMP12qhSzJttUs8Cyk0ElJ0IbRLf6XoN0iPg8=@vger.kernel.org X-Gm-Message-State: AOJu0YzR74hkbjsCS+nqW4inoQzeQW+lLAOTwe3OjrNF8a9CJTcZZslh paracNppFLa8XrYoT3jgTp/xWGoDPfgnfl72e5qxB2uQxNGHi0uqh+cNWDEkBYeKwVoXZRJTYmt ACgg= X-Google-Smtp-Source: AGHT+IEtq5x06sVi9VriYMH3JsAvnoSFcmTPLv7qhrAQHuJ0KzIixvn2H0J3ILsL9EaEXcFLK9oHmw== X-Received: by 2002:a05:600c:35d3:b0:431:59b2:f0c4 with SMTP id 5b1f17b1804b1-431842010admr29674505e9.8.1729702238396; Wed, 23 Oct 2024 09:50:38 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:35 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:22 +0100 Subject: [PATCH 25/37] 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: <20241023-drm-vc4-2712-support-v1-25-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 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 AD7E5200CAD for ; Wed, 23 Oct 2024 16:50:42 +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=1729702244; cv=none; b=IvMU2cXKb+LajREg5TQz2UokzTyY8JRo346ncD5Z47t5r08C39sJICcl85wknxRjUkpbkiMEzzIzaZehjvJC07B0aipX5JHZmAYOAJSMhQWdbwohKe2g3X+QBD8plgdm5x6QItlFpdJc5RRzWf+Q9+c+KLPSe1AlEhtChanqCJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702244; c=relaxed/simple; bh=tZOo0Ix9iGrdx8pkIPTQHYKTf0KrfmsFOehv40Q+vb4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nHM7cc+JUuvnCP6NRxA7gba4fNVCrXu7oczJyyoQ4RzbeQj6L+VNtezUTlsMIY3z6jOGpfSIGHFYD0GFPbZCZqqpwv+GQgtGEWLmNsA3z6xulDhnVXgWgNAH8pCrzOP/d5kUl8KgXGuQZZyeecdlsidqMAXuDfEOeuARsLx/L4g= 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=WelteRD1; 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="WelteRD1" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43161c0068bso56790605e9.1 for ; Wed, 23 Oct 2024 09:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702241; x=1730307041; 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=6vaguUe7juL1LVMz08cL6sDxAEiRfNF+JBFP9wF0Q+s=; b=WelteRD1jH/o/pmNMehvDU3poLhCzwThNTXbMOyxlB01zXSDo+h3p18ZeykSLsd2Z6 icXhXvjzP2kpTAu2uhACRXytuG40twE4xoIXU1GfxmAuQGe98mi6zIu91wAeDClskQGt N+ax2YzC8epP1AEEjbfFXGsU2Hd84qSMYWWln61MYRz+rdJRNfTw5XJnzK6cVc9KOPhE WAIMh9dpfsOoMH3UH61IOk9jelcPSe9CWu0Qh2oosu1cqaVHknTDjHKhjYswi1ywH0mi qJsBXZGvgAZBfGjHq7zUKUxCA8cgRvTw92SubJIa1gfx14jTXD/M+nETXISCnitlW9k8 jmqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702241; x=1730307041; 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=6vaguUe7juL1LVMz08cL6sDxAEiRfNF+JBFP9wF0Q+s=; b=mGMKe4Qwer/fYHHtDweohE2tFCgOCczCXJG0a0OmEpj7qEOh5eqA5lER9ZiiT64G7f bY+xTtkYCr3H9AqlUt4CXZhF1nFIlTBQXSb/yUxtHTL2r0DGABjyLy6FEWb0V1j1lhvF ewz2zxwDpcfiIXQ2a5rw+vMbfXZwJVtIEJbEp53wpvr3tEbnkyAVf56wqQRQ43CBLWmS TtWlvM4PSKxcmXsurJu4xTS5CQEQUb+1eX3tZBDeWsBK2pF/f/p3Wy2BcPRETOR4utxK W7Sxbcjj0foj84cWZd9TNCHeyYAWzJho6u4khx2GLoNdp4HNEtHqgs7xa3ASPS7Xx768 1I+A== X-Forwarded-Encrypted: i=1; AJvYcCVPjd2STBh/Q0oGL2WFZmlf3lENReKKCkEaxV35sDSdmUHlAxTeJFy9aGMoeO7yRa7PEcAfSqNhm9DphSQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywd81RYV439X09X4hk6sVVRDSAjOgVERrS6FFsIWEi+WvHbe9iC a8WqGaJlEemMCbSGNf7R0s8zVHkj8adj+sUElt4szphmYk/Af2VK7AvIbcftsws= X-Google-Smtp-Source: AGHT+IERYOndgW/udDrkKTC0Se/KUmNKFRwzDAk4TOKT6h49ITwfBkIc/0nZV6Akai4GqaHXpM9b4Q== X-Received: by 2002:a05:600c:511c:b0:42f:823d:dddd with SMTP id 5b1f17b1804b1-4318423b856mr23693165e9.27.1729702241069; Wed, 23 Oct 2024 09:50:41 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:40 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:23 +0100 Subject: [PATCH 26/37] 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: <20241023-drm-vc4-2712-support-v1-26-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 95ef8bbe6439..6fcdd1c247d2 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2128,18 +2128,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 22:39:04 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 0806E200CBD for ; Wed, 23 Oct 2024 16:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702246; cv=none; b=GsoEGHRoawC5/Nsiu9qk/0hNQZy1t1P/9ekDdogFnqJVlekht5LWHmPZsH15SpMfkVQhI6fJvNbg5f+lUQcVvg40fiDxIKvFV+HIJicC9iM5cMhCyI7sHnXaBDbHoTcN8/OROLLr5PheVl8RwYVx972Yj0c+DFWUgYZn4fCvIxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702246; c=relaxed/simple; bh=+BG0h8wlmH06SZK5YD7t3bFzfMh9GcpVnwWKqZt68qQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gqm3m5K8xbPEGXdfT0Ye/dFB8U4kIua0tiD7ZG04ez9/0iPtKXEIk8UONmx2iY1EuA/+Fp7sYOSZoc4yt5GmIDRfpz4dYs38/Fe0qC+z+QwmhD+TMRIvdgf0NMMbmO6xwGMi4LzoFmmAsrZrGjEN3gyTHaFEETWTxqScl/E7UOw= 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=IU3VjKmn; arc=none smtp.client-ip=209.85.128.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="IU3VjKmn" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so74192885e9.2 for ; Wed, 23 Oct 2024 09:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702242; x=1730307042; 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=rx+cgECVrwHBqHNuLqK3jB//M+8KGwV7ZzrA+d3SFbk=; b=IU3VjKmn5pm6iLzwXrc3QndM2MrU7GW+vMtOYCSqUu/PqVnJQeXXq5zcNLhUb6rNFG XwPVoYjZI81a3y5AoRn/GJ5sSxQ+Q4xYno7JDpl1bzgu0fjNEl+AmZDa+MER3pApLNEi RKafFQl/hMVoWktFNy+IQrDeabTpbKh7wmm6mjQCFcD1ZR5j6utI9HxCbpGye5MXmPy1 TXcLiOsKe1n52F6gUVCQExXJ5tu6yfdvaD9v+uhhg+eIPUOyMjHJwW+8/XYyLlwBhgYc 3uONyZkB4vjVEWbZEWdjRpj6M/r/PKtUzCQeLwIDvN84qCVYcqmdKdIHXKUIIxK97dY7 HCWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702242; x=1730307042; 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=rx+cgECVrwHBqHNuLqK3jB//M+8KGwV7ZzrA+d3SFbk=; b=qIuuUJ6oADq1rwfsGGGR7flquR/p2TKz3pxMuugK+0p7+qQyZSymn+oy3snxxNynAU /RyiRmKuKZ3ygCltzg1DkYn6Af6zWqPVPZSCUR6Nu83vHBVo0ZHjII3i1/6gbc25p9J4 7psrwrmhGz+7JqpHE+l7pEl3Jkw5bgAaxYQW1PSGjRwwAkFvI7SjtwhPKM2e0w0HZTcV iFycMkIoukmlwqqNzXJn2y82H4N97L4Jr2nZgLdhoK7YgyOI/PYhm71oFVbYQ3Mfqlhc mTmnhJaLB64dfcaMtl8lHWr2CFqrCG7ttUEL9mVyvEQrOL3UBZ6kMAVGmL5QPkUIlQ0m ZiaQ== X-Forwarded-Encrypted: i=1; AJvYcCXZa9UsRjv94XDQE7L1k1hi/eIVUttWQ5JBGkbCYtuOwJjPtvHd5MSt5EH7Xdth2Vhzu19OhYSBUmdl+kY=@vger.kernel.org X-Gm-Message-State: AOJu0YwrEAl9moYyt4zP4WojLHaIKFcYpoDTzLaQf+WzCUtYKfRkCKAx 2tSyDwFt9G6qHSFLO2UIP+a+8V7Znufd5AXWboWLNowkA+HotdaHu2L6eeX4rtQ= X-Google-Smtp-Source: AGHT+IEGbFSUWklZClQpP0TsDzcUmssP/K7HgzrueQBCh/JZ/3hd+ojpDHVXKKSpg+VGEoE86bXTLg== X-Received: by 2002:a05:600c:3b9b:b0:431:58cd:b259 with SMTP id 5b1f17b1804b1-431841b1fdbmr26533865e9.31.1729702242397; Wed, 23 Oct 2024 09:50:42 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:41 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:24 +0100 Subject: [PATCH 27/37] 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: <20241023-drm-vc4-2712-support-v1-27-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 e4717ccd0730..f15aba4b81d7 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 ce1154c463ef..3f241b15e8be 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 22:39:04 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 6D5E22038CC for ; Wed, 23 Oct 2024 16:50:49 +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=1729702251; cv=none; b=JRorUjrmV5Ba5lfUDnUaepEwqx/0Yj3AvW+a1kp3vJSLbpUynEDGiHKJl06y/DpneBfy74tksRVU85DvVRb4/pw7OQdorbcIhOvzQrqrt5mt1ytH7Goi0Jof9gfJYw4H51V1zFv9IMOE0gdFrV1oqdDcZlU/g7uiBnr5HdAz5a4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702251; c=relaxed/simple; bh=ZpoQHHOugAokWeviZCRyfQ9yR7PkyScHju2uFvM9Aw0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iPHWniMl1VZeLhteIFtnYf3VOa5VbUZU5KuFYhXByi74eA4bJlDF4lyOqS5L2UEeHi5EmZDhqOoQVmmvWdFVg9H031/nOHKD9hm1GIHMKoI97OhJucw2bo+AEZ6/Sv83ITG6KmBG8wQi3C63H3DECYwgUxbyjpflUjbQsRPIkkQ= 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=pOwL66H6; 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="pOwL66H6" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43161c0068bso56791735e9.1 for ; Wed, 23 Oct 2024 09:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702248; x=1730307048; 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=LXVu+XPK1twrhAqeJinZn0FZ1mNK/jEIbakCvmjUtPs=; b=pOwL66H6CdJ7bJg8VymBw5mpXmteWXfca5HnOJkb5CIchGrgbvPK5mWE0EX6i7obCc mxDdm8xY8ir9gCzab7wRdcarsArLtx588RfkJcdD+1dYkVLoHiQkUc+QZypVNNxAtxRS 0vhVsprVFQOlo3sElaIzOb76LZbaAoCym/0Q+9/pUZfOxWG75JwfOtYllmDkpkC849qc ijPJ6fwRKWyGOI1ySaXl+aV4djI+aAgNMVw0ybWGEhNvwjkNOwMYo5dU4tDqNnQ4P4VJ uXxEP6iBcq9wGzC2E2Zjn2zGu+uGpybiWwLaOKRYB4s6gXyuNsctxtAVl+g+FMl+EzbO h2HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702248; x=1730307048; 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=LXVu+XPK1twrhAqeJinZn0FZ1mNK/jEIbakCvmjUtPs=; b=GFPzmgdLSRz5vtjd9M3rsOWbPFf1pKMJAa5iifxaEWF39Uq67m1EFv4jPebfXOqCO1 lkyBXKvTaSgA65yCGLQQZRfyipem/C7frPut+WIgPAXDxG7p2veYfoyNHZI/9ar2Hb9D 9v21PoGK0VwYsL5FFCD1bb586UcMXGU8RZCIT8eOnNaAKC0tt1JRM/XhdRJO9inNc2lQ /U5G0vOFJlL8ajr+Ck/ay1aMlMQhAyrzr4azCZPjO/00sGos9hDSixWX5B99llEpDz89 ZDPQa7EWBGomIqAyi+KaAoGi7RhshA7fGGMEixe7dKm92I/PzJDfhEGjbRT8NgD3fQK5 okqQ== X-Forwarded-Encrypted: i=1; AJvYcCXQy9RP9ca1gyj5T8XeOorQmMQgKUMESDxdhi9cEotSxIIpOMxKOHRZxYTn2p0NoIBFWu7ZOpaYKyIMpU8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz48vK9uwjz+skaclZt4FocIKr3Hk+eGQmKi4RtOJt4zWayJ1Xj ed+JvwlTSrhWXOjZlgnksg4YMxmtZbYuzGETuyXTXwtT3XlW1Tm8e59yoc6MhOA= X-Google-Smtp-Source: AGHT+IE4mgCaYm2elKT76LlNq3zUCFQBwxYPgla+kkQUxdQtty9ocFGx1hYzfLUy3hw38CapCGa/1g== X-Received: by 2002:a05:600c:4ecd:b0:431:612f:189b with SMTP id 5b1f17b1804b1-431841fdademr30938035e9.12.1729702247813; Wed, 23 Oct 2024 09:50:47 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:47 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:25 +0100 Subject: [PATCH 28/37] 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: <20241023-drm-vc4-2712-support-v1-28-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 f15aba4b81d7..5d40bbcb3b54 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 22:39:04 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 4EE0620402A for ; Wed, 23 Oct 2024 16:50:50 +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=1729702253; cv=none; b=gAUMIIvs0q9RnQAafEI67II/pf8IyK81gCZ8fPdAdDrtaw9909n/azcEFrqdcipuc5hLFTacrFIxutmc6lGD5aw17+gB2EHDzQLtIU1TYNcCBinifofLaXQVrYeWk1qFHvZ9gQDcRpECbBLvNWtAVIarKlcTACul2vCUEst4TQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702253; c=relaxed/simple; bh=Tf5SSu/dwKpmtutp86BXzxJjLmaIFwSGq4VXqGNb0f8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AHowa1K9/qsNgSa5lTIN89pKZ4SaR5KqiMNrH31qrDsXyRnkN//L+52QUfCeihzWRW2GVmWVAO0/zCrBvASLDrKS/SwiyA4QYiZi7MRD+9FlafM7mLAcwGJgLR2A5C+fjTJrn7FfhDcGwa8pABgHEifW43Qs8wY5bRDhQFmLkSs= 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=Gn8NGfry; 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="Gn8NGfry" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43159c9f617so68262425e9.2 for ; Wed, 23 Oct 2024 09:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702249; x=1730307049; 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=1187eCau7YQm+fLqvdnzaKIPua1eXW5DaRGJ7Ln3ZlQ=; b=Gn8NGfryCnYDFq0f5SzUEVth/qZ6rLF2/hCHopTUqJQJMjphyM2FGLjpHWyXDDfQJ3 Mv64Far1rQKueknLLYmwE+9KO0fFhhbf1tat2J7vVkJNjQojOe+l8Wsg2F6DlvF5TmmF i1USbBDE+qOnwoCCJIiIyW3Pz07aafnVSjrNMnNKbRm8aH8QOFXWbjEI6ONlgbgbDUpp VX5sARLoKBqg6ynxAR87zPY/juYGYa9hz+Ww75+ZcZg9P2KPYi9JWgleyQX+y80pNeRm y3h6Ad9zjPIzHKmooU3O3OGPxZ9fdyrgDNO33x94axAfYiIfmdKRHGUqqgzwOU6rVz7M JilQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702249; x=1730307049; 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=1187eCau7YQm+fLqvdnzaKIPua1eXW5DaRGJ7Ln3ZlQ=; b=YvdTl78uggPAnGaAGtTCoB/BzEpfCJzoSZwYoDXmrWykJZZTf0DkW+wqDup/a46B27 5Z/ZAJ/3gSI58OBykfilGzcERjKrOLlF5rZqq8I9RL2LVZ5PqUmuY5yXKXEsbF8z0A26 56lxdHhDL5bqAqxUthVoay8AyITmS1jD1KjdwZk3R/QyAUIgvCAXEwxOMjXblH0A70Kn W7nNTtobgAPOQ6z31XvFP1sga9kkXGXhFbFgVl06s8zIP/q3nEgoEopO7uIpInwavYk/ hRXW7L+Glp+MqrUTpxc7QR0ZdAVH0wZkfyL+d0TFIDGD1sZqBwk2Z7suIVjj8k7qxAad GM8g== X-Forwarded-Encrypted: i=1; AJvYcCXKksgjasnWiDPTUeDl6ev3IymFbODudsk870WCWSW1ekMTGH1FqezZ9v9OtI6TvVRKMvJe17UyFZzz13A=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2i7fxPBxDiMiI55wAAtSNAOfGpHbWt5kl/Zs3q0myRqfpd1fn HBrSsF0fl17q8Hv+e7gyDyV7WFTbV8gqq2s2dxCt3XB1yY4X4LSU8IE8zlJPcng= X-Google-Smtp-Source: AGHT+IGnOy6934iu4X4nAJLDq42XcldaiFx0K1e85HTnwt0PFdy3j0mfVRmbr6x1y+nTvJQlVW7Bhg== X-Received: by 2002:a05:600c:46d0:b0:431:4e25:fe42 with SMTP id 5b1f17b1804b1-4318419f2dcmr33339855e9.32.1729702248667; Wed, 23 Oct 2024 09:50:48 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:48 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:26 +0100 Subject: [PATCH 29/37] 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: <20241023-drm-vc4-2712-support-v1-29-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 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 7DA6220409C for ; Wed, 23 Oct 2024 16:50:51 +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=1729702253; cv=none; b=O7ivOO0joo6NZN63OXmnBPbICweoyvupEhiD68AGoyGFY/mnFjF3kZ6DgZhAVIgL2v9kR/DEPoJoCkXetqCa+sIrCl4EheXhbzgZiQA/2VAEoxEkw5Elf4WgATfZgaA3AQURhzTDFlXItXZNm7WwiUIcwC2KeeGXcPryZipFxtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702253; c=relaxed/simple; bh=0je9Y0xbsCwGhDIv3Ukq4aSt2NhWmJSUC9xO7wwoU+Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M1xd+p5u9IWn/KeeudTKNLPWaC417ubie1O8LMV4PwJ5AEIVq+okDQUzCums8dcJTdXRNyuNEkXa+ojasUuJf2PVivl0YsRcJdPhA0w0zTRfzIGeOcwyVaXfopeY3ks5veAfu6RtmHT/vXgM1T40EqD0tdmFa357YEjJcQupy60= 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=NZh3rnyl; 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="NZh3rnyl" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-37d4fd00574so52041f8f.0 for ; Wed, 23 Oct 2024 09:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702250; x=1730307050; 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=NZh3rnyln15b4NoTAMJm2xtzQ0XgdJFooE4JGnISCXetjvJg4dIE7//ICE/OHd61Yg 0DXYN2tDUHx2frZsLDE4LMLHMP/5kCgr9iXKQAsGsga3euHBV+L1eTUtbXCwJiD5Uyy6 DXX7mpej0RkSVxwjI6pkaxW/6ZD28mPR8jPrIJQ0x/fzmMyzIJLEpz9uhrsc1bHE/1ey kDKJ1olOZ5vdkxgW/PeziY28uUx19tXb6LwBW6t4QJLXLKdMUpfeLc7Ihr8+/ua+kFsG wokXebkIe8qM81p8/8BJXIQJFtDLk/kKEVprOzH38/uNhXApOlagqpQlxc53x5X6AIAN eE7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702250; x=1730307050; 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=lWmZHjfkb9YD2ocBV++R8UX7785YDF6mwOGUAr9auWItpdgBZrOTFOID0/8VkoRuPg KyDxAIUc6hjoYYK1HHqV4WZC2KBbfLj2yvC3a80m3tDTrQo3OqJylK7EycZBYM39lzlf pTgARJkU7SAzwnixb/Lh43TC9iA13utl8id6IKAiMl/McU/FLG9zZLKynhxeRdwLutot v568Sk8JtCFV/xYPZhFU3EdG3Ww8gdiEJfOhtVYYrMwhtu7lxgtMjK4G2w5tkts3zoB9 wUKejwoKQGhyXL13OWfbd5kuYx0c0PJ8ibNaUaXi0wYbr5kO0rUgDnNGXnAAty0nY36v 3Hbg== X-Forwarded-Encrypted: i=1; AJvYcCV6sy3WqotNdP19baHH3g+GIVHD7ecA1OJM5kfdkg6ydl395vU7RUE0TYICDX6m4zOw9BIcJDcCRUtZI2Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwmSMPdasmTNdYyFJWgu5wK7UKkGlG7aO/RIihnGeuyJJkVeLw8 MmMQkPyvwm/gKLLfq+9vxD+3bGVcQXQGiLS7+zrPzxM2D/ychpKVhZmuJX3zewU= X-Google-Smtp-Source: AGHT+IHiThpqNk1aykeI/HCv+JYxamwU4EBdrmtK4EAyvKSVy0PZGtmgt/LXmRWsriS/yuXmN6RtIA== X-Received: by 2002:adf:e88d:0:b0:37d:47eb:b586 with SMTP id ffacd0b85a97d-37ef12592e5mr5273994f8f.4.1729702249886; Wed, 23 Oct 2024 09:50:49 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:49 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:27 +0100 Subject: [PATCH 30/37] 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: <20241023-drm-vc4-2712-support-v1-30-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Acked-by: Stephen Boyd --- 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 22:39:04 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 E7C39204F9B for ; Wed, 23 Oct 2024 16:50:53 +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=1729702256; cv=none; b=Zxc8HQeSnxUc1FkiZ788xgyomV1Llsyktwul0LjvV1ZC5GozPXvHaPTZt+k6uhC/Oz859/xo1PWGRsRhJxSMutjPURXjSF1TznQMT1Vx9UUsdDJBcgsOXuzZApts6YJICOys4H7I3Na/Zr0WpQOuBDahr0ZTtbGj2kU1CBcXTuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702256; c=relaxed/simple; bh=C3Ok8sm57eKmxRqqzCgHPYhgz8IPwYz2HCnF7cfbcRM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZuW4jLA2Xh9cmG6Xk8hWyt5G/Qr1bwF9rSDkvL773Ylq2kleQGQPKp9Y0M3ptfAkTqGmfVTH8CAM/RG0mcDYsBHC1eYGCGaTe4dX0T5B5oTi6SXz90lQWZyKo3VWVH6mIWxcaLT5ntsazlpVYu6gVk3PHGaMyRxU9PDwFOfZtvg= 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=ooSlda9d; 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="ooSlda9d" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-37d50fad249so5507876f8f.1 for ; Wed, 23 Oct 2024 09:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702252; x=1730307052; 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=rM/PLpT0bJIFrHHYZG7pNuWN750b4ZOA/oUy8wRZ+s0=; b=ooSlda9dznT3V1h6pRhzcmXf2OIQ/8DdepYFfOKmKomRwvpIn9TM2VEPX19NPd4SX4 DS74dtSoNnBVguNHi1bFa2tp7XbemkP/gN4tRbzMcX3io1YhHjYHIb8309JxiNPGN/73 3GX3Wm2qVRjdJ3CAmWkd49Z/tiqfLvvMY2Zl1r5dcbk0KrAn2IEgvtRqCCOEWErZ2LmC 8f2nXcR63by6M3v82SJdq+EiGDwLhgcNQTu1cNgjHy2N1Lq1Z4A/2O0kIFXGsCvLXad+ a1ciJJqoTbS/V7pqURaG1LOAOlCU2t7YzwXgILidEQJYG0DdxXQrXZYRCzY1nyH3HIUH aROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702252; x=1730307052; 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=rM/PLpT0bJIFrHHYZG7pNuWN750b4ZOA/oUy8wRZ+s0=; b=aImPahJ8jsRbHyG7coXqFK5zI1a7Wx3vujXiV0WYF2SZ5YsXzEDeRrhN8rRkfvSih3 dxixGh70wATODqX9r53/ad2AJfl6dT69pZlNl8j3EjCMvzPwYW5fPWmqLrvgy33flt8s JsFK6Vna/6cvsNrH8mEh/63rYvhFhha3ymsRXIKcsKBhu++gTqUEoQH5Sde1XOmehaE4 eHQNFAORQS4GDDCpPX332VnPRLspdt5DZ2BGY3AmwuBRAxAmRteyUdieBnczxPK0mNE0 a9gXM+4mp7CYbRdex00NaQ3csCDDPu/4mQLk+U1IMTmZPWQdQwKXKoFzL/2y+/hpW2FI p5Qw== X-Forwarded-Encrypted: i=1; AJvYcCUTiNNGMZiWbffc9Xli3HAdi7VE6c3CRpYX2UYy2s7oK0aM9+VLOsZrdT3IOgDyWs2i+9TARmeJTWPJt/M=@vger.kernel.org X-Gm-Message-State: AOJu0YylymIqzo39DNHWfCqyWNP5o8/9lwSK0d3klCvOrguHoVZrTl0V 3Q68fsCzWjZy3KEn0NZ3BR+SHWR029xtLVypIjIh1qOcoLx4xWY26eUjKHOYUEM= X-Google-Smtp-Source: AGHT+IHztOCCr87oR87Z3+JBdAivrEgxHT4i0hywZWr6jUvTWMEc0lm3QWh2DVlbarj1WpyyJN12PQ== X-Received: by 2002:adf:e009:0:b0:37c:cc60:2c68 with SMTP id ffacd0b85a97d-37efcef190cmr2044356f8f.5.1729702250772; Wed, 23 Oct 2024 09:50:50 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:50 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:28 +0100 Subject: [PATCH 31/37] 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: <20241023-drm-vc4-2712-support-v1-31-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Acked-by: Stephen Boyd --- drivers/clk/bcm/clk-raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspbe= rrypi.c index 6d5ee1cddded..274176a938c6 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -156,7 +156,7 @@ 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), + .disable_turbo =3D cpu_to_le32(0), }; int ret; =20 --=20 2.34.1 From nobody Mon Nov 25 22:39:04 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 3C930205AA0 for ; Wed, 23 Oct 2024 16:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702255; cv=none; b=oYWZ/IFd3mpd5rzlAQJi/SVIx0qW8AMQs/avs71WqT9OaHCby6AhVjnPXZl3htP6aQ6WX8c4yjtqDKoGoY2ZxGamCxvnMNgoqfniLuMHGVTc8wJ+x9arxvrW5GuDEAWqz/rwjZ8TgGHlzaXgyI8uZ9/Bh9ibaLVr3/88ZV03db4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702255; c=relaxed/simple; bh=nCTgcNJqAOLt1t1JGW8NB89E+/HvF1h0Y8xB7b4gHLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oEhGDz9sif7NArVYOcp36YI9kWGkAgMp0F0az6AqMTXaZOCC8V22NnGp11PoYK1esj3BSsdp73q7TH3XK2eRNJJiu0d9onRB094E5LvK+8jb0Br0bgu/O3zEjHLmvDRvFQivCiY2kIU+JWzvGlxqGVJ9DMGh0Y3beMREegeC9mQ= 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=EmYDbt0K; arc=none smtp.client-ip=209.85.128.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="EmYDbt0K" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so70324045e9.1 for ; Wed, 23 Oct 2024 09:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702252; x=1730307052; 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=ts1NDd5vcHREqhcvSTV/1shtmvDfyt1K2xdMF/qf56o=; b=EmYDbt0KXrQUZiQBkXgvvcfZQsvlvr9WTeHhNnGiGLG2k1RH+Wo9YZtnBvPlHydMAC FT+ZBU2ZFzsbYHFYc4n+e7ILJ2S6/PIeygADPFr3ZDRe++lulrtn04ZauqjHfF7cEprZ 7m/5CxLiL2UP+J+JbFKYhOUW1L9FDQ9thPoFqG9f5bbff+KEGdJQn6DuDT3zGMTjlFJA ON6viroX+X7RG98IpCwIkdsAMPo8jO6Z648ynPGnElsv5cBiq13Hy+qNqie8AHqSQtgB WdAJcv3Qr6dUJB7r9LJQtrvrnZWw6GBKsEAjdp+tmieK5JU5/Y2yzxvVOazO59C6a0nd HaxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702252; x=1730307052; 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=ts1NDd5vcHREqhcvSTV/1shtmvDfyt1K2xdMF/qf56o=; b=YjXmEgt1BsJnaYDKeavlIVxHUKpNZ3ycaTj2L01y/SjezYRezFP1HCW1DcTBCsa9Dt 0ZAP470N+/Fj+Jqkbjo5e472yWqw9IO2paJXZaZDVQLLDXG5V9OCCMVdXJs7WVBUSrTq Aq6i5t8b5yBHYswHBI2HEjI/nmyKyU3cEOmTPbPzi7jMYwzoVWkVa+b3f9q2R4r9QSYN /GLfPvkU0kSSRNPAXo/ILo1XD8sYAWe8DoI0Q3L/P4Cu6u+VzD6058Qx22e2gqXVM8a0 RPPnVxVQYuwYEN2M3MHYfudwl7SWCaBTryIYLEc7OrPjKQP/N4dDrQJ6TYPgsKK84nep ++vw== X-Forwarded-Encrypted: i=1; AJvYcCU4rACeAsk200//fl1BgOGe3XH+dm7pPbNKsJuct0zmW3pJpJTBhanE95Pa4s/Q3nI7LcT11oJ31qh2yWw=@vger.kernel.org X-Gm-Message-State: AOJu0YwtEBPvjuvIC2xYrElXYEwWoKNJsvr8hYWs/3yztIC1bgPHwydq E8TfeslkMYtgZxZ8xoS3eIPdLrchOhxvqZSuYtarGK+6hmUIKKGaU9XqUwcV+mI= X-Google-Smtp-Source: AGHT+IF+Ep5cy5ocAHASp/06u2OSiKjV3AGCYRQMjGhBm4svhBLkWe/K2mww/KQzVSfsztZblCEfXg== X-Received: by 2002:a05:600c:358b:b0:431:46fe:4cad with SMTP id 5b1f17b1804b1-4318413e307mr28468675e9.9.1729702252475; Wed, 23 Oct 2024 09:50:52 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:52 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:29 +0100 Subject: [PATCH 32/37] 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: <20241023-drm-vc4-2712-support-v1-32-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Acked-by: Stephen Boyd --- 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 274176a938c6..fd7ae0efcf07 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 22:39:04 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 ED9CF205AD5 for ; Wed, 23 Oct 2024 16:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702256; cv=none; b=UjBwKK0vVd/kXmrBe73C3+1Kwfq+ZuRXbMRjVcbx11rDI+PRE0P9dwrZyMAoeuKqAntxBeUBOJjYkYH4SZ3buYz+J+wk0GVIZjfiGwu4WJdqP4atJ/+pxREPwra4Awa5OHJ9c5g3yP91oVnGP7n2m5K+8EuR/PceLezKRWvSm4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702256; c=relaxed/simple; bh=h60g8ThwYT/UJQE4G2CP6rUIno0KoMdhzemrzgI+AYI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dtoZ3eKC+LgX1J3CodCy1/AUzJQzEkCoswA03dYGvxUi5I9BR7I6ofMvJmtTNPi+CTUK54IqDAb32oqOoGu/WgsA+TzwYm6VibafF7Eqx/Qf3yO/zj9iXHPp/BGmXB3awDhJd/UJtWDSOqC1Lq/56yymuyJ3nmAp9N8jwL7MJ3U= 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=bL2DrpR/; arc=none smtp.client-ip=209.85.128.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="bL2DrpR/" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so77557895e9.1 for ; Wed, 23 Oct 2024 09:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702253; x=1730307053; 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=L9MiZUhuAcE+DC6JkjBsIZrkLkLAyStuyfWQoaNqfXQ=; b=bL2DrpR/FWJvjVHisJX0luDsjeVwtalgpvJdWsZ+637rtRRezTKHRugwXfdQ5bf/+y uiqlIT3FA0kmVYEA7kMVrRN6QnUPNoFuTfEQvSKB4QeY1EaMmOP14jpQ1sCjLjp6XG9j O8EPae4nTBvCJTUxZTiHeI1ndfQxE3+hcyWQH4QRa92YrkJz9ZxX2NTo4hfeUjuNBKlv UPfQlQpYrJp7KaxsDXY49plKI9POTVha/1Cv0HMY6xFqTl/Qnpyid/8wYQnXRKoKyl2z y+s4TBiCEi4qkFmmQkNJpubQvFxgKMRb2gxTpIZ5yLv8VqQqYBO7Q/0AdpdJ2V2Yedr+ f3dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702253; x=1730307053; 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=L9MiZUhuAcE+DC6JkjBsIZrkLkLAyStuyfWQoaNqfXQ=; b=ltIUvMdbL62MZNexLgt87BgFZDcQvTFFRtmTkuO1Kh/n/RxM4vkOzGmC2HG3O7GZHT QdeFoLX4wUVwTboRhKgRREl9fKfpU+wVazmkHThQCA9MBFLVJEd5DJ88+P10xfSzS303 mrV19KR5Hfi0zkOd/Y/qb+5P8fv94dnL7go5/BPQBprJX7IpsHVBbbSHLiaLVkqqncha LxP2AM9SlXjl5bGL0fWbpwJoeLxKwgZhDVSHy3VMCsh8CBhM15sfCltn2zXol3TjXhe1 s8dMy43hmJ6EKqQdaU2cIipAot+YLQ6vPtZV+SDj7DJIjpe+18IMf4zY15laEvh7n25+ 7jCw== X-Forwarded-Encrypted: i=1; AJvYcCVoHMOcXWX3pxARtkDtnIhFCrfYdcRRtmhIUyn0ZapfHhgTYszkBkk0iVrZHIWhu5kP+DyjxNwHCGf1mf8=@vger.kernel.org X-Gm-Message-State: AOJu0YwUMYgSEbZIWZDribNRMtLfVIN5eHglLvygIF1VdpGJAJTV3WMa IOAI40Gc0Ughe4vV2Wh1vqqV6oxnLzay6HoYYpHJXqTkTw9YxA4y9QcZV/wvAMg= X-Google-Smtp-Source: AGHT+IH3dVyDZOxIVjZAcfUl+JwKCM4Z59KdfEHOCGa0hmLNiw7CjeLKq/QM+g/Vjy8Ji+yxUeCFow== X-Received: by 2002:a05:600c:45cb:b0:431:44aa:ee2e with SMTP id 5b1f17b1804b1-4318413209emr25331625e9.4.1729702253413; Wed, 23 Oct 2024 09:50:53 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:53 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:30 +0100 Subject: [PATCH 33/37] 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: <20241023-drm-vc4-2712-support-v1-33-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Acked-by: Stephen Boyd --- 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 fd7ae0efcf07..89e2c0241ff6 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; @@ -177,8 +183,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; @@ -195,8 +200,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; @@ -212,8 +216,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; @@ -230,8 +233,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 22:39:04 2024 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 E18D8206941 for ; Wed, 23 Oct 2024 16:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702258; cv=none; b=o9GKhHkI8lAaPcroQ9pifPUUJTGxXFSUDUmTW13R4h9tdlZaPVbHci99T7/RJoQWtdKZinTkz95ltgd9B3f6c7eL1wC+9vfrtniU++lZTZVoRcQ1efFYntTSnyc/YvFAW+9pj9N2DZbqw/MVruMijbwhtQy/WkDsuqILs/ikVA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702258; c=relaxed/simple; bh=zOfNiFHIr6LUp00eEgBOCOMOPtvRz9GVcA5IPokPhD8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PwZJMGZ4H0jgsDGewo8liEGQvPlCUeeSde9H8728wSlPAQmwPLq7LV615ASurbEnm3y4emviEiZ79T/i+zecFn8/6kgAXT2fKHH5VSajqhkMCJw/rR5VENkR3vI9u8Sg9ulpH1TEtAmh27EFX97YVesQS7HJa2XiWmOEB4LXY/o= 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=QC/s7snA; arc=none smtp.client-ip=209.85.128.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="QC/s7snA" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-431548bd1b4so69622955e9.3 for ; Wed, 23 Oct 2024 09:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702254; x=1730307054; 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=PFtxhxYujLumaUhYyF7W41V3jkXWk5OXPRGFqIjwWy0=; b=QC/s7snAilRTzc1d36QEbrNfL0Yi9x7VmfUzr78791SMzIN4IMJl/hmWRKClYgXMDl pRjZutPXSHkG8SlCp2I1H/F08M40EdMqn+hhU2jYUdJ3jTqtGQtKFaYeKEi6PG5ipwGm q1m1jkhB0Oi1cSUko5sb/PNiXCNJNhUD3/m+VMEVxjASl+Jbdq++th2+4Uoyyo722FWd gjVG1jkGtgex0qKDjCJM/UcZMACkouqkCS8kn3NgT3bKPnNMQ46xAThTsC9KuGpMJrOH 2z7iC269DP+RDD/gIHr9EEEVJOTXpqMdvDT3sdn5S++yMvmmVzefUpiLLPyu7N41Bqny LGyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702254; x=1730307054; 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=PFtxhxYujLumaUhYyF7W41V3jkXWk5OXPRGFqIjwWy0=; b=bGMV1+G+jrP6R8Hpaslew5am710vIoROByr+DVfPGktnTq4pDlxPk+IG17qTJeC5tG R6feTcs5rwV9cZNxRzqMvWP6BcGPGZYzGQE6Ed+zbgtFXMc53QHVrGmyMeiQJILf0TzR P7Dm/lDlU7i/JGnUSIVkWXDb4vk3yqBEC7WG21qjeaSpfCSkOB/N71xuAUSc/RZye6hU NOaNT9xAJcT+j/qfsgdoRgHNTtOkSSWPuFjUX4coiQ67E8rd6LnhtC9peo1Y768C2m7d M8ZoreYnC9EvC7v1KVoMXZTD4guZ+bSNii+AAhJuIcX4QDJKLsi7ENFJJbMmwqRrCnXm Qcgg== X-Forwarded-Encrypted: i=1; AJvYcCUcEh4VJnBwKMyH7Zy+1J1pf0JWDJLDVLBrANu31eWyLWqHlbjuxnLw6T0xL0ZfjMaL269XAKm0D3gunRA=@vger.kernel.org X-Gm-Message-State: AOJu0YwMqOyOrdHLFRcfqLv/g35Xj6f/MTRkx3p9yY+maE6vUpVobUyu AHEUSNxWvCGj/8W4Rvlll7AvwJWs+YrKIBp1VLaegEyhEKB0NAThzfr00D6rDIw= X-Google-Smtp-Source: AGHT+IH4dOnkzCDNmAk4RGF4mcO+87rO9BS2DXATZO3jiQ7gGdJCQSnc4CC+BnBw8QyI1TRa/qtaAA== X-Received: by 2002:a05:600c:4a9a:b0:431:57e5:b245 with SMTP id 5b1f17b1804b1-4318423b9e1mr26772775e9.23.1729702254379; Wed, 23 Oct 2024 09:50:54 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:53 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:31 +0100 Subject: [PATCH 34/37] 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: <20241023-drm-vc4-2712-support-v1-34-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 Acked-by: Stephen Boyd --- 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 89e2c0241ff6..aff9f3195573 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 22:39:04 2024 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.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 34907202F8C for ; Wed, 23 Oct 2024 16:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702258; cv=none; b=cmRNCSBkHFZlhRbaRcoCxKBfMo3zKo3ZNlHopSUvtmPMFi4jc76qm9pGQCG8VvN211coH4FwQJqygcwS1jyPfyjfC1EAgQKl63R7jiiPFcfjJ3rbhm4r1TlcqBwj8hTOfehO5QX/+pRbZu+O1qP1cl7Oum9BDbNjBCtqDQB01Sg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702258; c=relaxed/simple; bh=6GIQGcktZBfb3EW9sCT/3N7/H28SyLep9RyAXNQs71k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L1CXxnhFgfGME65+pprKtTj2Ul6wDyskIIhyA+KLKNDhsihTQtukGsBVFPTcgk0qox7j2bwZvomBfdAbPZCr5TR7O6+NebWJ7HpmrrPvLFPNUnckcWjCZ1M5nzQwu+obd994KYVnuguqlaTBh0U24YzGTPCmw9p/yUNRwnJnbpo= 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=WOePlJ8t; arc=none smtp.client-ip=209.85.128.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="WOePlJ8t" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4316a44d1bbso42941795e9.3 for ; Wed, 23 Oct 2024 09:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702255; x=1730307055; 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=WOePlJ8tIpimRsafUkx/Q3TGB8qAPwiMHHEulqLZkl5qGQ2wtqFQAkghs8Xw76pSX1 h9/MgcQMr0udvMn8Ce6O6C3kcD8riQx0bDsx0EUpI2nuDX/1Zehf+leSHGpLL8n+s0iN KYASBWMjdLTpFqOTHmN4mPh2CEiUElF4svwECBwQ0pidYU1FtD+YaqK6+YFaHJGl5lkP jx+jse6Kk4DVoASAW20lVLjlioyd0aq13M/sAJch/dZGVr5D4IQP8zoj7NnXEL8NnqwA hz2vJHHkHwDug3OKM4BnHUbJ1wS97+oO/ozWL6FCRbe1IbI7NG02iHJQhwodkTeZCfPb UryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702255; x=1730307055; 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=qi/VLGomoMlrNjWLfqyFRgiVLwSwNIwNWOzC+7pcZsgNY3W/SQd6NivV0J3JGiZHo1 0HJHE7NqZewUuVNDfXChbptYwOERrto/odRum9WsP4VY8m5owMO3H45hlkVgo+0CRqyl cnApAb4Ljja9dI5I5zAc5m9IK110FtTpnfw+T9lEtN9VJZnBIpPCRb51NGvxUfV05E8+ Evv2wd5QyFVQRMtGyGLC3pSSX4tuNCawolhXHPbWI2K/F1awmY46brTWlT+VS8XH//Sh m2CuQ4jS75+TIilCv/K/+LCj2phD7ilmRZAZ1ihY/U9iEG7qJgzudqJCSFbIb1PvFVB/ E/lg== X-Forwarded-Encrypted: i=1; AJvYcCXCuCE/JhQQ7dR4aZ2Aho+ZH9TAKA7SkHvPpuglA9mPKWBYCezwa6CyXrYL8ozkmQbS+Z7Y3Ncj2LzEU94=@vger.kernel.org X-Gm-Message-State: AOJu0YxnOZfrURwleOnFPFU7SASNH7WVfUZpnKI6fsxp+aFTtXjnyXUM XqrdbcEyH1FmiR25086zqP2Pp7R1rNtRTj4DJ9MDe1hJpE+OJCc0TxeL6oQUbL8= X-Google-Smtp-Source: AGHT+IFBguMU8OEAESQDL/dSrL8fzEBB5IpCHLayBxdUcUsJXhruVCscX1KffjfpU7lvEVL73DyGQA== X-Received: by 2002:a05:600c:3b1b:b0:431:594b:8e2b with SMTP id 5b1f17b1804b1-4318413ee73mr31043765e9.12.1729702255516; Wed, 23 Oct 2024 09:50:55 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:54 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:32 +0100 Subject: [PATCH 35/37] 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: <20241023-drm-vc4-2712-support-v1-35-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 2024 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 17A0B208996 for ; Wed, 23 Oct 2024 16:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702260; cv=none; b=Ez8BXjgidY6y9hx2jmiyoaoyKaDerkNm4LbdsA7bBpmqnMpSjGoUT+DFmvTGaCULhHGRkyKWEtnbyrIATC2IZBa0Ffq6NQHduTD9r3Wt3wQ7NngLjIyvZD/Ro9Z+41ROnuodMcmhx2OgtkMqZuPXiXy43b3XoqAbVPCJz8L/T0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702260; c=relaxed/simple; bh=nMBH0rWLQkU2soF+Cg2c4yz0aba3rmak7d2lggM5H44=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lvwCHaWA1MiS/MO6xeI1wxjx4Ho9f9vKvLa9cEH2s63GeUvRvM1WaXjUl8yeG6DLcF+8ZfUYMJDfCzAQM9Ml+TLT/Pl4jVF+W+lzy0I3LU0ixpW5EsDohFxqwu745TLLUvxlV86aW6drhKziP5Y4XJUxauEWAoZGtEw5NnBhegk= 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=W53HFHGo; arc=none smtp.client-ip=209.85.128.46 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="W53HFHGo" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43163667f0eso55405185e9.0 for ; Wed, 23 Oct 2024 09:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702256; x=1730307056; 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=W53HFHGofOY87JUQQ7VMG0jCiHlRc2Tq+6KriRo2SlDgojvu7zpmtA/ofdJkdPQllA 5un2VyGZtR0Dnk8Cp38W5JOt3EnUipVIfoKC6t49LGgF+iMTVKFHq08zIO7PQlMUxNnh 7bAAGaN5lU8WHOy0AxKZBbrbMxP+5fP5/xy9XWqY9qwgwfz57b98h9tPW+UYPumLdm7t KHZIX9teZnZTKnprsJVScKcBmzUW1fvL1rTbtU05VaahtpkeUCuGJtAYrskMaVdgyOro hVj8MFrOzkvDNTj3u3OE7ucwAloitE8WD4sIuYjxWgDFdnW0GtcJngGJb2Bvvaz+ERL9 twog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702256; x=1730307056; 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=mIQmfsylUGVeTvT+HNuTwg/H0SljcM/tKfQc6BvsF13zONSgg9Lhr64XkIrrDwhIwl UrfsHUI3iuWO6WjFVp2CJS/9SXIyh4cey3VHWtCjT9nBzDuGyw7dMClQNbLLQEQNH0i/ 2EVmZt50D/gzb9PTGmWrNnqZU5Rw98W1UraDlEBeaBNfcvTXd8eO7INCrpcMZ6f4zaiy WkC6xMK/yM2aCZtla4GTUPejI+e05xs0JmIUKIVBz03Qye+9gsAk1GFkcYYXsMNm4Zdz x8Dil22rg+zAI1pM0Ec1tNsX50aYw6BtdkT5RBXqXDnIViJezAoZqefhD5Z7cX8ItoaQ RSWA== X-Forwarded-Encrypted: i=1; AJvYcCWmQtUott7uDKj1lSRC9rUEwlzHk31IuBnNDFHiY15U+voRETD+pz0TdnrJq0j1bydvXC7w9SjsXiDlxrI=@vger.kernel.org X-Gm-Message-State: AOJu0YygtDbEiH1M8Nr9cqktvuX5zYs6KmuUOmnNBvJiMEEZVWvZLjtx TUYWp7pc7mabR0T40FpoNRAkE9MPPdhmygaso7oVHYVIzgC2fZZ1ouUESGaFyg4= X-Google-Smtp-Source: AGHT+IEKHk3DI5IbbI8urr1ZRpPA9f3+OxHfkXhNNfwqtfcP/WAzZ07gB+VgLne69sb39V54boK1Cw== X-Received: by 2002:a05:600c:4e8e:b0:426:64a2:5362 with SMTP id 5b1f17b1804b1-431841fd6b6mr24505825e9.8.1729702256467; Wed, 23 Oct 2024 09:50:56 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:56 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:33 +0100 Subject: [PATCH 36/37] 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: <20241023-drm-vc4-2712-support-v1-36-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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 22:39:04 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 4CA1A1D015E for ; Wed, 23 Oct 2024 16:50:59 +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=1729702261; cv=none; b=Mp7b1f/8xcsEJygH7j7pCqzv2Sb9UsYq7Sv3/otCcPM71t5kFjoZlUSJ/qYsutpb3xugBYlVuTzbV7DGATC9CyUIoG6gTVzSTh7wptPREMO5xQtGPWQjcORovM3x+jpDGzHhxluThul5gEgCqVzDzTDIn8mmCqDsoTOeMdFf7Ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729702261; c=relaxed/simple; bh=YzyDLNl8va/xJl47EHT+vId7czfsGNnbHYHobDKQTlg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AQZ5BLE0ZaEc9nK/mHH+sKJfsbj6vUr5XHPzfZjRaFVhYrzz9FhDIh+MwZq1b+F33UG6K0xy+aJaL3AersJrgX0RXwYrtU6JGst9PAPl/y/igwos/gqqFTM3fsm1CRW1Ev9dRwWTvJcFk3BpjZ/DUfGSyvdk4Z/ERIr+1tBbZMg= 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=rkfrkLKq; 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="rkfrkLKq" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-37f52925fc8so32947f8f.1 for ; Wed, 23 Oct 2024 09:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1729702258; x=1730307058; 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=rkfrkLKqLgRsplrsZqRWvZZGQof9auNQasLNinujzsbNsRUpqLanza6XyxYrrZNj8L nBNTJ69ZD46c/m1vwbP8V86QIw75LDiVr0O47Kav84XfVx6KSrFMge0yWP2FkWkiEAgx gT99G6im9kVqCogG2d34n8ArG2y0ZM82u00fKmG6+ftwcicErE30c3kPehmkUIPJ9fc8 OcphUnIO3jaIfgP/mojARb63OqMW+uy9qwsfU1XIVK2BlkMzRKoFEMt2s5eDQHsYVOD9 9/qtuUqopdPkNWEc1rsEWJgZJpo9YHLF9G+HEbNlt546icKw/7fG4kkHvKU6m7ewLmMk FoHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729702258; x=1730307058; 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=S2bKaIIiZ4h0jVjRthglybJXhk2LZwnHxHm85PEHHu4rQ/Vzddar3Z5jWvoKQItT7L B1s3akAhxhJzkjHZMM56ATYDLr7tNKX7zimtlHEjZtvviNfX5DHf8BSHWyPvVXV4uz8O NrwXlYaFJ/K4iyUuCSw7B2Bja5jmTVJG2EcHBp50FBnW9OkfYOYul9I1ihyUWDDyhIjW xqDxICQyvZUHlVvUkHDH7eacKgGkKXwlCfuYRB9v3q7LPMpvY6WpSGemnfOn0OqzwVy8 76G3TUFV4GrflfH4KAX/Q3D9BQc3oW5ODH2bobTstCzBB6r/Dma1jMHJnrB9lDrd1grR 4m6g== X-Forwarded-Encrypted: i=1; AJvYcCUqbF8Q7PQxW7GkmmeOvv5qMiJ/gK89kfDeTJoYSTeO4uIj8JFQFfg3/ahrtAhfgl2ckbU0JXKHZnl7YTI=@vger.kernel.org X-Gm-Message-State: AOJu0YySdD4v+kFueH1GQps/8yHhEJ3FA9MPLfpuOnsqT5oOGM22+CMp lz8xF3tbOyk6JOkaFJDnCpFcZXPjxySAuqQBVuZR4wDbAsqRENgfLn1ngKP+DTM= X-Google-Smtp-Source: AGHT+IHyDo7gKJ/IShXkUH9eaVP+PbzXws85gi+26NgIg+img0yXRqlCHCujQCnuXRFKsSClohiLPQ== X-Received: by 2002:a5d:6102:0:b0:37d:509e:8742 with SMTP id ffacd0b85a97d-37efceee7d5mr2193265f8f.1.1729702257644; Wed, 23 Oct 2024 09:50:57 -0700 (PDT) Received: from [127.0.1.1] ([2a00:1098:3142:e::8]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43186c50445sm21642035e9.39.2024.10.23.09.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:50:56 -0700 (PDT) From: Dave Stevenson Date: Wed, 23 Oct 2024 17:50:34 +0100 Subject: [PATCH 37/37] 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: <20241023-drm-vc4-2712-support-v1-37-1cc2d5594907@raspberrypi.com> References: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@raspberrypi.com> In-Reply-To: <20241023-drm-vc4-2712-support-v1-0-1cc2d5594907@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