From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2DD3C7619A for ; Mon, 27 Mar 2023 08:13:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BBF5F86064; Mon, 27 Mar 2023 10:12:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cJAIzEte"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E93298609C; Mon, 27 Mar 2023 10:12:28 +0200 (CEST) Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DEF908606A for ; Mon, 27 Mar 2023 10:12:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=clamor95@gmail.com Received: by mail-lj1-x229.google.com with SMTP id a11so7973235lji.6 for ; Mon, 27 Mar 2023 01:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679904740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+dR2lP6hrDjOLVTDFha09H6d5vmfLyWNEtX62WAXguA=; b=cJAIzEtem95p37Qq2q0mfBdCHXmqKbklc38AcRlwzWUCwc6YiK3MPfa+jw/MFD1K7K 84/BPgLb0u3xhsXQraCQe/ZlPDgSnTWAUCzWh7FKEo8s56m/+CBrlVUDGQwZwBpkuCOI d8qio3fREFm76LnE+q/oNZKTVFNN/dp51HdM6qFPgzog0t7amDlUUw9Iz+C8nS/tq94G q3tAuCbn/R9NbzhbVDU0M24WVvQkJ3LCl4cUbYHBA/ZWsyATtxYRM3YfLgYqHTzSY/DX fX8X5LL/YmBuH0YzwkVBrbZGD8WeS5pc5otSU7ov0MHbT6uA98sivaGklsLFUy33bHNn r8tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679904740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+dR2lP6hrDjOLVTDFha09H6d5vmfLyWNEtX62WAXguA=; b=pZ0y+9hXkpQmoO1VPaO7sELW7EKr39BWuM1xJxCHDVxB78fcTwxkoCRMn9lP48z3fi EqWGlOuFYLO7uTtTYwTf/74R0gV+Je8lvCUot1DOxfHlV6+qU8g0cg0oRvO0ixVo7ynS 58WxG1XyGeILEBEMtweDB1zKDSZwZxrtz87CmoMuavUl6vdHdEZVX5AG5detWmcI2Hvs 6qkugCvyWmD6kVRKGdRLp0N5a+OIuNfsolyVYHDi9t15mTHIjPa/H6DHiCr/6CmN5MSf X9MrhDOgpZzuALAjoSRE8YVG7LiC0hY6LWAEq2ZMOGyWH4edeZwLhJ/5ODcSC1CceaYz EbXA== X-Gm-Message-State: AAQBX9ffgrNMG/Vr31O/4ZMpv6QWIjiFxxpbhKlHDL0Vmc5rQzZWKKht 0xGDC74QPLX4GdLHUNlQZPI= X-Google-Smtp-Source: AKy350YVInlkF1PUFDWYYYMcCT12oB/v9TXx2pVx0eety7/BII5bJgJ+gKKsarYy/Azo3NuNfKlKwA== X-Received: by 2002:a2e:9c44:0:b0:298:af9d:67f0 with SMTP id t4-20020a2e9c44000000b00298af9d67f0mr3745255ljj.33.1679904740174; Mon, 27 Mar 2023 01:12:20 -0700 (PDT) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id z2-20020a2e8402000000b002a32238ea10sm1460263ljg.53.2023.03.27.01.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 01:12:19 -0700 (PDT) From: Svyatoslav Ryhel To: Tom Warren , Anatolij Gustschin , Simon Glass , Svyatoslav Ryhel , Marcel Ziswiler , Thierry Reding , Maxim Schwalm , Dmitry Osipenko , Nicolas Chauvet Cc: u-boot@lists.denx.de Subject: [PATCH v3 01/11] tegra: lcd: video: integrate display driver for t30 Date: Mon, 27 Mar 2023 11:11:40 +0300 Message-Id: <20230327081150.4585-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230327081150.4585-1-clamor95@gmail.com> References: <20230327081150.4585-1-clamor95@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Marcel Ziswiler On popular request make the display driver from T20 work on T30 as well. Turned out to be quite straight forward. However a few notes about some things encountered during porting: Of course the T30 device tree was completely missing host1x as well as PWM support but it turns out this can simply be copied from T20. The only trouble compiling the Tegra video driver for T30 had to do with some hard-coded PWM pin muxing for T20 which is quite ugly anyway. On T30 this gets handled by a board specific complete pin muxing table. The older Chromium U-Boot 2011.06 which to my knowledge was the only prior attempt at enabling a display driver for T30 for whatever reason got some clocking stuff mixed up. Turns out at least for a single display controller T20 and T30 can be clocked quite similar. Enjoy. Tested-by: Andreas Westman Dorcsak # ASUS TF T30 Tested-by: Jonas Schwöbel # Surface RT T30 Tested-by: Svyatoslav Ryhel # LG P895 T30 Signed-off-by: Marcel Ziswiler Signed-off-by: Svyatoslav Ryhel --- arch/arm/dts/tegra30-u-boot.dtsi | 9 +++++++ arch/arm/include/asm/arch-tegra30/display.h | 28 +++++++++++++++++++++ arch/arm/include/asm/arch-tegra30/pwm.h | 13 ++++++++++ drivers/video/tegra.c | 10 ++++++-- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/asm/arch-tegra30/display.h create mode 100644 arch/arm/include/asm/arch-tegra30/pwm.h diff --git a/arch/arm/dts/tegra30-u-boot.dtsi b/arch/arm/dts/tegra30-u-boot.dtsi index 7c11972552..cf17fa803b 100644 --- a/arch/arm/dts/tegra30-u-boot.dtsi +++ b/arch/arm/dts/tegra30-u-boot.dtsi @@ -1,3 +1,12 @@ #include #include "tegra-u-boot.dtsi" + +/ { + host1x@50000000 { + u-boot,dm-pre-reloc; + dc@54200000 { + u-boot,dm-pre-reloc; + }; + }; +}; diff --git a/arch/arm/include/asm/arch-tegra30/display.h b/arch/arm/include/asm/arch-tegra30/display.h new file mode 100644 index 0000000000..9411525799 --- /dev/null +++ b/arch/arm/include/asm/arch-tegra30/display.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2010 + * NVIDIA Corporation + */ + +#ifndef __ASM_ARCH_TEGRA_DISPLAY_H +#define __ASM_ARCH_TEGRA_DISPLAY_H + +#include + +/* This holds information about a window which can be displayed */ +struct disp_ctl_win { + enum win_color_depth_id fmt; /* Color depth/format */ + unsigned int bpp; /* Bits per pixel */ + phys_addr_t phys_addr; /* Physical address in memory */ + unsigned int x; /* Horizontal address offset (bytes) */ + unsigned int y; /* Veritical address offset (bytes) */ + unsigned int w; /* Width of source window */ + unsigned int h; /* Height of source window */ + unsigned int stride; /* Number of bytes per line */ + unsigned int out_x; /* Left edge of output window (col) */ + unsigned int out_y; /* Top edge of output window (row) */ + unsigned int out_w; /* Width of output window in pixels */ + unsigned int out_h; /* Height of output window in pixels */ +}; + +#endif /*__ASM_ARCH_TEGRA_DISPLAY_H*/ diff --git a/arch/arm/include/asm/arch-tegra30/pwm.h b/arch/arm/include/asm/arch-tegra30/pwm.h new file mode 100644 index 0000000000..c314e2b5ad --- /dev/null +++ b/arch/arm/include/asm/arch-tegra30/pwm.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Tegra pulse width frequency modulator definitions + * + * Copyright (c) 2011 The Chromium OS Authors. + */ + +#ifndef __ASM_ARCH_TEGRA30_PWM_H +#define __ASM_ARCH_TEGRA30_PWM_H + +#include + +#endif /* __ASM_ARCH_TEGRA30_PWM_H */ diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c index 3f9fcd0403..5e3f6bf029 100644 --- a/drivers/video/tegra.c +++ b/drivers/video/tegra.c @@ -40,8 +40,8 @@ struct tegra_lcd_priv { enum { /* Maximum LCD size we support */ - LCD_MAX_WIDTH = 1366, - LCD_MAX_HEIGHT = 768, + LCD_MAX_WIDTH = 1920, + LCD_MAX_HEIGHT = 1200, LCD_MAX_LOG2_BPP = VIDEO_BPP16, }; @@ -307,14 +307,19 @@ static int tegra_lcd_probe(struct udevice *dev) int ret; /* Initialize the Tegra display controller */ +#ifdef CONFIG_TEGRA20 funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT); +#endif + if (tegra_display_probe(blob, priv, (void *)plat->base)) { printf("%s: Failed to probe display driver\n", __func__); return -1; } +#ifdef CONFIG_TEGRA20 pinmux_set_func(PMUX_PINGRP_GPU, PMUX_FUNC_PWM); pinmux_tristate_disable(PMUX_PINGRP_GPU); +#endif ret = panel_enable_backlight(priv->panel); if (ret) { @@ -414,6 +419,7 @@ static const struct video_ops tegra_lcd_ops = { static const struct udevice_id tegra_lcd_ids[] = { { .compatible = "nvidia,tegra20-dc" }, + { .compatible = "nvidia,tegra30-dc" }, { } }; -- 2.37.2