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 4F90AC05027 for ; Mon, 20 Feb 2023 09:55:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0E8085860; Mon, 20 Feb 2023 10:55:12 +0100 (CET) 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="B5rzYqG8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84C3D8583D; Mon, 20 Feb 2023 10:54:53 +0100 (CET) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 76D8585851 for ; Mon, 20 Feb 2023 10:54:48 +0100 (CET) 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-ed1-x534.google.com with SMTP id h32so2488943eda.2 for ; Mon, 20 Feb 2023 01:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=B5rzYqG8H8kF/MoYA2zq03Ix+DxRllA0n2WkryhQQ+6lqfmIDk29fFvLukJFJPxjVf cNFNyDCaISbC5tp+CXrwVuQZEKOIJAbebkriqKmoxT787T+tyVMpXxmhaaz5U0QOSSTZ QvZd/5g3EBadeRDjXvOdJNBZsyCt3bo4ThT4y/FCBk4ykse7l8gZF6Dw2thOSPoPOrO7 3/EXsr19MuoDP/AnFp+MO5H+cAaPkU7T+8kjT2knVf26QaczFnPz77r7e4bo0QRWW0qo 8QbHOtIMYdOAdvfd32VR6Wmlzq8cEh7RD/Ivu0eMufGydZvbElVETVucSgqIdQ0P938Q iYkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=R3ePgk6Bw+i7WxcGQwP1lE41bYnce2ZwIXmBZ8Zvj3MpbprdJGJuNxYlv+i7GPVhxV H0U+4lysaPVynnMq6i8b3euJ8voeAs92vPThlYerkr3pPRG2EBvonflIML2nDWzx0Ipy ZqUGrJ43AuVAUSD+Fo+WoC8xOrlXJ/yB0kmDzUbCug2pWRfhguMNTV+9zM4bRtLIZ03h K89oZ8kIQGBtxcDv3mvn8wzZ9TB+Ruzb5iwEO5RBVQ00BdDkbzv/Y1vaM2Dw7WHjjMC7 aUH9hpqjfHU7AfZniLi0VLgIKUX5oPLlc34+zd3Kr4KW8BxmpY9NBaSJhiIQFoxZNXr2 Estw== X-Gm-Message-State: AO0yUKXWccnhaVr+6HBqak3u+rujqMTeCd+JL4+1wvqg0BFi7mhWUJii QEJjO5Yz9ui4bESruYPxoqs= X-Google-Smtp-Source: AK7set+VQ6bCl5Il5VxqTwjy3UoBoa8JbJe865zlpyeORgWw2XtcJumU0+yWsodhdsI9ldNnClJxqg== X-Received: by 2002:a17:906:4914:b0:8b1:7eaf:4708 with SMTP id b20-20020a170906491400b008b17eaf4708mr11797933ejq.65.1676886887890; Mon, 20 Feb 2023 01:54:47 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id bk7-20020a170906b0c700b008cd37aff603sm1636536ejb.164.2023.02.20.01.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 01:54:47 -0800 (PST) From: Svyatoslav Ryhel To: Tom Warren , Anatolij Gustschin , Simon Glass , Svyatoslav Ryhel , Marcel Ziswiler , Thierry Reding , Maxim Schwalm , Dmitry Osipenko Cc: u-boot@lists.denx.de Subject: [PATCH v1 01/11] tegra: lcd: video: integrate display driver for t30 Date: Mon, 20 Feb 2023 11:54:15 +0200 Message-Id: <20230220095425.6198-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230220095425.6198-1-clamor95@gmail.com> References: <20230220095425.6198-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.6 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