diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2011-11-15 13:34:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-30 11:39:54 -0500 |
commit | 6cf1056f0a7ecb543d4b523f6c55a5587fc455f2 (patch) | |
tree | 9085aca1e9a3283520165a5178fa57bd7663ff43 /drivers/media/video | |
parent | 87eaec5dff4e20228fb6ac72dc849fd12f4e86be (diff) |
[media] s5p-csis: Enable v4l subdev device node
Set v4l2_subdev flags for a host driver to create a sub-device
node for the driver so the subdev can be directly configured
by applications. Add the subdev open() handler.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/s5p-fimc/mipi-csis.c | 22 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/mipi-csis.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.c b/drivers/media/video/s5p-fimc/mipi-csis.c index 59d79bc2f58a..130335cf62fd 100644 --- a/drivers/media/video/s5p-fimc/mipi-csis.c +++ b/drivers/media/video/s5p-fimc/mipi-csis.c | |||
@@ -427,6 +427,23 @@ static int s5pcsis_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
427 | return 0; | 427 | return 0; |
428 | } | 428 | } |
429 | 429 | ||
430 | static int s5pcsis_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) | ||
431 | { | ||
432 | struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(fh, 0); | ||
433 | |||
434 | format->colorspace = V4L2_COLORSPACE_JPEG; | ||
435 | format->code = s5pcsis_formats[0].code; | ||
436 | format->width = S5PCSIS_DEF_PIX_WIDTH; | ||
437 | format->height = S5PCSIS_DEF_PIX_HEIGHT; | ||
438 | format->field = V4L2_FIELD_NONE; | ||
439 | |||
440 | return 0; | ||
441 | } | ||
442 | |||
443 | static const struct v4l2_subdev_internal_ops s5pcsis_sd_internal_ops = { | ||
444 | .open = s5pcsis_open, | ||
445 | }; | ||
446 | |||
430 | static struct v4l2_subdev_core_ops s5pcsis_core_ops = { | 447 | static struct v4l2_subdev_core_ops s5pcsis_core_ops = { |
431 | .s_power = s5pcsis_s_power, | 448 | .s_power = s5pcsis_s_power, |
432 | }; | 449 | }; |
@@ -544,8 +561,13 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev) | |||
544 | v4l2_subdev_init(&state->sd, &s5pcsis_subdev_ops); | 561 | v4l2_subdev_init(&state->sd, &s5pcsis_subdev_ops); |
545 | state->sd.owner = THIS_MODULE; | 562 | state->sd.owner = THIS_MODULE; |
546 | strlcpy(state->sd.name, dev_name(&pdev->dev), sizeof(state->sd.name)); | 563 | strlcpy(state->sd.name, dev_name(&pdev->dev), sizeof(state->sd.name)); |
564 | state->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; | ||
547 | state->csis_fmt = &s5pcsis_formats[0]; | 565 | state->csis_fmt = &s5pcsis_formats[0]; |
548 | 566 | ||
567 | state->format.code = s5pcsis_formats[0].code; | ||
568 | state->format.width = S5PCSIS_DEF_PIX_WIDTH; | ||
569 | state->format.height = S5PCSIS_DEF_PIX_HEIGHT; | ||
570 | |||
549 | state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; | 571 | state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; |
550 | state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; | 572 | state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; |
551 | ret = media_entity_init(&state->sd.entity, | 573 | ret = media_entity_init(&state->sd.entity, |
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.h b/drivers/media/video/s5p-fimc/mipi-csis.h index f5691336dd5c..2709286396e1 100644 --- a/drivers/media/video/s5p-fimc/mipi-csis.h +++ b/drivers/media/video/s5p-fimc/mipi-csis.h | |||
@@ -19,4 +19,7 @@ | |||
19 | #define CSIS_PAD_SOURCE 1 | 19 | #define CSIS_PAD_SOURCE 1 |
20 | #define CSIS_PADS_NUM 2 | 20 | #define CSIS_PADS_NUM 2 |
21 | 21 | ||
22 | #define S5PCSIS_DEF_PIX_WIDTH 640 | ||
23 | #define S5PCSIS_DEF_PIX_HEIGHT 480 | ||
24 | |||
22 | #endif | 25 | #endif |