From patchwork Wed Jul 25 06:29:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hideki EIRAKU X-Patchwork-Id: 1235681 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 B851940D46 for ; Wed, 25 Jul 2012 06:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932710Ab2GYGaY (ORCPT ); Wed, 25 Jul 2012 02:30:24 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:49738 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932880Ab2GYGaV (ORCPT ); Wed, 25 Jul 2012 02:30:21 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so905749pbb.19 for ; Tue, 24 Jul 2012 23:30:21 -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:in-reply-to:references :x-gm-message-state; bh=7N+1TgQ12KOsvT06iMrPgo+78ROWZPzKVkFClphkSFk=; b=TkE9iAeSF2npj4+2jAi+t0C4epRv1H62BJHCDVoWu9yukIH7olSwcfXGrql3q7sO9J Fn0HKLdLr5PKDwFT7lOiDWDsskKvWzQVlIyC3b4ecFGSqAnPD4OC/+na+BVxrH9sc0aC BC+a7VTdB8ldUMANCgiFCsQ5690ktFS/We/WiwF/5h9a8Xsfs6ZTm3H7cVXW1iKeeMQz LolS7aOzmvgeEEi2WajbxQqEQjn00PTgHS2Otqkiw/7cKC6HJuTv7mZ/Q5buRZJcJXsT La4ef7kfRfOAiXDDwe4XchIaEJinp4s0qyG9wJZSrbmkOhPOlktQry/uPeOtE121wS3x xlLQ== Received: by 10.68.132.166 with SMTP id ov6mr51821127pbb.24.1343197821170; Tue, 24 Jul 2012 23:30:21 -0700 (PDT) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPS id jz4sm13740730pbc.17.2012.07.24.23.30.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 23:30:20 -0700 (PDT) From: Hideki EIRAKU To: Russell King , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , Florian Tobias Schandinat Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-fbdev@vger.kernel.org, Katsuya MATSUBARA , Hideki EIRAKU Subject: [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available Date: Wed, 25 Jul 2012 15:29:24 +0900 Message-Id: <1343197764-13659-4-git-send-email-hdk@igel.co.jp> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1343197764-13659-1-git-send-email-hdk@igel.co.jp> References: <1343197764-13659-1-git-send-email-hdk@igel.co.jp> X-Gm-Message-State: ALoCoQnIFxqUWksAGnJNRmnBSs5+kgqMSfEOL5bwNjdSnC/xpguX6djMUsNNHs5/RiWyJ2gAkTgN 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. It is available on ARM platforms. Signed-off-by: Hideki EIRAKU --- drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index e672698..65732c4 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info) return 0; } +#ifdef ARCH_HAS_DMA_MMAP_COHERENT +static int +sh_mobile_fb_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); +} +#endif + static struct fb_ops sh_mobile_lcdc_ops = { .owner = THIS_MODULE, .fb_setcolreg = sh_mobile_lcdc_setcolreg, @@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = { .fb_release = sh_mobile_release, .fb_check_var = sh_mobile_check_var, .fb_set_par = sh_mobile_set_par, +#ifdef ARCH_HAS_DMA_MMAP_COHERENT + .fb_mmap = sh_mobile_fb_mmap, +#endif }; static void