1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2023 SKIDATA GmbH
4  * Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
5  */
6 
7 #ifndef __TEGRA_VIP_H__
8 #define __TEGRA_VIP_H__
9 
10 #include <media/media-entity.h>
11 #include <media/v4l2-async.h>
12 #include <media/v4l2-subdev.h>
13 
14 enum {
15 	TEGRA_VIP_PAD_SINK,
16 	TEGRA_VIP_PAD_SOURCE,
17 	TEGRA_VIP_PADS_NUM,
18 };
19 
20 struct tegra_vip;
21 
22 /**
23  * struct tegra_vip_channel - Tegra VIP (parallel video capture) channel
24  *
25  * @subdev: V4L2 subdevice associated with this channel
26  * @pads: media pads for the subdevice entity
27  * @of_node: vip device tree node
28  */
29 struct tegra_vip_channel {
30 	struct v4l2_subdev subdev;
31 	struct media_pad pads[TEGRA_VIP_PADS_NUM];
32 	struct device_node *of_node;
33 };
34 
35 /**
36  * struct tegra_vip_ops - Tegra VIP operations
37  *
38  * @vip_start_streaming: programs vip hardware to enable streaming.
39  */
40 struct tegra_vip_ops {
41 	int (*vip_start_streaming)(struct tegra_vip_channel *vip_chan);
42 };
43 
44 /**
45  * struct tegra_vip_soc - NVIDIA Tegra VIP SoC structure
46  *
47  * @ops: vip hardware operations
48  */
49 struct tegra_vip_soc {
50 	const struct tegra_vip_ops *ops;
51 };
52 
53 /**
54  * struct tegra_vip - NVIDIA Tegra VIP device structure
55  *
56  * @dev: device struct
57  * @client: host1x_client struct
58  * @soc: pointer to SoC data structure
59  * @chan: the VIP channel
60  */
61 struct tegra_vip {
62 	struct device *dev;
63 	struct host1x_client client;
64 	const struct tegra_vip_soc *soc;
65 	struct tegra_vip_channel chan;
66 };
67 
68 #endif
69