Documentation/driver-api/media/drivers/cx88-devel.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API

The cx88 driver

cx88 MO_OUTPUT_FORMAT bitfield, MPEG-2 sync byte 정정과 Hauppauge WinTV RC5 IR sampling 경로를 다루는 개발 문서의 전문 번역입니다.

Source pathDocumentation/driver-api/media/drivers/cx88-devel.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

cx88-devel.rst:1-113

cx88 datasheet의 누락·오류를 보완하는 짧은 개발 기록입니다. 영상 출력 bitfield와 transport packet 정정, audio mux GPIO 조합, free-running IR sample에서 RC5 bi-phase code를 복원하는 전체 흐름을 설명합니다.

문서 구성
원문 줄내용
1-7문서와 저자
8-51MO_OUTPUT_FORMAT와 MPEG-2 sync byte
52-98Hauppauge GPIO mux와 RC5 sampling
99-113외부 참고 자료

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 The cx88 driver
4 ===============
5
6 Author: Gerd Hoffmann
7
8 Documentation missing at the cx88 datasheet
9 -------------------------------------------
10
11 MO_OUTPUT_FORMAT (0x310164)
12
13 .. code-block:: none
14
15 Previous default from DScaler: 0x1c1f0008
16 Digit 8: 31-28
17 28: PREVREMOD = 1
18
19 Digit 7: 27-24 (0xc = 12 = b1100 )
20 27: COMBALT = 1
21 26: PAL_INV_PHASE
22 (DScaler apparently set this to 1, resulted in sucky picture)
23
24 Digits 6,5: 23-16
25 25-16: COMB_RANGE = 0x1f [default] (9 bits -> max 512)
26
27 Digit 4: 15-12
28 15: DISIFX = 0
29 14: INVCBF = 0
30 13: DISADAPT = 0
31 12: NARROWADAPT = 0
32
33 Digit 3: 11-8
34 11: FORCE2H
35 10: FORCEREMD
36 9: NCHROMAEN
37 8: NREMODEN
38
39 Digit 2: 7-4
40 7-6: YCORE
41 5-4: CCORE
42
43 Digit 1: 3-0
44 3: RANGE = 1
45 2: HACTEXT
46 1: HSFMT
47
48 0x47 is the sync byte for MPEG-2 transport stream packets.
49 Datasheet incorrectly states to use 47 decimal. 188 is the length.
50 All DVB compliant frontends output packets with this start code.
51
52 Hauppauge WinTV cx88 IR information
53 -----------------------------------
54
55 The controls for the mux are GPIO [0,1] for source, and GPIO 2 for muting.
56
57 ====== ======== =================================================
58 GPIO0 GPIO1
59 ====== ======== =================================================
60 0 0 TV Audio
61 1 0 FM radio
62 0 1 Line-In
63 1 1 Mono tuner bypass or CD passthru (tuner specific)
64 ====== ======== =================================================
65
66 GPIO 16(I believe) is tied to the IR port (if present).
67
68
69 From the data sheet:
70
71 - Register 24'h20004 PCI Interrupt Status
72
73 - bit [18] IR_SMP_INT Set when 32 input samples have been collected over
74 - gpio[16] pin into GP_SAMPLE register.
75
76 What's missing from the data sheet:
77
78 - Setup 4KHz sampling rate (roughly 2x oversampled; good enough for our RC5
79 compat remote)
80 - set register 0x35C050 to 0xa80a80
81 - enable sampling
82 - set register 0x35C054 to 0x5
83 - enable the IRQ bit 18 in the interrupt mask register (and
84 provide for a handler)
85
86 GP_SAMPLE register is at 0x35C058
87
88 Bits are then right shifted into the GP_SAMPLE register at the specified
89 rate; you get an interrupt when a full DWORD is received.
90 You need to recover the actual RC5 bits out of the (oversampled) IR sensor
91 bits. (Hint: look for the 0/1and 1/0 crossings of the RC5 bi-phase data) An
92 actual raw RC5 code will span 2-3 DWORDS, depending on the actual alignment.
93
94 I'm pretty sure when no IR signal is present the receiver is always in a
95 marking state(1); but stray light, etc can cause intermittent noise values
96 as well. Remember, this is a free running sample of the IR receiver state
97 over time, so don't assume any sample starts at any particular place.
98
99 Additional info
100 ~~~~~~~~~~~~~~~
101
102 This data sheet (google search) seems to have a lovely description of the
103 RC5 basics:
104 http://www.atmel.com/dyn/resources/prod_documents/doc2817.pdf
105
106 This document has more data:
107 http://www.nenya.be/beor/electronics/rc5.htm
108
109 This document has a how to decode a bi-phase data stream:
110 http://www.ee.washington.edu/circuit_archive/text/ir_decode.txt
111
112 This document has still more info:
113 http://www.xs4all.nl/~sbp/knowledge/ir/rc5.htm
114

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

cx88 driver 문서

1-7

이 문서는 `GPL-2.0`으로 배포되는 cx88 driver 개발 참고 자료입니다. 저자는 Gerd Hoffmann이며, datasheet에서 빠졌거나 잘못 설명된 register와 Hauppauge WinTV cx88의 IR 입력 동작을 기록합니다.

문서 메타데이터
항목
대상cx88 driver
저자Gerd Hoffmann
라이선스GPL-2.0
성격datasheet 보완 및 정정

.. SPDX-License-Identifier: GPL-2.0

The cx88 driver
===============

Author:  Gerd Hoffmann

MO_OUTPUT_FORMAT와 MPEG-2 transport packet

8-51

`MO_OUTPUT_FORMAT`의 주소는 `0x310164`입니다. DScaler에서 가져온 이전 기본값 `0x1c1f0008`을 hexadecimal digit별로 나누면 다음 bitfield가 됩니다. `PAL_INV_PHASE`를 1로 설정한 DScaler 값은 화질을 크게 떨어뜨렸다는 관찰도 함께 기록되어 있습니다.

MO_OUTPUT_FORMAT bitfield
비트Symbol값 또는 의미
31:28PREVREMODbit28=1
27:24COMBALT / PAL_INV_PHASEbit27=1; bit26의 DScaler 값 1은 화질 저하
25:16COMB_RANGE기본 0x1f, 9비트, 최대 512
15:12DISIFX / INVCBF / DISADAPT / NARROWADAPT모두 0
11:8FORCE2H / FORCEREMD / NCHROMAEN / NREMODEN개별 제어 bit
7:4YCORE / CCOREYCORE bits7:6, CCORE bits5:4
3:0RANGE / HACTEXT / HSFMTRANGE bit3=1; bit0은 문서에 정의 없음

MPEG-2 transport stream packet의 sync byte는 hexadecimal `0x47`입니다. datasheet의 decimal 47 사용 지시는 잘못됐으며 packet 길이는 188바이트입니다. DVB 호환 frontend는 모두 이 start code로 시작하는 packet을 출력합니다.

Documentation missing at the cx88 datasheet
-------------------------------------------

MO_OUTPUT_FORMAT (0x310164)

.. code-block:: none

  Previous default from DScaler: 0x1c1f0008
  Digit 8: 31-28
  28: PREVREMOD = 1

  Digit 7: 27-24 (0xc = 12 = b1100 )
  27: COMBALT = 1
  26: PAL_INV_PHASE
    (DScaler apparently set this to 1, resulted in sucky picture)

  Digits 6,5: 23-16
  25-16: COMB_RANGE = 0x1f [default] (9 bits -> max 512)

  Digit 4: 15-12
  15: DISIFX = 0
  14: INVCBF = 0
  13: DISADAPT = 0
  12: NARROWADAPT = 0

  Digit 3: 11-8
  11: FORCE2H
  10: FORCEREMD
  9: NCHROMAEN
  8: NREMODEN

  Digit 2: 7-4
  7-6: YCORE
  5-4: CCORE

  Digit 1: 3-0
  3: RANGE = 1
  2: HACTEXT
  1: HSFMT

0x47 is the sync byte for MPEG-2 transport stream packets.
Datasheet incorrectly states to use 47 decimal. 188 is the length.
All DVB compliant frontends output packets with this start code.

Hauppauge mux와 RC5 IR sampling

52-98

Hauppauge WinTV cx88에서 mux source는 GPIO[0:1], mute는 GPIO2로 제어합니다. GPIO16으로 추정되는 pin은 장치에 IR port가 있으면 그 port에 연결됩니다.

Audio mux GPIO
GPIO0GPIO1입력
00TV Audio
10FM radio
01Line-In
11Mono tuner bypass 또는 CD passthru; tuner별 차이

datasheet에 따르면 PCI Interrupt Status register `24'h20004`의 bit18 `IR_SMP_INT`는 GPIO16에서 32개 input sample이 `GP_SAMPLE`에 모이면 set됩니다. datasheet에 빠진 설정은 약 4 kHz sampling rate, sample enable register와 interrupt mask입니다.

RC5 sample 수신 흐름
0x35C050 = 0xa80a800x35C054 = 0x5IRQ mask bit18 enableGPIO16 sampleGP_SAMPLE 0x35C05832 samples / DWORD0/1·1/0 crossing으로 RC5 복원

free-running oversampled GPIO stream에서 RC5 bit를 복원합니다.

sample은 지정한 rate로 `GP_SAMPLE(0x35C058)`에 오른쪽 shift되어 들어오고 DWORD가 차면 interrupt가 발생합니다. RC5는 bi-phase data이므로 oversampled sensor bit에서 `0/1`과 `1/0` 전이를 찾아 실제 bit를 복원합니다. 정렬에 따라 하나의 raw RC5 code는 2-3 DWORD에 걸칩니다.

신호가 없을 때 receiver는 대체로 marking state(1)이지만 stray light가 간헐적 noise를 만들 수 있습니다. 이 값은 IR receiver 상태를 시간에 따라 계속 sampling하는 free-running stream이므로 어느 sample이 code 경계에서 시작한다고 가정하면 안 됩니다.

Hauppauge WinTV cx88 IR information
-----------------------------------

The controls for the mux are GPIO [0,1] for source, and GPIO 2 for muting.

====== ======== =================================================
GPIO0  GPIO1
====== ======== =================================================
  0        0    TV Audio
  1        0    FM radio
  0        1    Line-In
  1        1    Mono tuner bypass or CD passthru (tuner specific)
====== ======== =================================================

GPIO 16(I believe) is tied to the IR port (if present).


From the data sheet:

- Register 24'h20004  PCI Interrupt Status

 - bit [18]  IR_SMP_INT Set when 32 input samples have been collected over
 - gpio[16] pin into GP_SAMPLE register.

What's missing from the data sheet:

- Setup 4KHz sampling rate (roughly 2x oversampled; good enough for our RC5
  compat remote)
- set register 0x35C050 to  0xa80a80
- enable sampling
- set register 0x35C054 to 0x5
- enable the IRQ bit 18 in the interrupt mask register (and
  provide for a handler)

GP_SAMPLE register is at 0x35C058

Bits are then right shifted into the GP_SAMPLE register at the specified
rate; you get an interrupt when a full DWORD is received.
You need to recover the actual RC5 bits out of the (oversampled) IR sensor
bits. (Hint: look for the 0/1and 1/0 crossings of the RC5 bi-phase data)  An
actual raw RC5 code will span 2-3 DWORDS, depending on the actual alignment.

I'm pretty sure when no IR signal is present the receiver is always in a
marking state(1); but stray light, etc can cause intermittent noise values
as well.  Remember, this is a free running sample of the IR receiver state
over time, so don't assume any sample starts at any particular place.

RC5 추가 참고 자료

99-113

원문은 RC5 기본, 추가 protocol 정보와 bi-phase stream decode 방법을 다룬 네 개의 외부 자료를 안내합니다. URL은 역사적 참고를 위해 원문 그대로 보존하며 현재 접근 가능성을 보장하지 않습니다.

원문 참고 링크
URL주제
http://www.atmel.com/dyn/resources/prod_documents/doc2817.pdfRC5 기본 설명
http://www.nenya.be/beor/electronics/rc5.htmRC5 추가 자료
http://www.ee.washington.edu/circuit_archive/text/ir_decode.txtbi-phase data stream decode
http://www.xs4all.nl/~sbp/knowledge/ir/rc5.htm추가 IR/RC5 정보

Additional info
~~~~~~~~~~~~~~~

This data sheet (google search) seems to have a lovely description of the
RC5 basics:
http://www.atmel.com/dyn/resources/prod_documents/doc2817.pdf

This document has more data:
http://www.nenya.be/beor/electronics/rc5.htm

This document has a  how to decode a bi-phase data stream:
http://www.ee.washington.edu/circuit_archive/text/ir_decode.txt

This document has still more info:
http://www.xs4all.nl/~sbp/knowledge/ir/rc5.htm