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 84022C64ED6 for ; Sun, 26 Feb 2023 18:22:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7F03F85945; Sun, 26 Feb 2023 19:21:11 +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="PdUhE6eH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6065185905; Sun, 26 Feb 2023 19:20:42 +0100 (CET) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (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 3C64C85935 for ; Sun, 26 Feb 2023 19:20:36 +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-lf1-x136.google.com with SMTP id s20so5660290lfb.11 for ; Sun, 26 Feb 2023 10:20:36 -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=dqYDxFeuqOSNrPhBv+EAyxhKsJSn/GTQwKeO/KJrF5g=; b=PdUhE6eHJGnjRm2V4cbc1LUbCR4pLyA7nSRjze/jjZVTlghwXm8T7PIBSib0EUw+OP s2nnDeFPBFMVW4Uk9ifcCR4oBMP2L7S34J1DZDnZ5o4iGLYKE5r92uD89s7qS6VpEMHi M7piaQwtrSD6H60+0uEWee+iXH7KTIUhKFTLgUBY9SswPVJJbY/aOrjD9qVhpsgej5Hn s+K4fEsihPTYqQV8+j7U+TV/Fq3J8t3IrF4ruTwM1A/Q/qK2Kea7/XRRFXjuiyJS8kEZ bnxk9wSUS4C5XO/KHeWbQQshwWkn854+f9tGdkHR3So9/wqqQ7PHMLsynls1gqGPhcSl kRxg== 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=dqYDxFeuqOSNrPhBv+EAyxhKsJSn/GTQwKeO/KJrF5g=; b=WGlEy2u6SJaNRaJeyaOn/gpxMGSD+Vl8Zk28YVwQgsV22iDSYrZDT6hz/od7dYFAPr yc56IuzMjPX6GavSCrosHTFTywEewYNvR3lxIzoBIdEyP8Bq8B91hPK8KEP0af++TPnR U+tFosewCnL40kMNMOCEcaqFe8d8kfMGcKkwfP1NtSJIlF7CZmU8VTEpgNWU8PM3yHTN E1pkba6kQIpolVDaJfSbjM1xz8E5ait/POK9FQsDSP0EKxnwo/sa0zkR3gH3Vq1wln6H S10axgpXvZ6XsiOxfP7BDLnFHhx7nXOJyTWBpE9oN/QOabEN+QvhbIsNssQDYAk5fUJS 4m5w== X-Gm-Message-State: AO0yUKWd7ykYoMw1ueIM75elkcyz+YpgqK+OknkoECZtuEF7sUIj9ciF To01JoiVxMA0siHduL6Yx/g= X-Google-Smtp-Source: AK7set+UYJoicbptcVf0bc/rBSey5Xbuy/FNGLuDVY+aj3eqqeyqDYu81fC5eo+G5wFDA7xM+SkZRA== X-Received: by 2002:ac2:5323:0:b0:4cc:6f42:a097 with SMTP id f3-20020ac25323000000b004cc6f42a097mr7210160lfh.26.1677435635450; Sun, 26 Feb 2023 10:20:35 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id x25-20020ac259d9000000b004dc4d984911sm619421lfn.271.2023.02.26.10.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 10:20:35 -0800 (PST) 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 v2 06/11] video: tegra-dc: add 180 degree panel rotation Date: Sun, 26 Feb 2023 20:20:00 +0200 Message-Id: <20230226182005.27291-7-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230226182005.27291-1-clamor95@gmail.com> References: <20230226182005.27291-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: 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