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: 1235671 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 9DA084025E for ; Wed, 25 Jul 2012 06:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932931Ab2GYGaX (ORCPT ); Wed, 25 Jul 2012 02:30:23 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:36250 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932876Ab2GYGaV (ORCPT ); Wed, 25 Jul 2012 02:30:21 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so905752pbb.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=QdldaTQXcW4z7WPuP1MECFVWPW/RRkiUdqVSrJNHtd/9+Lo2xagfB4HTjyDVHy4WH3 yjkvAWlQtjvcXVmBrip9A2Rk1VPEg2vjInAEdPCtQ8fOkRrflEi0b6ro7nj36iZNbEsb u4zCTCgbFk0VhB0LKLy6QqYy0m0xXYz00cONEOLGTMJsupfes5lqQp2GAwoPDAIea0rQ gJZPNYWW/lHP2/2dyVwEE7mjbApMsEiKV/1lWRL/Gob+5tgoXhn5HZbT61Mxn7D452ht FTLRos5S4P0+h8DUJL0MJmNHBc2bN8hleU8rm9q/bu8z9ZdWZ13hQ48kj90bEtYEVOMx MnmQ== 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: ALoCoQm0OFYGP4xOgcFY8cBFRlSjaGWU5HLJrzBNgMlvgSQvbW3LXqLQdly5VF/0DUR5WVYKmQrI 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 --- 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