39 #define NTSC_LIKE_TIMINGS .vrefresh = 60 * fixed1/1.001, \
44 #define PAL_LIKE_TIMINGS .vrefresh = 50 * fixed1, \
52 .black_level = 0.339 *
fixed1,
53 .subc_freq = 3579545 *
fixed1,
59 .black_level = 0.286 *
fixed1,
60 .subc_freq = 3579545 *
fixed1,
66 .black_level = 0.3 *
fixed1,
67 .subc_freq = 4433618.75 *
fixed1,
73 .black_level = 0.339 *
fixed1,
74 .subc_freq = 3575611.433 *
fixed1,
84 .black_level = 0.339 *
fixed1,
85 .subc_freq = 4433618.75 *
fixed1,
91 .black_level = 0.3 *
fixed1,
92 .subc_freq = 3582056.25 *
fixed1,
98 .black_level = 0.3 *
fixed1,
99 .subc_freq = 4433618.75 *
fixed1,
105 #define __MODE(f, hd, vd, ht, vt, hsynp, vsynp, \
106 subc, scale, scale_mask, norm_mask, e_hd, e_vd) { \
108 .name = #hd "x" #vd, \
110 .type = DRM_MODE_TYPE_DRIVER, \
113 .hsync_start = e_hd + 16, \
114 .hsync_end = e_hd + 80, \
118 .vsync_start = vd + 10, \
119 .vsync_end = vd + 26, \
122 .flags = DRM_MODE_FLAG_##hsynp##HSYNC | \
123 DRM_MODE_FLAG_##vsynp##VSYNC, \
128 .subc_coeff = subc * fixed1, \
129 .dispmode = bitfs(CH7006_DISPMODE_SCALING_RATIO, scale) | \
130 bitfs(CH7006_DISPMODE_INPUT_RES, e_hd##x##e_vd), \
131 .valid_scales = scale_mask, \
132 .valid_norms = norm_mask \
135 #define MODE(f, hd, vd, ht, vt, hsynp, vsynp, \
136 subc, scale, scale_mask, norm_mask) \
137 __MODE(f, hd, vd, ht, vt, hsynp, vsynp, subc, scale, \
138 scale_mask, norm_mask, hd, vd)
140 #define NTSC_LIKE (1 << TV_NORM_NTSC_M | 1 << TV_NORM_NTSC_J | \
141 1 << TV_NORM_PAL_M | 1 << TV_NORM_PAL_60)
143 #define PAL_LIKE (1 << TV_NORM_PAL | 1 << TV_NORM_PAL_N | 1 << TV_NORM_PAL_NC)
146 MODE(21000, 512, 384, 840, 500,
N,
N, 181.797557582, 5_4, 0x6,
PAL_LIKE),
147 MODE(26250, 512, 384, 840, 625,
N,
N, 145.438046066, 1_1, 0x1,
PAL_LIKE),
148 MODE(20140, 512, 384, 800, 420,
N,
N, 213.257083791, 5_4, 0x4,
NTSC_LIKE),
149 MODE(24671, 512, 384, 784, 525,
N,
N, 174.0874153, 1_1, 0x3,
NTSC_LIKE),
150 MODE(28125, 720, 400, 1125, 500,
N,
N, 135.742176298, 5_4, 0x6,
PAL_LIKE),
151 MODE(34875, 720, 400, 1116, 625,
N,
N, 109.469496898, 1_1, 0x1,
PAL_LIKE),
152 MODE(23790, 720, 400, 945, 420,
N,
N, 160.475642016, 5_4, 0x4,
NTSC_LIKE),
153 MODE(29455, 720, 400, 936, 525,
N,
N, 129.614941843, 1_1, 0x3,
NTSC_LIKE),
154 MODE(25000, 640, 400, 1000, 500,
N,
N, 152.709948279, 5_4, 0x6,
PAL_LIKE),
155 MODE(31500, 640, 400, 1008, 625,
N,
N, 121.198371646, 1_1, 0x1,
PAL_LIKE),
156 MODE(21147, 640, 400, 840, 420,
N,
N, 180.535097338, 5_4, 0x4,
NTSC_LIKE),
157 MODE(26434, 640, 400, 840, 525,
N,
N, 144.42807787, 1_1, 0x2,
NTSC_LIKE),
158 MODE(30210, 640, 400, 840, 600,
N,
N, 126.374568276, 7_8, 0x1,
NTSC_LIKE),
159 MODE(21000, 640, 480, 840, 500,
N,
N, 181.797557582, 5_4, 0x4,
PAL_LIKE),
160 MODE(26250, 640, 480, 840, 625,
N,
N, 145.438046066, 1_1, 0x2,
PAL_LIKE),
161 MODE(31500, 640, 480, 840, 750,
N,
N, 121.198371646, 5_6, 0x1,
PAL_LIKE),
162 MODE(24671, 640, 480, 784, 525,
N,
N, 174.0874153, 1_1, 0x4,
NTSC_LIKE),
163 MODE(28196, 640, 480, 784, 600,
N,
N, 152.326488422, 7_8, 0x2,
NTSC_LIKE),
164 MODE(30210, 640, 480, 800, 630,
N,
N, 142.171389101, 5_6, 0x1,
NTSC_LIKE),
165 __MODE(29500, 720, 576, 944, 625,
P,
P, 145.592111636, 1_1, 0x7,
PAL_LIKE, 800, 600),
166 MODE(36000, 800, 600, 960, 750,
P,
P, 119.304647022, 5_6, 0x6,
PAL_LIKE),
167 MODE(39000, 800, 600, 936, 836,
P,
P, 110.127366499, 3_4, 0x1,
PAL_LIKE),
168 MODE(39273, 800, 600, 1040, 630,
P,
P, 145.816809399, 5_6, 0x4,
NTSC_LIKE),
169 MODE(43636, 800, 600, 1040, 700,
P,
P, 131.235128487, 3_4, 0x2,
NTSC_LIKE),
170 MODE(47832, 800, 600, 1064, 750,
P,
P, 119.723275165, 7_10, 0x1,
NTSC_LIKE),
180 for (mode = ch7006_modes; mode->
mode.clock; mode++) {
228 ch7006_dbg(client,
"black level: %d\n", black_level);
240 subc_inc = round_fixed((mode->
subc_coeff >> 8)
252 ch7006_dbg(client,
"subcarrier inc: %u\n", subc_inc);
263 int freq, best_freq = 0;
269 if (
abs(freq - mode->
mode.clock) <
270 abs(best_freq - mode->
mode.clock)) {
290 best_n, best_m, best_freq, best_n < 108);
305 switch (subconnector) {
364 ch7006_dbg(client,
"hpos: %d, vpos: %d\n", hpos, vpos);
376 ch7006_err(client,
"Error %d writing to subaddress 0x%x\n",
396 ch7006_err(client,
"Error %d reading from subaddress 0x%x\n",