[media] vpif_capture: move routing info from subdev to input

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 <hans.verkuil@cisco.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Tested-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans Verkuil 2012-09-20 09:06:25 -03:00 committed by Mauro Carvalho Chehab
parent 33bf178660
commit 7aaad13124
4 changed files with 19 additions and 12 deletions

View File

@ -1182,8 +1182,11 @@ static const struct vpif_input da850_ch0_inputs[] = {
.index = 0, .index = 0,
.name = "Composite", .name = "Composite",
.type = V4L2_INPUT_TYPE_CAMERA, .type = V4L2_INPUT_TYPE_CAMERA,
.capabilities = V4L2_IN_CAP_STD,
.std = TVP514X_STD_ALL, .std = TVP514X_STD_ALL,
}, },
.input_route = INPUT_CVBS_VI2B,
.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.subdev_name = TVP5147_CH0, .subdev_name = TVP5147_CH0,
}, },
}; };
@ -1194,8 +1197,11 @@ static const struct vpif_input da850_ch1_inputs[] = {
.index = 0, .index = 0,
.name = "S-Video", .name = "S-Video",
.type = V4L2_INPUT_TYPE_CAMERA, .type = V4L2_INPUT_TYPE_CAMERA,
.capabilities = V4L2_IN_CAP_STD,
.std = TVP514X_STD_ALL, .std = TVP514X_STD_ALL,
}, },
.input_route = INPUT_SVIDEO_VI2C_VI1C,
.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.subdev_name = TVP5147_CH1, .subdev_name = TVP5147_CH1,
}, },
}; };
@ -1207,8 +1213,6 @@ static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
I2C_BOARD_INFO("tvp5146", 0x5d), I2C_BOARD_INFO("tvp5146", 0x5d),
.platform_data = &tvp5146_pdata, .platform_data = &tvp5146_pdata,
}, },
.input = INPUT_CVBS_VI2B,
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.vpif_if = { .vpif_if = {
.if_type = VPIF_IF_BT656, .if_type = VPIF_IF_BT656,
.hd_pol = 1, .hd_pol = 1,
@ -1222,8 +1226,6 @@ static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
I2C_BOARD_INFO("tvp5146", 0x5c), I2C_BOARD_INFO("tvp5146", 0x5c),
.platform_data = &tvp5146_pdata, .platform_data = &tvp5146_pdata,
}, },
.input = INPUT_SVIDEO_VI2C_VI1C,
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.vpif_if = { .vpif_if = {
.if_type = VPIF_IF_BT656, .if_type = VPIF_IF_BT656,
.hd_pol = 1, .hd_pol = 1,

View File

@ -601,8 +601,6 @@ static struct vpif_subdev_info vpif_capture_sdev_info[] = {
I2C_BOARD_INFO("tvp5146", 0x5d), I2C_BOARD_INFO("tvp5146", 0x5d),
.platform_data = &tvp5146_pdata, .platform_data = &tvp5146_pdata,
}, },
.input = INPUT_CVBS_VI2B,
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.vpif_if = { .vpif_if = {
.if_type = VPIF_IF_BT656, .if_type = VPIF_IF_BT656,
.hd_pol = 1, .hd_pol = 1,
@ -616,8 +614,6 @@ static struct vpif_subdev_info vpif_capture_sdev_info[] = {
I2C_BOARD_INFO("tvp5146", 0x5c), I2C_BOARD_INFO("tvp5146", 0x5c),
.platform_data = &tvp5146_pdata, .platform_data = &tvp5146_pdata,
}, },
.input = INPUT_SVIDEO_VI2C_VI1C,
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
.vpif_if = { .vpif_if = {
.if_type = VPIF_IF_BT656, .if_type = VPIF_IF_BT656,
.hd_pol = 1, .hd_pol = 1,
@ -633,9 +629,12 @@ static const struct vpif_input dm6467_ch0_inputs[] = {
.index = 0, .index = 0,
.name = "Composite", .name = "Composite",
.type = V4L2_INPUT_TYPE_CAMERA, .type = V4L2_INPUT_TYPE_CAMERA,
.capabilities = V4L2_IN_CAP_STD,
.std = TVP514X_STD_ALL, .std = TVP514X_STD_ALL,
}, },
.subdev_name = TVP5147_CH0, .subdev_name = TVP5147_CH0,
.input_route = INPUT_CVBS_VI2B,
.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
}, },
}; };
@ -645,9 +644,12 @@ static const struct vpif_input dm6467_ch1_inputs[] = {
.index = 0, .index = 0,
.name = "S-Video", .name = "S-Video",
.type = V4L2_INPUT_TYPE_CAMERA, .type = V4L2_INPUT_TYPE_CAMERA,
.capabilities = V4L2_IN_CAP_STD,
.std = TVP514X_STD_ALL, .std = TVP514X_STD_ALL,
}, },
.subdev_name = TVP5147_CH1, .subdev_name = TVP5147_CH1,
.input_route = INPUT_SVIDEO_VI2C_VI1C,
.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
}, },
}; };

View File

@ -1464,6 +1464,9 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
chan_cfg = &config->chan_config[ch->channel_id]; chan_cfg = &config->chan_config[ch->channel_id];
if (index >= chan_cfg->input_count)
return -EINVAL;
if (common->started) { if (common->started) {
vpif_err("Streaming in progress\n"); vpif_err("Streaming in progress\n");
return -EBUSY; return -EBUSY;
@ -1502,8 +1505,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
} }
} }
input = subdev_info->input; input = chan_cfg->inputs[index].input_route;
output = subdev_info->output; output = chan_cfg->inputs[index].output_route;
ret = v4l2_subdev_call(vpif_obj.sd[sd_index], video, s_routing, ret = v4l2_subdev_call(vpif_obj.sd[sd_index], video, s_routing,
input, output, 0); input, output, 0);
if (ret < 0 && ret != -ENOIOCTLCMD) { if (ret < 0 && ret != -ENOIOCTLCMD) {

View File

@ -37,8 +37,6 @@ struct vpif_interface {
struct vpif_subdev_info { struct vpif_subdev_info {
const char *name; const char *name;
struct i2c_board_info board_info; struct i2c_board_info board_info;
u32 input;
u32 output;
struct vpif_interface vpif_if; struct vpif_interface vpif_if;
}; };
@ -56,6 +54,8 @@ struct vpif_display_config {
struct vpif_input { struct vpif_input {
struct v4l2_input input; struct v4l2_input input;
const char *subdev_name; const char *subdev_name;
u32 input_route;
u32 output_route;
}; };
struct vpif_capture_chan_config { struct vpif_capture_chan_config {