From patchwork Sat Sep 17 19:33:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9337333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89D76601C2 for ; Sat, 17 Sep 2016 19:34:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E04E291CB for ; Sat, 17 Sep 2016 19:34:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7247B291E5; Sat, 17 Sep 2016 19:34:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2C08291CB for ; Sat, 17 Sep 2016 19:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752279AbcIQTeN (ORCPT ); Sat, 17 Sep 2016 15:34:13 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35444 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbcIQTeJ (ORCPT ); Sat, 17 Sep 2016 15:34:09 -0400 Received: by mail-pf0-f195.google.com with SMTP id 6so2173522pfl.2; Sat, 17 Sep 2016 12:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yPZwiPLCqLPKgNl22TuTC2kjaxLuPCB3iAUdQhsMtjY=; b=pM2N+LtBc+hCAIOgOopomMJQtsrNdBt48ytLFcSDmeS4KXjYMvq/zW0jHjhxhoiahX JuFykW8C60SMNCMSXCGGOUVXSa7kw+XtKrNH8eTw5EpqkTLOObh86iCNfKEXVO1swSdB QzAgbeUeetuEoRwS6ovQaNJhjKnYM6toFVbJLs3ra7tP43leKANikp8ej1v5Jjyg1BQG o+cfg0SUGZXkmF8grYs6/V3hXAi+6ZuOFXPOf+85qbE+6L/a6abYS3u5il6pq4JYy4Wd veKvynyPdF1a6mFCCRFb4lL6VL7EB3TKGhUgj3HTDlcsBIMGmbFLVLX8YPP31s+LogPl hTXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yPZwiPLCqLPKgNl22TuTC2kjaxLuPCB3iAUdQhsMtjY=; b=M8ltit2pvYpY7SRq7wnBeNC/Bi2JBBmx3ick0odYsjZrSMH31ez1BBDRKHrsJf6ZyH bgiRq6WPuw8iw+8GXq8AWoUKRUkv0R+w2Ogsdfd1jipTK5Ta2z3wwcnXEnz62A4Dp8D3 B713e3c3j552EfVAYoEtEtY+l97iEkP6wc0Z/KRvjBwZ1wFJ+5q4eznfXyrlfLlE80jj IzYfTiM8IdiPAzLYQj0eaFmwOUyHT0wcD1YBHNYgCNWafJGOB2CMkgr2S1qMSHSv8Pag RgNs/t/VIU1oyU5fSoOct3L1WytDJ4om2Ny5xr9BiNM0tslU3XfOLpjyrKcnENIQbzPT X0aA== X-Gm-Message-State: AE9vXwNZOIJKvRsxVOETpENnl+D+ADkGHwsYeNaI29mjBPp7blj19rXKUw6TCj3BZvCJ+A== X-Received: by 10.98.94.6 with SMTP id s6mr33572565pfb.31.1474140848503; Sat, 17 Sep 2016 12:34:08 -0700 (PDT) Received: from mappy.world.mentorg.com (c-98-234-136-200.hsd1.ca.comcast.net. [98.234.136.200]) by smtp.googlemail.com with ESMTPSA id an11sm20761627pac.26.2016.09.17.12.34.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Sep 2016 12:34:08 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: p.zabel@pengutronix.de, tomi.valkeinen@ti.com Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Steve Longerbeam Subject: [PATCH v7 2/3] gpu: ipu-v3: Add ipu_rot_mode_is_irt() Date: Sat, 17 Sep 2016 12:33:57 -0700 Message-Id: <1474140838-1082-3-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474140838-1082-1-git-send-email-steve_longerbeam@mentor.com> References: <1474140838-1082-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a macro that returns boolean true if the given ipu_rotate_mode requires the use of the Image Rotator. Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- include/video/imx-ipu-v3.h | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 1a37afc..321eb98 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -619,7 +619,7 @@ int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel, ipu_ic_write(ic, ic_idmac_2, IC_IDMAC_2); ipu_ic_write(ic, ic_idmac_3, IC_IDMAC_3); - if (rot >= IPU_ROTATE_90_RIGHT) + if (ipu_rot_mode_is_irt(rot)) ic->rotation = true; unlock: diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index 49d5439..f39a3d6 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h @@ -63,17 +63,25 @@ enum ipu_csi_dest { /* * Enumeration of IPU rotation modes */ +#define IPU_ROT_BIT_VFLIP (1 << 0) +#define IPU_ROT_BIT_HFLIP (1 << 1) +#define IPU_ROT_BIT_90 (1 << 2) + enum ipu_rotate_mode { IPU_ROTATE_NONE = 0, - IPU_ROTATE_VERT_FLIP, - IPU_ROTATE_HORIZ_FLIP, - IPU_ROTATE_180, - IPU_ROTATE_90_RIGHT, - IPU_ROTATE_90_RIGHT_VFLIP, - IPU_ROTATE_90_RIGHT_HFLIP, - IPU_ROTATE_90_LEFT, + IPU_ROTATE_VERT_FLIP = IPU_ROT_BIT_VFLIP, + IPU_ROTATE_HORIZ_FLIP = IPU_ROT_BIT_HFLIP, + IPU_ROTATE_180 = (IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP), + IPU_ROTATE_90_RIGHT = IPU_ROT_BIT_90, + IPU_ROTATE_90_RIGHT_VFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_VFLIP), + IPU_ROTATE_90_RIGHT_HFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_HFLIP), + IPU_ROTATE_90_LEFT = (IPU_ROT_BIT_90 | + IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP), }; +/* 90-degree rotations require the IRT unit */ +#define ipu_rot_mode_is_irt(m) (((m) & IPU_ROT_BIT_90) != 0) + enum ipu_color_space { IPUV3_COLORSPACE_RGB, IPUV3_COLORSPACE_YUV,