9606d0d2126303f1bea8ae6b7b4f30b6894e4bab
[deliverable/linux.git] / drivers / media / platform / vsp1 / vsp1_entity.h
1 /*
2 * vsp1_entity.h -- R-Car VSP1 Base Entity
3 *
4 * Copyright (C) 2013-2014 Renesas Electronics Corporation
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>
17 #include <linux/spinlock.h>
18
19 #include <media/v4l2-subdev.h>
20
21 struct vsp1_device;
22
23 enum vsp1_entity_type {
24 VSP1_ENTITY_BRU,
25 VSP1_ENTITY_HSI,
26 VSP1_ENTITY_HST,
27 VSP1_ENTITY_LIF,
28 VSP1_ENTITY_LUT,
29 VSP1_ENTITY_RPF,
30 VSP1_ENTITY_SRU,
31 VSP1_ENTITY_UDS,
32 VSP1_ENTITY_WPF,
33 };
34
35 /*
36 * struct vsp1_route - Entity routing configuration
37 * @type: Entity type this routing entry is associated with
38 * @index: Entity index this routing entry is associated with
39 * @reg: Output routing configuration register
40 * @inputs: Target node value for each input
41 *
42 * Each $vsp1_route entry describes routing configuration for the entity
43 * specified by the entry's @type and @index. @reg indicates the register that
44 * holds output routing configuration for the entity, and the @inputs array
45 * store the target node value for each input of the entity.
46 */
47 struct vsp1_route {
48 enum vsp1_entity_type type;
49 unsigned int index;
50 unsigned int reg;
51 unsigned int inputs[4];
52 };
53
54 struct vsp1_entity {
55 struct vsp1_device *vsp1;
56
57 enum vsp1_entity_type type;
58 unsigned int index;
59 const struct vsp1_route *route;
60
61 struct list_head list_dev;
62 struct list_head list_pipe;
63
64 struct media_pad *pads;
65 unsigned int source_pad;
66
67 struct media_entity *sink;
68 unsigned int sink_pad;
69
70 struct v4l2_subdev subdev;
71 struct v4l2_mbus_framefmt *formats;
72
73 spinlock_t lock; /* Protects the streaming field */
74 bool streaming;
75 };
76
77 static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
78 {
79 return container_of(subdev, struct vsp1_entity, subdev);
80 }
81
82 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
83 unsigned int num_pads);
84 void vsp1_entity_destroy(struct vsp1_entity *entity);
85
86 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
87 extern const struct media_entity_operations vsp1_media_ops;
88
89 struct v4l2_mbus_framefmt *
90 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
91 struct v4l2_subdev_pad_config *cfg,
92 unsigned int pad, u32 which);
93 void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
94 struct v4l2_subdev_pad_config *cfg);
95
96 bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
97 int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
98
99 void vsp1_entity_route_setup(struct vsp1_entity *source);
100
101 #endif /* __VSP1_ENTITY_H__ */
This page took 0.045536 seconds and 4 git commands to generate.