From patchwork Fri Oct 2 04:03:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315150 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=Vduysfs4; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gh7yNJi+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9Rz5Kqpz1xvt for ; Sat, 03 Oct 2026 00:01:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 200FE60BCF; Fri, 2 Oct 2026 14:01:18 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 5aISSqnHRMPy; Fri, 2 Oct 2026 14:01:17 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org E45F360894 Authentication-Results: smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949677; b=gxXS989VhF60piO39YA/k25kLRkGJ6a6/5861+hLgHgNdKSVuKz7Q0RLzPztRUQ5hfHQ 35a/5d3XHGnRhgGF5fyxcpVOs0R0grGxOdkt/sD2HffhpdYmadYB7jJzZ/IKpMC2Of7hn HI5zWd7MsDk83PJLN5UFzKgQPAmj+lCLdxEm14VwLHoj3nRd74L5b3+eTBZGxAaAKI8Vv ahK2Nj+cagk2cphL9r2vUq6V7+VdELwWVs1Rlh3jQiTwTP0JrDlPPsrQ6kHJdZZteHIEc AELy4dM1Z3mMEmQ7yYagOOCA3ZLDR4Kg0cXCrW2GtgLv0sO9D6FZi/5h6kocEt+k8Gg== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949677; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=9w0rTM7Wu/fiTQq8ZdXIGVsDq7KNt9CBGWDpugXjIHU=; b=cay63QjVactFmY0hcqgH3H5RFAJX1Ifr2pp28S1WuyaD4Y1gSkxj1ep1IYUOl4sH2ShM Fw9mKxzzXiTubCS2vrRAK+S5GBWkvZFE+3f/EaXwijS/yFsnE8leJgeJNvJZh+yYrzY2r WNvXYVoitYmp5KWP7+elHZgNeC6iW+mIxKS48pwsNe9kcI7puCX27h0iw9Vq38ccF03hG vwI8W+AYP0EAjUqLO47exbQuaXneiZplXHnYAZb/rML7DaIySCayo3WXwDsiCRcNlrVUa 8YQbbwu1EV4030E349r43/CoDZF6ztIhK27QzOCq1Db/txeli2vi0UdlQ6b0lByL0Xg== ARC-Authentication-Results: i=2; smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949677; bh=9w0rTM7Wu/fiTQq8ZdXIGVsDq7KNt9CBGWDpugXjIHU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Vduysfs4GN1WWB6R2jYZ3YlYoTraFPvfmKm73CsECKXdzYWcVzCoAo1FeHwoVtH72 ZfYEMQv3IQB4mSK2OT/mFwN64dGgFDFAzxvU33az+rVQRalTsOod+Ae2AytIj+0sw9 HlsZnAJipt1KOND23QXDp1eMLsK1hBbOnNxBhVqMwGS/vg7hSFNNZEup19/+/pArLK 4LAoGb4uogn4REkP/UgsOClLmJuaKF32hI1UazpZf3Cd8s986Ug4BsQ7YREyQ8Javk dl1sHxh/D8tFXFpgW7MxD+VwK7Iy3Bxt1bwI8Tx28vRLbQUEVi6hg7vnGzfanxv0qy Jhl2sQ2MdUROQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id E45F360894; Fri, 2 Oct 2026 14:01:16 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 05886263 for ; Fri, 2 Oct 2026 14:01:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DF67D40D94 for ; Fri, 2 Oct 2026 14:01:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id r4V4gIAmL8S8 for ; Fri, 2 Oct 2026 14:01:14 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 3F7CE40D87 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::11" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949674; b=SUjVWqqFoEQJ9guIgoEcvUlpq+GJ3QawFEsyCA84azV52J6MFhvUfz5GmkHSndSzsXg5 7J5uf2/jDoVgvs6eb7y3n2kWChzcXxjB9TFRj2OqAbinQ3AVUBf6s9/1RMd0MlKzeDkUP Efziw8hcCNiWdajYrXvLWD8kXegilZr4jBjbrCgB/1mtqvmNrA14foylrkGSdtZSQurL6 6+Oe09Mdigkm7vXhAFfP15tdC3h73yq8G7zBtBbLCHRDYCy6kneY9z5Kfzz5bwiZnw5Cn luI7eN4bv8ZXMhGQyqZlViP7nBA9xXevpmzuDnWqKmt8yV56rsonoYvd1P3yOWmh7Ag== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949674; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=9w0rTM7Wu/fiTQq8ZdXIGVsDq7KNt9CBGWDpugXjIHU=; b=IhgEShgJ9y7rSzJO59o9m0cg0jzq/gafbWIS14Dsmgc9JJvhMnUa46bnn0dA2a/vbVNe 0olvDyh4wUSF4HESElirAsYM3y6thobmHMPP4lEFyjIF6V9fAMvfShIaEASYNJTKCdw4h jkrax1nsbk1meR3GNUhmeIWI2spW7Dalirp87YDlN6cGHnNyyXp9Dmb+kk3tgFgL1KhsK kK5XIHaRElzgXQq8rfYjywq2xI455lMG+l1IYg5gbXbrgzBBvv99TfQ8USoF8xgbO0WDY kk4c0ffvPZoGCNDfJVDmeomDHLBgv52IjH0T6iwrcANxAyFYnYEgSrQ7tCDuwl5I1JQ== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gh7yNJi+; arc=none smtp.remote-ip="2a00:1450:4864:31::11" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::11; helo=mail-wm2-x11.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gh7yNJi+ Received: from mail-wm2-x11.google.com (mail-wm2-x11.google.com [IPv6:2a00:1450:4864:31::11]) by smtp4.osuosl.org (Postfix) with ESMTPS id 3F7CE40D87 for ; Fri, 2 Oct 2026 14:01:12 +0000 (UTC) Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-4a0977b9c20so882235e9.2 for ; Fri, 02 Oct 2026 07:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949671; x=1791554471; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9w0rTM7Wu/fiTQq8ZdXIGVsDq7KNt9CBGWDpugXjIHU=; b=gh7yNJi+EBtowq9XzgMVM1Qo1ABhBj/txKxKIlGrxPpUpjhDOFm7HjDfwAEafpFBAi sQKGuW05Iu06O1FWmARjmu6M0Pi6EGDvPnbKft0JRrrjQQlXWLafkbPb0IU5+C+2kDK7 jEqQ6ju4Yc+c8YU7d8WTAkQlOIjXjK1H6w1v0vXyAZDamju9aAD+gbzVrEeECWcII4K+ 8iTnpzKjnHRXuZuoOrI3nS2+Z+QcDdEhQAmZDXnYtV5cfRkQXLQcL6+yEUEAx97cRBWj 2uB8m2ueYbTacpKocwXv+I+Q5i1AysR7BbpJQPZ1wAe51lvMJS4RHdLkDi0SXdrrsE0J 4b9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949671; x=1791554471; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=9w0rTM7Wu/fiTQq8ZdXIGVsDq7KNt9CBGWDpugXjIHU=; b=q0KMTYKZlV1zfEaEFF1m6xp2CPyCtzTDcdvZDf7V24GJQamIx7XlWDpbI8aHOyrNSI i87mno0a1Kf9sEqNl9+CZr1Ho8Ko7FG+bGHAJTknVuVaSU8QfP2E+ihCcBO3baWsrtU8 D1PNXBiU5W4/NgV/WOhMZNT9cqJuZ2awGDyP/cK+u0+Xh+VU5kXL4XU93e27H6eqqgwV gjls5bhjMNUAFQtEcG1/a3Hu/la+qmJ3kly5z1jeOofUo+zWFLy0N1itapW3CjwkcZBi Uw4M0Bl6dmasQAUy/mLbGvFYM1xN0OJh4gE+cV0681uAXAqzPywa4OoZp6rWNf1IFA33 N23Q== X-Forwarded-Encrypted: i=1; AKwUvByKhHVPrmfnzt10UyVa1TtWqMwmOYzU6F863vINhyVA4WHyOfush2FIp4vtdIW+VSIcROLIGqs=@lists.u-boot-project.org X-Gm-Message-State: AFuF++k5+HAJrhqQD2pQxSjmmQfw2Brc2qx2D44raOznmMoNKIrpFTNO +MeGi/ma+sMsiq8bdhqZayICBVtXGtn47WfaGQOjKGkXPqmI2DKr3iGNzQZDk5yyMlM= X-Gm-Gg: AYBFou1eGwnQDqH03LRSZA5ME0mAT4T0GqHdwnZcULt/Ykg16lE8aiAdi58VJrIanwF wrgaSnmg5XKYkflW5yky4EtnQexglVii3Fu5TArt4O2uHmGP5K5DwCBBmmQNWPY6dPB6IiRVqeg QnQrMinzmcTN2C2HE9F9l034hWkrOy8JpvSNBq6SrU8+Wj9rBR8+lJchzx4Qv4LhWQL4rYF2NpI JqR5kcsX+4dKNHLqs8Hkvt5imBFdvlBCFQwLwSTu4HNxR+d0GWZIN3YFFxcOBeSSDSmuch2VIHL QVAjxa5LZ+Axt9inlf87F0frfqOcoDKMqVCdZVV9GmZcOdEfCuDmBtQ+jfgWo9PMLkBB3jv4/Gi UODZErmJx6H/61+SQLNjPclGksg643Gk5nsTKt2KbsjdY2ImMQKeWrA4oaHxLOI+WkQPE8HLZke kBd6bJgvaSHuK1DxIc64f0bSYMR9yvUa2I7ZXtpykEfoJk3yqkUgLk8df0Hk7YQahuIltFm1zBS 5G4tgFB1tIJGNZ539m9BIRLWhnte8v+qlrKzKIJUIQtdb0N1qSxylELq2Ve+kXCKfHkHi7QbGKR Ii0KXhgf5CxkFXbqFpt5nv5qD7qF3g4FxFjOdemBcj73bVZ08XmhClQ= X-Received: by 2002:a05:600c:4ec6:b0:49d:1cc7:5ec3 with SMTP id 5b1f17b1804b1-4a02756637cmr53150865e9.9.1790949670108; Fri, 02 Oct 2026 07:01:10 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:09 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:52 +0200 Subject: [PATCH v2 01/13] memory: mediatek: mtk-smi: support smi_common and the larb ports MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-1-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The DMA masters of a display pipeline reach DRAM through an SMI local arbiter, and the larbs themselves through the smi_common block behind them, whose clocks must be ungated as well. Drive it with a second driver in the same file, found through the "mediatek,smi" phandle of the larb, and reference count both: several masters share a larb, and several larbs share an smi_common. A larb whose smi_common has no driver here, or no node, is not an error: its clocks are already on. U-Boot has no IOMMU driver, so those masters address DRAM directly: add a helper switching one larb port to physical addressing, which the overlay calls once its larb is ungated. Four compatibles are added: - "mediatek,mt8186-smi-larb", the generic fallback the MT8365 larbs carry behind their SoC specific string, so a single entry covers every SoC reusing that larb generation, - "mediatek,mt8366-smi-larb", which the MT8366 larbs carry on their own as that SoC is not upstream yet. They are the MT8188 IP, so they reuse its data, and with it the secure monitor call taking the larb ports out of the IOMMU, - "mediatek,mt8365-smi-common" and "mediatek,mt8366-smi-common" for the smi_common driver. Neither node declares a generic fallback, so both SoC specific strings have to be listed. Signed-off-by: Julien Stephan --- drivers/memory/mtk-smi.c | 157 +++++++++++++++++++++++++++++++++++++++++++---- include/mtk_smi.h | 20 +++++- 2 files changed, 161 insertions(+), 16 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 4531d416861..28f026c3ed9 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -1,24 +1,28 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * MediaTek SMI local arbiter (larb) driver + * MediaTek SMI local arbiter (larb) and smi_common driver * * Copyright (c) 2026 BayLibre, SAS. * Author: Julien Stephan */ +#include #include #include #include #include #include +#include #include +#define SMI_LARB_NONSEC_CON(port) (0x380 + 4 * (port)) +#define MMU_EN BIT(0) + /* - * On the newer larbs the mmu_en bits of SMI_LARB_NONSEC_CON live in the - * secure world, where "the mmu_en bits of LARB_NONSEC_CON have no effect", - * as the Linux driver puts it. Which ports of a larb go through the IOMMU - * is told to the secure monitor instead; U-Boot sets up no page table, so - * it asks for none, and the DMA masters use physical addresses. + * On the newer larbs the mmu_en bits above live in the secure world, where + * "the mmu_en bits of LARB_NONSEC_CON have no effect", as the Linux driver + * puts it. Which ports of a larb go through the IOMMU is told to the secure + * monitor instead; U-Boot sets up no page table, so it asks for none. */ #define MTK_SIP_SMC_CONVENTION (IS_ENABLED(CONFIG_ARM64) ? \ ARM_SMCCC_SMC_64 : ARM_SMCCC_SMC_32) @@ -28,6 +32,24 @@ ARM_SMCCC_OWNER_SIP, 0x514) #define IOMMU_ATF_CMD_CONFIG_SMI_LARB 0 +/* + * The SMI local arbiters gate a multimedia subsystem's access to DRAM. Linux + * handles them as part of its SMI/IOMMU framework (its mtk-smi driver); + * U-Boot has no such framework, so this minimal driver only ungates the + * clocks of a larb and of the smi_common block behind it, on behalf of the + * DMA master sitting in front of it. + */ + +/** + * struct mtk_smi_common_priv - private data of an smi_common block + * @clk_bulk: clocks of the smi_common block + * @enable_count: number of larbs that enabled the smi_common block + */ +struct mtk_smi_common_priv { + struct clk_bulk clk_bulk; + unsigned int enable_count; +}; + /** * struct mtk_smi_larb_data - per-SoC larb data * @port_sec_ctl: the port mmu_en bits are controlled by the secure world @@ -39,20 +61,20 @@ struct mtk_smi_larb_data { /** * struct mtk_smi_larb_priv - private data of an SMI larb * @clk_bulk: clocks of the larb + * @smi_common: smi_common device behind the larb, if handled by this driver + * @base: larb register window * @data: per-SoC larb data, NULL when there is none * @enable_count: number of DMA masters that enabled the larb - * - * The SMI local arbiters gate a multimedia subsystem's access to DRAM. Linux - * handles them as part of its SMI/IOMMU framework (drivers/memory/mtk-smi.c); - * U-Boot has no such framework, so this minimal driver only ungates the larb - * clocks on behalf of the DMA master sitting behind it. */ struct mtk_smi_larb_priv { struct clk_bulk clk_bulk; + struct udevice *smi_common; + void __iomem *base; const struct mtk_smi_larb_data *data; unsigned int enable_count; }; +/* the MT8366 larbs are the MT8188 IP */ static const struct mtk_smi_larb_data mt8188_larb_data = { .port_sec_ctl = true, }; @@ -81,19 +103,84 @@ static int mtk_smi_larb_bypass_iommu(struct udevice *dev) return 0; } +static int mtk_smi_common_enable(struct udevice *dev) +{ + struct mtk_smi_common_priv *priv = dev_get_priv(dev); + int ret; + + /* several larbs sit behind one smi_common, only the first ungates it */ + if (priv->enable_count++) + return 0; + + ret = clk_enable_bulk(&priv->clk_bulk); + if (ret) { + dev_err(dev, "failed to enable clocks: %d\n", ret); + priv->enable_count = 0; + } + + return ret; +} + +static int mtk_smi_common_disable(struct udevice *dev) +{ + struct mtk_smi_common_priv *priv = dev_get_priv(dev); + int ret; + + if (!priv->enable_count || --priv->enable_count) + return 0; + + ret = clk_disable_bulk(&priv->clk_bulk); + if (ret) + dev_err(dev, "failed to disable clocks: %d\n", ret); + + return ret; +} + +static int mtk_smi_common_probe(struct udevice *dev) +{ + struct mtk_smi_common_priv *priv = dev_get_priv(dev); + int ret; + + ret = clk_get_bulk(dev, &priv->clk_bulk); + if (ret) + dev_err(dev, "failed to get clocks: %d\n", ret); + + return ret; +} + +static const struct udevice_id mtk_smi_common_ids[] = { + { .compatible = "mediatek,mt8365-smi-common" }, + { .compatible = "mediatek,mt8366-smi-common" }, + { } +}; + +U_BOOT_DRIVER(mtk_smi_common) = { + .name = "mtk_smi_common", + .id = UCLASS_MEMORY, + .of_match = mtk_smi_common_ids, + .probe = mtk_smi_common_probe, + .priv_auto = sizeof(struct mtk_smi_common_priv), +}; + int mtk_smi_larb_enable(struct udevice *dev) { struct mtk_smi_larb_priv *priv = dev_get_priv(dev); int ret; - /* several DMA masters can sit behind the same larb */ + /* one larb feeds several DMA masters, only the first ungates it */ if (priv->enable_count++) return 0; + if (priv->smi_common) { + ret = mtk_smi_common_enable(priv->smi_common); + if (ret) + goto err; + } + ret = clk_enable_bulk(&priv->clk_bulk); if (ret) { dev_err(dev, "failed to enable clocks: %d\n", ret); - goto err; + goto err_disable_common; } /* as in Linux, only talk to the secure monitor once the larb is on */ @@ -107,6 +194,9 @@ int mtk_smi_larb_enable(struct udevice *dev) err_disable_clks: clk_disable_bulk(&priv->clk_bulk); +err_disable_common: + if (priv->smi_common) + mtk_smi_common_disable(priv->smi_common); err: priv->enable_count = 0; @@ -128,30 +218,71 @@ int mtk_smi_larb_disable(struct udevice *dev) if (ret) dev_err(dev, "failed to disable clocks: %d\n", ret); + if (priv->smi_common) + mtk_smi_common_disable(priv->smi_common); + return ret; } +void mtk_smi_larb_port_set_pa(struct udevice *dev, unsigned int port) +{ + struct mtk_smi_larb_priv *priv = dev_get_priv(dev); + + clrbits_le32(priv->base + SMI_LARB_NONSEC_CON(port), MMU_EN); +} + static int mtk_smi_larb_probe(struct udevice *dev) { struct mtk_smi_larb_priv *priv = dev_get_priv(dev); int ret; + priv->base = dev_remap_addr(dev); + if (!priv->base) + return -EINVAL; + ret = clk_get_bulk(dev, &priv->clk_bulk); if (ret) { dev_err(dev, "failed to get clocks: %d\n", ret); return ret; } + /* + * Not every smi_common block is handled by this driver: where it + * isn't, its clocks are already ungated by the time the DMA masters + * run, so having no device for it is not an error. + */ + ret = uclass_get_device_by_phandle(UCLASS_MEMORY, dev, "mediatek,smi", + &priv->smi_common); + if (ret == -ENODEV || ret == -ENOENT) { + dev_dbg(dev, "no smi_common device: %d\n", ret); + priv->smi_common = NULL; + } else if (ret) { + dev_err(dev, "failed to get smi_common device: %d\n", ret); + return ret; + } + priv->data = (const struct mtk_smi_larb_data *)dev_get_driver_data(dev); return 0; } +/* + * The MT8365 larbs also carry the generic mediatek,mt8186-smi-larb + * compatible, which is the one matched here. The MT8366 ones only have + * their own, as that SoC is not upstream yet. + */ static const struct udevice_id mtk_smi_larb_ids[] = { + { + .compatible = "mediatek,mt8186-smi-larb", + }, { .compatible = "mediatek,mt8188-smi-larb", .data = (ulong)&mt8188_larb_data, }, + { + .compatible = "mediatek,mt8366-smi-larb", + .data = (ulong)&mt8188_larb_data, + }, { } }; diff --git a/include/mtk_smi.h b/include/mtk_smi.h index b0166b37538..d4a22745d5e 100644 --- a/include/mtk_smi.h +++ b/include/mtk_smi.h @@ -15,8 +15,11 @@ struct udevice; * mtk_smi_larb_enable() - ungate an SMI local arbiter * @dev: larb device * - * Enable the clocks of the larb so that the DMA master behind it can reach - * DRAM. Calls are refcounted, so several masters can share one larb. + * Enable the clocks of the smi_common block behind the larb, if any, then + * the larb ones, so that the DMA master in front of it can reach DRAM. On + * the SoCs where the secure world owns the port mmu_en bits, also ask the + * secure monitor to keep every port of the larb out of the IOMMU. Calls + * are refcounted, so several masters can share one larb. * * Return: 0 on success, or a negative error code */ @@ -27,11 +30,22 @@ int mtk_smi_larb_enable(struct udevice *dev); * @dev: larb device * * Drop one reference taken by mtk_smi_larb_enable(), and disable the larb - * clocks when it was the last one. + * clocks, then the smi_common ones, when it was the last one. * * Return: 0 on success, -EINVAL if the larb is not enabled, or another * negative error code */ int mtk_smi_larb_disable(struct udevice *dev); +/** + * mtk_smi_larb_port_set_pa() - switch a larb port to physical addressing + * @dev: larb device + * @port: M4U port index within the larb + * + * Take the port out of the IOMMU, so that it issues physical addresses (PA). + * Without an IOMMU driver the DMA masters address DRAM directly, so their + * ports must be taken out of the translated address space. + */ +void mtk_smi_larb_port_set_pa(struct udevice *dev, unsigned int port); + #endif /* _MTK_SMI_H */ From patchwork Fri Oct 2 04:03:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315151 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=QHwAk8xN; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=XIO74+lN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9S53Vlcz1xvt for ; Sat, 03 Oct 2026 00:01:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2B69081324; Fri, 2 Oct 2026 14:01:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id NZKcMdC9dJHK; Fri, 2 Oct 2026 14:01:18 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 8D0DD81303 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949678; b=PNbG2TmWNYAKI/+7BJEhssm/qkcI3ndMyqQxbcQBmKZ+MzORJkejmvwUVtaTF//+uBxo 9nEuvYQWuSVwoMu23PTFh3mhB6HIFuyqsNwUg3L98hinsw1eNwDBiDwH5W4id73ViCogl nfR99dUCVvn9uAh7i0g+rgQrx6Re7tpqnxzp1pZeP/REhjrde2L88UYrTiZerB+eJm7JD XcfFGapglpM2L18sFoYDkgdZnVF9UVCazCBWn3kMrZIOtOOdEOSR+ZBI9+KM4TLuQ7mxk P1Z72WobYcjbirZF30hwsq2iKZAqiBHA42JJgPikMM2/CsO7a0mE2DHBn2LawpFVviQ== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949678; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=K6IquK68HlCusO6ZINh0VS2i3GbV4UymBUE9LxnySz0=; b=EiHV4owFfxT/VLzrBEMMf0YNfUHZmTX4cUQm/dtNUvmAu9wfQtyqUoWI10whH9D+ja/J 56hQpTDaaxa09/PfSqs90I0zQqSDHtewiqYIRPPFBbsFvYj81G/OB7uUs/mWb78hCnMgJ nEIdNoAoE/hm9Nl4Hp3+d4+Bqc0QI+7Pqym+R+/2N5Z2fcpbdWOHA932svZV/QyN+peKF hMmWobLmHkvusyCScslg/qV6f6NsJXddaSqjfGr0rg4ZrJmdneIBqZbXpGt/cpJH6xajP OAi+8MWdduIBK14cmcSbKiIxQCnmjiE4UVKFqbgwE9RgCvK+bCsi/xCaXhm7JXi4gDg== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949678; bh=K6IquK68HlCusO6ZINh0VS2i3GbV4UymBUE9LxnySz0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QHwAk8xNw99AkfsmQjlCpyA2iC1eXqXs6bJHaGEIaYGDvvT9A65Wzm132IT8hzLA5 mlbQcU1xH+q3mqgnsh6S9uv+CsETZ2kq99Gn+1dI7bIdcXiyzvAyQlsPHP4/nooOSX 7axNpmjbdaTTqTrul7i4FcigKZXkUeJCFd2AxeI5Es1uIhIN+tfc3YWHkERMFAVOxY FceDJa7y5ZkGoTRyWqRMzQfmdd88SIsg6ThTXSppME9gcuqBqL7KmhcEnjDVGbDXzY EEooCHsxqKSlUrnZ1Own/ldEn46E1aNMDVUqs4kR5h8NFiCJIWr8TBCr7Z3BtVri2H Iy5XVfix5gb+w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 8D0DD81303; Fri, 2 Oct 2026 14:01:18 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists1.osuosl.org (Postfix) with ESMTP id 12FE234D for ; Fri, 2 Oct 2026 14:01:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 04B5E4055D for ; Fri, 2 Oct 2026 14:01:15 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id K4ArK2VUXtbT for ; Fri, 2 Oct 2026 14:01:14 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp2.osuosl.org 996DF404F8 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::e" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949674; b=n7ZFpGhaTXhjitTfroFAjJM+XiPALG9wSyqQG3sMvIu82G059ACmsytqmnsTH9s4SIP6 aX+AuLvR5DWiD0hk1MbnzH+G+ySMm10c4IxVxkltQxi+FhBmzP1Mp2AYoipTOBgk4Yu6C Tx0m2hQkjC3UqtvGwggq7Usq2pC9Hz5csUVUUhmK6qi26J0CCer76dxZNH1xVMxyIRZD7 lJ3ZGWwuXmoITxkgzFMraxj/azQyQU5kKi8XnR8xHqUvqrgw3eZWnFqyNgQlkH1Ai8bkR eR6bf8JMna3biVyI3KEPnHr+/s8sg6uO1Dc+wUMs0ycffO7qftpVixXbr/ogMKxQMWQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949674; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=K6IquK68HlCusO6ZINh0VS2i3GbV4UymBUE9LxnySz0=; b=WofgNiWL692TwQBco/T6jCFXZqdptQYPnFTpHcElLR/hRnYvQBJdYjuzcj89V8kzcIAX UbDC6O/mki2jl6JiMiwz5jej3V8hJJPZLzgqqzfqrcdvDlMe/yBX+AJwe+rp4xP9zUifE X80uYgtxi2P455RR2kbF4uaPf3vj918HXkUuR5ZIFiByxtX13E9DiVTH06uteXDMigzj+ LqWteTmb8U6fenpDL9AgkQqko8RVLZIOCgQCYczN2zaxxJIieKimOnhJqqo6+XzZnP0+1 jhQL7EEvVgiqaVB/JtGOrwOmIHHTcAZuhtNkGarGK+MBv+FzW0Wqgp7zBTI0ysq6lbQ== ARC-Authentication-Results: i=1; smtp2.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=XIO74+lN; arc=none smtp.remote-ip="2a00:1450:4864:30::e" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::e; helo=mail-wr2-x0e.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=XIO74+lN Received: from mail-wr2-x0e.google.com (mail-wr2-x0e.google.com [IPv6:2a00:1450:4864:30::e]) by smtp2.osuosl.org (Postfix) with ESMTPS id 996DF404F8 for ; Fri, 2 Oct 2026 14:01:13 +0000 (UTC) Received: by mail-wr2-x0e.google.com with SMTP id ffacd0b85a97d-48b017a3be3so2560587f8f.2 for ; Fri, 02 Oct 2026 07:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949671; x=1791554471; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=K6IquK68HlCusO6ZINh0VS2i3GbV4UymBUE9LxnySz0=; b=XIO74+lNtGT8KAerYQLrbXhJSHJUJ7xCaoi1yEOO6RWzt9sYq0e6sPFsUDNdeniKDg a5i1UZM/1hXD5bls9VDn7AgvZ+LN8xx6SWJwsssxBx3aXUgfWa+ztnZ3ow+N8NkeD6q2 3QFLC/cJQRM5P7Hspxs+bgEdcMDNJAlhOFDIRcsd8/xnFmxF75U9IDcBRiaz9dG+cCqn 5r9NkmC/yix3HXMrL+lhJoy7Tuv10NImtBK31HPTQJsveHLohkWE0ddWH8gTiqn85s08 8fssf+Jl4FJmTYY9Z5v0R1zdQ0Rp4Bajau3fTiB8UMtpxfqr7gpJ2vgxj770XKdi8CCG SmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949671; x=1791554471; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=K6IquK68HlCusO6ZINh0VS2i3GbV4UymBUE9LxnySz0=; b=gbUe0XIHPXnbdSUU9ub4RIjDbhRBqs2ukg9TBAcivUQ62kVpH618BBOGn/jASUX1DW xopeyt+72K6yumi6h36bvQU//N+JhfyI5Mq8LK06uU7wKfnSvU3GYhQtl1N+50ihosIV jMsKNskIJzz/9ks2T+rO8zGMnEgqrBcaIf4x3Z+eHLEy8Zt+llC1UC1bn22FatngY7O9 Xyw6Fv3d1XIOdfcL2aWCZbpnvxvIkmm7ZiAwak7xDM/z1PaztDDcWa1S5jyfr5g7nWDp 3W+KE5GVZ7dx0jP0XxnNFdjrLQNT1M9ei+g0+iD7e6T1Rq5W9Pj82A6VRNIimbXd348H LppQ== X-Forwarded-Encrypted: i=1; AKwUvByym6nwbv97yZXk/YeJRbGW57cIHPzGhj7OLei0fkbu2JQxW1gSA3Y8k7GBbAx5E7GCLQVy3IA=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYLZNYLb2uKprEzrHzPUNsFaZLtHF+JR8BTFj66qohoCZ00Tik67 xdv9unNNhoTcsftQaNZF60AyyT3a69XckqaW3v8DOpblaOLMMSspzDp6LdS/GcGVuUk= X-Gm-Gg: AYBFou03xCaFiHnsl+OKlvE4Bd0M92gr1zPwPw+lMoETrevuvgjCc1LO3ICV86z2QPH Xfh8IselaZdBU3rwDgzF9rRkiPI9oO4pegH2W/kmNlO4Lm+kSU2KTgLm1hOpsDJLY+ctguVztPi ilKs3MlxCTmN6DsM8Lr/x9OZDM1t/kDiTKQ5W7IEogRFMfEcVhyKQDfB1V571Kak93PbighS5L+ 87aiAYwzJYl4HxTMy54e0JVyAfQvSkxK9IDS2BdQmJXRyTtIMXpYBwy3LBZYd7ZZZP+PI9YL33b mfEJZIBF3P5TgDrrXhovd3Rmp7u+AmGouuRrkmTnd7QqJpttlsdSI2F2EmXuKD/XCFfsaVfQ032 z8k71x1MVVvZPafOLpziV1Q8eZPX3QMrJYu93B5nPNE0URjJxLDcx6+ucjdTMBhsdBSKKSjQ4P1 ctBgVGSHflYhGvfCJQaHqSTJlsB8BEFXC+YaAulDPTMNGmJoAeG0hrLj7fxbowCr9mJgOtomoXT RLSrDippj86Dg5GsLPrS8XwvaCtDtE/VlG9B+/r69U5gHBE8VYMZqsYc5XfRpYCEKSyJYj3azWm jLG+LJPXAM52MjVJtgBeyGpEhJkzpMCJxsPkwizvDcfmVn8buXiJJmd6 X-Received: by 2002:a05:6000:310a:b0:487:1ac0:32af with SMTP id ffacd0b85a97d-48b1275b416mr5204228f8f.51.1790949671312; Fri, 02 Oct 2026 07:01:11 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:10 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:53 +0200 Subject: [PATCH v2 02/13] video: mediatek: add ovl component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-2-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The overlay (ovl) is the entry point of the video pipeline on some MediaTek SoCs, such as the MT8365 and the MT8366: it reads the layers from DRAM and blends them into the stream handed to the rest of the pipeline. U-Boot only ever shows one framebuffer, so the driver configures layer 0 with the XRGB8888 framebuffer of the video uclass, blended over an opaque black background, and leaves the other layers off. The overlay is also a DMA master, so it needs the SMI larb feeding it and its port taken out of the IOMMU translated address space, U-Boot having no IOMMU driver: extend the component larb lookup with that port index. The driver matches "mediatek,mt8192-disp-ovl", the generic fallback the MT8365 ovl0 node carries behind "mediatek,mt8365-disp-ovl", and "mediatek,mt8366-disp-ovl", which the MT8366 node carries on its own as that SoC is not upstream yet. The MT8366 overlay is the only one of the two able to drive the per layer bit depth of DISP_REG_OVL_CLRFMT_EXT, which the per-compatible data selects. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_comp.c | 1 + drivers/video/mediatek/mtk_disp_comp.h | 13 +- drivers/video/mediatek/mtk_disp_ovl.c | 253 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_ovl.h | 45 ++++++ 4 files changed, 307 insertions(+), 5 deletions(-) diff --git a/drivers/video/mediatek/mtk_disp_comp.c b/drivers/video/mediatek/mtk_disp_comp.c index f9eb9e00de6..3846a46f698 100644 --- a/drivers/video/mediatek/mtk_disp_comp.c +++ b/drivers/video/mediatek/mtk_disp_comp.c @@ -89,6 +89,7 @@ int mtk_disp_comp_get_larb(struct udevice *dev) } iommu = args.node; larb_id = MTK_M4U_TO_LARB(args.args[0]); + priv->larb_port = MTK_M4U_TO_PORT(args.args[0]); for (i = 0; ; i++) { node = ofnode_parse_phandle(iommu, "mediatek,larbs", i); diff --git a/drivers/video/mediatek/mtk_disp_comp.h b/drivers/video/mediatek/mtk_disp_comp.h index 8214af38b27..fbc2174352e 100644 --- a/drivers/video/mediatek/mtk_disp_comp.h +++ b/drivers/video/mediatek/mtk_disp_comp.h @@ -18,13 +18,15 @@ struct udevice; * @base: register window of the component * @clk_bulk: clocks of the component * @larb: optional SMI larb device (UCLASS_MEMORY), enabled and disabled - * together with the component. Only the RDMAs, which are the DMA - * masters of this pipeline, have one. + * together with the component. Only the DMA masters of the pipelines, + * the overlays and the MDP RDMAs, have one. + * @larb_port: M4U port index of the component within @larb */ struct mtk_disp_comp_priv { void __iomem *base; struct clk_bulk clk_bulk; struct udevice *larb; + unsigned int larb_port; }; /** @@ -44,9 +46,10 @@ int mtk_disp_comp_probe(struct udevice *dev); * * A DMA master component reaches DRAM through an SMI larb, which must be * ungated for its accesses. The component points at its IOMMU (M4U) port - * through "iommus", and MTK_M4U_TO_LARB() extracts the larb id from that - * port. Resolve the matching larb in the IOMMU's "mediatek,larbs" list by - * its "mediatek,larb-id", so that mtk_disp_comp_enable() and + * through "iommus": MTK_M4U_TO_LARB() extracts the larb id from that port + * and MTK_M4U_TO_PORT() the port index within it, kept in larb_port. + * Resolve the matching larb in the IOMMU's "mediatek,larbs" list by its + * "mediatek,larb-id", so that mtk_disp_comp_enable() and * mtk_disp_comp_disable() then enable and disable it together with the * component. * diff --git a/drivers/video/mediatek/mtk_disp_ovl.c b/drivers/video/mediatek/mtk_disp_ovl.c new file mode 100644 index 00000000000..865372a6263 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_ovl.c @@ -0,0 +1,253 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Overlay support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mtk_disp_comp.h" +#include "mtk_disp_ovl.h" + +#define DISP_REG_OVL_EN 0x00c +#define OVL_EN BIT(0) + +#define DISP_REG_OVL_RST 0x014 + +#define DISP_REG_OVL_ROI_SIZE 0x020 +#define OVL_ROI_SIZE_WIDTH GENMASK(15, 0) +#define OVL_ROI_SIZE_HEIGHT GENMASK(31, 16) + +#define DISP_REG_OVL_DATAPATH_CON 0x024 +#define OVL_LAYER_SMI_ID_EN BIT(0) + +#define DISP_REG_OVL_ROI_BGCLR 0x028 +#define OVL_COLOR_ALPHA GENMASK(31, 24) + +#define DISP_REG_OVL_SRC_CON 0x02c +#define L0_EN BIT(0) + +#define DISP_REG_OVL_CON 0x030 +#define OVL_CON_ALPHA GENMASK(7, 0) +#define OVL_CON_AEN BIT(8) +#define OVL_CON_CLRFMT GENMASK(14, 12) +#define OVL_CON_CLRFMT_ARGB8888 2 + +#define DISP_REG_OVL_SRC_SIZE 0x038 +#define OVL_SRC_SIZE_WIDTH GENMASK(15, 0) +#define OVL_SRC_SIZE_HEIGHT GENMASK(31, 16) + +#define DISP_REG_OVL_OFFSET 0x03c + +#define DISP_REG_OVL_PITCH 0x044 +#define OVL_PITCH_LSB GENMASK(15, 0) +#define OVL_CONST_BLEND BIT(28) + +#define DISP_REG_OVL_RDMA0_CTRL 0x0c0 +#define RDMA0_EN BIT(0) + +#define DISP_REG_OVL_RDMA_GMC 0x0c8 +#define GMC_THRESHOLD_BITS 16 +#define GMC_THRESHOLD_HIGH ((1 << GMC_THRESHOLD_BITS) / 4) +#define GMC_THRESHOLD_LOW ((1 << GMC_THRESHOLD_BITS) / 8) + +#define DISP_REG_OVL_CLRFMT_EXT 0x2d0 +#define OVL_CON_CLRFMT_BIT_DEPTH_MASK(n) (GENMASK(1, 0) << (4 * (n))) +#define OVL_CON_CLRFMT_BIT_DEPTH(depth, n) ((depth) << (4 * (n))) +#define OVL_CON_CLRFMT_8_BIT 0 + +#define DISP_REG_OVL_ADDR 0xf40 + +/** + * struct mtk_disp_ovl_data - per-SoC overlay data + * @smi_id_en: the overlay tags its DRAM requests with an SMI id + * @supports_clrfmt_ext: the overlay has the CLRFMT_EXT bit depth register + * @gmc_bits: width of the GMC thresholds, in bits + */ +struct mtk_disp_ovl_data { + bool smi_id_en; + bool supports_clrfmt_ext; + unsigned int gmc_bits; +}; + +/** + * struct mtk_disp_ovl_priv - private data of an overlay + * @comp: common component state, must be the first member + * @data: per-SoC overlay data + */ +struct mtk_disp_ovl_priv { + struct mtk_disp_comp_priv comp; + const struct mtk_disp_ovl_data *data; +}; + +void mtk_ovl_config(struct udevice *dev, const struct display_timing *timing) +{ + u32 width = timing->hactive.typ; + u32 height = timing->vactive.typ; + + if (width != 0 && height != 0) + mtk_disp_comp_write(dev, DISP_REG_OVL_ROI_SIZE, + FIELD_PREP(OVL_ROI_SIZE_WIDTH, width) | + FIELD_PREP(OVL_ROI_SIZE_HEIGHT, height)); + + /* the background must be opaque black, or alpha blending has no effect */ + mtk_disp_comp_write(dev, DISP_REG_OVL_ROI_BGCLR, OVL_COLOR_ALPHA); + + mtk_disp_comp_write(dev, DISP_REG_OVL_RST, 1); + mtk_disp_comp_write(dev, DISP_REG_OVL_RST, 0); +} + +/* + * Layer 0 is always fed our fixed 8-bit-per-channel XRGB8888 framebuffer, so + * the 10-bit format check Linux does here never applies to us. + */ +static void mtk_ovl_set_bit_depth(struct udevice *dev) +{ + struct mtk_disp_ovl_priv *ovl = dev_get_priv(dev); + + if (!ovl->data->supports_clrfmt_ext) + return; + + mtk_disp_comp_update(dev, DISP_REG_OVL_CLRFMT_EXT, + OVL_CON_CLRFMT_BIT_DEPTH(OVL_CON_CLRFMT_8_BIT, 0), + OVL_CON_CLRFMT_BIT_DEPTH_MASK(0)); +} + +static void mtk_ovl_layer_on(struct udevice *dev) +{ + struct mtk_disp_ovl_priv *ovl = dev_get_priv(dev); + u32 gmc_thrshd_l, gmc_thrshd_h, gmc; + + mtk_disp_comp_write(dev, DISP_REG_OVL_RDMA0_CTRL, RDMA0_EN); + + gmc_thrshd_l = GMC_THRESHOLD_LOW >> (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); + gmc_thrshd_h = GMC_THRESHOLD_HIGH >> (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); + if (ovl->data->gmc_bits == 10) + gmc = gmc_thrshd_h | gmc_thrshd_h << 16; + else + gmc = gmc_thrshd_l | gmc_thrshd_l << 8 | + gmc_thrshd_h << 16 | gmc_thrshd_h << 24; + mtk_disp_comp_write(dev, DISP_REG_OVL_RDMA_GMC, gmc); + + mtk_disp_comp_update(dev, DISP_REG_OVL_SRC_CON, L0_EN, L0_EN); +} + +int mtk_ovl_layer(struct udevice *dev, const struct video_uc_plat *plat, + const struct display_timing *timing) +{ + struct mtk_disp_ovl_priv *ovl = dev_get_priv(dev); + u32 width = timing->hactive.typ; + u32 height = timing->vactive.typ; + u32 pitch = width * VNBYTES(VIDEO_BPP32); + + /* DISP_REG_OVL_ADDR is 32-bit, the framebuffer has to fit below 4GB */ + if (upper_32_bits(plat->base)) { + dev_err(dev, "framebuffer at 0x%lx is above 4GB\n", plat->base); + return -ERANGE; + } + + /* opaque layer with alpha blending on, as Linux sets it up */ + mtk_disp_comp_write(dev, DISP_REG_OVL_CON, + FIELD_PREP(OVL_CON_CLRFMT, OVL_CON_CLRFMT_ARGB8888) | + FIELD_PREP(OVL_CON_ALPHA, 0xff) | OVL_CON_AEN); + + /* + * The framebuffer has no real per-pixel alpha channel, so without + * OVL_CONST_BLEND the hardware reads the (zero) alpha byte from + * memory and blends the whole layer as fully transparent. + */ + mtk_disp_comp_write(dev, DISP_REG_OVL_PITCH, + FIELD_PREP(OVL_PITCH_LSB, pitch) | OVL_CONST_BLEND); + + mtk_disp_comp_write(dev, DISP_REG_OVL_SRC_SIZE, + FIELD_PREP(OVL_SRC_SIZE_WIDTH, width) | + FIELD_PREP(OVL_SRC_SIZE_HEIGHT, height)); + + /* the layer covers the whole region of interest */ + mtk_disp_comp_write(dev, DISP_REG_OVL_OFFSET, 0); + + /* + * Without an IOMMU driver the overlay reads the framebuffer with a + * physical address, so take its larb port out of the translated + * address space now that the larb is ungated. + */ + mtk_smi_larb_port_set_pa(ovl->comp.larb, ovl->comp.larb_port); + + mtk_disp_comp_write(dev, DISP_REG_OVL_ADDR, plat->base); + + mtk_ovl_set_bit_depth(dev); + + mtk_ovl_layer_on(dev); + + return 0; +} + +void mtk_ovl_start(struct udevice *dev) +{ + struct mtk_disp_ovl_priv *ovl = dev_get_priv(dev); + + if (ovl->data->smi_id_en) + mtk_disp_comp_update(dev, DISP_REG_OVL_DATAPATH_CON, + OVL_LAYER_SMI_ID_EN, OVL_LAYER_SMI_ID_EN); + + mtk_disp_comp_write(dev, DISP_REG_OVL_EN, OVL_EN); +} + +static int mtk_disp_ovl_probe(struct udevice *dev) +{ + struct mtk_disp_ovl_priv *ovl = dev_get_priv(dev); + int ret; + + ret = mtk_disp_comp_probe(dev); + if (ret) + return ret; + + ovl->data = (const struct mtk_disp_ovl_data *)dev_get_driver_data(dev); + if (!ovl->data) + return -EINVAL; + + /* the overlay is a DMA master: it feeds from an SMI larb */ + return mtk_disp_comp_get_larb(dev); +} + +static const struct mtk_disp_ovl_data mt8192_ovl_driver_data = { + .smi_id_en = true, + .gmc_bits = 10, +}; + +static const struct mtk_disp_ovl_data mt8366_ovl_driver_data = { + .smi_id_en = true, + .supports_clrfmt_ext = true, + .gmc_bits = 10, +}; + +static const struct udevice_id mtk_disp_ovl_ids[] = { + { + .compatible = "mediatek,mt8192-disp-ovl", + .data = (ulong)&mt8192_ovl_driver_data, + }, + { + .compatible = "mediatek,mt8366-disp-ovl", + .data = (ulong)&mt8366_ovl_driver_data, + }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_ovl) = { + .name = "mtk_disp_ovl", + .id = UCLASS_MISC, + .of_match = mtk_disp_ovl_ids, + .probe = mtk_disp_ovl_probe, + .priv_auto = sizeof(struct mtk_disp_ovl_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_ovl.h b/drivers/video/mediatek/mtk_disp_ovl.h new file mode 100644 index 00000000000..1882309f6d8 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_ovl.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_OVL_H +#define _MTK_DISP_OVL_H + +struct display_timing; +struct udevice; +struct video_uc_plat; + +/** + * mtk_ovl_config() - configure an overlay + * @dev: overlay device + * @timing: display timing, giving the frame size + * + * Set the region of interest over an opaque black background, and reset + * the overlay. + */ +void mtk_ovl_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_ovl_layer() - scan out the framebuffer on layer 0 + * @dev: overlay device + * @plat: video uclass platform data, holding the framebuffer base address + * @timing: display timing, giving the frame size + * + * Point layer 0 at the XRGB8888 framebuffer, take its larb port out of the + * IOMMU, and enable the layer. + * + * Return: 0 on success, -ERANGE if the framebuffer is above 4 GiB + */ +int mtk_ovl_layer(struct udevice *dev, const struct video_uc_plat *plat, + const struct display_timing *timing); + +/** + * mtk_ovl_start() - start an overlay + * @dev: overlay device + */ +void mtk_ovl_start(struct udevice *dev); + +#endif /* _MTK_DISP_OVL_H */ From patchwork Fri Oct 2 04:03:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315153 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=chEw5Lub; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=b4mrv2qx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SB501kz1xvt for ; Sat, 03 Oct 2026 00:01:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4EBFC8132B; Fri, 2 Oct 2026 14:01:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 236K0Jj6jQRW; Fri, 2 Oct 2026 14:01:27 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 6C65B81339 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949686; b=E2T4yQyUAKY7DD9PS7rXqHBq21dD9+I1DUe2g7+MvXUkF7jhB6Z7eeCKuzWPcj3GV+lx loUpd6bxA3cHKPTbaGoMLENR3KY7HFppKK8HhZQzZrKPKWctsofxXgqD3l6gdMp2cL6YO whENeSDml4KeAGBme9pvldtgcc/J4Nk/p+8KkwjwWz1DwN8/3IaEmUB+KKU3HwEoqprdO ohm50j51O37OhmZrSQ1CYvW0dKdcW1nbiDhHov+wI4pRLPfcsPD8Eb4Ek9J3zuLGPw5Rh 6rLerp+YUG+QCZt4YOAj/ODmFUfhAWTrWTBrgzkmF+DD+BCvQNtofJ3Vv4YAmVq4LFQ== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949686; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=AClgjogaFQSA8zjJP/0IX0ywGu36jRnZT0QyqqSbHG8=; b=XO9ml2hk3xb8TDZvaFdjZO2oRNhh1jY8PQ9azC6UpzrM8spR5i91JelkumgWJuVgdepz IkCR2Z/YNtlQTqrS3czVnuagj0hxL8IGBok6O447IKWxvt78mFlzHqFANeBQEeyY00Z5h tJdA8VABoHqCmqOnmpJ/qnU7NsPWlG+Ir30WhKkRO4uc6WYGZxg2eE980W96ucSnJ/lbc v1XfuFf1unWWk+KXiAR1P5cEHDYXDlr7iIGQZhtietf4ZyGAYycUbzwnyZ6Tr2dGqIgAV b0DglgFzH4TMaAWppceG9KbhyucAQ6F4DCvJp1Btj0ru7RzNSf+KBGEHFga6+zlnrSQ== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949686; bh=AClgjogaFQSA8zjJP/0IX0ywGu36jRnZT0QyqqSbHG8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=chEw5Lub3MUUBHuw3XoofoaZU1UZapORcDLcQpGb4ycMkJEv5SBpiiLs4yIDyUR7b xt3zYyaGP1TM4QUPsBEsgV8EY3tINzWvCB9Qpj1WbllV4a1R9fp8qivzBkUqtwb28v Jb1jcCaoWyOIAdp3h6c633wvnL+fLLh+Eqeukdn9IAagFQ0EYMvLprWySElQiLh3AZ ouEb8o9hAH8K225vc+0X+F+5/glsIIe5QmdLsZoy9TMpw+TR27/wqv9vwAiZYrZSdB kKWSUdRuAfcS3ZAVAy6NPdEqHLBXI4JR5NcALkW5mMcZOSlNzSD18ryZgqyXisbVRn WqdiCRwtxajsg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 6C65B81339; Fri, 2 Oct 2026 14:01:26 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 50901435 for ; Fri, 2 Oct 2026 14:01:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 41C4340D87 for ; Fri, 2 Oct 2026 14:01:17 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oWO-gIxi30RU for ; Fri, 2 Oct 2026 14:01:16 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 1D59D40D94 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::11" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949676; b=aRYZwQEMNSGGe3SJuAauLxZ2iuZk8VOiwZlYlGGK6IVwe97Kj3c/g7v3FxOz6/sarGIf VD2jbNZpgaaFxLK0zORLeyv43QD5Pc2RTiXMV3jxG9mgglLxvc5sXL6V/q4kLWfNLR6in 9PsKTv1gWHHlLOAdhmNxqgulMpbcg09Vabp4fG4inGc97+DAjeLI/n0ui9FrJs4BB97IM l3LDueN0FlGWW4pxh9jpL1UdUwCEBrG2mx9uXc4eVPOmUhJN6XjQKs0c5EU9ffApEAavj Yje+Q+jDsTB2POFFqpuJ1P8hqlg/JQnPT0h1c4rR7pXn0ef09TKbH2JCzbb++9G30sw== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949676; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=AClgjogaFQSA8zjJP/0IX0ywGu36jRnZT0QyqqSbHG8=; b=YxgmiFhpDQJC/bzWYsuvJaRU1b40HTJY+1T/+GZBJ4NI8UNP5gANQFTXRRo2JllPhjzk X44D/RxOg0BtfKwaNHATuMyOGiO1v0tuZdS/P+798Cz4hTALZJ3Cssp7ZWLpy/3kK8of6 eEvrQ3KlgnkGn+uaOESc5gUku1GIg9+hBAOY3LIp26uCJbDahFZhAxqoZj5ASom2Gc7Zc 7ziM3d0I+Rd5sTvOO7mf5Fyj4d6lvZNAUB0xcSwjSnx1DIsCKYeJ6RU5NwtEf2NUzafS1 lqGX0cWowSrSIcwQgFMq5B/Bf0Sn7Y2JEYU/LqxQl+nCDoiLWgOIbZzIGILQPpxClOw== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=b4mrv2qx; arc=none smtp.remote-ip="2a00:1450:4864:31::11" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::11; helo=mail-wm2-x11.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=b4mrv2qx Received: from mail-wm2-x11.google.com (mail-wm2-x11.google.com [IPv6:2a00:1450:4864:31::11]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1D59D40D94 for ; Fri, 2 Oct 2026 14:01:15 +0000 (UTC) Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49e6c0fce17so42700845e9.1 for ; Fri, 02 Oct 2026 07:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949674; x=1791554474; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AClgjogaFQSA8zjJP/0IX0ywGu36jRnZT0QyqqSbHG8=; b=b4mrv2qxHdBB7c0X+xc7IhZuXUQsPTlNHYmYzWHM94nYU3ByddHG6hkblE9xHsmd2D 1841FBJbPjtmTw3u6Lr7Byr6zcq2K9WSi1QVIYHikHDqyCjLAiH3yBC+/MW0V6yl1GDn VFhx4AusNdcOeg2wPpl2aOAIHjEys1dXxqquK8Q6j+cHSVt0qxm3N1Pdbx0AZRFQ1nrj 8siC7Sn95hKw4Wo2o+NMdT0FKuV+217t43uBR2/DzgQFPVSAsH3VdAUnmiRNHo+z1N2K iumCh7rBaCm9raAsEZmQ4LQonEu+bJYt7/7qC4SMVLKbwgVT3qKG5c12LwSWtjzuml5E 1iEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949674; x=1791554474; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AClgjogaFQSA8zjJP/0IX0ywGu36jRnZT0QyqqSbHG8=; b=ZmRVdwbeR5MXsObi5Ae/J1dtyASn6hbpZYHrCUzATfw7YXnjkHCMfEtf2A8K//ZhXv j/r5kulnWLW/82XlOAUnUVrlv7znE2cT3II5a1q9HBbcxP+ENXmCccgwqduslOpC+z05 FCtC64iHo8KXfKla2ylDmHYxgofQGLCp7UzALXma1lClt0W4GLRmdq+dkxJXdWYtKPMc 2nsB4QvdP/oxaGnvyUDo+MI/ESaAtHIbAxnZ2wQavvj2AIZ9zxK+B5FCG8nysvhTi3lZ uc2pY1nI2hfQY049qfxJIZT8f3TS3DJPmadPx7I9wpK8d+P+539PxC10cptATfZpcBHB D8aQ== X-Forwarded-Encrypted: i=1; AKwUvBwKO0Cod0zfHAUxi6A6V2GRS8y4sihtgJtCav3pPm/aA4ktP3RjUplCX+4h7VLPzcX9bagbj/M=@lists.u-boot-project.org X-Gm-Message-State: AFuF++nXfj7p1V7rZMkn+jDqsWi3UVYgzXHAwo7ndiFr+/8vaQMpSeKR QW3FRn0cVZW/LdjmKb2Plz84aeariy8m1XX0ZKyMLWPgN2QDn36nbHidGqC84o3H6I4= X-Gm-Gg: AYBFou2IclQcEpmEGix3KojjeZfullQ4qfBbfEyVHnrQjXINsQ3zVyHr//qZePY/Xi/ QCtMLtyjl+TP5tfSJcvVm54CSWRppMRLILcgJU/FnJKakshs5IdH2WtJSuRTD8i+dQgD9gfMtwc FK+xI1grtKX8wf5T320hi2zDSA1HLM3JaBJXWqCntXF5vzBQbz4x6D//z2bmlGRJRnUAY5up1CE 9X9O4qk8lqRirgFOhe1zNkWTpOQXldJ97QtKmP8jGbxKUQpoDTdOFsNYx5bTmaN7qbEtFAtcT+q wyVFRNASjJpEY9+qh5b1vSKWDRbIzlEPmjJ1kN+Y3h/XhEgbQ/ippEulrGWmyR9ohMu8Ku7MT6a RQDruu+IMUL4pEOQ1Im06m839GVbSaSNt/FrJo2WYHhhgsMEbTfz3UNiIM4PSROCy98IqXRqzl+ MxVGA383/NTABfUrXOSGCd9iyJxC7ATJVrESUk4hPP78p8gBqGyBEI4b3jMpZ21YG0dr7iGyW12 b2ZWm7PbzKotr++tOotiJefqBFhpOMzk1ARgOBnUa37HLVqZM6+hrKvvdK+r0N/0v8ayxpS3WiJ IaP1OFTHQd38PH22JNRmubushP5d0+jFzn9hU9ObKlqOCHv+scnuQKY= X-Received: by 2002:a05:600c:871b:b0:49f:dc71:e609 with SMTP id 5b1f17b1804b1-4a0276cba9amr48202605e9.20.1790949672209; Fri, 02 Oct 2026 07:01:12 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:11 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:54 +0200 Subject: [PATCH v2 03/13] video: mediatek: add disp rdma component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-3-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The rdma (read DMA) block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365 and the MT8366. It feeds the pipeline either from a framebuffer in DRAM, or from the stream coming out of the overlay. The DSI pipeline only goes through it in direct mode, the overlay being the DMA master there, so the driver programs the frame size and the FIFO thresholds and starts the block, leaving its memory mode alone. The larb feeding it is still ungated with it, as the block sits behind it either way. The driver matches "mediatek,mt8183-disp-rdma" and "mediatek,mt8195-disp-rdma", the generic fallbacks the MT8365 and the MT8366 rdma nodes respectively carry behind their SoC specific string, so a single entry covers every SoC reusing either generation. The FIFO size of the compatible is only a default: the instances of one SoC may differ, and "mediatek,rdma-fifo-size" overrides it when the device tree describes it. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_comp.h | 4 +- drivers/video/mediatek/mtk_disp_rdma.c | 154 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_rdma.h | 30 +++++++ 3 files changed, 186 insertions(+), 2 deletions(-) diff --git a/drivers/video/mediatek/mtk_disp_comp.h b/drivers/video/mediatek/mtk_disp_comp.h index fbc2174352e..9e525521cc4 100644 --- a/drivers/video/mediatek/mtk_disp_comp.h +++ b/drivers/video/mediatek/mtk_disp_comp.h @@ -18,8 +18,8 @@ struct udevice; * @base: register window of the component * @clk_bulk: clocks of the component * @larb: optional SMI larb device (UCLASS_MEMORY), enabled and disabled - * together with the component. Only the DMA masters of the pipelines, - * the overlays and the MDP RDMAs, have one. + * together with the component. Only the components sitting behind an + * SMI larb, the overlays and the rdmas, have one. * @larb_port: M4U port index of the component within @larb */ struct mtk_disp_comp_priv { diff --git a/drivers/video/mediatek/mtk_disp_rdma.c b/drivers/video/mediatek/mtk_disp_rdma.c new file mode 100644 index 00000000000..e66092c7799 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_rdma.c @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video RDMA support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mtk_disp_comp.h" +#include "mtk_disp_rdma.h" + +#define DISP_REG_RDMA_GLOBAL_CON 0x010 +#define RDMA_ENGINE_EN BIT(0) + +#define DISP_REG_RDMA_SIZE_CON_0 0x014 +#define RDMA_SIZE_CON_0_WIDTH GENMASK(11, 0) + +#define DISP_REG_RDMA_SIZE_CON_1 0x018 +#define RDMA_SIZE_CON_1_HEIGHT GENMASK(19, 0) + +#define DISP_REG_RDMA_FIFO_CON 0x040 +#define RDMA_FIFO_UNDERFLOW_EN BIT(31) +#define RDMA_FIFO_PSEUDO_SIZE GENMASK(27, 16) +#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD GENMASK(11, 0) + +/* the FIFO registers count in 16-byte words */ +#define RDMA_FIFO_WORD(bytes) ((bytes) / 16) + +/** + * struct mtk_disp_rdma_data - per-SoC rdma data + * @fifo_size: default FIFO size, in bytes + */ +struct mtk_disp_rdma_data { + u32 fifo_size; +}; + +/** + * struct mtk_disp_rdma_priv - private data of an rdma + * @comp: common component state, must be the first member + * @fifo_size: FIFO size, in bytes, from "mediatek,rdma-fifo-size" or the + * per-SoC default + */ +struct mtk_disp_rdma_priv { + struct mtk_disp_comp_priv comp; + u32 fifo_size; +}; + +void mtk_rdma_config(struct udevice *dev, const struct display_timing *timing) +{ + struct mtk_disp_rdma_priv *rdma = dev_get_priv(dev); + u32 threshold = rdma->fifo_size * 7 / 10; + + mtk_disp_comp_update(dev, DISP_REG_RDMA_SIZE_CON_0, + FIELD_PREP(RDMA_SIZE_CON_0_WIDTH, timing->hactive.typ), + RDMA_SIZE_CON_0_WIDTH); + mtk_disp_comp_update(dev, DISP_REG_RDMA_SIZE_CON_1, + FIELD_PREP(RDMA_SIZE_CON_1_HEIGHT, timing->vactive.typ), + RDMA_SIZE_CON_1_HEIGHT); + + /* + * Enable FIFO underflow since the DSI and the DPI can't be blocked, + * and set the output threshold to 70% of the FIFO size so that it + * never overflows. + */ + mtk_disp_comp_write(dev, DISP_REG_RDMA_FIFO_CON, + RDMA_FIFO_UNDERFLOW_EN | + FIELD_PREP(RDMA_FIFO_PSEUDO_SIZE, + RDMA_FIFO_WORD(rdma->fifo_size)) | + FIELD_PREP(RDMA_OUTPUT_VALID_FIFO_THRESHOLD, + RDMA_FIFO_WORD(threshold))); +} + +void mtk_rdma_start(struct udevice *dev) +{ + mtk_disp_comp_update(dev, DISP_REG_RDMA_GLOBAL_CON, RDMA_ENGINE_EN, + RDMA_ENGINE_EN); +} + +static int mtk_disp_rdma_probe(struct udevice *dev) +{ + struct mtk_disp_rdma_priv *rdma = dev_get_priv(dev); + const struct mtk_disp_rdma_data *data; + int ret; + + data = (const struct mtk_disp_rdma_data *)dev_get_driver_data(dev); + if (!data) + return -EINVAL; + + ret = mtk_disp_comp_probe(dev); + if (ret) + return ret; + + /* + * The rdma sits behind an SMI larb, which has to be ungated with it + * even on the paths where the overlay is the one doing the DMA. + */ + ret = mtk_disp_comp_get_larb(dev); + if (ret) + return ret; + + /* + * The instances of a same SoC may have different FIFO depths, so the + * per-compatible size is only the default: the MT8365 and the MT8183 + * describe both of their RDMAs in the device tree, the MT8186 none. + */ + ret = dev_read_u32(dev, "mediatek,rdma-fifo-size", &rdma->fifo_size); + if (ret && ret != -EINVAL) { + dev_err(dev, "failed to get the rdma fifo size: %d\n", ret); + return ret; + } + + if (ret) + rdma->fifo_size = data->fifo_size; + + return 0; +} + +static const struct mtk_disp_rdma_data mt8183_rdma_driver_data = { + .fifo_size = 5 * SZ_1K, +}; + +static const struct mtk_disp_rdma_data mt8195_rdma_driver_data = { + .fifo_size = 1920, +}; + +static const struct udevice_id mtk_disp_rdma_ids[] = { + { + .compatible = "mediatek,mt8183-disp-rdma", + .data = (ulong)&mt8183_rdma_driver_data, + }, + { + .compatible = "mediatek,mt8195-disp-rdma", + .data = (ulong)&mt8195_rdma_driver_data, + }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_rdma) = { + .name = "mtk_disp_rdma", + .id = UCLASS_MISC, + .of_match = mtk_disp_rdma_ids, + .probe = mtk_disp_rdma_probe, + .priv_auto = sizeof(struct mtk_disp_rdma_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_rdma.h b/drivers/video/mediatek/mtk_disp_rdma.h new file mode 100644 index 00000000000..c2fe9228661 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_rdma.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_RDMA_H +#define _MTK_DISP_RDMA_H + +struct display_timing; +struct udevice; + +/** + * mtk_rdma_config() - configure an rdma + * @dev: rdma device + * @timing: display timing, giving the frame size + * + * Set the frame size and the FIFO thresholds of the rdma, which passes the + * overlay output through without reading DRAM itself. + */ +void mtk_rdma_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_rdma_start() - start an rdma + * @dev: rdma device + */ +void mtk_rdma_start(struct udevice *dev); + +#endif /* _MTK_DISP_RDMA_H */ From patchwork Fri Oct 2 04:03:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315152 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=abf4zlcj; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=NcNOeK5v; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9S70nWxz1yGJ for ; Sat, 03 Oct 2026 00:01:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4E7568131C; Fri, 2 Oct 2026 14:01:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LgLtidyqASsx; Fri, 2 Oct 2026 14:01:24 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org DDB0081328 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949684; b=bFFwZ0ddXaKOK1TzlmqaVHEpWUnQDUIMVQ3G67cMKvsq5duzTvQ8tFHu/FI5AZH+aEGv bA/jorIl5DXyney6iRmWN9amT9jriUw7LJ0w3Av/ugqZy1i6RkNH6Aq4DOhOcLuNI1J51 2N3IzPGVJ5EggwSmWY0GxMwwJZ2G1EusQ2v2UnU+iJ/vUvCEuUF3QovRhe8YH65+a61Mx YNnJCbHSAzt8wJySwuEykKQFWkYtgXjQn3Yqn4jwfBNOrB6pGzyyROobd80OQDfDQWFlD TlnZm6Ph/ICRmFUI5lBq2FxULHEngpfzJL55DNVUs+Osg5e5PusAzz2pBEXBTIKuW2g== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949684; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=AzGf/0o66eLXQCt+rb6oD2vCWIiHZgtRuI9qVbdCabE=; b=mlD+LAQASY8Fjtde84/07TfP3uD4WxCHY98+KpwXXYOdRCIizh85DbC7E+TaueIVicmy V/RL/MKWikIaKGG/y9OgvE8eUhv2GKp9Ik+zi7+n7XY9nEA8KP2bvVcP8fO/6HLiq8CNp /4FPyAjlBG/wh4C4CpRFZipalPyg/I8rWWdMdnI1cF0W43AbWNY8vKqUV5mUjUlKRZycE mSghOWHOY0LaQ8xq29TyplS8vzdr42TxSNOgA3YAuOfQvoc2fkaGRfTtZ1QkKjAo57Pfk qyHUz3z57yClit/ILuR66iGt6XQCWv0pi5TGa+GgvoUkZLdSkU8cTRjwKrM8VWrDv/A== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949684; bh=AzGf/0o66eLXQCt+rb6oD2vCWIiHZgtRuI9qVbdCabE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=abf4zlcjQyISRUjQOPYvLiE5re5d705ft5wtkYPSbD6D/ElhOc7x844svIouqSgYr 84RBBbjJHS0bAubEwIXIwfnSI1JjzGcYBc17gw3OpEI8hz95Ahxl9WxRnyVuzFUdRa 4icr1ZDLB0NgfppLXj+ktiHwm7e2TKWq1VOrinoWiNFjj/L04pnH3UfDImCaSWBj3/ VCTkueeKZiKNMCzyfUF9udMovONfdwhZ2dY8LHId2tJ1KCBTfV0JLQTREDItN5BoVs 7pHhxlG5fI8Gd5yMt7cIXH0Sr81hJgEcdyQpAqJXYkRZNSBECZ4KBbX2FsDT6Ujkek wi//VTjoiJcMw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id DDB0081328; Fri, 2 Oct 2026 14:01:23 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 412BE2E0 for ; Fri, 2 Oct 2026 14:01:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 26D5740D95 for ; Fri, 2 Oct 2026 14:01:17 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 42FCKpACOQRK for ; Fri, 2 Oct 2026 14:01:16 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 18BB240D87 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::f" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949676; b=dyvtItGF1VK9iWduTZMcHrHr6W1kA6XQqQNSbmJfdFjEngltBgpXIhsZrcrwPZpZNDoo oR4F3MUaGbwlwAe7WpfQaKA1uOroQrSxl4M+YUyHmdcZoQjdAMOFngHKHMKwq0T/lpgEN SB2igVaquRP4GXXGqVqxtBBSaoEFB+aPmvsxlhJAUvTjADKn79eXRHQAVZb83l2qoZ/sF F+2t5DEGFHVjNGdtbd8E9WpZTU1CMm1y3avd5CUi98b9MCgOrHpSViUl/4gPVqXaE2EHG FiqI/JZpxWOAsgdjNox9Y/+qSfLNHwemfgUAjC6BxJWiroVngD0WAIiWgyJhYH3Ia7g== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949676; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=AzGf/0o66eLXQCt+rb6oD2vCWIiHZgtRuI9qVbdCabE=; b=CXgPoD+SWEDNUqTtEyThSb8iWriD37XlxeKD7Y/q2EdOPFgnKiSa6DS7LoawEbzWf9c9 Enoon/8PVCx6hwFaMtljBokImsS54LViBt0v07bTUVCC/G6+X6xToaMFK3F15rNNRApQi rCEaye+KoChAXcaPPz7nz1mxy66LKUy443jtNyzfFfXbjVJJ2gNa4OCkYFG7kuwZoENxJ p2ngFohXYPb8dXLoJh4BAZ3gnKYSwFqc5nSurnr+9q5cjh9T4EKB23HiVx0D2gZWgp+XL B6v/hMEFje/U1HMyMVxYdF7/UG/eH2a59xjSH5tUnGSn7adF/3P9VQfC6VhkbCcDv0w== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=NcNOeK5v; arc=none smtp.remote-ip="2a00:1450:4864:30::f" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::f; helo=mail-wr2-x0f.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=NcNOeK5v Received: from mail-wr2-x0f.google.com (mail-wr2-x0f.google.com [IPv6:2a00:1450:4864:30::f]) by smtp4.osuosl.org (Postfix) with ESMTPS id 18BB240D87 for ; Fri, 2 Oct 2026 14:01:15 +0000 (UTC) Received: by mail-wr2-x0f.google.com with SMTP id ffacd0b85a97d-48b0503e39fso2044430f8f.0 for ; Fri, 02 Oct 2026 07:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949673; x=1791554473; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AzGf/0o66eLXQCt+rb6oD2vCWIiHZgtRuI9qVbdCabE=; b=NcNOeK5vEGRQVPHvQiFYZrtXdlL+6kBIhGIq1rclPOK0Xp7sFkNwQ3RkjB0/H8fOEJ Qo9TKnkczFSdufdSSeQhhaiti+cBeYv8bNc3IEonMuYriUvWAzuoa7iYaU3+VTR5ynAA 0lUL3WNjqlwpib/V7b25MZOc0hdHfEu2aBj3poEQ9NAedZVO9e0ui1NiUo7BqEnpgD6t dqzxM/LXy+QgZx1VBmoL91mpvNaMonyyCAdbz55XMIeXugRth/Qz/ax4sVbnEAC62r49 sc0NF0/LxAm60s2VWbecBChpEl6FTDuMKUTOJTCh9KC0LjJNuPaftml/mclVy3l7gSv2 Xnsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949673; x=1791554473; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AzGf/0o66eLXQCt+rb6oD2vCWIiHZgtRuI9qVbdCabE=; b=nTrgIB1Tms6ezcthY+/h8sYwLatSc1giDpsgwFS8n43RZkBqTM5zQ75mB7rAgXXZRu 0muHiVoBHRn01AYynp819ugVOgHa2tSH6NEF0YSqHqv7h9Ha9p51S2PPFJdUCqtznkVm upzJZpgZav3iR2o+RrLRkAi+RLeoSKDOmevUqgiDmAQ9h580hmSwM982B//CwoSEDG8m YBkJBYSkUuhVhzneNgCr4e68Vj2vA9COAwMZ5q4PKaXsuEsYLiTPrqQX4urqSeUthKeb AmiN0Xex/hCE8wwHziWqW6O+cJmL0RWQmeJKtZiJsskbr8HFy4QMbTG2EqE6YzHff5wq +8yA== X-Forwarded-Encrypted: i=1; AKwUvBxJZmXV+Um1mhJlx2+0Nuw5FG8thQHbshF4txVWAYhNLNa/QFyin8ohWLuHsRQTqQDWRusN/S0=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYIVKj/GEiSbYuzGim3VOqat8ZtmwRgWFpIWSsyza5hLKDv38mCs vgcV/xbLmfmpJwBUR9H0E+/c64WSnDD24LctGJhasMsYxl0Xk0NQ30DD7iXJjqsuoYI= X-Gm-Gg: AYBFou0SuJ9mMBX6GhqDfznspxk439ngBQcUe6yJbGXT/6s8SIjFTjoWm70qfsPPazt JsYAqr8oXRR2DS5dFWUxBdD87feCayIZ7TxZASI6J3NgffFYT32D2k3TMvU2JZOaJEepmS2VO5Z d1+VhGBn5mPDGOCpvdzXJVqhMl2B76rda7txZih+Gamf7CkkmKuwHt/7LNNtiILm5oTCeokMixl iXCzIUcAItCanfqr/1KzpIJrIe/Fchv3hhXD/FKzSPgQIhJKJVpXQN4YxETxOawaOCYUpaXFFtp RsLqI0ooHH3y9J9dMlam+OkSj/Bc9lpsx6ax7GOGdZYb8heuMWl9z1oLZl1M8ihs5mJpVYfHUaq Pnd9hnJAErdMd1alei3aomPZNuyi7SK0DDfo6gzSicD+UCssgg3s8wI1qmuXFmSHI+Kf0+r0YQU EeF2e9UpZ3QEgZ1K6gP46C0OhMtt9YvjpS4oM+p4iaI1IKR+KD76roHDmo3usuDtJhO0h3tnzLH mcyDKg12WoZ2wqMB4v9McWsQOV5S94sumDaXl8ZQ9IpuXTnZdN78+3J5dIzKzqvEQKbT2HFLBZS 7VeeR3bC7E8sVGi47ZHeIQ5pNjYBZ6FgXj1IH0B+k+cBMbFa2j0Zavc= X-Received: by 2002:a05:6000:4553:b0:488:9695:d15e with SMTP id ffacd0b85a97d-48b1274c9femr3545643f8f.37.1790949673227; Fri, 02 Oct 2026 07:01:13 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:12 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:55 +0200 Subject: [PATCH v2 04/13] video: mediatek: add color component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-4-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The color block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365. It provides the picture quality adjustments of the pipeline, such as contrast, hue and saturation. None of them is needed to display a splash screen, so the driver programs the frame size and starts the block with all the adjustments bypassed. The driver matches "mediatek,mt8173-disp-color", the generic fallback the MT8365 color0 node carries behind "mediatek,mt8365-disp-color", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_color.c | 50 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_color.h | 31 ++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_color.c b/drivers/video/mediatek/mtk_disp_color.c new file mode 100644 index 00000000000..759e7c800b4 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_color.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Color support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include + +#include "mtk_disp_color.h" +#include "mtk_disp_comp.h" + +#define DISP_COLOR_CFG_MAIN 0x400 +#define COLOR_BYPASS_ALL BIT(7) +#define COLOR_SEQ_SEL BIT(13) + +#define DISP_COLOR_START 0xc00 + +#define DISP_COLOR_WIDTH 0xc50 +#define DISP_COLOR_HEIGHT 0xc54 + +void mtk_color_config(struct udevice *dev, const struct display_timing *timing) +{ + mtk_disp_comp_write(dev, DISP_COLOR_WIDTH, timing->hactive.typ); + mtk_disp_comp_write(dev, DISP_COLOR_HEIGHT, timing->vactive.typ); +} + +void mtk_color_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_COLOR_CFG_MAIN, + COLOR_BYPASS_ALL | COLOR_SEQ_SEL); + mtk_disp_comp_write(dev, DISP_COLOR_START, 1); +} + +static const struct udevice_id mtk_disp_color_ids[] = { + { .compatible = "mediatek,mt8173-disp-color" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_color) = { + .name = "mtk_disp_color", + .id = UCLASS_MISC, + .of_match = mtk_disp_color_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_color.h b/drivers/video/mediatek/mtk_disp_color.h new file mode 100644 index 00000000000..9858ee95d5b --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_color.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_COLOR_H +#define _MTK_DISP_COLOR_H + +struct display_timing; +struct udevice; + +/** + * mtk_color_config() - configure the color block + * @dev: color device + * @timing: display timing, giving the frame size + * + * Set the frame size of the color block. + */ +void mtk_color_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_color_start() - start the color block + * @dev: color device + * + * Start the color block with every color adjustment bypassed. + */ +void mtk_color_start(struct udevice *dev); + +#endif /* _MTK_DISP_COLOR_H */ From patchwork Fri Oct 2 04:03:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315155 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=zGVfrFvC; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=d37nC7p/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SG4SrJz1xvt for ; Sat, 03 Oct 2026 00:01:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1500B81339; Fri, 2 Oct 2026 14:01:32 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xRLlT3i-Wgea; Fri, 2 Oct 2026 14:01:31 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org D67B781338 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949691; b=RfPx/LNMnIEHU8TrcAD8uP94qBD3qXYil3AGr/B4644p1pyCKF8uWbRzC5Qyxo0LywiX ut7vcDNCPpx3cjggvd6tRK21EYovecH1bon+f8zSrSG39ZXHKDQMR19W+ffXzBpACaYe+ 6gXIV+5JLa2Vkr7TO3megt7PyPyInkrdolP3xhvMplvx1HAleeMzZUyxb2q4kpBZhB3xU Io0Pfd4KdpEEqAirm7hwL2l33RQ1bXbye8w1lZ+RqD0EeEtOMSVs3E7Qhmy5IkhYuoRUE Up5Zgf2q0doh89Tyd3/Zl2sVlgdd8FDDpcLvkHm5XHXi3L/jUgoshZ/BhdhNgmLV6hw== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949691; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=nbRhMXtB7BKukDloXZytwXmgJXnfU5GIm5vjo5ReUUE=; b=m382NVsvY+fC1wOnXp7sPMkfAITUJ0kVb5nQ3Qpo63hFBfLpEcuI80cNGYjUichmsOlJ EhcM2/bZ6KREHny3vjdpBKbqSUSHvP0eISsyPPim5Q+tmcBCHAUP8Jd1o5gaWAIJD5El+ ysRkCPDoclQ9t19OWPi56LYERrCe3L5lnWBKoatx+yLI90Xqov9VSm3NKwb4MUnhUUXyT M4h+HbKoaUXIBcC2pGVyGZuUDOwzu+e23GtEPemsXxN9lTEYmo6smnmjD612+Y78/IY7p SLIuRefx5yx7N1m+pdnPK52sWUHYVHl02C6PYC2C+xbRe2vIqXlRq6XyabN+8RvcNWw== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949691; bh=nbRhMXtB7BKukDloXZytwXmgJXnfU5GIm5vjo5ReUUE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=zGVfrFvCgLy2TW2I7n0U1afqlf4G6/6LuZBU26Q25WRL2FWgeez85OvHcgvwfzhRB 0wEqusoW/bUQmkhfsNXeduL/CoKhrSpw/EoWYenaHwVOB9vSQaO/GBKhB7pe8GqH2D jl1w5C7ejkR0EcjbMwFJ6+e5SiLubSI0YY9duOtYStsvQ8t+OyPZk4x8SKK/yngxqw TtL+fcOaEOQCKAeoAiNXBxXYtX6Zn1+g7aMdYfDo2UHKeh76J2akzzQgRPN39+O3UJ vHB8L6vtIbjTMKxaLURIKdmxjacctRlb4/vxEEZXpXLR+na9D5rbElbJPK+M190bDw Qfp9geg6d+f2A== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id D67B781338; Fri, 2 Oct 2026 14:01:30 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 7C6FF282 for ; Fri, 2 Oct 2026 14:01:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6313040D94 for ; Fri, 2 Oct 2026 14:01:23 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Gx0Yk1FYeEWh for ; Fri, 2 Oct 2026 14:01:22 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 6311840D87 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::11" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949682; b=RRPzhuXZVAf9XUeXXe7wmwVN9eg0HpYMxzpTdjan5J9797XsfZy4JWVHGe5GoTujBLwS gttqYhADzx2XtnPJCf8NQlqO7SvkQpINDfQjCYPfO8P/QQ6/jKHFKTfKh5ZwOGuRy0teF 7rJtnLnilLmJAKdHZVPVAsl0fgap5whSnIxHCQOupEiCaAdZ4qcWqVf8ooLXRNn3/eIlL dBIGtF9q+V7xylkuc+rIMgBWoGvEDGurNBFtwnATG3XzDRjUSUriGK8n7r4vdSQgww7qu ajBkofK/0ajW5M533UORFYniGuwS9Zat1pdyesTDmOr6sQgTQQzEJwCV0zhTvCfAOuA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949682; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=nbRhMXtB7BKukDloXZytwXmgJXnfU5GIm5vjo5ReUUE=; b=XDfwK7Qyu5Hbus7JlX3gVt25/5ZUKmAKR9/mqYnu9BpNHrLSFX2KU6sLadcLP2/rSud+ k77CV/14+yj5WpUHc5Nl3WZY9BXIfL/zam+H7fEjwsCI8ilaDHo2GxGabns7dXXfha320 kLFkxyOywlVHdZ7MyPbqE9smPxjFYVw4ng3KrS/ZH2xuHTN+tgcpuh3YvAbDSUNEeu/1T oQe6firD2BykspMxbyG4bCiZEx+DaQfVXvgChTTDEIiTKzeBYjr1Z18cmEbts52eGbwQD 2GOMf4+0aekPOr53LfY+nhYZVKx5CwAcudhIcW66whDcWTPUQ5F/qhPwRjhUsCWu3uw== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="d37nC7p/"; arc=none smtp.remote-ip="2a00:1450:4864:31::11" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::11; helo=mail-wm2-x11.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=d37nC7p/ Received: from mail-wm2-x11.google.com (mail-wm2-x11.google.com [IPv6:2a00:1450:4864:31::11]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6311840D87 for ; Fri, 2 Oct 2026 14:01:22 +0000 (UTC) Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49ffbd83a92so780225e9.0 for ; Fri, 02 Oct 2026 07:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949680; x=1791554480; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=nbRhMXtB7BKukDloXZytwXmgJXnfU5GIm5vjo5ReUUE=; b=d37nC7p/tx+SkaPoqB08jbBs8Ee5v0ne7+Q5VfiuUj5jGa1ajQK89mru0YOgLxjAG1 TctpNnshSDicEvH6Cg9nH6MLbC6OzyMgAv+41KR7kLa4tXf1vbAT7tfVJPlpb42aJYb5 iFaWJoBilz22UrxKk++M2q9RWDgneqZ95L0Fs1LRTt+3WTuloUz4KSugxXvHXtS6J1Yf 7RknJjUuFNWe7YKpAuoI2UdP8gBPHwbIohSRYRr1qN5L6TlO0R+yV7q/vy4y25+jcLeB pbMDLneD7udzL/gTMGikaWIbvz3i/GZVgqA+yDFdMqbRQ/921Tjfik2Ka0HTa6rGEChZ v7XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949680; x=1791554480; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=nbRhMXtB7BKukDloXZytwXmgJXnfU5GIm5vjo5ReUUE=; b=SMxdBA2gc+xLCl+l4IbfBcFdi1VIfIKAORyPHe6YR5HOTVUylBLPLtdwkXxgYVxHat 3hmnhiCFkjC+tX/hHh/Q5k5hVDn55d5Ge+MZLrsipzr7sXtCT4m7v07bOQKK7/bt/J/h IUCOXJMMfz1MvTc/MbDmHTzMCn8q9iF+JQvMlGoceywgaidLfhLRN3NW/GPQiN1Zwb5s 28nqgX7GyAzgPMOiQPUXSRIJnv2r3Jb136Q3+pkuqaAFkKKNe6+EsJe2GofdSVGN+am2 EAapQ11uxfc+51+duqssDiZYTucQnpV63+ToYP6LRp87dq0jBQgdTwVTq4OQAz4e/qdX Jthw== X-Forwarded-Encrypted: i=1; AKwUvByNOyOnxoCp+bzRphq8mvkiOXzHribo1HP1aRLtq9Au/Y25ZjiTiim2jZrysgWNWHIFgm+XmYU=@lists.u-boot-project.org X-Gm-Message-State: AFuF++mQitBfZdOs4oR148h3yOdsVNGnr16W5UVTsrZb6QXJ7CxmQE5h 4QhCaP7COgeKAv+7lWpTCDt8pEbsoRmlr0acpygjM6kz18iQ3rEfP2khmA8pewQOwyQ= X-Gm-Gg: AYBFou0ghoROWjXBxrIFGX4CPAUkIKa8Q+n5cO6pdMq7pzyqCc2knK3ipNhDFX7lzOL BJUa52aqYFy7wKE05hDcTLKrG4Ai7FqD0bZG15XetZ79/tniBTOSuvkeg2m3byjKqTrfMf/DUXz K/7RkeYkK4QJ4N8dSUnIwHHAZxmI449aIi/IftLtrjkyG4EX69JD6XSaah1EM3V3iIRXXC8dGAy aT2FrDREBTGqZa0h8PFvrwgSbydwc9K5GJu6B6vniE6Vvmt8jczTw16mktcMZZama+w/eFkTrYg M86eTctiG4PrJ1u1N8gl25Kp00IdYtM58YrbT6FuSb4TBY9Nu7tauTq1nYp1/PYCy3BSFepmNss kRkcNMZ4p6Mj934/Z82XuTc+Z8pVAHtawMGff6Vkl0YEjwoJGWjUdgjyVRuU3ZOL6qwltxq0Gvz o7evASxk62VMKvMp0HYDAOxJlHKSpAP8utghYhqKN5QU+P81PDBvx0emQK+RcDdr4/TWAoc1mY6 F9Gi7li9fHhlWnYz4YwW40e3GagZcpuqqvQorbcTkhEQ3hy47Q1WMSngBscnBNgMMYxUggYE+2L 7Tf7saAoMKv3KunXUWvukONBbaRprvNBTFwUtB7Ud6R3uWSBMFGDHEI= X-Received: by 2002:a05:600c:993:b0:4a0:1fb9:2f51 with SMTP id 5b1f17b1804b1-4a027579559mr38461895e9.14.1790949674592; Fri, 02 Oct 2026 07:01:14 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:13 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:56 +0200 Subject: [PATCH v2 05/13] video: mediatek: add ccorr component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-5-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The color correction (CCORR) block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365. It applies a 3x3 color transform matrix to the pixel stream. U-Boot has no color management, so the driver only programs the frame size and enables the engine, which then applies the matrix left in the coefficient registers at reset. The driver matches "mediatek,mt8183-disp-ccorr", the generic fallback the MT8365 ccorr0 node carries behind "mediatek,mt8365-disp-ccorr", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_ccorr.c | 55 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_ccorr.h | 31 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_ccorr.c b/drivers/video/mediatek/mtk_disp_ccorr.c new file mode 100644 index 00000000000..b54cc7dbe82 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_ccorr.c @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Color Correction Engine support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include + +#include "mtk_disp_ccorr.h" +#include "mtk_disp_comp.h" + +#define DISP_CCORR_EN 0x00 +#define CCORR_EN BIT(0) + +#define DISP_CCORR_CFG 0x20 +#define CCORR_ENGINE_EN BIT(1) + +#define DISP_CCORR_SIZE 0x30 +#define DISP_CCORR_SIZE_HSIZE GENMASK(28, 16) +#define DISP_CCORR_SIZE_VSIZE GENMASK(12, 0) + +void mtk_ccorr_config(struct udevice *dev, const struct display_timing *timing) +{ + u32 sz; + + sz = FIELD_PREP(DISP_CCORR_SIZE_HSIZE, timing->hactive.typ) | + FIELD_PREP(DISP_CCORR_SIZE_VSIZE, timing->vactive.typ); + + mtk_disp_comp_write(dev, DISP_CCORR_SIZE, sz); + mtk_disp_comp_write(dev, DISP_CCORR_CFG, CCORR_ENGINE_EN); +} + +void mtk_ccorr_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_CCORR_EN, CCORR_EN); +} + +static const struct udevice_id mtk_disp_ccorr_ids[] = { + { .compatible = "mediatek,mt8183-disp-ccorr" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_ccorr) = { + .name = "mtk_disp_ccorr", + .id = UCLASS_MISC, + .of_match = mtk_disp_ccorr_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_ccorr.h b/drivers/video/mediatek/mtk_disp_ccorr.h new file mode 100644 index 00000000000..2d5bd3aa060 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_ccorr.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_CCORR_H +#define _MTK_DISP_CCORR_H + +struct display_timing; +struct udevice; + +/** + * mtk_ccorr_config() - configure the ccorr block + * @dev: ccorr device + * @timing: display timing, giving the frame size + * + * Set the frame size of the color correction block. + */ +void mtk_ccorr_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_ccorr_start() - start the ccorr block + * @dev: ccorr device + * + * Start the color correction block. + */ +void mtk_ccorr_start(struct udevice *dev); + +#endif /* _MTK_DISP_CCORR_H */ From patchwork Fri Oct 2 04:03:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315154 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=B1n1p0LQ; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=LKCq/HsY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SD0Sdnz1yGJ for ; Sat, 03 Oct 2026 00:01:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9BF2060D76; Fri, 2 Oct 2026 14:01:30 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9_3aTJnyMXDm; Fri, 2 Oct 2026 14:01:29 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 1448F60D68 Authentication-Results: smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949689; b=BpnnNaANl+rkkRkDklsdO0M4LLaZyqbQzDaOCkrUZG9VgHzi7mHiidm9OPY/C43U1mWr k70MFfQiqyPeBf7LNn+0nt8ANEQa9fXYTsJ/GUgKt82CFjCHq2ws3Wq4HpyAQHnnKUJkm VW6U+dUC36qW8K+tS65dCglFnM0BiweiJ8oz9KV9OO4yH+0s3+IQaIjKKKHdo57QaIUtb ekFnOA4GJEIkgDaOyexFdAIJqlk6TpC0c/ZP3AXjtot1Y+lLykPyQe7EaGkvf9PIXm7Js XkfrfB7zJtauomx2qF5cJZrQ/OEgdxE6fOzFYocbXbH4ryIaTLZnwFlxY4iXRfc55bg== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949689; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=DzsH9qM3JYbT0p0VluIHhFIn99sg+3EM8b1a12jWPxo=; b=Z+IEh8cBYjT63F2OgQtt223U5UpW1+f9+70uuXX3HWkut1JZKz8S/ryzD8dnmdfVv1eH BbzeXrlpfJZKo84FDApEgI+tQeObRo7jfXSRWD4csSp3bJkJKuicDVXvvIm/BRijqE1cu /oD9Gju54fRe8XQvS1Jg8T8b6dcva57OEVp1qHcN2t7RXZeyTqZzoPzxoQC+ugCpt12Gl 6kNN/dkw64J2I6C6nr6XEVlwlYWxh9asZCPMiuuAvjrQYAw8Ms1Cud9VLOl2cfH1m/iNy 5msDr4Gw1oDTMKa+VMyEETEC1RRg7Hwvjz2/RZWmthR8lJi7KUHZp5FtH9wNJLeqWkQ== ARC-Authentication-Results: i=2; smtp3.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="LKCq/HsY"; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949689; bh=DzsH9qM3JYbT0p0VluIHhFIn99sg+3EM8b1a12jWPxo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=B1n1p0LQbnF1QABToU1D6F4xzK4+g0P266X3pr+hiBAlpkUT9bo3etzNJxw5t0U09 e6P/L3vZAVqKac9Ogbqt25ShUMRZjhPgabHxSAEMTp3f4kQv2VqpQXBzb5+SPiJEm4 pD5XrT4xWOUbEfu7khNLuopgByyIOw0KCrXrTvJxySsBYnBuGLluD6EHxT2vLUscjS XCu+70vQGQO/s6u5uu1Bk1T0LFloj6TB0ZWOAwFEgrmv03sicmAn6nN0fqDvbSSSE0 m1FYbxucyrfn5kLeMnFKgyxGjN5TFfntjzi2dutDQn3Nm0yFY5V11xU/AGeKYQkSNF bQKrZoN8L3TTA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 1448F60D68; Fri, 2 Oct 2026 14:01:29 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 414D92E0 for ; Fri, 2 Oct 2026 14:01:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 31D4460D6D for ; Fri, 2 Oct 2026 14:01:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hI6-O569dGqK for ; Fri, 2 Oct 2026 14:01:21 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 2EF7A606AF Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::10" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949681; b=dM3+Wj4v1HKh7yUln3qfIRGw29jW1h6EHqaUAjWji34uJbGMojx8+3Df48VO6tOyNAF1 x75FZy4LqLyClburjbDW+OWu4ZQmOl1Xk2TPK0dIrfvDxyFXkplITXX4HJFtB8YpQAV0V ACSxMhoLeaHjnK9IGJV+8TivXEFjU9t+FB23rboMXjV/aT3/3OXpy4w7QyqvvfR5MR4IA TqTzeiOYS2VkKxyr/r+dzefz6YDVuJ3qeEwT25X48nfrBt/tkWyKGhSBTfhIe2HxTL6TU ylO9yDyzDMhxZ6+ns1+4gAhmS6mvpghvS8wTrzbrZb+9abE77fHCMSLfnb0ZUayK5xA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949681; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=DzsH9qM3JYbT0p0VluIHhFIn99sg+3EM8b1a12jWPxo=; b=Z8vJmBoKyGJspLYITqruXTRvYw13FccYjGFnKpICMI3jntcmM7/j3eh2BWXjTJ6fi2BR q01vFI8BsB422sBfuo2eDeDf4IPIiAxkSbb4kB7n7YkwRsgsTAm+IDw60CMGHE1yqSCes VcI4HqxW64jSkYGn9E16v0zeE4+Gyi35FPmCzA+WSgkT0mLntyIqjxTUB/jp9kQ9NzYv+ kAOUM1aMIspiSlPla4Y5dnUiK3vwpj1akh0OqswGdJzosakES5uR8Afa/3NSdLq+nJGFV 27BNmeB7ZznU/tYffzZEaB5d42Yo1VMlxyrCxQIiIvjflW2yLn8c3fWCceN0b6zSaWA== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="LKCq/HsY"; arc=none smtp.remote-ip="2a00:1450:4864:31::10" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::10; helo=mail-wm2-x10.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=LKCq/HsY Received: from mail-wm2-x10.google.com (mail-wm2-x10.google.com [IPv6:2a00:1450:4864:31::10]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2EF7A606AF for ; Fri, 2 Oct 2026 14:01:20 +0000 (UTC) Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-4a003bd18e5so568595e9.0 for ; Fri, 02 Oct 2026 07:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949678; x=1791554478; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DzsH9qM3JYbT0p0VluIHhFIn99sg+3EM8b1a12jWPxo=; b=LKCq/HsYC7rhaBf5AQko4SwCDt1XbLP28Uf+mXhql/N9NTce/Xq4FpF4+orCl0MmAB 2sMfkzLwxxaALurcPqXZGSIAa6WGBrqio6voW+F9zRSlXQMGomVEls7w7nW41pYWWmqh qNXRtnYWdk+2ceyLohEPMwtfvZ13oonrl1kaLgAareGl5oecCDEg9E2n/hDR9lukbjLE 5f1fSYtAAacHlSULSYx4vwjdlll2B48wY31y6hVmf+fYqquT+lakAj4/8v4sU6LCwj8O D3yI8YWreA/i92qSXLfne+i//Jl9djtX5k4C72LgaOIMVkkgXHbHuJNCVyQm4aJEFBWs uUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949678; x=1791554478; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=DzsH9qM3JYbT0p0VluIHhFIn99sg+3EM8b1a12jWPxo=; b=GBLBlQJsE8Us2Tqy5B+F7oF5fAsbbw5VtDAinwUm9u4CsHlTf8/qy2zkG556nZ6XXt SEzGvNRilEXLtAXqvwUbS5WUHQi1GJpJIanvSXI9wVd6/cuNVXVUud/zrKWywRwsw2mU SUGPk1AMlo9Qfc9N3NYOdGWcFMFkGQ55c6zzsg7PvlK9JYFRCoAXF6ppxcFOv4KxPIUA yqU7Ngj4aGsVoCzRMpoKFJ7sBi2CUMkMSHb/oyGPu0IXxINOzvUfUX7rhG5q4/7iFSZZ ZYEnGOrvR0mWnzaus+B1OnEeASxZHhA27f8tISp5z6Zpzkiii8GpefQko7jDKh58hs7O z0bw== X-Forwarded-Encrypted: i=1; AKwUvBxv4eQsxzoiN9hkagZzPztCDQKhM9lD7xujZOcqn/XVGv93EvrHpKXvcET3GhAw3afCeVxv2HI=@lists.u-boot-project.org X-Gm-Message-State: AFuF++nTd9SUKYShLmofztGB0gi/1pRKEqsCnyUlcIwFRlPOumOKRQPM limKYbDuORHNJ6jBFizCNJBaV4yyF/3YetGxhhXobuz8MJeW6PoM18/zpX26Kpka7h4= X-Gm-Gg: AYBFou0q3J+yPr6h60SXq2nOYLksiLo4V3bHcs8xC8CZOW4etncu0U+XJEvrqvfFhtS oDlGot5kl2SMbb0JF1NJrkkI1tREanhsjsJQD23SvLoPQtIXY/cpi75qs7aVn/A2OMcuwbGqoxP Z+6FhYDNmojM2BUEmnFfg4lNIX0/exH9vMaIYdK/GPPkuMWVSuJUT5jqS7wspVq9MzV3mrwjV+5 /pZTGR3lgfF/16Pafw7p7aArLATHT48t9Ske/UdF+PI75rPo0S9c66QzF9Dnm0jIJXvckvKi4ey eRs9AWjui2bNcKB/iY2Qr+gzfdePJfBgdl10VoDS9bNBYmL2MzFfbIfKYMcHyO1xzRiazZ+azG9 F1d8a4W18FZG8mYICzlEQ/9cZr5y45BN3Q3oH9JCDHv/B38HYR+FHB3zxBD38IpMs/aXePFYMVo W1vyKSWW7urKnmNo++41yKreRF6UYyzJQlNdxHpmL9wPULKZYrgulT7hC5l1NXywXwa8KGvDOeD vuAOjqgje5T5QSP1lPUNa8k6C+r7Wccptcn+0lVLEPdJBiVe/vAhDT+HacKkLOCcoka1CG2lsSY oSBPGriMfLGnNWtZLaZos5KqcjNTBMrIAqzS+0x+j3veOIYV0txhjSQ= X-Received: by 2002:a05:600c:6094:b0:4a0:2488:71cc with SMTP id 5b1f17b1804b1-4a0276b2222mr45227645e9.32.1790949677022; Fri, 02 Oct 2026 07:01:17 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:16 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:57 +0200 Subject: [PATCH v2 06/13] video: mediatek: add aal component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-6-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The Adaptive Ambient Light (aal) block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365. It adapts the picture to the ambient light through a per frame histogram and a correction curve. U-Boot only needs the frame to go through untouched, so the driver just programs the frame size and enables the block, leaving the histogram and the correction curve at their reset values. The driver matches "mediatek,mt8183-disp-aal", the generic fallback the MT8365 aal0 node carries behind "mediatek,mt8365-disp-aal", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_aal.c | 54 +++++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_aal.h | 31 ++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_aal.c b/drivers/video/mediatek/mtk_disp_aal.c new file mode 100644 index 00000000000..bbd8e6da6bc --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_aal.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Adaptive Ambient Light support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include + +#include "mtk_disp_aal.h" +#include "mtk_disp_comp.h" + +#define DISP_AAL_EN 0x00 +#define AAL_EN BIT(0) + +#define DISP_AAL_SIZE 0x30 +#define DISP_AAL_SIZE_HSIZE GENMASK(28, 16) +#define DISP_AAL_SIZE_VSIZE GENMASK(12, 0) + +#define DISP_AAL_OUTPUT_SIZE 0x4d8 + +void mtk_aal_config(struct udevice *dev, const struct display_timing *timing) +{ + u32 sz; + + sz = FIELD_PREP(DISP_AAL_SIZE_HSIZE, timing->hactive.typ) | + FIELD_PREP(DISP_AAL_SIZE_VSIZE, timing->vactive.typ); + + mtk_disp_comp_write(dev, DISP_AAL_SIZE, sz); + mtk_disp_comp_write(dev, DISP_AAL_OUTPUT_SIZE, sz); +} + +void mtk_aal_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_AAL_EN, AAL_EN); +} + +static const struct udevice_id mtk_disp_aal_ids[] = { + { .compatible = "mediatek,mt8183-disp-aal" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_aal) = { + .name = "mtk_disp_aal", + .id = UCLASS_MISC, + .of_match = mtk_disp_aal_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_aal.h b/drivers/video/mediatek/mtk_disp_aal.h new file mode 100644 index 00000000000..d745556412e --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_aal.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_AAL_H +#define _MTK_DISP_AAL_H + +struct display_timing; +struct udevice; + +/** + * mtk_aal_config() - configure the aal block + * @dev: aal device + * @timing: display timing, giving the frame size + * + * Set the input and output frame sizes of the adaptive ambient light block. + */ +void mtk_aal_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_aal_start() - start the aal block + * @dev: aal device + * + * Start the adaptive ambient light block. + */ +void mtk_aal_start(struct udevice *dev); + +#endif /* _MTK_DISP_AAL_H */ From patchwork Fri Oct 2 04:03:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315156 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=BTCUB49h; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=P16bcGwP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SK6xdsz1xvt for ; Sat, 03 Oct 2026 00:01:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 83E5781364; Fri, 2 Oct 2026 14:01:36 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id iSoaEQ0UPxvy; Fri, 2 Oct 2026 14:01:35 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 38EC981338 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949695; b=E6NCTdqMtkArBCwMT+gS6xULEFHFiQ0JFvyHcpmMKiqJyQsU5JeNYj5Zm9YeBKs5x0SQ h00nUGcChhQQOQ8ESSXk8GtWBP2pTd/38+xdQLacOpk3p9ajjS88MqmPqwq7PJ9EPrhXJ atOg/kU/8qchfzQLaCPPfP2y0wKD+6J4OaoZYp7+rbMuuns8SE9jE7V14YBFuS7DX/zPA TJuq+hKZb5A3PwKaEYCgS3927f0ow9/NbxXRIXE/0QWcgAm2Ahvj4B/5r8STlHZcMQG2t T1SY+0jTwKJG4tQAC8njxQRAKVjqZl7Vs52cj2aFheKYMI/i2C7utOqkJNGd0KPkZnA== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949695; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=8pP5+9D+oWJnYevj71PlImQNQQv7MMT4AE4lo6hu2I8=; b=mMa2MRQbsQ+lTWDYqBjtdDKInt4qhtfVaRti/HY35a0RkFKauZ5kR2ftqQpo2fxBsGJu 9+KPB5zK/yixJQdwiFdV8NU96gOWWj6MMNhvdZmTev72/n71UaeHOgqoeIi7wl0mFHvMy kKWfjRoj5W5f8XG6vhzz0JsZUxQYmDfU+yZ6L0mdsJbsxTvG5Ioh9MUPgvIWIU8YKFt1k yQCvDA4bY5N8cKNbuBfK5bdmspcdT8IvUCQqRg+Sx6ZEJAHUuIBM/w1DdWiZaYtr47hiv EkVNTAmuC9lZ2ZylDi77LmRxjxOSpIOmT3PM4pc4RIhg96yy1WqTguIDkYYeBwJdcUQ== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949695; bh=8pP5+9D+oWJnYevj71PlImQNQQv7MMT4AE4lo6hu2I8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BTCUB49hm21bMjLQjMbdlRGntsMvTLqGGGyrTNWe6N5qCHA/fEDkgkI/0/hsRGwIf VehSltR5zA8UApD4IW7MlHlmPG8FHAjW8Mheg/Fs/5PkoZbTsEWVsTqMXvKRdwbBwz /k+2ft9ENZRaEp2ioGRG8u1HRcYio8eIdViwsKcmasdmIK7vOyQbfioABjvIWNJgud nyRXpVpRvorOHajbX/zVLII/XlloDp7D5p5NktF5FBU5xNTqIbzqxbLaBp4Lpjxq9Q QtOmC9nGDNWwPZ69YZhJTuP1MN149emcP7FxvLB4TwIpKL/7uAzOEoTTvSiAvzJcvf Lj8nSihkJmy+A== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 38EC981338; Fri, 2 Oct 2026 14:01:35 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists1.osuosl.org (Postfix) with ESMTP id 87FFE2E0 for ; Fri, 2 Oct 2026 14:01:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 79B8E4055D for ; Fri, 2 Oct 2026 14:01:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tvTruUkvT5YI for ; Fri, 2 Oct 2026 14:01:32 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp2.osuosl.org 6A512404F8 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::11" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949692; b=oGELMzzqpVOjnLEotXrWePk13f4JAbCzsuJZBko10n29KiHv7LjWp0LaIGcXTaLMqlzG 4St5Nn9bgSnFDt2bZo/LnUjAdtPsxjaSkMue2zs8/9GuOSU9KQgSUiKe57y1NZ5zP/d+P ZLKqnkyAl7sXGmA+rTmYeoKYXUDHM7l20TZolXL47XiF0jSyp1WnKRxTkLUKCctpbjjU4 sEIynkYdgGpRLbVLnnRA3RGiUuY6MLGDiElELVL1sIEBECIrVyUvk0PKvUiaBw6UDmTdY ERf7IwtRgdD8uuB7kOM2qOGDuBZADGu4xUQ9Xsdlmp/KSM6sAiNLZx9d1rJzeQMTqHw== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949692; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=8pP5+9D+oWJnYevj71PlImQNQQv7MMT4AE4lo6hu2I8=; b=DviYDUPWfbzLCOgjybAOS5Ex59klMR6OpAgvaju+rFkpSP8YgFoaY9zq2RCGeRb8cwRS xE2O2epOlUxJalUXIQ+6pQqfU9YgSI/ZKr4zzI8v2SHpNbTIsyjKNfBVmC/MhcXX2g4bv xpTEoBuLNuztWvD1JS/unaVQc3BD+TH0+esCDeTSyyoGDWobaJIJ3hw6fPehvgQvX8Z3n aDBh6v3qcUtUvLcFb+DRJeg6iuDTX/23gPaONnrA/7AVfl5nMgDqrXYL/xKYwGDrMFXuy eHMzawn+9n6TzLVVHGc8ja682PURyDnTcFX8Cu3wH8dj7uHG9vI1CLPYnbd3Sj3+N3Q== ARC-Authentication-Results: i=1; smtp2.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=P16bcGwP; arc=none smtp.remote-ip="2a00:1450:4864:31::11" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::11; helo=mail-wm2-x11.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=P16bcGwP Received: from mail-wm2-x11.google.com (mail-wm2-x11.google.com [IPv6:2a00:1450:4864:31::11]) by smtp2.osuosl.org (Postfix) with ESMTPS id 6A512404F8 for ; Fri, 2 Oct 2026 14:01:32 +0000 (UTC) Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-4a11603310fso899225e9.1 for ; Fri, 02 Oct 2026 07:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949690; x=1791554490; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8pP5+9D+oWJnYevj71PlImQNQQv7MMT4AE4lo6hu2I8=; b=P16bcGwPUvNLUPuHb/SspBiBqXSvQfvMiffRSSMmEFZZn6R2NDz/KGL/RVS7dUsap+ 84i8IMUifj45PEMm74VQ9MgF1uj7GJiihAnr2mpSut69Uq8SQ0SZTSARNhSXwqBlDiTf u3GiT6Jq9u/hmBguqqr9TYslb2/eos/QuL1rSfyyAQ0H1wEHrFhmlz1p9SEIpz2ljoVg 2jzy52Vd7tOY9cxZqQWoGa37+cwaoL4RodGYYsZIkolZnIgKYXoF8ZX0NA1bbN1TMTCw mUoJ6D8ZStbPd6mlLPrHTOwA5GhqyVrSoQxrSbfJ+TomUyY/NhU4DAganeLRuFxguff/ 8VGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949690; x=1791554490; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=8pP5+9D+oWJnYevj71PlImQNQQv7MMT4AE4lo6hu2I8=; b=bDiMjf5mlv62SM3TTbYllG3IpqKRYPGQD1bP9LpAHRWla+WWkYxBQLVFor+ZBMVcCT uzxhOjFo1XuvQWWN5wzC44VoXmV0kNgTDjhwYpDXFqxOnKqj4iFC5B/8HomDyjvGpLfG YHN8b+4L7BVu2HBQL1/CN+RHv23NdvIp+epfwEdxwi+yVfCU8Mmh8P3MoamsAkrySWW+ OONFl9tRFjAcehdss9fjHIyOEIK2Ppr1+wsIP1e2K5437fcDnHyleWrI5F6vOHzhoXTp SNe+bAR5pJ/IF9wlBA6Kt5OjN95Hzba7Z4bh46yPTGPZG4ztjnCmgbelKLJl78XK8PG1 sNPw== X-Forwarded-Encrypted: i=1; AKwUvByZ6mlGV8bL56PhJNs9T0MbzvDeHPnBLoZ28ELaqKyO49QKjXD+nXzcN8W3bU92FKxRJ144JvI=@lists.u-boot-project.org X-Gm-Message-State: AFuF++lv3gz15If/p/y6WcuaTnt94KQ1JANgjJmEPJi86komcUvumj4N mJGm37uDiFq3aYjLa7ysCiobBEVL8pEWVHPoQ6H2B49yYJ1Wvv9tsaHa35TSPXjVP3I= X-Gm-Gg: AYBFou2DfRT0qhabCfV07NGDo5E+pv5KIAMN2IQ9gBFgcqsIfnmkowzIvnJID46WJGe PmRfek2/dJL4ZBCwes/IIn05X8asM6j61IfQjFOe14WwZ6QHso7WmoBu95i9QXWEM9zjIe2d2Zt 6i5uMua87y/5joIgIGO2EuXNWxl51xP9AWX9YMwq+AX+LzKLgJex6UCEU/rbtZi6x2/PjpGg8Ft 3XqPYV1tAQ0d0JKSOdu9CEDyQ6xO1wFoo53HZ9bnBUnMVSIS8anPNSFnfAHpFAyi5xy9ozKpx7R 63m9rRQ5X9Sw7Y0ns+aGnYkBc25RXQvTJm9BdObYh8dpqamLS/vxuyDgjnesLA3bjkZtrjxMxrD WxQZVj1nsVl77GHkY6EHoxJqEuyG8XXbvGDAeZa90EMVdkwYNhi7dCCaWjAwNKE/Aa4ZwmuMrPY PgMcLyygM9p1InILSIG+WWymzlEcMiZ9oIXJDvrQBLtlJO7tJpjnhnJKRl0nJAK0zGyPtOQ9K7R nYO2og4wWNEkvO3jOl57kwhWPkJh7xEu5aeE0XY9v/vNqCdJjT5/xY0JEzgUido22M3adYKeg1O Lns2qaGwIjW045M9M3e44ltFKha5XzGmkHXA35kDDBhgxKouv+SIa7w= X-Received: by 2002:a05:600c:310b:b0:49f:bd3c:bc25 with SMTP id 5b1f17b1804b1-4a0276a224amr52032365e9.32.1790949690098; Fri, 02 Oct 2026 07:01:30 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:17 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:58 +0200 Subject: [PATCH v2 07/13] video: mediatek: add gamma component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-7-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The gamma block is one of the components of the video pipeline on some MediaTek SoCs, such as the MT8365. It applies a gamma correction lookup table to the pixel stream. U-Boot has no use for a gamma curve, so the driver only programs the frame size and enables the block, leaving the lookup table disabled. The driver matches "mediatek,mt8183-disp-gamma", the generic fallback the MT8365 gamma0 node carries behind "mediatek,mt8365-disp-gamma", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_gamma.c | 51 +++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_gamma.h | 31 ++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_gamma.c b/drivers/video/mediatek/mtk_disp_gamma.c new file mode 100644 index 00000000000..335e7216277 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_gamma.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video GAMMA support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include + +#include "mtk_disp_comp.h" +#include "mtk_disp_gamma.h" + +#define DISP_GAMMA_EN 0x00 +#define GAMMA_EN BIT(0) + +#define DISP_GAMMA_SIZE 0x30 +#define DISP_GAMMA_SIZE_HSIZE GENMASK(28, 16) +#define DISP_GAMMA_SIZE_VSIZE GENMASK(12, 0) + +void mtk_gamma_config(struct udevice *dev, const struct display_timing *timing) +{ + u32 sz; + + sz = FIELD_PREP(DISP_GAMMA_SIZE_HSIZE, timing->hactive.typ) | + FIELD_PREP(DISP_GAMMA_SIZE_VSIZE, timing->vactive.typ); + + mtk_disp_comp_write(dev, DISP_GAMMA_SIZE, sz); +} + +void mtk_gamma_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_GAMMA_EN, GAMMA_EN); +} + +static const struct udevice_id mtk_disp_gamma_ids[] = { + { .compatible = "mediatek,mt8183-disp-gamma" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_gamma) = { + .name = "mtk_disp_gamma", + .id = UCLASS_MISC, + .of_match = mtk_disp_gamma_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_gamma.h b/drivers/video/mediatek/mtk_disp_gamma.h new file mode 100644 index 00000000000..8dc171b8b16 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_gamma.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_GAMMA_H +#define _MTK_DISP_GAMMA_H + +struct display_timing; +struct udevice; + +/** + * mtk_gamma_config() - configure the gamma block + * @dev: gamma device + * @timing: display timing, giving the frame size + * + * Set the frame size of the gamma block. + */ +void mtk_gamma_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_gamma_start() - start the gamma block + * @dev: gamma device + * + * Start the gamma block. + */ +void mtk_gamma_start(struct udevice *dev); + +#endif /* _MTK_DISP_GAMMA_H */ From patchwork Fri Oct 2 04:03:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315157 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=a2yZHgQZ; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=BNpXV4H+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SN2SMCz1xvt for ; Sat, 03 Oct 2026 00:01:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EB9C660C22; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id aP2k9X0jPgQg; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 163C060D4B Authentication-Results: smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949698; b=c126GcDADeMSuQEHKTXtIWkUSwiQ+fRVrxshrLqoU9yPJgghj1QrUOXslPNZfFkIJLQf KQCln+J7Y2Zb2VsSMCg745ozTk0FAJcsJ+9z5yfLXvc9FOW+kMfaIGoZkTjjmSQ0Go/dU pvikFpAa86JcYpwkplF+5FZnsfr7KA6ZfXSGpErrn/BGf9UZSMeZxPFWYbuuRvj8AUwBp 4x6BqWMoRv66C9CCZpvGyZMjknF7NZyKUStX62wT6uEf3Ab8K7js2j/MaaCZNQqu6Jmnx iRKe/WufBhG7uBA+3hIklLF4HxJKgmbYcLwsqm9Sjpa2OgHgxfZNOIYcl8HcaamE5Lw== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949698; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=Rwonvp9Cvby25/84Kv4JvVu9NKciC+1BVG8KUEiRjnk=; b=f2Gidn+cK2X5vYj0hHb8GNeMf2eZpU+A1qpJ7b0qs8wNwQaIZHSfYcm4Iid/rXUV47aY BhnVrSNgeriYhsw9gDxXhSviINmrKvHcvo3uFmmIy4J1d4GqnmOnWovl+K7PDcjrwbdL/ kJlxwZmkx3GQniqpXi9J0NZ8iUz51ysUaojx9Koi2zvWGvoCy5yXZHoebYAbCUR5VuiVw 7k9Ph2AU5Y1b49PqRmWWO5g65yf0CW6v8sTC2zWuGrFrBkHc7pSR41bzjydWhScBxs8jt aZI3jdNUak7qJmguB7qgVnnTYQ4vZ478SDNhEyeU7FQI8RRkkVg1i7EUGzeQqXJJI9g== ARC-Authentication-Results: i=2; smtp3.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=BNpXV4H+; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949698; bh=Rwonvp9Cvby25/84Kv4JvVu9NKciC+1BVG8KUEiRjnk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a2yZHgQZ7P4YqMq9EJokCgzVv2HGfP6rFcCZe4CEPvA7pS4qLNMRqo+m2ESvgdiJe pBAEG1ViYee4UlCQkLy7mZUxF1PVUdAjVDt43IjSZPmeMPT8bZQT03bfQSYVJmipyo eU5EJ9EWT3nxvmHfRtbP0/9WF6RPeGLvgvlY2DBhxf4LTe3W5glus4OvpmyZIA7Eym IxWdupX1UCRPq+sYFu0TTfQQqLBUG0qi/03rtc3ZhgBcSh4XaoBQZ6MEEgULq6Q+3U bk+9mMGg/kumyESxNj1ARnLtPCPEO93kxzl0vaEwQb39iakRUYK2+meS5uVRqQ1voF PDr2VrG23xAuQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 163C060D4B; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id A7B9E34D for ; Fri, 2 Oct 2026 14:01:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8E1A460D79 for ; Fri, 2 Oct 2026 14:01:34 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id S-DwfBbfc1Gz for ; Fri, 2 Oct 2026 14:01:34 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 806D060D70 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::e" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949694; b=dgQk8MKvbJ9BzlWSXEaaqKtpDIDKy7xJ8Ne/bcdeFWzAVP5vj9bb+fPbvQ12b7fx5sHG yOowW0MAjjF8MYkQzWeAOCCY/fUYJFSRLxt/EAyLA7h7XiLmPL0UG/pPYQP0ewKiovad6 qZ0bgcMDNcIZQ1Sq38RDa7d5UM0FwFsGG2c5YOxbu/FMcOmX4bJpDKlHY4xYnHNAd0ks4 +i4gygO0wLZhqjZDIHGMKmfgT6Rix2Z1FfUcfHSdDT7RUa1NIzaLgU17EuWPBzXEdL51I XZlBPxmwhShWpiHEHJ25pq1T4fkJ0nUU9iL8wVRsQn0SlEFcWF8QD234wKo81rfLKlA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949694; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=Rwonvp9Cvby25/84Kv4JvVu9NKciC+1BVG8KUEiRjnk=; b=KyTAo0KKSiao276GtVRr1VlRw6CluvnUYU7rYuB7czwODMpSMxKjDL3hdK3VQbq6apyl gI52sRHyyd8LG9s7xu2l57W8T079OwibdjV0PNHZ6NTOmAa36sSImI6rykPcPsQDraX+/ lPiDPkZlGsiVwSD0BZT3d11XkrCwOYd+lR/HGaT5rBkG8SlFiyQNV1vagD0X+swCYrQZl u6qiHAwkswqvrvKFcK1IUYBDFoKPTgKPpP82if9pMpUNmMM+EgZXlAw+Lo18f/GWqIbim I/OdSB/dyR2Cqu/SU7ZKP3bMBCOWQXysbHplUOtPKuiBdjJwGV/Iuv0da1ZStJNQL9w== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=BNpXV4H+; arc=none smtp.remote-ip="2a00:1450:4864:30::e" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::e; helo=mail-wr2-x0e.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=BNpXV4H+ Received: from mail-wr2-x0e.google.com (mail-wr2-x0e.google.com [IPv6:2a00:1450:4864:30::e]) by smtp3.osuosl.org (Postfix) with ESMTPS id 806D060D70 for ; Fri, 2 Oct 2026 14:01:33 +0000 (UTC) Received: by mail-wr2-x0e.google.com with SMTP id ffacd0b85a97d-48aff58e6abso1760999f8f.3 for ; Fri, 02 Oct 2026 07:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949691; x=1791554491; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Rwonvp9Cvby25/84Kv4JvVu9NKciC+1BVG8KUEiRjnk=; b=BNpXV4H+bB2pexzGOz80rNQIK0/rjNop07rUVVHYkyhBD6wMzkel49S0hfATT2NkJJ LCdS/Fglc46beRzM+3KCozPzvfIO/PaBrntm+mTwGhkt2+d2LR9x7bNR3woT3M6d7o0m r76UxFP2BO0ahsVqDOKjH/UvwjNTkV8gZSXVeDXWwAWOHvkou2SWnViXPgZ7QTS2U7eh L0P00fAtN4D+21xz9fEQOeZjm84e0hf+YPhlJ8SN69eKAsNamo6+7pdTx+Awk+sY5Chj xclnP4Mr4HKt/BJj8G9toAg3SSvShFHVlSWAWP1GC/TV0NqtmwV88qk4rRhwK80JwxPT KSQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949691; x=1791554491; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Rwonvp9Cvby25/84Kv4JvVu9NKciC+1BVG8KUEiRjnk=; b=PpBXNXDjZFaWovXwHl2sFy2LBvQXgAMfDvCdsoQOYeTQjKNf9K8x8ZuvJArUKJzf6l JZmze2ts6l11Y0muUPMl1Xx/tRD2wrs1Hsov8EBlOug0J90Eff4U++GI5VOP4iMN3sd1 8V5ByJJKzgQPiMBIiYTA7Yj9c8Com/0aPQPntbTblGw33FLvzSm8ydHwTV4FtD3quZKJ ha7KgUQRcrGjOknzke4M8wdjJ+fpxORdyZNCEvxnN5BJppZhE5kCXi6HuHjsoHwpTYae Dr4/USrWbT+e578mJv2Zgfd6wnElN0J21ecE9cua2wpFhSkiApypf8ToXoU1KeMhV3bt oJKA== X-Forwarded-Encrypted: i=1; AKwUvBx/OI5e/T0K5yXTd32yvVwsZr/htEXLFQal9frTIvHP82K9uNSYnrKSK1WN5yl9TbRAGj95Vq4=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYI30EUwFfL8RUf8ww5pC6hSfvjX9Fy+TsYU2xEfChmIMCBdGUxW 7ZsHghP7r69Ic3PN6wxl7EVYty8MLZRUeAnje8UUSHZO+O5btKdm9xBUDGBICCRIFW8= X-Gm-Gg: AYBFou0bsgKNU29e37AKpF1WRUi3ObbFVAN6uhDHgvDBB7v98Exzv3cJk9EsHcAZbQH g64YS/wedVVxMmWy4TlkdBVJ8TVDa1dzY+i7hBOosbdp6MZdm4VQTZQCZ5rH/veTH9FeVF98KkP tVvkleVcaTZ1de0rBW8qmffCZa/Y/sq2txFx2tT0G5uE4Xoefe7NWboD0yhal8j7axbTWq0fNfu yBcf4s50C7tq9LcbwB4M6H422+gLPGOAGRDpIsEh2ld/fGpa0lqL6mjRn7uwAxiRRZ4tq3ibvUi HIFxZ+TWLh4u+D8M8DoMJ3Cjdu8GfNXIF1gh+rdG2uWSRWD6bCOSLR8j2C22jhAbPVlmfsDT4hM GgRHoRAzc8m65F1I+DIEqdG1r1L/H6cb1jJPW4H1mRO5fCsRv+ParyMmP3c1CjEavibJLeUols9 8fJizfOpKxDHca1jqjkdpOXaBg4seW/zD0XYGvMU2BWwDlyHN0kPQQmdi3ZAMzp3t/5xeNKl5Jo C0f8qngjVYDKeD0rrqedgkRZ8j4lfhqMfayj4UZoW/o1m0gNwnjujcHwu9YvN0eCsTNd88wcQlK k4XHyE2R3lGLKwSsDYyE1czwjnQs/E2G2jMvhUnrvDSCSvaJj9iz2A8= X-Received: by 2002:adf:e009:0:10b0:48a:fcec:2a1b with SMTP id ffacd0b85a97d-48b1272d365mr4070509f8f.17.1790949691273; Fri, 02 Oct 2026 07:01:31 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:30 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:03:59 +0200 Subject: [PATCH v2 08/13] video: mediatek: add dither component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-8-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The dither block is the last of the colour blocks of the video pipeline on some MediaTek SoCs, such as the MT8365. It reduces the pixel depth of the stream down to the bit depth of the panel and spreads the resulting quantization error over the neighbouring pixels. The pipeline carries 10 bits per component and U-Boot always drives the panel with 8, so the driver programs the block as Linux does for an 8 bpc output: the frame size, then the DITHER_5/7/15/16 settings of mtk_dither_set_common() before enabling the engine. The driver matches "mediatek,mt8183-disp-dither", the generic fallback the MT8365 dither0 node carries behind "mediatek,mt8365-disp-dither", so a single entry covers every SoC reusing that block. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_dither.c | 89 ++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_disp_dither.h | 32 ++++++++++++ 2 files changed, 121 insertions(+) diff --git a/drivers/video/mediatek/mtk_disp_dither.c b/drivers/video/mediatek/mtk_disp_dither.c new file mode 100644 index 00000000000..51ed69df011 --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_dither.c @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video Dither support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include + +#include "mtk_disp_comp.h" +#include "mtk_disp_dither.h" + +#define DISP_REG_DITHER_EN 0x00 +#define DITHER_EN BIT(0) + +#define DISP_REG_DITHER_CFG 0x20 +#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1) + +#define DISP_REG_DITHER_SIZE 0x30 +#define DISP_REG_DITHER_SIZE_HSIZE GENMASK(28, 16) +#define DISP_REG_DITHER_SIZE_VSIZE GENMASK(12, 0) + +#define DISP_REG_DITHER_5 0x114 +#define DISP_REG_DITHER_7 0x11c + +#define DISP_REG_DITHER_15 0x13c +#define DITHER_LSB_ERR_SHIFT_R GENMASK(30, 28) +#define DITHER_ADD_LSHIFT_R GENMASK(22, 20) +#define DITHER_NEW_BIT_MODE BIT(0) + +#define DISP_REG_DITHER_16 0x140 +#define DITHER_LSB_ERR_SHIFT_B GENMASK(30, 28) +#define DITHER_ADD_LSHIFT_B GENMASK(22, 20) +#define DITHER_LSB_ERR_SHIFT_G GENMASK(14, 12) +#define DITHER_ADD_LSHIFT_G GENMASK(6, 4) + +/* the pipeline carries 10 bits per component, the panel takes 8 */ +#define MTK_MAX_BPC 10 +#define MTK_DITHER_BPC 8 +#define MTK_DITHER_SHIFT (MTK_MAX_BPC - MTK_DITHER_BPC) + +void mtk_dither_config(struct udevice *dev, const struct display_timing *timing) +{ + u32 sz; + + sz = FIELD_PREP(DISP_REG_DITHER_SIZE_HSIZE, timing->hactive.typ) | + FIELD_PREP(DISP_REG_DITHER_SIZE_VSIZE, timing->vactive.typ); + + mtk_disp_comp_write(dev, DISP_REG_DITHER_SIZE, sz); + mtk_disp_comp_write(dev, DISP_REG_DITHER_CFG, DITHER_RELAY_MODE); + + /* as mtk_dither_set_common() in Linux */ + mtk_disp_comp_write(dev, DISP_REG_DITHER_5, 0); + mtk_disp_comp_write(dev, DISP_REG_DITHER_7, 0); + mtk_disp_comp_write(dev, DISP_REG_DITHER_15, + FIELD_PREP(DITHER_LSB_ERR_SHIFT_R, MTK_DITHER_SHIFT) | + FIELD_PREP(DITHER_ADD_LSHIFT_R, MTK_DITHER_SHIFT) | + DITHER_NEW_BIT_MODE); + mtk_disp_comp_write(dev, DISP_REG_DITHER_16, + FIELD_PREP(DITHER_LSB_ERR_SHIFT_B, MTK_DITHER_SHIFT) | + FIELD_PREP(DITHER_ADD_LSHIFT_B, MTK_DITHER_SHIFT) | + FIELD_PREP(DITHER_LSB_ERR_SHIFT_G, MTK_DITHER_SHIFT) | + FIELD_PREP(DITHER_ADD_LSHIFT_G, MTK_DITHER_SHIFT)); + mtk_disp_comp_write(dev, DISP_REG_DITHER_CFG, DITHER_ENGINE_EN); +} + +void mtk_dither_start(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_REG_DITHER_EN, DITHER_EN); +} + +static const struct udevice_id mtk_disp_dither_ids[] = { + { .compatible = "mediatek,mt8183-disp-dither" }, + { } +}; + +U_BOOT_DRIVER(mtk_disp_dither) = { + .name = "mtk_disp_dither", + .id = UCLASS_MISC, + .of_match = mtk_disp_dither_ids, + .probe = mtk_disp_comp_probe, + .priv_auto = sizeof(struct mtk_disp_comp_priv), +}; diff --git a/drivers/video/mediatek/mtk_disp_dither.h b/drivers/video/mediatek/mtk_disp_dither.h new file mode 100644 index 00000000000..019e6c954bb --- /dev/null +++ b/drivers/video/mediatek/mtk_disp_dither.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DISP_DITHER_H +#define _MTK_DISP_DITHER_H + +struct display_timing; +struct udevice; + +/** + * mtk_dither_config() - configure the dither block + * @dev: dither device + * @timing: display timing, giving the frame size + * + * Set the frame size of the dither block, and dither its 10-bit input down + * to 8 bits per component. + */ +void mtk_dither_config(struct udevice *dev, const struct display_timing *timing); + +/** + * mtk_dither_start() - start the dither block + * @dev: dither device + * + * Start the dither block. + */ +void mtk_dither_start(struct udevice *dev); + +#endif /* _MTK_DISP_DITHER_H */ From patchwork Fri Oct 2 04:04:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315158 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=1DPPGGH+; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gbha3Bzz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SR0VV5z1xvt for ; Sat, 03 Oct 2026 00:01:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A90768136A; Fri, 2 Oct 2026 14:01:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HHF1ILbAU8EK; Fri, 2 Oct 2026 14:01:40 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org B64F18134C Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949699; b=R6zktR1K2oYpuTXnXTzwj6eIv9Z364fvjjz0oxH1zSKA0O+sWUN+HF8yWyOKYX/S0LK5 ezm9AzijOzG8XSG0v+qmTYsTblRYPrUNQPkMLzDp8oCGtmSQFjCsTZiaGRfLMjFYrd1TM 8RftwdBuiAyidxRRqqvEyZXCJefItIHjofShuv/6MJD7EXZzkVe2bDMfR/K55SI2erIoD t9OYFQz1bJB0BqDjrtXe0iK6Bo1NgCZ/gom99t2XZdzoQgvWTqrPztF4zDbN4Fvw4H9iO WIJ76yoCsH9v1DsfcDxxYdimuXSUDpVXKCQztAMdEwAw1/ybQON/tp3M7sCFSTtWxIw== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949699; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=hNFCwSTITuuh3zuvbrIfBxYhL4zKihutr2bRwPBSNCE=; b=lcYsKNDDDRjkG9Q99JX5fCHYOJDdPeO2M0j1T48E68w/w2pDMC34TuwIB0llZNJQXK8B 6sxGQqxyzTbSIdkAo/jMYhyQd2cXKfmtg6AI76pYSatBT5Yb/+c1gUPRnfirR/RprSz9h sgemVg/1xxQEQmcwzUEdEBPdTcauDwQdNnfo2Q5QrymKkEg6Tx86FBewR9RzwGh/pw+p5 Goft/Cxw4wKfyrTLnhiwjvJuMVuMwTRzqVAr7HKvmYcI4blNUnXWZOXbjc0yhlyPuAtcr 6Dt+7Cc9cMvG23aN+eefkLNgf+F1bmi64lj8WB69uDWfZOeSCgEXJPFzc/ZwlZ7rOJg== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949699; bh=hNFCwSTITuuh3zuvbrIfBxYhL4zKihutr2bRwPBSNCE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=1DPPGGH+MTKrqoWKt3omgaBEoTWuewb8/mv1ud9Pc69aSPifq9zGRKP43xrsEHwGN 79VTF6qMbbQwkoyuc93ZB14NnwfdtaRVREUaXI7vxOVnhfDadVFBf3yp0n0hLa7qQR 4I+nzbUcNi5MX6zTsVwZ7M2wf9pZX/75CPlVmnMsXIvOX6rPwHOj+HcGGOK8sFo5yq 58tXlIeOULV6FzBFgp7BxT+Ozmc7iy7lLp8t96UHjx+SB2eOZmOaxO8R5jEAS4RoEp Vxzvc3Ra1ysm4Xl9T3JurnFXjmmCfcHCRDoCMKTT5nxEIarXy/pHBR+a3UgOtzVsGv 6wPyMi/D/vH/w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id B64F18134C; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id 8B0FD435 for ; Fri, 2 Oct 2026 14:01:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 70EB160D70 for ; Fri, 2 Oct 2026 14:01:35 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id K3Q0Ef61B7qu for ; Fri, 2 Oct 2026 14:01:34 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 61D2A60C22 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::e" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949694; b=gA7w7/xv9sHJbKhwlTp+IN2tt6rf7GvSXZNlHMT9/LK/p4Z81qoeFMCjByhT6sru9HXp IrP37VwQZDDFd7+bUFSOD6OYCytePCeCQGAWR0LeXMZvnuVd/ZvuwL5JkoBFeGSUOt7il h/O8nRl+CjuXu3WyetUB+1Kg+/gjMsifQzPqBDvZi0odau8okHlw/hs4BBKGVzc/t6KLt pXym2StzkYsCQvRUCYJA5fb0SSd1Xd9mbX9NLHRL6+u1EDOqZ+S8DM/HoCbljrUO/Ew4m 2nOK+V9cLBIKyMBxNwCQEzODMzuckM/9MQ3z7QLW5G45/+AcSlazy6bKd5CWyGBa4Sg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949694; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=hNFCwSTITuuh3zuvbrIfBxYhL4zKihutr2bRwPBSNCE=; b=FTasjNFLAmCJPLG0VUh4SaChkBVm8gaJp2G0XHC6FDoFf/ptkLhsinfj/7dQNk329a59 J48okpGbAQDLYqdYU0mOL8TsxjtYsd2VICu07TXXL1zGWna1Z52uWtvqQr+Nq/uWNd+Pq 880I/HBJiDiIMxmieVHdrSItkCsbwHXNvN56htEh9xm3FdWe4p1Iq23zRBJcQVTQv+U94 M/VdnfrvJM/fzF6rof62nrPfl6PkYk2r5XaBAZerADcPqoGcTWDuws2qROHMsTJLisiAl YXYawJGrxsZTDNxHHMcT4QSznwlCShVSZa6vEh2YBdkcDyoERT4v61MssmzfDUA0hnA== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gbha3Bzz; arc=none smtp.remote-ip="2a00:1450:4864:30::e" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::e; helo=mail-wr2-x0e.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gbha3Bzz Received: from mail-wr2-x0e.google.com (mail-wr2-x0e.google.com [IPv6:2a00:1450:4864:30::e]) by smtp3.osuosl.org (Postfix) with ESMTPS id 61D2A60C22 for ; Fri, 2 Oct 2026 14:01:34 +0000 (UTC) Received: by mail-wr2-x0e.google.com with SMTP id ffacd0b85a97d-48aef5d66c1so2437068f8f.3 for ; Fri, 02 Oct 2026 07:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949692; x=1791554492; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hNFCwSTITuuh3zuvbrIfBxYhL4zKihutr2bRwPBSNCE=; b=gbha3BzzwCoJtjEGPV5sdp260TFtRpWz6nE+M5M1+Fd3bzJMyQp9fnrzy7hDU9D0Gy RbW1uDuRfqri7P8vDfhxpI1x3OGZXpPgu79lFGUjA4IL5wYtjx3SGwlUV1VWPnl4GOiO IPTDY2TOXDMt2UKkcTiJutRXF1B+3na+z3fXR1n1lFFNZGxMJaDXw+xWd/OJEh+nHLKI LtXZGtC1yiARu5UnEOqIwVuyM5uCCY5lQ5eOraihTpBB77pnlyy+pH1jor25zLWxUzwu U8or8JPTrpbe+oxDAoFbj2pk+Pyxl4UkWVIDpls4GhMvTlwvD5hgjXCde0B236pwZTro jCKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949692; x=1791554492; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hNFCwSTITuuh3zuvbrIfBxYhL4zKihutr2bRwPBSNCE=; b=wWpzHY6y+hE4XDtY4JxGejSFTmSLxqiCifxrcyBGSWBGgYNOBdgE9LXPnmCbZuktxW 6KAXEzOee/qoOgq8PyYXwNWoRsv5X1e8N4gMMCBbzJfzcSeHt6RO8bbz5jzw4+mdeaKM 6EOUnzbS1AoMHkwHc6UO6FqNEDDzpCZU8L2m3/v2FnMWYgbnFK6PS8wC1HEOj8ICIu3h FXbaGUnfxFTHTHzLuRME7ROYspYNdYE9OWk+zEfYFlj3C0kW28tU+cPv+tWh8/6FEJpF rmYbJX1P6CFNK63NEpa5C5Qr/5cOPTt7JGYaXEpvScmIpdwtcZG3ue3NDkObVl8C+lML /8lA== X-Forwarded-Encrypted: i=1; AKwUvBy0WJ//LIqvExQWfEKAF6td/3swqzTMvgUhovGDek+2HTFK89DgGkV8QUnM3Htbu5GTKf2+gsY=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYJCd6DMCBvAlAGJB74o50Aqw28R5CHVxbxeLqAElibpA2GVwfEs ph9vRm9wOIcRsdtBecXDosr89n367XhT+ejzG1cmIFtoy6LcxrWqjpWanNGe9Yh+XhU= X-Gm-Gg: AYBFou1nSJmVNt5WmJgpJ76R/QBg+1RCrIkHNClCUM4vvIf7j2HcRyi1o0MrgUmFUaP ujghHU94VaCFvJzl2K3EgRzutCKCe+i8TBW92FH5wRm9tR+Ju2LQRqpd6GIpUXmP8GmYAIeya+M xFJt2SPIOKyvldi+mjPXO/O9ECqfDWeuTFSAaRoR+mVPBBI+P0XzoDfTIPUVG1mRu1Sq0PNnpQL ymLOaX9zf7lx+2BtvdlNys1D5bpLzktqD1NuGN7s4LHkl5mBFtQJyyl6Ilt4IZ2+O4CHx5IWGWw ulNIW+el2DeTmjCdsLF5q1rP8d1OjYKhJF+LtH+GykUyRTGJpYxOpgqCKdPGpJ7RW/xUiCB/pjb q56RtRGqWJcTRr7TknLfzLfNeubhiK/xw/SRtiIKqlQjRDbLVOJCJ2cTcRgvobAaGTTymn8BfVH kuXjFMFu+H9R4xNJXjNgQoiRMcB7BTtv+A1obvie4Va3ylkgKKXza6hbcaSe4uSz+uY82GdN6YL NgduTrpC1oOb9hC7QYBhC1FUf4QqulrtpTVfNfmNadCS9xIm5/xW3f2wvPj6Rcty3DL93XKb7GW vLUbVAEZ7ZEw5GUM6BucRAlXiQKfKjtv37ybGHBUyafAsWuB9hKno00= X-Received: by 2002:a05:6000:385:b0:488:79db:c73b with SMTP id ffacd0b85a97d-48b12717923mr5031791f8f.24.1790949692324; Fri, 02 Oct 2026 07:01:32 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:31 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:04:00 +0200 Subject: [PATCH v2 09/13] video: mediatek: add ddp component MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-9-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The display data path (ddp) is the set of muxes of the mmsys register space routing the components of the video pipeline into each other. Add the route needed to bring up a splash screen, the overlay to the DSI, with one function per SoC: mt8365_ddp_ovl_to_dsi() goes through the colour pipeline, mt8366_ddp_ovl_to_dsi() straight through the crossbar. The muxes have no device of their own: they live in the mmsys syscon window, which the DSI driver maps and hands over, so no compatible is added here. The MT8365 offsets and values are the ones of the Linux mt8365_mmsys_routing_table; the MT8366 ones come from its downstream mmsys, that SoC not being upstream yet. Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_ddp.c | 122 +++++++++++++++++++++++++++++++++++++++ drivers/video/mediatek/mtk_ddp.h | 30 ++++++++++ 2 files changed, 152 insertions(+) diff --git a/drivers/video/mediatek/mtk_ddp.c b/drivers/video/mediatek/mtk_ddp.c new file mode 100644 index 00000000000..246e6615fa0 --- /dev/null +++ b/drivers/video/mediatek/mtk_ddp.c @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Display Data Path + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include + +#include "mtk_ddp.h" + +/* + * mt8365-generation mmsys: the path is built out of direct muxes, one + * register per input or output. The offsets and the values are the ones of + * the Linux mt8365_mmsys_routing_table. + */ +#define MT8365_DISP_MS_IN_OUT_MASK GENMASK(3, 0) + +#define MT8365_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN 0xf3c +#define MT8365_OVL0_MOUT_PATH0_SEL BIT(0) + +#define MT8365_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL 0xf4c +#define MT8365_RDMA0_SOUT_COLOR0 0x1 + +#define MT8365_DISP_REG_CONFIG_DISP_DITHER0_MOUT_EN 0xf50 +#define MT8365_DITHER_MOUT_EN_DSI0 BIT(0) + +#define MT8365_DISP_REG_CONFIG_DISP_RDMA0_SEL_IN 0xf54 +#define MT8365_RDMA0_SEL_IN_OVL0 0x0 + +#define MT8365_DISP_REG_CONFIG_DISP_RDMA0_RSZ0_SEL_IN 0xf60 +#define MT8365_RDMA0_RSZ0_SEL_IN_RDMA0 0x0 + +#define MT8365_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0xf64 +#define MT8365_DISP_COLOR_SEL_IN_COLOR0 0x0 + +#define MT8365_DISP_REG_CONFIG_DISP_DSI0_SEL_IN 0xf68 +#define MT8365_DSI0_SEL_IN_DITHER 0x1 + +/* + * mt8366-generation mmsys uses a multi-stage crossbar instead of the simple + * direct muxes above. + */ +#define MT8366_DISP_OVL0_BGCLR_MOUT_EN 0xe24 +#define MT8366_DISP_OVL_BGCLR_MOUT_MASK GENMASK(1, 0) +#define MT8366_MOUT_OVL_TO_BLENDOUT BIT(0) + +#define MT8366_DISP_OVL0_OUT0_MOUT_EN 0xc10 +#define MT8366_DISP_OVL_OUT0_MOUT_MASK GENMASK(2, 0) +#define MT8366_MOUT_DISP_OVL0_TO_DISP_RDMA0 BIT(1) + +#define MT8366_DISP_RDMA0_SEL_IN 0xe04 +#define MT8366_DISP_RDMA_SEL_IN_MASK BIT(0) +#define MT8366_SEL_IN_DISP_RDMA0_FROM_DISP_OVL0_OUT0_MOUT 0x1 + +#define MT8366_DISP_RDMA0_RSZ0_SOUT_SEL 0xe00 +#define MT8366_SOUT_DISP_RDMA0_RSZ0_TO_OVL_PQ_OUT_CROSSBAR1 0x0 + +#define MT8366_OVL_PQ_OUT_CROSSBAR1_MOUT_EN 0xc78 +#define MT8366_OVL_PQ_OUT_CROSSBAR_MOUT_MASK GENMASK(5, 0) +#define MT8366_MOUT_OVL_PQ_OUT_CROSSBAR1_TO_COMP_OUT_CROSSBAR4 BIT(4) + +#define MT8366_COMP_OUT_CROSSBAR4_MOUT_EN 0xd80 +#define MT8366_COMP_OUT_CROSSBAR_MOUT_MASK GENMASK(5, 0) +#define MT8366_MOUT_COMP_OUT_CROSSBAR4_TO_DISP_DSI0 BIT(0) + +static void mtk_ddp_mask(void __iomem *base, u32 offset, u32 val, u32 mask) +{ + u32 tmp = readl(base + offset) & ~mask; + + writel(tmp | (val & mask), base + offset); +} + +void mt8365_ddp_ovl_to_dsi(void __iomem *mmsys_base) +{ + /* OVL0 -> RDMA0 */ + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN, + MT8365_OVL0_MOUT_PATH0_SEL, MT8365_DISP_MS_IN_OUT_MASK); + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_RDMA0_SEL_IN, + MT8365_RDMA0_SEL_IN_OVL0, MT8365_DISP_MS_IN_OUT_MASK); + + /* RDMA0 -> COLOR0 */ + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_RDMA0_RSZ0_SEL_IN, + MT8365_RDMA0_RSZ0_SEL_IN_RDMA0, MT8365_DISP_MS_IN_OUT_MASK); + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL, + MT8365_RDMA0_SOUT_COLOR0, MT8365_DISP_MS_IN_OUT_MASK); + + /* COLOR0 -> CCORR0 -> AAL0 -> GAMMA0 -> DITHER0 -> DSI0 */ + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN, + MT8365_DISP_COLOR_SEL_IN_COLOR0, MT8365_DISP_MS_IN_OUT_MASK); + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_DITHER0_MOUT_EN, + MT8365_DITHER_MOUT_EN_DSI0, MT8365_DISP_MS_IN_OUT_MASK); + mtk_ddp_mask(mmsys_base, MT8365_DISP_REG_CONFIG_DISP_DSI0_SEL_IN, + MT8365_DSI0_SEL_IN_DITHER, MT8365_DISP_MS_IN_OUT_MASK); +} + +void mt8366_ddp_ovl_to_dsi(void __iomem *mmsys_base) +{ + /* OVL0 -> RDMA0 */ + mtk_ddp_mask(mmsys_base, MT8366_DISP_OVL0_BGCLR_MOUT_EN, + MT8366_MOUT_OVL_TO_BLENDOUT, MT8366_DISP_OVL_BGCLR_MOUT_MASK); + mtk_ddp_mask(mmsys_base, MT8366_DISP_OVL0_OUT0_MOUT_EN, + MT8366_MOUT_DISP_OVL0_TO_DISP_RDMA0, + MT8366_DISP_OVL_OUT0_MOUT_MASK); + mtk_ddp_mask(mmsys_base, MT8366_DISP_RDMA0_SEL_IN, + MT8366_SEL_IN_DISP_RDMA0_FROM_DISP_OVL0_OUT0_MOUT, + MT8366_DISP_RDMA_SEL_IN_MASK); + + /* RDMA0 -> COMP_OUT_CROSSBAR4 -> DSI0 */ + mtk_ddp_mask(mmsys_base, MT8366_DISP_RDMA0_RSZ0_SOUT_SEL, + MT8366_SOUT_DISP_RDMA0_RSZ0_TO_OVL_PQ_OUT_CROSSBAR1, + MT8366_OVL_PQ_OUT_CROSSBAR_MOUT_MASK); + mtk_ddp_mask(mmsys_base, MT8366_OVL_PQ_OUT_CROSSBAR1_MOUT_EN, + MT8366_MOUT_OVL_PQ_OUT_CROSSBAR1_TO_COMP_OUT_CROSSBAR4, + MT8366_OVL_PQ_OUT_CROSSBAR_MOUT_MASK); + mtk_ddp_mask(mmsys_base, MT8366_COMP_OUT_CROSSBAR4_MOUT_EN, + MT8366_MOUT_COMP_OUT_CROSSBAR4_TO_DISP_DSI0, + MT8366_COMP_OUT_CROSSBAR_MOUT_MASK); +} diff --git a/drivers/video/mediatek/mtk_ddp.h b/drivers/video/mediatek/mtk_ddp.h new file mode 100644 index 00000000000..f7efbd64cae --- /dev/null +++ b/drivers/video/mediatek/mtk_ddp.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#ifndef _MTK_DDP_H +#define _MTK_DDP_H + +#include +#include + +/** + * mt8365_ddp_ovl_to_dsi() - route the MT8365 mmsys muxes from the OVL to the DSI + * @mmsys_base: mmsys config register window + * + * Go through the color, ccorr, aal, gamma and dither blocks. + */ +void mt8365_ddp_ovl_to_dsi(void __iomem *mmsys_base); + +/** + * mt8366_ddp_ovl_to_dsi() - route the MT8366 mmsys muxes from the OVL to the DSI + * @mmsys_base: mmsys config register window + * + * Go straight from the rdma to the DSI, through the crossbars. + */ +void mt8366_ddp_ovl_to_dsi(void __iomem *mmsys_base); + +#endif /* _MTK_DDP_H */ From patchwork Fri Oct 2 04:04:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315160 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=HoV3ZeYn; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gwIu37U2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9ST5nPCz1yGJ for ; Sat, 03 Oct 2026 00:01:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 67BA08133E; Fri, 2 Oct 2026 14:01:44 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2fAAE6s3q5ey; Fri, 2 Oct 2026 14:01:42 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 4A99481355 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949701; b=LO2LSxHEiGKrc3PKsatL2gNCR3scz0P+wKyYdTMujoxRjsQ5pSvXaUYl5qS8YPJEehqA 22Yp4M0LNq2Ksr33xNpGEPZhsHydTiLn8u9Cua8Mb1KYLtgq8jCMFIw/91hmzL0VKbpSx VVdxhwZPP5kRgRCbzYwxXIiyw8OwDa/DW/jUMCl+FSKT0GUSTzHS6AIwk9EkpiMZf7u0Q 57NajivQjnQdpFWyCfO4qLgR9ssX4PN4dCELjqdGXrYYKC5hc0CP2ryvOui3CGbDsf4tC Uu4ShCvZyVowKXpCTbz6GDhITlVRXeeZgY6jo6+ZR++mxpvudbF+kLgxY+G0Z9BF/qw== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949701; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=9ZYZQ4ZK+NAQzNEVmwI7x0sg0RKtQ2t3IUDQzMxLmnw=; b=NDbUKPU9Do08Ytmz/8+sg5DLKWJSCp0TLsBMoElWh+5W5XrfZX6ohkneaQ76mNFKY66r JO2lYVs4trRVZRMRWDodanr4Sa7Gn3UrHA0V34DAFlsUk7j9aauXmJihrPNivnL/EqsyV 6nS5Cubk6yn1PwfMNnARHMbfymBPcLQUn1Rhy67EbtQaY78vgT5ySxtW2bDGr7LENJyKt y0XLgqbjQCyzVCuylC4WZP/jvUjK/NhSqf6lQLzAc5MnPd0RQqqlRP2R9ah05J1PcNjbH G5m140F2xRZ9oAXC4p7NqmD8hO4SmGjrG+66sLiKbHdbi7zYCTGZjxXfLgZ+JUvbNrg== ARC-Authentication-Results: i=2; smtp1.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gwIu37U2; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949701; bh=9ZYZQ4ZK+NAQzNEVmwI7x0sg0RKtQ2t3IUDQzMxLmnw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HoV3ZeYnFIcDjcGKfo+DvyxaIAt72BUSAxu/qHurlNX2L2J50K96GoznyKiyOQ62f 0qxNGl7gEsa8MsrGQmk0yivdSlhDnWOApjgQx/T5+O7AGhDPfAJdQWvR3y86m0ubZj WIdsMwLmYTbK56itGSQe+5iFA0alNsFWhNiaaADOPcDrwgruTTFugcZWkftD07BZBa KXD7SxFMuD5HJdlhLPSGarbFos8u1sLHsSzd0uAEXI41yprZVfy/mvMdtkHWupATKh I2SVHet5J0mGHdx3WT1m++lJ8C1zqvi/djRf0XUIkPdR4Qu7Er+9giSdMMR/R/8C/x UNPHLivGBacoQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 4A99481355; Fri, 2 Oct 2026 14:01:41 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 535DD2E0 for ; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3951681367 for ; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id QO1BwCE4j72l for ; Fri, 2 Oct 2026 14:01:36 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 0600881324 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::10" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949696; b=enWHLivR/QcEjJehllA6wTevqnfjNC2xzYnjjZGE12vxR7ZLvlYLRBQoNs4DEnMTdhfv cUgYm1p6hue9hhqwX/XaTsKQabA+lDPh0sG6Z3uEPKX5Teamz/ZcUgn9fEWQskzUfbbK1 kckDx5S702aKpYiEzbHCXB07LtIp2xgC3KlD9hcPwNnNZQxbNMgjcJUebX9vFxRTERm7E pvxTAKuesvPSYhlSSKX1e/JIO/9QKKhqkxJ7gijRM7KjNUbxQan7d6/kt8DbMLckw3c9H 5XT4hQxTwl+grR2qhvXqJac4DURcK3QmRawnRbhgSGOBuRd7VyxUIUniPTwFtT6r1RQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949696; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=9ZYZQ4ZK+NAQzNEVmwI7x0sg0RKtQ2t3IUDQzMxLmnw=; b=pkUbCa83TXhSQkL+ocXGxmL6xhMBeDgjWedcLpraBOFmuASFm+AprCit1mS1bF3jV1vp Oi6JR1ew4VCAN8K49ZcVKCAP0uWosx4KqQVxzz56DGYt77OiRws3oueKgIMRpKvzaNN0n 6c1lMGl9DB++3M7ooDUyY7PhfTBkceS8SBmUDrs/6sRJkQOXVi0Ju/PW3yOmYJfw/KHL5 1GkLW/Qz/S9FcZJWMM/1d7B2VCdn6DVrSsbb5SLgo8D+WjDjkl1keB+W1x3bw6UACB5L5 BsedJHwtMMtqqFlCid4KCnhDz01khT+DFc5WFvAN7PJIccWLC2pdCOJKUNxtKMXIVTQ== ARC-Authentication-Results: i=1; smtp1.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gwIu37U2; arc=none smtp.remote-ip="2a00:1450:4864:31::10" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::10; helo=mail-wm2-x10.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=gwIu37U2 Received: from mail-wm2-x10.google.com (mail-wm2-x10.google.com [IPv6:2a00:1450:4864:31::10]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0600881324 for ; Fri, 2 Oct 2026 14:01:35 +0000 (UTC) Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-49e6598dd44so695665e9.1 for ; Fri, 02 Oct 2026 07:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949694; x=1791554494; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9ZYZQ4ZK+NAQzNEVmwI7x0sg0RKtQ2t3IUDQzMxLmnw=; b=gwIu37U2+MaIb+gAjp882yapobSA/p0OhLXpZCOxzOd0nNHDNrSYP+9pI/W0JX1SHB L5k5pqGjieAM/TKZbcJ+6NG+AyzvJcWC9trsjBWvIbiDapaZMvv4dTdWZi9X1tOv4SKi hC0gQF7nFEZD7aF7KhwBMUCRguWFXROS0At0n+drpaFHyhpaYBaxOfYA2/5jx5BPy3vb HfdfNjeMCl5ayN6Ksd1kD/UoaIdyu279w3WSWiD5FLxKSqcAN75kfr5PPxzazeiSJyfy UecDOGe+cv1YPxRVBKKhlK7baNbP2y70kdGKmE/pZprVd2pAruARglFjq+kT2WCiCeyB zsig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949694; x=1791554494; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=9ZYZQ4ZK+NAQzNEVmwI7x0sg0RKtQ2t3IUDQzMxLmnw=; b=ceTr7rdzlozZLV9M9a7/fSo45ErHvnAxjMjM5r6FZUwl4ZkPJ6KTU+3zFZpWLbSu6Z zvaFktQ4tc7vFy68DrtawLszjRb9HaEk16zAcoGpuL1RI6IXgaqKC3K7RZQkBcgkn2s4 KtHYRgBKUm2TySzFSfcAnWHiRk2kmqFEnNmJ3RizNLuwOVP3XQ5tcuvNDmU/jhUnPdqT wk53di4LfV/DLsf5Pxiikp1lY+v7MWZevxv0QMjxcA5UFPaFJxZZczD5Desuqrk2dhXc 0E1OvC01pG1EKBbKztXAZm8r0NDLZE88zLCFJmlBPRvMAq/nqlOX8a585sKFMRjO+4Gl 42gw== X-Forwarded-Encrypted: i=1; AKwUvBzF0VEsqu2n3ErQR1sN5GDMO79IJ6R95atPBXgCOYobR2riNdlBa7LAanpmES18wHiaGh6F5yc=@lists.u-boot-project.org X-Gm-Message-State: AFuF++mVZlaRb6xNiV7H2BH0AEGkHg4HhC+FQEOQ9CrqYkpzeH0D6NQ1 jG5refNnOSwiL91lwXdjXV3H0hk+n0y5vf66MS+ZzZW4jAGlE8EgdOVvDbtKPT2DyNM= X-Gm-Gg: AYBFou1TzMYRRWEwMLd9QTfvCcBHejAUOFEYh2wrOfOtnyljkV9yDO/dHo854x2zFfa /4PXi9uqbEnCNH9mx/RQfe0Oe9mXkO6/0+68lrnOEF4z9v47BZu4bBdlnyU+syLM6y44l794UL4 jrZB2+Hi7T/jYP11VPFoJ2a7slqLX2QRRicKSQShBN2Vfe6dWH33glhhQN6tdrdn9gCpxS3JmUu dvI7vTSDnSj2C2BkK0jwMPb6z6APFOaViWRag6ZWNGzaFntOuTh6a0YYF42ryM6KV59b62hSsZ9 k0p7KcGEWSyuW0a3vbKL80MDjHSX13jsyI78pYNdVhX8MmqXuTczbfFWA6gZsdS24r4RfgGKWx8 yVp0VIM/0XQyurzvU0tU7nHKMqnBk91NLzIOK/7WyI0fB/Uo5Jtp3EuzdRInpxbM1wuo2kTTKDk ugFW51gCg6ZkyTAN7EnozwWh09Fs7WT7dYRA9kSn33jWCazJ93IhI+14WkZHPGbp1rBzMaZkJCX fEAL7fKoktO4Z79y9ewkywEUWKDerk0nJNZrvPkSPMhv+//oowaFgiV8BbuIEsxDJnEQE2gneeE 5wEVwMJylBp3XY1IKJdvlUkxAXWJpmJsvEvilV6zWdGtkIgcNcXvo5c= X-Received: by 2002:a05:600c:3508:b0:49e:6683:d23c with SMTP id 5b1f17b1804b1-4a02744dcbemr53083425e9.0.1790949693591; Fri, 02 Oct 2026 07:01:33 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:32 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:04:01 +0200 Subject: [PATCH v2 10/13] video: mediatek: mtk_disp_mutex: add the DSI pipeline MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-10-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The mutex serialises the components of a pipeline on the same frame: it holds the list of the modules started together and the source of the start and end of frame signals driving them. Extend the driver, so far only used by the MT8188 HDMI pipeline, with the DSI pipeline of the MT8365 and the MT8366: the overlay to the DSI, through the colour pipeline on the MT8365 and straight out of the rdma on the MT8366. mtk_disp_mutex_ovl_dsi_enable() calls the SoC one, mt8365_mutex_ovl_dsi_enable() or mt8366_mutex_ovl_dsi_enable(), and fails on a mutex without a DSI pipeline. Two compatibles are added, "mediatek,mt8365-disp-mutex" and "mediatek,mt8366-disp-mutex". Neither node declares a generic fallback, so both SoC specific strings have to be listed; they also differ in the module indices, in the DSI0 module bit the MT8366 needs, and in the shift of the end-of-frame selector (6 on the MT8365, 7 on the MT8366). The MT8365 mutex has no clock of its own: as in Linux, a "no_clk" flag of its driver data says so, and its probe then only maps the registers. The driver includes and , for the dev_err() it now uses, instead of . Signed-off-by: Julien Stephan --- drivers/video/mediatek/mtk_disp_mutex.c | 133 ++++++++++++++++++++++++++++++-- drivers/video/mediatek/mtk_disp_mutex.h | 11 +++ 2 files changed, 138 insertions(+), 6 deletions(-) diff --git a/drivers/video/mediatek/mtk_disp_mutex.c b/drivers/video/mediatek/mtk_disp_mutex.c index 571d4c8b672..af8e7032a01 100644 --- a/drivers/video/mediatek/mtk_disp_mutex.c +++ b/drivers/video/mediatek/mtk_disp_mutex.c @@ -6,7 +6,10 @@ * Author: Julien Stephan */ -#include +#include +#include +#include +#include #include #include "mtk_disp_comp.h" @@ -16,8 +19,8 @@ * Register layout of one mutex instance @id (as in the Linux mtk-mutex * driver): the block packs the per-mutex registers 0x20 apart. SOF holds * the start/end-of-frame source, MOD0/MOD1 the attached modules 0-31 and - * 32-63. The offsets are index-based so a future DSI helper can drive a - * different instance/controller. + * 32-63. The offsets are index-based so the HDMI and DSI helpers below can + * drive a different instance/controller each. */ #define DISP_MUTEX_EN(id) (0x20 + 0x20 * (id)) #define MUTEX_EN BIT(0) @@ -48,6 +51,49 @@ #define MT8188_MUTEX_MOD_DISP1_DISP_MIXER 30 #define MT8188_MUTEX_MOD_DISP1_DPI1 38 +/* The MT8365 and MT8366 DSI pipelines use instance 0 of the mmsys mutex */ +#define MUTEX_DSI_ID 0 + +/* the MT8365 shifts the end-of-frame selector by 6 instead of 7 */ +#define MT8365_MUTEX_SOF_DSI0 1 +#define MT8365_MUTEX_EOF_DSI0 (MT8365_MUTEX_SOF_DSI0 << 6) + +#define MT8365_MUTEX_MOD_DISP_OVL0 7 +#define MT8365_MUTEX_MOD_DISP_RDMA0 9 +#define MT8365_MUTEX_MOD_DISP_COLOR0 12 +#define MT8365_MUTEX_MOD_DISP_CCORR 13 +#define MT8365_MUTEX_MOD_DISP_AAL 14 +#define MT8365_MUTEX_MOD_DISP_GAMMA 15 +#define MT8365_MUTEX_MOD_DISP_DITHER 16 + +/* the MT8366 drives the DSI straight out of the rdma, without the PQ blocks */ +#define MT8366_MUTEX_SOF_DSI0 1 +#define MT8366_MUTEX_EOF_DSI0 (MT8366_MUTEX_SOF_DSI0 << 7) + +#define MT8366_MUTEX_MOD_DISP_OVL0 0 +#define MT8366_MUTEX_MOD_DISP_RDMA0 4 +#define MT8366_MUTEX_MOD_DISP_DSI0 13 + +/** + * struct mtk_disp_mutex_data - per-SoC mutex data + * @ovl_dsi_enable: set up the mutex of the OVL -> DSI pipeline + * @no_clk: the mutex has no clock of its own + */ +struct mtk_disp_mutex_data { + void (*ovl_dsi_enable)(struct udevice *dev); + bool no_clk; +}; + +/** + * struct mtk_disp_mutex_priv - private data of a mutex + * @comp: common component state, must be the first member + * @data: per-SoC data, NULL on the SoCs without a DSI pipeline + */ +struct mtk_disp_mutex_priv { + struct mtk_disp_comp_priv comp; + const struct mtk_disp_mutex_data *data; +}; + void mt8188_mutex_config_hdmi(struct udevice *dev) { mtk_disp_comp_write(dev, DISP_MUTEX_SOF(MUTEX_HDMI_ID), @@ -65,8 +111,83 @@ void mt8188_mutex_config_hdmi(struct udevice *dev) mtk_disp_comp_write(dev, DISP_MUTEX_EN(MUTEX_HDMI_ID), MUTEX_EN); } +static void mt8365_mutex_ovl_dsi_enable(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_MUTEX_MOD0(MUTEX_DSI_ID), + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_OVL0) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_RDMA0) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_COLOR0) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_CCORR) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_AAL) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_GAMMA) | + MUTEX_MOD_BIT(MT8365_MUTEX_MOD_DISP_DITHER)); + mtk_disp_comp_write(dev, DISP_MUTEX_SOF(MUTEX_DSI_ID), + MT8365_MUTEX_EOF_DSI0 | MT8365_MUTEX_SOF_DSI0); + mtk_disp_comp_write(dev, DISP_MUTEX_EN(MUTEX_DSI_ID), MUTEX_EN); +} + +static void mt8366_mutex_ovl_dsi_enable(struct udevice *dev) +{ + mtk_disp_comp_write(dev, DISP_MUTEX_MOD0(MUTEX_DSI_ID), + MUTEX_MOD_BIT(MT8366_MUTEX_MOD_DISP_OVL0) | + MUTEX_MOD_BIT(MT8366_MUTEX_MOD_DISP_RDMA0) | + MUTEX_MOD_BIT(MT8366_MUTEX_MOD_DISP_DSI0)); + mtk_disp_comp_write(dev, DISP_MUTEX_SOF(MUTEX_DSI_ID), + MT8366_MUTEX_EOF_DSI0 | MT8366_MUTEX_SOF_DSI0); + mtk_disp_comp_write(dev, DISP_MUTEX_EN(MUTEX_DSI_ID), MUTEX_EN); +} + +static const struct mtk_disp_mutex_data mt8365_mutex_data = { + .ovl_dsi_enable = mt8365_mutex_ovl_dsi_enable, + .no_clk = true, +}; + +static const struct mtk_disp_mutex_data mt8366_mutex_data = { + .ovl_dsi_enable = mt8366_mutex_ovl_dsi_enable, +}; + +int mtk_disp_mutex_ovl_dsi_enable(struct udevice *dev) +{ + struct mtk_disp_mutex_priv *mutex = dev_get_priv(dev); + + if (!mutex->data) { + dev_err(dev, "no DSI pipeline on this mutex\n"); + return -EOPNOTSUPP; + } + + mutex->data->ovl_dsi_enable(dev); + + return 0; +} + +static int mtk_disp_mutex_probe(struct udevice *dev) +{ + struct mtk_disp_mutex_priv *mutex = dev_get_priv(dev); + + /* the HDMI pipeline needs no per-SoC data */ + mutex->data = (const struct mtk_disp_mutex_data *)dev_get_driver_data(dev); + + if (mutex->data && mutex->data->no_clk) { + mutex->comp.base = dev_remap_addr(dev); + + return mutex->comp.base ? 0 : -EINVAL; + } + + return mtk_disp_comp_probe(dev); +} + static const struct udevice_id mtk_disp_mutex_ids[] = { - { .compatible = "mediatek,mt8188-disp-mutex" }, + { + .compatible = "mediatek,mt8188-disp-mutex", + }, + { + .compatible = "mediatek,mt8365-disp-mutex", + .data = (ulong)&mt8365_mutex_data, + }, + { + .compatible = "mediatek,mt8366-disp-mutex", + .data = (ulong)&mt8366_mutex_data, + }, { } }; @@ -74,6 +195,6 @@ U_BOOT_DRIVER(mtk_disp_mutex) = { .name = "mtk_disp_mutex", .id = UCLASS_MISC, .of_match = mtk_disp_mutex_ids, - .probe = mtk_disp_comp_probe, - .priv_auto = sizeof(struct mtk_disp_comp_priv), + .probe = mtk_disp_mutex_probe, + .priv_auto = sizeof(struct mtk_disp_mutex_priv), }; diff --git a/drivers/video/mediatek/mtk_disp_mutex.h b/drivers/video/mediatek/mtk_disp_mutex.h index 6b2c8863a20..3b97c7020a2 100644 --- a/drivers/video/mediatek/mtk_disp_mutex.h +++ b/drivers/video/mediatek/mtk_disp_mutex.h @@ -18,4 +18,15 @@ struct udevice; */ void mt8188_mutex_config_hdmi(struct udevice *dev); +/** + * mtk_disp_mutex_ovl_dsi_enable() - set up the mutex of the DSI pipeline + * @dev: mmsys mutex device + * + * Put all the components of the OVL -> DSI pipeline under one mutex + * instance, and start and end their frames on the DSI ones. + * + * Return: 0 on success, -EOPNOTSUPP if the mutex has no DSI pipeline + */ +int mtk_disp_mutex_ovl_dsi_enable(struct udevice *dev); + #endif /* _MTK_DISP_MUTEX_H */ From patchwork Fri Oct 2 04:04:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315162 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=kpgSX6mV; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=NOV946b/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9Sg6vVjz1xvt for ; Sat, 03 Oct 2026 00:01:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 92CDA8131C; Fri, 2 Oct 2026 14:01:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3SbS831_jd5V; Fri, 2 Oct 2026 14:01:48 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org 929BC8136C Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949708; b=bv3cwS6d3bwh070zLskWwSpJ+EB854S2rk9NLLsY1Zv4sQD8hk1Mll7PgdYdtcyBNm0l m6Vejxs4Y1vz1mdxRED+DA8W/39HWLcIoTrqRnoIYFxKJOb8inPf8J8xgfZs1h0Ad7sZf +ZMPMXBPlNkqrslN66uyvn4MoicvXYrloV4X6jK865zZkZ4pBo2HTJFydTvnzGDZ6fjff t3wtdEm7TRlSg3IgPZya0vce7jWijT4UH6zLHEZEHm6vBUBs+cqx2FP15gaFiEdX0qf/p qnwa95vJYt1n8ShBhHQSg8LtQdANWPuud5tNK0QoCMkyCYvKXQCvYGTgI1lShST4ajQ== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949708; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=9DNwsrE3U2dfiu315px5HWnMe5l9lgv18Gl7tog3zsM=; b=LDe/14hBOImolJ9wOaVQP6Tg3+FvSnSV+D3lvBDBDS9cL9rzyhqvlPpyNQ3OsY10ny8L u9sK1nklRpUojNVTAqn/SZv/CXqMfmv1y8adBNruDWsBptozN0yMCcaO2oBNE4zIhSmoe rRn8Nv5S7coz6XrKbl7OWF2RLCy+TWnOJp5Qe8/cnFjn7ZISPTWeaTCPOQcnD3IyHKuEU I+AeflE0gwEVLVsktgkHmOsjB402bsKZruaJZpj8Qjgr5538Igy5S6PHGChklqGWWKFlp Cp9XPgpbvFXFxYnURScyZXNx7PMzNXfNyFKIqsYryGQqx6YoeLjxJ+D/jiFoRISfgzA== ARC-Authentication-Results: i=2; smtp1.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="NOV946b/"; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949708; bh=9DNwsrE3U2dfiu315px5HWnMe5l9lgv18Gl7tog3zsM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kpgSX6mVenFYC1cfLiGz2llqVWe5zU385YvZr9c6/gqeANNzlbs/FgYHiruGZxHB3 s9X/wGk6xSrgXf4J84tqH5npJKv/ACDQQQF09EEQENuX7z0Y9ILLE016ZmiJjck3bn o+9/B2X+ftbn5QEibEm27PVuHNKgpbBzvn36vazQhfojoh5td0RPBrLe56yGe9arho 5hw0G9qIv+M2GhkHT0hgJ4D4vh64sYiw5/+nptg/rVM5jh5TSS+wbAFOZb9gJISUT5 BteeoTXb3DYc8NzGqNLXYpvMBTypKxscLBQaK0QB4ieBX9qZrjq9IAETj80vUGrxzt XyjB76gERiU5Q== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 929BC8136C; Fri, 2 Oct 2026 14:01:47 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 2DAC6435 for ; Fri, 2 Oct 2026 14:01:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 137ED8135B for ; Fri, 2 Oct 2026 14:01:42 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id kUa1L35CkKy5 for ; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org E4B3581361 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:31::10" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949698; b=C7Um6HEBLmWeimIDHj/HmeScYBjgHBO4Ir/sScLpB/f5cYt3TjQnmEeM+EUWLM6BtEuT HTo0GJ3NsJtMu8GTz19gg77wbiwhOG2dPoeDAggwqU0Z1OBgeiZzhLjrQFu1AbDIqd+NU VKOEDXYbsSZ/U7yA5hq0rf13qfpkLgjrviao1AXp9trZU+V/QvRJ4yHuzN3NvJ9xZfNN1 dkGRcDDA8+OlPNxeMdGFexX3QUD8azZKOSAl8thf8jgu5edfQrW2KT8PS+8/5V1ht6da7 qR6N2p1Y0Dqx2ZYKM1sfF3Nlwgfa98BWqpXq6foex6iOsYZcTGlxpNx7h4zpy/hZKpg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949698; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=9DNwsrE3U2dfiu315px5HWnMe5l9lgv18Gl7tog3zsM=; b=qCrR+Dzga6IJEpLGWqwGU2pFZa5q+n93b1IXRGvkhKT+NwyxVxTJWwIuaCYTmEzFjn0t KMqKIRRCXI6XWH1v+FiN9himFdeOMMv8zblCSivhzTdmT+kDHT1m6Ymo1TagCBamjzl4O 7bAnR411Y6d8wDxaTAcffHfbchqmzBvYgR9OX+hdg9GGqFsDwgv2y8iv0PDReRnYyMWxV uS69kyr25k4mH5b47OjOKFQdjrwEhFoNOUY41dMEe/aKIu50drwp2LQ06dCZFIn7Q+5bY IIm3SZyv6gaeXC2LjHmQWUUe8TIT1CBiDgIP1hjLY6oY0QMU3xtYz7GjHLHUWDgTS0Q== ARC-Authentication-Results: i=1; smtp1.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="NOV946b/"; arc=none smtp.remote-ip="2a00:1450:4864:31::10" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:31::10; helo=mail-wm2-x10.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=NOV946b/ Received: from mail-wm2-x10.google.com (mail-wm2-x10.google.com [IPv6:2a00:1450:4864:31::10]) by smtp1.osuosl.org (Postfix) with ESMTPS id E4B3581361 for ; Fri, 2 Oct 2026 14:01:37 +0000 (UTC) Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-49b912d391aso58895385e9.2 for ; Fri, 02 Oct 2026 07:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949695; x=1791554495; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9DNwsrE3U2dfiu315px5HWnMe5l9lgv18Gl7tog3zsM=; b=NOV946b/i9fcvGSgxbWj91JO8wOLbk3RUqsEV87Qg8VOZSNBaQ8S4gRzBnEfR1d6aE TaUOeA7fX/NfiWogriAVnYtoLa6REQ8JnIQ+of7wPzyB3m5f/0sH3G63FIrs9yyRfLHC jsAMjKnWHkfQfsB+tZN8MsbC2cxVGydBcyXw9jZhttjVqRM7dxX8Xgj2eUcE952thOom 9UXYr2h1sf6nC6MNDjAkuRkvKgJgJsIYzja8YGVjEKrDDabFEwUjtEayh2BXgk95pMl6 vdMjxjUIoNFMt3vPSu499Ld6GkOkEyWoEADXD6ul4psgdQy7kWDFZ66YZQG2ZWbuFh3i WIfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949695; x=1791554495; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=9DNwsrE3U2dfiu315px5HWnMe5l9lgv18Gl7tog3zsM=; b=D0803EWyNJ002VTz727yg+ce5dLMA/dljaHwDvs49zqjWKotyP0+E+GP1IIHDskPJ8 d3yH3z4RqVLPtbW+oGd5wiFBgDEh/r0na4Jp9kvHVocR8mG4hkCJledMrE96oeEOKpxA eGQeHerj/kzeI3K/qRz1vRW7aWkGjjVNZtTGbQFYRyPmOUisR7W/BuqmouESzzn7uME+ FurvCKiuS783fuvDpRK2BCcsF6fnZQ83PhsgDgYRkYBNUULIDgcs61klAlFdrcUb4J3V cDhUh3bkqEqi19vdmIwGIDM1be1TbcOvkLtVwtQHjo22Rj8/ZhSw+pxWmDrXq7AFnviH 6y/w== X-Forwarded-Encrypted: i=1; AKwUvBzbz5Eqr8bhKl00divc7ims/bMTh/XegrL+fuRpyclzkVoqawBPoWsiHH7PFUL7LHdkfsW3RHA=@lists.u-boot-project.org X-Gm-Message-State: AFuF++kPWDrVPncx0ZxRqeLTzYSz0PlBaRO2ZCgAgj+JvO/g8iOBj1Jy HTm/XspxbaASdTHIN/izk7BpRyNOMQohXPao/p8+PAktERaPTbvnS/Jt8plWmFroGR4= X-Gm-Gg: AYBFou2UlEkOeqt58Lhx2fPNybGXNeDliIlJQwstLeNFRGTjG3syMxSy/ElS6V6Qsd3 2zlP0pBwQmOql6ZzzlAK1TWLvAXmQkn8pxRhXj0RzHDoqubq/ngS0WlhK6Q0UbN0Y0lWzkwTlcp 20OiwwkuV0518VMhcHjKNq++0rQ6jVMdkpFM2PwZY6r/TmVZxLybRFKPosT+/FAxJbDhrTRGmSn 1yB2uGBXGFftlfHV6R7P3U++/G8UlZZ4msQaRLbBDAulNxJDXsJeEGQ2SYwJi8Dykres+sbdz4T TeI1GvFJvXZB0ET5/GNN2BgwAnlQj6i97Ip9rIIM0daQVs5w8ebJxc0OPo3ag13svqtjuiSdqq5 Xi4wTrUR7Wu6XalCm49zrEHzSpBrlJgMRUqiwoQ1cqEM+uDApatr+gTuHQomhjd2FL2rmRF/+ph Pc65kl6IxIwGDm4jTL5FEzLujoDnXcI4mto+TmWFJcG910Yx3AgAAHi95qL+UlD6VSOy1nbKrKq 3udxACmbMoThrFQ46IKjObM1cnJSj+SoxdzlaHvsreqknZCYh5q/nJBz/AApNbwhhAGPqdPv/d5 bCFeR+1FPu5RixUlmP0ETsTBB6zsvdMqtYEnjl0Kf66si+B1MN53M5Y2AGyCBnrnKg== X-Received: by 2002:a05:600c:34c4:b0:4a0:1c16:d6f6 with SMTP id 5b1f17b1804b1-4a0276ad351mr50535585e9.24.1790949695069; Fri, 02 Oct 2026 07:01:35 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:34 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:04:02 +0200 Subject: [PATCH v2 11/13] video: mediatek: add dsi driver MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-11-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org The DSI controller is the last stage of the MT8365 and MT8366 display pipelines: it serialises the pixel stream coming out of the pipeline onto the MIPI D-PHY lanes, and carries the DCS commands the panel needs to come up. Add a video uclass driver bringing up that whole pipeline: power the D-PHY and the controller up with its D-PHY timings, ungate the components, route the overlay to the DSI through the mmsys, start the components in order, then program the video timings and the pixel stream format from the panel's own description, and start the video stream once the panel and its backlight are on. The components feeding the DSI are listed in the per-compatible data, as in the Linux main paths: the MT8365 runs the stream through the colour pipeline, the MT8366 straight from the rdma. The driver is also the MIPI DSI host the panel talks to: the panel init sequence goes out through the controller's command queue, in command mode, before the video stream is started. Linux cannot take over a running pipeline, so the driver shuts it down in its remove callback, run before booting the OS (DM_FLAG_OS_PREPARE). The driver matches "mediatek,mt8365-dsi" rather than the "mediatek,mt8183-dsi" fallback the MT8365 dsi0 node carries, since the path feeding the DSI is SoC specific, and "mediatek,mt8366-dsi", which the MT8366 node carries on its own as that SoC is not upstream yet. Beyond the path, the two generations differ in the offset of the command queues, in the mt8183-style shadow register control, which the MT8366 does not have, and in the command queue size of the long packets, which the MT8366 has to set itself (CMDQ_SIZE_SEL): all of it is per-compatible data. The objects both paths need move out of the HDMI object list into Kconfig symbols of their own: VIDEO_MEDIATEK_DISP_COMP for the component helpers and the mutex, selected by both paths, and VIDEO_MEDIATEK_DPI for the DPI, selected by the HDMI path. VIDEO_MEDIATEK_DISP_PIPELINE covers the mmsys routing and the display rdma of the DSI path. Signed-off-by: Julien Stephan --- drivers/video/mediatek/Kconfig | 32 ++ drivers/video/mediatek/Makefile | 19 +- drivers/video/mediatek/mtk_dsi.c | 1184 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1232 insertions(+), 3 deletions(-) diff --git a/drivers/video/mediatek/Kconfig b/drivers/video/mediatek/Kconfig index a10f2360391..693582236ae 100644 --- a/drivers/video/mediatek/Kconfig +++ b/drivers/video/mediatek/Kconfig @@ -4,6 +4,36 @@ # # Author: Julien Stephan +# Display pipeline component helpers, selected by the output paths below +config VIDEO_MEDIATEK_DISP_COMP + bool + +# mmsys routing and display RDMA, used by the DSI path +config VIDEO_MEDIATEK_DISP_PIPELINE + bool + +# DPI timing generator programming, shared by the DPI and HDMI paths +config VIDEO_MEDIATEK_DPI + bool + +config VIDEO_MEDIATEK_DSI + bool "DSI video path for MediaTek SoCs" + depends on VIDEO && ARCH_MEDIATEK + depends on ARM64 && CLK && PHY && POWER_DOMAIN + select MISC + select MTK_SMI + select PANEL + select PHY_MTK_MIPI_DSI + select SYSCON + select VIDEO_MEDIATEK_DISP_COMP + select VIDEO_MEDIATEK_DISP_PIPELINE + select VIDEO_MIPI_DSI + help + Enable support for the DSI controller found on MediaTek SoCs such + as the MT8365 and the MT8366. The driver drives the mmsys display + pipeline (overlay, RDMA and, on the SoCs having one, the colour + pipeline) to scan out the U-Boot framebuffer to a DSI panel. + config VIDEO_MEDIATEK_HDMI bool "Video HDMI Support for MediaTek SoCs" depends on VIDEO && ARCH_MEDIATEK @@ -14,6 +44,8 @@ config VIDEO_MEDIATEK_HDMI select MTK_SMI select PHY_MTK_HDMI select SYS_I2C_DDC_MTK + select VIDEO_MEDIATEK_DISP_COMP + select VIDEO_MEDIATEK_DPI help Enable support for the HDMI TX output found on recent MediaTek SoCs such as the MT8188. The driver reads the EDID of the diff --git a/drivers/video/mediatek/Makefile b/drivers/video/mediatek/Makefile index 38ab13e94fd..9de9a9c78f1 100644 --- a/drivers/video/mediatek/Makefile +++ b/drivers/video/mediatek/Makefile @@ -4,12 +4,25 @@ # # Author: Julien Stephan +obj-$(CONFIG_VIDEO_MEDIATEK_DISP_COMP) += mtk_disp_comp.o \ + mtk_disp_mutex.o + +obj-$(CONFIG_VIDEO_MEDIATEK_DISP_PIPELINE) += mtk_ddp.o \ + mtk_disp_rdma.o + +obj-$(CONFIG_VIDEO_MEDIATEK_DPI) += mtk_dpi.o + +obj-$(CONFIG_VIDEO_MEDIATEK_DSI) += mtk_disp_aal.o \ + mtk_disp_ccorr.o \ + mtk_disp_color.o \ + mtk_disp_dither.o \ + mtk_disp_gamma.o \ + mtk_disp_ovl.o \ + mtk_dsi.o + obj-$(CONFIG_VIDEO_MEDIATEK_HDMI) += \ - mtk_disp_comp.o \ mtk_disp_merge.o \ - mtk_disp_mutex.o \ mtk_disp_padding.o \ - mtk_dpi.o \ mtk_ethdr.o \ mtk_hdmi.o \ mtk_mdp_rdma.o diff --git a/drivers/video/mediatek/mtk_dsi.c b/drivers/video/mediatek/mtk_dsi.c new file mode 100644 index 00000000000..a93e99d66ad --- /dev/null +++ b/drivers/video/mediatek/mtk_dsi.c @@ -0,0 +1,1184 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek Video DSI support + * + * Copyright (c) 2026 BayLibre, SAS. + * Author: Julien Masson + * Julien Stephan + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mtk_ddp.h" +#include "mtk_disp_aal.h" +#include "mtk_disp_ccorr.h" +#include "mtk_disp_color.h" +#include "mtk_disp_comp.h" +#include "mtk_disp_dither.h" +#include "mtk_disp_gamma.h" +#include "mtk_disp_mutex.h" +#include "mtk_disp_ovl.h" +#include "mtk_disp_rdma.h" + +DECLARE_GLOBAL_DATA_PTR; + +#define MTK_DSI_MAX_WIDTH 3840 +#define MTK_DSI_MAX_HEIGHT 2160 + +/* the longest of the DSI paths below */ +#define MTK_DSI_MAX_COMPS 7 + +/* one microsecond apart, as many as the engine may need to take a RACK */ +#define MTK_DSI_RACK_RETRIES 1000 + +#define DSI_START 0x00 + +#define DSI_INTEN 0x08 +#define LPRX_RD_RDY_INT_FLAG BIT(0) +#define CMD_DONE_INT_FLAG BIT(1) +#define VM_DONE_INT_FLAG BIT(3) + +/* Same flag layout as DSI_INTEN, plus the engine busy bit */ +#define DSI_INTSTA 0x0c +#define DSI_BUSY BIT(31) + +#define DSI_CON_CTRL 0x10 +#define DSI_RESET BIT(0) +#define DSI_EN BIT(1) +#define DPHY_RESET BIT(2) + +#define DSI_MODE_CTRL 0x14 +#define MODE_CON GENMASK(1, 0) +#define CMD_MODE 0 +#define SYNC_PULSE_MODE 1 +#define SYNC_EVENT_MODE 2 +#define BURST_MODE 3 + +#define DSI_TXRX_CTRL 0x18 +#define LANE_NUM GENMASK(5, 2) +#define DIS_EOT BIT(6) +#define HSTX_CKLP_EN BIT(16) + +#define DSI_PSCTRL 0x1c +#define DSI_PS_WC GENMASK(13, 0) +#define DSI_PS_SEL GENMASK(17, 16) +#define PACKED_PS_16BIT_RGB565 0 +#define PACKED_PS_18BIT_RGB666 1 +#define LOOSELY_PS_24BIT_RGB666 2 +#define PACKED_PS_24BIT_RGB888 3 + +#define DSI_VSA_NL 0x20 +#define DSI_VBP_NL 0x24 +#define DSI_VFP_NL 0x28 +#define DSI_VACT_NL 0x2C +#define DSI_SIZE_CON 0x38 +#define DSI_SIZE_CON_WIDTH GENMASK(15, 0) +#define DSI_SIZE_CON_HEIGHT GENMASK(31, 16) +#define DSI_HSA_WC 0x50 +#define DSI_HBP_WC 0x54 +#define DSI_HFP_WC 0x58 + +#define DSI_CMDQ_SIZE 0x60 +#define CMDQ_SIZE GENMASK(5, 0) +#define CMDQ_SIZE_SEL BIT(15) + +#define DSI_HSTX_CKL_WC 0x64 + +#define DSI_RX_DATA0 0x74 + +#define DSI_RACK 0x84 +#define RACK BIT(0) + +#define VM_CMD_EN BIT(0) +#define TS_VFP_EN BIT(5) + +#define DSI_PHY_LCCON 0x104 +#define LC_HS_TX_EN BIT(0) +#define LC_ULPM_EN BIT(1) +#define LC_WAKEUP_EN BIT(2) + +#define DSI_PHY_LD0CON 0x108 +#define LD0_HS_TX_EN BIT(0) +#define LD0_ULPM_EN BIT(1) +#define LD0_WAKEUP_EN BIT(2) + +#define DSI_PHY_TIMECON0 0x110 +#define LPX GENMASK(7, 0) +#define HS_PREP GENMASK(15, 8) +#define HS_ZERO GENMASK(23, 16) +#define HS_TRAIL GENMASK(31, 24) + +#define DSI_PHY_TIMECON1 0x114 +#define TA_GO GENMASK(7, 0) +#define TA_SURE GENMASK(15, 8) +#define TA_GET GENMASK(23, 16) +#define DA_HS_EXIT GENMASK(31, 24) + +#define DSI_PHY_TIMECON2 0x118 +#define DA_HS_SYNC GENMASK(15, 8) +#define CLK_ZERO GENMASK(23, 16) +#define CLK_TRAIL GENMASK(31, 24) + +#define DSI_PHY_TIMECON3 0x11c +#define CLK_HS_PREP GENMASK(7, 0) +#define CLK_HS_POST GENMASK(15, 8) +#define CLK_HS_EXIT GENMASK(23, 16) + +/* + * mt8183-style shadow control. The MT8366 follows the downstream mt8188 + * data, which has none, unlike the upstream Linux mt8188 one (at 0xc00). + */ +#define DSI_SHADOW_DEBUG 0x190 +#define FORCE_COMMIT BIT(0) +#define BYPASS_SHADOW BIT(1) + +/* Layout of the first word of the command queue (at data->host_cmdq_off) */ +#define CMDQ_CONFIG GENMASK(7, 0) +#define SHORT_PACKET 0 +#define LONG_PACKET 2 +#define BTA BIT(2) +#define HSTX BIT(3) +#define CMDQ_DATA_ID GENMASK(15, 8) +#define CMDQ_DATA_0 GENMASK(23, 16) +#define CMDQ_DATA_1 GENMASK(31, 24) +/* For a long packet DATA_0/DATA_1 together hold the 16-bit word count */ +#define CMDQ_WC GENMASK(31, 16) + +#define MTK_DSI_HOST_IS_READ(type) \ + ((type == MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM) || \ + (type == MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM) || \ + (type == MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \ + (type == MIPI_DSI_DCS_READ)) + +/* D-PHY timings, in HS byte-clock cycles, as computed by the Linux driver */ +struct mtk_dsi_phy_timing { + u32 lpx; + u32 da_hs_prepare; + u32 da_hs_zero; + u32 da_hs_trail; + u32 ta_go; + u32 ta_sure; + u32 ta_get; + u32 da_hs_exit; + u32 clk_hs_prepare; + u32 clk_hs_post; + u32 clk_hs_trail; + u32 clk_hs_zero; + u32 clk_hs_exit; +}; + +struct mtk_dsi_priv { + void __iomem *base; + struct udevice *dev; + const struct mtk_dsi_data *data; + struct udevice *comps[MTK_DSI_MAX_COMPS]; + struct udevice *mutex; + void __iomem *mmsys_base; + struct phy phy; + struct udevice *panel; + struct mipi_dsi_host dsi_host; + struct mipi_dsi_device mipi; + struct clk *engine_clk; + struct clk *digital_clk; + struct mtk_dsi_phy_timing phy_timing; + u64 data_rate; +}; + +/** + * struct mtk_dsi_comp - a component of the path feeding the DSI + * @alias: device tree alias of the component + * @config: set the frame size of the component + * @start: start the component + */ +struct mtk_dsi_comp { + const char *alias; + void (*config)(struct udevice *dev, const struct display_timing *timing); + void (*start)(struct udevice *dev); +}; + +/** + * struct mtk_dsi_data - per-SoC DSI data + * @path: components feeding the DSI, from the overlay, which must come first + * @path_len: number of components in @path, MTK_DSI_MAX_COMPS at most + * @ddp_connect: route the mmsys muxes along @path + * @cmdq_long_packet_ctl: the command queue size is not set automatically for + * long packets, CMDQ_SIZE_SEL must be set + * @shadow_dbg_off: offset of the shadow control, zero on the SoCs without it + * @vm_cmdq_off: offset of the video mode command register + * @host_cmdq_off: offset of the host command queue + */ +struct mtk_dsi_data { + const struct mtk_dsi_comp *path; + unsigned int path_len; + void (*ddp_connect)(void __iomem *mmsys_base); + bool cmdq_long_packet_ctl; + u32 shadow_dbg_off; + u32 vm_cmdq_off; + u32 host_cmdq_off; +}; + +/* the paths are the main ones of the Linux mtk_drm_drv driver data */ +static const struct mtk_dsi_comp mt8365_dsi_path[] = { + { "ovl0", mtk_ovl_config, mtk_ovl_start }, + { "rdma0", mtk_rdma_config, mtk_rdma_start }, + { "color0", mtk_color_config, mtk_color_start }, + { "ccorr0", mtk_ccorr_config, mtk_ccorr_start }, + { "aal0", mtk_aal_config, mtk_aal_start }, + { "gamma0", mtk_gamma_config, mtk_gamma_start }, + { "dither0", mtk_dither_config, mtk_dither_start }, +}; + +static const struct mtk_dsi_comp mt8366_dsi_path[] = { + { "ovl0", mtk_ovl_config, mtk_ovl_start }, + { "rdma0", mtk_rdma_config, mtk_rdma_start }, +}; + +static const struct mtk_dsi_data mt8365_dsi_data = { + .path = mt8365_dsi_path, + .path_len = ARRAY_SIZE(mt8365_dsi_path), + .ddp_connect = mt8365_ddp_ovl_to_dsi, + .shadow_dbg_off = DSI_SHADOW_DEBUG, + .vm_cmdq_off = 0x130, + .host_cmdq_off = 0x200, +}; + +static const struct mtk_dsi_data mt8366_dsi_data = { + .path = mt8366_dsi_path, + .path_len = ARRAY_SIZE(mt8366_dsi_path), + .ddp_connect = mt8366_ddp_ovl_to_dsi, + .cmdq_long_packet_ctl = true, + .vm_cmdq_off = 0x200, + .host_cmdq_off = 0xd00, +}; + +static inline struct mtk_dsi_priv *host_to_dsi(struct mipi_dsi_host *host) +{ + return container_of(host, struct mtk_dsi_priv, dsi_host); +} + +static void mtk_dsi_mask(struct mtk_dsi_priv *dsi, u32 offset, u32 val, u32 mask) +{ + void __iomem *addr = dsi->base + offset; + u32 tmp = readl(addr) & ~mask; + + tmp |= (val & mask); + writel(tmp, addr); +} + +static void mtk_dsi_shadow_debug(struct mtk_dsi_priv *dsi) +{ + writel(FORCE_COMMIT | BYPASS_SHADOW, dsi->base + dsi->data->shadow_dbg_off); +} + +static void mtk_dsi_enable(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, DSI_EN); +} + +static void mtk_dsi_disable(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_CON_CTRL, 0, DSI_EN); +} + +static void mtk_dsi_reset_engine(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET); + mtk_dsi_mask(dsi, DSI_CON_CTRL, 0, DSI_RESET); +} + +static void mtk_dsi_reset_dphy(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_CON_CTRL, DPHY_RESET, DPHY_RESET); + mtk_dsi_mask(dsi, DSI_CON_CTRL, 0, DPHY_RESET); +} + +static void mtk_dsi_clk_ulp_mode_leave(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_PHY_LCCON, 0, LC_ULPM_EN); + mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_WAKEUP_EN, LC_WAKEUP_EN); + mtk_dsi_mask(dsi, DSI_PHY_LCCON, 0, LC_WAKEUP_EN); +} + +static void mtk_dsi_clk_ulp_mode_enter(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_PHY_LCCON, 0, LC_HS_TX_EN); + mtk_dsi_mask(dsi, DSI_PHY_LCCON, 0, LC_ULPM_EN); +} + +static void mtk_dsi_lane0_ulp_mode_enter(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_PHY_LD0CON, 0, LD0_HS_TX_EN); + mtk_dsi_mask(dsi, DSI_PHY_LD0CON, 0, LD0_ULPM_EN); +} + +static void mtk_dsi_lane0_ulp_mode_leave(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, DSI_PHY_LD0CON, 0, LD0_ULPM_EN); + mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_WAKEUP_EN, LD0_WAKEUP_EN); + mtk_dsi_mask(dsi, DSI_PHY_LD0CON, 0, LD0_WAKEUP_EN); +} + +static bool mtk_dsi_clk_hs_state(struct mtk_dsi_priv *dsi) +{ + return readl(dsi->base + DSI_PHY_LCCON) & LC_HS_TX_EN; +} + +static void mtk_dsi_clk_hs_mode(struct mtk_dsi_priv *dsi, bool enter) +{ + if (enter && !mtk_dsi_clk_hs_state(dsi)) + mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_HS_TX_EN, LC_HS_TX_EN); + else if (!enter && mtk_dsi_clk_hs_state(dsi)) + mtk_dsi_mask(dsi, DSI_PHY_LCCON, 0, LC_HS_TX_EN); +} + +static void mtk_dsi_phy_timconfig(struct mtk_dsi_priv *dsi) +{ + struct mtk_dsi_phy_timing *timing = &dsi->phy_timing; + u32 data_rate_mhz = DIV_ROUND_UP_ULL(dsi->data_rate, 1000000); + u32 timcon0, timcon1, timcon2, timcon3; + + timing->lpx = (60 * data_rate_mhz / (8 * 1000)) + 1; + timing->da_hs_prepare = (80 * data_rate_mhz + 4 * 1000) / 8000; + timing->da_hs_zero = (170 * data_rate_mhz + 10 * 1000) / 8000 + 1 - + timing->da_hs_prepare; + timing->da_hs_trail = timing->da_hs_prepare + 1; + + timing->ta_go = 4 * timing->lpx - 2; + timing->ta_sure = timing->lpx + 2; + timing->ta_get = 4 * timing->lpx; + timing->da_hs_exit = 2 * timing->lpx + 1; + + timing->clk_hs_prepare = 70 * data_rate_mhz / (8 * 1000); + timing->clk_hs_post = timing->clk_hs_prepare + 8; + timing->clk_hs_trail = timing->clk_hs_prepare; + timing->clk_hs_zero = timing->clk_hs_trail * 4; + timing->clk_hs_exit = 2 * timing->clk_hs_trail; + + timcon0 = FIELD_PREP(LPX, timing->lpx) | + FIELD_PREP(HS_PREP, timing->da_hs_prepare) | + FIELD_PREP(HS_ZERO, timing->da_hs_zero) | + FIELD_PREP(HS_TRAIL, timing->da_hs_trail); + + timcon1 = FIELD_PREP(TA_GO, timing->ta_go) | + FIELD_PREP(TA_SURE, timing->ta_sure) | + FIELD_PREP(TA_GET, timing->ta_get) | + FIELD_PREP(DA_HS_EXIT, timing->da_hs_exit); + + timcon2 = FIELD_PREP(DA_HS_SYNC, 1) | + FIELD_PREP(CLK_ZERO, timing->clk_hs_zero) | + FIELD_PREP(CLK_TRAIL, timing->clk_hs_trail); + + timcon3 = FIELD_PREP(CLK_HS_PREP, timing->clk_hs_prepare) | + FIELD_PREP(CLK_HS_POST, timing->clk_hs_post) | + FIELD_PREP(CLK_HS_EXIT, timing->clk_hs_exit); + + writel(timcon0, dsi->base + DSI_PHY_TIMECON0); + writel(timcon1, dsi->base + DSI_PHY_TIMECON1); + writel(timcon2, dsi->base + DSI_PHY_TIMECON2); + writel(timcon3, dsi->base + DSI_PHY_TIMECON3); +} + +static void mtk_dsi_set_interrupt_enable(struct mtk_dsi_priv *dsi) +{ + u32 inten = LPRX_RD_RDY_INT_FLAG | CMD_DONE_INT_FLAG | VM_DONE_INT_FLAG; + + writel(inten, dsi->base + DSI_INTEN); +} + +static void mtk_dsi_set_vm_cmd(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_mask(dsi, dsi->data->vm_cmdq_off, VM_CMD_EN, VM_CMD_EN); + mtk_dsi_mask(dsi, dsi->data->vm_cmdq_off, TS_VFP_EN, TS_VFP_EN); +} + +static void mtk_dsi_rxtx_control(struct mtk_dsi_priv *dsi) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + u32 lane_bits = 0, reg; + u8 i; + + /* one bit per enabled data lane, four lanes at most */ + for (i = 0; i < plat->lanes; i++) + lane_bits |= BIT(i); + + reg = FIELD_PREP(LANE_NUM, lane_bits); + + if (plat->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) + reg |= HSTX_CKLP_EN; + + if (plat->mode_flags & MIPI_DSI_MODE_EOT_PACKET) + reg |= DIS_EOT; + + writel(reg, dsi->base + DSI_TXRX_CTRL); +} + +static void mtk_dsi_lane_ready(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_rxtx_control(dsi); + udelay(100); + mtk_dsi_reset_dphy(dsi); + mtk_dsi_clk_ulp_mode_leave(dsi); + mtk_dsi_lane0_ulp_mode_leave(dsi); + mtk_dsi_clk_hs_mode(dsi, false); + udelay(3000); +} + +static void mtk_dsi_ps_control(struct mtk_dsi_priv *dsi, + const struct display_timing *timing) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + u32 bpp, ps_sel, ps_wc; + + switch (plat->format) { + case MIPI_DSI_FMT_RGB666: + ps_sel = LOOSELY_PS_24BIT_RGB666; + bpp = 3; + break; + case MIPI_DSI_FMT_RGB666_PACKED: + ps_sel = PACKED_PS_18BIT_RGB666; + bpp = 3; + break; + case MIPI_DSI_FMT_RGB565: + ps_sel = PACKED_PS_16BIT_RGB565; + bpp = 2; + break; + case MIPI_DSI_FMT_RGB888: + default: + ps_sel = PACKED_PS_24BIT_RGB888; + bpp = 3; + break; + } + + ps_wc = FIELD_PREP(DSI_PS_WC, timing->hactive.typ * bpp); + + /* + * The clock lane needs the same word count as the pixel stream, or it + * never sustains HS for the whole data burst and no video frame ever + * completes. + */ + writel(ps_wc, dsi->base + DSI_HSTX_CKL_WC); + + writel(FIELD_PREP(DSI_PS_SEL, ps_sel) | ps_wc, dsi->base + DSI_PSCTRL); +} + +static void mtk_dsi_config_vdo_timing(struct mtk_dsi_priv *dsi, + const struct display_timing *timing) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + const struct mtk_dsi_phy_timing *phy = &dsi->phy_timing; + u32 hsa, hbp, hfp, bpp; + u32 delta, front_back, data_phy_cycles, data_phy_cycles_byte; + + bpp = (plat->format == MIPI_DSI_FMT_RGB565) ? 2 : 3; + + writel(timing->vsync_len.typ, dsi->base + DSI_VSA_NL); + writel(timing->vback_porch.typ, dsi->base + DSI_VBP_NL); + writel(timing->vfront_porch.typ, dsi->base + DSI_VFP_NL); + writel(timing->vactive.typ, dsi->base + DSI_VACT_NL); + + writel(FIELD_PREP(DSI_SIZE_CON_WIDTH, timing->hactive.typ) | + FIELD_PREP(DSI_SIZE_CON_HEIGHT, timing->vactive.typ), + dsi->base + DSI_SIZE_CON); + + hsa = (timing->hsync_len.typ * bpp - 10); + + if (plat->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + hbp = timing->hback_porch.typ * bpp - 10; + else + hbp = (timing->hback_porch.typ + timing->hsync_len.typ) * bpp - 10; + + /* + * Number of D-PHY HS byte-clock cycles the panel needs to switch the + * data lanes from LP to HS and back. It must be subtracted out of the + * HFP/HBP word counts or the horizontal blanking period ends up far + * too long. + */ + data_phy_cycles = phy->lpx + phy->da_hs_prepare + phy->da_hs_zero + + phy->da_hs_exit + 3; + + /* burst/sync-pulse base overhead, plus 2 when the EOT packet is sent */ + delta = (plat->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) ? 18 : 12; + delta += (plat->mode_flags & MIPI_DSI_MODE_EOT_PACKET) ? 0 : 2; + + /* + * The d-phy allowance is shared between the two porches in proportion + * to their word counts, so scale by the byte values rather than by the + * pixel counts they were derived from. + */ + hfp = timing->hfront_porch.typ * bpp; + front_back = hfp + hbp; + data_phy_cycles_byte = data_phy_cycles * plat->lanes + delta; + + if (front_back > data_phy_cycles_byte) { + hfp -= data_phy_cycles_byte * hfp / front_back; + hbp -= data_phy_cycles_byte * hbp / front_back; + } else { + dev_warn(dsi->dev, "HFP + HBP less than d-phy, FPS will under 60Hz\n"); + } + + writel(hsa, dsi->base + DSI_HSA_WC); + writel(hbp, dsi->base + DSI_HBP_WC); + writel(hfp, dsi->base + DSI_HFP_WC); + + mtk_dsi_ps_control(dsi, timing); +} + +static void mtk_dsi_set_display_mode(struct mtk_dsi_priv *dsi, + const struct display_timing *timing) +{ + struct video_priv *priv = dev_get_uclass_priv(dsi->dev); + + priv->xsize = timing->hactive.typ; + priv->ysize = timing->vactive.typ; + priv->bpix = VIDEO_BPP32; + + mtk_dsi_config_vdo_timing(dsi, timing); +} + +static void mtk_dsi_set_mode(struct mtk_dsi_priv *dsi) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + u32 vid_mode = CMD_MODE; + + if (plat->mode_flags & MIPI_DSI_MODE_VIDEO) { + if (plat->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + vid_mode = BURST_MODE; + else if (plat->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) + vid_mode = SYNC_PULSE_MODE; + else + vid_mode = SYNC_EVENT_MODE; + } + + writel(vid_mode, dsi->base + DSI_MODE_CTRL); +} + +static void mtk_dsi_start(struct mtk_dsi_priv *dsi) +{ + writel(0, dsi->base + DSI_START); + writel(1, dsi->base + DSI_START); +} + +static void mtk_dsi_stop(struct mtk_dsi_priv *dsi) +{ + writel(0, dsi->base + DSI_START); +} + +static void mtk_dsi_output_enable(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_set_mode(dsi); + + /* The panel's DCS init goes out in LP, so raise the clock lane only now. */ + mtk_dsi_clk_hs_mode(dsi, true); + + mtk_dsi_start(dsi); +} + +static int mtk_dsi_power_on(struct mtk_dsi_priv *dsi, + const struct display_timing *timing) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + struct phy_configure_opts_mipi_dphy opts = { }; + int ret, bit_per_pixel; + unsigned int i; + + bit_per_pixel = mipi_dsi_pixel_format_to_bpp(plat->format); + if (bit_per_pixel < 0) { + dev_err(dsi->dev, "unknown MIPI DSI format %d\n", plat->format); + return bit_per_pixel; + } + + dsi->data_rate = DIV_ROUND_UP_ULL((u64)timing->pixelclock.typ * + bit_per_pixel, plat->lanes); + + opts.hs_clk_rate = dsi->data_rate; + opts.lanes = plat->lanes; + + ret = generic_phy_configure(&dsi->phy, &opts); + if (ret) { + dev_err(dsi->dev, "failed to set the PHY to %llu Hz: %d\n", + dsi->data_rate, ret); + return ret; + } + + ret = generic_phy_power_on(&dsi->phy); + if (ret) { + dev_err(dsi->dev, "failed to power on the PHY: %d\n", ret); + return ret; + } + + ret = clk_enable(dsi->engine_clk); + if (ret) { + dev_err(dsi->dev, "failed to enable engine clk: %d\n", ret); + goto err_phy_power_off; + } + + ret = clk_enable(dsi->digital_clk); + if (ret) { + dev_err(dsi->dev, "failed to enable digital clk: %d\n", ret); + goto err_disable_engine_clk; + } + + ret = mtk_disp_comp_enable(dsi->mutex); + if (ret) { + dev_err(dsi->dev, "failed to enable mutex: %d\n", ret); + goto err_disable_digital_clk; + } + + for (i = 0; i < dsi->data->path_len; i++) { + ret = mtk_disp_comp_enable(dsi->comps[i]); + if (ret) { + dev_err(dsi->dev, "failed to enable %s: %d\n", + dsi->data->path[i].alias, ret); + goto err_disable_comps; + } + } + + mtk_dsi_enable(dsi); + + if (dsi->data->shadow_dbg_off) + mtk_dsi_shadow_debug(dsi); + + mtk_dsi_reset_engine(dsi); + + mtk_dsi_phy_timconfig(dsi); + + mtk_dsi_set_vm_cmd(dsi); + + mtk_dsi_set_interrupt_enable(dsi); + + return 0; + +err_disable_comps: + while (i--) + mtk_disp_comp_disable(dsi->comps[i]); + mtk_disp_comp_disable(dsi->mutex); +err_disable_digital_clk: + clk_disable(dsi->digital_clk); +err_disable_engine_clk: + clk_disable(dsi->engine_clk); +err_phy_power_off: + generic_phy_power_off(&dsi->phy); + + return ret; +} + +/* + * Linux re-enables and resets the engine whenever one of its waits times + * out; do the same, so that a command left unfinished does not wedge all + * the ones after it. + */ +static void mtk_dsi_reset_after_timeout(struct mtk_dsi_priv *dsi) +{ + mtk_dsi_enable(dsi); + mtk_dsi_reset_engine(dsi); +} + +static int mtk_dsi_wait_for_idle(struct mtk_dsi_priv *dsi) +{ + u32 val; + int ret; + + ret = readl_poll_timeout(dsi->base + DSI_INTSTA, val, !(val & DSI_BUSY), + 2000000); + if (ret) + mtk_dsi_reset_after_timeout(dsi); + + return ret; +} + +/* + * Acknowledge the packet the engine has just flagged: it keeps BUSY set + * until the acknowledge is taken. Linux spins here in its interrupt + * handler; U-Boot has no way out of a wedged engine, so give up eventually. + */ +static int mtk_dsi_ack_packet(struct mtk_dsi_priv *dsi) +{ + u32 tmp; + int i; + + for (i = 0; i < MTK_DSI_RACK_RETRIES; i++) { + mtk_dsi_mask(dsi, DSI_RACK, RACK, RACK); + + tmp = readl(dsi->base + DSI_INTSTA); + if (!(tmp & DSI_BUSY)) + return 0; + + udelay(1); + } + + return -ETIME; +} + +/* + * Wait for one of the @flag interrupt flags, 2 s at most as in Linux, then + * acknowledge and clear every flag raised, as the Linux interrupt handler + * does. + */ +static int mtk_dsi_wait_for_done(struct mtk_dsi_priv *dsi, u32 flag) +{ + u32 all = LPRX_RD_RDY_INT_FLAG | CMD_DONE_INT_FLAG | VM_DONE_INT_FLAG; + u32 status; + int ret; + + ret = readl_poll_timeout(dsi->base + DSI_INTSTA, status, status & flag, + 2000000); + if (ret) { + dev_err(dsi->dev, "wait_for_done timeout: INTSTA=0x%08x\n", + status); + goto reset; + } + + ret = mtk_dsi_ack_packet(dsi); + mtk_dsi_mask(dsi, DSI_INTSTA, 0, status & all); + if (ret) { + dev_err(dsi->dev, "engine still busy after %d acknowledges\n", + MTK_DSI_RACK_RETRIES); + goto reset; + } + + return 0; + +reset: + mtk_dsi_reset_after_timeout(dsi); + + return ret; +} + +static void mtk_dsi_switch_to_cmd_mode(struct mtk_dsi_priv *dsi) +{ + if (!(readl(dsi->base + DSI_MODE_CTRL) & MODE_CON)) + return; + + writel(CMD_MODE, dsi->base + DSI_MODE_CTRL); + + /* the engine leaves the video mode at the end of the current frame */ + if (mtk_dsi_wait_for_done(dsi, VM_DONE_INT_FLAG)) + dev_warn(dsi->dev, "failed to switch to command mode\n"); +} + +static void mtk_dsi_power_off(struct mtk_dsi_priv *dsi) +{ + unsigned int i; + + /* undo mtk_dsi_power_on() and the lane setup, in the order Linux does */ + mtk_dsi_stop(dsi); + mtk_dsi_switch_to_cmd_mode(dsi); + mtk_dsi_reset_engine(dsi); + mtk_dsi_lane0_ulp_mode_enter(dsi); + mtk_dsi_clk_ulp_mode_enter(dsi); + /* no lane enabled pulls the MIPI lines down */ + writel(0, dsi->base + DSI_TXRX_CTRL); + mtk_dsi_disable(dsi); + + for (i = dsi->data->path_len; i--; ) + mtk_disp_comp_disable(dsi->comps[i]); + + mtk_disp_comp_disable(dsi->mutex); + clk_disable(dsi->digital_clk); + clk_disable(dsi->engine_clk); + generic_phy_power_off(&dsi->phy); +} + +static void mtk_dsi_cmdq(struct mtk_dsi_priv *dsi, const struct mipi_dsi_msg *msg) +{ + const char *tx_buf = msg->tx_buf; + u8 config, cmdq_size, cmdq_off, type = msg->type; + u32 reg_val, cmdq_mask, i; + u32 reg_cmdq_off = dsi->data->host_cmdq_off; + + if (MTK_DSI_HOST_IS_READ(type)) + config = BTA; + else + config = (msg->tx_len > 2) ? LONG_PACKET : SHORT_PACKET; + + if (!(msg->flags & MIPI_DSI_MSG_USE_LPM)) + config |= HSTX; + + if (msg->tx_len > 2) { + cmdq_size = 1 + (msg->tx_len + 3) / 4; + cmdq_off = 4; + cmdq_mask = CMDQ_CONFIG | CMDQ_DATA_ID | CMDQ_DATA_0 | CMDQ_DATA_1; + reg_val = FIELD_PREP(CMDQ_WC, msg->tx_len) | + FIELD_PREP(CMDQ_DATA_ID, type) | + FIELD_PREP(CMDQ_CONFIG, config); + } else { + cmdq_size = 1; + cmdq_off = 2; + cmdq_mask = CMDQ_CONFIG | CMDQ_DATA_ID; + reg_val = FIELD_PREP(CMDQ_DATA_ID, type) | + FIELD_PREP(CMDQ_CONFIG, config); + } + + for (i = 0; i < msg->tx_len; i++) + mtk_dsi_mask(dsi, (reg_cmdq_off + cmdq_off + i) & (~0x3U), + tx_buf[i] << (((i + cmdq_off) & 3U) * 8U), + (0xffUL << (((i + cmdq_off) & 3U) * 8U))); + + mtk_dsi_mask(dsi, reg_cmdq_off, reg_val, cmdq_mask); + mtk_dsi_mask(dsi, DSI_CMDQ_SIZE, cmdq_size, CMDQ_SIZE); + + /* do not let the engine size the queue itself for long packets */ + if (dsi->data->cmdq_long_packet_ctl) + mtk_dsi_mask(dsi, DSI_CMDQ_SIZE, CMDQ_SIZE_SEL, CMDQ_SIZE_SEL); +} + +static u32 mtk_dsi_recv_cnt(struct mtk_dsi_priv *dsi, u8 type, u8 *read_data) +{ + switch (type) { + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: + return 1; + case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: + case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE: + return 2; + case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE: + case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE: + return read_data[1] + read_data[2] * 16; + case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: + dev_info(dsi->dev, "type is 0x02, try again\n"); + break; + default: + dev_warn(dsi->dev, "type(0x%x) not recognized\n", type); + break; + } + + return 0; +} + +static int mtk_dsi_host_send_cmd(struct mtk_dsi_priv *dsi, + const struct mipi_dsi_msg *msg, u32 flag) +{ + int ret; + + ret = mtk_dsi_wait_for_idle(dsi); + if (ret) { + dev_err(dsi->dev, "polling dsi wait not busy timeout!\n"); + return ret; + } + + /* drop any flag left over, so that only this command completes it */ + mtk_dsi_mask(dsi, DSI_INTSTA, 0, flag); + mtk_dsi_cmdq(dsi, msg); + mtk_dsi_start(dsi); + + return mtk_dsi_wait_for_done(dsi, flag); +} + +static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) +{ + struct mtk_dsi_priv *dsi = host_to_dsi(host); + ssize_t recv_cnt; + u8 read_data[16]; + u32 flag = CMD_DONE_INT_FLAG; + void *src_addr; + int ret; + u8 i; + + if (readl(dsi->base + DSI_MODE_CTRL) & MODE_CON) { + dev_err(dsi->dev, "dsi engine is not command mode\n"); + return -EINVAL; + } + + if (MTK_DSI_HOST_IS_READ(msg->type)) + flag |= LPRX_RD_RDY_INT_FLAG; + + ret = mtk_dsi_host_send_cmd(dsi, msg, flag); + if (ret) + return ret; + + if (!MTK_DSI_HOST_IS_READ(msg->type)) + return 0; + + if (!msg->rx_buf) { + dev_err(dsi->dev, "dsi receive buffer size may be NULL\n"); + return -EINVAL; + } + + for (i = 0; i < ARRAY_SIZE(read_data); i++) + read_data[i] = readb(dsi->base + DSI_RX_DATA0 + i); + + recv_cnt = mtk_dsi_recv_cnt(dsi, read_data[0], read_data); + + if (recv_cnt > 2) + src_addr = &read_data[4]; + else + src_addr = &read_data[1]; + + if (recv_cnt > 10) + recv_cnt = 10; + + if (recv_cnt > msg->rx_len) + recv_cnt = msg->rx_len; + + if (recv_cnt) + memcpy(msg->rx_buf, src_addr, recv_cnt); + + dev_dbg(dsi->dev, "dsi get %zd byte data from the panel address(0x%x)\n", + recv_cnt, *((const u8 *)msg->tx_buf)); + + return recv_cnt; +} + +static int mtk_dsi_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) +{ + return 0; +} + +static const struct mipi_dsi_host_ops mtk_dsi_host_ops = { + .attach = mtk_dsi_host_attach, + .transfer = mtk_dsi_host_transfer, +}; + +static void mtk_dsi_host_init(struct mtk_dsi_priv *dsi) +{ + struct mipi_dsi_panel_plat *plat = dev_get_plat(dsi->panel); + struct mipi_dsi_device *device = &dsi->mipi; + + /* + * Populate the mipi_dsi_device the panel will use. Without ->dev the + * panel's dev_err()/logging prints "(NULL udevice *)", and the lane/ + * format/mode_flags are needed by mipi_dsi helpers. + */ + device->dev = dsi->dev; + device->lanes = plat->lanes; + device->format = plat->format; + device->mode_flags = plat->mode_flags; + + plat->device = device; + + dsi->dsi_host.dev = (struct device *)dsi->dev; + dsi->dsi_host.ops = &mtk_dsi_host_ops; + device->host = &dsi->dsi_host; +} + +static int mtk_dsi_probe(struct udevice *dev) +{ + struct mtk_dsi_priv *dsi = dev_get_priv(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); + struct display_timing timing; + struct udevice *mmsys_dev; + struct regmap *regmap; + const char *alias; + unsigned int i; + int ret; + + /* Before relocation we don't need to do anything */ + if (!(gd->flags & GD_FLG_RELOC)) + return 0; + + dsi->dev = dev; + dsi->data = (const struct mtk_dsi_data *)dev_get_driver_data(dev); + if (!dsi->data) { + dev_err(dev, "missing dsi match data\n"); + return -EINVAL; + } + + dsi->base = dev_remap_addr(dev); + if (!dsi->base) + return -EINVAL; + + dsi->engine_clk = devm_clk_get(dev, "engine"); + if (IS_ERR(dsi->engine_clk)) + return PTR_ERR(dsi->engine_clk); + + /* + * The DSI host's "hs" clock is the MIPI TX PLL. U-Boot's MIPI TX driver + * does not register it as a clock, so it is not fetched here; its rate + * is set through generic_phy_configure() instead. + */ + dsi->digital_clk = devm_clk_get(dev, "digital"); + if (IS_ERR(dsi->digital_clk)) + return PTR_ERR(dsi->digital_clk); + + if (dsi->data->path_len > MTK_DSI_MAX_COMPS) + return -E2BIG; + + for (i = 0; i < dsi->data->path_len; i++) { + alias = dsi->data->path[i].alias; + ret = uclass_get_device_by_of_path(UCLASS_MISC, alias, + &dsi->comps[i]); + if (ret) { + dev_err(dev, "cannot get %s device: %s\n", alias, + errno_str(ret)); + return ret; + } + } + + /* + * Unlike the components above, the mutex has no alias in the MT8365 + * device tree, so take the first device bound to its driver, as Linux + * does when the "mutex" alias is missing. Both SoCs supported here + * have a single mutex node; a SoC with more than one mmsys would need + * the mutex sitting next to this DSI to be singled out. + */ + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(mtk_disp_mutex), + &dsi->mutex); + if (ret) { + dev_err(dev, "cannot get mutex device: %s\n", errno_str(ret)); + return ret; + } + + /* + * No standalone "mmsys" phandle exists in the DSI binding; the + * "digital" clock already comes from the mmsys config block, so + * reuse its clock provider device to reach the same regmap. + */ + mmsys_dev = dsi->digital_clk->dev; + + regmap = syscon_node_to_regmap(dev_ofnode(mmsys_dev)); + if (IS_ERR(regmap)) { + dev_err(dev, "cannot get mmsys regmap: %ld\n", PTR_ERR(regmap)); + return PTR_ERR(regmap); + } + + dsi->mmsys_base = regmap_get_range(regmap, 0); + if (!dsi->mmsys_base) { + dev_err(dev, "cannot get mmsys base\n"); + return -ENOENT; + } + + ret = generic_phy_get_by_name(dev, "dphy", &dsi->phy); + if (ret) { + dev_err(dev, "failed to get dsi PHY: %d\n", ret); + return ret; + } + + /* the panel is the DSI node's own child, bound by .bind below */ + ret = uclass_get_device_by_ofnode(UCLASS_PANEL, + dev_read_subnode(dev, "panel"), + &dsi->panel); + if (ret) { + dev_err(dev, "cannot get panel: %s\n", errno_str(ret)); + return ret; + } + + mtk_dsi_host_init(dsi); + + ret = panel_get_display_timing(dsi->panel, &timing); + if (ret) { + dev_err(dev, "cannot get display timing\n"); + return ret; + } + + /* the components are only programmed once their clocks are on */ + ret = mtk_dsi_power_on(dsi, &timing); + if (ret) { + dev_err(dev, "failed to power on\n"); + return ret; + } + + ret = mtk_disp_mutex_ovl_dsi_enable(dsi->mutex); + if (ret) + goto err_power_off; + + dsi->data->ddp_connect(dsi->mmsys_base); + + for (i = 0; i < dsi->data->path_len; i++) { + dsi->data->path[i].config(dsi->comps[i], &timing); + dsi->data->path[i].start(dsi->comps[i]); + } + + mtk_dsi_set_display_mode(dsi, &timing); + + mtk_dsi_lane_ready(dsi); + + /* the overlay comes first in every path */ + ret = mtk_ovl_layer(dsi->comps[0], plat, &timing); + if (ret) + goto err_power_off; + + video_set_flush_dcache(dev, true); + + ret = panel_set_backlight(dsi->panel, BACKLIGHT_DEFAULT); + if (ret && ret != -ENOSYS) { + dev_err(dev, "failed to set backlight\n"); + goto err_power_off; + } + + ret = panel_enable_backlight(dsi->panel); + if (ret) { + dev_err(dev, "failed to enable backlight\n"); + goto err_power_off; + } + + mtk_dsi_output_enable(dsi); + + return 0; + +err_power_off: + mtk_dsi_power_off(dsi); + + return ret; +} + +/* + * Linux cannot take over a running pipeline: shut it down before booting + * the OS, or the DMA masters keep scanning out memory the kernel reuses. + */ +static int mtk_dsi_remove(struct udevice *dev) +{ + struct mtk_dsi_priv *dsi = dev_get_priv(dev); + + /* nothing was set up before relocation */ + if (!dsi->dev) + return 0; + + mtk_dsi_power_off(dsi); + + return 0; +} + +static int mtk_dsi_bind(struct udevice *dev) +{ + struct video_uc_plat *plat = dev_get_uclass_plat(dev); + + plat->size = MTK_DSI_MAX_WIDTH * MTK_DSI_MAX_HEIGHT * VNBYTES(VIDEO_BPP32); + + return dm_scan_fdt_dev(dev); +} + +static const struct udevice_id mtk_dsi_ids[] = { + { + .compatible = "mediatek,mt8365-dsi", + .data = (ulong)&mt8365_dsi_data, + }, + { + .compatible = "mediatek,mt8366-dsi", + .data = (ulong)&mt8366_dsi_data, + }, + { } +}; + +U_BOOT_DRIVER(mtk_dsi) = { + .name = "mtk_dsi", + .id = UCLASS_VIDEO, + .of_match = mtk_dsi_ids, + .probe = mtk_dsi_probe, + .remove = mtk_dsi_remove, + .bind = mtk_dsi_bind, + .priv_auto = sizeof(struct mtk_dsi_priv), + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_OS_PREPARE, +}; From patchwork Fri Oct 2 04:04:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315159 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=UXvrgjmn; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=MhaUu6zk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9ST1NDsz1xvt for ; Sat, 03 Oct 2026 00:01:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C867A606AF; Fri, 2 Oct 2026 14:01:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yqeatB4Cjb8v; Fri, 2 Oct 2026 14:01:43 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp3.osuosl.org 1653A60B56 Authentication-Results: smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949703; b=hzgIzcF2Odk9wCvo+UzHzk9T5HgVnwBQjThGDxn4aIMCmzihDx+OEgWFxiKRdKf8Ffy/ zKFztpwUUX9+iS+sa4kmZGrPn0uqaXFrDem1W9kgovkz/8CYfIwo7rWIjd+RkgHjeJP91 HO1OwTWIEpCc10v8QLQ0jWr7ObJWlFX7VmBOq4wFEGtg8ChIcxrROibwisasdPjs6yQsF 2Om68DF+wmndsxcENWegzxXZ9lU+1Ww659K5UUT6TmDbscYWkIPJzOhhju5j3JmSFg4cm ZqjEPNRgoYmt05Pww3qHFUqH/ULHYCWCmOWi8ezwxHmRcKv8ASKZ5geeCfnVrrcf+Tg== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949703; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=IIsz8m9NtRhUdntyaADZUdrTakR1WFWenSKPNLDIkfs=; b=hmQank30r2I4SFwpRzIOTwMPy0W1QxoOliEixRfOhiCy5cSBqgURrlfwJfBlo3yMB/Fq agmScLkJ5wsu5i+c/76+rB7OCTDFVtMNGpnY2gm+Wp8zN4D1UTebH5zXqcqoZ92+v3djh kJ5ySpiHXbJ++fikD6bWO/g/dtVug3pNkF0roIMaVQQF7v4gWYvY9YZ/jEYvDWdk0wzQL eI4rv0r7Tb0b5QYP6IdRMYLk9BLnWhmRy2aM6w2mnqG1UMeZfb5NH8kyMA5KO7frcXYzB 3n+FmpGgsKk7huCGA/zMapcBrblWow5yk5AutXxTHC4Y3OhOiS2dbW8TtKv4CzatwzA== ARC-Authentication-Results: i=2; smtp3.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949703; bh=IIsz8m9NtRhUdntyaADZUdrTakR1WFWenSKPNLDIkfs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UXvrgjmnQRMnXOVEatfZzDDULYQc9ZPV01mWYmY2gP2+L2vvCbdcqZPO1DN3kg01Y dnXzuZvuHCKZGv8O/czq+kobznAZwGpC1/CrNOKTODU34jbL5tKVoBbFPn4xhPH/LR 6TmHRXUR3zqRgSmd+sC9D8+veRUOh92mxuiQRhJsvsH45oEer5TJ4BmbOvgEg8CiQP BNkYZR+7+vq0AosvH1nAmsx850h6NFU1EPDoMrxy1YOjebK1mH8gsfXNEqYOneGAdu NGOdeOhVwrgMvCvrMnp57ohPQiapSosFrcG+JCuRH2/uvPl1vGrFKPvCL2gqNY8W9g 2GDa8dg0QdOLA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 1653A60B56; Fri, 2 Oct 2026 14:01:43 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 9B3B32E0 for ; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8D65940D95 for ; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 70to_vsjw98e for ; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 958D840D87 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::17" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949699; b=fQmrzc6IKicGt5M8Scx5YMsKc2Lzw66dFB3UmanoTVMBqUGSFRv9oLcskk6ms9T8cb3W o5l790EGMNqJPde9fOR/7/J/Rh1Y9i88vhP8oCZBRNLTvcEWhDGwJ8tz05hk7t82MrYqm rg/KAVyipXzu+UgZ+5I93chWfk6V/yP3puDq3akiPifbh1oZ7rB0Hojbtyvpy7ICP6KM4 9u1tcntO2B5ozRiDfbCcGbcKzx+aA3cPQ4WUwvsXJ/5H0jBefCLraaj+rnjmn7llKOiAq 94RVINJT7OwP1imUJZQBLokFitljTlKzqN6lCDtSgQOsmHaWvoQUGjNLnrCWObsw/lg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949699; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=IIsz8m9NtRhUdntyaADZUdrTakR1WFWenSKPNLDIkfs=; b=bRF76lEgck2Hgu/pNna0v4jRYL90DqF8ty2Z2gZIz5a7xHxn2s0elHjUCAsnzzjIft1N WV2RXGtkpEX4UNXctUpOhBjIr2/qPBtT+nUldGKbUj6CMvcGHRa5YIit5JCTt6gIUMLOw j1X0FjeLPN5mnOMo6OGaW8uFYTOs+JmHHXcyGKwSTLm6LcynqZHfaZ7Jz8vheZg5r6TKp WaEA0t6CsGA5LV2TiB7l35nLguifZ6HjYNBDOn+/+Db8CY89WxIf2oQoNy3iBeYVOpYxQ /tZBzNCpxw9U8fqcYrx2xCAT0U7WG1UwlxnTVAU2lN/LgKjVSRMLMqUPJy6rEvABAjA== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=MhaUu6zk; arc=none smtp.remote-ip="2a00:1450:4864:30::17" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::17; helo=mail-wr2-x17.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=MhaUu6zk Received: from mail-wr2-x17.google.com (mail-wr2-x17.google.com [IPv6:2a00:1450:4864:30::17]) by smtp4.osuosl.org (Postfix) with ESMTPS id 958D840D87 for ; Fri, 2 Oct 2026 14:01:38 +0000 (UTC) Received: by mail-wr2-x17.google.com with SMTP id ffacd0b85a97d-48b0622cc90so1342434f8f.1 for ; Fri, 02 Oct 2026 07:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949696; x=1791554496; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IIsz8m9NtRhUdntyaADZUdrTakR1WFWenSKPNLDIkfs=; b=MhaUu6zkMWO8woHBw+bh+yx60AUvwMxF4MBE6deABCXaTeEfh/d+CH+Lw0ye1DV7xU IVhRq13VpvYuBm7iyCPswQ1O9GFj2MBN+76SOaD2L9PxCr3Ez3Yg5yRFjTdFD7MTj9QK kjAvVbdTm5gJlMuE65lQ85TqXUJnTrY2xuhwo+yyC6vZHX7sOR84y0tcN0Lkfk42YTI3 rOXLE7z77OjqOUAY7R3HBIPCauqpY7Z65mz4P7GNhukFsnBi1bdfKazoQNRPRQCWUPVn s+2N25n69OssrK1oOJ0fZXEWQnuy6l0+mF8vEXEHdI4KP7MH25aKGef8pg0htTsNAPqb iRpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949696; x=1791554496; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IIsz8m9NtRhUdntyaADZUdrTakR1WFWenSKPNLDIkfs=; b=XyLq+OvLP/p7LpbGtdFvEP/oiSmZoh7GiaEd3Py0th+7ZFaAC3UGbj9jQSQMNbPLdX fsJuGEHb2zC2nplgLrJJYM2txKU4j7b7SY+1uHLakcIzseaRrKWWD0bDuYj01oWy7VUT 6yYcDjWluxFk39oiyan5eC9D9P4pvrRBEUwe4j/aOxnbzAFf7lgEbAsVHpKAYxrzAWJH uTc7T8Zisz/ZMDhu3j+q7oyoAA1yztffbTe/r5a+UyoddeZxFarg3QPcTHS7AegzVetn kj8Z3YlsI9fLm0R0tcYQ28xPKmCruKr6OaK/y8wVmCcSclacEwNriBTeYGyRyUDUv+ec ujKA== X-Forwarded-Encrypted: i=1; AKwUvBywtsu9x5PCv0UnNRk6s9vsmTuKocuuwSoUMnB5B1zbXIBTXmYlNmQbVmgsRaZVNjp9mmVTwNo=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYJqYIsTQNvAgJzHDuEcyXtwxjT9NeBXQKhwBlIOCAKPK66+XVzW KH6OZrbLN5uObOJAIptPtocor8ikcWAFxs9Y/PfxckZKs1N9HUPN75DM8JdvdFAnsYc= X-Gm-Gg: AYBFou24hFGYJ3nHGzV+ElzxkkqX7N4uXRLdbImVAsk7qirRW6zXOJ3Q8fkZV+c0PcZ RXf7gGPeW7HLlCUXpvQIsTnF8coYDs5aYcbkGa7HG9N237sFjgPWeJy/eMt86ZD0+wlj43ZqOoR 8zV8g2bQN66AXM9SsrlgpVbhvAnQVZcziFBAkhSWIHVDN06l3Keye6LOvG9M6XtRCNo5N0RLlu7 YH3CFoYnVVxCxO1x6iiuYuWl5Vqs1s+auBw0YQv/QYVeThc8kW7eXokYuaHx2/2ms+4QQ5rr39i LTSxiERt7nx3fLggO+rDEV02nPX+qiCTQxqfX6Bp/29nC8onSV+MUCdZAIZu6l2P5iVTZd8dKQW SKFLuYTMEFrM5eDyTSSRmCLJ4tsTspLb9DO8F9L5B2p4rmJTWkAAJN/kjRFB2TSUUFUCaht0K6P HgePX/6iCPlBF6d2yiFvXJceRs1ZKCflhPNWeVUeuE/Ya0/mdk0ufS5A5ZpwcrwJEsNacyR2Kqo 1dMxqD0jv34U8cr2sI/WcpXajh2izhdgBSoczII5bhWxpgdro2NS175M9JFLx5sS++q/oQn+jGe gLpS+iS8RL9Bh3GV2ns5up+qcOgEXlrrwVPhBtN+rGINb9qXOJ8PpmC6 X-Received: by 2002:a05:6000:41cf:b0:487:62d:37dc with SMTP id ffacd0b85a97d-48b1273e37fmr4949645f8f.32.1790949696318; Fri, 02 Oct 2026 07:01:36 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:35 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:04:03 +0200 Subject: [PATCH v2 12/13] configs: mediatek: mt8365_evk: enable dsi pipeline MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-12-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org Enable the configuration required for the DSI pipeline on Genio 350 EVK: video, regulator fixed, dm_gpio, the MediaTek DSI driver, the PHY uclass and the startek kd070fhfid015 panel which is the default display for the Genio 350 EVK. That panel drives its reset and enable lines through GPIOs only, so no backlight driver is needed. Everything else the driver needs, the MIPI DSI PHY included, is selected by CONFIG_VIDEO_MEDIATEK_DSI. The U-Boot logo is not enabled by a symbol of its own: CONFIG_VIDEO_LOGO is "default y if !SPLASH_SCREEN", so CONFIG_VIDEO=y already brings it in. CONFIG_VIDEO also turns CONFIG_CONSOLE_MUX and CONFIG_CMD_CLS on by default. Both are turned back off: the display is only there for the boot logo, the console stays on the serial port. Signed-off-by: Julien Stephan --- configs/mt8365_evk_defconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/mt8365_evk_defconfig b/configs/mt8365_evk_defconfig index cc01dcf434c..a608cdd75a1 100644 --- a/configs/mt8365_evk_defconfig +++ b/configs/mt8365_evk_defconfig @@ -5,6 +5,7 @@ CONFIG_POSITION_INDEPENDENT=y CONFIG_ARCH_MEDIATEK=y CONFIG_TEXT_BASE=0x4c000000 CONFIG_NR_DRAM_BANKS=1 +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="mediatek/mt8365-evk" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_TARGET_MT8365=y @@ -21,15 +22,20 @@ CONFIG_CMD_REGULATOR=y CONFIG_OF_UPSTREAM=y CONFIG_CLK=y CONFIG_MMC_MTK=y +CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_POWER_DOMAIN=y CONFIG_DM_PMIC=y CONFIG_DM_PMIC_MTK_PWRAP=y CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_MT6357=y CONFIG_BAUDRATE=921600 CONFIG_DM_SERIAL=y CONFIG_MTK_SERIAL=y +CONFIG_VIDEO=y +CONFIG_PANEL_STARTEK_KD070FHFID015=y +CONFIG_VIDEO_MEDIATEK_DSI=y # CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_WDT=y CONFIG_WDT_MTK=y From patchwork Fri Oct 2 04:04:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 2315161 X-Patchwork-Delegate: dlechner@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=hwHa0CY0; dkim=pass (2048-bit key; secure) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=A6/pMjn/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.u-boot-project.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hx9SX737kz1xvt for ; Sat, 03 Oct 2026 00:01:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 81FFA8135B; Fri, 2 Oct 2026 14:01:47 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id BWvRgljMSf6e; Fri, 2 Oct 2026 14:01:45 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp1.osuosl.org B269581376 Authentication-Results: smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 ARC-Seal: i=2; d=osuosl.org; s=arc; a=rsa-sha256; cv=pass; t=1790949705; b=jEOCdQwgZCWozE0TvD5uUc8q840prqLAsFTRIIyMyOSvQiBDZJQVhwzlmtQOaKqFZnJp tBw+kxrODAZwFfWnGnkGSVvpOfwHGhL6Hue7CGLwp74r5tzC8o8MiNxfZtvKQqDigBcRh HwCtLv93K+p0atnKIJM0SQ0+RV2nyx13NYjfhqq7UJ7p3M4OW6PkWqoNsmhwrMKNDQEpG y9iXnt3+Nsv9/sVSbykPEvc3XK4a9E1NlsGx2+A7FzPT5pQcfGkpfDbTE9+ttva770wFU YWln07M/DU5dqVMrwGSWGTwrt7wGcnv8gJ7+gdl3NI130zZX+asMZYJtSFLkrpQwsYQ== ARC-Message-Signature: i=2; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949705; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=X81IQa5iKrwaXqGThG7E8Ss5H88Td8cEJcBkTSCzb+M=; b=fjZn+WtzLyi54ejQLcUGKyaM8h03OzxnzgB4MwEtWslImAk87/eK8Ntdc/CtZZt4mrBJ 2vXphBlE3duigbiAlG0/QsjoAyvr1LsycfaTKknJ3u+9nRrM7u3P57r8ocPZEg4UpyQtD /UiyEFqQOVf9pONC/O30BTFt8L5FJoCvQndvjuJxMYCXKaj1wHKjHXp5Pom/wkfcNECNa m6caqX7s64YclXJNYmjmR57jsJrfhoKHeDKGFL5YA4Sv2JRRtggkTxx7sWu2W9rpBdtpS tvO3iGn1x0pwBs03p3uPCecZyCfhmKiG/Dk9rnHrsOCA8RxdATxbFPFMfej3DYY5BoA== ARC-Authentication-Results: i=2; smtp1.osuosl.org; arc=pass header.oldest-pass=0 smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1790949705; bh=X81IQa5iKrwaXqGThG7E8Ss5H88Td8cEJcBkTSCzb+M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hwHa0CY0C8yw7QZi4GuAEhvEoUihBbpoIxN7yZRww2Seb+5dHh6uJnsLEdPPEI+Ub D+5U577E27qaai2YHrYYhPA+QZ6O6s7wuY63P2tZxqGz95NP5gPrLSNNVF4otw3uF9 n7hv3pWmpOG7cOVOOr6C6+Buk3HMOxla1Tohkzr6u/mOseUuDOaVk3FIIz2TuqlUBQ Luku3T4ty8O7G+Egx21K5PXh8MD9CqvzpuQiUbYQcLy70pvoCOj4KS1++i1etFThgq wjn8QBnDUZBvNFJoZ2P4/SpBS+OBZwWi6DECNVzA0Z0/H8XN0ui+Bccfr5MbuESVY4 1HflanODDAwnQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id B269581376; Fri, 2 Oct 2026 14:01:44 +0000 (UTC) X-Original-To: u-boot@lists.u-boot-project.org Delivered-To: u-boot@lists.u-boot-project.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 5C0EF435 for ; Fri, 2 Oct 2026 14:01:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4EC3C40D87 for ; Fri, 2 Oct 2026 14:01:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qYBDVOWAbmiV for ; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.0 smtp4.osuosl.org 5B07140D94 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:30::d" ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1790949699; b=aic5KYnxAENqNCyFQYvqf9GxxqMTi0PZA5Y9q5UEmA5C14sbHGYOJomFEKhD/d79q0GC wuTYaK5DnUoGfQuK/PlQnPEu1wKuR2ZwaLFVc4+kCAMqv9t2HeV0Thssl77qONE7dxdmr UDzM3rSpfWm9g4ucgL7QmFKeUoljZ1ZbUmJxoXRdorxWr+e+DfEBVw1IOBhP+6uLXQnBQ DWGnrMhokZ2Qr6T6fMwll/9nBxEV8H25fJL6+J1xrZrF2D9DWaWEaod4hzgdhMhkuQPP4 2y87Sr6IzYqGADKYi0yveQkuUP6vIH1F7uip9wdK+VU7MQHRI+rc+r1by/Zph2MlGpQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1790949699; h=Received-SPF:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=X81IQa5iKrwaXqGThG7E8Ss5H88Td8cEJcBkTSCzb+M=; b=MzOC1l+ClHFtPeGMi83QRI1vNlQpZUaIJN+JgiqzGGun0qE0iwzUS6aO6preHeJk/zuh EAKBl0kNgti53P7fIpoIGyPIvlvgyekSI8wocu6cnOVCc8QSapo2sp6H5kAvsR/CKJnnX vIpaLISpD8POyVdmEf3q1v9hpEOucjKB8MgsR0xoIhR2Nb6ZMXAyIjysEx/UewrcaGSAF 4+Zm7HLcWUhafNKGL6LPxlSBYritzsYgNVR4aqoWhpWKv3UTXqvOuc6chd441VTdbHfLF T22O8/ZRYNqj/qNK7edbkNlqmqXBBbnUcAZmuwLgcg/MMqdRE1lLhq7vj+0ghl8gDgQ== ARC-Authentication-Results: i=1; smtp4.osuosl.org; dmarc=none header.from=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="A6/pMjn/"; arc=none smtp.remote-ip="2a00:1450:4864:30::d" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:30::d; helo=mail-wr2-x0d.google.com; envelope-from=jstephan@baylibre.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=A6/pMjn/ Received: from mail-wr2-x0d.google.com (mail-wr2-x0d.google.com [IPv6:2a00:1450:4864:30::d]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5B07140D94 for ; Fri, 2 Oct 2026 14:01:39 +0000 (UTC) Received: by mail-wr2-x0d.google.com with SMTP id ffacd0b85a97d-482f6351831so4522141f8f.1 for ; Fri, 02 Oct 2026 07:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1790949697; x=1791554497; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=X81IQa5iKrwaXqGThG7E8Ss5H88Td8cEJcBkTSCzb+M=; b=A6/pMjn/l3W+iZSEAugsbyneEsqD2NbqxTN4NMBQW/2Pn5CJSVDJIcXtztYBeEzfK5 YsY3l6zSanExzzE6SXFr9UFXNvHxTUveu0YTn7MD20+l5MOpHgD+SAa81niQLVNozQoz CO/WjtGpOS8ZOFf+SMjHXTlceNgyBf3x0Gb1K/n59iJGgjTisdt+1UBduh7mJJVpZh4s s1zNx3IK7LsMcY/9H1ex+s/KwDMLxdLMg/ha3eU9UH5PW6Pyg8flYu8fNCw/t52hoKhO uGBcVUBL4jQiTFSQTBNLHPMy9DagQmZuxYGGibrH4dryzAKjdcb32NeCnBATd+05KqFT h7eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790949697; x=1791554497; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=X81IQa5iKrwaXqGThG7E8Ss5H88Td8cEJcBkTSCzb+M=; b=MfAyfiSRq11HSjA9lpHxRW3ZiYmMcA75dCaqLRiY7Vh4zvwUAzk20BdK8rjTIOLoD6 ejzv5b3uNTFNzI5PTa2HJYnNN9ElbGRdQ7mkxL+fdcQ1O7LJe1a8g/hro8OLGegL7Y/Z Y5qj344xTDpxuowd1TLLdHxfdL1BZtjOHXYFZ04eIZnVvtRymwz7uweK7AIGNtFB7B0C vTE55i10cDtbFqm9WMeKMVQWLf+ImfqerQ8KEgZD1EygRFlX+028vhzCfdNn2XgJFwd6 R3M7Q92/wrrTJVH/Zz566y/1aozF6HO9zV2PkQBPDBBuY1H7xKKLvvKCdr3eit4sjk/G zQJQ== X-Forwarded-Encrypted: i=1; AKwUvBy68fL16LRDVeK1Reedi5UCMj9tHQLz8XKUQIW9wf64tolnFneg4u7Tm/R1hoWoif0spku+K/E=@lists.u-boot-project.org X-Gm-Message-State: AFq9FYL4pee4OKTl+bGFj26Qdp9XlNwAksUlkoerVwcM/wdcHt4xehb4 1i5ib/x7IhoxkTrOKszLK4oXbs+jM+R5GubDKslMADrZv7KlTtAxjcqmoFyBUTcf53g= X-Gm-Gg: AYBFou2ZAfvI30sEwR814l69kvFtAb+PMexSFDOMQHp5X7rSxYcDgzUqGqziSz55f0i Jk4pAhIR1rraRS+7qWb4NjVZOlvY3XDU1K8ggluFsZsqYAfrYAwbULaz6UlKkzn7lypjIg5wWxo wtEkQnSzNbVbPb0DxG60O8yjtjTJnUebxfDR4q+yQFAtzFaaw0255zaOdwiwuqz12SQf4JhyhrJ mFLh52K9ZPNNQVoJxo87ib8No7+OxnK9Ef5ms9B+oWslVKPj2skUQoUQANqhg9ApKSkoS3njDhR uZMLPb1tZ6n9kn3p3Gr5DpXmC4TXzZu1coT34QuOwlJrAlUVJaBCtEIH6WsqRF7b0SUDWDiQUgh u8QZL66Ucpev/E2YyLMqXCHZ5KESYID2enhaFmWzqs/DGw5CkUjVApF+Fero2l9lHwufDt6eTcw ZE2fNLwag7bzGOP6w+OPRBGnsHalr2VZasyV+75GiyDxU7XO0j6va5ZdLdaA4Uvt96ZnA3F3nil QvXVweal5wHI4kH0EOHv4Y5dLAd/IUouAsgOmQ9u3hlVUdMhYqrHRgT7uZ9FYuNvQ2Y2enffwZI bXpWdUneiwTyEkwBgVRRmvBfHZEhU9qfokD35M7WgMYB9C1cBex2ZIJwByxLPOYgIg== X-Received: by 2002:a05:6000:240d:b0:48b:451:4f19 with SMTP id ffacd0b85a97d-48b1272dbafmr5358881f8f.51.1790949697288; Fri, 02 Oct 2026 07:01:37 -0700 (PDT) Received: from [192.168.1.100] (2a02-842a-d52e-6101-6f8f-5617-c4b6-8627.rev.sfr.net. [2a02:842a:d52e:6101:6f8f:5617:c4b6:8627]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b382f8c4asm6138477f8f.37.2026.10.02.07.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2026 07:01:36 -0700 (PDT) From: Julien Stephan Date: Fri, 02 Oct 2026 16:04:04 +0200 Subject: [PATCH v2 13/13] configs: mediatek: mt8366_genio_360_evk: enable dsi pipeline MIME-Version: 1.0 Message-Id: <20261002-mt8365-mt8366-add-dsi-support-v2-13-9e435457b90c@baylibre.com> References: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> In-Reply-To: <20261002-mt8365-mt8366-add-dsi-support-v2-0-9e435457b90c@baylibre.com> To: GSS_MTK_Uboot_upstream , u-boot@lists.u-boot-project.org Cc: Tom Rini , Ryder Lee , Weijie Gao , Chunfeng Yun , Igor Belwon , David Lechner , Heiko Schocher , Johan Jonker , Anatolij Gustschin , Julien Masson , Pavlo Yadvychuk , Julien Stephan X-Mailer: b4 0.16.0 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org Enable the configuration required for the DSI pipeline on Genio 360 EVK: video, the MediaTek DSI driver and the startek kd070fhfid078 panel which is the default display for the Genio 360 EVK. The PHY uclass, DM_GPIO and the fixed regulator are already enabled for the other peripherals of the board. Unlike the Genio 350 panel, the kd070fhfid078 drives its backlight through the display PWM, so the PWM uclass and the MediaTek display PWM driver are enabled as well. The backlight uclass and the generic PWM backlight driver are "default y", so CONFIG_DM_PWM=y is enough to bring them in. Everything else the driver needs, the MIPI DSI PHY included, is selected by CONFIG_VIDEO_MEDIATEK_DSI. The U-Boot logo is not enabled by a symbol of its own: CONFIG_VIDEO_LOGO is "default y if !SPLASH_SCREEN", so CONFIG_VIDEO=y already brings it in. CONFIG_VIDEO also turns CONFIG_CONSOLE_MUX and CONFIG_CMD_CLS on by default. Both are turned back off: the display is only there for the boot logo, the console stays on the serial port. Signed-off-by: Julien Stephan --- configs/mt8366_genio_360_evk_defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configs/mt8366_genio_360_evk_defconfig b/configs/mt8366_genio_360_evk_defconfig index abc3667d566..18e67f09816 100644 --- a/configs/mt8366_genio_360_evk_defconfig +++ b/configs/mt8366_genio_360_evk_defconfig @@ -12,6 +12,7 @@ CONFIG_SYS_LOAD_ADDR=0x4c000000 CONFIG_FIT=y CONFIG_BOOTSTD_FULL=y CONFIG_DEFAULT_FDT_FILE="mt8366-genio-360-evk" +# CONFIG_CONSOLE_MUX is not set # CONFIG_BOARD_INIT is not set CONFIG_CMD_CLK=y CONFIG_CMD_DM=y @@ -20,6 +21,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_MTD=y CONFIG_CMD_USB=y +# CONFIG_CMD_CLS is not set CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_NET_LWIP=y @@ -49,6 +51,8 @@ CONFIG_DM_PMIC_MTK_PWRAP=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_MT6358=y +CONFIG_DM_PWM=y +CONFIG_PWM_MTK_DISP=y CONFIG_BAUDRATE=921600 CONFIG_DM_SERIAL=y CONFIG_MTK_SERIAL=y @@ -59,5 +63,8 @@ CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_MTK=y CONFIG_USB_MTU3=y +CONFIG_VIDEO=y +CONFIG_PANEL_STARTEK_KD070FHFID078=y +CONFIG_VIDEO_MEDIATEK_DSI=y CONFIG_WDT=y CONFIG_WDT_MTK=y