wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _VIDEO_AD7177_H_ |
| 9 | #define _VIDEO_AD7177_H_ |
| 10 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 11 | /* #define VIDEO_DEBUG_DISABLE_COLORS 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 12 | |
| 13 | #define VIDEO_ENCODER_NAME "Analog Devices AD7177" |
| 14 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 15 | #define VIDEO_ENCODER_I2C_RATE 100000 /* Max rate is 100 kHz */ |
| 16 | #define VIDEO_ENCODER_CB_Y_CR_Y /* Use CB Y CR Y format... */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 17 | |
| 18 | #define VIDEO_MODE_YUYV /* The only mode supported by this encoder */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 19 | #undef VIDEO_MODE_RGB |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 20 | #define VIDEO_MODE_BPP 16 |
| 21 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 22 | #ifdef VIDEO_MODE_PAL |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 23 | #define VIDEO_ACTIVE_COLS 720 |
| 24 | #define VIDEO_ACTIVE_ROWS 576 |
| 25 | #define VIDEO_VISIBLE_COLS 640 |
| 26 | #define VIDEO_VISIBLE_ROWS 480 |
| 27 | #endif |
| 28 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 29 | #ifdef VIDEO_MODE_NTSC |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 30 | #define VIDEO_ACTIVE_COLS 720 |
| 31 | #define VIDEO_ACTIVE_ROWS 525 |
| 32 | #define VIDEO_VISIBLE_COLS 640 |
| 33 | #define VIDEO_VISIBLE_ROWS 400 |
| 34 | #endif |
| 35 | |
| 36 | static unsigned char |
| 37 | video_encoder_data[] = { |
| 38 | #ifdef VIDEO_MODE_NTSC |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 39 | 0x04, /* Mode Register 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 40 | #ifdef VIDEO_DEBUG_COLORBARS |
| 41 | 0xc2, |
| 42 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 43 | 0x42, /* Mode Register 1 */ |
| 44 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 45 | 0x16, /* Subcarrier Freq 0 */ |
| 46 | 0x7c, /* Subcarrier Freq 1 */ |
| 47 | 0xf0, /* Subcarrier Freq 2 */ |
| 48 | 0x21, /* Subcarrier Freq 3 */ |
| 49 | 0x00, /* Subcarrier phase */ |
| 50 | 0x02, /* Timing Register 0 */ |
| 51 | 0x00, /* Extended Captioning 0 */ |
| 52 | 0x00, /* Extended Captioning 1 */ |
| 53 | 0x00, /* Closed Captioning 0 */ |
| 54 | 0x00, /* Closed Captioning 1 */ |
| 55 | 0x00, /* Timing Register 1 */ |
| 56 | 0x08, /* Mode Register 2 */ |
| 57 | 0x00, /* Pedestal Register 0 */ |
| 58 | 0x00, /* Pedestal Register 1 */ |
| 59 | 0x00, /* Pedestal Register 2 */ |
| 60 | 0x00, /* Pedestal Register 3 */ |
| 61 | 0x08, /* Mode Register 3 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 62 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 63 | #endif /* VIDEO_MODE_NTSC */ |
| 64 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 65 | #ifdef VIDEO_MODE_PAL |
| 66 | #ifdef VIDEO_MODE_RGB_OUT |
| 67 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 68 | 0x69, /* Mode Register 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 69 | #ifdef VIDEO_DEBUG_COLORBARS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 70 | 0xc0, /* Mode Register 1 (c0) */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 71 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 72 | 0x40, /* Mode Register 1 (c0) */ |
| 73 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 74 | 0xcb, /* Subcarrier Freq 0 */ |
| 75 | 0x8a, /* Subcarrier Freq 1 */ |
| 76 | 0x09, /* Subcarrier Freq 2 */ |
| 77 | 0x2a, /* Subcarrier Freq 3 */ |
| 78 | 0x00, /* Subcarrier phase */ |
| 79 | 0x02, /* Timing Register 0 */ |
| 80 | 0x00, /* Extended Captioning 0 */ |
| 81 | 0x00, /* Extended Captioning 1 */ |
| 82 | 0x00, /* Closed Captioning 0 */ |
| 83 | 0x00, /* Closed Captioning 1 */ |
| 84 | 0x00, /* Timing Register 1 */ |
| 85 | 0x28, /* Mode Register 2 */ |
| 86 | 0x00, /* Pedestal Register 0 */ |
| 87 | 0x00, /* Pedestal Register 1 */ |
| 88 | 0x00, /* Pedestal Register 2 */ |
| 89 | 0x00, /* Pedestal Register 3 */ |
| 90 | 0x08, /* Mode Register 3 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 91 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 92 | #else /* ! VIDEO_MODE_RGB_OUT */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 93 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 94 | 0x09, /* Mode Register 0 (was 01) */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 95 | #ifdef VIDEO_DEBUG_COLORBARS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 96 | 0xd8, /* */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 97 | #else |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 98 | 0x59, /* Mode Register 1 (was 58) */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 99 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 100 | 0xcb, /* Subcarrier Freq 0 */ |
| 101 | 0x8a, /* Subcarrier Freq 1 */ |
| 102 | 0x09, /* Subcarrier Freq 2 */ |
| 103 | 0x2a, /* Subcarrier Freq 3 */ |
| 104 | 0x00, /* Subcarrier phase */ |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 105 | 0x02, /* Timing Register 0 (was a) */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 106 | 0x00, /* Extended Captioning 0 */ |
| 107 | 0x00, /* Extended Captioning 1 */ |
| 108 | 0x00, /* Closed Captioning 0 */ |
| 109 | 0x00, /* Closed Captioning 1 */ |
| 110 | 0x00, /* Timing Register 1 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 111 | #ifdef VIDEO_DEBUG_LOWPOWER |
| 112 | #ifdef VIDEO_DEBUG_DISABLE_COLORS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 113 | 0x98, /* Mode Register 2 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 114 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 115 | 0x88, /* Mode Register 2 */ |
| 116 | #endif /* VIDEO_DEBUG_DISABLE_COLORS */ |
| 117 | #else /* ! VIDEO_DEBUG_LOWPOWER */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 118 | #ifdef VIDEO_DEBUG_DISABLE_COLORS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 119 | 0x18, /* Mode Register 2 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 120 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 121 | 0x08, /* Mode Register 2 */ |
| 122 | #endif /* VIDEO_DEBUG_DISABLE_COLORS */ |
| 123 | #endif /* VIDEO_DEBUG_LOWPOWER */ |
| 124 | 0x00, /* Pedestal Register 0 */ |
| 125 | 0x00, /* Pedestal Register 1 */ |
| 126 | 0x00, /* Pedestal Register 2 */ |
| 127 | 0x00, /* Pedestal Register 3 */ |
| 128 | 0x08 /* Mode Register 3 */ |
| 129 | #endif /* VIDEO_MODE_RGB_OUT */ |
| 130 | #endif /* VIDEO_MODE_PAL */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 131 | } ; |
| 132 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 133 | #endif /* _VIDEO_AD7177_H_ */ |