From patchwork Fri Apr 5 10:31:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Pargmann X-Patchwork-Id: 2397731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id D4D043FD8C for ; Fri, 5 Apr 2013 10:36:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO40i-00033V-1n for patchwork-linux-arm@patchwork.kernel.org; Fri, 05 Apr 2013 10:36:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO3w8-0007XA-1r; Fri, 05 Apr 2013 10:32:00 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UO3vt-0007Q2-8f for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2013 10:31:46 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UO3ve-0000TI-3Q; Fri, 05 Apr 2013 12:31:30 +0200 Received: from mpa by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1UO3vd-0001IP-EH; Fri, 05 Apr 2013 12:31:29 +0200 From: Markus Pargmann To: Florian Tobias Schandinat Subject: [PATCH v3 1/2] imxfb: Set alpha value of the framebuffer Date: Fri, 5 Apr 2013 12:31:15 +0200 Message-Id: <1365157876-1757-2-git-send-email-mpa@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1365157876-1757-1-git-send-email-mpa@pengutronix.de> References: <1365157876-1757-1-git-send-email-mpa@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130405_063145_559012_A83C5FAC X-CRM114-Status: GOOD ( 18.44 ) X-Spam-Score: -4.3 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-fbdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Rob Herring , Grant Likely , Sascha Hauer , Christian Hemp , Markus Pargmann , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Christian Hemp Based on Sascha Hauer's patch i.MX27 clock: Do not disable lcd clocks during startup. This patch gives a interface to chance the alphavalue of the framebuffer. Signed-off-by: Christian Hemp rebased to 3.7 Signed-off-by: Markus Pargmann --- drivers/video/imxfb.c | 35 +++++++++++++++++++++++++++++++ include/linux/platform_data/video-imxfb.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 0abf2bf..ef2b587 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -112,6 +113,10 @@ #define LCDISR_EOF (1<<1) #define LCDISR_BOF (1<<0) +#define LCDC_LGWCR 0x64 +#define LGWCR_GWAV(alpha) (((alpha) & 0xff) << 24) +#define LGWCR_GWE (1 << 22) + /* Used fb-mode. Can be set on kernel command line, therefore file-static. */ static const char *fb_mode; @@ -610,6 +615,35 @@ static int imxfb_blank(int blank, struct fb_info *info) return 0; } +static int imxfb_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) +{ + struct imxfb_info *fbi = info->par; + int alpha, ret = 0; + unsigned int tmp; + + switch (cmd) { + case IMXFB_ALPHA: + if (get_user(alpha, (int __user *)arg)) { + ret = -EFAULT; + } else { + tmp = readl(fbi->regs + LCDC_LGWCR); + tmp &= ~LGWCR_GWAV(0xff); + tmp |= LGWCR_GWAV(alpha); + if (!alpha) + tmp &= ~LGWCR_GWE; + else + tmp |= LGWCR_GWE; + writel(tmp , fbi->regs + LCDC_LGWCR); + } + break; + default: + ret = -EINVAL; + } + + return ret; +} + static struct fb_ops imxfb_ops = { .owner = THIS_MODULE, .fb_check_var = imxfb_check_var, @@ -619,6 +653,7 @@ static struct fb_ops imxfb_ops = { .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, .fb_blank = imxfb_blank, + .fb_ioctl = imxfb_ioctl, }; /* diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h index 9de8f06..ce3875f 100644 --- a/include/linux/platform_data/video-imxfb.h +++ b/include/linux/platform_data/video-imxfb.h @@ -51,6 +51,9 @@ #define DMACR_HM(x) (((x) & 0xf) << 16) #define DMACR_TM(x) ((x) & 0xf) +#define IMXFB_IOW(num, dtype) _IOW('I', num, dtype) +#define IMXFB_ALPHA IMXFB_IOW(31, int) + struct imx_fb_videomode { struct fb_videomode mode; u32 pcr;