From patchwork Tue Sep 18 10:53:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1528091 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork2.kernel.org (Postfix) with ESMTP id 1188EDF280 for ; Sat, 29 Sep 2012 06:54:56 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8T6rSnv021891; Sat, 29 Sep 2012 01:53:28 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8T6rSZp014718; Sat, 29 Sep 2012 01:53:28 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Sat, 29 Sep 2012 01:53:27 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8T6rRfL013301; Sat, 29 Sep 2012 01:53:27 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id BC1EC80627; Sat, 29 Sep 2012 01:53:27 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 9914280626 for ; Tue, 18 Sep 2012 05:53:34 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8IArYRE019184 for ; Tue, 18 Sep 2012 05:53:34 -0500 (CDT) Received: from psmtp.com (na3sys009amx160.postini.com [74.125.149.86]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id q8IArW9C001801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 18 Sep 2012 05:53:33 -0500 Received: from ams-iport-1.cisco.com ([144.254.224.140]) (using TLSv1) by na3sys009amx160.postini.com ([74.125.148.10]) with SMTP; Tue, 18 Sep 2012 10:53:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4850; q=dns/txt; s=iport; t=1347965613; x=1349175213; h=from:to:cc:subject:date:message-id; bh=d8+4S3WDtEIk5N3E4ID5yhhcHsL/i0QXYEO5XdycWCE=; b=Q1yspkHI8ALBFmAA8wFLzgFAlXsNNXe9o+1VIoZB8NzZwm3EmxBtfG9J gZWfAA1hqQfIaaiRBhapri3PZMwB2p7iAJcGyV+hM3C5hNTD309o57aGu Z8P2lM8GiUhbTVsK66lD++ewVHG1GGTfAOCKRB/cayx7pPCwtR41utsto I=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EADZSWFCQ/khR/2dsb2JhbABFvDOBB4IhAQEEEgEUUhBRVxkih16aIqAzkgkDlWKJNYUDgWmCaA X-IronPort-AV: E=Sophos;i="4.80,442,1344211200"; d="scan'208";a="143977012" Received: from ams-core-1.cisco.com ([144.254.72.81]) by ams-iport-1.cisco.com with ESMTP; 18 Sep 2012 10:53:28 +0000 Received: from cobaltpc1.cisco.com (dhcp-10-54-92-107.cisco.com [10.54.92.107]) by ams-core-1.cisco.com (8.14.5/8.14.5) with ESMTP id q8IArQ4U012350; Tue, 18 Sep 2012 10:53:28 GMT From: Hans Verkuil To: Subject: [RFCv1 PATCH 06/11] vpif_capture: move routing info from subdev to input. Date: Tue, 18 Sep 2012 12:53:08 +0200 Message-ID: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-pstn-levels: (S:88.20261/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0003) s cv gt3 GT2 gt1 r p m c X-pstn-addresses: from [82/3] X-Mailman-Approved-At: Sat, 29 Sep 2012 01:48:44 -0500 CC: DLOS X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Routing information is a property of the input, not of the subdev. One subdev may provide multiple inputs, each with its own routing information. Signed-off-by: Hans Verkuil --- arch/arm/mach-davinci/board-da850-evm.c | 8 ++++---- arch/arm/mach-davinci/board-dm646x-evm.c | 8 ++++---- drivers/media/video/davinci/vpif_capture.c | 7 +++++-- include/media/davinci/vpif_types.h | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index d92e0ab..514d4d4 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -1184,6 +1184,8 @@ static const struct vpif_input da850_ch0_inputs[] = { .type = V4L2_INPUT_TYPE_CAMERA, .std = TVP514X_STD_ALL, }, + .input_route = INPUT_CVBS_VI2B, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, .subdev_name = TVP5147_CH0, }, }; @@ -1196,6 +1198,8 @@ static const struct vpif_input da850_ch1_inputs[] = { .type = V4L2_INPUT_TYPE_CAMERA, .std = TVP514X_STD_ALL, }, + .input_route = INPUT_SVIDEO_VI2C_VI1C, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, .subdev_name = TVP5147_CH1, }, }; @@ -1207,8 +1211,6 @@ static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { I2C_BOARD_INFO("tvp5146", 0x5d), .platform_data = &tvp5146_pdata, }, - .input = INPUT_CVBS_VI2B, - .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, .vpif_if = { .if_type = VPIF_IF_BT656, .hd_pol = 1, @@ -1222,8 +1224,6 @@ static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { I2C_BOARD_INFO("tvp5146", 0x5c), .platform_data = &tvp5146_pdata, }, - .input = INPUT_SVIDEO_VI2C_VI1C, - .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, .vpif_if = { .if_type = VPIF_IF_BT656, .hd_pol = 1, diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index a0be63b..0daec7e 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -601,8 +601,6 @@ static struct vpif_subdev_info vpif_capture_sdev_info[] = { I2C_BOARD_INFO("tvp5146", 0x5d), .platform_data = &tvp5146_pdata, }, - .input = INPUT_CVBS_VI2B, - .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, .vpif_if = { .if_type = VPIF_IF_BT656, .hd_pol = 1, @@ -616,8 +614,6 @@ static struct vpif_subdev_info vpif_capture_sdev_info[] = { I2C_BOARD_INFO("tvp5146", 0x5c), .platform_data = &tvp5146_pdata, }, - .input = INPUT_SVIDEO_VI2C_VI1C, - .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, .vpif_if = { .if_type = VPIF_IF_BT656, .hd_pol = 1, @@ -636,6 +632,8 @@ static const struct vpif_input dm6467_ch0_inputs[] = { .std = TVP514X_STD_ALL, }, .subdev_name = TVP5147_CH0, + .input_route = INPUT_CVBS_VI2B, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, }, }; @@ -648,6 +646,8 @@ static const struct vpif_input dm6467_ch1_inputs[] = { .std = TVP514X_STD_ALL, }, .subdev_name = TVP5147_CH1, + .input_route = INPUT_SVIDEO_VI2C_VI1C, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, }, }; diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index ae5cabf..f11b9e3 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c @@ -1449,6 +1449,9 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) chan_cfg = &config->chan_config[ch->channel_id]; + if (index >= chan_cfg->input_count) + return -EINVAL; + if (common->started) { vpif_err("Streaming in progress\n"); return -EBUSY; @@ -1487,8 +1490,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) } } - input = subdev_info->input; - output = subdev_info->output; + input = chan_cfg->inputs[index].input_route; + output = chan_cfg->inputs[index].output_route; ret = v4l2_subdev_call(vpif_obj.sd[sd_index], video, s_routing, input, output, 0); if (ret < 0 && ret != -ENOIOCTLCMD) { diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h index 1fe46a5..a422ed0 100644 --- a/include/media/davinci/vpif_types.h +++ b/include/media/davinci/vpif_types.h @@ -37,8 +37,6 @@ struct vpif_interface { struct vpif_subdev_info { const char *name; struct i2c_board_info board_info; - u32 input; - u32 output; struct vpif_interface vpif_if; }; @@ -56,6 +54,8 @@ struct vpif_display_config { struct vpif_input { struct v4l2_input input; const char *subdev_name; + u32 input_route; + u32 output_route; }; struct vpif_capture_chan_config {