123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031 |
- /******************************Includes************************************/
- #include <linux/errno.h>
- #include <mach/am_regs.h>
- #include "tvin_global.h"
- #include "tvafe.h"
- #include "tvafe_regs.h"
- #include "tvafe_adc.h"
- #include "tvafe_cvd.h"
- #include "tvafe_general.h"
- /***************************Global Variables**********************************/
- enum tvafe_adc_pin_e tvafe_default_cvbs_out;
- enum tvafe_state_e tvafe_state;
- unsigned int tvafe_state_counter; // used in TVAFE_STATE_NOSIG & TVAFE_STATE_UNSTABLE
- unsigned int tvafe_exit_nosig_counter; // used in TVAFE_STATE_NOSIG
- unsigned int tvafe_back_nosig_counter; // used in TVAFE_STATE_UNSTABLE
- unsigned int tvafe_exit_stable_counter; // used in TVAFE_STATE_STABLE
- unsigned int tvafe_back_stable_counter; // used in TVAFE_STATE_UNSTABLE
- // *****************************************************************************
- // Function:
- //
- // Params:
- //
- // Return:
- //
- // *****************************************************************************
- enum tvafe_adc_pin_e tvafe_get_free_pga_pin(struct tvafe_pin_mux_s *pinmux)
- {
- unsigned int i = 0;
- unsigned int flag = 0;
- enum tvafe_adc_pin_e ret = TVAFE_ADC_PIN_NULL;
- for (i=0; i<TVAFE_SRC_SIG_MAX_NUM; i++)
- {
- if (pinmux->pin[i] == TVAFE_ADC_PIN_A_PGA_0)
- flag |= 0x00000001;
- if (pinmux->pin[i] == TVAFE_ADC_PIN_A_PGA_1)
- flag |= 0x00000002;
- if (pinmux->pin[i] == TVAFE_ADC_PIN_A_PGA_2)
- flag |= 0x00000004;
- if (pinmux->pin[i] == TVAFE_ADC_PIN_A_PGA_3)
- flag |= 0x00000008;
- }
- if (!(flag&0x00000001))
- {
- ret = TVAFE_ADC_PIN_A_PGA_0;
- }
- else if (!(flag&0x00000002))
- {
- ret = TVAFE_ADC_PIN_A_PGA_1;
- }
- else if (!(flag&0x00000004))
- {
- ret = TVAFE_ADC_PIN_A_PGA_2;
- }
- else if (!(flag&0x00000008))
- {
- ret = TVAFE_ADC_PIN_A_PGA_3;
- }
- else // In the worst case, CVBS_OUT links to TV
- {
- ret = pinmux->pin[CVBS0_Y];
- }
- return ret;
- }
- #include <linux/kernel.h>
- static inline enum tvafe_adc_ch_e tvafe_pin_adc_muxing(enum tvafe_adc_pin_e pin)
- {
- enum tvafe_adc_ch_e ret = TVAFE_ADC_CH_NULL;
- if ((pin >= TVAFE_ADC_PIN_A_PGA_0) && (pin <= TVAFE_ADC_PIN_A_PGA_3))
- {
- WRITE_APB_REG_BITS(ADC_REG_06, 1, ENPGA_BIT, ENPGA_WID);
- WRITE_APB_REG_BITS(ADC_REG_17, pin-TVAFE_ADC_PIN_A_PGA_0, INMUXA_BIT, INMUXA_WID);
- ret = TVAFE_ADC_CH_PGA;
- }
- else if ((pin >= TVAFE_ADC_PIN_A_0) && (pin <= TVAFE_ADC_PIN_A_3))
- {
- WRITE_APB_REG_BITS(ADC_REG_06, 0, ENPGA_BIT, ENPGA_WID);
- WRITE_APB_REG_BITS(ADC_REG_17, pin-TVAFE_ADC_PIN_A_0, INMUXA_BIT, INMUXA_WID);
- ret = TVAFE_ADC_CH_A;
- }
- else if ((pin >= TVAFE_ADC_PIN_B_0) && (pin <= TVAFE_ADC_PIN_B_4))
- {
- WRITE_APB_REG_BITS(ADC_REG_17, pin-TVAFE_ADC_PIN_B_0, INMUXB_BIT, INMUXB_WID);
- ret = TVAFE_ADC_CH_B;
- }
- else if ((pin >= TVAFE_ADC_PIN_C_0) && (pin <= TVAFE_ADC_PIN_C_4))
- {
- WRITE_APB_REG_BITS(ADC_REG_18, pin-TVAFE_ADC_PIN_C_0, INMUXC_BIT, INMUXC_WID);
- ret = TVAFE_ADC_CH_C;
- }
- return ret;
- }
- /*
- 000: abc
- 001: acb
- 010: bac
- 011: bca
- 100: cab
- 101: cba
- */
- static inline int tvafe_adc_top_muxing(enum tvafe_adc_ch_e gy,
- enum tvafe_adc_ch_e bpb,
- enum tvafe_adc_ch_e rpr,
- unsigned int s_video_flag)
- {
- int ret = 0;
- switch (gy)
- {
- case TVAFE_ADC_CH_PGA:
- case TVAFE_ADC_CH_A:
- switch (bpb)
- {
- case TVAFE_ADC_CH_B:
- // abc => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_C))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVAFE_ADC_CH_C:
- // acb => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_B))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- default:
- ret = -EFAULT;
- break;
- }
- break;
- case TVAFE_ADC_CH_B:
- switch (bpb)
- {
- case TVAFE_ADC_CH_PGA:
- case TVAFE_ADC_CH_A:
- // bac => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_C))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 2, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVAFE_ADC_CH_C:
- // bca => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_PGA)
- || (rpr == TVAFE_ADC_CH_A))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 3, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- default:
- ret = -EFAULT;
- break;
- }
- break;
- case TVAFE_ADC_CH_C:
- switch (bpb)
- {
- case TVAFE_ADC_CH_PGA:
- case TVAFE_ADC_CH_A:
- // cab => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_B))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 4, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVAFE_ADC_CH_B:
- // cba => abc
- if (s_video_flag || (rpr == TVAFE_ADC_CH_PGA)
- || (rpr == TVAFE_ADC_CH_A))
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 5, SWT_GY_BCB_RCR_IN_BIT,
- SWT_GY_BCB_RCR_IN_WID);
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- default:
- ret = -EFAULT;
- break;
- }
- break;
- default:
- ret = -EFAULT;
- break;
- }
- return ret;
- }
- int tvafe_source_muxing(struct tvafe_info_s *info)
- {
- int ret = 0;
- switch (info->param.port)
- {
- case TVIN_PORT_CVBS0:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS0_Y]) == TVAFE_ADC_CH_PGA)
- {
- if (info->pinmux->pin[CVBS0_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS0_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS1:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS1_Y]) == TVAFE_ADC_CH_PGA)
- {
- if (info->pinmux->pin[CVBS1_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS1_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS2:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS2_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS2_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS2_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS2_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS3:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS3_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS3_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS3_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS3_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS4:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS4_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS4_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS4_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS5_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS5:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS5_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS5_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS5_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS5_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS6:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS6_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS6_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS6_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS6_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_CVBS7:
- if (tvafe_pin_adc_muxing(info->pinmux->pin[CVBS7_Y]) == TVAFE_ADC_CH_PGA)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, info->pinmux->pin[CVBS7_Y]-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[CVBS7_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[CVBS7_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_CVBS;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO0:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO0_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO0_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO0_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO0_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO1:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO1_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO1_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO1_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO1_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO2:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO2_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO2_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO2_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO2_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO3:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO3_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO3_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO3_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO3_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO4:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO4_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO4_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO4_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO4_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO5:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO5_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO5_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO5_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO5_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO6:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO6_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO6_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO6_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO6_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_SVIDEO7:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO7_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[S_VIDEO7_C]), TVAFE_ADC_CH_NULL, 1) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[S_VIDEO7_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[S_VIDEO7_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_SVIDEO;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA0:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA0_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA0_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA0_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA0_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA0_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- WRITE_APB_REG_BITS(ADC_REG_39, 0, INSYNCMUXCTRL_BIT, INSYNCMUXCTRL_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA1:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA1_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA1_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA1_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA1_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA1_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- WRITE_APB_REG_BITS(ADC_REG_39, 1, INSYNCMUXCTRL_BIT, INSYNCMUXCTRL_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA2:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA2_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA2_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA2_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA2_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA2_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA3:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA3_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA3_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA3_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA3_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA3_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA4:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA4_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA4_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA4_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA4_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA4_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA5:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA5_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA5_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA5_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA5_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA5_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA6:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA6_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA6_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA6_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA6_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA6_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_VGA7:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[VGA7_G]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA7_B]), tvafe_pin_adc_muxing(info->pinmux->pin[VGA7_R]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[VGA7_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[VGA7_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_VGA;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP0:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP0_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP0_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP0_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP0_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP0_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP1:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP1_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP1_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP1_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP1_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP1_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP2:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP2_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP2_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP2_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP2_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP2_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP3:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP3_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP3_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP3_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP3_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP3_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP4:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP4_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP4_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP4_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP4_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP4_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP5:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP5_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP5_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP5_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP5_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP5_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP6:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP6_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP6_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP6_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP6_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP6_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- case TVIN_PORT_COMP7:
- if (tvafe_adc_top_muxing(tvafe_pin_adc_muxing(info->pinmux->pin[COMP7_Y]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP7_PB]), tvafe_pin_adc_muxing(info->pinmux->pin[COMP7_PR]), 0) == 0)
- {
- WRITE_APB_REG_BITS(ADC_REG_20, tvafe_default_cvbs_out-TVAFE_ADC_PIN_A_PGA_0, INMUXBUF_BIT, INMUXBUF_WID);
- if (info->pinmux->pin[COMP7_SOG] >= TVAFE_ADC_PIN_SOG_0)
- WRITE_APB_REG_BITS(ADC_REG_24, (info->pinmux->pin[COMP7_SOG] - TVAFE_ADC_PIN_SOG_0), INMUXSOG_BIT, INMUXSOG_WID);
- info->src_type = TVAFE_SRC_TYPE_COMP;
- }
- else
- {
- ret = -EFAULT;
- }
- break;
- default:
- ret = -EFAULT;
- break;
- }
- if (!ret)
- info->sig_status_cnt = 0;
- return ret;
- }
- void tvafe_vga_set_edid(struct tvafe_vga_edid_s *edid)
- {
- unsigned int i = 0;
- // diable TCON
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_7, 0, 1, 1);
- // diable DVIN
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 0, 27, 1);
- // DDC_SDA0
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 1, 13, 1);
- // DDC_SCL0
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 1, 12, 1);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, EDID_CLK_EN_BIT,EDID_CLK_EN_WID); // VGA_CLK_EN
- // APB Bus accessing mode
- WRITE_APB_REG(TVFE_EDID_CONFIG, 0x00000000);
- WRITE_APB_REG(TVFE_EDID_RAM_ADDR, 0x00000000);
- for (i=0; i<256; i++)
- WRITE_APB_REG(TVFE_EDID_RAM_WDATA, (unsigned int)edid->value[i]);
- // Slave IIC acessing mode, 8-bit standard IIC protocol
- WRITE_APB_REG(TVFE_EDID_CONFIG, 0x01800050);
- }
- void tvafe_vga_get_edid(struct tvafe_vga_edid_s *edid)
- {
- unsigned int i = 0;
- // diable TCON
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_7, 0, 1, 1);
- // diable DVIN
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 0, 27, 1);
- // DDC_SDA0
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 1, 13, 1);
- // DDC_SCL0
- WRITE_CBUS_REG_BITS(PERIPHS_PIN_MUX_6, 1, 12, 1);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, EDID_CLK_EN_BIT,EDID_CLK_EN_WID); // VGA_CLK_EN
- // APB Bus accessing mode
- WRITE_APB_REG(TVFE_EDID_CONFIG, 0x00000000);
- WRITE_APB_REG(TVFE_EDID_RAM_ADDR, 0x00000100);
- for (i=0; i<256; i++)
- edid->value[i] = (unsigned char)(READ_APB_REG_BITS(TVFE_EDID_RAM_RDATA, EDID_RAM_RDATA_BIT, EDID_RAM_RDATA_WID));
- // Slave IIC acessing mode, 8-bit standard IIC protocol
- WRITE_APB_REG(TVFE_EDID_CONFIG, 0x01800050);
- return;
- }
- ///////////////////TVFE top control////////////////////
- const static unsigned int aafilter_ctl[][2] = {
- //TVIN_SIG_FMT_NULL = 0,
- {0,0},
- //VDIN_SIG_FORMAT_VGA_512X384P_60D147,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_560X384P_60D147,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X200P_59D924,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X350P_85D080,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X400P_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X400P_85D080,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X400P_59D638,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X400P_56D416,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480I_29D970,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_66D619,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_66D667,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_72D809,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_75D000_A,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_85D008,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_59D638,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X480P_75D000_B,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_640X870P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X350P_70D086,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X400P_85D039,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X400P_70D086,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X400P_87D849,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X400P_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_720X480P_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_752X484I_29D970,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_768X574I_25D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_800X600P_56D250,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_800X600P_60D317,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_800X600P_72D188,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_800X600P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_800X600P_85D061,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_832X624P_75D087,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_848X480P_84D751,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_59D278,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_74D927,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768I_43D479,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_60D004,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_70D069,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_75D029,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_84D997,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_74D925,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_75D020,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_70D008,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_75D782,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_77D069,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X768P_71D799,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1024X1024P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1053X754I_43D453,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1056X768I_43D470,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1120X750I_40D021,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X864P_70D012,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X864P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X864P_84D999,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X870P_75D062,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X900P_65D950,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X900P_66D004,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X900P_76D047,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1152X900P_76D149,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1244X842I_30D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X768P_59D995,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X768P_74D893,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X768P_84D837,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X960P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X960P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X960P_85D002,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024I_43D436,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_60D020,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_75D025,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_85D024,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_59D979,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_72D005,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_60D002,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_67D003,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_74D112,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_76D179,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_66D718,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_66D677,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_76D107,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1280X1024P_59D996,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1360X768P_59D799,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1360X1024I_51D476,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1440X1080P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200I_48D040,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_65D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_70D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_80D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1200P_85D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1600X1280P_66D931,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1680X1080P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1792X1344P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1792X1344P_74D997,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1856X1392P_59D995,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1856X1392P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1868X1200P_75D000,
- //VDIN_SIG_FORMAT_VGA_1920X1080P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1080P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1080P_85D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1200P_84D932,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1200P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1200P_85D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1234P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1234P_85D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1440P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_1920X1440P_75D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_VGA_2048X1536P_60D000_A,
- {
- 0x00082222, //
- 0x252b39c6, //
- },
- //VDIN_SIG_FORMAT_VGA_2048X1536P_75D000,
- {0,0},
- //VDIN_SIG_FORMAT_VGA_2048X1536P_60D000_B,
- {0,0},
- //VDIN_SIG_FORMAT_VGA_2048X2048P_60D008,
- {0,0},
- //TVIN_SIG_FMT_VGA_MAX,
- {0,0},
- ///////////////////////////////////////////////////////////////
- //VDIN_SIG_FORMAT_COMPONENT_480P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_480I_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_576P_50D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_576I_50D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_720P_59D940,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_720P_50D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_23D976,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_24D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_25D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_30D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_50D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080P_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_29D970,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_47D952,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_48D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_50D000_A,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_50D000_B,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_50D000_C,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_COMPONENT_1080I_60D000,
- {
- 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //TVIN_SIG_FMT_COMP_MAX,
- {0,0},
- //VDIN_SIG_FORMAT_CVBS_NTSC_M,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_NTSC_443,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_PAL_I,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_PAL_M,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_PAL_60,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_PAL_CN,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_CVBS_SECAM,
- { 0x00082222, // TVFE_AAFILTER_CTRL1
- 0x252b39c6, // TVFE_AAFILTER_CTRL2
- },
- //VDIN_SIG_FORMAT_MAX,
- {0,0 }
- };
- // *****************************************************************************
- // Function:set aafilter control
- //
- // Params: format index
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_top_set_aafilter_control(enum tvin_sig_fmt_e fmt)
- {
- WRITE_APB_REG(TVFE_AAFILTER_CTRL1, aafilter_ctl[fmt][0]);
- WRITE_APB_REG(TVFE_AAFILTER_CTRL2, aafilter_ctl[fmt][1]);
- return;
- }
- void tvafe_top_set_cpump_para(enum tvin_sig_fmt_e fmt)
- {
- unsigned char clamp_type = 0;
- unsigned int clamping_delay;
- //check top charge pump clamping bit
- clamp_type = READ_APB_REG_BITS(TVFE_CLAMP_INTF, CLAMP_EN_BIT, CLAMP_EN_WID);
- if (clamp_type == 1) {
- clamping_delay = tvin_fmt_tbl[fmt].hs_front + tvin_fmt_tbl[fmt].hs_width
- + tvin_fmt_tbl[fmt].h_active;
- WRITE_APB_REG_BITS(TVFE_CLP_MUXCTRL1, clamping_delay, CLAMPING_DLY_BIT,
- CLAMPING_DLY_WID);
- }
- }
- // *****************************************************************************
- // Function:set bp gate of tvfe top module
- //
- // Params: format index
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_top_set_bp_gate(enum tvin_sig_fmt_e fmt)
- {
- unsigned int h_bp_end,h_bp_start;
- unsigned int v_bp_end,v_bp_start;
- h_bp_start = tvin_fmt_tbl[fmt].hs_width + 1;
- WRITE_APB_REG_BITS(TVFE_BPG_BACKP_H, h_bp_start, BACKP_H_ST_BIT, BACKP_H_ST_WID);
- h_bp_end = tvin_fmt_tbl[fmt].h_total
- - tvin_fmt_tbl[fmt].hs_front + 1;
- WRITE_APB_REG_BITS(TVFE_BPG_BACKP_H, h_bp_end, BACKP_H_ED_BIT, BACKP_H_ED_WID);
- v_bp_start = tvin_fmt_tbl[fmt].vs_width + 1;
- WRITE_APB_REG_BITS(TVFE_BPG_BACKP_V, v_bp_start, BACKP_V_ST_BIT, BACKP_V_ST_WID);
- v_bp_end = tvin_fmt_tbl[fmt].v_total
- - tvin_fmt_tbl[fmt].vs_front + 1;
- WRITE_APB_REG_BITS(TVFE_BPG_BACKP_V, v_bp_end, BACKP_V_ED_BIT, BACKP_V_ED_WID);
- return;
- }
- // *****************************************************************************
- // Function:set mvdet control of tvfe module
- //
- // Params: format index
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_top_set_mvdet_control(enum tvin_sig_fmt_e fmt)
- {
- unsigned int sd_mvd_reg_15_1b[] = {0, 0, 0, 0, 0, 0, 0,};
- if ((fmt > TVIN_SIG_FMT_COMP_480P_60D000)
- && (fmt < TVIN_SIG_FMT_COMP_576I_50D000)) {
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL1, sd_mvd_reg_15_1b[0]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL2, sd_mvd_reg_15_1b[1]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL3, sd_mvd_reg_15_1b[2]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL4, sd_mvd_reg_15_1b[3]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL5, sd_mvd_reg_15_1b[4]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL6, sd_mvd_reg_15_1b[5]);
- WRITE_APB_REG(TVFE_DVSS_MVDET_CTRL7, sd_mvd_reg_15_1b[6]);
- }
- return;
- }
- // *****************************************************************************
- // Function:set wss of tvfe top module
- //
- // Params: format index
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_top_set_wss_control(enum tvin_sig_fmt_e fmt)
- {
- unsigned int hd_mvd_reg_2a_2d[] = {0, 0, 0, 0};
- if (fmt > TVIN_SIG_FMT_COMP_720P_59D940
- && fmt < TVIN_SIG_FMT_COMP_1080I_60D000) {
- WRITE_APB_REG(TVFE_MISC_WSS1_MUXCTRL1, hd_mvd_reg_2a_2d[0]);
- WRITE_APB_REG(TVFE_MISC_WSS1_MUXCTRL2, hd_mvd_reg_2a_2d[1]);
- WRITE_APB_REG(TVFE_MISC_WSS2_MUXCTRL1, hd_mvd_reg_2a_2d[2]);
- WRITE_APB_REG(TVFE_MISC_WSS2_MUXCTRL2, hd_mvd_reg_2a_2d[3]);
- }
- return;
- }
- // *****************************************************************************
- // Function:set sfg control of tvfe top module
- //
- // Params: format index
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_top_set_sfg_mux_control(enum tvin_sig_fmt_e fmt)
- {
- unsigned int tmp;
- tmp = tvin_fmt_tbl[fmt].h_total/4;
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, tmp, SFG_DET_HSTART_BIT, SFG_DET_HSTART_WID);
- tmp = tvin_fmt_tbl[fmt].h_total*3/4;
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, tmp, SFG_DET_HEND_BIT, SFG_DET_HEND_WID);
- return;
- }
- enum tvin_scan_mode_e tvafe_top_get_scan_mode(void)
- {
- unsigned int scan_mode;
- scan_mode = READ_APB_REG_BITS(TVFE_SYNCTOP_INDICATOR3,
- SFG_PROGRESSIVE_BIT, SFG_PROGRESSIVE_WID);
- if (scan_mode == 0)
- return TVIN_SCAN_MODE_INTERLACED;
- else
- return TVIN_SCAN_MODE_PROGRESSIVE;
- }
- // *****************************************************************************
- // Function: get & set cal result
- //
- // Params: system info
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_set_cal_value(struct tvafe_adc_cal_s *para)
- {
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET1, 1, OGO_EN_BIT, OGO_EN_WID);
- WRITE_APB_REG_BITS(ADC_REG_07, para->a_analog_gain, ADCGAINA_BIT, ADCGAINA_WID);
- WRITE_APB_REG_BITS(ADC_REG_08, para->b_analog_gain, ADCGAINB_BIT, ADCGAINB_WID);
- WRITE_APB_REG_BITS(ADC_REG_09, para->c_analog_gain, ADCGAINC_BIT, ADCGAINC_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET1, para->a_digital_offset1,
- OGO_YG_OFFSET1_BIT, OGO_YG_OFFSET1_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET1, para->b_digital_offset1,
- OGO_UB_OFFSET1_BIT, OGO_UB_OFFSET1_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET3, para->c_digital_offset1,
- OGO_VR_OFFSET1_BIT, OGO_VR_OFFSET1_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_GAIN1, para->a_digital_gain,
- OGO_YG_GAIN_BIT, OGO_YG_GAIN_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_GAIN1, para->b_digital_gain,
- OGO_UB_GAIN_BIT, OGO_UB_GAIN_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_GAIN2, para->c_digital_gain,
- OGO_VR_GAIN_BIT, OGO_VR_GAIN_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET2, para->a_digital_offset2,
- OGO_YG_OFFSET2_BIT, OGO_YG_OFFSET2_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET2, para->b_digital_offset2,
- OGO_UB_OFFSET2_BIT, OGO_UB_OFFSET2_WID);
- WRITE_APB_REG_BITS(TVFE_OGO_OFFSET3, para->c_digital_offset2,
- OGO_VR_OFFSET2_BIT, OGO_VR_OFFSET2_WID);
- }
- void tvafe_get_cal_value(struct tvafe_adc_cal_s *para)
- {
- para->a_analog_gain = READ_APB_REG_BITS(ADC_REG_07, ADCGAINA_BIT, ADCGAINA_WID);
- para->b_analog_gain = READ_APB_REG_BITS(ADC_REG_08, ADCGAINB_BIT, ADCGAINB_WID);
- para->c_analog_gain = READ_APB_REG_BITS(ADC_REG_09, ADCGAINC_BIT, ADCGAINC_WID);
- para->a_digital_offset1 = READ_APB_REG_BITS(TVFE_OGO_OFFSET1, OGO_YG_OFFSET1_BIT, OGO_YG_OFFSET1_WID);
- para->b_digital_offset1 = READ_APB_REG_BITS(TVFE_OGO_OFFSET1, OGO_UB_OFFSET1_BIT, OGO_UB_OFFSET1_WID);
- para->c_digital_offset1 = READ_APB_REG_BITS(TVFE_OGO_OFFSET3, OGO_VR_OFFSET1_BIT, OGO_VR_OFFSET1_WID);
- para->a_digital_gain = READ_APB_REG_BITS(TVFE_OGO_GAIN1, OGO_YG_GAIN_BIT, OGO_YG_GAIN_WID);
- para->b_digital_gain = READ_APB_REG_BITS(TVFE_OGO_GAIN1, OGO_UB_GAIN_BIT, OGO_UB_GAIN_WID);
- para->c_digital_gain = READ_APB_REG_BITS(TVFE_OGO_GAIN2, OGO_VR_GAIN_BIT, OGO_VR_GAIN_WID);
- para->a_digital_offset2 = READ_APB_REG_BITS(TVFE_OGO_OFFSET2, OGO_YG_OFFSET2_BIT, OGO_YG_OFFSET2_WID);
- para->b_digital_offset2 = READ_APB_REG_BITS(TVFE_OGO_OFFSET2, OGO_UB_OFFSET2_BIT, OGO_UB_OFFSET2_WID);
- para->c_digital_offset2 = READ_APB_REG_BITS(TVFE_OGO_OFFSET3, OGO_VR_OFFSET2_BIT, OGO_VR_OFFSET2_WID);
- }
- // *****************************************************************************
- // Function: fetch WSS data
- //
- // Params: system info
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_get_wss_data(struct tvafe_comp_wss_s *para)
- {
- para->wss1[0] = READ_APB_REG(TVFE_MISC_WSS1_INDICATOR1);
- para->wss1[1] = READ_APB_REG(TVFE_MISC_WSS1_INDICATOR2);
- para->wss1[2] = READ_APB_REG(TVFE_MISC_WSS1_INDICATOR3);
- para->wss1[3] = READ_APB_REG(TVFE_MISC_WSS1_INDICATOR4);
- para->wss1[4] = READ_APB_REG_BITS(TVFE_MISC_WSS1_INDICATOR5, WSS1_DATA_143_128_BIT, WSS1_DATA_143_128_WID);
- para->wss2[0] = READ_APB_REG(TVFE_MISC_WSS2_INDICATOR1);
- para->wss2[1] = READ_APB_REG(TVFE_MISC_WSS2_INDICATOR2);
- para->wss2[2] = READ_APB_REG(TVFE_MISC_WSS2_INDICATOR3);
- para->wss2[3] = READ_APB_REG(TVFE_MISC_WSS2_INDICATOR4);
- para->wss2[4] = READ_APB_REG_BITS(TVFE_MISC_WSS2_INDICATOR5, WSS2_DATA_143_128_BIT, WSS2_DATA_143_128_WID);
- }
- // *****************************************************************************
- // Function: set hardcode of tvfe top module
- //
- // Params: none
- //
- // Return: none
- //
- // *****************************************************************************
- void tvafe_check_cvbs_3d_comb(void)
- {
- #if 0
- unsigned int interrupt_status = READ_APB_REG(TVFE_INT_INDICATOR1);
- if ((interrupt_status>>WARNING_3D_BIT) & 0x01) {
- WRITE_APB_REG_BITS(TVFE_INT_INDICATOR1, 0, WARNING_3D_BIT, WARNING_3D_WID);
- WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 1, SOFT_RST_BIT, SOFT_RST_WID);
- WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- }
- #else
- unsigned int cvd2_3d_status = READ_APB_REG(CVD2_REG_95);
- if(cvd2_3d_status & 0x1ffff) {
- //pr_info("%s: cvd2_3d_status = %x \n",__FUNCTION__, cvd2_3d_status);
- WRITE_APB_REG_BITS(CVD2_REG_B2, 1, COMB2D_ONLY_BIT, COMB2D_ONLY_WID);
- WRITE_APB_REG_BITS(CVD2_REG_B2, 0, COMB2D_ONLY_BIT, COMB2D_ONLY_WID);
- }
- #endif
- }
- void tvafe_top_set_de(enum tvin_sig_fmt_e fmt)
- {
- unsigned int hs = 0, he = 0, vs = 0, ve = 0;
- hs = tvin_fmt_tbl[fmt].hs_width + tvin_fmt_tbl[fmt].hs_bp;
- vs = tvin_fmt_tbl[fmt].vs_width + tvin_fmt_tbl[fmt].vs_bp;
- he = hs + tvin_fmt_tbl[fmt].h_active - 1;
- ve = vs + tvin_fmt_tbl[fmt].v_active - 1;
- WRITE_APB_REG_BITS(TVFE_DEG_H, hs,
- DEG_HSTART_BIT, DEG_HSTART_WID);
- WRITE_APB_REG_BITS(TVFE_DEG_H, he,
- DEG_HEND_BIT, DEG_HEND_WID);
- WRITE_APB_REG_BITS(TVFE_DEG_VODD, vs,
- DEG_VSTART_ODD_BIT, DEG_VSTART_ODD_WID);
- WRITE_APB_REG_BITS(TVFE_DEG_VODD, ve,
- DEG_VEND_ODD_BIT, DEG_VEND_ODD_WID);
- WRITE_APB_REG_BITS(TVFE_DEG_VEVEN, vs + 1,
- DEG_VSTART_EVEN_BIT, DEG_VSTART_EVEN_WID);
- WRITE_APB_REG_BITS(TVFE_DEG_VEVEN, ve + 1,
- DEG_VEND_EVEN_BIT, DEG_VEND_EVEN_WID);
- }
- void tvafe_top_set_field_gen(enum tvin_sig_fmt_e fmt)
- {
- unsigned int hs = 0, he = 0, vs = 0, ve = 0;
- hs = tvin_fmt_tbl[fmt].hs_width + tvin_fmt_tbl[fmt].hs_bp;
- vs = tvin_fmt_tbl[fmt].vs_width + tvin_fmt_tbl[fmt].vs_bp;
- he = hs + tvin_fmt_tbl[fmt].h_active - 1;
- ve = vs + tvin_fmt_tbl[fmt].v_active - 1;
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, hs,
- DEG_HSTART_BIT, DEG_HSTART_WID);
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, he,
- DEG_HEND_BIT, DEG_HEND_WID);
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, vs,
- DEG_VSTART_ODD_BIT, DEG_VSTART_ODD_WID);
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, ve,
- DEG_VEND_ODD_BIT, DEG_VEND_ODD_WID);
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, vs + 1,
- DEG_VSTART_EVEN_BIT, DEG_VSTART_EVEN_WID);
- WRITE_APB_REG_BITS(TVFE_SYNCTOP_SFG_MUXCTRL1, ve + 1,
- DEG_VEND_EVEN_BIT, DEG_VEND_EVEN_WID);
- }
- static void tvafe_top_config(enum tvin_sig_fmt_e fmt)
- {
- //tvafe_top_set_aafilter_control(fmt);
- //tvafe_top_set_bp_gate(fmt);
- //tvafe_top_set_mvdet_control(fmt);
- //tvafe_top_set_sfg_mux_control(fmt);
- tvafe_top_set_wss_control(fmt);
- tvafe_top_set_de(fmt);
- }
- static void tvafe_stop_vga(void)
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, COMP_CLK_ENABLE_BIT, COMP_CLK_ENABLE_WID);
- //WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, EDID_CLK_EN_BIT, EDID_CLK_EN_WID);
- //WRITE_CBUS_REG_BITS(HHI_TVFE_AUTOMODE_CLK_CNTL, 0, 7, 1); //?
- //...
- }
- #include <linux/kernel.h>
- static void tvafe_reset_vga(void)
- {
- // pr_info("tvafe: tvafe_reset_vga.CVD2_RESET_REGISTER %x 1\n", CVD2_RESET_REGISTER);
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- //pr_info("tvafe: tvafe_reset_vga. 2\n");
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 1, SOFT_RST_BIT, SOFT_RST_WID); //SOFT RESET memory
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, COMP_CLK_ENABLE_BIT, COMP_CLK_ENABLE_WID);
- //WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, EDID_CLK_EN_BIT, EDID_CLK_EN_WID);
- //pr_info("tvafe: tvafe_reset_vga. 3\n");
- //WRITE_CBUS_REG_BITS(HHI_TVFE_AUTOMODE_CLK_CNTL, 1, 7, 1); //enable auto mode clock
- //...
- //pr_info("tvafe: tvafe_reset_vga. 4\n");
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, ADC_CLK_RST_BIT, ADC_CLK_RST_WID);
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, EDID_RST_BIT, EDID_RST_WID);
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, VAFE_RST_BIT, VAFE_RST_WID);
- }
- static void tvafe_stop_comp(void)
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, COMP_CLK_ENABLE_BIT, COMP_CLK_ENABLE_WID);
- //WRITE_CBUS_REG_BITS(HHI_TVFE_AUTOMODE_CLK_CNTL, 0, 7, 1); //
- }
- static void tvafe_reset_comp(void)
- {
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 1, SOFT_RST_BIT, SOFT_RST_WID); //SOFT RESET memory
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, DCLK_ENABLE_BIT, DCLK_ENABLE_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, VAFE_MCLK_EN_BIT, VAFE_MCLK_EN_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, COMP_CLK_ENABLE_BIT, COMP_CLK_ENABLE_WID);
- //WRITE_CBUS_REG_BITS(HHI_TVFE_AUTOMODE_CLK_CNTL, 1, 7, 1); //enable auto mode clock
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, ADC_CLK_RST_BIT, ADC_CLK_RST_WID);
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, VAFE_RST_BIT, VAFE_RST_WID);
- }
- static void tvafe_stop_cvbs(void)
- {
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, DCLK_ENABLE_BIT, DCLK_ENABLE_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 0, VAFE_MCLK_EN_BIT, VAFE_MCLK_EN_WID);
- }
- static void tvafe_reset_cvbs(void)
- {
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 1, SOFT_RST_BIT, SOFT_RST_WID); //SOFT RESET memory
- //WRITE_APB_REG_BITS(CVD2_RESET_REGISTER, 0, SOFT_RST_BIT, SOFT_RST_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, DCLK_ENABLE_BIT, DCLK_ENABLE_WID);
- WRITE_APB_REG_BITS(TVFE_TOP_CTRL, 1, VAFE_MCLK_EN_BIT, VAFE_MCLK_EN_WID);
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, DCLK_RST_BIT, DCLK_RST_WID);
- WRITE_APB_REG_BITS(TVFE_RST_CTRL, 1, MCLK_RST_BIT, MCLK_RST_WID);
- }
- void tvafe_stop_module(struct tvafe_info_s *info)
- {
- if ((info->param.port > TVIN_PORT_VGA0) && (info->param.port < TVIN_PORT_VGA7))
- tvafe_stop_vga();
- else if ((info->param.port > TVIN_PORT_COMP0) && (info->param.port < TVIN_PORT_COMP7))
- tvafe_stop_comp();
- else
- tvafe_stop_cvbs();
- }
- void tvafe_reset_module(enum tvin_port_e port)
- {
- if ((port >= TVIN_PORT_VGA0) && (port <= TVIN_PORT_VGA7))
- tvafe_reset_vga();
- else if ((port >= TVIN_PORT_COMP0) && (port <= TVIN_PORT_COMP7))
- tvafe_reset_comp();
- else
- tvafe_reset_cvbs();
- }
- void tvafe_set_fmt(struct tvafe_info_s *info)
- {
- //check decoder signal status
- if((info->param.status != TVIN_SIG_STATUS_STABLE) || (info->param.fmt == TVIN_SIG_FMT_NULL))
- {
- //pr_info("TVAFE tvafe_set_fmt format abnormal \n");
- return;
- }
- pr_info("TVAFE tvafe_set_fmt:%d\n", info->param.fmt);
- if ((info->param.port >= TVIN_PORT_CVBS0) &&
- (info->param.port <= TVIN_PORT_SVIDEO7)
- )
- {
- #ifndef VDIN_FIXED_FMT_TEST
- tvafe_cvd2_video_mode_confiure(info->param.fmt, info->param.port);
- #endif
- }
- else
- {
- tvafe_adc_configure(info->param.fmt);
- tvafe_top_config(info->param.fmt);
- }
- //pin mux, must load pin mux again after load reg table
- tvafe_source_muxing(info);
- //cvd2 set fmt ...
- }
- static inline bool tvafe_is_nosig(struct tvafe_info_s *info)
- {
- bool ret = 0;
- if ((info->src_type == TVAFE_SRC_TYPE_VGA) ||
- (info->src_type == TVAFE_SRC_TYPE_COMP))
- ret = tvafe_adc_no_sig();
- else if ((info->src_type == TVAFE_SRC_TYPE_CVBS) ||
- (info->src_type == TVAFE_SRC_TYPE_SVIDEO))
- ret = tvafe_cvd_no_sig();
- return ret;
- }
- static inline bool tvafe_fmt_chg(struct tvafe_info_s *info)
- {
- bool ret = false;
- if ((info->src_type == TVAFE_SRC_TYPE_VGA) ||
- (info->src_type == TVAFE_SRC_TYPE_COMP))
- ret = tvafe_adc_fmt_chg(info);//(info->src_type, &info->param);
- else if ((info->src_type == TVAFE_SRC_TYPE_CVBS) ||
- (info->src_type == TVAFE_SRC_TYPE_SVIDEO))
- ret = tvafe_cvd_fmt_chg();
- return ret;
- }
- static inline bool tvafe_pll_bad(struct tvafe_info_s *info)
- {
- bool ret = true;
- if ((info->src_type == TVAFE_SRC_TYPE_VGA) ||
- (info->src_type == TVAFE_SRC_TYPE_COMP)
- )
- ret = tvafe_adc_get_pll_status();
- if (ret)
- return false;
- else
- return true;
- }
- static inline enum tvin_sig_fmt_e tvafe_get_fmt(struct tvafe_info_s *info)
- {
- enum tvin_sig_fmt_e fmt = TVIN_SIG_FMT_NULL;
- if ((info->src_type == TVAFE_SRC_TYPE_VGA) ||
- (info->src_type == TVAFE_SRC_TYPE_COMP))
- fmt = tvafe_adc_search_mode(info->src_type);
- else if ((info->src_type == TVAFE_SRC_TYPE_CVBS) ||
- (info->src_type == TVAFE_SRC_TYPE_SVIDEO))
- fmt = tvafe_cvd2_get_format();
- return fmt;
- }
- inline void tvafe_init_state_handler(void)
- {
- tvafe_state = TVAFE_STATE_NOSIG;
- tvafe_state_counter = 0;
- tvafe_exit_nosig_counter = 0;
- tvafe_back_nosig_counter = 0;
- tvafe_exit_stable_counter = 0;
- tvafe_back_stable_counter = 0;
- tvafe_cvd2_state_init();
- }
- static unsigned int wait_fmt_set_cnt = 0;
- static bool rst_fg = 0;
- inline void tvafe_run_state_handler(struct tvafe_info_s *info)
- {
- enum tvin_sig_fmt_e fmt = 0;
- //wait format stable after set format table
- if (info->src_type == TVAFE_SRC_TYPE_COMP)
- {
- if (wait_fmt_set_cnt++ <= 10)
- return;
- else
- wait_fmt_set_cnt = 10;
- }
- switch (tvafe_state)
- {
- case TVAFE_STATE_NOSIG:
- ++tvafe_state_counter;
- if (tvafe_is_nosig(info))
- {
- tvafe_exit_nosig_counter = 0;
- if (tvafe_state_counter >= TVAFE_SURE_NOSIG)
- {
- tvafe_state_counter = TVAFE_SURE_NOSIG;
- info->param.status = TVIN_SIG_STATUS_NOSIG;
- info->param.fmt = TVIN_SIG_FMT_NULL;
- //pr_info("TVAFE state: nosig\n");
- }
- }
- else
- {
- ++tvafe_exit_nosig_counter;
- if (tvafe_exit_nosig_counter >= TVAFE_EXIT_NOSIG)
- {
- tvafe_exit_nosig_counter = 0;
- tvafe_state_counter = 0;
- tvafe_state = TVAFE_STATE_UNSTABLE;
- rst_fg = 0;
- pr_info("TVAFE state: nosig-->unstable\n");
- }
- }
- break;
- case TVAFE_STATE_UNSTABLE:
- ++tvafe_state_counter;
- if (tvafe_is_nosig(info))
- {
- tvafe_back_stable_counter = 0;
- ++tvafe_back_nosig_counter;
- if (tvafe_back_nosig_counter >= TVAFE_BACK_NOSIG)
- {
- tvafe_back_nosig_counter = 0;
- tvafe_state_counter = 0;
- tvafe_state = TVAFE_STATE_NOSIG;
- info->param.status = TVIN_SIG_STATUS_NOSIG;
- info->param.fmt = TVIN_SIG_FMT_NULL;
- pr_info("TVAFE state: unstable-->nosig\n");
- }
- }
- else
- {
- tvafe_back_nosig_counter = 0;
- // if (tvafe_fmt_chg(info) || tvafe_pll_bad(info))
- if (tvafe_fmt_chg(info))
- {
- tvafe_back_stable_counter = 0;
- if (tvafe_state_counter >= TVAFE_SURE_UNSTABLE)
- {
- tvafe_state_counter = TVAFE_SURE_UNSTABLE;
- info->param.status = TVIN_SIG_STATUS_UNSTABLE;
- info->param.fmt = TVIN_SIG_FMT_NULL;
- if ((rst_fg == 0) &&
- (info->src_type == TVAFE_SRC_TYPE_COMP))
- {
- rst_fg = 1;
- tvafe_adc_digital_reset();
- wait_fmt_set_cnt = 0;
- pr_info("TVAFE: unstable, reset ADC\n");
- }
- pr_info("TVAFE state: unstable\n");
- }
- }
- else
- {
- ++tvafe_back_stable_counter;
- if (tvafe_back_stable_counter >= TVAFE_BACK_STABLE*9)
- { //must wait enough time for cvd signal lock
- tvafe_back_stable_counter = 0;
- tvafe_state_counter = 0;
- tvafe_state = TVAFE_STATE_STABLE;
- info->param.status = TVIN_SIG_STATUS_STABLE;
- //info->param.fmt = tvafe_get_fmt(info);
- fmt = tvafe_get_fmt(info);
- #if 1
- if (info->src_type == TVAFE_SRC_TYPE_COMP)
- {
- if ((info->param.fmt == TVIN_SIG_FMT_NULL) &&
- (rst_fg == 0))
- {
- rst_fg = 1;
- tvafe_adc_digital_reset();
- wait_fmt_set_cnt = 0;
- pr_info("TVAFE: NULL fmt, reset ADC\n");
- }
- else if (info->param.fmt != fmt)
- wait_fmt_set_cnt = 0;
- }
- info->param.fmt = fmt;
- #else
- info->param.fmt = tvafe_get_fmt(info);
- #endif
- pr_info("TVAFE state: unstable-->stable fmt:%d\n", info->param.fmt);
- }
- }
- }
- break;
- case TVAFE_STATE_STABLE:
- // if (tvafe_is_nosig(info) || tvafe_fmt_chg(info) || tvafe_pll_bad(info))
- if (tvafe_is_nosig(info) || tvafe_fmt_chg(info))
- {
- ++tvafe_exit_stable_counter;
- if (tvafe_exit_stable_counter >= TVAFE_EXIT_STABLE)
- {
- tvafe_exit_stable_counter = 0;
- tvafe_state = TVAFE_STATE_UNSTABLE;
- rst_fg = 0;
- pr_info("TVAFE state: stable-->unstable\n");
- }
- }
- else
- {
- tvafe_exit_stable_counter = 0;
- }
- break;
- default:
- break;
- }
- }
|