From patchwork Mon Aug 6 09:55: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: 1277801 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 08ABBDFF71 for ; Mon, 6 Aug 2012 09:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755737Ab2HFJ4h (ORCPT ); Mon, 6 Aug 2012 05:56:37 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:39532 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755758Ab2HFJ4Y (ORCPT ); Mon, 6 Aug 2012 05:56:24 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr13so2350020pbb.19 for ; Mon, 06 Aug 2012 02:56:24 -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=l3JPx29qWFfrf5QoL6DbtrbTguwQIt3LeKSwMLPvHaY=; b=nUBcr5dJ5YwMR2NeEBXL22+Adwa5xV/8LOEK6+htXRrLkGB3NxcZei6f78EhWCLbKI J4d6aV73lEm9Xgu2SwsoJtOdeRBhZV0xoA9EEXHwuftqa5kFJ6eAICNySRz61zmXI3ds 3L8EXeXPhPeSF6V2FOdUrekMVCJ6FyQzKo4dzmGKzNzH6Z9NZb9H59o7rfPrg3gqVhge 9pgMA/+FRdK9Gvaq9Nw4DG9ZJQ5VJhmn/th909Ov8ErG4Q76aPUzUBARPOs4TXo+num9 JLkpzGoslG5XqqG7oeKZPCnU66+rk6tNleAFOSuyzX8ViFTfzBg2AQIpaRHGiWL4jNO7 87Ew== Received: by 10.68.227.37 with SMTP id rx5mr17540493pbc.47.1344246984203; Mon, 06 Aug 2012 02:56:24 -0700 (PDT) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPS id qd10sm8650359pbb.38.2012.08.06.02.56.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Aug 2012 02:56:23 -0700 (PDT) From: Hideki EIRAKU To: Russell King , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , Florian Tobias Schandinat , Jaroslav Kysela , Takashi Iwai Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org, Katsuya MATSUBARA , Hideki EIRAKU Subject: [PATCH v3 4/4] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available Date: Mon, 6 Aug 2012 18:55:24 +0900 Message-Id: <1344246924-32620-5-git-send-email-hdk@igel.co.jp> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1344246924-32620-1-git-send-email-hdk@igel.co.jp> References: <1344246924-32620-1-git-send-email-hdk@igel.co.jp> X-Gm-Message-State: ALoCoQl7ekPwaDyJ+LpsMcpVaZprRZJLb1VXcewnhKbmy71DL2Lj7Z0TZBodWN+9le+Tmrut54ZI 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 Acked-by: Hideki EIRAKU Acked-by: Laurent Pinchart --- drivers/video/sh_mobile_lcdcfb.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8cb653b..c8cba7a 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1614,6 +1614,17 @@ static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info) return 1; } +#ifdef ARCH_HAS_DMA_MMAP_COHERENT +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); +} +#endif + static struct fb_ops sh_mobile_lcdc_overlay_ops = { .owner = THIS_MODULE, .fb_read = fb_sys_read, @@ -1626,6 +1637,9 @@ 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, +#ifdef ARCH_HAS_DMA_MMAP_COHERENT + .fb_mmap = sh_mobile_lcdc_overlay_mmap, +#endif }; static void @@ -2093,6 +2107,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_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); +} +#endif + static struct fb_ops sh_mobile_lcdc_ops = { .owner = THIS_MODULE, .fb_setcolreg = sh_mobile_lcdc_setcolreg, @@ -2108,6 +2133,9 @@ 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, +#ifdef ARCH_HAS_DMA_MMAP_COHERENT + .fb_mmap = sh_mobile_lcdc_mmap, +#endif }; static void