From patchwork Thu Aug 25 19:51:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 1096442 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7PDuF8d010801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 25 Aug 2011 13:56:36 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwaPA-0006RE-Gm; Thu, 25 Aug 2011 13:55:37 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QwaP5-0003RW-0i; Thu, 25 Aug 2011 13:55:31 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QwaOV-0003LH-DD for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2011 13:54:56 +0000 Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LQH008PGLAT0O30@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2011 22:54:53 +0900 (KST) X-AuditID: cbfee61b-b7b7fae000005864-36-4e5654297c7f Received: from epmmp1 ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 68.58.22628.924565E4; Thu, 25 Aug 2011 22:54:49 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LQH00D1NLB42L@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2011 22:54:49 +0900 (KST) Date: Thu, 25 Aug 2011 15:51:57 -0400 From: Ajay Kumar Subject: [PATCH 2/2] video: s3c-fb: Modify s3c-fb driver to support window positioning In-reply-to: <1314301917-9938-1-git-send-email-ajaykumar.rs@samsung.com> To: linux-samsung-soc@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-id: <1314301917-9938-3-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.0.4 References: <1314301917-9938-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110825_095455_698499_5E6F32E9 X-CRM114-Status: GOOD ( 18.48 ) X-Spam-Score: -0.4 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [203.254.224.34 listed in list.dnswl.org] -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date Cc: banajit.g@samsung.com, FlorianSchandinat@gmx.de, jg1.han@samsung.com, lethal@linux-sh.org, ben-linux@fluff.org, m.szyprowski@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Aug 2011 13:56:36 +0000 (UTC) This patch modifies the existing s3c-fb driver to provide flexibility to the user to reposition the framebuffer windows. Signed-off-by: Ajay Kumar Signed-off-by: Banajit Goswami --- drivers/video/s3c-fb.c | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 0fda252..41179d7 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c @@ -442,6 +442,7 @@ static int s3c_fb_set_par(struct fb_info *info) struct fb_var_screeninfo *var = &info->var; struct s3c_fb_win *win = info->par; struct s3c_fb *sfb = win->parent; + struct s3cfb_window_pos *winpos = &win->windata->winpos; void __iomem *regs = sfb->regs; void __iomem *buf = regs; int win_no = win->index; @@ -539,12 +540,13 @@ static int s3c_fb_set_par(struct fb_info *info) /* write 'OSD' registers to control position of framebuffer */ - data = VIDOSDxA_TOPLEFT_X(0) | VIDOSDxA_TOPLEFT_Y(0); + data = VIDOSDxA_TOPLEFT_X(winpos->win_pos_x) | + VIDOSDxA_TOPLEFT_Y(winpos->win_pos_y); writel(data, regs + VIDOSD_A(win_no, sfb->variant)); - data = VIDOSDxB_BOTRIGHT_X(s3c_fb_align_word(var->bits_per_pixel, - var->xres - 1)) | - VIDOSDxB_BOTRIGHT_Y(var->yres - 1); + data = VIDOSDxB_BOTRIGHT_X((s3c_fb_align_word(var->bits_per_pixel, + (winpos->win_pos_x + var->xres - 1)))) | + VIDOSDxB_BOTRIGHT_Y((winpos->win_pos_y + var->yres - 1)); writel(data, regs + VIDOSD_B(win_no, sfb->variant)); @@ -999,8 +1001,10 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd, { struct s3c_fb_win *win = info->par; struct s3c_fb *sfb = win->parent; - int ret; + struct s3cfb_window_pos *winpos = &win->windata->winpos; + int ret = 0; u32 crtc; + u32 data; switch (cmd) { case FBIO_WAITFORVSYNC: @@ -1011,6 +1015,29 @@ static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd, ret = s3c_fb_wait_for_vsync(sfb, crtc); break; + case S3CFB_WIN_POSITION: + if (copy_from_user(winpos, (u32 __user *)arg, + sizeof(struct s3cfb_window_pos))) { + ret = -EFAULT; + break; + } + + shadow_protect_win(win, 1); + + /* write 'OSD' registers to set position of the window */ + data = VIDOSDxA_TOPLEFT_X(winpos->win_pos_x) | + VIDOSDxA_TOPLEFT_Y(winpos->win_pos_y); + writel(data, sfb->regs + VIDOSD_A(win->index, sfb->variant)); + + data = VIDOSDxB_BOTRIGHT_X( + s3c_fb_align_word(info->var.bits_per_pixel, + (winpos->win_pos_x + info->var.xres - 1))); + data |= VIDOSDxB_BOTRIGHT_Y(winpos->win_pos_y + + info->var.yres - 1); + writel(data, sfb->regs + VIDOSD_B(win->index, sfb->variant)); + + shadow_protect_win(win, 0); + break; default: ret = -ENOTTY; }