cx231xx-pcb-cfg.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /*
  2. cx231xx-pcb-config.c - driver for Conexant
  3. Cx23100/101/102 USB video capture devices
  4. Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #include "cx231xx.h"
  18. #include "cx231xx-conf-reg.h"
  19. static unsigned int pcb_debug;
  20. module_param(pcb_debug, int, 0644);
  21. MODULE_PARM_DESC(pcb_debug, "enable pcb config debug messages [video]");
  22. /******************************************************************************/
  23. static struct pcb_config cx231xx_Scenario[] = {
  24. {
  25. INDEX_SELFPOWER_DIGITAL_ONLY, /* index */
  26. USB_SELF_POWER, /* power_type */
  27. 0, /* speed , not decide yet */
  28. MOD_DIGITAL, /* mode */
  29. SOURCE_TS_BDA, /* ts1_source, digital tv only */
  30. NOT_SUPPORTED, /* ts2_source */
  31. NOT_SUPPORTED, /* analog source */
  32. 0, /* digital_index */
  33. 0, /* analog index */
  34. 0, /* dif_index */
  35. 0, /* external_index */
  36. 1, /* only one configuration */
  37. {
  38. {
  39. 0, /* config index */
  40. {
  41. 0, /* interrupt ep index */
  42. 1, /* ts1 index */
  43. NOT_SUPPORTED, /* TS2 index */
  44. NOT_SUPPORTED, /* AUDIO */
  45. NOT_SUPPORTED, /* VIDEO */
  46. NOT_SUPPORTED, /* VANC */
  47. NOT_SUPPORTED, /* HANC */
  48. NOT_SUPPORTED /* ir_index */
  49. }
  50. ,
  51. }
  52. ,
  53. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  54. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  55. NOT_SUPPORTED}
  56. }
  57. ,
  58. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  59. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  60. NOT_SUPPORTED}
  61. }
  62. }
  63. ,
  64. /* full-speed config */
  65. {
  66. {
  67. 0, /* config index */
  68. {
  69. 0, /* interrupt ep index */
  70. 1, /* ts1 index */
  71. NOT_SUPPORTED, /* TS2 index */
  72. NOT_SUPPORTED, /* AUDIO */
  73. NOT_SUPPORTED, /* VIDEO */
  74. NOT_SUPPORTED, /* VANC */
  75. NOT_SUPPORTED, /* HANC */
  76. NOT_SUPPORTED /* ir_index */
  77. }
  78. }
  79. ,
  80. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  81. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  82. NOT_SUPPORTED}
  83. }
  84. ,
  85. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  86. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  87. NOT_SUPPORTED}
  88. }
  89. }
  90. }
  91. ,
  92. {
  93. INDEX_SELFPOWER_DUAL_DIGITAL, /* index */
  94. USB_SELF_POWER, /* power_type */
  95. 0, /* speed , not decide yet */
  96. MOD_DIGITAL, /* mode */
  97. SOURCE_TS_BDA, /* ts1_source, digital tv only */
  98. 0, /* ts2_source,need update from register */
  99. NOT_SUPPORTED, /* analog source */
  100. 0, /* digital_index */
  101. 0, /* analog index */
  102. 0, /* dif_index */
  103. 0, /* external_index */
  104. 1, /* only one configuration */
  105. {
  106. {
  107. 0, /* config index */
  108. {
  109. 0, /* interrupt ep index */
  110. 1, /* ts1 index */
  111. 2, /* TS2 index */
  112. NOT_SUPPORTED, /* AUDIO */
  113. NOT_SUPPORTED, /* VIDEO */
  114. NOT_SUPPORTED, /* VANC */
  115. NOT_SUPPORTED, /* HANC */
  116. NOT_SUPPORTED /* ir_index */
  117. }
  118. }
  119. ,
  120. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  121. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  122. NOT_SUPPORTED}
  123. }
  124. ,
  125. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  126. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  127. NOT_SUPPORTED}
  128. }
  129. }
  130. ,
  131. /* full-speed */
  132. {
  133. {
  134. 0, /* config index */
  135. {
  136. 0, /* interrupt ep index */
  137. 1, /* ts1 index */
  138. 2, /* TS2 index */
  139. NOT_SUPPORTED, /* AUDIO */
  140. NOT_SUPPORTED, /* VIDEO */
  141. NOT_SUPPORTED, /* VANC */
  142. NOT_SUPPORTED, /* HANC */
  143. NOT_SUPPORTED /* ir_index */
  144. }
  145. }
  146. ,
  147. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  148. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  149. NOT_SUPPORTED}
  150. }
  151. ,
  152. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  153. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  154. NOT_SUPPORTED}
  155. }
  156. }
  157. }
  158. ,
  159. {
  160. INDEX_SELFPOWER_ANALOG_ONLY, /* index */
  161. USB_SELF_POWER, /* power_type */
  162. 0, /* speed , not decide yet */
  163. MOD_ANALOG | MOD_DIF | MOD_EXTERNAL, /* mode ,analog tv only */
  164. NOT_SUPPORTED, /* ts1_source, NOT SUPPORT */
  165. NOT_SUPPORTED, /* ts2_source,NOT SUPPORT */
  166. 0, /* analog source, need update */
  167. 0, /* digital_index */
  168. 0, /* analog index */
  169. 0, /* dif_index */
  170. 0, /* external_index */
  171. 1, /* only one configuration */
  172. {
  173. {
  174. 0, /* config index */
  175. {
  176. 0, /* interrupt ep index */
  177. NOT_SUPPORTED, /* ts1 index */
  178. NOT_SUPPORTED, /* TS2 index */
  179. 1, /* AUDIO */
  180. 2, /* VIDEO */
  181. 3, /* VANC */
  182. 4, /* HANC */
  183. NOT_SUPPORTED /* ir_index */
  184. }
  185. }
  186. ,
  187. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  188. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  189. NOT_SUPPORTED}
  190. }
  191. ,
  192. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  193. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  194. NOT_SUPPORTED}
  195. }
  196. }
  197. ,
  198. /* full-speed */
  199. {
  200. {
  201. 0, /* config index */
  202. {
  203. 0, /* interrupt ep index */
  204. NOT_SUPPORTED, /* ts1 index */
  205. NOT_SUPPORTED, /* TS2 index */
  206. 1, /* AUDIO */
  207. 2, /* VIDEO */
  208. NOT_SUPPORTED, /* VANC */
  209. NOT_SUPPORTED, /* HANC */
  210. NOT_SUPPORTED /* ir_index */
  211. }
  212. }
  213. ,
  214. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  215. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  216. NOT_SUPPORTED}
  217. }
  218. ,
  219. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  220. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  221. NOT_SUPPORTED}
  222. }
  223. }
  224. }
  225. ,
  226. {
  227. INDEX_SELFPOWER_DUAL, /* index */
  228. USB_SELF_POWER, /* power_type */
  229. 0, /* speed , not decide yet */
  230. /* mode ,analog tv and digital path */
  231. MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
  232. 0, /* ts1_source,will update in register */
  233. NOT_SUPPORTED, /* ts2_source,NOT SUPPORT */
  234. 0, /* analog source need update */
  235. 0, /* digital_index */
  236. 0, /* analog index */
  237. 0, /* dif_index */
  238. 0, /* external_index */
  239. 1, /* only one configuration */
  240. {
  241. {
  242. 0, /* config index */
  243. {
  244. 0, /* interrupt ep index */
  245. 1, /* ts1 index */
  246. NOT_SUPPORTED, /* TS2 index */
  247. 2, /* AUDIO */
  248. 3, /* VIDEO */
  249. 4, /* VANC */
  250. 5, /* HANC */
  251. NOT_SUPPORTED /* ir_index */
  252. }
  253. }
  254. ,
  255. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  256. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  257. NOT_SUPPORTED}
  258. }
  259. ,
  260. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  261. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  262. NOT_SUPPORTED}
  263. }
  264. }
  265. ,
  266. /* full-speed */
  267. {
  268. {
  269. 0, /* config index */
  270. {
  271. 0, /* interrupt ep index */
  272. 1, /* ts1 index */
  273. NOT_SUPPORTED, /* TS2 index */
  274. 2, /* AUDIO */
  275. 3, /* VIDEO */
  276. NOT_SUPPORTED, /* VANC */
  277. NOT_SUPPORTED, /* HANC */
  278. NOT_SUPPORTED /* ir_index */
  279. }
  280. }
  281. ,
  282. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  283. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  284. NOT_SUPPORTED}
  285. }
  286. ,
  287. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  288. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  289. NOT_SUPPORTED}
  290. }
  291. }
  292. }
  293. ,
  294. {
  295. INDEX_SELFPOWER_TRIPLE, /* index */
  296. USB_SELF_POWER, /* power_type */
  297. 0, /* speed , not decide yet */
  298. /* mode ,analog tv and digital path */
  299. MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
  300. 0, /* ts1_source, update in register */
  301. 0, /* ts2_source,update in register */
  302. 0, /* analog source, need update */
  303. 0, /* digital_index */
  304. 0, /* analog index */
  305. 0, /* dif_index */
  306. 0, /* external_index */
  307. 1, /* only one configuration */
  308. {
  309. {
  310. 0, /* config index */
  311. {
  312. 0, /* interrupt ep index */
  313. 1, /* ts1 index */
  314. 2, /* TS2 index */
  315. 3, /* AUDIO */
  316. 4, /* VIDEO */
  317. 5, /* VANC */
  318. 6, /* HANC */
  319. NOT_SUPPORTED /* ir_index */
  320. }
  321. }
  322. ,
  323. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  324. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  325. NOT_SUPPORTED}
  326. }
  327. ,
  328. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  329. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  330. NOT_SUPPORTED}
  331. }
  332. }
  333. ,
  334. /* full-speed */
  335. {
  336. {
  337. 0, /* config index */
  338. {
  339. 0, /* interrupt ep index */
  340. 1, /* ts1 index */
  341. 2, /* TS2 index */
  342. 3, /* AUDIO */
  343. 4, /* VIDEO */
  344. NOT_SUPPORTED, /* VANC */
  345. NOT_SUPPORTED, /* HANC */
  346. NOT_SUPPORTED /* ir_index */
  347. }
  348. }
  349. ,
  350. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  351. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  352. NOT_SUPPORTED}
  353. }
  354. ,
  355. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  356. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  357. NOT_SUPPORTED}
  358. }
  359. }
  360. }
  361. ,
  362. {
  363. INDEX_SELFPOWER_COMPRESSOR, /* index */
  364. USB_SELF_POWER, /* power_type */
  365. 0, /* speed , not decide yet */
  366. /* mode ,analog tv AND DIGITAL path */
  367. MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
  368. NOT_SUPPORTED, /* ts1_source, disable */
  369. SOURCE_TS_BDA, /* ts2_source */
  370. 0, /* analog source,need update */
  371. 0, /* digital_index */
  372. 0, /* analog index */
  373. 0, /* dif_index */
  374. 0, /* external_index */
  375. 1, /* only one configuration */
  376. {
  377. {
  378. 0, /* config index */
  379. {
  380. 0, /* interrupt ep index */
  381. NOT_SUPPORTED, /* ts1 index */
  382. 1, /* TS2 index */
  383. 2, /* AUDIO */
  384. 3, /* VIDEO */
  385. 4, /* VANC */
  386. 5, /* HANC */
  387. NOT_SUPPORTED /* ir_index */
  388. }
  389. }
  390. ,
  391. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  392. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  393. NOT_SUPPORTED}
  394. }
  395. ,
  396. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  397. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  398. NOT_SUPPORTED}
  399. }
  400. }
  401. ,
  402. /* full-speed */
  403. {
  404. {
  405. 0, /* config index */
  406. {
  407. 0, /* interrupt ep index */
  408. NOT_SUPPORTED, /* ts1 index */
  409. 1, /* TS2 index */
  410. 2, /* AUDIO */
  411. 3, /* VIDEO */
  412. NOT_SUPPORTED, /* VANC */
  413. NOT_SUPPORTED, /* HANC */
  414. NOT_SUPPORTED /* ir_index */
  415. }
  416. }
  417. ,
  418. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  419. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  420. NOT_SUPPORTED}
  421. }
  422. ,
  423. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  424. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  425. NOT_SUPPORTED}
  426. }
  427. }
  428. }
  429. ,
  430. {
  431. INDEX_BUSPOWER_DIGITAL_ONLY, /* index */
  432. USB_BUS_POWER, /* power_type */
  433. 0, /* speed , not decide yet */
  434. MOD_DIGITAL, /* mode ,analog tv AND DIGITAL path */
  435. SOURCE_TS_BDA, /* ts1_source, disable */
  436. NOT_SUPPORTED, /* ts2_source */
  437. NOT_SUPPORTED, /* analog source */
  438. 0, /* digital_index */
  439. 0, /* analog index */
  440. 0, /* dif_index */
  441. 0, /* external_index */
  442. 1, /* only one configuration */
  443. {
  444. {
  445. 0, /* config index */
  446. {
  447. 0, /* interrupt ep index = 2 */
  448. 1, /* ts1 index */
  449. NOT_SUPPORTED, /* TS2 index */
  450. NOT_SUPPORTED, /* AUDIO */
  451. NOT_SUPPORTED, /* VIDEO */
  452. NOT_SUPPORTED, /* VANC */
  453. NOT_SUPPORTED, /* HANC */
  454. NOT_SUPPORTED /* ir_index */
  455. }
  456. }
  457. ,
  458. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  459. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  460. NOT_SUPPORTED}
  461. }
  462. ,
  463. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  464. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  465. NOT_SUPPORTED}
  466. }
  467. }
  468. ,
  469. /* full-speed */
  470. {
  471. {
  472. 0, /* config index */
  473. {
  474. 0, /* interrupt ep index = 2 */
  475. 1, /* ts1 index */
  476. NOT_SUPPORTED, /* TS2 index */
  477. NOT_SUPPORTED, /* AUDIO */
  478. NOT_SUPPORTED, /* VIDEO */
  479. NOT_SUPPORTED, /* VANC */
  480. NOT_SUPPORTED, /* HANC */
  481. NOT_SUPPORTED /* ir_index */
  482. }
  483. }
  484. ,
  485. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  486. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  487. NOT_SUPPORTED}
  488. }
  489. ,
  490. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  491. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  492. NOT_SUPPORTED}
  493. }
  494. }
  495. }
  496. ,
  497. {
  498. INDEX_BUSPOWER_ANALOG_ONLY, /* index */
  499. USB_BUS_POWER, /* power_type */
  500. 0, /* speed , not decide yet */
  501. MOD_ANALOG, /* mode ,analog tv AND DIGITAL path */
  502. NOT_SUPPORTED, /* ts1_source, disable */
  503. NOT_SUPPORTED, /* ts2_source */
  504. SOURCE_ANALOG, /* analog source--analog */
  505. 0, /* digital_index */
  506. 0, /* analog index */
  507. 0, /* dif_index */
  508. 0, /* external_index */
  509. 1, /* only one configuration */
  510. {
  511. {
  512. 0, /* config index */
  513. {
  514. 0, /* interrupt ep index */
  515. NOT_SUPPORTED, /* ts1 index */
  516. NOT_SUPPORTED, /* TS2 index */
  517. 1, /* AUDIO */
  518. 2, /* VIDEO */
  519. 3, /* VANC */
  520. 4, /* HANC */
  521. NOT_SUPPORTED /* ir_index */
  522. }
  523. }
  524. ,
  525. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  526. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  527. NOT_SUPPORTED}
  528. }
  529. ,
  530. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  531. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  532. NOT_SUPPORTED}
  533. }
  534. }
  535. ,
  536. { /* full-speed */
  537. {
  538. 0, /* config index */
  539. {
  540. 0, /* interrupt ep index */
  541. NOT_SUPPORTED, /* ts1 index */
  542. NOT_SUPPORTED, /* TS2 index */
  543. 1, /* AUDIO */
  544. 2, /* VIDEO */
  545. NOT_SUPPORTED, /* VANC */
  546. NOT_SUPPORTED, /* HANC */
  547. NOT_SUPPORTED /* ir_index */
  548. }
  549. }
  550. ,
  551. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  552. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  553. NOT_SUPPORTED}
  554. }
  555. ,
  556. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  557. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  558. NOT_SUPPORTED}
  559. }
  560. }
  561. }
  562. ,
  563. {
  564. INDEX_BUSPOWER_DIF_ONLY, /* index */
  565. USB_BUS_POWER, /* power_type */
  566. 0, /* speed , not decide yet */
  567. /* mode ,analog tv AND DIGITAL path */
  568. MOD_DIF | MOD_ANALOG | MOD_DIGITAL | MOD_EXTERNAL,
  569. SOURCE_TS_BDA, /* ts1_source, disable */
  570. NOT_SUPPORTED, /* ts2_source */
  571. SOURCE_DIF | SOURCE_ANALOG | SOURCE_EXTERNAL, /* analog source, dif */
  572. 0, /* digital_index */
  573. 0, /* analog index */
  574. 0, /* dif_index */
  575. 0, /* external_index */
  576. 1, /* only one configuration */
  577. {
  578. {
  579. 0, /* config index */
  580. {
  581. 0, /* interrupt ep index */
  582. 1, /* ts1 index */
  583. NOT_SUPPORTED, /* TS2 index */
  584. 2, /* AUDIO */
  585. 3, /* VIDEO */
  586. 4, /* VANC */
  587. 5, /* HANC */
  588. NOT_SUPPORTED /* ir_index */
  589. }
  590. }
  591. ,
  592. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  593. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  594. NOT_SUPPORTED}
  595. }
  596. ,
  597. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  598. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  599. NOT_SUPPORTED}
  600. }
  601. }
  602. ,
  603. { /* full speed */
  604. {
  605. 0, /* config index */
  606. {
  607. 0, /* interrupt ep index */
  608. 1, /* ts1 index */
  609. NOT_SUPPORTED, /* TS2 index */
  610. 2, /* AUDIO */
  611. 3, /* VIDEO */
  612. NOT_SUPPORTED, /* VANC */
  613. NOT_SUPPORTED, /* HANC */
  614. NOT_SUPPORTED /* ir_index */
  615. }
  616. }
  617. ,
  618. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  619. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  620. NOT_SUPPORTED}
  621. }
  622. ,
  623. {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  624. NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
  625. NOT_SUPPORTED}
  626. }
  627. }
  628. }
  629. ,
  630. };
  631. /*****************************************************************/
  632. int initialize_cx231xx(struct cx231xx *dev)
  633. {
  634. int retval;
  635. u32 config_info = 0;
  636. struct pcb_config *p_pcb_info;
  637. u8 usb_speed = 1; /* from register,1--HS, 0--FS */
  638. u8 data[4] = { 0, 0, 0, 0 };
  639. u32 ts1_source = 0;
  640. u32 ts2_source = 0;
  641. u32 analog_source = 0;
  642. u8 _current_scenario_idx = 0xff;
  643. ts1_source = SOURCE_TS_BDA;
  644. ts2_source = SOURCE_TS_BDA;
  645. /* read board config register to find out which
  646. pcb config it is related to */
  647. retval = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT,
  648. data, 4);
  649. if (retval < 0)
  650. return retval;
  651. config_info = le32_to_cpu(*((__le32 *)data));
  652. usb_speed = (u8) (config_info & 0x1);
  653. /* Verify this device belongs to Bus power or Self power device */
  654. if (config_info & BUS_POWER) { /* bus-power */
  655. switch (config_info & BUSPOWER_MASK) {
  656. case TS1_PORT | BUS_POWER:
  657. cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY].speed =
  658. usb_speed;
  659. p_pcb_info =
  660. &cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY];
  661. _current_scenario_idx = INDEX_BUSPOWER_DIGITAL_ONLY;
  662. break;
  663. case AVDEC_ENABLE | BUS_POWER:
  664. cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY].speed =
  665. usb_speed;
  666. p_pcb_info =
  667. &cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY];
  668. _current_scenario_idx = INDEX_BUSPOWER_ANALOG_ONLY;
  669. break;
  670. case AVDEC_ENABLE | BUS_POWER | TS1_PORT:
  671. cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY].speed =
  672. usb_speed;
  673. p_pcb_info = &cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY];
  674. _current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
  675. break;
  676. default:
  677. dev_err(dev->dev,
  678. "bad config in buspower!!!!\nconfig_info=%x\n",
  679. config_info & BUSPOWER_MASK);
  680. return 1;
  681. }
  682. } else { /* self-power */
  683. switch (config_info & SELFPOWER_MASK) {
  684. case TS1_PORT | SELF_POWER:
  685. cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY].speed =
  686. usb_speed;
  687. p_pcb_info =
  688. &cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY];
  689. _current_scenario_idx = INDEX_SELFPOWER_DIGITAL_ONLY;
  690. break;
  691. case TS1_TS2_PORT | SELF_POWER:
  692. cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].speed =
  693. usb_speed;
  694. cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].
  695. ts2_source = ts2_source;
  696. p_pcb_info =
  697. &cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL];
  698. _current_scenario_idx = INDEX_SELFPOWER_DUAL_DIGITAL;
  699. break;
  700. case AVDEC_ENABLE | SELF_POWER:
  701. cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].speed =
  702. usb_speed;
  703. cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].
  704. analog_source = analog_source;
  705. p_pcb_info =
  706. &cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY];
  707. _current_scenario_idx = INDEX_SELFPOWER_ANALOG_ONLY;
  708. break;
  709. case AVDEC_ENABLE | TS1_PORT | SELF_POWER:
  710. cx231xx_Scenario[INDEX_SELFPOWER_DUAL].speed =
  711. usb_speed;
  712. cx231xx_Scenario[INDEX_SELFPOWER_DUAL].ts1_source =
  713. ts1_source;
  714. cx231xx_Scenario[INDEX_SELFPOWER_DUAL].analog_source =
  715. analog_source;
  716. p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_DUAL];
  717. _current_scenario_idx = INDEX_SELFPOWER_DUAL;
  718. break;
  719. case AVDEC_ENABLE | TS1_TS2_PORT | SELF_POWER:
  720. cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].speed =
  721. usb_speed;
  722. cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts1_source =
  723. ts1_source;
  724. cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts2_source =
  725. ts2_source;
  726. cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].analog_source =
  727. analog_source;
  728. p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE];
  729. _current_scenario_idx = INDEX_SELFPOWER_TRIPLE;
  730. break;
  731. case AVDEC_ENABLE | TS1VIP_TS2_PORT | SELF_POWER:
  732. cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].speed =
  733. usb_speed;
  734. cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].
  735. analog_source = analog_source;
  736. p_pcb_info =
  737. &cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR];
  738. _current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
  739. break;
  740. default:
  741. dev_err(dev->dev,
  742. "bad scenario!!!!!\nconfig_info=%x\n",
  743. config_info & SELFPOWER_MASK);
  744. return -ENODEV;
  745. }
  746. }
  747. dev->current_scenario_idx = _current_scenario_idx;
  748. memcpy(&dev->current_pcb_config, p_pcb_info,
  749. sizeof(struct pcb_config));
  750. if (pcb_debug) {
  751. dev_info(dev->dev,
  752. "SC(0x00) register = 0x%x\n", config_info);
  753. dev_info(dev->dev,
  754. "scenario %d\n",
  755. (dev->current_pcb_config.index) + 1);
  756. dev_info(dev->dev,
  757. "type=%x\n",
  758. dev->current_pcb_config.type);
  759. dev_info(dev->dev,
  760. "mode=%x\n",
  761. dev->current_pcb_config.mode);
  762. dev_info(dev->dev,
  763. "speed=%x\n",
  764. dev->current_pcb_config.speed);
  765. dev_info(dev->dev,
  766. "ts1_source=%x\n",
  767. dev->current_pcb_config.ts1_source);
  768. dev_info(dev->dev,
  769. "ts2_source=%x\n",
  770. dev->current_pcb_config.ts2_source);
  771. dev_info(dev->dev,
  772. "analog_source=%x\n",
  773. dev->current_pcb_config.analog_source);
  774. }
  775. return 0;
  776. }