From patchwork Wed Feb 23 08:36:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 583711 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1N8arfW032622 for ; Wed, 23 Feb 2011 08:36:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932082Ab1BWIgw (ORCPT ); Wed, 23 Feb 2011 03:36:52 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:35722 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755110Ab1BWIgw (ORCPT ); Wed, 23 Feb 2011 03:36:52 -0500 Received: by iyb26 with SMTP id 26so2634535iyb.19 for ; Wed, 23 Feb 2011 00:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=vhuGz1h/yWGjDtAbvIgL6jbjtGH4ajWJtPY+YRQNESQ=; b=AvvbX3InD0IeK+dxrEwjZvr1p5R/hUuxDbN5E6eGGdAuOLXjHnyspHjp4IPoaMk59y 35ziga2eVJ/D/S70bOjSIxOr1r35vtlLCCcgESth3PxdpWSKdmh+raV2NSKFLPD6SOBp CUVFCsQe5VI1chv9yqmxGzgrb0qqOjNHkglig= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=E+xuwkbjr0L7+IPJBh7MmRfX0KAAyx34qhndKPzAvzk9VGWhaFJ2wQERXZdG+dG4es Of7iNE7Q72LXXEoJS3Q96+PKzQw6PVwX20u/cf+NLkLcvSP93sg0fgPirZB5g0KtbVqT nHDmGUyC6vvSa2PGJ4xSMKzrDq4MNus/XSEzg= Received: by 10.42.166.138 with SMTP id o10mr5062381icy.22.1298450211538; Wed, 23 Feb 2011 00:36:51 -0800 (PST) Received: from localhost.localdomain (e0109-114-22-40-118.uqwimax.jp [114.22.40.118]) by mx.google.com with ESMTPS id gy41sm7041163ibb.17.2011.02.23.00.36.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Feb 2011 00:36:50 -0800 (PST) From: Alexandre Courbot To: Magnus Damm Cc: linux-sh@vger.kernel.org, Alexandre Courbot Subject: [PATCH] fbdev: sh_mobile_lcdcfb: add blanking support Date: Wed, 23 Feb 2011 17:36:30 +0900 Message-Id: <1298450190-3803-1-git-send-email-gnurou@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 08:36:53 +0000 (UTC) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index bf12e53..994bcc7 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -965,6 +965,49 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in return 0; } +/* + * Screen blanking. Behavior is as follows: + * FB_BLANK_UNBLANK: screen unblanked, clocks enabled + * FB_BLANK_NORMAL: screen blanked, clocks enabled + * FB_BLANK_VSYNC, + * FB_BLANK_HSYNC, + * FB_BLANK_POWEROFF: screen blanked, clocks disabled + */ +static int sh_mobile_lcdc_blank(int blank, struct fb_info *info) +{ + struct sh_mobile_lcdc_chan *ch = info->par; + struct sh_mobile_lcdc_priv *p = ch->lcdc; + + /* blank the screen? */ + if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) { + struct fb_fillrect rect = { + .width = info->var.xres, + .height = info->var.yres, + }; + sh_mobile_lcdc_fillrect(info, &rect); + } + /* turn clocks on? */ + if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) { + sh_mobile_lcdc_clk_on(p); + } + /* turn clocks off? */ + if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) { + /* make sure the screen is updated with the black fill before + * switching the clocks off. one vsync is not enough since + * blanking may occur in the middle of a refresh. deferred io + * mode will reenable the clocks and update the screen in time, + * so it does not need this. */ + if (!info->fbdefio) { + sh_mobile_wait_for_vsync(info); + sh_mobile_wait_for_vsync(info); + } + sh_mobile_lcdc_clk_off(p); + } + + ch->blank_status = blank; + return 0; +} + static struct fb_ops sh_mobile_lcdc_ops = { .owner = THIS_MODULE, .fb_setcolreg = sh_mobile_lcdc_setcolreg, @@ -973,6 +1016,7 @@ static struct fb_ops sh_mobile_lcdc_ops = { .fb_fillrect = sh_mobile_lcdc_fillrect, .fb_copyarea = sh_mobile_lcdc_copyarea, .fb_imageblit = sh_mobile_lcdc_imageblit, + .fb_blank = sh_mobile_lcdc_blank, .fb_pan_display = sh_mobile_fb_pan_display, .fb_ioctl = sh_mobile_ioctl, .fb_open = sh_mobile_open, diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h index 9ecee2f..948dd24 100644 --- a/drivers/video/sh_mobile_lcdcfb.h +++ b/drivers/video/sh_mobile_lcdcfb.h @@ -35,6 +35,7 @@ struct sh_mobile_lcdc_chan { struct completion vsync_completion; struct fb_var_screeninfo display_var; int use_count; + int blank_status; struct mutex open_lock; /* protects the use counter */ };