Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (3300): Add standard for South Korean NTSC-M using A2 audio.

South Korea uses NTSC-M but with A2 audio instead of BTSC. Several audio
chips need this information in order to set the correct audio processing
registers.

Acked-by: Mauro Carvalho Chehab <mauro_chehab@yahoo.com.br>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
d97a11e0 8a8832a8

+35 -33
+1 -1
drivers/media/video/bttv-driver.c
··· 214 214 we can capture, of the first and second field. */ 215 215 .vbistart = { 7,320 }, 216 216 },{ 217 - .v4l2_id = V4L2_STD_NTSC_M, 217 + .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, 218 218 .name = "NTSC", 219 219 .Fsc = 28636363, 220 220 .swidth = 768,
+20 -30
drivers/media/video/cx25840/cx25840-core.c
··· 220 220 cx25840_write(client, 0x808, 0xff); 221 221 cx25840_write(client, 0x80b, 0x10); 222 222 } else if (std & V4L2_STD_NTSC) { 223 - /* NTSC */ 224 - if (state->pvr150_workaround) { 225 - /* Certain Hauppauge PVR150 models have a hardware bug 226 - that causes audio to drop out. For these models the 227 - audio standard must be set explicitly. 228 - To be precise: it affects cards with tuner models 229 - 85, 99 and 112 (model numbers from tveeprom). */ 230 - if (std == V4L2_STD_NTSC_M_JP) { 231 - /* Japan uses EIAJ audio standard */ 232 - cx25840_write(client, 0x808, 0x2f); 233 - } else { 234 - /* Others use the BTSC audio standard */ 235 - cx25840_write(client, 0x808, 0x1f); 236 - } 237 - /* South Korea uses the A2-M (aka Zweiton M) audio 238 - standard, and should set 0x808 to 0x3f, but I don't 239 - know how to detect this. */ 240 - } else if (std == V4L2_STD_NTSC_M_JP) { 223 + /* Certain Hauppauge PVR150 models have a hardware bug 224 + that causes audio to drop out. For these models the 225 + audio standard must be set explicitly. 226 + To be precise: it affects cards with tuner models 227 + 85, 99 and 112 (model numbers from tveeprom). */ 228 + int hw_fix = state->pvr150_workaround; 229 + 230 + if (std == V4L2_STD_NTSC_M_JP) { 241 231 /* Japan uses EIAJ audio standard */ 242 - cx25840_write(client, 0x808, 0xf7); 232 + cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7); 233 + } else if (std == V4L2_STD_NTSC_M_KR) { 234 + /* South Korea uses A2 audio standard */ 235 + cx25840_write(client, 0x808, hw_fix ? 0x3f : 0xf8); 243 236 } else { 244 237 /* Others use the BTSC audio standard */ 245 - cx25840_write(client, 0x808, 0xf6); 238 + cx25840_write(client, 0x808, hw_fix ? 0x1f : 0xf6); 246 239 } 247 - /* South Korea uses the A2-M (aka Zweiton M) audio standard, 248 - and should set 0x808 to 0xf8, but I don't know how to 249 - detect this. */ 250 240 cx25840_write(client, 0x80b, 0x00); 251 241 } 252 242 ··· 320 330 u8 fmt=0; /* zero is autodetect */ 321 331 322 332 /* First tests should be against specific std */ 323 - if (std & V4L2_STD_NTSC_M_JP) { 333 + if (std == V4L2_STD_NTSC_M_JP) { 324 334 fmt=0x2; 325 - } else if (std & V4L2_STD_NTSC_443) { 335 + } else if (std == V4L2_STD_NTSC_443) { 326 336 fmt=0x3; 327 - } else if (std & V4L2_STD_PAL_M) { 337 + } else if (std == V4L2_STD_PAL_M) { 328 338 fmt=0x5; 329 - } else if (std & V4L2_STD_PAL_N) { 339 + } else if (std == V4L2_STD_PAL_N) { 330 340 fmt=0x6; 331 - } else if (std & V4L2_STD_PAL_Nc) { 341 + } else if (std == V4L2_STD_PAL_Nc) { 332 342 fmt=0x7; 333 - } else if (std & V4L2_STD_PAL_60) { 343 + } else if (std == V4L2_STD_PAL_60) { 334 344 fmt=0x8; 335 345 } else { 336 346 /* Then, test against generic ones */ ··· 359 369 } 360 370 361 371 switch (fmt) { 362 - case 0x1: return V4L2_STD_NTSC_M; 372 + case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; 363 373 case 0x2: return V4L2_STD_NTSC_M_JP; 364 374 case 0x3: return V4L2_STD_NTSC_443; 365 375 case 0x4: return V4L2_STD_PAL;
+6 -1
drivers/media/video/tda9887.c
··· 231 231 cAudioIF_6_5 | 232 232 cVideoIF_38_90 ), 233 233 },{ 234 - .std = V4L2_STD_NTSC_M, 234 + .std = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, 235 235 .name = "NTSC-M", 236 236 .b = ( cNegativeFmTV | 237 237 cQSS ), ··· 618 618 case 'J': 619 619 tda9887_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 620 620 t->std = V4L2_STD_NTSC_M_JP; 621 + break; 622 + case 'k': 623 + case 'K': 624 + tda9887_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); 625 + t->std = V4L2_STD_NTSC_M_KR; 621 626 break; 622 627 case '-': 623 628 /* default parameter, do nothing */
+5
drivers/media/video/tuner-core.c
··· 366 366 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 367 367 t->std = V4L2_STD_NTSC_M_JP; 368 368 break; 369 + case 'k': 370 + case 'K': 371 + tuner_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); 372 + t->std = V4L2_STD_NTSC_M_KR; 373 + break; 369 374 case '-': 370 375 /* default parameter, do nothing */ 371 376 break;
+3 -1
include/linux/videodev2.h
··· 638 638 #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 639 639 #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 640 640 #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) 641 + #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) 641 642 642 643 #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 643 644 #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) ··· 671 670 V4L2_STD_PAL_H |\ 672 671 V4L2_STD_PAL_I) 673 672 #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ 674 - V4L2_STD_NTSC_M_JP) 673 + V4L2_STD_NTSC_M_JP |\ 674 + V4L2_STD_NTSC_M_KR) 675 675 #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ 676 676 V4L2_STD_SECAM_K |\ 677 677 V4L2_STD_SECAM_K1)