From patchwork Fri Aug 3 12:08:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martin X-Patchwork-Id: 174983 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 41F642C0079 for ; Fri, 3 Aug 2012 22:12:17 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SxGgJ-0004Gg-6O; Fri, 03 Aug 2012 12:08:39 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SxGgF-0004GS-Rr for linux-arm-kernel@lists.infradead.org; Fri, 03 Aug 2012 12:08:36 +0000 Received: by wgbez12 with SMTP id ez12so377835wgb.18 for ; Fri, 03 Aug 2012 05:08:32 -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:x-gm-message-state; bh=pfj0obXgI559CP4ckHbdBIUFdF5UB4726JBNnsld5T0=; b=XlzvPNui7/vnEsIq013NV2VeW4IVK/PEJFERUTx0WRcMRfZbJqOpM1hrnykjatAWpT mPHJTXDVkY5Hlto1UiJlCzavpdoEhKVpu08P6YgaDw/er6MnBsk7V/xcxFOini0GPKkd LPyoHTnlEwbhK2KFCSgY9ik1yBe/1xrVQZ0F6zzeWePbco8l+G+dq6DmYPTNu/JXPxMn 99pl2Co7zga/INtK23IAPhLc3IlpndiCf8pHk5QNjmOxiyDyAg23+MBnFPCX7xzX1QgG TiFuLhBCoNksEIkDzfuQPA+Jw49MTT5QxD2DHdBeoPjhTRCVFCOeFZgQckN5EJ8sbXvn 3jSw== Received: by 10.216.41.195 with SMTP id h45mr852735web.74.1343995712348; Fri, 03 Aug 2012 05:08:32 -0700 (PDT) Received: from piscis.vsilicon.net (122.251.106.212.dynamic.jazztel.es. [212.106.251.122]) by mx.google.com with ESMTPS id eu4sm39160235wib.2.2012.08.03.05.08.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Aug 2012 05:08:31 -0700 (PDT) From: Javier Martin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] Visstrim SM10: Use mo_version to decide board video mode. Date: Fri, 3 Aug 2012 14:08:23 +0200 Message-Id: <1343995703-13578-1-git-send-email-javier.martin@vista-silicon.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmERRPcj884oHp4usPE2uMVTNc+FlbXT1PfKy/6EIWPXtLTykFog4QHDgbpVJ8XxiEUh04I X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: baruch@tkos.co.il, linux@arm.linux.org.uk, Javier Martin , kernel@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org If the mother board version number is odd, emmaprp() for format conversion + UVC camera will be used. Otherwise mx2_camera and m2m-deinterlacer will be registered. For both cases Coda video codec is registered. Signed-off-by: Javier Martin --- Changes since v1: - Add error message to emmaprp init function. --- arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 54 ++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index 176533e..dbb344a 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c @@ -49,6 +49,10 @@ #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) #define SDHC1_IRQ IRQ_GPIOB(25) +#define VERSION_MASK 0x7 +#define MOTHERBOARD_SHIFT 4 +#define EXPBOARD_SHIFT 0 + #define MOTHERBOARD_BIT2 (GPIO_PORTD + 31) #define MOTHERBOARD_BIT1 (GPIO_PORTD + 30) #define MOTHERBOARD_BIT0 (GPIO_PORTD + 29) @@ -205,7 +209,7 @@ static struct mx2_camera_platform_data visstrim_camera = { static phys_addr_t mx2_camera_base __initdata; #define MX2_CAMERA_BUF_SIZE SZ_8M -static void __init visstrim_camera_init(void) +static void __init visstrim_analog_camera_init(void) { struct platform_device *pdev; int dma; @@ -442,6 +446,29 @@ static void __init visstrim_deinterlace_init(void) return; } +/* Emma-PrP for format conversion */ +static void __init visstrim_emmaprp_init(void) +{ + struct platform_device *pdev; + int dma; + + pdev = imx27_add_mx2_emmaprp(); + if (IS_ERR(pdev)) + return; + + /* + * Use the same memory area as the analog camera since both + * devices are, by nature, exclusive. + */ + dma = dma_declare_coherent_memory(&pdev->dev, + mx2_camera_base, mx2_camera_base, + MX2_CAMERA_BUF_SIZE, + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); + if (!(dma & DMA_MEMORY_MAP)) { + pr_err("Failed to declare memory for emmaprp\n"); + return; + } +} static void __init visstrim_m10_revision(void) { @@ -467,13 +494,14 @@ static void __init visstrim_m10_revision(void) mo_version |= !gpio_get_value(MOTHERBOARD_BIT0); system_rev = 0x27000; - system_rev |= (mo_version << 4); - system_rev |= exp_version; + system_rev |= (mo_version << MOTHERBOARD_SHIFT); + system_rev |= (exp_version << EXPBOARD_SHIFT); } static void __init visstrim_m10_board_init(void) { int ret; + int mo_version; imx27_soc_init(); visstrim_m10_revision(); @@ -505,8 +533,24 @@ static void __init visstrim_m10_board_init(void) platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, &iclink_tvp5150, sizeof(iclink_tvp5150)); gpio_led_register_device(0, &visstrim_m10_led_data); - visstrim_deinterlace_init(); - visstrim_camera_init(); + + /* Use mother board version to decide what video devices we shall use */ + mo_version = (system_rev >> MOTHERBOARD_SHIFT) & VERSION_MASK; + if (mo_version & 0x1) { + visstrim_emmaprp_init(); + + /* + * Despite not being used, tvp5150 must be + * powered on to avoid I2C problems. To minimize + * power consupmtion keep reset enabled. + */ + gpio_set_value(TVP5150_PWDN, 1); + ndelay(1); + gpio_set_value(TVP5150_RSTN, 0); + } else { + visstrim_deinterlace_init(); + visstrim_analog_camera_init(); + } visstrim_coda_init(); }