From patchwork Mon Apr 8 15:05:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2408931 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5D462DFB78 for ; Mon, 8 Apr 2013 15:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964928Ab3DHPGA (ORCPT ); Mon, 8 Apr 2013 11:06:00 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:58375 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964852Ab3DHPF7 (ORCPT ); Mon, 8 Apr 2013 11:05:59 -0400 Received: from axis700.grange (dslb-088-077-162-116.pools.arcor-ip.net [88.77.162.116]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MM0VQ-1UWt9H2yY0-007hwe; Mon, 08 Apr 2013 17:05:44 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id E8C8F40BC3; Mon, 8 Apr 2013 17:05:41 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UPDdd-0004AR-Gf; Mon, 08 Apr 2013 17:05:41 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Hans Verkuil , Sylwester Nawrocki , Sylwester Nawrocki , linux-sh@vger.kernel.org, Magnus Damm , Sakari Ailus , Prabhakar Lad , Guennadi Liakhovetski Subject: [PATCH v8 7/7] ARM: shmobile: convert ap4evb to asynchronously register camera subdevices Date: Mon, 8 Apr 2013 17:05:38 +0200 Message-Id: <1365433538-15975-8-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1365433538-15975-1-git-send-email-g.liakhovetski@gmx.de> References: <1365433538-15975-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:k/jWnUFKmHOi2sneUB9AYr3mAsFZr14X+MgGz5SSeMW LjXuSbKWCl0Rn1whK02ZFyJuajMivLTYFmaL4BCXlQp35ZQQHt qAvaVyHUb6DamEFCyAp4GspIUtQCi7fUN1d+H8j0NURWkafXF7 nZ4YOIrx/3DgM757KQ9ApEWop8G0WcMYsBfubp8mVRfNrD/ei0 BXyVQik4jZWmgL5QrDVb+VVm/b/tdsxXCZFiCrKEjzm1CQkG2T glLcNL3fxc6d0YtRYCK1iScYmNXD0iWQepEhMSpJdmU6/fQDrG au4s04UePrg9E1Cv5ha9vByT2QFxHyAyLu7PCEyIUr+nPQUDS4 4rFu9H3/xPYHkns3QkpOL7pIPiUD9Gj1C8PaE0nWY/oJDQ+9DP o0yykSoXQ5ALw== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Register the imx074 camera I2C and the CSI-2 platform devices directly in board platform data instead of letting the sh_mobile_ceu_camera driver and the soc-camera framework register them at their run-time. This uses the V4L2 asynchronous subdevice probing capability. Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-shmobile/board-ap4evb.c | 103 +++++++++++++++++++------------- arch/arm/mach-shmobile/clock-sh7372.c | 1 + 2 files changed, 62 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 38f1259..450e06b 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -871,22 +872,32 @@ static struct platform_device leds_device = { }, }; -static struct i2c_board_info imx074_info = { - I2C_BOARD_INFO("imx074", 0x1a), +/* I2C */ +static struct soc_camera_subdev_desc imx074_desc; +static struct i2c_board_info i2c0_devices[] = { + { + I2C_BOARD_INFO("ak4643", 0x13), + }, { + I2C_BOARD_INFO("imx074", 0x1a), + .platform_data = &imx074_desc, + }, }; -static struct soc_camera_link imx074_link = { - .bus_id = 0, - .board_info = &imx074_info, - .i2c_adapter_id = 0, - .module_name = "imx074", +static struct i2c_board_info i2c1_devices[] = { + { + I2C_BOARD_INFO("r2025sd", 0x32), + }, }; -static struct platform_device ap4evb_camera = { - .name = "soc-camera-pdrv", - .id = 0, - .dev = { - .platform_data = &imx074_link, +static struct resource csi2_resources[] = { + { + .name = "CSI2", + .start = 0xffc90000, + .end = 0xffc90fff, + .flags = IORESOURCE_MEM, + }, { + .start = intcs_evt2irq(0x17a0), + .flags = IORESOURCE_IRQ, }, }; @@ -895,7 +906,7 @@ static struct sh_csi2_client_config csi2_clients[] = { .phy = SH_CSI2_PHY_MAIN, .lanes = 0, /* default: 2 lanes */ .channel = 0, - .pdev = &ap4evb_camera, + .name = "imx074", }, }; @@ -906,31 +917,50 @@ static struct sh_csi2_pdata csi2_info = { .flags = SH_CSI2_ECC | SH_CSI2_CRC, }; -static struct resource csi2_resources[] = { - [0] = { - .name = "CSI2", - .start = 0xffc90000, - .end = 0xffc90fff, - .flags = IORESOURCE_MEM, +static struct platform_device csi2_device = { + .name = "sh-mobile-csi2", + .id = 0, + .num_resources = ARRAY_SIZE(csi2_resources), + .resource = csi2_resources, + .dev = { + .platform_data = &csi2_info, }, - [1] = { - .start = intcs_evt2irq(0x17a0), - .flags = IORESOURCE_IRQ, +}; + +static struct soc_camera_async_subdev csi2_sd = { + .asd.hw = { + .bus_type = V4L2_ASYNC_BUS_PLATFORM, + .match.platform.name = "sh-mobile-csi2.0", }, + .role = SOCAM_SUBDEV_DATA_PROCESSOR, }; -static struct sh_mobile_ceu_companion csi2 = { - .id = 0, - .num_resources = ARRAY_SIZE(csi2_resources), - .resource = csi2_resources, - .platform_data = &csi2_info, +static struct soc_camera_async_subdev imx074_sd = { + .asd.hw = { + .bus_type = V4L2_ASYNC_BUS_I2C, + .match.i2c = { + .adapter_id = 0, + .address = 0x1a, + }, + }, + .role = SOCAM_SUBDEV_DATA_SOURCE, }; +static struct v4l2_async_subdev *ceu_subdevs[] = { + /* Single 2-element group */ + &csi2_sd.asd, + &imx074_sd.asd, +}; + +/* 0-terminated array of group-sizes */ +static int ceu_subdev_sizes[] = {ARRAY_SIZE(ceu_subdevs), 0}; + static struct sh_mobile_ceu_info sh_mobile_ceu_info = { .flags = SH_CEU_FLAG_USE_8BIT_BUS, .max_width = 8188, .max_height = 8188, - .csi2 = &csi2, + .asd = ceu_subdevs, + .asd_sizes = ceu_subdev_sizes, }; static struct resource ceu_resources[] = { @@ -975,7 +1005,7 @@ static struct platform_device *ap4evb_devices[] __initdata = { &lcdc_device, &lcdc1_device, &ceu_device, - &ap4evb_camera, + &csi2_device, &meram_device, }; @@ -1070,19 +1100,6 @@ static struct i2c_board_info tsc_device = { /*.irq is selected on ap4evb_init */ }; -/* I2C */ -static struct i2c_board_info i2c0_devices[] = { - { - I2C_BOARD_INFO("ak4643", 0x13), - }, -}; - -static struct i2c_board_info i2c1_devices[] = { - { - I2C_BOARD_INFO("r2025sd", 0x32), - }, -}; - #define GPIO_PORT9CR IOMEM(0xE6051009) #define GPIO_PORT10CR IOMEM(0xE605100A) @@ -1097,6 +1114,7 @@ static void __init ap4evb_init(void) { "A3SP", &sdhi0_device, }, { "A3SP", &sdhi1_device, }, { "A4R", &ceu_device, }, + { "A4R", &csi2_device, }, }; u32 srcr4; struct clk *clk; @@ -1324,6 +1342,7 @@ static void __init ap4evb_init(void) sh7372_pm_init(); pm_clk_add(&fsi_device.dev, "spu2"); pm_clk_add(&lcdc1_device.dev, "hdmi"); + pm_clk_add(&csi2_device.dev, "csir"); } MACHINE_START(AP4EVB, "ap4evb") diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 45d21fe..2e8cb42 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c @@ -617,6 +617,7 @@ static struct clk_lookup lookups[] = { CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]), CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk), CLKDEV_ICK_ID("xckb", "sh_fsi2", &fsibck_clk), + CLKDEV_ICK_ID("csir", "sh-mobile-csi2.0", &div4_clks[DIV4_CSIR]), }; void __init sh7372_clock_init(void)