Merge tag 'char-misc-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6-block.git] / drivers / media / platform / vsp1 / vsp1_entity.h
CommitLineData
26e0ca22
LP
1/*
2 * vsp1_entity.h -- R-Car VSP1 Base Entity
3 *
8a1edc55 4 * Copyright (C) 2013-2014 Renesas Electronics Corporation
26e0ca22
LP
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13#ifndef __VSP1_ENTITY_H__
14#define __VSP1_ENTITY_H__
15
16#include <linux/list.h>
adb8963f 17#include <linux/spinlock.h>
26e0ca22
LP
18
19#include <media/v4l2-subdev.h>
20
21struct vsp1_device;
22
23enum vsp1_entity_type {
629bb6d4 24 VSP1_ENTITY_BRU,
5cdf5741
LP
25 VSP1_ENTITY_HSI,
26 VSP1_ENTITY_HST,
26e0ca22 27 VSP1_ENTITY_LIF,
989af883 28 VSP1_ENTITY_LUT,
26e0ca22 29 VSP1_ENTITY_RPF,
a626e64e 30 VSP1_ENTITY_SRU,
26e0ca22
LP
31 VSP1_ENTITY_UDS,
32 VSP1_ENTITY_WPF,
33};
34
a96c5fa4
LP
35#define VSP1_ENTITY_MAX_INPUTS 5 /* For the BRU */
36
d9b45ed3
LP
37/*
38 * struct vsp1_route - Entity routing configuration
39 * @type: Entity type this routing entry is associated with
40 * @index: Entity index this routing entry is associated with
41 * @reg: Output routing configuration register
42 * @inputs: Target node value for each input
43 *
44 * Each $vsp1_route entry describes routing configuration for the entity
45 * specified by the entry's @type and @index. @reg indicates the register that
46 * holds output routing configuration for the entity, and the @inputs array
47 * store the target node value for each input of the entity.
48 */
49struct vsp1_route {
50 enum vsp1_entity_type type;
51 unsigned int index;
52 unsigned int reg;
a96c5fa4 53 unsigned int inputs[VSP1_ENTITY_MAX_INPUTS];
d9b45ed3
LP
54};
55
26e0ca22
LP
56struct vsp1_entity {
57 struct vsp1_device *vsp1;
58
59 enum vsp1_entity_type type;
60 unsigned int index;
d9b45ed3 61 const struct vsp1_route *route;
26e0ca22
LP
62
63 struct list_head list_dev;
64 struct list_head list_pipe;
65
66 struct media_pad *pads;
67 unsigned int source_pad;
68
69 struct media_entity *sink;
d9b45ed3 70 unsigned int sink_pad;
26e0ca22
LP
71
72 struct v4l2_subdev subdev;
73 struct v4l2_mbus_framefmt *formats;
1499be67 74
adb8963f 75 spinlock_t lock; /* Protects the streaming field */
960de2cf 76 bool streaming;
26e0ca22
LP
77};
78
79static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
80{
81 return container_of(subdev, struct vsp1_entity, subdev);
82}
83
84int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
85 unsigned int num_pads);
86void vsp1_entity_destroy(struct vsp1_entity *entity);
87
88extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
babca007
LP
89
90int vsp1_entity_link_setup(struct media_entity *entity,
91 const struct media_pad *local,
92 const struct media_pad *remote, u32 flags);
26e0ca22
LP
93
94struct v4l2_mbus_framefmt *
95vsp1_entity_get_pad_format(struct vsp1_entity *entity,
f7234138 96 struct v4l2_subdev_pad_config *cfg,
26e0ca22
LP
97 unsigned int pad, u32 which);
98void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
f7234138 99 struct v4l2_subdev_pad_config *cfg);
26e0ca22 100
960de2cf
LP
101bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
102int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
103
665b693c
LP
104void vsp1_entity_route_setup(struct vsp1_entity *source);
105
26e0ca22 106#endif /* __VSP1_ENTITY_H__ */