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 8F79EC636CC for ; Mon, 20 Feb 2023 09:56:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 332AA85927; Mon, 20 Feb 2023 10:55:52 +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="lvd4ZGm1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F01FF857B1; Mon, 20 Feb 2023 10:55:02 +0100 (CET) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 6142485910 for ; Mon, 20 Feb 2023 10:54:54 +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-x536.google.com with SMTP id s26so2260347edw.11 for ; Mon, 20 Feb 2023 01:54:54 -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=VidRFU+p7QvuiDQP5Kf010fYpC/0B+HGhCNZfKRd6Vo=; b=lvd4ZGm1ayixECmhep+LsRMf/EOD5rlB4zF69bqX+xgystCljzF3HtMyI78RbzQzkf Jz3tqibfne7CFqkkGftRwxluONg13yLMeMY7Nft3MnYrNk1ILYdw6TGhSyYnOyJ4g+7l RBIpgxIJo9wEynrMHyORGHIoAXm2QJqG3rB8YG4c4tkD8r23qo1/1/6yGDKzQghDQKkH JTHK+DDglMYeMbQ3qjtO/rqOC9BG50/XYGSFAlOoPbKAshB1ObcgoaSJU6ia+zBC8HDn Bf6+4GyoHh6av8JBKnTRkP/YD2yz//GCyNQc8q33tMtIXieaPMhMgQCLE05WbUa7vOSv SqrA== 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=VidRFU+p7QvuiDQP5Kf010fYpC/0B+HGhCNZfKRd6Vo=; b=5vllccW0PQcM89ySILqBuLmqYPpjl7Gl/O4wadrWwtMPvmO8rUV7lVJh9raschsVXE 5BfsiDjZaK9IbKejLmyPPdQH34Xheup/5bBQNrlOO/33qMyiCS16K2Et04yWDK2VRHF1 Iuo3YjGEltvSjFAD3Ik9kKC26V9+Z7fTTqb0eh89E3N9GL5pt9xk6PiZcxKNYFLpiINo O19tm2MBFtIV3awhfkmRYjcNBrmq9HbrrT3oDIqYni6yK7EnATRay/vEV7fBkgFib1Nd Bj+rFvuw7xi2xx8xSqdCr8L0+yPBBkuKx6DgKxRP1Dt0zsj45VCujML1Qz4relFCaISc Disw== X-Gm-Message-State: AO0yUKXh6ZfvVi/zDUdrKKBoi+m/L8u8tLFPjvsb/a0+R3HnQyYt5KdQ uctHXQjHkp2UE0R/CB1hAfg= X-Google-Smtp-Source: AK7set/cw9jxYId16c0SUzKkPP0ZkK64v8Cyr9vrsZ7oPwpMwsCNPn6u9+5USDfFopzETxbRk0Lysg== X-Received: by 2002:a17:906:5390:b0:87b:e105:5d9a with SMTP id g16-20020a170906539000b0087be1055d9amr8358999ejo.67.1676886892433; Mon, 20 Feb 2023 01:54:52 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id bk7-20020a170906b0c700b008cd37aff603sm1636536ejb.164.2023.02.20.01.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 01:54:52 -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 06/11] video: tegra-dc: add 180 degree panel rotation Date: Mon, 20 Feb 2023 11:54:20 +0200 Message-Id: <20230220095425.6198-7-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-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 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: 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