From patchwork Thu Jul 26 11:13:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hideki EIRAKU X-Patchwork-Id: 1241671 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 0F2253FC5A for ; Thu, 26 Jul 2012 11:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526Ab2GZLNx (ORCPT ); Thu, 26 Jul 2012 07:13:53 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:61810 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520Ab2GZLNu (ORCPT ); Thu, 26 Jul 2012 07:13:50 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so3069482pbb.19 for ; Thu, 26 Jul 2012 04:13:50 -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=fk1/I5WhvfLiDlDtPtURreBjrK0zi7QaIELmleUs7YWrj88BUX0JSU6fW0jJXtU398 qA3wLGVsCNOvIhLwsZakZs0cUrxOMplWgD7w5Yt0QkOzcc+VnovbOpz3rH/4kuQd0+C/ V7yqoCIIq+r0slUc2k3J0NvKyt4Kk+3skBXjtookklMnBt4H44Z8WjGmq2fDeaXz6KY4 gvAIz5ukwYhqVwpkAUXAFxRCxXDFov7+9Cir1+h4IqYT3EUR528Wh7ty2cKqDBoJ4+Yi xVbs42l9Uhqea2tF8osCwYRRczCI8V/eHXuzrTU4z+BbisEc7q4vKfSnrImcKQr/f/fv ZZTw== Received: by 10.68.221.70 with SMTP id qc6mr4470719pbc.92.1343301229913; Thu, 26 Jul 2012 04:13:49 -0700 (PDT) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPS id ru10sm16359210pbc.50.2012.07.26.04.13.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 04:13:49 -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 v2 4/4] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available Date: Thu, 26 Jul 2012 20:13:11 +0900 Message-Id: <1343301191-26001-5-git-send-email-hdk@igel.co.jp> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1343301191-26001-1-git-send-email-hdk@igel.co.jp> References: <1343301191-26001-1-git-send-email-hdk@igel.co.jp> X-Gm-Message-State: ALoCoQkWBeynKnw2ZD443F6SnCsrMqSlwNEkap+8wZUvxMFBsrksR0Ixs6Wn+SQp5xzO8ugWfg4U 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: 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