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: 1277831 Return-Path: X-Original-To: patchwork-linux-media@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 AFC5B40AC9 for ; Mon, 6 Aug 2012 09:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755795Ab2HFJ4h (ORCPT ); Mon, 6 Aug 2012 05:56:37 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:43381 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755756Ab2HFJ4Y (ORCPT ); Mon, 6 Aug 2012 05:56:24 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr13so2350021pbb.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=eLnUTdY+K83slKwBD35rpo9OgQn3dulcPAfgDgadyIaN5H8GM4vmmMJwiJO1To3wmr ZO7DNoRgIGv1w23BWGUOQula990uVmZj044TD/Y2E5QOZWWi+zLTUU9HaiHi1ORd/qmi UIKXSSEs0NmpDbTIxw1mnUd5YWflQeJh0lIRRbyDxRBo2HePKl8dAovxiAGdzCa6lIsf tlVbp+m4SL+0xb+du2DFEVdXb+HscmbCZ6lFRxfN46/+QygBF+vRa41oicbHd3lxwMTF 1m4m/p7Nx/onsz34EKzq50YoN1fgnUU2T/LpQ1qB4wC+Cr59tBpLr+EtNkT75b/Y5dsX eRkQ== 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: ALoCoQnVl2lqmYn/KC+PSggZFg0LBxYtPhb35CgafIZHC4MVZJVrZCiRwfsUTQowEg3w5LkcplzF Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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