.. | .. |
---|
134 | 134 | extern unsigned char nvp6158_det_mode[16]; |
---|
135 | 135 | NC_VIVO_CH_FORMATDEF NVP6158_NC_VD_AUTO_VFCtoFMTDEF(unsigned char ch, unsigned char VFC) |
---|
136 | 136 | { |
---|
137 | | - if((nvp6158_chip_id[ch/4] == NVP6168C_R0_ID) || (nvp6158_chip_id[ch/4] == NVP6168_R0_ID)) |
---|
138 | | - { |
---|
| 137 | + if((nvp6158_chip_id[ch/4] == NVP6168C_R0_ID) || |
---|
| 138 | + (nvp6158_chip_id[ch/4] == NVP6168_R0_ID)) { |
---|
139 | 139 | return nvp6158_arrVfcType_raptor4[VFC]; |
---|
140 | | - } |
---|
141 | | - else |
---|
142 | | - { |
---|
| 140 | + } else { |
---|
143 | 141 | if(nvp6158_det_mode[ch] == NVP6158_DET_MODE_AUTO) |
---|
144 | 142 | return nvp6158_arrVfcType[VFC]; |
---|
145 | 143 | else if(nvp6158_det_mode[ch] == NVP6158_DET_MODE_CVI) |
---|
146 | 144 | return nvp6158_arrVfcType_cvi[VFC]; |
---|
147 | 145 | else if(nvp6158_det_mode[ch] == NVP6158_DET_MODE_TVI) |
---|
148 | 146 | return nvp6158_arrVfcType_tvi[VFC]; |
---|
149 | | - else |
---|
| 147 | + else |
---|
150 | 148 | return nvp6158_arrVfcType_ahd[VFC]; |
---|
151 | 149 | } |
---|
152 | 150 | } |
---|
.. | .. |
---|
168 | 166 | |
---|
169 | 167 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0xFF, 0x00); |
---|
170 | 168 | //B0 0x00/1/2/3 gain[4], powerdown[0] |
---|
171 | | - gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x00 + vin_auto_det->ch, ((vin_auto_det->vafe.gain & 0x01) << 4) | |
---|
172 | | - (vin_auto_det->vafe.powerdown & 0x01)); |
---|
| 169 | + gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x00 + vin_auto_det->ch, |
---|
| 170 | + ((vin_auto_det->vafe.gain & 0x01) << 4) | (vin_auto_det->vafe.powerdown & 0x01)); |
---|
173 | 171 | |
---|
174 | 172 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0xFF, 0x01); |
---|
175 | 173 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x84 + vin_auto_det->ch, 0x00); |
---|
.. | .. |
---|
186 | 184 | |
---|
187 | 185 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x00, val_5678x00); |
---|
188 | 186 | |
---|
189 | | - val_5678x01 = ((vin_auto_det->vafe.ctrlreg << 6) | (vin_auto_det->vafe.ctrlibs << 4) | (vin_auto_det->vafe.adcspd << 2) | (vin_auto_det->vafe.clplevel)); |
---|
| 187 | + val_5678x01 = ((vin_auto_det->vafe.ctrlreg << 6) | (vin_auto_det->vafe.ctrlibs << 4) | |
---|
| 188 | + (vin_auto_det->vafe.adcspd << 2) | (vin_auto_det->vafe.clplevel)); |
---|
190 | 189 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x01, val_5678x01 ); |
---|
191 | 190 | |
---|
192 | 191 | //B5/6/7/8 0x58 eq_band[7:4], lpf_front_band[1:0] |
---|
.. | .. |
---|
194 | 193 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x58, val_5678x58); |
---|
195 | 194 | |
---|
196 | 195 | //B5/6/7/8 0x5B ref_vol[1:0] |
---|
197 | | - val_5678x59 = ((vin_auto_det->vafe.clpmode << 7) | (vin_auto_det->vafe.f_lpf_bypass << 4) | (vin_auto_det->vafe.clproff << 3) | (vin_auto_det->vafe.b_lpf_bypass)); |
---|
| 196 | + val_5678x59 = ((vin_auto_det->vafe.clpmode << 7) | (vin_auto_det->vafe.f_lpf_bypass << 4) | |
---|
| 197 | + (vin_auto_det->vafe.clproff << 3) | (vin_auto_det->vafe.b_lpf_bypass)); |
---|
198 | 198 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x59, val_5678x59); |
---|
199 | 199 | |
---|
200 | 200 | val_5678x5B = ((vin_auto_det->vafe.duty << 4) | (vin_auto_det->vafe.ref_vol)); |
---|
201 | 201 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x5B, val_5678x5B); |
---|
202 | 202 | |
---|
203 | | - val_5678x5C = ((vin_auto_det->vafe.lpf_back_band << 4) | (vin_auto_det->vafe.clk_sel << 3) | (vin_auto_det->vafe.eq_gainsel)); |
---|
| 203 | + val_5678x5C = ((vin_auto_det->vafe.lpf_back_band << 4) | |
---|
| 204 | + (vin_auto_det->vafe.clk_sel << 3) | (vin_auto_det->vafe.eq_gainsel)); |
---|
204 | 205 | gpio_i2c_write(nvp6158_iic_addr[vin_auto_det->devnum], 0x5C, val_5678x5C); |
---|
205 | 206 | } |
---|
206 | 207 | |
---|
.. | .. |
---|
462 | 463 | unsigned char val_13x32; |
---|
463 | 464 | unsigned char val_9x44; |
---|
464 | 465 | unsigned char val_1x7A; |
---|
465 | | - |
---|
| 466 | + |
---|
466 | 467 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0xFF, 0x00); |
---|
467 | 468 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x21 + (auto_novid->ch * 4), 0x82); |
---|
468 | 469 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x23 + (auto_novid->ch * 4), 0x41); |
---|
.. | .. |
---|
483 | 484 | //gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x58, 0x07); |
---|
484 | 485 | //gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x5C, 0x78); |
---|
485 | 486 | /* After 08/28 */ |
---|
486 | | - gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x47, 0xEE); |
---|
| 487 | + gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x47, 0xEE); |
---|
487 | 488 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x50, 0xc6); //recovery to std value. |
---|
488 | 489 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x58, 0x47); |
---|
489 | 490 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x5C, 0x7f); |
---|
490 | 491 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x6E, 0x00); //VBLK default setting |
---|
491 | | - gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x6F, 0x00); |
---|
| 492 | + gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x6F, 0x00); |
---|
492 | 493 | /* Low-Poass Filter (LPF) Bypass Enable Bank5/6/7/8 0x59 */ |
---|
493 | 494 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x59, 0x10); |
---|
494 | 495 | |
---|
.. | .. |
---|
511 | 512 | /* disable Bank11 0x00, if before setting format TVI 5M 20P when onvideo */ |
---|
512 | 513 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0xFF, 0x11); |
---|
513 | 514 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x00 + ( auto_novid->ch * 0x20 ), 0x00); |
---|
514 | | - |
---|
| 515 | + |
---|
515 | 516 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0xFF, 0x09); |
---|
516 | 517 | val_9x44 = gpio_i2c_read(nvp6158_iic_addr[auto_novid->devnum], 0x44); |
---|
517 | 518 | val_9x44 |= (1 << auto_novid->ch); |
---|
.. | .. |
---|
530 | 531 | gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x8c + auto_novid->ch, 0x55); |
---|
531 | 532 | val_1x7A = gpio_i2c_read(nvp6158_iic_addr[auto_novid->devnum], 0x7A); |
---|
532 | 533 | val_1x7A |= (1 << auto_novid->ch); |
---|
533 | | - gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x7A, val_1x7A); |
---|
| 534 | + gpio_i2c_write(nvp6158_iic_addr[auto_novid->devnum], 0x7A, val_1x7A); |
---|
534 | 535 | } |
---|
535 | 536 | |
---|
536 | 537 | void nvp6168_video_input_no_video_set(video_input_novid *auto_novid) |
---|
.. | .. |
---|
573 | 574 | |
---|
574 | 575 | |
---|
575 | 576 | |
---|
576 | | -void nvp6158_video_input_sam_val_read(video_input_sam_val *vin_sam_val ) |
---|
| 577 | +void nvp6158_video_input_sam_val_read(video_input_sam_val *vin_sam_val ) |
---|
577 | 578 | { |
---|
578 | 579 | unsigned char val1, val2; |
---|
579 | 580 | |
---|
.. | .. |
---|
763 | 764 | unsigned int val_1 = 0; |
---|
764 | 765 | unsigned int val_2 = 0; |
---|
765 | 766 | unsigned int val_result; |
---|
766 | | - |
---|
| 767 | + |
---|
767 | 768 | static unsigned int pre_val_1; |
---|
768 | 769 | static unsigned int pre_val_2; |
---|
769 | 770 | |
---|
.. | .. |
---|
777 | 778 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0xFF, 0x13); |
---|
778 | 779 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0x2B, vin_hsync_accum->ch); |
---|
779 | 780 | |
---|
780 | | - while(read_cnt < total_cnt) |
---|
781 | | - { |
---|
| 781 | + while(read_cnt < total_cnt) { |
---|
782 | 782 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0xFF, 0x00); |
---|
783 | 783 | video_loss = gpio_i2c_read(nvp6158_iic_addr[vin_hsync_accum->devnum], 0xA8); |
---|
784 | 784 | video_loss = (((video_loss >> vin_hsync_accum->ch) & 0x1)) ; |
---|
.. | .. |
---|
786 | 786 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0xFF, 0x05 + vin_hsync_accum->ch); |
---|
787 | 787 | vfc = gpio_i2c_read(nvp6158_iic_addr[vin_hsync_accum->devnum], 0xF0); |
---|
788 | 788 | |
---|
789 | | - if((video_loss == 1) && (vfc == 0xFF)) |
---|
790 | | - { |
---|
791 | | - printk("[%s] CH:%d, video_loss:%02X, vfc:0x%X \r\n", __func__, vin_hsync_accum->ch, video_loss, vfc); |
---|
| 789 | + if((video_loss == 1) && (vfc == 0xFF)) { |
---|
| 790 | + printk("[%s] CH:%d, video_loss:%02X, vfc:0x%X \r\n", __func__, |
---|
| 791 | + vin_hsync_accum->ch, video_loss, vfc); |
---|
792 | 792 | vin_hsync_accum->hsync_accum_val1 = 0; |
---|
793 | 793 | vin_hsync_accum->hsync_accum_val2 = 0; |
---|
794 | 794 | vin_hsync_accum->hsync_accum_result = 0xffffffff; |
---|
.. | .. |
---|
822 | 822 | |
---|
823 | 823 | //printk("[%s] CH:%d, video_loss:%02X, vfc:0x%X val1:%08X / val2:%08X \r\n", __func__, vin_hsync_accum->ch, video_loss, vfc, val_1, val_2); |
---|
824 | 824 | |
---|
825 | | - if((val_1 != 0) && (val_2 != 0)) |
---|
826 | | - { |
---|
827 | | - if((pre_val_1 != val_1) || (pre_val_2 != val_2)) |
---|
828 | | - { |
---|
| 825 | + if((val_1 != 0) && (val_2 != 0)) { |
---|
| 826 | + if((pre_val_1 != val_1) || (pre_val_2 != val_2)) { |
---|
829 | 827 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0x7A, rst_reg); |
---|
830 | 828 | gpio_i2c_write(nvp6158_iic_addr[vin_hsync_accum->devnum], 0x7A, 0x10); |
---|
831 | 829 | pre_val_1 = val_1; |
---|
.. | .. |
---|
987 | 985 | |
---|
988 | 986 | val1 = gpio_i2c_read(nvp6158_iic_addr[vin_acc_gain->devnum],0xE2) & 0x7; // B5 0xE2 acc gain [10:8] |
---|
989 | 987 | val2 = gpio_i2c_read(nvp6158_iic_addr[vin_acc_gain->devnum],0xE3); // B5 0xE3 acc gain [7:0] |
---|
990 | | - } |
---|
991 | | - else if(vin_acc_gain->func_sel == ACC_GAIN_DEBUG) { // DEBUG |
---|
| 988 | + } else if(vin_acc_gain->func_sel == ACC_GAIN_DEBUG) { // DEBUG |
---|
992 | 989 | gpio_i2c_write(nvp6158_iic_addr[vin_acc_gain->devnum], 0xFF, 0x00); |
---|
993 | 990 | val1 = 0; |
---|
994 | 991 | val2 = gpio_i2c_read(nvp6158_iic_addr[vin_acc_gain->devnum],0xD8 + vin_acc_gain->ch); // B13 0xC6 acc gain [9:8] |
---|
995 | | - } |
---|
996 | | - else |
---|
997 | | - { |
---|
| 992 | + } else { |
---|
998 | 993 | gpio_i2c_write(nvp6158_iic_addr[vin_acc_gain->devnum], 0xFF, 0x05); |
---|
999 | 994 | |
---|
1000 | 995 | val1 = gpio_i2c_read(nvp6158_iic_addr[vin_acc_gain->devnum],0xE2) & 0x7; // B5 0xE2 acc gain [10:8] |
---|
.. | .. |
---|
1013 | 1008 | // 0x7A [7 : 4][3 : 0] 0x7B [7 : 4][3 : 0] |
---|
1014 | 1009 | gpio_i2c_write(nvp6158_iic_addr[vo_data_out_mode->devnum], 0xFF, 0x00); |
---|
1015 | 1010 | |
---|
1016 | | - switch(vo_data_out_mode -> ch) |
---|
1017 | | - { |
---|
| 1011 | + switch(vo_data_out_mode -> ch) { |
---|
1018 | 1012 | case CH1 : |
---|
1019 | 1013 | case CH2 : temp_val = gpio_i2c_read(nvp6158_iic_addr[vo_data_out_mode->devnum], 0x7A); |
---|
1020 | 1014 | break; |
---|
.. | .. |
---|
1023 | 1017 | break; |
---|
1024 | 1018 | } |
---|
1025 | 1019 | |
---|
1026 | | - switch(vo_data_out_mode -> ch) |
---|
1027 | | - { |
---|
| 1020 | + switch(vo_data_out_mode -> ch) { |
---|
1028 | 1021 | case CH1 : |
---|
1029 | 1022 | case CH3 : temp_val = ((temp_val & 0xF0) | (vo_data_out_mode -> set_val & 0xF)); |
---|
1030 | 1023 | break; |
---|
.. | .. |
---|
1034 | 1027 | } |
---|
1035 | 1028 | |
---|
1036 | 1029 | // printk("[%s:%s] : %s >>>> temp_val [ %x ]\n", __FILE__, __LINE__, __FUNCTION__,temp_val); |
---|
1037 | | - switch(vo_data_out_mode -> ch) |
---|
1038 | | - { |
---|
| 1030 | + switch(vo_data_out_mode -> ch) { |
---|
1039 | 1031 | case CH1 : |
---|
1040 | 1032 | case CH2 : gpio_i2c_write(nvp6158_iic_addr[vo_data_out_mode->devnum], 0x7A, temp_val); |
---|
1041 | 1033 | break; |
---|
.. | .. |
---|
1050 | 1042 | { |
---|
1051 | 1043 | unsigned char ret = 0; // |
---|
1052 | 1044 | |
---|
1053 | | - if( |
---|
1054 | | - (decoder_info->fmt_def == AHD30_3M_30P) || |
---|
| 1045 | + if((decoder_info->fmt_def == AHD30_3M_30P) || |
---|
1055 | 1046 | (decoder_info->fmt_def == AHD30_3M_25P) || |
---|
1056 | 1047 | (decoder_info->fmt_def == AHD30_4M_30P) || |
---|
1057 | 1048 | (decoder_info->fmt_def == AHD30_4M_25P) || |
---|
.. | .. |
---|
1070 | 1061 | (decoder_info->fmt_def == CVI_4M_30P) || |
---|
1071 | 1062 | (decoder_info->fmt_def == CVI_5M_20P) || |
---|
1072 | 1063 | (decoder_info->fmt_def == CVI_8M_15P) || |
---|
1073 | | - (decoder_info->fmt_def == CVI_8M_12_5P) |
---|
1074 | | - ) |
---|
1075 | | - { |
---|
| 1064 | + (decoder_info->fmt_def == CVI_8M_12_5P)) { |
---|
1076 | 1065 | ret = 1; |
---|
1077 | 1066 | } |
---|
1078 | 1067 | return ret; // 0:Over 3M RT, 1:other formation |
---|
.. | .. |
---|
1083 | 1072 | { |
---|
1084 | 1073 | unsigned char format_3M_RT; |
---|
1085 | 1074 | |
---|
1086 | | - printk("onvideo_set dev_num[%x] ch_num[%x] fmt_def[%d]", decoder_info->devnum, decoder_info->ch, decoder_info->fmt_def); |
---|
1087 | | - |
---|
1088 | | - |
---|
| 1075 | + printk("onvideo_set dev_num[%x] ch_num[%x] fmt_def[%d]", |
---|
| 1076 | + decoder_info->devnum, decoder_info->ch, decoder_info->fmt_def); |
---|
1089 | 1077 | |
---|
1090 | 1078 | /* after 09/12 */ |
---|
1091 | 1079 | format_3M_RT = __nvp6158_IsOver3MRTVideoFormat(decoder_info); |
---|
1092 | 1080 | |
---|
1093 | | - if(format_3M_RT) |
---|
1094 | | - { |
---|
| 1081 | + if(format_3M_RT) { |
---|
1095 | 1082 | /* DECI_FILTER_ON */ |
---|
1096 | 1083 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0xFF, 0x05 + decoder_info->ch); |
---|
1097 | 1084 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x50, 0x76); |
---|
1098 | | - } |
---|
1099 | | - else |
---|
1100 | | - { |
---|
| 1085 | + } else { |
---|
1101 | 1086 | /* DECI_FILTER_OFF */ |
---|
1102 | 1087 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0xFF, 0x05 + decoder_info->ch); |
---|
1103 | 1088 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x50, 0xc6); |
---|
1104 | 1089 | } |
---|
1105 | 1090 | |
---|
1106 | 1091 | |
---|
1107 | | - if( decoder_info->fmt_def == CVI_HD_30P || |
---|
1108 | | - decoder_info->fmt_def == CVI_HD_30P_EX || |
---|
1109 | | - decoder_info->fmt_def == AHD20_720P_30P || |
---|
1110 | | - decoder_info->fmt_def == AHD20_720P_30P_EX || |
---|
1111 | | - decoder_info->fmt_def == AHD20_720P_30P_EX_Btype) |
---|
1112 | | - { |
---|
| 1092 | + if(decoder_info->fmt_def == CVI_HD_30P || decoder_info->fmt_def == CVI_HD_30P_EX || |
---|
| 1093 | + decoder_info->fmt_def == AHD20_720P_30P || decoder_info->fmt_def == AHD20_720P_30P_EX || |
---|
| 1094 | + decoder_info->fmt_def == AHD20_720P_30P_EX_Btype) { |
---|
1113 | 1095 | //meant to remove pre-connection issue. 07.31 |
---|
1114 | | - if( nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] == 0) |
---|
1115 | | - { |
---|
| 1096 | + if( nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] == 0) { |
---|
1116 | 1097 | nvp6158_video_input_vafe_reset(decoder_info); |
---|
1117 | 1098 | nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] = 1; |
---|
1118 | 1099 | } |
---|
1119 | | - } |
---|
1120 | | - else |
---|
1121 | | - { |
---|
1122 | | - if( nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] == 0) |
---|
1123 | | - { |
---|
| 1100 | + } else { |
---|
| 1101 | + if( nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] == 0) { |
---|
1124 | 1102 | nvp6158_s_only_onetime_run[decoder_info->ch + 4 * decoder_info->devnum] = 1; |
---|
1125 | 1103 | } |
---|
1126 | 1104 | } |
---|
1127 | | - |
---|
1128 | 1105 | } |
---|
1129 | 1106 | |
---|
1130 | 1107 | void nvp6168_video_input_onvideo_set(decoder_dev_ch_info_s *decoder_info) |
---|
.. | .. |
---|
1133 | 1110 | unsigned char ch = decoder_info->ch % 4; |
---|
1134 | 1111 | unsigned char devnum = decoder_info->devnum; |
---|
1135 | 1112 | unsigned char val_9x44; |
---|
1136 | | -#ifndef _NVP6168_USE_MANUAL_MODE_ |
---|
| 1113 | +#ifndef _NVP6168_USE_MANUAL_MODE_ |
---|
1137 | 1114 | unsigned char set_done=0xF0; |
---|
1138 | 1115 | #endif |
---|
1139 | | - printk("onvideo_set dev_num[%x] ch_num[%x] fmt_def[%d]", decoder_info->devnum, decoder_info->ch, decoder_info->fmt_def); |
---|
| 1116 | + printk("onvideo_set dev_num[%x] ch_num[%x] fmt_def[%d]", |
---|
| 1117 | + decoder_info->devnum, decoder_info->ch, decoder_info->fmt_def); |
---|
1140 | 1118 | |
---|
1141 | 1119 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x09); |
---|
1142 | 1120 | val_9x44 = gpio_i2c_read(nvp6158_iic_addr[devnum], 0x44); |
---|
.. | .. |
---|
1202 | 1180 | void nvp6158_video_input_manual_agc_stable_endi(decoder_dev_ch_info_s *decoder_info, int endi) |
---|
1203 | 1181 | { |
---|
1204 | 1182 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0xFF, 0x05+decoder_info->ch); |
---|
1205 | | - if( endi == 1 ) |
---|
1206 | | - { |
---|
| 1183 | + if( endi == 1 ) { |
---|
1207 | 1184 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x82, 0xff); |
---|
1208 | 1185 | printk("[DRV] MANUAL AGC STABLE ENABLE CH:[%d]\n", decoder_info->ch); |
---|
1209 | | - } |
---|
1210 | | - else |
---|
1211 | | - { |
---|
1212 | | - |
---|
| 1186 | + } else { |
---|
1213 | 1187 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x82, 0x00); |
---|
1214 | 1188 | printk("[DRV] MANUAL AGC STABLE ENABLE CH:[%d]\n", decoder_info->ch); |
---|
1215 | 1189 | } |
---|
.. | .. |
---|
1221 | 1195 | |
---|
1222 | 1196 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0xFF, 0x00); |
---|
1223 | 1197 | |
---|
1224 | | - if(cmd == 0) |
---|
1225 | | - { |
---|
| 1198 | + if(cmd == 0) { |
---|
1226 | 1199 | val_0x00 = gpio_i2c_read(nvp6158_iic_addr[decoder_info->devnum], 0x00 + decoder_info->ch); |
---|
1227 | 1200 | _SET_BIT(val_0x00, 0); |
---|
1228 | 1201 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x00 + decoder_info->ch, val_0x00); |
---|
.. | .. |
---|
1230 | 1203 | printk("[DRV] [Ch:%d] AFE Power Down ... \n", decoder_info->ch); |
---|
1231 | 1204 | |
---|
1232 | 1205 | msleep(10); |
---|
1233 | | - } |
---|
1234 | | - else if(cmd == 1) |
---|
1235 | | - { |
---|
| 1206 | + } else if(cmd == 1) { |
---|
1236 | 1207 | val_0x00 = gpio_i2c_read(nvp6158_iic_addr[decoder_info->devnum], 0x00 + decoder_info->ch); |
---|
1237 | 1208 | _CLE_BIT(val_0x00, 0); |
---|
1238 | 1209 | gpio_i2c_write(nvp6158_iic_addr[decoder_info->devnum], 0x00 + decoder_info->ch, val_0x00); |
---|
.. | .. |
---|
1251 | 1222 | max = input_arry[0]; |
---|
1252 | 1223 | min = input_arry[0]; |
---|
1253 | 1224 | |
---|
1254 | | - for(ii = 0; ii < cnt; ii++) |
---|
1255 | | - { |
---|
| 1225 | + for(ii = 0; ii < cnt; ii++) { |
---|
1256 | 1226 | max = max > input_arry[ii] ? max : input_arry[ii]; |
---|
1257 | 1227 | min = min > input_arry[ii] ? input_arry[ii] : min; |
---|
1258 | 1228 | |
---|
.. | .. |
---|
1261 | 1231 | |
---|
1262 | 1232 | result = sum - (max + min); |
---|
1263 | 1233 | |
---|
1264 | | - if(result == 0) |
---|
1265 | | - { |
---|
| 1234 | + if(result == 0) { |
---|
1266 | 1235 | return 0; |
---|
1267 | | - } |
---|
1268 | | - else |
---|
1269 | | - { |
---|
| 1236 | + } else { |
---|
1270 | 1237 | result /= ( cnt - 2 ); |
---|
1271 | 1238 | } |
---|
1272 | 1239 | |
---|
.. | .. |
---|
1285 | 1252 | |
---|
1286 | 1253 | chk1 = input_arry[0]; |
---|
1287 | 1254 | |
---|
1288 | | - for(ii = 0; ii < cnt; ii++) |
---|
1289 | | - { |
---|
| 1255 | + for(ii = 0; ii < cnt; ii++) { |
---|
1290 | 1256 | chk2 = input_arry[ii]; |
---|
1291 | 1257 | |
---|
1292 | | - if( chk1 == chk2) |
---|
1293 | | - { |
---|
| 1258 | + if( chk1 == chk2) { |
---|
1294 | 1259 | calc_array[0][inner_idx] += 1; |
---|
1295 | 1260 | calc_array[1][inner_idx] = chk1; |
---|
1296 | | - } |
---|
1297 | | - else if( chk1 != chk2 ) |
---|
1298 | | - { |
---|
1299 | | - for(ij = 0; ij < ii; ij++) |
---|
1300 | | - { |
---|
1301 | | - if( calc_array[1][ij] == chk2 ) |
---|
1302 | | - { |
---|
| 1261 | + } else if( chk1 != chk2 ) { |
---|
| 1262 | + for(ij = 0; ij < ii; ij++) { |
---|
| 1263 | + if( calc_array[1][ij] == chk2 ) { |
---|
1303 | 1264 | find_idx = ij; |
---|
1304 | 1265 | calc_array[0][find_idx] += 1; |
---|
1305 | 1266 | calc_array[1][find_idx] = chk2; |
---|
.. | .. |
---|
1309 | 1270 | need_update = 1; |
---|
1310 | 1271 | } |
---|
1311 | 1272 | |
---|
1312 | | - if(need_update) |
---|
1313 | | - { |
---|
| 1273 | + if(need_update) { |
---|
1314 | 1274 | inner_idx += 1; |
---|
1315 | 1275 | calc_array[0][inner_idx] += 1; |
---|
1316 | 1276 | calc_array[1][inner_idx] = chk2; |
---|
1317 | 1277 | } |
---|
1318 | 1278 | } |
---|
1319 | | - |
---|
1320 | 1279 | chk1 = chk2; |
---|
1321 | 1280 | } |
---|
1322 | 1281 | |
---|
1323 | 1282 | max = calc_array[0][0]; |
---|
1324 | 1283 | |
---|
1325 | | - for(ii = 0; ii < cnt; ii++) |
---|
1326 | | - { |
---|
1327 | | - if( max < calc_array[0][ii] ) |
---|
1328 | | - { |
---|
| 1284 | + for(ii = 0; ii < cnt; ii++) { |
---|
| 1285 | + if( max < calc_array[0][ii] ) { |
---|
1329 | 1286 | max_idx = ii; |
---|
1330 | 1287 | max = calc_array[0][ii]; |
---|
1331 | 1288 | } |
---|
1332 | 1289 | } |
---|
1333 | 1290 | |
---|
1334 | 1291 | |
---|
1335 | | - for(ii = 0; ii < cnt; ii++) |
---|
1336 | | - { |
---|
| 1292 | + for(ii = 0; ii < cnt; ii++) { |
---|
1337 | 1293 | printk("[DRV] [ idx %d ] [ num %d ] [ val %x ]\n", ii, calc_array[0][ii], calc_array[1][ii]); |
---|
1338 | 1294 | } |
---|
1339 | 1295 | |
---|
.. | .. |
---|
1360 | 1316 | |
---|
1361 | 1317 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x05 + ch); |
---|
1362 | 1318 | |
---|
1363 | | - for(ii = 0; ii < check_time; ii++) |
---|
1364 | | - { |
---|
| 1319 | + for(ii = 0; ii < check_time; ii++) { |
---|
1365 | 1320 | msleep(100); |
---|
1366 | | - B5xF5_F4[ii] = ( gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF5) << 8 ) | gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF4); |
---|
| 1321 | + B5xF5_F4[ii] = ( gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF5) << 8 ) | |
---|
| 1322 | + gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF4); |
---|
1367 | 1323 | printk("[DRV] [Ch:%d] %d time B5xF3_F4 : %x \n", ch, ii, B5xF5_F4[ii]); |
---|
1368 | 1324 | } |
---|
1369 | 1325 | |
---|
1370 | 1326 | check_point = __nvp6158_s_distinguish_5M_ahd_tvi_func( B5xF5_F4, check_time ); |
---|
1371 | 1327 | |
---|
1372 | | - if( fmtdef == AHD30_5M_20P ) |
---|
1373 | | - { |
---|
1374 | | - if( ( check_point & 0xfff ) == 0x7c2) |
---|
1375 | | - { |
---|
| 1328 | + if( fmtdef == AHD30_5M_20P ) { |
---|
| 1329 | + if( ( check_point & 0xfff ) == 0x7c2) { |
---|
1376 | 1330 | decoder_info->fmt_def = TVI_5M_20P; |
---|
1377 | 1331 | printk("[DRV] [Ch:%d] Get Format : AHD 5M 20P, Change Format : TVI 5M 20P\n", decoder_info->ch); |
---|
1378 | | - } |
---|
1379 | | - else if( ( check_point & 0xfff ) == 0x7c4) |
---|
1380 | | - { |
---|
| 1332 | + } else if( ( check_point & 0xfff ) == 0x7c4) { |
---|
1381 | 1333 | decoder_info->fmt_def = CVI_5M_20P; |
---|
1382 | 1334 | printk("[DRV] [Ch:%d] Get Format : AHD 5M 20P, Change Format : CVI 5M 20P\n", decoder_info->ch); |
---|
1383 | | - } |
---|
1384 | | - else |
---|
1385 | | - { |
---|
| 1335 | + } else { |
---|
1386 | 1336 | |
---|
1387 | 1337 | printk("[DRV] [Ch:%d] Get Format : AHD 5M 20P, Not Change Format\n", decoder_info->ch); |
---|
1388 | 1338 | } |
---|
1389 | | - } |
---|
1390 | | - else if( fmtdef == 0x2B) |
---|
1391 | | - { |
---|
1392 | | - if( ( check_point & 0xfff ) >= 0x673) |
---|
1393 | | - { |
---|
| 1339 | + } else if( fmtdef == 0x2B) { |
---|
| 1340 | + if( ( check_point & 0xfff ) >= 0x673) { |
---|
1394 | 1341 | decoder_info->fmt_def = TVI_4M_15P; |
---|
1395 | 1342 | printk("[DRV] [Ch:%d] Get Format : AHD 4M15P #0P, Change Format : TVI 4M 15P\n", decoder_info->ch); |
---|
1396 | 1343 | } |
---|
1397 | | - } |
---|
1398 | | - else |
---|
1399 | | - { |
---|
| 1344 | + } else { |
---|
1400 | 1345 | decoder_info->fmt_def = fmtdef; |
---|
1401 | 1346 | } |
---|
1402 | 1347 | |
---|
.. | .. |
---|
1464 | 1409 | |
---|
1465 | 1410 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x05 + ch); |
---|
1466 | 1411 | |
---|
1467 | | - for(ii = 0; ii < check_time; ii++) |
---|
1468 | | - { |
---|
| 1412 | + for(ii = 0; ii < check_time; ii++) { |
---|
1469 | 1413 | msleep(100); |
---|
1470 | | - B5xF5_F4[ii] = ( gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF5) << 8 ) | gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF4); |
---|
| 1414 | + B5xF5_F4[ii] = ( gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF5) << 8 ) | |
---|
| 1415 | + gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF4); |
---|
1471 | 1416 | printk("[DRV] [Ch:%d] %d time B5xF3_F4 : %x \n", ch, ii, B5xF5_F4[ii]); |
---|
1472 | 1417 | } |
---|
1473 | 1418 | |
---|
1474 | 1419 | check_point = __nvp6158_s_distinguish_5M_ahd_tvi_func( B5xF5_F4, check_time ); |
---|
1475 | 1420 | |
---|
1476 | | - if( ( check_point & 0xfff ) == 0x7c4) |
---|
1477 | | - { |
---|
| 1421 | + if( ( check_point & 0xfff ) == 0x7c4) { |
---|
1478 | 1422 | decoder_info->fmt_def = CVI_5M_20P; |
---|
1479 | 1423 | printk("[DRV] [Ch:%d] Get Format : AHD 5M 20P, Change Format : CVI 5M 20P\n", decoder_info->ch); |
---|
1480 | | - } |
---|
1481 | | - else |
---|
1482 | | - { |
---|
| 1424 | + } else { |
---|
1483 | 1425 | |
---|
1484 | 1426 | decoder_info->fmt_def = TVI_5M_20P; |
---|
1485 | 1427 | printk("[DRV] [Ch:%d] Get Format : AHD 5M 20P, Change Format : TVI 5M 20P\n", decoder_info->ch); |
---|
.. | .. |
---|
1500 | 1442 | |
---|
1501 | 1443 | chk1 = input_arry[0]; |
---|
1502 | 1444 | |
---|
1503 | | - for(ii = 0; ii < cnt; ii++) |
---|
1504 | | - { |
---|
| 1445 | + for(ii = 0; ii < cnt; ii++) { |
---|
1505 | 1446 | chk2 = input_arry[ii]; |
---|
1506 | 1447 | |
---|
1507 | | - if( chk1 == chk2) |
---|
1508 | | - { |
---|
| 1448 | + if( chk1 == chk2) { |
---|
1509 | 1449 | calc_array[0][inner_idx] += 1; |
---|
1510 | 1450 | calc_array[1][inner_idx] = chk1; |
---|
1511 | | - } |
---|
1512 | | - else if( chk1 != chk2 ) |
---|
1513 | | - { |
---|
1514 | | - for(ij = 0; ij < ii; ij++) |
---|
1515 | | - { |
---|
1516 | | - if( calc_array[1][ij] == chk2 ) |
---|
1517 | | - { |
---|
| 1451 | + } else if( chk1 != chk2 ) { |
---|
| 1452 | + for(ij = 0; ij < ii; ij++) { |
---|
| 1453 | + if( calc_array[1][ij] == chk2 ) { |
---|
1518 | 1454 | find_idx = ij; |
---|
1519 | 1455 | calc_array[0][find_idx] += 1; |
---|
1520 | 1456 | calc_array[1][find_idx] = chk2; |
---|
.. | .. |
---|
1524 | 1460 | need_update = 1; |
---|
1525 | 1461 | } |
---|
1526 | 1462 | |
---|
1527 | | - if(need_update) |
---|
1528 | | - { |
---|
| 1463 | + if(need_update) { |
---|
1529 | 1464 | inner_idx += 1; |
---|
1530 | 1465 | calc_array[0][inner_idx] += 1; |
---|
1531 | 1466 | calc_array[1][inner_idx] = chk2; |
---|
1532 | 1467 | } |
---|
1533 | 1468 | } |
---|
1534 | | - |
---|
1535 | 1469 | chk1 = chk2; |
---|
1536 | 1470 | } |
---|
1537 | 1471 | |
---|
1538 | 1472 | max = calc_array[0][0]; |
---|
1539 | 1473 | |
---|
1540 | | - for(ii = 0; ii < cnt; ii++) |
---|
1541 | | - { |
---|
1542 | | - if( max < calc_array[0][ii] ) |
---|
1543 | | - { |
---|
| 1474 | + for(ii = 0; ii < cnt; ii++) { |
---|
| 1475 | + if( max < calc_array[0][ii] ) { |
---|
1544 | 1476 | max_idx = ii; |
---|
1545 | 1477 | max = calc_array[0][ii]; |
---|
1546 | 1478 | } |
---|
1547 | 1479 | } |
---|
1548 | 1480 | |
---|
1549 | 1481 | |
---|
1550 | | - for(ii = 0; ii < cnt; ii++) |
---|
1551 | | - { |
---|
| 1482 | + for(ii = 0; ii < cnt; ii++) { |
---|
1552 | 1483 | printk("[DRV] [ idx %d ] [ num %d ] [ val %x ]\n", ii, calc_array[0][ii], calc_array[1][ii]); |
---|
1553 | 1484 | } |
---|
1554 | 1485 | |
---|
.. | .. |
---|
1573 | 1504 | |
---|
1574 | 1505 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x13); |
---|
1575 | 1506 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0x2B, ch % 4 ); |
---|
1576 | | - |
---|
1577 | | - for(ii = 0; ii < check_time; ii++) |
---|
1578 | | - { |
---|
| 1507 | + |
---|
| 1508 | + for(ii = 0; ii < check_time; ii++) { |
---|
1579 | 1509 | msleep(100); |
---|
1580 | 1510 | B13xAB[ii] = gpio_i2c_read(nvp6158_iic_addr[devnum], 0xAB); |
---|
1581 | | - if(B13xAB[ii] == 0) |
---|
1582 | | - { |
---|
| 1511 | + if(B13xAB[ii] == 0) { |
---|
1583 | 1512 | B13xAB_zerocnt ++; |
---|
1584 | 1513 | } |
---|
1585 | 1514 | printk("[DRV] [Ch:%d] %d time B13xAB : %x \n", ch, ii, B13xAB[ii]); |
---|
.. | .. |
---|
1590 | 1519 | |
---|
1591 | 1520 | check_point = __nvp6158_s_distinguish_8M_cvi_tvi_func( B13xAB, check_time ); |
---|
1592 | 1521 | |
---|
1593 | | - if( fmtdef == CVI_8M_15P || fmtdef == CVI_8M_12_5P ) |
---|
1594 | | - { |
---|
1595 | | - if( ( check_point & 0xff ) > 0x1A ) |
---|
1596 | | - { |
---|
1597 | | - if( fmtdef == CVI_8M_12_5P ) |
---|
1598 | | - { |
---|
| 1522 | + if( fmtdef == CVI_8M_15P || fmtdef == CVI_8M_12_5P ) { |
---|
| 1523 | + if( ( check_point & 0xff ) > 0x1A ) { |
---|
| 1524 | + if( fmtdef == CVI_8M_12_5P ) { |
---|
1599 | 1525 | decoder_info->fmt_def = TVI_8M_12_5P; |
---|
1600 | 1526 | printk("[DRV] [Ch:%d] Get Format : CVI 8M 12_5P, Change Format : TVI 8M 12_5P\n", decoder_info->ch); |
---|
1601 | | - } |
---|
1602 | | - else |
---|
1603 | | - { |
---|
| 1527 | + } else { |
---|
1604 | 1528 | decoder_info->fmt_def = TVI_8M_15P; |
---|
1605 | 1529 | printk("[DRV] [Ch:%d] Get Format : CVI 8M 15P, Change Format : TVI 8M 15P\n", decoder_info->ch); |
---|
1606 | 1530 | } |
---|
1607 | | - } |
---|
1608 | | - else |
---|
1609 | | - { |
---|
| 1531 | + } else { |
---|
1610 | 1532 | printk("[DRV] [Ch:%d] Get Format : CVI 8M, Not Change Format\n", decoder_info->ch); |
---|
1611 | 1533 | } |
---|
1612 | | - } |
---|
1613 | | - else |
---|
1614 | | - { |
---|
| 1534 | + } else { |
---|
1615 | 1535 | decoder_info->fmt_def = fmtdef; |
---|
1616 | 1536 | } |
---|
1617 | 1537 | return 0; |
---|
.. | .. |
---|
1629 | 1549 | |
---|
1630 | 1550 | chk1 = input_arry[0]; |
---|
1631 | 1551 | |
---|
1632 | | - for(ii = 0; ii < cnt; ii++) |
---|
1633 | | - { |
---|
| 1552 | + for(ii = 0; ii < cnt; ii++) { |
---|
1634 | 1553 | chk2 = input_arry[ii]; |
---|
1635 | 1554 | |
---|
1636 | | - if( chk1 == chk2) |
---|
1637 | | - { |
---|
| 1555 | + if( chk1 == chk2) { |
---|
1638 | 1556 | calc_array[0][inner_idx] += 1; |
---|
1639 | 1557 | calc_array[1][inner_idx] = chk1; |
---|
1640 | | - } |
---|
1641 | | - else if( chk1 != chk2 ) |
---|
1642 | | - { |
---|
1643 | | - for(ij = 0; ij < ii; ij++) |
---|
1644 | | - { |
---|
1645 | | - if( calc_array[1][ij] == chk2 ) |
---|
1646 | | - { |
---|
| 1558 | + } else if( chk1 != chk2 ) { |
---|
| 1559 | + for(ij = 0; ij < ii; ij++) { |
---|
| 1560 | + if( calc_array[1][ij] == chk2 ) { |
---|
1647 | 1561 | find_idx = ij; |
---|
1648 | 1562 | calc_array[0][find_idx] += 1; |
---|
1649 | 1563 | calc_array[1][find_idx] = chk2; |
---|
.. | .. |
---|
1653 | 1567 | need_update = 1; |
---|
1654 | 1568 | } |
---|
1655 | 1569 | |
---|
1656 | | - if(need_update) |
---|
1657 | | - { |
---|
| 1570 | + if(need_update) { |
---|
1658 | 1571 | inner_idx += 1; |
---|
1659 | 1572 | calc_array[0][inner_idx] += 1; |
---|
1660 | 1573 | calc_array[1][inner_idx] = chk2; |
---|
1661 | 1574 | } |
---|
1662 | 1575 | } |
---|
1663 | | - |
---|
1664 | 1576 | chk1 = chk2; |
---|
1665 | 1577 | } |
---|
1666 | 1578 | |
---|
1667 | 1579 | max = calc_array[0][0]; |
---|
1668 | 1580 | |
---|
1669 | | - for(ii = 0; ii < cnt; ii++) |
---|
1670 | | - { |
---|
1671 | | - if( max < calc_array[0][ii] ) |
---|
1672 | | - { |
---|
| 1581 | + for(ii = 0; ii < cnt; ii++) { |
---|
| 1582 | + if( max < calc_array[0][ii] ) { |
---|
1673 | 1583 | max_idx = ii; |
---|
1674 | 1584 | max = calc_array[0][ii]; |
---|
1675 | 1585 | } |
---|
1676 | 1586 | } |
---|
1677 | 1587 | |
---|
1678 | 1588 | |
---|
1679 | | - for(ii = 0; ii < cnt; ii++) |
---|
1680 | | - { |
---|
| 1589 | + for(ii = 0; ii < cnt; ii++) { |
---|
1681 | 1590 | printk("[DRV] [ idx %d ] [ num %d ] [ val %x ]\n", ii, calc_array[0][ii], calc_array[1][ii]); |
---|
1682 | 1591 | } |
---|
1683 | 1592 | |
---|
.. | .. |
---|
1701 | 1610 | |
---|
1702 | 1611 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x05 + ch); |
---|
1703 | 1612 | |
---|
1704 | | - for(ii = 0; ii < check_time; ii++) |
---|
1705 | | - { |
---|
| 1613 | + for(ii = 0; ii < check_time; ii++) { |
---|
1706 | 1614 | msleep(30); |
---|
1707 | 1615 | B5xF3[ii] = gpio_i2c_read(nvp6158_iic_addr[devnum], 0xF3); |
---|
1708 | 1616 | printk("[DRV] [Ch:%d] %d time B5xF3 : %x \n", ch, ii, B5xF3[ii]); |
---|
.. | .. |
---|
1710 | 1618 | |
---|
1711 | 1619 | check_point = __nvp6158_s_distinguish_ahd_nrt_func( B5xF3, check_time ); |
---|
1712 | 1620 | |
---|
1713 | | - if( ( check_point & 0xff ) == 0x14 ) |
---|
1714 | | - { |
---|
| 1621 | + if( ( check_point & 0xff ) == 0x14 ) { |
---|
1715 | 1622 | decoder_info->fmt_def = AHD20_1080P_12_5P_EX; |
---|
1716 | 1623 | printk("[DRV] [Ch:%d] Get Format : AHD 1080P 12.5P\n", decoder_info->ch); |
---|
1717 | | - } |
---|
1718 | | - else if( ( check_point & 0xff ) == 0x11 ) |
---|
1719 | | - { |
---|
| 1624 | + } else if( ( check_point & 0xff ) == 0x11 ) { |
---|
1720 | 1625 | decoder_info->fmt_def = AHD20_1080P_15P_EX; |
---|
1721 | 1626 | printk("[DRV] [Ch:%d] Get Format : AHD 1080P 15P\n", decoder_info->ch); |
---|
1722 | | - } |
---|
1723 | | - else |
---|
1724 | | - { |
---|
| 1627 | + } else { |
---|
1725 | 1628 | decoder_info->fmt_def = NC_VIVO_CH_FORMATDEF_UNKNOWN; |
---|
1726 | 1629 | printk("[DRV] [Ch:%d] Get Format : Unknown Format \n", decoder_info->ch); |
---|
1727 | 1630 | } |
---|
.. | .. |
---|
1739 | 1642 | |
---|
1740 | 1643 | chk1 = input_arry[0]; |
---|
1741 | 1644 | |
---|
1742 | | - for(ii = 0; ii < cnt; ii++) |
---|
1743 | | - { |
---|
| 1645 | + for(ii = 0; ii < cnt; ii++) { |
---|
1744 | 1646 | chk2 = input_arry[ii]; |
---|
1745 | 1647 | |
---|
1746 | | - if( chk1 == chk2) |
---|
1747 | | - { |
---|
| 1648 | + if( chk1 == chk2) { |
---|
1748 | 1649 | calc_array[0][inner_idx] += 1; |
---|
1749 | 1650 | calc_array[1][inner_idx] = chk1; |
---|
1750 | | - } |
---|
1751 | | - else if( chk1 != chk2 ) |
---|
1752 | | - { |
---|
1753 | | - for(ij = 0; ij < ii; ij++) |
---|
1754 | | - { |
---|
1755 | | - if( calc_array[1][ij] == chk2 ) |
---|
1756 | | - { |
---|
| 1651 | + } else if( chk1 != chk2 ) { |
---|
| 1652 | + for(ij = 0; ij < ii; ij++) { |
---|
| 1653 | + if( calc_array[1][ij] == chk2 ) { |
---|
1757 | 1654 | find_idx = ij; |
---|
1758 | 1655 | calc_array[0][find_idx] += 1; |
---|
1759 | 1656 | calc_array[1][find_idx] = chk2; |
---|
.. | .. |
---|
1763 | 1660 | need_update = 1; |
---|
1764 | 1661 | } |
---|
1765 | 1662 | |
---|
1766 | | - if(need_update) |
---|
1767 | | - { |
---|
| 1663 | + if(need_update) { |
---|
1768 | 1664 | inner_idx += 1; |
---|
1769 | 1665 | calc_array[0][inner_idx] += 1; |
---|
1770 | 1666 | calc_array[1][inner_idx] = chk2; |
---|
.. | .. |
---|
1776 | 1672 | |
---|
1777 | 1673 | max = calc_array[0][0]; |
---|
1778 | 1674 | |
---|
1779 | | - for(ii = 0; ii < cnt; ii++) |
---|
1780 | | - { |
---|
1781 | | - if( max < calc_array[0][ii] ) |
---|
1782 | | - { |
---|
| 1675 | + for(ii = 0; ii < cnt; ii++) { |
---|
| 1676 | + if( max < calc_array[0][ii] ) { |
---|
1783 | 1677 | max_idx = ii; |
---|
1784 | 1678 | max = calc_array[0][ii]; |
---|
1785 | 1679 | } |
---|
1786 | 1680 | } |
---|
1787 | 1681 | |
---|
1788 | 1682 | |
---|
1789 | | - for(ii = 0; ii < cnt; ii++) |
---|
1790 | | - { |
---|
| 1683 | + for(ii = 0; ii < cnt; ii++) { |
---|
1791 | 1684 | printk("[DRV] [ idx %d ] [ num %d ] [ val %x ]\n", ii, calc_array[0][ii], calc_array[1][ii]); |
---|
1792 | 1685 | } |
---|
1793 | 1686 | |
---|
.. | .. |
---|
1812 | 1705 | |
---|
1813 | 1706 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0xFF, 0x13); |
---|
1814 | 1707 | gpio_i2c_write(nvp6158_iic_addr[devnum], 0x2B, ch % 4 ); |
---|
1815 | | - |
---|
1816 | | - for(ii = 0; ii < check_time; ii++) |
---|
1817 | | - { |
---|
| 1708 | + |
---|
| 1709 | + for(ii = 0; ii < check_time; ii++) { |
---|
1818 | 1710 | msleep(100); |
---|
1819 | 1711 | B13xAB[ii] = gpio_i2c_read(nvp6158_iic_addr[devnum], 0xAB); |
---|
1820 | 1712 | printk("[DRV] [Ch:%d] %d time B13xAB : %x \n", ch, ii, B13xAB[ii]); |
---|
.. | .. |
---|
1822 | 1714 | |
---|
1823 | 1715 | check_point = __nvp6158_s_distinguish_2M_cvi_ahd_func( B13xAB, check_time ); |
---|
1824 | 1716 | |
---|
1825 | | - if( fmtdef == CVI_FHD_25P ) |
---|
1826 | | - { |
---|
1827 | | - if( ( check_point & 0xff ) <= 0x09 ) |
---|
1828 | | - { |
---|
1829 | | - |
---|
| 1717 | + if( fmtdef == CVI_FHD_25P ) { |
---|
| 1718 | + if( ( check_point & 0xff ) <= 0x09 ) { |
---|
| 1719 | + |
---|
1830 | 1720 | decoder_info->fmt_def = AHD20_1080P_25P; |
---|
1831 | 1721 | printk("[DRV] [Ch:%d] Get Format : CVI 2M 25P, Change Format : AHD 2M 25P\n", decoder_info->ch); |
---|
1832 | | - } |
---|
1833 | | - else |
---|
1834 | | - { |
---|
| 1722 | + } else { |
---|
1835 | 1723 | printk("[DRV] [Ch:%d] Get Format : CVI 2M, Not Change Format\n", decoder_info->ch); |
---|
1836 | 1724 | } |
---|
1837 | | - } |
---|
1838 | | - else |
---|
1839 | | - { |
---|
| 1725 | + } else { |
---|
1840 | 1726 | decoder_info->fmt_def = fmtdef; |
---|
1841 | 1727 | } |
---|
1842 | 1728 | } |
---|