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: 1241681 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 2955D4025E for ; Thu, 26 Jul 2012 11:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328Ab2GZLNx (ORCPT ); Thu, 26 Jul 2012 07:13:53 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:47092 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752519Ab2GZLNu (ORCPT ); Thu, 26 Jul 2012 07:13:50 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so3069479pbb.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=T0vfV0I871R8bSg327JgSWYr7juJN9VAre9l5W8YZlf2X0XoZVvpA8bSWZ9zJiyhhq YU2UKOfHa4D1fu4MxPwqbfL4Bw/IRyCXd/lqw8A4DUdJqWKlGQ/QiiQ0IYSXMBkek/bA vl8/U7GSBDtoCa6/szB0OUm1AIY/ZoUwiccC8X5UL+3uzGRufba434VYoetUfGm2nqEQ pQw2+JyEQnQbVkv4SuHNTTME7CNDiGcECU7AApNxZXP8hpztOSRaw8qvkqP9+WxuZRhO 2N/TrQ3i8AgD7FsPtUYz0hqWRqM/8BiX43XfC24zF9huAdhWwv5ZtZumSJfZP1G7rSug aFhg== 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: ALoCoQmqOnffJG40CkltKiWnzgqvAvCkk5zb/xois7A0Vz1AlkQhSmPRcZK/KG/6/n5BA6u5IGWJ 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: 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