1
/* Copyright (c) 2005 Advanced Micro Devices, Inc.
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to
5
* deal in the Software without restriction, including without limitation the
6
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
* sell copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* Neither the name of the Advanced Micro Devices, Inc. nor the names of its
22
* contributors may be used to endorse or promote products derived from this
23
* software without specific prior written permission.
27
* This file contains routines to program TVOUT and TV encoder.
34
* gfx_set_tv_flicker_filter
35
* gfx_set_tv_sub_carrier_reset
38
* gfx_set_tvenc_reset_interval
39
* gfx_set_tv_cc_enable
41
* gfx_test_tvout_odd_field
42
* gfx_test_tvenc_odd_field
43
* gfx_set_tv_field_status_invert
49
DISPLAYMODE TVTimings[] = {
53
{0x3 | /* negative syncs */
54
GFX_MODE_TV_NTSC, /* NTSC format */
55
640, 640, 656, 744, 792, 792, /* horizontal timings */
56
480, 480, 490, 492, 517, 525, /* vertical timings */
57
0x0018EC4D, /* freq = 24.923052 MHz */
63
{0x3 | /* negative syncs */
64
GFX_MODE_TV_PAL, /* PAL format */
65
768, 768, 800, 848, 864, 864, /* horizontal timings */
66
576, 576, 586, 588, 625, 625, /* vertical timings */
67
0x001B0000, /* freq = 27.00 MHz */
71
/* NTSC resolution non-square pixels */
73
{0x3 | /* negative syncs */
74
GFX_MODE_TV_NTSC, /* NTSC format */
75
720, 720, 736, 752, 792, 792, /* horizontal timings */
76
480, 480, 490, 492, 517, 525, /* vertical timings */
77
0x0018EC4D, /* freq = 24.923052 MHz */
81
/* PAL resolution non-square pixels */
83
{0x3 | /* negative syncs */
84
GFX_MODE_TV_PAL, /* PAL format */
85
720, 720, 752, 816, 864, 864, /* horizontal timings */
86
576, 576, 586, 588, 625, 625, /* vertical timings */
87
0x001B0000, /* freq = 27.00 MHz */
91
#define NUM_TV_MODES sizeof(TVTimings)/sizeof(DISPLAYMODE)
93
/* INCLUDE SUPPORT FOR SC1200 TV ENCODER, IF SPECIFIED */
99
/* INCLUDE SUPPORT FOR FS450 TV ENCODER, IF SPECIFIED */
102
#include "tv_fs450.c"
105
/* WRAPPERS IF DYNAMIC SELECTION */
106
/* Extra layer to call either SC1200 or FS450 TV encoder routines. */
110
/*----------------------------------------------------------------------------
112
*----------------------------------------------------------------------------
115
gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution)
117
int retval = GFX_STATUS_UNSUPPORTED;
120
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
121
retval = sc1200_set_tv_format(format, resolution);
124
if (gfx_tv_type & GFX_TV_TYPE_FS451)
125
retval = fs450_set_tv_format(format, resolution);
130
/*----------------------------------------------------------------------------
132
*----------------------------------------------------------------------------
135
gfx_set_tv_output(int output)
137
int retval = GFX_STATUS_UNSUPPORTED;
140
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
141
retval = sc1200_set_tv_output(output);
144
if (gfx_tv_type & GFX_TV_TYPE_FS451)
145
retval = fs450_set_tv_output(output);
150
/*----------------------------------------------------------------------------
152
*----------------------------------------------------------------------------
155
gfx_set_tv_enable(int enable)
157
int retval = GFX_STATUS_UNSUPPORTED;
160
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
161
retval = sc1200_set_tv_enable(enable);
164
if (gfx_tv_type & GFX_TV_TYPE_FS451)
165
retval = fs450_set_tv_enable(enable);
170
/*----------------------------------------------------------------------------
171
* gfx_set_tv_flicker_filter
172
*----------------------------------------------------------------------------
175
gfx_set_tv_flicker_filter(int ff)
177
int retval = GFX_STATUS_UNSUPPORTED;
180
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
181
retval = sc1200_set_tv_flicker_filter(ff);
186
/*----------------------------------------------------------------------------
187
* gfx_set_tv_sub_carrier_reset
188
*----------------------------------------------------------------------------
191
gfx_set_tv_sub_carrier_reset(int screset)
193
int retval = GFX_STATUS_UNSUPPORTED;
196
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
197
retval = sc1200_set_tv_sub_carrier_reset(screset);
202
/*----------------------------------------------------------------------------
204
*----------------------------------------------------------------------------
207
gfx_set_tv_vphase(int vphase)
209
int retval = GFX_STATUS_UNSUPPORTED;
212
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
213
retval = sc1200_set_tv_vphase(vphase);
218
/*----------------------------------------------------------------------------
219
* gfx_set_tv_YC_delay
220
*----------------------------------------------------------------------------
223
gfx_set_tv_YC_delay(int delay)
225
int retval = GFX_STATUS_UNSUPPORTED;
228
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
229
retval = sc1200_set_tv_YC_delay(delay);
234
/*----------------------------------------------------------------------------
235
* gfx_set_tvenc_reset_interval
236
*----------------------------------------------------------------------------
239
gfx_set_tvenc_reset_interval(int interval)
241
int retval = GFX_STATUS_UNSUPPORTED;
244
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
245
retval = sc1200_set_tvenc_reset_interval(interval);
250
/*----------------------------------------------------------------------------
251
* gfx_set_tv_cc_enable
252
*----------------------------------------------------------------------------
255
gfx_set_tv_cc_enable(int enable)
257
int retval = GFX_STATUS_UNSUPPORTED;
260
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
261
retval = sc1200_set_tv_cc_enable(enable);
266
/*----------------------------------------------------------------------------
269
* This routine writes the two specified characters to the CC data register
271
*----------------------------------------------------------------------------
274
gfx_set_tv_cc_data(unsigned char data1, unsigned char data2)
276
int retval = GFX_STATUS_UNSUPPORTED;
279
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
280
retval = sc1200_set_tv_cc_data(data1, data2);
285
/*---------------------------------------------------------------------------
288
* Set the timings in the display controller to support a TV resolution.
289
*---------------------------------------------------------------------------
292
gfx_set_tv_display(int width, int height)
294
int status = GFX_STATUS_UNSUPPORTED;
297
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
298
status = sc1200_set_tv_display(width, height);
303
/*---------------------------------------------------------------------------
304
* gfx_test_tvout_odd_field
305
*---------------------------------------------------------------------------
308
gfx_test_tvout_odd_field(void)
310
int status = GFX_STATUS_UNSUPPORTED;
313
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
314
status = sc1200_test_tvout_odd_field();
319
/*---------------------------------------------------------------------------
320
* gfx_test_tvenc_odd_field
321
*---------------------------------------------------------------------------
324
gfx_test_tvenc_odd_field(void)
326
int status = GFX_STATUS_UNSUPPORTED;
329
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
330
status = sc1200_test_tvenc_odd_field();
335
/*----------------------------------------------------------------------------
336
* gfx_set_tv_field_status_invert
337
*----------------------------------------------------------------------------
340
gfx_set_tv_field_status_invert(int enable)
342
int retval = GFX_STATUS_UNSUPPORTED;
345
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
346
retval = sc1200_set_tv_field_status_invert(enable);
351
/*---------------------------------------------------------------------------
353
*---------------------------------------------------------------------------
356
gfx_get_tv_vphase(void)
358
int status = GFX_STATUS_UNSUPPORTED;
361
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
362
status = sc1200_get_tv_vphase();
367
/*---------------------------------------------------------------------------
369
*---------------------------------------------------------------------------
372
gfx_get_tv_enable(unsigned int *p_on)
377
if (gfx_tv_type & GFX_TV_TYPE_FS451)
378
retval = fs450_get_tv_enable(p_on);
381
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
382
retval = sc1200_get_tv_enable(p_on);
387
/*---------------------------------------------------------------------------
389
*---------------------------------------------------------------------------
397
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
398
retval = sc1200_get_tv_output();
403
/*---------------------------------------------------------------------------
404
* gfx_get_tv_mode_count
405
*---------------------------------------------------------------------------
408
gfx_get_tv_mode_count(TVStandardType format)
413
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
414
retval = sc1200_get_tv_mode_count(format);
419
/*---------------------------------------------------------------------------
420
* gfx_get_tv_display_mode
421
*---------------------------------------------------------------------------
424
gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz)
429
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
430
retval = sc1200_get_tv_display_mode(width, height, bpp, hz);
435
/*---------------------------------------------------------------------------
436
* gfx_get_tv_display_mode_frequency
437
*---------------------------------------------------------------------------
440
gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height,
441
TVStandardType format, int *frequency)
446
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
448
sc1200_get_tv_display_mode_frequency(width, height, format,
454
/*---------------------------------------------------------------------------
455
* gfx_is_tv_display_mode_supported
456
*---------------------------------------------------------------------------
459
gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height,
460
TVStandardType format)
465
if (gfx_tv_type & GFX_TV_TYPE_SC1200)
466
retval = sc1200_is_tv_display_mode_supported(width, height, format);
471
/*------------------------------------------
472
* The following functions were added to support
473
* the FS450 and will eventually be removed. There
474
* is no equivalent support in the SC1200.
475
*----------------------------------------------*/
477
/*==========================================================================
479
*==========================================================================
482
gfx_get_tv_standard(unsigned long *p_standard)
487
if (gfx_tv_type & GFX_TV_TYPE_FS451)
488
retval = fs450_get_tv_standard(p_standard);
494
gfx_get_available_tv_standards(unsigned long *p_standards)
499
if (gfx_tv_type & GFX_TV_TYPE_FS451)
500
retval = fs450_get_available_tv_standards(p_standards);
506
gfx_set_tv_standard(unsigned long standard)
511
if (gfx_tv_type & GFX_TV_TYPE_FS451)
512
retval = fs450_set_tv_standard(standard);
518
*==========================================================================
519
* vga mode as known by the driver
520
*==========================================================================
523
gfx_get_tv_vga_mode(unsigned long *p_vga_mode)
528
if (gfx_tv_type & GFX_TV_TYPE_FS451)
529
retval = fs450_get_tv_vga_mode(p_vga_mode);
535
gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes)
540
if (gfx_tv_type & GFX_TV_TYPE_FS451)
541
retval = fs450_get_available_tv_vga_modes(p_vga_modes);
547
gfx_set_tv_vga_mode(unsigned long vga_mode)
552
if (gfx_tv_type & GFX_TV_TYPE_FS451)
553
retval = fs450_set_tv_vga_mode(vga_mode);
559
*==========================================================================
565
gfx_get_tvout_mode(unsigned long *p_tvout_mode)
570
if (gfx_tv_type & GFX_TV_TYPE_FS451)
571
retval = fs450_get_tvout_mode(p_tvout_mode);
577
gfx_set_tvout_mode(unsigned long tvout_mode)
582
if (gfx_tv_type & GFX_TV_TYPE_FS451)
583
retval = fs450_set_tvout_mode(tvout_mode);
589
*==========================================================================
594
gfx_get_sharpness(int *p_sharpness)
599
if (gfx_tv_type & GFX_TV_TYPE_FS451)
600
retval = fs450_get_sharpness(p_sharpness);
606
gfx_set_sharpness(int sharpness)
611
if (gfx_tv_type & GFX_TV_TYPE_FS451)
612
retval = fs450_set_sharpness(sharpness);
618
*==========================================================================
620
* flicker filter control.
624
gfx_get_flicker_filter(int *p_flicker)
629
if (gfx_tv_type & GFX_TV_TYPE_FS451)
630
retval = fs450_get_flicker_filter(p_flicker);
636
gfx_set_flicker_filter(int flicker)
641
if (gfx_tv_type & GFX_TV_TYPE_FS451)
642
retval = fs450_set_flicker_filter(flicker);
648
*==========================================================================
650
* Overscan and Position
654
gfx_get_overscan(int *p_x, int *p_y)
659
if (gfx_tv_type & GFX_TV_TYPE_FS451)
660
retval = fs450_get_overscan(p_x, p_y);
667
gfx_set_overscan(int x, int y)
672
if (gfx_tv_type & GFX_TV_TYPE_FS451)
673
retval = fs450_set_overscan(x, y);
679
gfx_get_position(int *p_x, int *p_y)
684
if (gfx_tv_type & GFX_TV_TYPE_FS451)
685
retval = fs450_get_position(p_x, p_y);
691
gfx_set_position(int x, int y)
696
if (gfx_tv_type & GFX_TV_TYPE_FS451)
697
retval = fs450_set_position(x, y);
703
*==========================================================================
705
* Color, Brightness, and Contrast
709
gfx_get_color(int *p_color)
714
if (gfx_tv_type & GFX_TV_TYPE_FS451)
715
retval = fs450_get_color(p_color);
721
gfx_set_color(int color)
726
if (gfx_tv_type & GFX_TV_TYPE_FS451)
727
retval = fs450_set_color(color);
733
gfx_get_brightness(int *p_brightness)
738
if (gfx_tv_type & GFX_TV_TYPE_FS451)
739
retval = fs450_get_brightness(p_brightness);
745
gfx_set_brightness(int brightness)
750
if (gfx_tv_type & GFX_TV_TYPE_FS451)
751
retval = fs450_set_brightness(brightness);
757
gfx_get_contrast(int *p_contrast)
762
if (gfx_tv_type & GFX_TV_TYPE_FS451)
763
retval = fs450_get_contrast(p_contrast);
769
gfx_set_contrast(int contrast)
774
if (gfx_tv_type & GFX_TV_TYPE_FS451)
775
retval = fs450_set_contrast(contrast);
781
*==========================================================================
787
gfx_get_yc_filter(unsigned int *p_yc_filter)
792
if (gfx_tv_type & GFX_TV_TYPE_FS451)
793
retval = fs450_get_yc_filter(p_yc_filter);
799
gfx_set_yc_filter(unsigned int yc_filter)
804
if (gfx_tv_type & GFX_TV_TYPE_FS451)
805
retval = fs450_set_yc_filter(yc_filter);
811
gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits)
816
if (gfx_tv_type & GFX_TV_TYPE_FS451)
817
retval = fs450_get_aps_trigger_bits(p_trigger_bits);
823
gfx_set_aps_trigger_bits(unsigned int trigger_bits)
828
if (gfx_tv_type & GFX_TV_TYPE_FS451)
829
retval = fs450_set_aps_trigger_bits(trigger_bits);
834
#endif /* GFX_TV_DYNAMIC */