From patchwork Thu Aug 16 10:13:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hideki EIRAKU X-Patchwork-Id: 1330611 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 854E440210 for ; Thu, 16 Aug 2012 10:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756914Ab2HPKO1 (ORCPT ); Thu, 16 Aug 2012 06:14:27 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:40311 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756945Ab2HPKOZ (ORCPT ); Thu, 16 Aug 2012 06:14:25 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr13so1359343pbb.19 for ; Thu, 16 Aug 2012 03:14:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=Xx65bN/Vt/03psJI8hupMP8LoQ9HYlOzYuhoiihG2dA=; b=kq8lvVYncSNix301EuQDUsILRUEgiqhQP7+ch90ZiRnwX3kBG/3ICuS0evBcSlELsT 3xZmmnzebwXfgSHsOhqrvZ/3CqgHY7CYAQnYiT4VWFbXDVQMSCdWACGWMFkOnzgw7SW+ Gq2MJy8ae23xK9eo5dmExkoy+VfSinnUWWJrt/mpTsCKHrusGM7nla/Ig+PdcXIm0t8c 1xvT7woINe21otLFMJ3g8r9HeD2so+3THunfxkElOjGB5lNUNvDJtpF5DXjgxiVjP9GZ lF0477RdDIWIkRq+TAQfT2QCF9OA19WlHR7K91cHvMyKV4m9TEd5CPb0/DVZB3XXfV3H PxNA== Received: by 10.68.132.41 with SMTP id or9mr2379247pbb.115.1345112065572; Thu, 16 Aug 2012 03:14:25 -0700 (PDT) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPS id qr2sm2397510pbc.35.2012.08.16.03.14.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Aug 2012 03:14:24 -0700 (PDT) From: Hideki EIRAKU To: Florian Tobias Schandinat Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski , Laurent Pinchart , Katsuya MATSUBARA , Damian Hobson-Garcia , Hideki EIRAKU Subject: [PATCH v4] fbdev: sh_mobile_lcdc: use dma_mmap_coherent Date: Thu, 16 Aug 2012 19:13:20 +0900 Message-Id: <1345112000-22738-1-git-send-email-hdk@igel.co.jp> X-Mailer: git-send-email 1.7.0.4 X-Gm-Message-State: ALoCoQlLXbK6g7XTx8dlLjW7LIVjsDyQO5oRRjvIClccCjgT8XyEGIPyAjOL+MuxlUFVmpw3kK/4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org fb_mmap() implemented in fbmem.c uses smem_start as the physical address of the frame buffer. In the sh_mobile_lcdc driver, the smem_start is a dma_addr_t that is not a physical address when IOMMU is enabled. dma_mmap_coherent() maps the address correctly. Signed-off-by: Hideki EIRAKU Acked-by: Laurent Pinchart --- drivers/video/sh_mobile_lcdcfb.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 699487c..bccfd7e 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1614,6 +1614,15 @@ static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info) return 1; } +static int +sh_mobile_lcdc_overlay_mmap(struct fb_info *info, struct vm_area_struct *vma) +{ + struct sh_mobile_lcdc_overlay *ovl = info->par; + + return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem, + ovl->dma_handle, ovl->fb_size); +} + static struct fb_ops sh_mobile_lcdc_overlay_ops = { .owner = THIS_MODULE, .fb_read = fb_sys_read, @@ -1626,6 +1635,7 @@ static struct fb_ops sh_mobile_lcdc_overlay_ops = { .fb_ioctl = sh_mobile_lcdc_overlay_ioctl, .fb_check_var = sh_mobile_lcdc_overlay_check_var, .fb_set_par = sh_mobile_lcdc_overlay_set_par, + .fb_mmap = sh_mobile_lcdc_overlay_mmap, }; static void @@ -2093,6 +2103,15 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info) return 0; } +static int +sh_mobile_lcdc_mmap(struct fb_info *info, struct vm_area_struct *vma) +{ + struct sh_mobile_lcdc_chan *ch = info->par; + + return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem, + ch->dma_handle, ch->fb_size); +} + static struct fb_ops sh_mobile_lcdc_ops = { .owner = THIS_MODULE, .fb_setcolreg = sh_mobile_lcdc_setcolreg, @@ -2108,6 +2127,7 @@ static struct fb_ops sh_mobile_lcdc_ops = { .fb_release = sh_mobile_lcdc_release, .fb_check_var = sh_mobile_lcdc_check_var, .fb_set_par = sh_mobile_lcdc_set_par, + .fb_mmap = sh_mobile_lcdc_mmap, }; static void