pvrusb2-encoder.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. /*
  2. *
  3. * $Id$
  4. *
  5. * Copyright (C) 2005 Mike Isely <isely@pobox.com>
  6. * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #include <linux/device.h> // for linux/firmware.h
  23. #include <linux/firmware.h>
  24. #include <linux/videodev2.h>
  25. #include <media/cx2341x.h>
  26. #include "pvrusb2-util.h"
  27. #include "pvrusb2-encoder.h"
  28. #include "pvrusb2-hdw-internal.h"
  29. #include "pvrusb2-debug.h"
  30. static u32 pvr_tbl_emphasis [] = {
  31. [PVR2_CVAL_AUDIOEMPHASIS_NONE] = 0x0 << 12,
  32. [PVR2_CVAL_AUDIOEMPHASIS_50_15] = 0x1 << 12,
  33. [PVR2_CVAL_AUDIOEMPHASIS_CCITT] = 0x3 << 12,
  34. };
  35. static u32 pvr_tbl_srate[] = {
  36. [PVR2_CVAL_SRATE_48] = 0x01,
  37. [PVR2_CVAL_SRATE_44_1] = 0x00,
  38. };
  39. static u32 pvr_tbl_audiobitrate[] = {
  40. [PVR2_CVAL_AUDIOBITRATE_384] = 0xe << 4,
  41. [PVR2_CVAL_AUDIOBITRATE_320] = 0xd << 4,
  42. [PVR2_CVAL_AUDIOBITRATE_256] = 0xc << 4,
  43. [PVR2_CVAL_AUDIOBITRATE_224] = 0xb << 4,
  44. [PVR2_CVAL_AUDIOBITRATE_192] = 0xa << 4,
  45. [PVR2_CVAL_AUDIOBITRATE_160] = 0x9 << 4,
  46. [PVR2_CVAL_AUDIOBITRATE_128] = 0x8 << 4,
  47. [PVR2_CVAL_AUDIOBITRATE_112] = 0x7 << 4,
  48. [PVR2_CVAL_AUDIOBITRATE_96] = 0x6 << 4,
  49. [PVR2_CVAL_AUDIOBITRATE_80] = 0x5 << 4,
  50. [PVR2_CVAL_AUDIOBITRATE_64] = 0x4 << 4,
  51. [PVR2_CVAL_AUDIOBITRATE_56] = 0x3 << 4,
  52. [PVR2_CVAL_AUDIOBITRATE_48] = 0x2 << 4,
  53. [PVR2_CVAL_AUDIOBITRATE_32] = 0x1 << 4,
  54. [PVR2_CVAL_AUDIOBITRATE_VBR] = 0x0 << 4,
  55. };
  56. /* Firmware mailbox flags - definitions found from ivtv */
  57. #define IVTV_MBOX_FIRMWARE_DONE 0x00000004
  58. #define IVTV_MBOX_DRIVER_DONE 0x00000002
  59. #define IVTV_MBOX_DRIVER_BUSY 0x00000001
  60. static int pvr2_encoder_write_words(struct pvr2_hdw *hdw,
  61. const u32 *data, unsigned int dlen)
  62. {
  63. unsigned int idx;
  64. int ret;
  65. unsigned int offs = 0;
  66. unsigned int chunkCnt;
  67. /*
  68. Format: First byte must be 0x01. Remaining 32 bit words are
  69. spread out into chunks of 7 bytes each, little-endian ordered,
  70. offset at zero within each 2 blank bytes following and a
  71. single byte that is 0x44 plus the offset of the word. Repeat
  72. request for additional words, with offset adjusted
  73. accordingly.
  74. */
  75. while (dlen) {
  76. chunkCnt = 8;
  77. if (chunkCnt > dlen) chunkCnt = dlen;
  78. memset(hdw->cmd_buffer,0,sizeof(hdw->cmd_buffer));
  79. hdw->cmd_buffer[0] = 0x01;
  80. for (idx = 0; idx < chunkCnt; idx++) {
  81. hdw->cmd_buffer[1+(idx*7)+6] = 0x44 + idx + offs;
  82. PVR2_DECOMPOSE_LE(hdw->cmd_buffer, 1+(idx*7),
  83. data[idx]);
  84. }
  85. ret = pvr2_send_request(hdw,
  86. hdw->cmd_buffer,1+(chunkCnt*7),
  87. 0,0);
  88. if (ret) return ret;
  89. data += chunkCnt;
  90. dlen -= chunkCnt;
  91. offs += chunkCnt;
  92. }
  93. return 0;
  94. }
  95. static int pvr2_encoder_read_words(struct pvr2_hdw *hdw,int statusFl,
  96. u32 *data, unsigned int dlen)
  97. {
  98. unsigned int idx;
  99. int ret;
  100. unsigned int offs = 0;
  101. unsigned int chunkCnt;
  102. /*
  103. Format: First byte must be 0x02 (status check) or 0x28 (read
  104. back block of 32 bit words). Next 6 bytes must be zero,
  105. followed by a single byte of 0x44+offset for portion to be
  106. read. Returned data is packed set of 32 bits words that were
  107. read.
  108. */
  109. while (dlen) {
  110. chunkCnt = 16;
  111. if (chunkCnt > dlen) chunkCnt = dlen;
  112. memset(hdw->cmd_buffer,0,sizeof(hdw->cmd_buffer));
  113. hdw->cmd_buffer[0] = statusFl ? 0x02 : 0x28;
  114. hdw->cmd_buffer[7] = 0x44 + offs;
  115. ret = pvr2_send_request(hdw,
  116. hdw->cmd_buffer,8,
  117. hdw->cmd_buffer,chunkCnt * 4);
  118. if (ret) return ret;
  119. for (idx = 0; idx < chunkCnt; idx++) {
  120. data[idx] = PVR2_COMPOSE_LE(hdw->cmd_buffer,idx*4);
  121. }
  122. data += chunkCnt;
  123. dlen -= chunkCnt;
  124. offs += chunkCnt;
  125. }
  126. return 0;
  127. }
  128. /* This prototype is set up to be compatible with the
  129. cx2341x_mbox_func prototype in cx2341x.h, which should be in
  130. kernels 2.6.18 or later. We do this so that we can enable
  131. cx2341x.ko to write to our encoder (by handing it a pointer to this
  132. function). For earlier kernels this doesn't really matter. */
  133. static int pvr2_encoder_cmd(void *ctxt,
  134. int cmd,
  135. int arg_cnt_send,
  136. int arg_cnt_recv,
  137. u32 *argp)
  138. {
  139. unsigned int poll_count;
  140. int ret = 0;
  141. unsigned int idx;
  142. /* These sizes look to be limited by the FX2 firmware implementation */
  143. u32 wrData[16];
  144. u32 rdData[16];
  145. struct pvr2_hdw *hdw = (struct pvr2_hdw *)ctxt;
  146. /*
  147. The encoder seems to speak entirely using blocks 32 bit words.
  148. In ivtv driver terms, this is a mailbox which we populate with
  149. data and watch what the hardware does with it. The first word
  150. is a set of flags used to control the transaction, the second
  151. word is the command to execute, the third byte is zero (ivtv
  152. driver suggests that this is some kind of return value), and
  153. the fourth byte is a specified timeout (windows driver always
  154. uses 0x00060000 except for one case when it is zero). All
  155. successive words are the argument words for the command.
  156. First, write out the entire set of words, with the first word
  157. being zero.
  158. Next, write out just the first word again, but set it to
  159. IVTV_MBOX_DRIVER_DONE | IVTV_DRIVER_BUSY this time (which
  160. probably means "go").
  161. Next, read back 16 words as status. Check the first word,
  162. which should have IVTV_MBOX_FIRMWARE_DONE set. If however
  163. that bit is not set, then the command isn't done so repeat the
  164. read.
  165. Next, read back 32 words and compare with the original
  166. arugments. Hopefully they will match.
  167. Finally, write out just the first word again, but set it to
  168. 0x0 this time (which probably means "idle").
  169. */
  170. if (arg_cnt_send > (sizeof(wrData)/sizeof(wrData[0]))-4) {
  171. pvr2_trace(
  172. PVR2_TRACE_ERROR_LEGS,
  173. "Failed to write cx23416 command"
  174. " - too many input arguments"
  175. " (was given %u limit %u)",
  176. arg_cnt_send,
  177. (sizeof(wrData)/sizeof(wrData[0])) - 4);
  178. return -EINVAL;
  179. }
  180. if (arg_cnt_recv > (sizeof(rdData)/sizeof(rdData[0]))-4) {
  181. pvr2_trace(
  182. PVR2_TRACE_ERROR_LEGS,
  183. "Failed to write cx23416 command"
  184. " - too many return arguments"
  185. " (was given %u limit %u)",
  186. arg_cnt_recv,
  187. (sizeof(rdData)/sizeof(rdData[0])) - 4);
  188. return -EINVAL;
  189. }
  190. LOCK_TAKE(hdw->ctl_lock); do {
  191. wrData[0] = 0;
  192. wrData[1] = cmd;
  193. wrData[2] = 0;
  194. wrData[3] = 0x00060000;
  195. for (idx = 0; idx < arg_cnt_send; idx++) {
  196. wrData[idx+4] = argp[idx];
  197. }
  198. for (; idx < (sizeof(wrData)/sizeof(wrData[0]))-4; idx++) {
  199. wrData[idx+4] = 0;
  200. }
  201. ret = pvr2_encoder_write_words(hdw,wrData,idx);
  202. if (ret) break;
  203. wrData[0] = IVTV_MBOX_DRIVER_DONE|IVTV_MBOX_DRIVER_BUSY;
  204. ret = pvr2_encoder_write_words(hdw,wrData,1);
  205. if (ret) break;
  206. poll_count = 0;
  207. while (1) {
  208. if (poll_count < 10000000) poll_count++;
  209. ret = pvr2_encoder_read_words(hdw,!0,rdData,1);
  210. if (ret) break;
  211. if (rdData[0] & IVTV_MBOX_FIRMWARE_DONE) {
  212. break;
  213. }
  214. if (poll_count == 100) {
  215. pvr2_trace(
  216. PVR2_TRACE_ERROR_LEGS,
  217. "***WARNING*** device's encoder"
  218. " appears to be stuck"
  219. " (status=0%08x)",rdData[0]);
  220. pvr2_trace(
  221. PVR2_TRACE_ERROR_LEGS,
  222. "Encoder command: 0x%02x",cmd);
  223. for (idx = 4; idx < arg_cnt_send; idx++) {
  224. pvr2_trace(
  225. PVR2_TRACE_ERROR_LEGS,
  226. "Encoder arg%d: 0x%08x",
  227. idx-3,wrData[idx]);
  228. }
  229. pvr2_trace(
  230. PVR2_TRACE_ERROR_LEGS,
  231. "Giving up waiting."
  232. " It is likely that"
  233. " this is a bad idea...");
  234. ret = -EBUSY;
  235. break;
  236. }
  237. }
  238. if (ret) break;
  239. wrData[0] = 0x7;
  240. ret = pvr2_encoder_read_words(
  241. hdw,0,rdData,
  242. sizeof(rdData)/sizeof(rdData[0]));
  243. if (ret) break;
  244. for (idx = 0; idx < arg_cnt_recv; idx++) {
  245. argp[idx] = rdData[idx+4];
  246. }
  247. wrData[0] = 0x0;
  248. ret = pvr2_encoder_write_words(hdw,wrData,1);
  249. if (ret) break;
  250. } while(0); LOCK_GIVE(hdw->ctl_lock);
  251. return ret;
  252. }
  253. static int pvr2_encoder_vcmd(struct pvr2_hdw *hdw, int cmd,
  254. int args, ...)
  255. {
  256. va_list vl;
  257. unsigned int idx;
  258. u32 data[12];
  259. if (args > sizeof(data)/sizeof(data[0])) {
  260. pvr2_trace(
  261. PVR2_TRACE_ERROR_LEGS,
  262. "Failed to write cx23416 command"
  263. " - too many arguments"
  264. " (was given %u limit %u)",
  265. args,sizeof(data)/sizeof(data[0]));
  266. return -EINVAL;
  267. }
  268. va_start(vl, args);
  269. for (idx = 0; idx < args; idx++) {
  270. data[idx] = va_arg(vl, u32);
  271. }
  272. va_end(vl);
  273. return pvr2_encoder_cmd(hdw,cmd,args,0,data);
  274. }
  275. int pvr2_encoder_configure(struct pvr2_hdw *hdw)
  276. {
  277. int ret = 0, audio, i;
  278. v4l2_std_id vd_std = hdw->std_mask_cur;
  279. int height = hdw->res_ver_val;
  280. int width = hdw->res_hor_val;
  281. int height_full = !hdw->interlace_val;
  282. int is_30fps, is_ntsc;
  283. if (vd_std & V4L2_STD_NTSC) {
  284. is_ntsc=1;
  285. is_30fps=1;
  286. } else if (vd_std & V4L2_STD_PAL_M) {
  287. is_ntsc=0;
  288. is_30fps=1;
  289. } else {
  290. is_ntsc=0;
  291. is_30fps=0;
  292. }
  293. pvr2_trace(PVR2_TRACE_ENCODER,"pvr2_encoder_configure");
  294. /* set stream output port. Some notes here: The ivtv-derived
  295. encoder documentation says that this command only gets a
  296. single argument. However the Windows driver for the model
  297. 29xxx series hardware has been sending 0x01 as a second
  298. argument, while the Windows driver for the model 24xxx
  299. series hardware has been sending 0x02 as a second argument.
  300. Confusing matters further are the observations that 0x01
  301. for that second argument simply won't work on the 24xxx
  302. hardware, while 0x02 will work on the 29xxx - except that
  303. when we use 0x02 then xawtv breaks due to a loss of
  304. synchronization with the mpeg packet headers. While xawtv
  305. should be fixed to let it resync better (I did try to
  306. contact Gerd about this but he has not answered), it has
  307. also been determined that sending 0x00 as this mystery
  308. second argument seems to work on both hardware models AND
  309. xawtv works again. So we're going to send 0x00. */
  310. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_OUTPUT_PORT, 2,
  311. 0x01, 0x00);
  312. /* set the Program Index Information. We want I,P,B frames (max 400) */
  313. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_PGM_INDEX_INFO, 2,
  314. 0x07, 0x0190);
  315. /* NOTE : windows driver sends these */
  316. /* Mike Isely <isely@pobox.com> 7-Mar-2006 The windows driver
  317. sends the following commands but if we do the same then
  318. many apps are no longer able to read the video stream.
  319. Leaving these out seems to do no harm at all, so they're
  320. commented out for that reason. */
  321. #ifdef notdef
  322. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 5,0,0,0);
  323. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3,1,0,0);
  324. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 8,0,0,0);
  325. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 4,1,0,0);
  326. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0);
  327. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0);
  328. #endif
  329. /* Strange compared to ivtv data. */
  330. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2,
  331. 0xf0, 0xf0);
  332. /* setup firmware to notify us about some events (don't know why...) */
  333. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_EVENT_NOTIFICATION, 4,
  334. 0, 0, 0x10000000, 0xffffffff);
  335. /* set fps to 25 or 30 (1 or 0)*/
  336. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_RATE, 1,
  337. is_30fps ? 0 : 1);
  338. /* set encoding resolution */
  339. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_FRAME_SIZE, 2,
  340. (height_full ? height : (height / 2)),
  341. width);
  342. /* set encoding aspect ratio to 4:3 */
  343. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_ASPECT_RATIO, 1,
  344. 0x02);
  345. /* VBI */
  346. if (hdw->config == pvr2_config_vbi) {
  347. int lines = 2 * (is_30fps ? 12 : 18);
  348. int size = (4*((lines*1443+3)/4)) / lines;
  349. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_VBI_CONFIG, 7,
  350. 0xbd05, 1, 4,
  351. 0x25256262, 0x387f7f7f,
  352. lines , size);
  353. // 0x25256262, 0x13135454, lines , size);
  354. /* select vbi lines */
  355. #define line_used(l) (is_30fps ? (l >= 10 && l <= 21) : (l >= 6 && l <= 23))
  356. for (i = 2 ; i <= 24 ; i++){
  357. ret |= pvr2_encoder_vcmd(
  358. hdw,CX2341X_ENC_SET_VBI_LINE, 5,
  359. i-1,line_used(i), 0, 0, 0);
  360. ret |= pvr2_encoder_vcmd(
  361. hdw,CX2341X_ENC_SET_VBI_LINE, 5,
  362. (i-1) | (1 << 31),
  363. line_used(i), 0, 0, 0);
  364. }
  365. } else {
  366. ret |= pvr2_encoder_vcmd(
  367. hdw,CX2341X_ENC_SET_VBI_LINE, 5,
  368. 0xffffffff,0,0,0,0);
  369. }
  370. /* set stream type, depending on resolution. */
  371. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_STREAM_TYPE, 1,
  372. height_full ? 0x0a : 0x0b);
  373. /* set video bitrate */
  374. ret |= pvr2_encoder_vcmd(
  375. hdw, CX2341X_ENC_SET_BIT_RATE, 3,
  376. (hdw->vbr_val ? 1 : 0),
  377. hdw->videobitrate_val,
  378. hdw->videopeak_val / 400);
  379. /* setup GOP structure (GOP size = 0f or 0c, 3-1 = 2 B-frames) */
  380. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_GOP_PROPERTIES, 2,
  381. is_30fps ? 0x0f : 0x0c, 0x03);
  382. /* enable 3:2 pulldown */
  383. ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_3_2_PULLDOWN,1,0);
  384. /* set GOP open/close property (open) */
  385. ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_GOP_CLOSURE,1,0);
  386. /* set audio stream properties 0x40b9? 0100 0000 1011 1001 */
  387. audio = (pvr_tbl_audiobitrate[hdw->audiobitrate_val] |
  388. pvr_tbl_srate[hdw->srate_val] |
  389. hdw->audiolayer_val << 2 |
  390. (hdw->audiocrc_val ? 1 << 14 : 0) |
  391. pvr_tbl_emphasis[hdw->audioemphasis_val]);
  392. ret |= pvr2_encoder_vcmd(hdw,CX2341X_ENC_SET_AUDIO_PROPERTIES,1,
  393. audio);
  394. /* set dynamic noise reduction filter to manual, Horiz/Vert */
  395. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_MODE, 2,
  396. 0, 0x03);
  397. /* dynamic noise reduction filter param */
  398. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2
  399. , 0, 0);
  400. /* dynamic noise reduction median filter */
  401. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_SET_CORING_LEVELS, 4,
  402. 0, 0xff, 0, 0xff);
  403. /* spacial prefiler parameter */
  404. ret |= pvr2_encoder_vcmd(hdw,
  405. CX2341X_ENC_SET_SPATIAL_FILTER_TYPE, 2,
  406. 0x01, 0x01);
  407. /* initialize video input */
  408. ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_INITIALIZE_INPUT, 0);
  409. if (!ret) {
  410. hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG);
  411. }
  412. return ret;
  413. }
  414. int pvr2_encoder_start(struct pvr2_hdw *hdw)
  415. {
  416. int status;
  417. /* unmask some interrupts */
  418. pvr2_write_register(hdw, 0x0048, 0xbfffffff);
  419. /* change some GPIO data */
  420. pvr2_hdw_gpio_chg_dir(hdw,0xffffffff,0x00000481);
  421. pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000);
  422. if (hdw->config == pvr2_config_vbi) {
  423. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2,
  424. 0x01,0x14);
  425. } else if (hdw->config == pvr2_config_mpeg) {
  426. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2,
  427. 0,0x13);
  428. } else {
  429. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_START_CAPTURE,2,
  430. 0,0x13);
  431. }
  432. if (!status) {
  433. hdw->subsys_enabled_mask |= (1<<PVR2_SUBSYS_B_ENC_RUN);
  434. }
  435. return status;
  436. }
  437. int pvr2_encoder_stop(struct pvr2_hdw *hdw)
  438. {
  439. int status;
  440. /* mask all interrupts */
  441. pvr2_write_register(hdw, 0x0048, 0xffffffff);
  442. if (hdw->config == pvr2_config_vbi) {
  443. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3,
  444. 0x01,0x01,0x14);
  445. } else if (hdw->config == pvr2_config_mpeg) {
  446. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3,
  447. 0x01,0,0x13);
  448. } else {
  449. status = pvr2_encoder_vcmd(hdw,CX2341X_ENC_STOP_CAPTURE,3,
  450. 0x01,0,0x13);
  451. }
  452. /* change some GPIO data */
  453. /* Note: Bit d7 of dir appears to control the LED. So we shut it
  454. off here. */
  455. pvr2_hdw_gpio_chg_dir(hdw,0xffffffff,0x00000401);
  456. pvr2_hdw_gpio_chg_out(hdw,0xffffffff,0x00000000);
  457. if (!status) {
  458. hdw->subsys_enabled_mask &= ~(1<<PVR2_SUBSYS_B_ENC_RUN);
  459. }
  460. return status;
  461. }
  462. /*
  463. Stuff for Emacs to see, in order to encourage consistent editing style:
  464. *** Local Variables: ***
  465. *** mode: c ***
  466. *** fill-column: 70 ***
  467. *** tab-width: 8 ***
  468. *** c-basic-offset: 8 ***
  469. *** End: ***
  470. */