1/*
2 * extensions to ioctl_meteor.h for the bt848 cards
3 */
4
5/*
6 * frequency sets
7 */
8#define CHNLSET_NABCST 1
9#define CHNLSET_CABLEIRC 2
10#define CHNLSET_CABLEHRC 3
11#define CHNLSET_WEUROPE 4
12#define CHNLSET_JPNBCST 5
13#define CHNLSET_JPNCABLE 6
14#define CHNLSET_MIN CHNLSET_NABCST
15#define CHNLSET_MAX CHNLSET_JPNCABLE
16
17
18/*
19 * constants for various tuner registers
20 */
21#define BT848_HUEMIN (-90)
22#define BT848_HUEMAX 90
23#define BT848_HUECENTER 0
24#define BT848_HUERANGE 179.3
25#define BT848_HUEREGMIN (-128)
26#define BT848_HUEREGMAX 127
27#define BT848_HUESTEPS 256
28
29#define BT848_BRIGHTMIN (-50)
30#define BT848_BRIGHTMAX 50
31#define BT848_BRIGHTCENTER 0
32#define BT848_BRIGHTRANGE 99.6
33#define BT848_BRIGHTREGMIN (-128)
34#define BT848_BRIGHTREGMAX 127
35#define BT848_BRIGHTSTEPS 256
36
37#define BT848_CONTRASTMIN 0
38#define BT848_CONTRASTMAX 237
39#define BT848_CONTRASTCENTER 100
40#define BT848_CONTRASTRANGE 236.57
41#define BT848_CONTRASTREGMIN 0
42#define BT848_CONTRASTREGMAX 511
43#define BT848_CONTRASTSTEPS 512
44
45#define BT848_CHROMAMIN 0
46#define BT848_CHROMAMAX 284
47#define BT848_CHROMACENTER 100
48#define BT848_CHROMARANGE 283.89
49#define BT848_CHROMAREGMIN 0
50#define BT848_CHROMAREGMAX 511
51#define BT848_CHROMASTEPS 512
52
53#define BT848_SATUMIN 0
54#define BT848_SATUMAX 202
55#define BT848_SATUCENTER 100
56#define BT848_SATURANGE 201.18
57#define BT848_SATUREGMIN 0
58#define BT848_SATUREGMAX 511
59#define BT848_SATUSTEPS 512
60
61#define BT848_SATVMIN 0
62#define BT848_SATVMAX 284
63#define BT848_SATVCENTER 100
64#define BT848_SATVRANGE 283.89
65#define BT848_SATVREGMIN 0
66#define BT848_SATVREGMAX 511
67#define BT848_SATVSTEPS 512
68
69
70/*
71 * audio stuff
72 */
73#define AUDIO_TUNER 0x00 /* command for the audio routine */
74#define AUDIO_EXTERN 0x01 /* don't confuse them with bit */
75#define AUDIO_INTERN 0x02 /* settings */
76#define AUDIO_MUTE 0x80
77#define AUDIO_UNMUTE 0x81
78
79
80/*
81 * EEProm stuff
82 */
83struct eeProm {
84 short offset;
85 short count;
86 u_char bytes[ 256 ];
87};
88
89
90/*
91 * XXX: this is a hack, should be in ioctl_meteor.h
92 * here to avoid touching that file for now...
93 */
94#define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */
95#define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */
96#define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */
97#define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */
98#define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */
99#define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */
100#define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */
101
102
103#define BT848_SHUE _IOW('x', 37, int) /* set hue */
104#define BT848_GHUE _IOR('x', 37, int) /* get hue */
105#define BT848_SBRIG _IOW('x', 38, int) /* set brightness */
106#define BT848_GBRIG _IOR('x', 38, int) /* get brightness */
107#define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */
108#define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */
109#define BT848_SCONT _IOW('x', 40, int) /* set contrast */
110#define BT848_GCONT _IOR('x', 40, int) /* get contrast */
111#define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */
112#define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */
113#define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */
114#define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */
115
116#define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */
117#define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */
118
119
120#define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */
121#define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */
122#define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */
123
124#define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */
125
126#define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */
127#define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */
128
129#define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */
130
131#define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */
132#define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */
133#define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */
134#define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */
135
136/*
137 * XXX: more bad magic,
138 * we need to fix the METEORGINPUT to return something public
139 * duplicate them here for now...
140 */
141#define METEOR_DEV0 0x00001000
142#define METEOR_DEV1 0x00002000
143#define METEOR_DEV2 0x00004000
144
145/*
146 * right now I don't know were to put these, but as they are suppose to be
147 * a part of a common video capture interface, these should be relocated to
148 * another place. Probably most of the METEOR_xxx defines need to be
149 * renamed and moved to a common header
150 */
151
152typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
153 METEOR_PIXTYPE_YUV_PACKED,
154 METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
155
156
157struct meteor_pixfmt {
158 u_int index; /* Index in supported pixfmt list */
159 METEOR_PIXTYPE type; /* What's the board gonna feed us */
160 u_int Bpp; /* Bytes per pixel */
161 u_long masks[3]; /* R,G,B or Y,U,V masks, respectively */
162 unsigned swap_bytes :1; /* Bytes swapped within shorts */
163 unsigned swap_shorts:1; /* Shorts swapped within longs */
164};
165
166
167struct bktr_clip {
168 int x_min;
169 int x_max;
170 int y_min;
171 int y_max;
172};
173
174#define BT848_MAX_CLIP_NODE 100
175struct _bktr_clip {
176 struct bktr_clip x[BT848_MAX_CLIP_NODE];
177};
178
179/*
180 * I'm using METEOR_xxx just because that will be common to other interface
181 * and less of a surprise
182 */
183#define METEORSACTPIXFMT _IOW('x', 64, int )
184#define METEORGACTPIXFMT _IOR('x', 64, int )
185#define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt)
186
187/* set clip list */
188#define BT848SCLIP _IOW('x', 66, struct _bktr_clip )
189#define BT848GCLIP _IOR('x', 66, struct _bktr_clip )
190
191
192/* set input format */
193#define BT848SFMT _IOW('x', 67, unsigned long )
194#define BT848GFMT _IOR('x', 67, unsigned long )
195
196/* Read/Write the BT848's I2C bus directly
197 * b7-b0: data (read/write)
198 * b15-b8: internal peripheral register (write)
199 * b23-b16: i2c addr (write)
200 * b31-b24: 1 = write, 0 = read
201 */
202#define BT848_I2CWR _IOWR('x', 57, u_long) /* i2c read-write */
203
204/* XXX - Copied from /sys/pci/brktree_reg.h */
205#define BT848_IFORM_FORMAT (0x7<<0)
206# define BT848_IFORM_F_RSVD (0x7)
207# define BT848_IFORM_F_SECAM (0x6)
208# define BT848_IFORM_F_PALN (0x5)
209# define BT848_IFORM_F_PALM (0x4)
210# define BT848_IFORM_F_PALBDGHI (0x3)
211# define BT848_IFORM_F_NTSCJ (0x2)
212# define BT848_IFORM_F_NTSCM (0x1)
213# define BT848_IFORM_F_AUTO (0x0)
214
2 * extensions to ioctl_meteor.h for the bt848 cards
3 */
4
5/*
6 * frequency sets
7 */
8#define CHNLSET_NABCST 1
9#define CHNLSET_CABLEIRC 2
10#define CHNLSET_CABLEHRC 3
11#define CHNLSET_WEUROPE 4
12#define CHNLSET_JPNBCST 5
13#define CHNLSET_JPNCABLE 6
14#define CHNLSET_MIN CHNLSET_NABCST
15#define CHNLSET_MAX CHNLSET_JPNCABLE
16
17
18/*
19 * constants for various tuner registers
20 */
21#define BT848_HUEMIN (-90)
22#define BT848_HUEMAX 90
23#define BT848_HUECENTER 0
24#define BT848_HUERANGE 179.3
25#define BT848_HUEREGMIN (-128)
26#define BT848_HUEREGMAX 127
27#define BT848_HUESTEPS 256
28
29#define BT848_BRIGHTMIN (-50)
30#define BT848_BRIGHTMAX 50
31#define BT848_BRIGHTCENTER 0
32#define BT848_BRIGHTRANGE 99.6
33#define BT848_BRIGHTREGMIN (-128)
34#define BT848_BRIGHTREGMAX 127
35#define BT848_BRIGHTSTEPS 256
36
37#define BT848_CONTRASTMIN 0
38#define BT848_CONTRASTMAX 237
39#define BT848_CONTRASTCENTER 100
40#define BT848_CONTRASTRANGE 236.57
41#define BT848_CONTRASTREGMIN 0
42#define BT848_CONTRASTREGMAX 511
43#define BT848_CONTRASTSTEPS 512
44
45#define BT848_CHROMAMIN 0
46#define BT848_CHROMAMAX 284
47#define BT848_CHROMACENTER 100
48#define BT848_CHROMARANGE 283.89
49#define BT848_CHROMAREGMIN 0
50#define BT848_CHROMAREGMAX 511
51#define BT848_CHROMASTEPS 512
52
53#define BT848_SATUMIN 0
54#define BT848_SATUMAX 202
55#define BT848_SATUCENTER 100
56#define BT848_SATURANGE 201.18
57#define BT848_SATUREGMIN 0
58#define BT848_SATUREGMAX 511
59#define BT848_SATUSTEPS 512
60
61#define BT848_SATVMIN 0
62#define BT848_SATVMAX 284
63#define BT848_SATVCENTER 100
64#define BT848_SATVRANGE 283.89
65#define BT848_SATVREGMIN 0
66#define BT848_SATVREGMAX 511
67#define BT848_SATVSTEPS 512
68
69
70/*
71 * audio stuff
72 */
73#define AUDIO_TUNER 0x00 /* command for the audio routine */
74#define AUDIO_EXTERN 0x01 /* don't confuse them with bit */
75#define AUDIO_INTERN 0x02 /* settings */
76#define AUDIO_MUTE 0x80
77#define AUDIO_UNMUTE 0x81
78
79
80/*
81 * EEProm stuff
82 */
83struct eeProm {
84 short offset;
85 short count;
86 u_char bytes[ 256 ];
87};
88
89
90/*
91 * XXX: this is a hack, should be in ioctl_meteor.h
92 * here to avoid touching that file for now...
93 */
94#define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */
95#define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */
96#define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */
97#define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */
98#define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */
99#define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */
100#define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */
101
102
103#define BT848_SHUE _IOW('x', 37, int) /* set hue */
104#define BT848_GHUE _IOR('x', 37, int) /* get hue */
105#define BT848_SBRIG _IOW('x', 38, int) /* set brightness */
106#define BT848_GBRIG _IOR('x', 38, int) /* get brightness */
107#define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */
108#define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */
109#define BT848_SCONT _IOW('x', 40, int) /* set contrast */
110#define BT848_GCONT _IOR('x', 40, int) /* get contrast */
111#define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */
112#define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */
113#define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */
114#define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */
115
116#define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */
117#define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */
118
119
120#define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */
121#define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */
122#define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */
123
124#define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */
125
126#define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */
127#define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */
128
129#define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */
130
131#define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */
132#define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */
133#define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */
134#define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */
135
136/*
137 * XXX: more bad magic,
138 * we need to fix the METEORGINPUT to return something public
139 * duplicate them here for now...
140 */
141#define METEOR_DEV0 0x00001000
142#define METEOR_DEV1 0x00002000
143#define METEOR_DEV2 0x00004000
144
145/*
146 * right now I don't know were to put these, but as they are suppose to be
147 * a part of a common video capture interface, these should be relocated to
148 * another place. Probably most of the METEOR_xxx defines need to be
149 * renamed and moved to a common header
150 */
151
152typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
153 METEOR_PIXTYPE_YUV_PACKED,
154 METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
155
156
157struct meteor_pixfmt {
158 u_int index; /* Index in supported pixfmt list */
159 METEOR_PIXTYPE type; /* What's the board gonna feed us */
160 u_int Bpp; /* Bytes per pixel */
161 u_long masks[3]; /* R,G,B or Y,U,V masks, respectively */
162 unsigned swap_bytes :1; /* Bytes swapped within shorts */
163 unsigned swap_shorts:1; /* Shorts swapped within longs */
164};
165
166
167struct bktr_clip {
168 int x_min;
169 int x_max;
170 int y_min;
171 int y_max;
172};
173
174#define BT848_MAX_CLIP_NODE 100
175struct _bktr_clip {
176 struct bktr_clip x[BT848_MAX_CLIP_NODE];
177};
178
179/*
180 * I'm using METEOR_xxx just because that will be common to other interface
181 * and less of a surprise
182 */
183#define METEORSACTPIXFMT _IOW('x', 64, int )
184#define METEORGACTPIXFMT _IOR('x', 64, int )
185#define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt)
186
187/* set clip list */
188#define BT848SCLIP _IOW('x', 66, struct _bktr_clip )
189#define BT848GCLIP _IOR('x', 66, struct _bktr_clip )
190
191
192/* set input format */
193#define BT848SFMT _IOW('x', 67, unsigned long )
194#define BT848GFMT _IOR('x', 67, unsigned long )
195
196/* Read/Write the BT848's I2C bus directly
197 * b7-b0: data (read/write)
198 * b15-b8: internal peripheral register (write)
199 * b23-b16: i2c addr (write)
200 * b31-b24: 1 = write, 0 = read
201 */
202#define BT848_I2CWR _IOWR('x', 57, u_long) /* i2c read-write */
203
204/* XXX - Copied from /sys/pci/brktree_reg.h */
205#define BT848_IFORM_FORMAT (0x7<<0)
206# define BT848_IFORM_F_RSVD (0x7)
207# define BT848_IFORM_F_SECAM (0x6)
208# define BT848_IFORM_F_PALN (0x5)
209# define BT848_IFORM_F_PALM (0x4)
210# define BT848_IFORM_F_PALBDGHI (0x3)
211# define BT848_IFORM_F_NTSCJ (0x2)
212# define BT848_IFORM_F_NTSCM (0x1)
213# define BT848_IFORM_F_AUTO (0x0)
214