Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / media / platform / exynos4-is / common.c
1 /*
2  * Samsung S5P/EXYNOS4 SoC Camera Subsystem driver
3  *
4  * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5  * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11
12 #include <linux/module.h>
13 #include <media/exynos-fimc.h>
14 #include "common.h"
15
16 /* Called with the media graph mutex held or entity->stream_count > 0. */
17 struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
18 {
19         struct media_pad *pad = &entity->pads[0];
20         struct v4l2_subdev *sd;
21
22         while (pad->flags & MEDIA_PAD_FL_SINK) {
23                 /* source pad */
24                 pad = media_entity_remote_pad(pad);
25                 if (pad == NULL ||
26                     media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
27                         break;
28
29                 sd = media_entity_to_v4l2_subdev(pad->entity);
30
31                 if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR ||
32                     sd->grp_id == GRP_ID_SENSOR)
33                         return sd;
34                 /* sink pad */
35                 pad = &sd->entity.pads[0];
36         }
37         return NULL;
38 }
39 EXPORT_SYMBOL(fimc_find_remote_sensor);
40
41 void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
42                                                 unsigned int caps)
43 {
44         strlcpy(cap->driver, dev->driver->name, sizeof(cap->driver));
45         strlcpy(cap->card, dev->driver->name, sizeof(cap->card));
46         snprintf(cap->bus_info, sizeof(cap->bus_info),
47                                 "platform:%s", dev_name(dev));
48         cap->device_caps = caps;
49         cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
50 }
51 EXPORT_SYMBOL(__fimc_vidioc_querycap);
52
53 MODULE_LICENSE("GPL");