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 379A7C761A6 for ; Mon, 27 Mar 2023 08:14:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D561F86090; Mon, 27 Mar 2023 10:13:34 +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="APQVGlDu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 918F486081; Mon, 27 Mar 2023 10:12:45 +0200 (CEST) Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (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 B0CE78608F for ; Mon, 27 Mar 2023 10:12:25 +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-x235.google.com with SMTP id z42so7951940ljq.13 for ; Mon, 27 Mar 2023 01:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679904745; 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=dqYDxFeuqOSNrPhBv+EAyxhKsJSn/GTQwKeO/KJrF5g=; b=APQVGlDuIp5TP8wrTTMpswnD7GmFVVP2iweV/2J/3RyVm0vljXgdbcD0QTz5qmSsSq WzvrxBSgY9l2Rk1oB3y8b0P4F0L/U7Ce/AhbbbYxwnnGNtNyOgkAJ3gszEvlWMUS10Md KPfQyDqlf7H3NcxDKXRTXIPYLnDbRCDHY5hEwY4iqbYjZ0H/qjVomu36H7jBxOzTTttG MNOboPalV7gYBFMbMzs1VuILLSwlmZUkJKj0T9vtYVntIcLmIu7gulkZDlPIRdD/Z2uA 34m9xq5W99PFA11hVxS48dIDcRjuHMxzsq+mTFkXNjHhGdQFKrHsaZnYlnI6i8jMmxSE 65Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679904745; 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=dqYDxFeuqOSNrPhBv+EAyxhKsJSn/GTQwKeO/KJrF5g=; b=mlmaAdkyVIIOycK6GZK0i9HcVf1Wj8IvjTWNiYbAlM51uSpCVKXHnvenR0HiL/EGeQ cZ7t3ocmpPxX3hW/6mtpHRHdeg4zI/BiQ1c0BPpDyVXYjdE+TPTzMjsiwVVPUuo/QeiZ 89fkCXWPdMM0Ae96wTtxwRiLH9cU45zXKkhgsPg7pxND7qCaCSpKW3HIhSaZCxLYigcD nL760MU801WCu20OcH0q61DEsP/J87VG+hWtJxx0viQFWrkis3MdLeMu5Cjp5XjZxSl/ wgU6q7V2lCnY9QgbxySNoQjjs8o0IAL+vrF3+hQNmApUnNiTgGaePW3qahYb/OE8aBFD zsAg== X-Gm-Message-State: AAQBX9dfuGqyEGIgjKhWCJuye6HhqXagkELhTIX5Mj5CEmCuuxIa/f7t 6ivXuUznLZOIs6y5V3Tk04k= X-Google-Smtp-Source: AKy350awVy0SBtXBy6A+vBmt/9LNmZwV6u6ES72nQZSJdLz0br4RES1Ja9xVE9PyBmPTkc2NHVXu8A== X-Received: by 2002:a2e:9d50:0:b0:29b:d4d8:4d97 with SMTP id y16-20020a2e9d50000000b0029bd4d84d97mr2998570ljj.3.1679904744920; Mon, 27 Mar 2023 01:12:24 -0700 (PDT) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id z2-20020a2e8402000000b002a32238ea10sm1460263ljg.53.2023.03.27.01.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 01:12:24 -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 06/11] video: tegra-dc: add 180 degree panel rotation Date: Mon, 27 Mar 2023 11:11:45 +0300 Message-Id: <20230327081150.4585-7-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-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 Unlike 90 and 270 degree rotation, 180 degree rotation is more common and does not require scaling. Implement it for correct grouper support. Tested-by: Andreas Westman Dorcsak # Google Nexus 7 2012 Tested-by: Svyatoslav Ryhel # Google Nexus 7 2012 Signed-off-by: Svyatoslav Ryhel --- drivers/video/tegra20/tegra-dc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c index e004ee362f..e279650922 100644 --- a/drivers/video/tegra20/tegra-dc.c +++ b/drivers/video/tegra20/tegra-dc.c @@ -37,6 +37,7 @@ struct tegra_lcd_priv { fdt_addr_t frame_buffer; /* Address of frame buffer */ unsigned pixel_clock; /* Pixel clock in Hz */ int dc_clk[2]; /* Contains clk and its parent */ + bool rotation; /* 180 degree panel turn */ }; enum { @@ -46,8 +47,10 @@ enum { LCD_MAX_LOG2_BPP = VIDEO_BPP16, }; -static void update_window(struct dc_ctlr *dc, struct disp_ctl_win *win) +static void update_window(struct tegra_lcd_priv *priv, + struct disp_ctl_win *win) { + struct dc_ctlr *dc = priv->dc; unsigned h_dda, v_dda; unsigned long val; @@ -88,6 +91,10 @@ static void update_window(struct dc_ctlr *dc, struct disp_ctl_win *win) val = WIN_ENABLE; if (win->bpp < 24) val |= COLOR_EXPAND; + + if (priv->rotation) + val |= H_DIRECTION | V_DIRECTION; + writel(val, &dc->win.win_opt); writel((unsigned long)win->phys_addr, &dc->winbuf.start_addr); @@ -224,8 +231,14 @@ static void rgb_enable(struct dc_com_reg *com) static int setup_window(struct disp_ctl_win *win, struct tegra_lcd_priv *priv) { - win->x = 0; - win->y = 0; + if (priv->rotation) { + win->x = priv->width * 2; + win->y = priv->height; + } else { + win->x = 0; + win->y = 0; + } + win->w = priv->width; win->h = priv->height; win->out_x = 0; @@ -298,7 +311,7 @@ static int tegra_display_probe(const void *blob, struct tegra_lcd_priv *priv, if (setup_window(&window, priv)) return -1; - update_window(priv->dc, &window); + update_window(priv, &window); return 0; } @@ -370,6 +383,8 @@ static int tegra_lcd_of_to_plat(struct udevice *dev) return -EINVAL; } + priv->rotation = dev_read_bool(dev, "nvidia,180-rotation"); + rgb = fdt_subnode_offset(blob, node, "rgb"); if (rgb < 0) { debug("%s: Cannot find rgb subnode for '%s' (ret=%d)\n", -- 2.37.2