Mauro Carvalho Chehab | c009e68 | 2016-07-17 17:28:40 -0300 | [diff] [blame] | 1 | The cx88 driver |
| 2 | =============== |
| 3 | |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 4 | Author: Gerd Hoffmann |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
| 6 | This is a v4l2 device driver for the cx2388x chip. |
| 7 | |
| 8 | |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 9 | Current status |
Mauro Carvalho Chehab | c009e68 | 2016-07-17 17:28:40 -0300 | [diff] [blame] | 10 | -------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
| 12 | video |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 13 | - Works. |
| 14 | - Overlay isn't supported. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | audio |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 17 | - Works. The TV standard detection is made by the driver, as the |
| 18 | hardware has bugs to auto-detect. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | - audio data dma (i.e. recording without loopback cable to the |
Mauro Carvalho Chehab | 2b1b945 | 2008-10-24 23:13:57 -0300 | [diff] [blame] | 20 | sound card) is supported via cx88-alsa. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | vbi |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 23 | - Works. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
| 25 | |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 26 | How to add support for new cards |
Mauro Carvalho Chehab | c009e68 | 2016-07-17 17:28:40 -0300 | [diff] [blame] | 27 | -------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | The driver needs some config info for the TV cards. This stuff is in |
| 30 | cx88-cards.c. If the driver doesn't work well you likely need a new |
| 31 | entry for your card in that file. Check the kernel log (using dmesg) |
| 32 | to see whenever the driver knows your card or not. There is a line |
| 33 | like this one: |
| 34 | |
Mauro Carvalho Chehab | c009e68 | 2016-07-17 17:28:40 -0300 | [diff] [blame] | 35 | .. code-block:: none |
| 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | cx8800[0]: subsystem: 0070:3400, board: Hauppauge WinTV \ |
| 38 | 34xxx models [card=1,autodetected] |
| 39 | |
| 40 | If your card is listed as "board: UNKNOWN/GENERIC" it is unknown to |
| 41 | the driver. What to do then? |
| 42 | |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 43 | 1) Try upgrading to the latest snapshot, maybe it has been added |
| 44 | meanwhile. |
| 45 | 2) You can try to create a new entry yourself, have a look at |
| 46 | cx88-cards.c. If that worked, mail me your changes as unified |
| 47 | diff ("diff -u"). |
| 48 | 3) Or you can mail me the config information. We need at least the |
| 49 | following information to add the card: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 51 | - the PCI Subsystem ID ("0070:3400" from the line above, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | "lspci -v" output is fine too). |
Mauro Carvalho Chehab | 55aa32f | 2016-07-17 17:44:45 -0300 | [diff] [blame] | 53 | - the tuner type used by the card. You can try to find one by |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | trial-and-error using the tuner=<n> insmod option. If you |
| 55 | know which one the card has you can also have a look at the |
| 56 | list in CARDLIST.tuner |
| 57 | |
Mauro Carvalho Chehab | 2b8de4e | 2016-07-18 14:10:40 -0300 | [diff] [blame] | 58 | Documentation missing at the cx88 datasheet |
| 59 | ------------------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Mauro Carvalho Chehab | 2b8de4e | 2016-07-18 14:10:40 -0300 | [diff] [blame] | 61 | MO_OUTPUT_FORMAT (0x310164) |
| 62 | |
| 63 | .. code-block:: none |
| 64 | |
| 65 | Previous default from DScaler: 0x1c1f0008 |
| 66 | Digit 8: 31-28 |
| 67 | 28: PREVREMOD = 1 |
| 68 | |
| 69 | Digit 7: 27-24 (0xc = 12 = b1100 ) |
| 70 | 27: COMBALT = 1 |
| 71 | 26: PAL_INV_PHASE |
| 72 | (DScaler apparently set this to 1, resulted in sucky picture) |
| 73 | |
| 74 | Digits 6,5: 23-16 |
| 75 | 25-16: COMB_RANGE = 0x1f [default] (9 bits -> max 512) |
| 76 | |
| 77 | Digit 4: 15-12 |
| 78 | 15: DISIFX = 0 |
| 79 | 14: INVCBF = 0 |
| 80 | 13: DISADAPT = 0 |
| 81 | 12: NARROWADAPT = 0 |
| 82 | |
| 83 | Digit 3: 11-8 |
| 84 | 11: FORCE2H |
| 85 | 10: FORCEREMD |
| 86 | 9: NCHROMAEN |
| 87 | 8: NREMODEN |
| 88 | |
| 89 | Digit 2: 7-4 |
| 90 | 7-6: YCORE |
| 91 | 5-4: CCORE |
| 92 | |
| 93 | Digit 1: 3-0 |
| 94 | 3: RANGE = 1 |
| 95 | 2: HACTEXT |
| 96 | 1: HSFMT |
| 97 | |
| 98 | 0x47 is the sync byte for MPEG-2 transport stream packets. |
| 99 | Datasheet incorrectly states to use 47 decimal. 188 is the length. |
| 100 | All DVB compliant frontends output packets with this start code. |
Mauro Carvalho Chehab | f0d1722 | 2016-07-18 14:18:10 -0300 | [diff] [blame] | 101 | |
| 102 | Hauppauge WinTV cx88 IR information |
| 103 | ----------------------------------- |
| 104 | |
| 105 | The controls for the mux are GPIO [0,1] for source, and GPIO 2 for muting. |
| 106 | |
| 107 | ====== ======== ================================================= |
| 108 | GPIO0 GPIO1 |
| 109 | ====== ======== ================================================= |
| 110 | 0 0 TV Audio |
| 111 | 1 0 FM radio |
| 112 | 0 1 Line-In |
| 113 | 1 1 Mono tuner bypass or CD passthru (tuner specific) |
| 114 | ====== ======== ================================================= |
| 115 | |
| 116 | GPIO 16(I believe) is tied to the IR port (if present). |
| 117 | |
| 118 | |
| 119 | From the data sheet: |
| 120 | |
| 121 | - Register 24'h20004 PCI Interrupt Status |
Mauro Carvalho Chehab | 5b8700e | 2016-07-20 09:22:38 -0300 | [diff] [blame] | 122 | |
Mauro Carvalho Chehab | f0d1722 | 2016-07-18 14:18:10 -0300 | [diff] [blame] | 123 | - bit [18] IR_SMP_INT Set when 32 input samples have been collected over |
| 124 | - gpio[16] pin into GP_SAMPLE register. |
| 125 | |
| 126 | What's missing from the data sheet: |
| 127 | |
| 128 | - Setup 4KHz sampling rate (roughly 2x oversampled; good enough for our RC5 |
| 129 | compat remote) |
| 130 | - set register 0x35C050 to 0xa80a80 |
| 131 | - enable sampling |
| 132 | - set register 0x35C054 to 0x5 |
| 133 | - enable the IRQ bit 18 in the interrupt mask register (and |
| 134 | provide for a handler) |
| 135 | |
| 136 | GP_SAMPLE register is at 0x35C058 |
| 137 | |
| 138 | Bits are then right shifted into the GP_SAMPLE register at the specified |
| 139 | rate; you get an interrupt when a full DWORD is received. |
| 140 | You need to recover the actual RC5 bits out of the (oversampled) IR sensor |
| 141 | bits. (Hint: look for the 0/1and 1/0 crossings of the RC5 bi-phase data) An |
| 142 | actual raw RC5 code will span 2-3 DWORDS, depending on the actual alignment. |
| 143 | |
| 144 | I'm pretty sure when no IR signal is present the receiver is always in a |
| 145 | marking state(1); but stray light, etc can cause intermittent noise values |
| 146 | as well. Remember, this is a free running sample of the IR receiver state |
| 147 | over time, so don't assume any sample starts at any particular place. |
| 148 | |
| 149 | Additional info |
| 150 | ~~~~~~~~~~~~~~~ |
| 151 | |
| 152 | This data sheet (google search) seems to have a lovely description of the |
| 153 | RC5 basics: |
| 154 | http://www.atmel.com/dyn/resources/prod_documents/doc2817.pdf |
| 155 | |
| 156 | This document has more data: |
| 157 | http://www.nenya.be/beor/electronics/rc5.htm |
| 158 | |
| 159 | This document has a how to decode a bi-phase data stream: |
| 160 | http://www.ee.washington.edu/circuit_archive/text/ir_decode.txt |
| 161 | |
| 162 | This document has still more info: |
| 163 | http://www.xs4all.nl/~sbp/knowledge/ir/rc5.htm |