hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/media/media-entity.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Media entity
34 *
....@@ -5,15 +6,6 @@
56 *
67 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
78 * Sakari Ailus <sakari.ailus@iki.fi>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
179 */
1810
1911 #ifndef _MEDIA_ENTITY_H
....@@ -25,6 +17,7 @@
2517 #include <linux/kernel.h>
2618 #include <linux/list.h>
2719 #include <linux/media.h>
20
+#include <linux/android_vendor.h>
2821
2922 /* Enums used internally at the media controller to represent graphs */
3023
....@@ -153,6 +146,35 @@
153146 struct media_link *reverse;
154147 unsigned long flags;
155148 bool is_backlink;
149
+ ANDROID_VENDOR_DATA(1);
150
+};
151
+
152
+/**
153
+ * enum media_pad_signal_type - type of the signal inside a media pad
154
+ *
155
+ * @PAD_SIGNAL_DEFAULT:
156
+ * Default signal. Use this when all inputs or all outputs are
157
+ * uniquely identified by the pad number.
158
+ * @PAD_SIGNAL_ANALOG:
159
+ * The pad contains an analog signal. It can be Radio Frequency,
160
+ * Intermediate Frequency, a baseband signal or sub-cariers.
161
+ * Tuner inputs, IF-PLL demodulators, composite and s-video signals
162
+ * should use it.
163
+ * @PAD_SIGNAL_DV:
164
+ * Contains a digital video signal, with can be a bitstream of samples
165
+ * taken from an analog TV video source. On such case, it usually
166
+ * contains the VBI data on it.
167
+ * @PAD_SIGNAL_AUDIO:
168
+ * Contains an Intermediate Frequency analog signal from an audio
169
+ * sub-carrier or an audio bitstream. IF signals are provided by tuners
170
+ * and consumed by audio AM/FM decoders. Bitstream audio is provided by
171
+ * an audio decoder.
172
+ */
173
+enum media_pad_signal_type {
174
+ PAD_SIGNAL_DEFAULT = 0,
175
+ PAD_SIGNAL_ANALOG,
176
+ PAD_SIGNAL_DV,
177
+ PAD_SIGNAL_AUDIO,
156178 };
157179
158180 /**
....@@ -161,6 +183,7 @@
161183 * @graph_obj: Embedded structure containing the media object common data
162184 * @entity: Entity this pad belongs to
163185 * @index: Pad index in the entity pads array, numbered from 0 to n
186
+ * @sig_type: Type of the signal inside a media pad
164187 * @flags: Pad flags, as defined in
165188 * :ref:`include/uapi/linux/media.h <media_header>`
166189 * (seek for ``MEDIA_PAD_FL_*``)
....@@ -169,6 +192,7 @@
169192 struct media_gobj graph_obj; /* must be first field in struct */
170193 struct media_entity *entity;
171194 u16 index;
195
+ enum media_pad_signal_type sig_type;
172196 unsigned long flags;
173197 };
174198
....@@ -190,7 +214,8 @@
190214 * mutex held.
191215 */
192216 struct media_entity_operations {
193
- int (*get_fwnode_pad)(struct fwnode_endpoint *endpoint);
217
+ int (*get_fwnode_pad)(struct media_entity *entity,
218
+ struct fwnode_endpoint *endpoint);
194219 int (*link_setup)(struct media_entity *entity,
195220 const struct media_pad *local,
196221 const struct media_pad *remote, u32 flags);
....@@ -641,6 +666,24 @@
641666 #endif
642667
643668 /**
669
+ * media_get_pad_index() - retrieves a pad index from an entity
670
+ *
671
+ * @entity: entity where the pads belong
672
+ * @is_sink: true if the pad is a sink, false if it is a source
673
+ * @sig_type: type of signal of the pad to be search
674
+ *
675
+ * This helper function finds the first pad index inside an entity that
676
+ * satisfies both @is_sink and @sig_type conditions.
677
+ *
678
+ * Return:
679
+ *
680
+ * On success, return the pad number. If the pad was not found or the media
681
+ * entity is a NULL pointer, return -EINVAL.
682
+ */
683
+int media_get_pad_index(struct media_entity *entity, bool is_sink,
684
+ enum media_pad_signal_type sig_type);
685
+
686
+/**
644687 * media_create_pad_link() - creates a link between two entities.
645688 *
646689 * @source: pointer to &media_entity of the source pad.
....@@ -762,7 +805,7 @@
762805 * @flags: the requested new link flags
763806 *
764807 * The only configurable property is the %MEDIA_LNK_FL_ENABLED link flag
765
- * flag to enable/disable a link. Links marked with the
808
+ * to enable/disable a link. Links marked with the
766809 * %MEDIA_LNK_FL_IMMUTABLE link flag can not be enabled or disabled.
767810 *
768811 * When a link is enabled or disabled, the media framework calls the
....@@ -817,19 +860,6 @@
817860 struct media_pad *media_entity_remote_pad(const struct media_pad *pad);
818861
819862 /**
820
- * media_entity_get - Get a reference to the parent module
821
- *
822
- * @entity: The entity
823
- *
824
- * Get a reference to the parent media device module.
825
- *
826
- * The function will return immediately if @entity is %NULL.
827
- *
828
- * Return: returns a pointer to the entity on success or %NULL on failure.
829
- */
830
-struct media_entity *media_entity_get(struct media_entity *entity);
831
-
832
-/**
833863 * media_entity_get_fwnode_pad - Get pad number from fwnode
834864 *
835865 * @entity: The entity
....@@ -867,17 +897,6 @@
867897 * @graph: Media graph structure that will be used to walk the graph
868898 */
869899 void media_graph_walk_cleanup(struct media_graph *graph);
870
-
871
-/**
872
- * media_entity_put - Release the reference to the parent module
873
- *
874
- * @entity: The entity
875
- *
876
- * Release the reference count acquired by media_entity_get().
877
- *
878
- * The function will return immediately if @entity is %NULL.
879
- */
880
-void media_entity_put(struct media_entity *entity);
881900
882901 /**
883902 * media_graph_walk_start - Start walking the media graph at a