summaryrefslogtreecommitdiff
path: root/include/media/tegra_dtv.h
blob: 2f1c565b1493dc4def953f6ca79503c29c348b7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
 *
 * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __TEGRA_DTV_H__
#define __TEGRA_DTV_H__

#include <linux/ioctl.h>

#define TEGRA_DTV_MAGIC 'v'

#define TEGRA_DTV_IOCTL_START           _IO(TEGRA_DTV_MAGIC, 0)
#define TEGRA_DTV_IOCTL_STOP            _IO(TEGRA_DTV_MAGIC, 1)

struct tegra_dtv_hw_config {
	int clk_edge; /*< clock edge to be used to sample DTV input signals */
	int byte_swz_enabled; /*< byte order during deserialization */
	int bit_swz_enabled;  /*< bit order during deserialization */

	int protocol_sel;   /*< VD pin configuration. */
	int clk_mode;       /*< input clock characteristics */
	int fec_size;       /*< FEC size */
	int body_size;      /*< BODY size */
	int body_valid_sel; /*< VALID signal gate */
	int start_sel;      /*< START of the package */
	int err_pol;        /*< ERROR pin polarity */
	int psync_pol;      /*< PSYNC pin polarity */
	int valid_pol;      /*< VALID pin polarity */
};

struct tegra_dtv_profile {
	unsigned int bufsize;     /*< SIZE of buffer */
	unsigned int bufnum;      /*< COUNT of buffer */
	unsigned int cpuboost;    /*< FREQUENC to boost up CPU */
	unsigned int bitrate;     /*< BITRATE of stream */
};

struct tegra_dtv_platform_data {
	int dma_req_selector;
};

#define TEGRA_DTV_IOCTL_SET_HW_CONFIG  _IOW(TEGRA_DTV_MAGIC, 2,		\
					   const struct tegra_dtv_hw_config *)
#define TEGRA_DTV_IOCTL_GET_HW_CONFIG  _IOR(TEGRA_DTV_MAGIC, 3,		\
					   struct tegra_dtv_hw_config *)
#define TEGRA_DTV_IOCTL_GET_PROFILE _IOR(TEGRA_DTV_MAGIC, 4,		\
					 struct tegra_dtv_profile *)
#define TEGRA_DTV_IOCTL_SET_PROFILE _IOW(TEGRA_DTV_MAGIC, 5,		\
					  const struct tegra_dtv_profile *)

/**
 * clock edge settings for clk_edge
 *
 * RISE_EDGE: sample input signal at rising edge
 * FALL_EDGE: sample input signal at falling edge
 */
enum {
	TEGRA_DTV_CLK_RISE_EDGE = 0,
	TEGRA_DTV_CLK_FALL_EDGE,
};

/**
 * swizzle settings for byte_swz and bit_swz
 *
 * ENABLE: enable swizzle during deserialization
 * DISABLE: disable swizzle during deserialization
 *
 * If swizzling is enabled then deserialized data will be re-ordered to
 * fit the required format for tegra.
 *
 * For example, if raw BGR data is inputed into DTV interface, the data
 * could be swizzled into RGB.
 *
 * For TS/MPEG-2 stream, please disable this feature.
 */
enum {
	TEGRA_DTV_SWZ_DISABLE = 0,
	TEGRA_DTV_SWZ_ENABLE,
};

/* for selecting the pin configuration for VD(valid).
 * NONE : ERROR is tied to 0, PSYNC is tied to 0
 * ERROR: ERROR is tied to VD, PSYNC is tied to 0
 * PSYNC: ERROR is tied to 0, PSYNC is tied to VD
 */
enum {
	TEGRA_DTV_PROTOCOL_NONE = 0,
	TEGRA_DTV_PROTOCOL_ERROR,
	TEGRA_DTV_PROTOCOL_PSYNC,
};

enum {
	TEGRA_DTV_CLK_DISCONTINUOUS = 0,
	TEGRA_DTV_CLK_CONTINUOUS,
};

enum {
	TEGRA_DTV_BODY_VALID_IGNORE = 0,
	TEGRA_DTV_BODY_VALID_GATE,
};

enum {
	TEGRA_DTV_START_RESERVED = 0, /* never use this */
	TEGRA_DTV_START_PSYNC,
	TEGRA_DTV_START_VALID,
	TEGRA_DTV_START_BOTH,
};

enum {
	TEGRA_DTV_ERROR_POLARITY_HIGH = 0,
	TEGRA_DTV_ERROR_POLARITY_LOW,
};

enum {
	TEGRA_DTV_PSYNC_POLARITY_HIGH = 0,
	TEGRA_DTV_PSYNC_POLARITY_LOW,
};

enum {
	TEGRA_DTV_VALID_POLARITY_HIGH = 0,
	TEGRA_DTV_VALID_POLARITY_LOW,
};

#endif /* __TEGRA_DTV_H__ */