diff --git a/package/mediactl_lib/src/config/sc035hgs.conf b/package/mediactl_lib/src/config/sc035hgs.conf new file mode 100644 index 0000000..8d95722 --- /dev/null +++ b/package/mediactl_lib/src/config/sc035hgs.conf @@ -0,0 +1,533 @@ +{ + "isp_general":{ + "isp_out_sel":0, + "dvp_ch_mode":1, + "hist_3a_out_en":0, + "main_out":{ + "out_img_format":1, + "out_yuv_in_format":0, + "out_yuv422_pxl_order":0, + "out_pxl_width":0, + "out_frame_buf_size":2048 + }, + "out0":{ + "ds0_out_img_format":1, + "ds0_out_yuv_in_format":0, + "ds0_out_yuv422_pxl_order":0, + "ds0_out_pxl_width":0, + "ds0_frame_buf_size":2048 + }, + "out1":{ + "ds1_out_img_format":1, + "ds1_out_yuv_in_format":0, + "ds1_out_yuv422_pxl_order":0, + "ds1_out_pxl_width":0, + "ds1_frame_buf_size":2048 + }, + "out2":{ + "ds2_out_img_format":0, + "ds2_out_yuv_in_format":0, + "ds2_out_yuv422_pxl_order":0, + "ds2_out_pxl_width":0, + "ds2_frame_buf_size":2048 + }, + "wdr":{ + "wdr_mode":0, + "wdr_long_ch_mode":0, + "wdr_long_l2_buf_en":0, + "wdr_short_s1_buf_en":0, + "wdr_dynamic_switch_en":0, + "wdr_long_l2_buf_depth":0, + "wdr_long_img_format":0, + "wdr_long_yuv_in_format":0, + "wdr_long_img_out_format":0, + "wdr_long_yuv422_pxl_order":0, + "wdr_long_pixel_width":2, + "wdr_buf_base":0, + "wdr_line_stride":0, + "wdr_frame_buf_size":0 + }, + "nr3d":{ + "nr3d_en":0, + "nr3d_fbcd_en":0, + "nr3d_mv_out_en":0, + "nr3d_y_img_format":0, + "nr3d_y_yuv_in_format":0, + "nr3d_y_img_out_format":0, + "nr3d_y_yuv422_pxl_order":0, + "nr3d_y_pixel_width":2, + "nr3d_uv_img_format":0, + "nr3d_uv_yuv_in_format":0, + "nr3d_uv_mig_out_format":0, + "nr3d_uv_yuv422_pxl_order":0, + "nr3d_uv_pixel_width":2, + "nr3d_frame_buf_size":0 + }, + "ldc":{ + "ldc_line_stride":2048, + "ldc_frame_buf_size":2048 + } + }, + "isp_core": { + "itc": { + "hsync_pol":0, + "vsync_pol":0, + "hsync_input_timing":2, + "vsync_input_timing":1, + "flip_ctl" :0, + "video_fmt_sl":0, + "itc_ttl_h" :852, + "itc_ttl_v" :1056, + "itc_stt_hr" :0, + "itc_stt_vr" :1, + "itc_width_in":640, + "itc_height_in":480 + }, + "tpg": { + "tpg_en":0, + "bayer_mode_sel":3, + "motion_mode_sel":0, + "tpg_sel":9, + "wdr_l_mul_data":0, + "wdr_m_mul_data":0, + "wdr_s_mul_data":0 + }, + "blc":{ + "blc_en" :1, + "blc_offset" :240, + "blc_ratio" :272 + }, + "lsc":{ + "lsc_en" :0, + "lsc_h_center" :900, + "lsc_v_center" :580, + "lsc_r_ratio" :8, + "lsc_g_ratio":6, + "lsc_b_ratio" :6, + "lsc_ir_ratio" :6 + }, + "ae":{ + "ae_as_en" :1, + "ae_ag_en" :1, + "ae_airis_en" :0, + "ae_enter_ls_sel" :0, + "ae_exit_ls_sel" :0, + "ae_win_mode_sel" :0, + "ae_back_light_mode_sel" :2, + "ae_day_change_en" :0, + "ae_day_change_sel" :0, + "ae_win_stth" :0, + "ae_win_sttv" :0, + "ae_win_endh" :639, + "ae_win_endv" :479, + "ae_yobj" :50, + "ae_av_rg" :14, + "ae_l_ex_time" :1000, + "ae_m_ex_time" :32, + "ae_s_ex_time" :32, + "ae_agc" :256, + "ae_ad_shuttle_freq" :1, + "ae_ad_gain_freq" :1, + "ae_adjust_step_max":6, + "ae_ex_value_max" :1050, + "ae_ex_value_mid" :256, + "ae_ex_value_min" :1, + "ae_gain_value_max" :3968, + "ae_gain_value_mid" :512, + "ae_gain_value_min" :256, + "ae_dn_switch_ad_step_max" :512, + "ae_dn_switch_wait_time" :255, + "ape_max_diff" :12, + "ape_drv_signal_max" :3840, + "ape_coeff_distance" :0, + "ape_coeff_speed" :0, + "ape_coeff_acceleration" :0, + "ape_drv_manual_value" :4095, + "ape_damp_manual_value" :2048 + }, + "awb":{ + "awb_d65_en" :0, + "awb_ccm_en" :0, + "awb_en" :0, + "awb_mode_sel" :0, + "awb_hist_mode_sel" :0, + "awb_veri_en" :0, + "awb_fb_en" :0, + "awb_value_save_en" :0, + "awb_ccm_adp_adjust_en" :0, + "awb_stab_en" :1, + "awb_d65_red_gain" :256, + "awb_d65_blue_gain" :256, + "ccm_rr" :256, + "ccm_rg" :0, + "ccm_rb" :0, + "ccm_gr" :0, + "ccm_gg" :256, + "ccm_gb" :0, + "ccm_br" :0, + "ccm_bg" :0, + "ccm_bb" :256, + "ccm_correct_coff" :256, + "awb_win_stth" :0, + "awb_win_sttv" :0, + "awb_win_endh" :1919, + "awb_win_endv" :1079, + "awb_correct_diff_th" :8, + "awb_color_changeres_time" :8, + "awb_historgram_th" :4, + "awb_red_gain_adjust" :256, + "awb_green_gain_adjust" :256, + "awb_blue_gain_adjust" :256, + "awb_red_max_value" :240, + "awb_blue_max_value" :379, + "awb_red_min_value" :176, + "awb_blue_min_value" :281, + "awb_red_obj_value" :256, + "awb_blue_obj_value" :256 + }, + "wdr":{ + "wdr_fusion_en" :0, + "wdr_frame_sel" :0, + "wdr_adp_adjust_en" :0, + "wdr_stab_en" :0, + "wdr_en" :0, + "wdr_ghost_remove_en" :0, + "wdr_3frame_out_mode" :0, + "wdr_mode_sel" :0, + "wdr_2frame_ex_ratio" :1, + "wdr_3frame_ex_ratio" :1, + "wdr_stat_img_sel" :0, + "wdr_ltm_data_sel" :1, + "wdr_tz_data_sel" :1, + "wdr_remove_purple_en" :0, + "wdr_over_ex_ratio_th1" :384, + "wdr_over_ex_ratio_th2" :32, + "wdr_fusion_ratio_th" :192, + "wdr_fusion_value1" :64, + "wdr_fusion_value2" :16 + }, + "csc":{ + "rgb2yuv_00":153, + "rgb2yuv_01":256, + "rgb2yuv_02":86, + "rgb2yuv_10":301, + "rgb2yuv_11":214, + "rgb2yuv_12":170, + "rgb2yuv_20":58, + "rgb2yuv_21":42, + "rgb2yuv_22":256 + }, + "ada":{ + "gm_rgb_en" :1, + "gm_yuv_en" :0, + "ada_en" :1, + "ada_sbz_en" :0, + "ada_ccr_en" :0, + "ada_adp_en" :0, + "ada_adp_ccr_en" :0, + "ada_stat_mode_sel" :0, + "ada_enh_mode_sel" :0, + "ada_hist_max" :128, + "ada_ttl_max" :255, + "ada_win_stth" :0, + "ada_win_sttv" :0, + "ada_win_endh" :1919, + "ada_win_endv" :1079 + }, + "rgb-ir":{ + "raw_fmt" :0, + "rgbir_rct_en" :0, + "dfc_en" :0, + "rgbir_fs_en" :0, + "rgbir_ot_sl" :0, + "rgbir_fs_max" :256, + "dfc_krb" :0, + "dfc_ky" :0, + "dfc_th" :256, + "dfc_th_1" :256 + }, + "2dnr":{ + "dpeak_en" :1, + "nr2d_raw_en" :1, + "nr2d_eg_en" :1, + "nr2d_jl_en" :1, + "nr2d_av_en" :1, + "nr2d_c_en" :0, + "dpeak_adp_en" :0, + "nr2d_raw_adp_en":0, + "nr2d_y_adp_en" :0, + "nr2d_c_adp_en" :0, + "nr2d_raw_kl" :12, + "nr2d_jl_th" :128, + "nr2d_eg_k" :24, + "nr2d_y_k" :16, + "nr2d_c_k" :1 + }, + "3dnr":{ + "nr3d_en" :1, + "nr3dp_y_en" :1, + "nr3dp_c_en" :0, + "nr3dm_y_en" :1, + "nr3dm_c_en" :0, + "nr3db_y_en" :1, + "nr3db_c_en" :0, + "nr3dm_nr2d_y_en" :1, + "nr3dm_nr2d_c_en" :0, + "core_3dnr_wb_en" :1, + "core_3dnr_wb_sel" :1, + "core_3dnr_adp_luma_en" :0, + "core_3dnr_adp_chroma_en" :0, + "nr3dp_thy" :64, + "nr3dp_thyp" :64, + "nr3dp_thcp" :64, + "nr3dm_mid_th" :128, + "nr3dm_mtp_th" :8, + "nr3dm_mtc_th" :128, + "nr3dm_ym_k" :60, + "nr3dm_thy" :64, + "nr3dm_min" :0, + "nr3dm_thw0" :128, + "core_3dnr_chroma_intensity" :16, + "nr3db_nr2d_eg_th" :64, + "nr3db_thyp" :64, + "nr3db_thcp" :32 + }, + "enh":{ + "ltm":{ + "enh_ltm_en" :1, + "enh_adp_ltm_en" :0, + "ltm_gain" :128, + "ltm_mm_th" :128 + }, + "sharp":{ + "enh_sharp_en" :1, + "enh_adp_sharp_en" :0, + "shp_core" :8, + "shp_th1" :3840, + "shp_th2" :4095, + "shp_gain" :64 + }, + "cc":{ + "enh_cc_en" :0, + "enh_adp_cc_en" :0 + } + }, + "post_ctl":{ + "otc_ctl":{ + "otc_en" :0, + "otc_yc_sl" :0, + "otc_uv_sl" :1, + "otc_hs_plt_sl" :0, + "otc_vs_plt_sl" :0, + "otc_stt_vr" :0, + "otc_stt_hr" :0 + }, + "ctrst":{ + "ctrst_en" :1, + "ctrst_gain":128 + }, + "luma":{ + "luma_en" :1, + "luma_gain":128 + }, + "strt":{ + "strt_en" :1, + "strt_gain":0 + } + }, + "ldc":{ + "ldc_en" :0, + "ldc_rct_en" :0, + "ldc_rq_frq" :128, + "ldc_stt_ln" :540, + "ldc_ch" :960, + "ldc_cv" :540, + "ldc_cr" :684, + "ldc_cz" :684 + }, + "af":{ + "af_stat_en" :1, + "af_stat_mode_sel" :0, + "af_stat_win_h_start":0, + "af_stat_win_v_start":0, + "af_stat_win_h_end" :1919, + "af_stat_win_v_end" :1079 + } + }, + "isp_post":{ + "rgb2yuv":{ + "osd_rgb2yuv_coeff00":306, + "osd_rgb2yuv_coeff01":601, + "osd_rgb2yuv_coeff02":117, + "osd_rgb2yuv_coeff03":0, + "osd_rgb2yuv_coeff10":3920, + "osd_rgb2yuv_coeff11":3749, + "osd_rgb2yuv_coeff12":523, + "osd_rgb2yuv_coeff13":128, + "osd_rgb2yuv_coeff20":523, + "osd_rgb2yuv_coeff21":3658, + "osd_rgb2yuv_coeff22":4011, + "osd_rgb2yuv_coeff23":128 + }, + "yuv2rgb":{ + "out_yuv2rgb_coeff00":1024, + "out_yuv2rgb_coeff01":0, + "out_yuv2rgb_coeff02":1441, + "out_yuv2rgb_coeff03":3916, + "out_yuv2rgb_coeff10":1024, + "out_yuv2rgb_coeff11":3742, + "out_yuv2rgb_coeff12":3362, + "out_yuv2rgb_coeff13":136, + "out_yuv2rgb_coeff20":1024, + "out_yuv2rgb_coeff21":1822, + "out_yuv2rgb_coeff22":0, + "out_yuv2rgb_coeff23":3868 + }, + "ds0":{ + "ds0_out_rgb_mode":0, + "ds0_out_rgb_en":0, + "ds0_out_yuv_mode":0, + "ds0_out_uv_swap":0, + "ds0_osd0":{ + "ds0_osd0_enable":0, + "ds0_osd0_type":0, + "ds0_osd0_alpha_tpye":0, + "ds0_osd0_vst":0, + "ds0_osd0_hst":0, + "ds0_osd0_vend":0, + "ds0_osd0_hend":0, + "ds0_osd0_dma_request_length":0, + "ds0_osd0_dma_map":0, + "ds0_osd0_rgb_rev":0, + "ds0_osd0_global_alpha":0, + "ds0_osd0_swap_64":0, + "ds0_osd0_outstanding_num":0, + "ds0_osd0_bd_limit_en":0 + }, + "ds0_osd1":{ + "ds0_osd1_enable":0, + "ds0_osd1_type":0, + "ds0_osd1_alpha_tpye":0, + "ds0_osd1_vst":0, + "ds0_osd1_hst":0, + "ds0_osd1_vend":0, + "ds0_osd1_hend":0, + "ds0_osd1_dma_request_length":0, + "ds0_osd1_dma_map":0, + "ds0_osd1_rgb_rev":0, + "ds0_osd1_global_alpha":0, + "ds0_osd1_swap_64":0, + "ds0_osd1_outstanding_num":0, + "ds0_osd1_bd_limit_en":0 + }, + "ds0_osd2":{ + "ds0_osd2_enable":0, + "ds0_osd2_type":0, + "ds0_osd2_alpha_tpye":0, + "ds0_osd2_vst":0, + "ds0_osd2_hst":0, + "ds0_osd2_vend":0, + "ds0_osd2_hend":0, + "ds0_osd2_dma_request_length":0, + "ds0_osd2_dma_map":0, + "ds0_osd2_rgb_rev":0, + "ds0_osd2_global_alpha":0, + "ds0_osd2_swap_64":0, + "ds0_osd2_outstanding_num":0, + "ds0_osd2_bd_limit_en":0 + } + }, + "ds1":{ + "ds1_out_rgb_mode":0, + "ds1_out_rgb_en":0, + "ds1_out_yuv_mode":0, + "ds1_out_uv_swap":0, + "ds1_osd0":{ + "ds1_osd0_enable":0, + "ds1_osd0_type":0, + "ds1_osd0_alpha_tpye":0, + "ds1_osd0_vst":0, + "ds1_osd0_hst":0, + "ds1_osd0_vend":0, + "ds1_osd0_hend":0, + "ds1_osd0_dma_request_length":0, + "ds1_osd0_dma_map":0, + "ds1_osd0_rgb_rev":0, + "ds1_osd0_global_alpha":0, + "ds1_osd0_swap_64":0, + "ds1_osd0_outstanding_num":0, + "ds1_osd0_bd_limit_en":0 + }, + "ds1_osd1":{ + "ds1_osd1_enable":0, + "ds1_osd1_type":0, + "ds1_osd1_alpha_tpye":0, + "ds1_osd1_vst":0, + "ds1_osd1_hst":0, + "ds1_osd1_vend":0, + "ds1_osd1_hend":0, + "ds1_osd1_dma_request_length":0, + "ds1_osd1_dma_map":0, + "ds1_osd1_rgb_rev":0, + "ds1_osd1_global_alpha":0, + "ds1_osd1_swap_64":0, + "ds1_osd1_outstanding_num":0, + "ds1_osd1_bd_limit_en":0 + }, + "ds1_osd2":{ + "ds1_osd2_enable":0, + "ds1_osd2_type":0, + "ds1_osd2_alpha_tpye":0, + "ds1_osd2_vst":0, + "ds1_osd2_hst":0, + "ds1_osd2_vend":0, + "ds1_osd2_hend":0, + "ds1_osd2_dma_request_length":0, + "ds1_osd2_dma_map":0, + "ds1_osd2_rgb_rev":0, + "ds1_osd2_global_alpha":0, + "ds1_osd2_swap_64":0, + "ds1_osd2_outstanding_num":0, + "ds1_osd2_bd_limit_en":0 + } + }, + "ds2":{ + "ds2_out_rgb_mode":0, + "ds2_out_rgb_en":1, + "ds2_out_yuv_mode":0, + "ds2_out_uv_swap":0, + "ds2_osd0":{ + "ds2_osd0_enable":0, + "ds2_osd0_type":0, + "ds2_osd0_alpha_tpye":0, + "ds2_osd0_vst":0, + "ds2_osd0_hst":0, + "ds2_osd0_vend":0, + "ds2_osd0_hend":0, + "ds2_osd0_dma_request_length":0, + "ds2_osd0_dma_map":0, + "ds2_osd0_rgb_rev":0, + "ds2_osd0_global_alpha":0, + "ds2_osd0_swap_64":0, + "ds2_osd0_outstanding_num":0, + "ds2_osd0_bd_limit_en":0 + }, + "ds2_osd1":{ + "ds2_osd1_enable":0, + "ds2_osd1_type":0, + "ds2_osd1_alpha_tpye":0, + "ds2_osd1_vst":0, + "ds2_osd1_hst":0, + "ds2_osd1_vend":0, + "ds2_osd1_hend":0, + "ds2_osd1_dma_request_length":0, + "ds2_osd1_dma_map":0, + "ds2_osd1_rgb_rev":0, + "ds2_osd1_global_alpha":0, + "ds2_osd1_swap_64":0, + "ds2_osd1_outstanding_num":0, + "ds2_osd1_bd_limit_en":0 + } + } + } +} diff --git a/package/mediactl_lib/src/config/video_drm_sc035_640x480.conf b/package/mediactl_lib/src/config/video_drm_sc035_640x480.conf new file mode 100644 index 0000000..7ea24dd --- /dev/null +++ b/package/mediactl_lib/src/config/video_drm_sc035_640x480.conf @@ -0,0 +1,322 @@ +{ + "sensor0": { + "sensor0_name": "m00_f_sc035hgs 0-0030", + "sensor0_cfg_file": "sc035hgs.conf", + "sensor0_total_size": { + "sensor0_total_width": 852, + "sensor0_total_height": 1056 + }, + "sensor0_active_size": { + "sensor0_active_width": 640, + "sensor0_active_height": 480 + }, + "/dev/video2": { + "video2_used": 1, + "video2_width": 640, + "video2_height": 480, + "video2_out_format": 1 + }, + "/dev/video3": { + "video3_used": 0, + "video3_width": 640, + "video3_height": 480, + "video3_out_format": 1 + }, + "/dev/video4": { + "video4_used": 0, + "video4_width": 640, + "video4_height": 480, + "video4_out_format": 1 + }, + "/dev/video5": { + "video5_used": 0, + "video5_width": 320, + "video5_height": 320, + "video5_height_r": 240, + "video5_out_format": 1, + "video5_pitch": 320 + } + }, + "sensor1": { + "sensor1_name": "m01_f_imx219_1 3-0010", + "sensor1_cfg_file": "imx219_1.conf", + "sensor1_total_size": { + "sensor1_total_width": 3476, + "sensor1_total_height": 1166 + }, + "sensor1_active_size": { + "sensor1_active_width": 1920, + "sensor1_active_height": 1080 + }, + "/dev/video6": { + "video6_used": 0, + "video6_width": 1920, + "video6_height": 1080, + "video6_out_format": 1 + }, + "/dev/video7": { + "video7_used": 0, + "video7_width": 1080, + "video7_height": 720, + "video7_out_format": 1 + }, + "/dev/video8": { + "video8_used": 0, + "video8_width": 640, + "video8_height": 480, + "video8_out_format": 1 + }, + "/dev/video9": { + "video9_used": 0, + "video9_width": 320, + "video9_height": 240, + "video9_height_r": 240, + "video9_out_format": 1, + "video9_pitch": 320 + } + }, + "mipi_csi2": { + "csi0_used": 1, + "csi0_sony_wdr": 0, + "csi0_lane_nb": 2, + "csi0_dl0_map": 1, + "csi0_dl1_map": 2, + "csi0_dl2_map": 3, + "csi0_dl3_map": 4, + "csi00_datatype_select0": 43, + "csi00_datatype_select1": 42, + "csi00_vc_select": 1, + "csi01_datatype_select0": 43, + "csi01_datatype_select1": 42, + "csi01_vc_select": 2, + "csi02_datatype_select0": 43, + "csi02_datatype_select1": 42, + "csi02_vc_select": 4, + "csi1_used": 1, + "csi1_sony_wdr": 0, + "csi1_lane_nb": 2, + "csi1_dl0_map": 1, + "csi1_dl1_map": 2, + "csi1_dl2_map": 3, + "csi1_dl3_map": 4, + "csi10_datatype_select0": 43, + "csi10_datatype_select1": 42, + "csi10_vc_select": 1 + }, + "isp_vi": { + "vi_wrap": { + "dphy_mode": 0, + "sony_mode": 0, + "sensor0_interface_en": 1, + "sensor0_tpg_w_en": 0, + "sensor0_tpg_r_en": 0, + "sensor0_wdr_sensor_vendor": 0, + "sensor0_wdr_mode": 0, + "sensor0_mipi_mode": 0, + "sensor0_isp_pipeline": 1, + "sensor1_interface_en": 1, + "sensor1_tpg_w_en": 0, + "sensor1_tpg_r_en": 0, + "sensor1_wdr_sensor_vendor": 0, + "sensor1_wdr_mode": 0, + "sensor1_mipi_mode": 0, + "sensor1_isp_pipeline": 2, + "sensor2_interface_en": 0, + "sensor2_tpg_w_en": 0, + "sensor2_tpg_r_en": 0, + "sensor2_wdr_sensor_vendor": 0, + "sensor2_wdr_mode": 0, + "sensor2_mipi_mode": 0, + "sensor2_isp_pipeline": 2 + }, + "vi_pipe00": { + "p00_win_mode_en": 1, + "p00_input_ch_sel": 1, + "p00_ch_mode_sel": 1, + "p00_pixel_type": 0, + "p00_yuv_in_format": 0, + "p00_yuv_out_format": 0, + "p00_yuv422_order": 0, + "p00_pixel_width": 2, + "p00_data_out_timming_ctrl": 3, + "p00_sync_pulse_mode": 0, + "p00_sen_mipi_clk_pol": 1, + "p00_sen_mipi_vsync_pol": 0, + "p00_sen_mipi_hsync_pol": 0, + "p00_sen_mipi_field_pol": 1, + "p00_isp_clk_pol": 1, + "p00_isp_vsync_pol": 1, + "p00_isp_hsync_pol": 1, + "p00_isp_field_pol": 1, + "p00_tpg_w_en": 0, + "p00_tpg_r_en": 0, + "p00_w_st_width": 0, + "p00_w_st_height": 16383, + "p00_r_st_width": 279, + "p00_r_st_height": 44, + "p00_tof_mode_enable": 0, + "p00_vi_pipe_tpg_tof_frm_num": 3, + "p00_vi_pipe_tpg_tof_frm_stride": 66432 + }, + "vi_pipe01": { + "p01_win_mode_en": 1, + "p01_input_ch_sel": 1, + "p01_ch_mode_sel": 1, + "p01_pixel_type": 0, + "p01_yuv_in_format": 0, + "p01_yuv_out_format": 0, + "p01_yuv422_order": 0, + "p01_pixel_width": 2, + "p01_data_out_timming_ctrl": 3, + "p01_sync_pulse_mode": 0, + "p01_sen_mipi_clk_pol": 1, + "p01_sen_mipi_vsync_pol": 0, + "p01_sen_mipi_hsync_pol": 0, + "p01_sen_mipi_field_pol": 1, + "p01_isp_clk_pol": 1, + "p01_isp_vsync_pol": 1, + "p01_isp_hsync_pol": 1, + "p01_isp_field_pol": 1, + "p01_tpg_w_en": 0, + "p01_tpg_r_en": 0, + "p01_total_width": 852, + "p01_total_height": 1056, + "p01_in_width": 640, + "p01_in_height": 480, + "p01_w_st_width": 0, + "p01_w_st_height": 16383, + "p01_r_st_width": 279, + "p01_r_st_height": 44, + "p01_vi_pipe_w_addr_y0 ": 0, + "p01_vi_pipe_w_addr_y1 ": 0, + "p01_vi_pipe_w_addr_uv0": 0, + "p01_vi_pipe_w_addr_uv1": 0, + "p01_vi_pipe_r_addr_y0 ": 0, + "p01_vi_pipe_r_addr_y1 ": 0, + "p01_vi_pipe_addr_stride": 0, + "p01_tof_mode_enable": 0, + "p01_vi_pipe_tpg_tof_frm_num": 3, + "p01_vi_pipe_tpg_tof_frm_stride": 66432 + }, + "vi_pipe02": { + "p02_win_mode_en": 1, + "p02_input_ch_sel": 1, + "p02_ch_mode_sel": 1, + "p02_pixel_type": 0, + "p02_yuv_in_format": 0, + "p02_yuv_out_format": 0, + "p02_yuv422_order": 0, + "p02_pixel_width": 2, + "p02_data_out_timming_ctrl": 3, + "p02_sync_pulse_mode": 0, + "p02_sen_mipi_clk_pol": 1, + "p02_sen_mipi_vsync_pol": 0, + "p02_sen_mipi_hsync_pol": 0, + "p02_sen_mipi_field_pol": 1, + "p02_isp_clk_pol": 1, + "p02_isp_vsync_pol": 1, + "p02_isp_hsync_pol": 1, + "p02_isp_field_pol": 1, + "p02_tpg_w_en": 0, + "p02_tpg_r_en": 0, + "p02_total_width": 852, + "p02_total_height": 1056, + "p02_in_width": 640, + "p02_in_height": 480, + "p02_w_st_width": 0, + "p02_w_st_height": 16383, + "p02_r_st_width": 279, + "p02_r_st_height": 44, + "p02_vi_pipe_w_addr_y0 ": 0, + "p02_vi_pipe_w_addr_y1 ": 0, + "p02_vi_pipe_w_addr_uv0": 0, + "p02_vi_pipe_w_addr_uv1": 0, + "p02_vi_pipe_r_addr_y0 ": 0, + "p02_vi_pipe_r_addr_y1 ": 0, + "p02_vi_pipe_addr_stride": 0, + "p02_tof_mode_enable": 0, + "p02_vi_pipe_tpg_tof_frm_num": 3, + "p02_vi_pipe_tpg_tof_frm_stride": 66432 + }, + "vi_pipe10": { + "p10_win_mode_en": 1, + "p10_input_ch_sel": 1, + "p10_ch_mode_sel": 1, + "p10_pixel_type": 0, + "p10_yuv_in_format": 0, + "p10_yuv_out_format": 0, + "p10_yuv422_order": 0, + "p10_pixel_width": 2, + "p10_data_out_timming_ctrl": 3, + "p10_sync_pulse_mode": 0, + "p10_sen_mipi_clk_pol": 1, + "p10_sen_mipi_vsync_pol": 0, + "p10_sen_mipi_hsync_pol": 0, + "p10_sen_mipi_field_pol": 1, + "p10_isp_clk_pol": 1, + "p10_isp_vsync_pol": 1, + "p10_isp_hsync_pol": 1, + "p10_isp_field_pol": 1, + "p10_tpg_w_en": 0, + "p10_tpg_r_en": 0, + "p10_total_width": 2200, + "p10_total_height": 1125, + "p10_in_width": 1920, + "p10_in_height": 1080, + "p10_w_st_width": 0, + "p10_w_st_height": 16383, + "p10_r_st_width": 279, + "p10_r_st_height": 44, + "p10_vi_pipe_w_addr_y0 ": 0, + "p10_vi_pipe_w_addr_y1 ": 0, + "p10_vi_pipe_w_addr_uv0": 0, + "p10_vi_pipe_w_addr_uv1": 0, + "p10_vi_pipe_r_addr_y0 ": 0, + "p10_vi_pipe_r_addr_y1 ": 0, + "p10_vi_pipe_addr_stride": 0, + "p10_tof_mode_enable": 0, + "p10_vi_pipe_tpg_tof_frm_num": 3, + "p10_vi_pipe_tpg_tof_frm_stride": 66432 + }, + "vi_dvp00": { + "dvp00_win_mode_en": 1, + "dvp00_input_ch_sel": 1, + "dvp00_ch_mode_sel": 1, + "dvp00_pixel_type": 0, + "dvp00_yuv_in_format": 0, + "dvp00_yuv_out_format": 0, + "dvp00_yuv422_order": 0, + "dvp00_pixel_width": 2, + "dvp00_data_out_timming_ctrl": 3, + "dvp00_sync_pulse_mode": 0, + "dvp00_sen_mipi_clk_pol": 1, + "dvp00_sen_mipi_vsync_pol": 0, + "dvp00_sen_mipi_hsync_pol": 0, + "dvp00_sen_mipi_field_pol": 1, + "dvp00_isp_clk_pol": 1, + "dvp00_isp_vsync_pol": 1, + "dvp00_isp_hsync_pol": 1, + "dvp00_isp_field_pol": 1, + "dvp00_tpg_w_en": 0, + "dvp00_tpg_r_en": 0, + "dvp00_total_width": 2200, + "dvp00_total_height": 1125, + "dvp00_in_width": 1920, + "dvp00_in_height": 1080, + "dvp00_w_st_width": 0, + "dvp00_w_st_height": 16383, + "dvp00_r_st_width": 279, + "dvp00_r_st_height": 44, + "dvp00_vi_pipe_w_addr_y0 ": 0, + "dvp00_vi_pipe_w_addr_y1 ": 0, + "dvp00_vi_pipe_w_addr_uv0": 0, + "dvp00_vi_pipe_w_addr_uv1": 0, + "dvp00_vi_pipe_r_addr_y0 ": 0, + "dvp00_vi_pipe_r_addr_y1 ": 0, + "dvp00_vi_pipe_addr_stride": 0, + "dvp00_tof_mode_enable": 0, + "dvp00_vi_pipe_tpg_tof_frm_num": 3, + "dvp00_vi_pipe_tpg_tof_frm_stride": 66432 + } + } +} diff --git a/package/mediactl_lib/src/media_ctl.c b/package/mediactl_lib/src/media_ctl.c index 1a7d7e4..1d5cf48 100644 --- a/package/mediactl_lib/src/media_ctl.c +++ b/package/mediactl_lib/src/media_ctl.c @@ -127,14 +127,14 @@ struct video_entity_info_s{ }; struct isp_pipeline_s{ - unsigned int pipeline_en; - char sensor_name[20]; - struct image_size_s total_size; + unsigned int pipeline_en; + char sensor_name[32]; + struct image_size_s total_size; struct image_size_s sensor_size; - struct v4l2_mbus_framefmt format_in; - struct v4l2_mbus_framefmt format_crop; - struct v4l2_mbus_framefmt format_out; - struct video_entity_info_s video_entity_info[4]; + struct v4l2_mbus_framefmt format_in; + struct v4l2_mbus_framefmt format_crop; + struct v4l2_mbus_framefmt format_out; + struct video_entity_info_s video_entity_info[4]; }; struct v4l_isp_device { diff --git a/package/patches/linux/0033-camera-add-sc035hgs-sensor-support.patch b/package/patches/linux/0033-camera-add-sc035hgs-sensor-support.patch new file mode 100644 index 0000000..cf0d722 --- /dev/null +++ b/package/patches/linux/0033-camera-add-sc035hgs-sensor-support.patch @@ -0,0 +1,1489 @@ +From 98b200091a40bd3bd0750bc861f5ab971195b6c6 Mon Sep 17 00:00:00 2001 +From: "Chenggen.Wang" +Date: Fri, 14 Oct 2022 14:03:48 +0800 +Subject: [PATCH] camera: add sc035hgs sensor support. + +Signed-off-by: Chenggen.Wang +--- + .../canaan/k510_common/camera-sc035hgs.dtsi | 62 + + .../boot/dts/canaan/k510_crb_lp3_v1_2.dts | 2 + + .../media/i2c/soc_camera/canaanchip/Kconfig | 8 +- + .../media/i2c/soc_camera/canaanchip/Makefile | 13 +- + .../i2c/soc_camera/canaanchip/sc035hgs.c | 1335 +++++++++++++++++ + 5 files changed, 1413 insertions(+), 7 deletions(-) + create mode 100644 arch/riscv/boot/dts/canaan/k510_common/camera-sc035hgs.dtsi + mode change 100755 => 100644 drivers/media/i2c/soc_camera/canaanchip/Kconfig + mode change 100755 => 100644 drivers/media/i2c/soc_camera/canaanchip/Makefile + create mode 100644 drivers/media/i2c/soc_camera/canaanchip/sc035hgs.c + +diff --git a/arch/riscv/boot/dts/canaan/k510_common/camera-sc035hgs.dtsi b/arch/riscv/boot/dts/canaan/k510_common/camera-sc035hgs.dtsi +new file mode 100644 +index 00000000..0ffd5eae +--- /dev/null ++++ b/arch/riscv/boot/dts/canaan/k510_common/camera-sc035hgs.dtsi +@@ -0,0 +1,62 @@ ++//RGB ++&i2c1 { ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ sc035hgs: sc035hgs@30 { ++ compatible = "smartsens,sc035hgs"; ++ reg = <0x30>; ++ reset-gpios = <&porta 8 GPIO_ACTIVE_LOW>; ++ strobe-gpios = <&porta 9 GPIO_ACTIVE_HIGH>; ++ led1-gpios = <&porta 23 GPIO_ACTIVE_HIGH>; ++ led2-gpios = <&porta 17 GPIO_ACTIVE_HIGH>; ++ key1-gpios = <&porta 18 GPIO_ACTIVE_HIGH>; ++ key2-gpios = <&porta 24 GPIO_ACTIVE_HIGH>; ++ ++ canaanchip,camera-module-index = <0>; ++ canaanchip,camera-module-facing = "front"; ++ canaanchip,camera-module-name = "BFC105-DUAL-L"; ++ canaanchip,camera-module-lens-name = "RGB"; ++ // ir-cut = <&cam_ircut0>; ++ hflip = <1>; ++ ++ port { ++ ucam_out0: endpoint { ++ remote-endpoint = <&mipi_in_ucam0>; ++ data-lanes = <1>; ++ }; ++ }; ++ }; ++}; ++ ++&isp1{ ++ status = "okay"; ++ sensor_num =<1>; ++ dphy_speed =<1>; //0-RXDPHY_SPEED_MODE_2500M,1-RXDPHY_SPEED_MODE_1500M ++ dphy_mode = <0>;//0-TWO_LANES_MODE,1-FOUR_LANES_MODE ++ sony_mode = <0>;//0-SONY_POL_MODE_DIS,1-SONY_POL_MODE_EN ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ port@1 { ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ mipi_in_ucam0: endpoint@0 { ++ status = "okay"; ++ reg = <1>; ++ remote-endpoint = <&ucam_out0>; ++ clock-lanes = <0>; ++ data-lanes = <1>; ++ data-type = <0x2b>; //0x1E-MIPI_YUV422,0x2A-MIPI_RAW8,0x2B-MIPI_RAW10,0x2C-MIPI_RAW12 ++ tpg_r_en = <0>; ++ tpg_w_en = <0>; ++ wdr_sensor_vendor =<0>;//0-"SONY_WDR_SENSOR", 1=OTHERS_WDR_SENSOR ++ wdr_mode = <0>;//0-none wdr mode ,1-2frame wdr mode, 2-3frame wdr mode ++ mipi_csi_mode = <0>; //0- normal mode ,1 -debug mode ++ isp_pipeline = <1>;//1 -ISP_F_2K, 2 -ISP_R_2K, 3-ISP_TOF ++ }; ++ }; ++ }; ++}; ++ +diff --git a/arch/riscv/boot/dts/canaan/k510_crb_lp3_v1_2.dts b/arch/riscv/boot/dts/canaan/k510_crb_lp3_v1_2.dts +index 1620998c..81a478b6 100755 +--- a/arch/riscv/boot/dts/canaan/k510_crb_lp3_v1_2.dts ++++ b/arch/riscv/boot/dts/canaan/k510_crb_lp3_v1_2.dts +@@ -24,6 +24,7 @@ + //#include "k510_common/camera-gc2093_gc2053.dtsi" /* camera gc2053/gc2093 */ + //#include "k510_common/camera-gc2093_gc2145.dtsi" /* camera gc2093/gc2145 */ + //#include "k510_common/camera-gc2145_gc2093.dtsi" /* camera gc2093/gc2145 */ ++//#include "k510_common/camera-sc035hgs.dtsi" /* camera sc035hgs*/ + + #include + +@@ -219,6 +220,7 @@ + (71) (FUNC_GPIO4) /*KEY_1*/ + (72) (FUNC_GPIO17) + (73) (FUNC_GPIO18) ++ (74) (FUNC_GPIO24) + (75) (FUNC_GPIO5) /*HP_INSERT_DET*/ + (76) (FUNC_GPIO6) /*KEY_2*/ + (77) (FUNC_GPIO7) /*SYS_LED*/ +diff --git a/drivers/media/i2c/soc_camera/canaanchip/Kconfig b/drivers/media/i2c/soc_camera/canaanchip/Kconfig +old mode 100755 +new mode 100644 +index 7be3e789..dbbaf630 +--- a/drivers/media/i2c/soc_camera/canaanchip/Kconfig ++++ b/drivers/media/i2c/soc_camera/canaanchip/Kconfig +@@ -45,5 +45,11 @@ config VIDEO_GC2145 + This is a V4L2 sensor-level driver for the Galaxycore GC2145 + CMOS image sensor. + +- ++config VIDEO_SC035HGS ++ tristate "SmartSens SC035HGS sensor support" ++ depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && VIDEO_CANAAN_K510 ++ depends on MEDIA_CAMERA_SUPPORT ++ ---help--- ++ This is a V4L2 sensor-level driver for the SmartSens SC035HGS ++ CMOS image sensor. + +diff --git a/drivers/media/i2c/soc_camera/canaanchip/Makefile b/drivers/media/i2c/soc_camera/canaanchip/Makefile +old mode 100755 +new mode 100644 +index 3b53d53e..1f310b72 +--- a/drivers/media/i2c/soc_camera/canaanchip/Makefile ++++ b/drivers/media/i2c/soc_camera/canaanchip/Makefile +@@ -1,6 +1,7 @@ +-obj-$(CONFIG_VIDEO_IMX219_0) += imx219_0.o +-obj-$(CONFIG_VIDEO_IMX219_1) += imx219_1.o +-obj-$(CONFIG_VIDEO_IMX385) += imx385.o +-obj-$(CONFIG_VIDEO_GC2053) += gc2053.o +-obj-$(CONFIG_VIDEO_GC2093) += gc2093.o +-obj-$(CONFIG_VIDEO_GC2145) += gc2145.o ++obj-$(CONFIG_VIDEO_IMX219_0) += imx219_0.o ++obj-$(CONFIG_VIDEO_IMX219_1) += imx219_1.o ++obj-$(CONFIG_VIDEO_IMX385) += imx385.o ++obj-$(CONFIG_VIDEO_GC2053) += gc2053.o ++obj-$(CONFIG_VIDEO_GC2093) += gc2093.o ++obj-$(CONFIG_VIDEO_GC2145) += gc2145.o ++obj-$(CONFIG_VIDEO_SC035HGS) += sc035hgs.o +diff --git a/drivers/media/i2c/soc_camera/canaanchip/sc035hgs.c b/drivers/media/i2c/soc_camera/canaanchip/sc035hgs.c +new file mode 100644 +index 00000000..1e2ee7f2 +--- /dev/null ++++ b/drivers/media/i2c/soc_camera/canaanchip/sc035hgs.c +@@ -0,0 +1,1335 @@ ++/* ++ * Driver for SC035HGS CMOS Image Sensor ++ * ++ * Copyright (C) 2022, Canaan Bright Sight Co., Ltd ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x01) ++ ++#ifndef V4L2_CID_DIGITAL_GAIN ++#define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN ++#endif ++ ++#define CHIP_ID 0x310b ++#define SC035HGS_REG_CHIP_ID 0x3107 ++ ++#define SC035HGS_LANES 1 ++#define SC035HGS_BITS_PER_SAMPLE 10 ++#define SC035HGS_LINK_FREQ_270MHZ 270000000 ++#define SC035HGS_PIXEL_RATE (SC035HGS_LINK_FREQ_270MHZ * 2 * \ ++ SC035HGS_LANES / SC035HGS_BITS_PER_SAMPLE) ++#define SC035HGS_XVCLK_FREQ 24000000 ++ ++#define SC035HGS_REG_CTRL_MODE 0x0100 ++#define SC035HGS_MODE_SW_STANDBY 0x0 ++#define SC035HGS_MODE_STREAMING BIT(0) ++ ++#define SC035HGS_REG_EXPOSURE 0x3e01 ++#define SC035HGS_EXPOSURE_MIN 6 ++#define SC035HGS_EXPOSURE_STEP 1 ++#define SC035HGS_REG_VTS 0x320e ++#define SC035HGS_VTS_MAX 0xffff ++ ++#define SC035HGS_REG_COARSE_DGAIN 0x3e06 ++#define SC035HGS_REG_FINE_DGAIN 0x3e07 ++#define SC035HGS_REG_COARSE_AGAIN 0x3e08 ++#define SC035HGS_REG_FINE_AGAIN 0x3e09 ++#define ANALOG_GAIN_MIN 0x10 ++#define ANALOG_GAIN_MAX 0x7c0 ++#define ANALOG_GAIN_STEP 1 ++#define ANALOG_GAIN_DEFAULT 0x10 ++ ++#define SC035HGS_REG_TEST_PATTERN 0x4501 ++#define SC035HGS_TEST_PATTERN_ENABLE 0xcc ++#define SC035HGS_TEST_PATTERN_DISABLE 0xc4 ++ ++#define SC035HGS_REG_FLIP_MIRROR 0x3221 ++#define SC035HGS_MIRROR_MASK 0x06 ++#define SC035HGS_FLIP_MASK 0x60 ++ ++#define SC035HGS_GROUP_HOLD 0x3812 ++#define SC035HGS_GROUP_HOLD_START 0X00 ++#define SC035HGS_GROUP_HOLD_LUNCH 0x30 ++#define REG_NULL 0xFFFF ++ ++#define SC035HGS_REG_VALUE_08BIT 1 ++#define SC035HGS_REG_VALUE_16BIT 2 ++#define SC035HGS_REG_VALUE_24BIT 3 ++ ++#define SC035HGS_NAME "sc035hgs" ++ ++struct regval { ++ u16 addr; ++ u8 val; ++}; ++ ++struct sc035hgs_mode { ++ u32 bus_fmt; ++ u32 width; ++ u32 height; ++ struct v4l2_fract max_fps; ++ u32 hts_def; ++ u32 vts_def; ++ u32 exp_def; ++ const struct regval *reg_list; ++}; ++ ++struct sc035hgs { ++ struct i2c_client *client; ++ struct gpio_desc *reset_gpio; ++ struct gpio_desc *pwdn_gpio; ++ struct gpio_desc *strobe_gpio; ++ struct gpio_desc *led1_gpio; ++ struct gpio_desc *led2_gpio; ++ struct gpio_desc *key1_gpio; ++ struct gpio_desc *key2_gpio; ++ ++ struct v4l2_subdev subdev; ++ struct media_pad pad; ++ struct v4l2_ctrl_handler ctrl_handler; ++ struct v4l2_ctrl *exposure; ++ struct v4l2_ctrl *anal_gain; ++ struct v4l2_ctrl *digi_gain; ++ struct v4l2_ctrl *hblank; ++ struct v4l2_ctrl *vblank; ++ struct mutex mutex; ++ bool streaming; ++ bool power_on; ++ const struct sc035hgs_mode *cur_mode; ++ u32 module_index; ++ const char *module_facing; ++ const char *module_name; ++ const char *len_name; ++}; ++ ++#define to_sc035hgs(sd) container_of(sd, struct sc035hgs, subdev) ++ ++static const struct regval image_optimize_gain_1x_2x_regs[] = { ++ {0x3314, 0x1e}, ++ {0x3317, 0x1b}, ++ {0x3631, 0x58}, ++ {0x3329, 0x3c}, ++ {0x332d, 0x3c}, ++ {0x332f, 0x40}, ++ {0x3335, 0x44}, ++ {0x3344, 0x44}, ++ {0x3316, 0x48}, ++ {0x3630, 0x4a}, ++ {REG_NULL, 0x00} ++}; ++ ++static const struct regval image_optimize_gain_2x_4x_regs[] = { ++ {0x3314, 0x6f}, ++ {0x3317, 0x10}, ++ {0x3631, 0x48}, ++ {0x3329, 0x5c}, ++ {0x332d, 0x5c}, ++ {0x332f, 0x60}, ++ {0x3335, 0x64}, ++ {0x3344, 0x64}, ++ {0x3316, 0x68}, ++ {0x3630, 0x4c}, ++ {REG_NULL, 0x00} ++}; ++ ++static const struct regval image_optimize_regs[] = { ++ {0x3314, 0x76}, ++ {0x3317, 0x15}, ++ {0x3631, 0x48}, ++ {0x3329, 0x5c}, ++ {0x332d, 0x5c}, ++ {0x332f, 0x60}, ++ {0x3335, 0x64}, ++ {0x3344, 0x64}, ++ {0x3316, 0x68}, ++ {0x3630, 0x4c}, ++ {REG_NULL, 0x00} ++}; ++ ++ ++/* ++ * Xclk 24Mhz ++ * linelength 852(0x354) ++ * framelength 528(0x210) ++ * grabwindow_width 640 ++ * grabwindow_height 480 ++ * max_framerate 120fps ++ */ ++static const struct regval sc035hgs_640x480_120fps_1lane_regs[] = { ++ {0x0103, 0x01}, ++ {0x0100, 0x00}, ++ {0x36e9, 0x80}, ++ {0x36f9, 0x80}, ++ {0x3000, 0x00}, ++ {0x3001, 0x00}, ++ {0x300f, 0x0f}, ++ {0x3018, 0x13}, ++ {0x3019, 0xfc}, ++ {0x301c, 0x78}, ++ {0x301f, 0x87}, ++ {0x3031, 0x0a}, ++ {0x3037, 0x20}, ++ {0x303f, 0x01}, ++ {0x320c, 0x03},//Line Length ++ {0x320d, 0x54}, ++ {0x320e, 0x04},//Frame Length ++ {0x320f, 0x20}, ++ {0x3217, 0x00}, ++ {0x3218, 0x00}, ++ {0x3220, 0x10}, ++ {0x3223, 0x48}, ++ {0x3226, 0x74}, ++ {0x3227, 0x07}, ++ {0x323b, 0x00}, ++ {0x3250, 0xf0}, ++ {0x3251, 0x02}, ++ {0x3252, 0x02}, ++ {0x3253, 0x08}, ++ {0x3254, 0x02}, ++ {0x3255, 0x07}, ++ {0x3304, 0x48}, ++ {0x3305, 0x00}, ++ {0x3306, 0x60}, ++ {0x3309, 0x50}, ++ {0x330a, 0x00}, ++ {0x330b, 0xc0}, ++ {0x330c, 0x18}, ++ {0x330f, 0x40}, ++ {0x3310, 0x10}, ++ {0x3314, 0x1e}, ++ {0x3315, 0x30}, ++ {0x3316, 0x68}, ++ {0x3317, 0x1b}, ++ {0x3329, 0x5c}, ++ {0x332d, 0x5c}, ++ {0x332f, 0x60}, ++ {0x3335, 0x64}, ++ {0x3344, 0x64}, ++ {0x335b, 0x80}, ++ {0x335f, 0x80}, ++ {0x3366, 0x06}, ++ {0x3385, 0x31}, ++ {0x3387, 0x39}, ++ {0x3389, 0x01}, ++ {0x33b1, 0x03}, ++ {0x33b2, 0x06}, ++ {0x33bd, 0xe0}, ++ {0x33bf, 0x10}, ++ {0x3621, 0xa4}, ++ {0x3622, 0x05}, ++ {0x3624, 0x47}, ++ {0x3630, 0x4a}, ++ {0x3631, 0x58}, ++ {0x3633, 0x52}, ++ {0x3635, 0x03}, ++ {0x3636, 0x25}, ++ {0x3637, 0x8a}, ++ {0x3638, 0x0f}, ++ {0x3639, 0x08}, ++ {0x363a, 0x00}, ++ {0x363b, 0x48}, ++ {0x363c, 0x86}, ++ {0x363d, 0x10}, ++ {0x363e, 0xf8}, ++ {0x3640, 0x00}, ++ {0x3641, 0x01}, ++ {0x36ea, 0x37}, ++ {0x36eb, 0x0e}, ++ {0x36ec, 0x0e}, ++ {0x36ed, 0x23}, ++ {0x36fa, 0x37}, ++ {0x36fb, 0x00}, ++ {0x36fc, 0x02}, ++ {0x36fd, 0x03}, ++ {0x3908, 0x91}, ++ {0x391b, 0x81}, ++ {0x3d08, 0x01}, ++ {0x3e01, 0x14},//ET[7:0] ++ {0x3e02, 0x80},//ET[7:4] ++ {0x3e03, 0x2b}, ++ {0x3e06, 0x0c}, ++ {0x3f04, 0x03}, ++ {0x3f05, 0x34}, ++ {0x4500, 0x59}, ++ {0x4501, 0xc4}, ++ {0x4603, 0x00}, ++ {0x4800, 0x64}, ++ {0x4809, 0x01}, ++ {0x4810, 0x00}, ++ {0x4811, 0x01}, ++ {0x4837, 0x13}, ++ {0x5011, 0x00}, ++ {0x5988, 0x02}, ++ {0x598e, 0x03}, ++ {0x598f, 0x10}, ++ {0x36e9, 0x24}, ++ {0x36f9, 0x20}, ++ ++ {REG_NULL, 0x00} ++}; ++ ++static const struct sc035hgs_mode supported_modes[] = { ++ { ++ .bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10, ++ .width = 640, ++ .height = 480, ++ .max_fps = { ++ .numerator = 10000, ++ .denominator = 1200000, ++ }, ++ .exp_def = 0x0300,//default ++ .hts_def = 0x0354, ++ .vts_def = 0x0420, ++ .reg_list = sc035hgs_640x480_120fps_1lane_regs, ++ }, ++}; ++ ++static const char * const sc035hgs_test_pattern_menu[] = { ++ "Disabled", ++ "Vertical Color Bar Type 1", ++ "Vertical Color Bar Type 2", ++ "Vertical Color Bar Type 3", ++ "Vertical Color Bar Type 4" ++}; ++ ++static const s64 link_freq_menu_items[] = { ++ SC035HGS_LINK_FREQ_270MHZ ++}; ++ ++/* Write registers up to 4 at a time */ ++static int sc035hgs_write_reg(struct i2c_client *client, ++ u16 reg, u32 len, u32 val) ++{ ++ u32 buf_i, val_i; ++ u8 buf[6]; ++ u8 *val_p; ++ __be32 val_be; ++ u32 ret; ++ ++ if (len > 4) ++ return -EINVAL; ++ ++ buf[0] = reg >> 8; ++ buf[1] = reg & 0xff; ++ ++ val_be = cpu_to_be32(val); ++ val_p = (u8 *)&val_be; ++ buf_i = 2; ++ val_i = 4 - len; ++ ++ while (val_i < 4) ++ buf[buf_i++] = val_p[val_i++]; ++ ++ ret = i2c_master_send(client, buf, len + 2); ++ if (ret != len + 2) { ++ dev_err(&client->dev, "sc035hgs_write_reg error(%d))\n", ret); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static int sc035hgs_write_array(struct i2c_client *client, ++ const struct regval *regs) ++{ ++ u32 i; ++ int ret = 0; ++ ++ for (i = 0; ret == 0 && regs[i].addr != REG_NULL; i++) { ++ ret = sc035hgs_write_reg(client, regs[i].addr, ++ SC035HGS_REG_VALUE_08BIT, regs[i].val); ++ } ++ return ret; ++} ++ ++/* Read registers up to 4 at a time */ ++static int sc035hgs_read_reg(struct i2c_client *client, ++ u16 reg, unsigned int len, u32 *val) ++{ ++ struct i2c_msg msgs[2]; ++ u8 *data_be_p; ++ __be32 data_be = 0; ++ __be16 reg_addr_be = cpu_to_be16(reg); ++ int ret; ++ ++ if (len > 4 || !len) ++ return -EINVAL; ++ ++ data_be_p = (u8 *)&data_be; ++ /* Write register address */ ++ msgs[0].addr = client->addr; ++ msgs[0].flags = 0; ++ msgs[0].len = 2; ++ msgs[0].buf = (u8 *)®_addr_be; ++ ++ /* Read data from register */ ++ msgs[1].addr = client->addr; ++ msgs[1].flags = I2C_M_RD; ++ msgs[1].len = len; ++ msgs[1].buf = &data_be_p[4 - len]; ++ ++ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); ++ if (ret != ARRAY_SIZE(msgs)) ++ return -EIO; ++ ++ *val = be32_to_cpu(data_be); ++ ++ return 0; ++} ++ ++static int sc035hgs_get_reso_dist(const struct sc035hgs_mode *mode, ++ struct v4l2_mbus_framefmt *framefmt) ++{ ++ return abs(mode->width - framefmt->width) + ++ abs(mode->height - framefmt->height); ++} ++ ++static const struct sc035hgs_mode * ++sc035hgs_find_best_fit(struct v4l2_subdev_format *fmt) ++{ ++ struct v4l2_mbus_framefmt *framefmt = &fmt->format; ++ int dist; ++ int cur_best_fit = 0; ++ int cur_best_fit_dist = -1; ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(supported_modes); i++) { ++ dist = sc035hgs_get_reso_dist(&supported_modes[i], framefmt); ++ if (cur_best_fit_dist == -1 || dist < cur_best_fit_dist) { ++ cur_best_fit_dist = dist; ++ cur_best_fit = i; ++ } ++ } ++ ++ return &supported_modes[cur_best_fit]; ++} ++ ++static int sc035hgs_set_fmt(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_format *fmt) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ const struct sc035hgs_mode *mode; ++ s64 h_blank, vblank_def; ++ ++ mutex_lock(&sc035hgs->mutex); ++ ++ mode = sc035hgs_find_best_fit(fmt); ++ fmt->format.code = mode->bus_fmt; ++ fmt->format.width = mode->width; ++ fmt->format.height = mode->height; ++ fmt->format.field = V4L2_FIELD_NONE; ++ ++ dev_info(&sc035hgs->client->dev, "set_fmt, width:%u, height:%u.\n", mode->width, mode->height); ++ ++ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { ++#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API ++ *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; ++#else ++ mutex_unlock(&sc035hgs->mutex); ++ return -ENOTTY; ++#endif ++ } else { ++ sc035hgs->cur_mode = mode; ++ h_blank = mode->hts_def - mode->width; ++ __v4l2_ctrl_modify_range(sc035hgs->hblank, h_blank, ++ h_blank, 1, h_blank); ++ vblank_def = mode->vts_def - mode->height; ++ __v4l2_ctrl_modify_range(sc035hgs->vblank, vblank_def, ++ SC035HGS_VTS_MAX - mode->height, ++ 1, vblank_def); ++ } ++ ++ mutex_unlock(&sc035hgs->mutex); ++ ++ return 0; ++} ++ ++static int sc035hgs_get_fmt(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_format *fmt) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ const struct sc035hgs_mode *mode = sc035hgs->cur_mode; ++ ++ mutex_lock(&sc035hgs->mutex); ++ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { ++#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API ++ fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); ++#else ++ mutex_unlock(&sc035hgs->mutex); ++ return -ENOTTY; ++#endif ++ } else { ++ fmt->format.width = mode->width; ++ fmt->format.height = mode->height; ++ fmt->format.code = mode->bus_fmt; ++ fmt->format.field = V4L2_FIELD_NONE; ++ } ++ mutex_unlock(&sc035hgs->mutex); ++ dev_info(&sc035hgs->client->dev, "%s, width:%u, height:%u.\n", ++ __func__, fmt->format.width, fmt->format.height); ++ ++ return 0; ++} ++ ++static int sc035hgs_enum_mbus_code(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_mbus_code_enum *code) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ ++ if (code->index != 0) ++ return -EINVAL; ++ code->code = sc035hgs->cur_mode->bus_fmt; ++ ++ return 0; ++} ++ ++static int sc035hgs_enum_frame_sizes(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_frame_size_enum *fse) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ ++ if (fse->index >= ARRAY_SIZE(supported_modes)) ++ return -EINVAL; ++ ++ if (fse->code != sc035hgs->cur_mode->bus_fmt) ++ return -EINVAL; ++ ++ fse->min_width = supported_modes[fse->index].width; ++ fse->max_width = supported_modes[fse->index].width; ++ fse->max_height = supported_modes[fse->index].height; ++ fse->min_height = supported_modes[fse->index].height; ++ ++ return 0; ++} ++ ++static int sc035hgs_enable_test_pattern(struct sc035hgs *sc035hgs, u32 pattern) ++{ ++ u32 val; ++ ++ if (pattern) ++ val = (pattern - 1) | SC035HGS_TEST_PATTERN_ENABLE; ++ else ++ val = SC035HGS_TEST_PATTERN_DISABLE; ++ ++ return sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_TEST_PATTERN, ++ SC035HGS_REG_VALUE_08BIT, val); ++} ++ ++static long sc035hgs_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ long ret = 0; ++ ++ dev_info(&sc035hgs->client->dev, "sc035hgs_ioctl\n"); ++ ++ switch (cmd) { ++ //case: ++ default: ++ ret = -ENOIOCTLCMD; ++ break; ++ } ++ return ret; ++} ++ ++ ++#ifdef CONFIG_COMPAT ++static long sc035hgs_compat_ioctl32(struct v4l2_subdev *sd, ++ unsigned int cmd, unsigned long arg) ++{ ++ void __user *up = compat_ptr(arg); ++ struct module_inf *inf; ++ struct module_awb_cfg *awb_cfg; ++ long ret = 0; ++ ++ switch (cmd) { ++ case CANAANMODULE_GET_MODULE_INFO: ++ inf = kzalloc(sizeof(*inf), GFP_KERNEL); ++ if (!inf) { ++ ret = -ENOMEM; ++ return ret; ++ } ++ ++ ret = sc035hgs_ioctl(sd, cmd, inf); ++ if (!ret) ++ ret = copy_to_user(up, inf, sizeof(*inf)); ++ kfree(inf); ++ break; ++ case CANAANMODULE_AWB_CFG: ++ awb_cfg = kzalloc(sizeof(*awb_cfg), GFP_KERNEL); ++ if (!awb_cfg) { ++ ret = -ENOMEM; ++ return ret; ++ } ++ ++ ret = sc035hgs_ioctl(sd, cmd, awb_cfg); ++ if (!ret) ++ ret = copy_to_user(up, awb_cfg, sizeof(*awb_cfg)); ++ kfree(awb_cfg); ++ break; ++ default: ++ ret = -ENOIOCTLCMD; ++ break; ++ } ++ return ret; ++} ++#endif ++#if 0 ++static int sc035hgs_set_ctrl_gain(struct sc035hgs *sc035hgs, u32 a_gain) ++{ ++ struct device *dev = &sc035hgs->client->dev; ++ u32 coarse_again = 0, fine_again = 0; ++ u32 coarse_dgain = 0, fine_dgain = 0; ++ int ret = 0; ++ ++ if (a_gain < 0x20) { /*1x ~ 2x*/ ++ fine_again = a_gain; ++ coarse_again = 0x3;//0 ++ fine_dgain = 0x80; ++ coarse_dgain = 0x0c; ++ } else if (a_gain < 0x40) { /*2x ~ 4x*/ ++ fine_again = a_gain >> 1; ++ coarse_again = 0x7;//1 ++ fine_dgain = 0x80; ++ coarse_dgain = 0x0c; ++ } else if (a_gain < 0x80) { /*4x ~ 8x*/ ++ fine_again = a_gain >> 2; ++ coarse_again = 0xf;//3 ++ fine_dgain = 0x80; ++ coarse_dgain = 0x0c; ++ } else if (a_gain <= 0xf8) { /*8x ~ 15.5x*/ ++ fine_again = a_gain >> 3; ++ coarse_again = 0x1f;//7 ++ fine_dgain = 0x80; ++ coarse_dgain = 0x0c; ++ } else if (a_gain < 0x200) { /*15.5x ~ 32x*/ ++ fine_again = 0x1f; ++ coarse_again = 0x1f;//7 ++ fine_dgain = a_gain >> 1; ++ coarse_dgain = 0x0c; ++ } else if (a_gain < 0x400) { /*32x ~ 64x*/ ++ fine_again = 0x1f; ++ coarse_again = 0x1f;//7 ++ fine_dgain = a_gain >> 2; ++ coarse_dgain = 0x0d; ++ } else if (a_gain <= 0x7C0) { /*64x ~ 124x*/ ++ fine_again = 0x1f; ++ coarse_again = 0x1f;//7 ++ fine_dgain = a_gain >> 3; ++ coarse_dgain = 0x0f; ++ } ++ ++ dev_dbg(dev, "set fine_again = 0x%x, coarse_again = 0x%x, coarse_dgain=0x%x, fine_dgain=0x%x\n", ++ fine_again, coarse_again, coarse_dgain, fine_dgain); ++ ++ if (a_gain < 0x20) ++ ret = sc035hgs_write_array(sc035hgs->client, ++ image_optimize_gain_1x_2x_regs); ++ else if (a_gain < 0x40) ++ ret |= sc035hgs_write_array(sc035hgs->client, ++ image_optimize_gain_2x_4x_regs); ++ else ++ ret |= sc035hgs_write_array(sc035hgs->client, ++ image_optimize_regs); ++ ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_GROUP_HOLD, ++ SC035HGS_REG_VALUE_08BIT, ++ SC035HGS_GROUP_HOLD_START); ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_REG_COARSE_AGAIN, ++ SC035HGS_REG_VALUE_08BIT, ++ coarse_again); ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_REG_FINE_AGAIN, ++ SC035HGS_REG_VALUE_08BIT, ++ fine_again); ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_REG_COARSE_DGAIN, ++ SC035HGS_REG_VALUE_08BIT, ++ coarse_dgain); ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_REG_FINE_DGAIN, ++ SC035HGS_REG_VALUE_08BIT, ++ fine_dgain); ++ ret |= sc035hgs_write_reg(sc035hgs->client, ++ SC035HGS_GROUP_HOLD, ++ SC035HGS_REG_VALUE_08BIT, ++ SC035HGS_GROUP_HOLD_LUNCH); ++ ++ return ret; ++} ++#else ++static int sc035hgs_set_ctrl_gain(struct sc035hgs *sc035hgs, u32 gain) ++{ ++ u16 a_gain, a_gain_h, a_gain_l; ++ u16 d_gain, d_gain_h, d_gain_l; ++ int ret = 0; ++ ++ if (gain >= 2048) { //8x ++ a_gain_h = 8; ++ a_gain_l = gain >> 7; ++ } else if(gain >= 1024) { //4x ++ a_gain_h = 4; ++ a_gain_l = gain >> 6; ++ } else if(gain >= 512) { //2x ++ a_gain_h = 2; ++ a_gain_l = gain >> 5; ++ } else { //<2x ++ a_gain_h = 1; ++ a_gain_l = gain >> 4; ++ } ++ ++ a_gain = ((a_gain_h - 1) << 10) + a_gain_l; ++ //set analog gain ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_COARSE_AGAIN, ++ SC035HGS_REG_VALUE_16BIT, a_gain); ++ ++ a_gain = a_gain_h * a_gain_l; ++ d_gain = (gain << 3) /a_gain; ++ ++ if (d_gain >= 512) { //4x ++ d_gain_h = 4; ++ d_gain_l = d_gain >> 2; ++ } else if(d_gain >= 256) { //2x ++ d_gain_h = 2; ++ d_gain_l = d_gain >> 1; ++ } else { ++ d_gain_h = 1; ++ d_gain_l = d_gain; ++ } ++ ++ d_gain = ((d_gain_h + 0x0C -1) << 8) + d_gain_l; ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_COARSE_DGAIN, ++ SC035HGS_REG_VALUE_16BIT, d_gain); ++ ++ return ret; ++} ++#endif ++ ++static int __sc035hgs_start_stream(struct sc035hgs *sc035hgs) ++{ ++ int ret; ++ ++ dev_info(&sc035hgs->client->dev, "__sc035hgs_start_stream\n"); ++ ++ if (!IS_ERR(sc035hgs->led1_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->led1_gpio, 1); ++ if (!IS_ERR(sc035hgs->led2_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->led2_gpio, 1); ++ ++ ret = sc035hgs_write_array(sc035hgs->client, sc035hgs->cur_mode->reg_list); ++ if (ret < 0) { ++ dev_err(&sc035hgs->client->dev, "sc035 reg init error\n"); ++ return ret; ++ } ++ ++ /* In case these controls are set before streaming */ ++ mutex_unlock(&sc035hgs->mutex); ++ ret = v4l2_ctrl_handler_setup(&sc035hgs->ctrl_handler); ++ mutex_lock(&sc035hgs->mutex); ++ if (ret) ++ return ret; ++ ++ ret = sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_CTRL_MODE, ++ SC035HGS_REG_VALUE_08BIT, SC035HGS_MODE_STREAMING); ++ ++ ret |= sc035hgs_write_reg(sc035hgs->client, 0x4418, ++ SC035HGS_REG_VALUE_08BIT, 0x08); ++ ret |= sc035hgs_write_reg(sc035hgs->client, 0x363d, ++ SC035HGS_REG_VALUE_08BIT, 0x10); ++ ret |= sc035hgs_write_reg(sc035hgs->client, 0x4419, ++ SC035HGS_REG_VALUE_08BIT, 0x80); ++ ++ if (ret) ++ return ret; ++ ++ return ret; ++} ++ ++static int __sc035hgs_stop_stream(struct sc035hgs *sc035hgs) ++{ ++ dev_info(&sc035hgs->client->dev, "__sc035hgs_stop_stream\n"); ++ if (!IS_ERR(sc035hgs->led1_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->led1_gpio, 0); ++ if (!IS_ERR(sc035hgs->led2_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->led2_gpio, 0); ++ ++ ++ return sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_CTRL_MODE, ++ SC035HGS_REG_VALUE_08BIT, SC035HGS_MODE_SW_STANDBY); ++} ++ ++static int sc035hgs_s_stream(struct v4l2_subdev *sd, int on) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ int ret = 0; ++ ++ mutex_lock(&sc035hgs->mutex); ++ on = !!on; ++ if (on == sc035hgs->streaming) ++ goto unlock_and_return; ++ ++ if (on) { ++ ret = __sc035hgs_start_stream(sc035hgs); ++ if (ret) { ++ v4l2_err(sd, "start stream failed while write regs\n"); ++ goto unlock_and_return; ++ } ++ } else { ++ __sc035hgs_stop_stream(sc035hgs); ++ } ++ ++ sc035hgs->streaming = on; ++ ++unlock_and_return: ++ mutex_unlock(&sc035hgs->mutex); ++ ++ return ret; ++} ++ ++static int sc035hgs_g_frame_interval(struct v4l2_subdev *sd, ++ struct v4l2_subdev_frame_interval *fi) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ const struct sc035hgs_mode *mode = sc035hgs->cur_mode; ++ ++ mutex_lock(&sc035hgs->mutex); ++ fi->interval = mode->max_fps; ++ mutex_unlock(&sc035hgs->mutex); ++ ++ return 0; ++} ++ ++/* Calculate the delay in us by clock rate and clock cycles */ ++static inline u32 sc035hgs_cal_delay(u32 cycles) ++{ ++ return DIV_ROUND_UP(cycles, SC035HGS_XVCLK_FREQ / 1000 / 1000); ++} ++ ++static int __sc035hgs_power_on(struct sc035hgs *sc035hgs) ++{ ++ u32 delay_us; ++ dev_info(&sc035hgs->client->dev, "__sc035hgs_power_on\n"); ++ ++ if (!IS_ERR(sc035hgs->pwdn_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->pwdn_gpio, 0); ++ ++ if (!IS_ERR(sc035hgs->reset_gpio)) { ++ gpiod_set_value_cansleep(sc035hgs->reset_gpio, 1); ++ usleep_range(100, 200); ++ } ++ ++ if (!IS_ERR(sc035hgs->reset_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->reset_gpio, 0); ++ ++ /* 8192 cycles prior to first SCCB transaction */ ++ delay_us = sc035hgs_cal_delay(8192); ++ usleep_range(delay_us, delay_us * 2); ++ return 0; ++} ++ ++static void __sc035hgs_power_off(struct sc035hgs *sc035hgs) ++{ ++ dev_info(&sc035hgs->client->dev, "__sc035hgs_power_off\n"); ++ ++ if (!IS_ERR(sc035hgs->pwdn_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->pwdn_gpio, 1); ++ ++ if (!IS_ERR(sc035hgs->reset_gpio)) ++ gpiod_set_value_cansleep(sc035hgs->reset_gpio, 1); ++} ++ ++static int sc035hgs_s_power(struct v4l2_subdev *sd, int on) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ int ret = 0; ++ ++ mutex_lock(&sc035hgs->mutex); ++ ++ /* If the power state is not modified - no work to do. */ ++ if (sc035hgs->power_on == !!on) ++ goto unlock_and_return; ++ ++ if (on) { ++ __sc035hgs_power_on(sc035hgs); ++ sc035hgs->power_on = true; ++ } else { ++ __sc035hgs_power_off(sc035hgs); ++ sc035hgs->power_on = false; ++ } ++ ++unlock_and_return: ++ mutex_unlock(&sc035hgs->mutex); ++ ++ return ret; ++} ++ ++#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API ++static int sc035hgs_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ++{ ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ struct v4l2_mbus_framefmt *try_fmt = ++ v4l2_subdev_get_try_format(sd, fh->pad, 0); ++ const struct sc035hgs_mode *def_mode = &supported_modes[0]; ++ ++ mutex_lock(&sc035hgs->mutex); ++ /* Initialize try_fmt */ ++ try_fmt->width = def_mode->width; ++ try_fmt->height = def_mode->height; ++ try_fmt->code = sc035hgs->cur_mode->bus_fmt; ++ try_fmt->field = V4L2_FIELD_NONE; ++ ++ mutex_unlock(&sc035hgs->mutex); ++ /* No crop or compose */ ++ ++ return 0; ++} ++#endif ++ ++static int sc035hgs_g_mbus_config(struct v4l2_subdev *sd, ++ struct v4l2_mbus_config *config) ++{ ++ u32 val = 0; ++ ++ val = 1 << (SC035HGS_LANES - 1) | ++ V4L2_MBUS_CSI2_CHANNEL_0 | ++ V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; ++ ++ config->type = V4L2_MBUS_CSI2; ++ config->flags = val; ++ ++ return 0; ++} ++ ++static int sc035hgs_enum_frame_interval(struct v4l2_subdev *sd, ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_frame_interval_enum *fie) ++{ ++ if (fie->index >= ARRAY_SIZE(supported_modes)) ++ return -EINVAL; ++ ++ fie->code = supported_modes[fie->index].bus_fmt; ++ fie->width = supported_modes[fie->index].width; ++ fie->height = supported_modes[fie->index].height; ++ fie->interval = supported_modes[fie->index].max_fps; ++ ++ return 0; ++} ++ ++#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API ++static const struct v4l2_subdev_internal_ops sc035hgs_internal_ops = { ++ .open = sc035hgs_open, ++}; ++#endif ++ ++static const struct v4l2_subdev_core_ops sc035hgs_core_ops = { ++ .s_power = sc035hgs_s_power, ++ .ioctl = sc035hgs_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl32 = sc035hgs_compat_ioctl32, ++#endif ++}; ++ ++static const struct v4l2_subdev_video_ops sc035hgs_video_ops = { ++ .s_stream = sc035hgs_s_stream, ++ .g_frame_interval = sc035hgs_g_frame_interval, ++ .g_mbus_config = sc035hgs_g_mbus_config, ++ ++}; ++ ++static const struct v4l2_subdev_pad_ops sc035hgs_pad_ops = { ++ .enum_mbus_code = sc035hgs_enum_mbus_code, ++ .enum_frame_size = sc035hgs_enum_frame_sizes, ++ .enum_frame_interval = sc035hgs_enum_frame_interval, ++ .get_fmt = sc035hgs_get_fmt, ++ .set_fmt = sc035hgs_set_fmt, ++}; ++ ++static const struct v4l2_subdev_ops sc035hgs_subdev_ops = { ++ .core = &sc035hgs_core_ops, ++ .video = &sc035hgs_video_ops, ++ .pad = &sc035hgs_pad_ops, ++}; ++ ++static int sc035hgs_set_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct sc035hgs *sc035hgs = container_of(ctrl->handler, ++ struct sc035hgs, ctrl_handler); ++ struct i2c_client *client = sc035hgs->client; ++ s64 max; ++ u32 val = 0; ++ u32 vts = 0; ++ int ret = 0; ++ ++ /* Propagate change of current control to all related controls */ ++ switch (ctrl->id) { ++ case V4L2_CID_VBLANK: ++ /* Update max exposure while meeting expected vblanking */ ++ max = sc035hgs->cur_mode->height + ctrl->val - 6; ++ dev_dbg(&client->dev, "set max 0x%llx\n", max); ++ __v4l2_ctrl_modify_range(sc035hgs->exposure, ++ sc035hgs->exposure->minimum, max, ++ sc035hgs->exposure->step, ++ sc035hgs->exposure->default_value); ++ break; ++ } ++ ++ switch (ctrl->id) { ++ case V4L2_CID_EXPOSURE: ++ dev_dbg(&client->dev, "set exposure 0x%x\n", ctrl->val); ++ ret = sc035hgs_write_reg(sc035hgs->client, SC035HGS_GROUP_HOLD, ++ SC035HGS_REG_VALUE_08BIT, ++ SC035HGS_GROUP_HOLD_START); ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_EXPOSURE, ++ SC035HGS_REG_VALUE_16BIT, ctrl->val << 4); ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_GROUP_HOLD, ++ SC035HGS_REG_VALUE_08BIT, ++ SC035HGS_GROUP_HOLD_LUNCH); ++ break; ++ ++ case V4L2_CID_GAIN: ++ case V4L2_CID_ANALOGUE_GAIN: ++ dev_dbg(&client->dev, "set again 0x%x\n", ctrl->val); ++ ret = sc035hgs_set_ctrl_gain(sc035hgs, ctrl->val); ++ break; ++ case V4L2_CID_VBLANK: ++ vts = ctrl->val + sc035hgs->cur_mode->height; ++ dev_dbg(&client->dev, "set vts 0x%x\n", vts); ++ ret = sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_VTS, ++ SC035HGS_REG_VALUE_16BIT, vts); ++ break; ++ case V4L2_CID_TEST_PATTERN: ++ ret = sc035hgs_enable_test_pattern(sc035hgs, ctrl->val); ++ break; ++ case V4L2_CID_HFLIP: ++ ret = sc035hgs_read_reg(sc035hgs->client, SC035HGS_REG_FLIP_MIRROR, ++ SC035HGS_REG_VALUE_08BIT, &val); ++ if (ret) ++ break; ++ if (ctrl->val) ++ val |= SC035HGS_MIRROR_MASK; ++ else ++ val &= ~SC035HGS_MIRROR_MASK; ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_FLIP_MIRROR, ++ SC035HGS_REG_VALUE_08BIT, val); ++ break; ++ case V4L2_CID_VFLIP: ++ ret = sc035hgs_read_reg(sc035hgs->client, SC035HGS_REG_FLIP_MIRROR, ++ SC035HGS_REG_VALUE_08BIT, &val); ++ if (ret) ++ break; ++ if (ctrl->val) ++ val |= SC035HGS_FLIP_MASK; ++ else ++ val &= ~SC035HGS_FLIP_MASK; ++ ret |= sc035hgs_write_reg(sc035hgs->client, SC035HGS_REG_FLIP_MIRROR, ++ SC035HGS_REG_VALUE_08BIT, val); ++ break; ++ default: ++ dev_warn(&client->dev, "%s Unhandled id:0x%x, val:0x%x\n", ++ __func__, ctrl->id, ctrl->val); ++ break; ++ } ++ ++ return ret; ++} ++ ++static const struct v4l2_ctrl_ops sc035hgs_ctrl_ops = { ++ .s_ctrl = sc035hgs_set_ctrl, ++}; ++ ++static int sc035hgs_initialize_controls(struct sc035hgs *sc035hgs) ++{ ++ const struct sc035hgs_mode *mode; ++ struct v4l2_ctrl_handler *handler; ++ struct v4l2_ctrl *ctrl; ++ s64 exposure_max, vblank_def; ++ u32 h_blank; ++ int ret; ++ ++ handler = &sc035hgs->ctrl_handler; ++ mode = sc035hgs->cur_mode; ++ ret = v4l2_ctrl_handler_init(handler, 10); ++ if (ret) ++ return ret; ++ handler->lock = &sc035hgs->mutex; ++ ++ ctrl = v4l2_ctrl_new_int_menu(handler, NULL, V4L2_CID_LINK_FREQ, ++ 0, 0, link_freq_menu_items); ++ if (ctrl) ++ ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; ++ ++ v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE, ++ 0, SC035HGS_PIXEL_RATE, 1, SC035HGS_PIXEL_RATE); ++ ++ h_blank = mode->hts_def - mode->width; ++ sc035hgs->hblank = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_HBLANK, ++ h_blank, h_blank, 1, h_blank); ++ if (sc035hgs->hblank) ++ sc035hgs->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; ++ ++ vblank_def = mode->vts_def - mode->height; ++ sc035hgs->vblank = v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_VBLANK, vblank_def, ++ SC035HGS_VTS_MAX - mode->height, ++ 1, vblank_def); ++ ++ exposure_max = mode->vts_def - 6; ++ sc035hgs->exposure = v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_EXPOSURE, SC035HGS_EXPOSURE_MIN, ++ exposure_max, SC035HGS_EXPOSURE_STEP, ++ mode->exp_def); ++ ++ sc035hgs->anal_gain = v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_ANALOGUE_GAIN, ANALOG_GAIN_MIN, ++ ANALOG_GAIN_MAX, ANALOG_GAIN_STEP, ++ ANALOG_GAIN_DEFAULT); ++ ++ sc035hgs->digi_gain = v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_GAIN, ANALOG_GAIN_MIN, ++ ANALOG_GAIN_MAX, ANALOG_GAIN_STEP, ++ ANALOG_GAIN_DEFAULT); ++ ++ v4l2_ctrl_new_std_menu_items(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_TEST_PATTERN, ++ ARRAY_SIZE(sc035hgs_test_pattern_menu) - 1, ++ 0, 0, sc035hgs_test_pattern_menu); ++ ++ v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_HFLIP, 0, 1, 1, 0); ++ ++ v4l2_ctrl_new_std(handler, &sc035hgs_ctrl_ops, ++ V4L2_CID_VFLIP, 0, 1, 1, 0); ++ ++ if (handler->error) { ++ ret = handler->error; ++ dev_err(&sc035hgs->client->dev, ++ "Failed to init controls(%d)\n", ret); ++ goto err_free_handler; ++ } ++ ++ sc035hgs->subdev.ctrl_handler = handler; ++ ++ return 0; ++ ++err_free_handler: ++ v4l2_ctrl_handler_free(handler); ++ ++ return ret; ++} ++ ++static int sc035hgs_check_sensor_id(struct sc035hgs *sc035hgs, ++ struct i2c_client *client) ++{ ++ struct device *dev = &sc035hgs->client->dev; ++ u32 id = 0; ++ int ret; ++ ++ ret = sc035hgs_read_reg(client, SC035HGS_REG_CHIP_ID, ++ SC035HGS_REG_VALUE_24BIT, &id); ++ if (id != CHIP_ID) { ++ dev_err(dev, "Unexpected sensor id(%04x), ret(%d)\n", id, ret); ++ return -ENODEV; ++ } ++ ++ dev_info(dev, "Detected SC035HGS CHIP ID = 0x%04x sensor\n", CHIP_ID); ++ ++ return 0; ++} ++ ++static int sc035hgs_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct device *dev = &client->dev; ++ struct device_node *node = dev->of_node; ++ struct sc035hgs *sc035hgs; ++ struct v4l2_subdev *sd; ++ char facing[2]; ++ int ret; ++ ++ dev_info(dev, "driver version: %02x.%02x.%02x", ++ DRIVER_VERSION >> 16, ++ (DRIVER_VERSION & 0xff00) >> 8, ++ DRIVER_VERSION & 0x00ff); ++ ++ sc035hgs = devm_kzalloc(dev, sizeof(*sc035hgs), GFP_KERNEL); ++ if (!sc035hgs) ++ return -ENOMEM; ++ ++ ret = of_property_read_u32(node, CANAANMODULE_CAMERA_MODULE_INDEX, ++ &sc035hgs->module_index); ++ ret |= of_property_read_string(node, CANAANMODULE_CAMERA_MODULE_FACING, ++ &sc035hgs->module_facing); ++ ret |= of_property_read_string(node, CANAANMODULE_CAMERA_MODULE_NAME, ++ &sc035hgs->module_name); ++ ret |= of_property_read_string(node, CANAANMODULE_CAMERA_LENS_NAME, ++ &sc035hgs->len_name); ++ if (ret) { ++ dev_err(dev, "could not get module information!\n"); ++ return -EINVAL; ++ } ++ ++ sc035hgs->client = client; ++ sc035hgs->cur_mode = &supported_modes[0]; ++ ++ sc035hgs->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); ++ if (IS_ERR(sc035hgs->reset_gpio)) ++ dev_warn(dev, "Failed to get reset-gpios\n"); ++ ++ sc035hgs->pwdn_gpio = devm_gpiod_get(dev, "pwdn", GPIOD_OUT_LOW); ++ if (IS_ERR(sc035hgs->pwdn_gpio)) ++ dev_warn(dev, "Failed to get pwdn-gpios\n"); ++ ++ sc035hgs->strobe_gpio = devm_gpiod_get(dev, "strobe", GPIOD_IN); ++ if (IS_ERR(sc035hgs->strobe_gpio)) ++ dev_warn(dev, "Failed to get strobe-gpios\n"); ++ ++ sc035hgs->led1_gpio = devm_gpiod_get(dev, "led1", GPIOD_OUT_LOW); ++ if (IS_ERR(sc035hgs->led1_gpio)) ++ dev_warn(dev, "Failed to get led1-gpios\n"); ++ ++ sc035hgs->led2_gpio = devm_gpiod_get(dev, "led2", GPIOD_OUT_LOW); ++ if (IS_ERR(sc035hgs->led2_gpio)) ++ dev_warn(dev, "Failed to get led2-gpios\n"); ++ ++ sc035hgs->key1_gpio = devm_gpiod_get(dev, "key1", GPIOD_IN); ++ if (IS_ERR(sc035hgs->key1_gpio)) ++ dev_warn(dev, "Failed to get key1-gpios\n"); ++ ++ sc035hgs->key2_gpio = devm_gpiod_get(dev, "key2", GPIOD_IN); ++ if (IS_ERR(sc035hgs->key2_gpio)) ++ dev_warn(dev, "Failed to get key2-gpios\n"); ++ ++ if (gpiod_export(sc035hgs->led1_gpio, 0)) { ++ dev_err(dev, "gpiod export sc035hgs led1 failed."); ++ } ++ ++ if (gpiod_export(sc035hgs->led2_gpio, 0)) { ++ dev_err(dev, "gpiod export sc035hgs led2 failed."); ++ } ++ ++ mutex_init(&sc035hgs->mutex); ++ ++ sd = &sc035hgs->subdev; ++ v4l2_i2c_subdev_init(sd, client, &sc035hgs_subdev_ops); ++ ret = sc035hgs_initialize_controls(sc035hgs); ++ if (ret) ++ goto err_destroy_mutex; ++ ++ ret = __sc035hgs_power_on(sc035hgs); ++ if (ret) ++ goto err_free_handler; ++ ++ ret = sc035hgs_check_sensor_id(sc035hgs, client); ++ if (ret) ++ goto err_power_off; ++ ++#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API ++ sd->internal_ops = &sc035hgs_internal_ops; ++ sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | ++ V4L2_SUBDEV_FL_HAS_EVENTS; ++#endif ++#if defined(CONFIG_MEDIA_CONTROLLER) ++ sc035hgs->pad.flags = MEDIA_PAD_FL_SOURCE; ++ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; ++ ret = media_entity_pads_init(&sd->entity, 1, &sc035hgs->pad); ++ if (ret < 0) ++ goto err_power_off; ++#endif ++ ++ memset(facing, 0, sizeof(facing)); ++ if (strcmp(sc035hgs->module_facing, "back") == 0) ++ facing[0] = 'b'; ++ else ++ facing[0] = 'f'; ++ ++ snprintf(sd->name, sizeof(sd->name), "m%02d_%s_%s %s", ++ sc035hgs->module_index, facing, ++ SC035HGS_NAME, dev_name(sd->dev)); ++ ret = v4l2_async_register_subdev_sensor_common(sd); ++ if (ret) { ++ dev_err(dev, "v4l2 async register subdev failed\n"); ++ goto err_clean_entity; ++ } ++ ++ return 0; ++ ++err_clean_entity: ++#if defined(CONFIG_MEDIA_CONTROLLER) ++ media_entity_cleanup(&sd->entity); ++#endif ++err_power_off: ++ __sc035hgs_power_off(sc035hgs); ++err_free_handler: ++ v4l2_ctrl_handler_free(&sc035hgs->ctrl_handler); ++err_destroy_mutex: ++ mutex_destroy(&sc035hgs->mutex); ++ ++ return ret; ++} ++ ++static int sc035hgs_remove(struct i2c_client *client) ++{ ++ struct v4l2_subdev *sd = i2c_get_clientdata(client); ++ struct sc035hgs *sc035hgs = to_sc035hgs(sd); ++ ++ v4l2_async_unregister_subdev(sd); ++#if defined(CONFIG_MEDIA_CONTROLLER) ++ media_entity_cleanup(&sd->entity); ++#endif ++ v4l2_ctrl_handler_free(&sc035hgs->ctrl_handler); ++ mutex_destroy(&sc035hgs->mutex); ++ ++ __sc035hgs_power_off(sc035hgs); ++ ++ return 0; ++} ++ ++static const struct of_device_id sc035hgs_of_match[] = { ++ { .compatible = "smartsens,sc035hgs" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, sc035hgs_of_match); ++ ++static const struct i2c_device_id sc035hgs_match_id[] = { ++ { "smartsens,sc035hgs", 0 }, ++ { }, ++}; ++ ++static struct i2c_driver sc035hgs_i2c_driver = { ++ .driver = { ++ .name = SC035HGS_NAME, ++ .of_match_table = of_match_ptr(sc035hgs_of_match), ++ }, ++ .probe = &sc035hgs_probe, ++ .remove = &sc035hgs_remove, ++ .id_table = sc035hgs_match_id, ++}; ++ ++module_i2c_driver(sc035hgs_i2c_driver); ++MODULE_DESCRIPTION("SmartSens sc035hgs Camera driver"); ++MODULE_LICENSE("GPL v2"); +-- +2.25.1 + diff --git a/package/patches/linux/0034-canaan-isp-fix-f2k-int-clear-error-main-ds2-out-buff.patch b/package/patches/linux/0034-canaan-isp-fix-f2k-int-clear-error-main-ds2-out-buff.patch new file mode 100644 index 0000000..b1a84fe --- /dev/null +++ b/package/patches/linux/0034-canaan-isp-fix-f2k-int-clear-error-main-ds2-out-buff.patch @@ -0,0 +1,8850 @@ +From 011aeae5ba1500ed9529836cb6ac98aec29fea86 Mon Sep 17 00:00:00 2001 +From: "Chenggen.Wang" +Date: Fri, 14 Oct 2022 15:38:16 +0800 +Subject: [PATCH] canaan-isp: fix f2k int clear error & main/ds2 out buffer + drop error. + +Signed-off-by: Chenggen.Wang +--- + .../platform/canaan-isp/isp_2k/isp_f2k.c | 2477 +++++++++-------- + .../platform/canaan-isp/isp_2k/isp_r2k.c | 2319 +++++++-------- + drivers/media/platform/canaan-isp/k510_isp.c | 932 +++---- + 3 files changed, 2866 insertions(+), 2862 deletions(-) + mode change 100755 => 100644 drivers/media/platform/canaan-isp/isp_2k/isp_f2k.c + mode change 100755 => 100644 drivers/media/platform/canaan-isp/isp_2k/isp_r2k.c + mode change 100755 => 100644 drivers/media/platform/canaan-isp/k510_isp.c + +diff --git a/drivers/media/platform/canaan-isp/isp_2k/isp_f2k.c b/drivers/media/platform/canaan-isp/isp_2k/isp_f2k.c +old mode 100755 +new mode 100644 +index 1b3fc56a..d96141c9 +--- a/drivers/media/platform/canaan-isp/isp_2k/isp_f2k.c ++++ b/drivers/media/platform/canaan-isp/isp_2k/isp_f2k.c +@@ -3,7 +3,7 @@ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +-*/ ++ */ + #include + #include + #include +@@ -42,12 +42,12 @@ static unsigned long long get_usec(void) + + + /**************************************************************************** +-*wrap +-*****************************************************************************/ ++ *wrap ++ *****************************************************************************/ + // + void isp_f2k_wrap_SetComRst(struct k510_isp_device *isp) + { +- ISP_WRAP_RST_CTL_S stRstCtl; ++ ISP_WRAP_RST_CTL_S stRstCtl; + stRstCtl.sw_3dnr_rst = 1; + stRstCtl.wdr_2_frame_rst = 1; + stRstCtl.wdr_3_frame_rst =1; +@@ -62,62 +62,62 @@ void isp_f2k_wrap_SetComRst(struct k510_isp_device *isp) + stRstCtl.core_cfg_rst = 1; + stRstCtl.axi_wr_ch_rst = 1; + stRstCtl.axi_rd_ch_rst = 1; +- Isp_Drv_F2k_Wrap_SetPipeReset(isp,&stRstCtl); ++ Isp_Drv_F2k_Wrap_SetPipeReset(isp,&stRstCtl); + } + // + void isp_f2k_wrap_SetDmaRst(struct k510_isp_device *isp) + { + +- ISP_WRAP_DMA_RST_CTL_S stDmaRstCtl; +- stDmaRstCtl.y_3dnr_wr_ch_rst = 1; +- stDmaRstCtl.uv_3dnr_wr_ch_rst = 1; +- stDmaRstCtl.ldc_y_wr_ch_rst = 1; +- stDmaRstCtl.ldc_uv_wr_ch_rst = 1; +- stDmaRstCtl.wdr_raw_wr_ch_rst = 1; +- stDmaRstCtl.main_out_y_wr_ch_rst = 1; +- stDmaRstCtl.main_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.y_3dnr_rd_ch_rst = 1; +- stDmaRstCtl.uv_3dnr_rd_ch_rst = 1; +- stDmaRstCtl.ldc_y_rd_ch_rst = 1; +- stDmaRstCtl.ldc_uv_rd_ch_rst = 1; +- stDmaRstCtl.wdr_raw_rd_ch_rst = 1; +- stDmaRstCtl.ds0_out_y_wr_ch_rst = 1; +- stDmaRstCtl.ds0_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.ds1_out_y_wr_ch_rst = 1; +- stDmaRstCtl.ds1_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_r_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_g_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_b_wr_ch_rst = 1; +- stDmaRstCtl.ds0_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds0_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd2_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd2_rd_ch_rst = 1; +- Isp_Drv_F2k_Wrap_SetDmaReset(isp,&stDmaRstCtl); ++ ISP_WRAP_DMA_RST_CTL_S stDmaRstCtl; ++ stDmaRstCtl.y_3dnr_wr_ch_rst = 1; ++ stDmaRstCtl.uv_3dnr_wr_ch_rst = 1; ++ stDmaRstCtl.ldc_y_wr_ch_rst = 1; ++ stDmaRstCtl.ldc_uv_wr_ch_rst = 1; ++ stDmaRstCtl.wdr_raw_wr_ch_rst = 1; ++ stDmaRstCtl.main_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.main_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.y_3dnr_rd_ch_rst = 1; ++ stDmaRstCtl.uv_3dnr_rd_ch_rst = 1; ++ stDmaRstCtl.ldc_y_rd_ch_rst = 1; ++ stDmaRstCtl.ldc_uv_rd_ch_rst = 1; ++ stDmaRstCtl.wdr_raw_rd_ch_rst = 1; ++ stDmaRstCtl.ds0_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.ds0_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.ds1_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.ds1_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_r_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_g_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_b_wr_ch_rst = 1; ++ stDmaRstCtl.ds0_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds0_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd2_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd2_rd_ch_rst = 1; ++ Isp_Drv_F2k_Wrap_SetDmaReset(isp,&stDmaRstCtl); + } + // + void isp_f2k_wrap_SetPipeClkCtl(struct k510_isp_device *isp) + { + +- ISP_WRAP_PIPE_CLK_CTL_S pstPipeClkCtl; +- pstPipeClkCtl.wrap_com_clk_en = 1; +- pstPipeClkCtl.wrap_cfg_clk_en = 1; +- pstPipeClkCtl.core_com_clk_en = 1; +- pstPipeClkCtl.core_cfg_clk_en = 1; +- pstPipeClkCtl.axi_wr_ch_en = 1; +- pstPipeClkCtl.axi_rd_ch_en = 1; ++ ISP_WRAP_PIPE_CLK_CTL_S pstPipeClkCtl; ++ pstPipeClkCtl.wrap_com_clk_en = 1; ++ pstPipeClkCtl.wrap_cfg_clk_en = 1; ++ pstPipeClkCtl.core_com_clk_en = 1; ++ pstPipeClkCtl.core_cfg_clk_en = 1; ++ pstPipeClkCtl.axi_wr_ch_en = 1; ++ pstPipeClkCtl.axi_rd_ch_en = 1; + Isp_Drv_F2k_Wrap_SetComClkCtl(isp,&pstPipeClkCtl); + } + // + void isp_f2k_wrap_SetWdr(struct k510_isp_device *isp,struct isp_wrap_wdr_info *wdrInfo) + { +- ISP_WRAP_WDR_ATTR_S pstWdrAttr; +- ISP_WRAP_WDR_CLK_CTL_S *stWdrClkCtl = &pstWdrAttr.stWdrClkCtl; ++ ISP_WRAP_WDR_ATTR_S pstWdrAttr; ++ ISP_WRAP_WDR_CLK_CTL_S *stWdrClkCtl = &pstWdrAttr.stWdrClkCtl; + ISP_WRAP_WDR_DMA_EN_CTL_S *stWdrDmaEn = &pstWdrAttr.stWdrDmaEn; +- ISP_WRAP_WDR_MODE_CTL_S *stWdrModeCtl = &pstWdrAttr.stWdrModeCtl; ++ ISP_WRAP_WDR_MODE_CTL_S *stWdrModeCtl = &pstWdrAttr.stWdrModeCtl; + if( ISP_PIPE_WDR_2_FRAME == wdrInfo->wdr_mode) + { + stWdrClkCtl->wdr_2_frame_clk_en = 1; +@@ -154,22 +154,22 @@ void isp_f2k_wrap_SetWdr(struct k510_isp_device *isp,struct isp_wrap_wdr_info *w + stWdrModeCtl->wdr_long_l2_buf_en = 0; + stWdrModeCtl->wdr_short_s1_buf_en = 0; + } +- ISP_WRAP_WDR_PIXEL_FORMAT_CTL_S *stWdrPixelFormat = &pstWdrAttr.stWdrPixelFormat; ++ ISP_WRAP_WDR_PIXEL_FORMAT_CTL_S *stWdrPixelFormat = &pstWdrAttr.stWdrPixelFormat; + stWdrPixelFormat->wdr_long_img_format = ISP_RGBRAW_DATA; + stWdrPixelFormat->wdr_long_img_out_format = IN_YUV422; + stWdrPixelFormat->wdr_long_pixel_width = PIXEL_12; + stWdrPixelFormat->wdr_long_yuv422_pxl_order = YUYV; + stWdrPixelFormat->wdr_long_yuv_in_format =IN_YUV422; +- ISP_WRAP_WDR_BUF_S *stWdrBuf = &pstWdrAttr.stWdrBuf; ++ ISP_WRAP_WDR_BUF_S *stWdrBuf = &pstWdrAttr.stWdrBuf; + stWdrBuf->wdr_buf_base = 0x0; + stWdrBuf->wdr_buf_size = 0x0; + stWdrBuf->wdr_line_stride = 0x0; +- Isp_Drv_F2k_Wrap_SetWdr(isp,&pstWdrAttr); ++ Isp_Drv_F2k_Wrap_SetWdr(isp,&pstWdrAttr); + } + // + void isp_f2k_wrap_Set3dnr(struct k510_isp_device *isp,struct isp_wrap_3dnr_info *nr3dInfo) + { +- ISP_WRAP_3DNR_ATTR_S pst3dnrAttr; ++ ISP_WRAP_3DNR_ATTR_S pst3dnrAttr; + if( 1 == nr3dInfo->nr3d_en) + { + pst3dnrAttr.clk_3dnr_en = 1; +@@ -192,7 +192,7 @@ void isp_f2k_wrap_Set3dnr(struct k510_isp_device *isp,struct isp_wrap_3dnr_info + pst3dnrAttr.nr3d_fbcd_en = 0; + pst3dnrAttr.nr3d_mv_out_en = 0; + } +- ISP_WRAP_3DNR_PIXEL_FORMAT_CTL_S *st3DnrPixelFormat = &pst3dnrAttr.st3DnrPixelFormat; ++ ISP_WRAP_3DNR_PIXEL_FORMAT_CTL_S *st3DnrPixelFormat = &pst3dnrAttr.st3DnrPixelFormat; + st3DnrPixelFormat->y_3dnr_img_format = nr3dInfo->nr3d_y_img_format;//ISP_RGBRAW_DATA; + st3DnrPixelFormat->y_3dnr_img_out_format = nr3dInfo->nr3d_y_img_out_format;//IN_YUV422; + st3DnrPixelFormat->y_3dnr_pixel_width = nr3dInfo->nr3d_y_pixel_width;//PIXEL_12; +@@ -203,17 +203,17 @@ void isp_f2k_wrap_Set3dnr(struct k510_isp_device *isp,struct isp_wrap_3dnr_info + st3DnrPixelFormat->uv_3dnr_pixel_width = nr3dInfo->nr3d_uv_yuv422_pxl_order;//PIXEL_8; + st3DnrPixelFormat->uv_3dnr_yuv422_pxl_order = nr3dInfo->nr3d_uv_yuv422_pxl_order;//YUYV; + st3DnrPixelFormat->uv_3dnr_yuv_in_format = nr3dInfo->nr3d_uv_yuv_in_format;//IN_YUV422; +- ISP_WRAP_3DNR_BUF_S *st3dnrBuf = &pst3dnrAttr.st3dnrBuf; +- st3dnrBuf->y_3dnr_buf_base = nr3dInfo->nr3d_y_buf_base;//ISP_BUF_3DNR_Y; +- st3dnrBuf->uv_3dnr_buf_base = nr3dInfo->nr3d_uv_buf_base;//ISP_BUF_3DNR_UV; +- st3dnrBuf->y_3dnr_line_stride = nr3dInfo->nr3d_y_line_stride;//ISP_BUF_3DNR_Y_STRIDE; +- st3dnrBuf->uv_3dnr_line_stride = nr3dInfo->nr3d_uv_line_stride;//ISP_BUF_3DNR_UV_STRIDE; +- Isp_Drv_F2k_Wrap_Set3Dnr(isp,&pst3dnrAttr); ++ ISP_WRAP_3DNR_BUF_S *st3dnrBuf = &pst3dnrAttr.st3dnrBuf; ++ st3dnrBuf->y_3dnr_buf_base = nr3dInfo->nr3d_y_buf_base;//ISP_BUF_3DNR_Y; ++ st3dnrBuf->uv_3dnr_buf_base = nr3dInfo->nr3d_uv_buf_base;//ISP_BUF_3DNR_UV; ++ st3dnrBuf->y_3dnr_line_stride = nr3dInfo->nr3d_y_line_stride;//ISP_BUF_3DNR_Y_STRIDE; ++ st3dnrBuf->uv_3dnr_line_stride = nr3dInfo->nr3d_uv_line_stride;//ISP_BUF_3DNR_UV_STRIDE; ++ Isp_Drv_F2k_Wrap_Set3Dnr(isp,&pst3dnrAttr); + } + // + void isp_f2k_wrap_SetLdc(struct k510_isp_device *isp,struct isp_wrap_ldc_info *ldcInfo) + { +- ISP_WRAP_LDC_ATTR_S pstLdcAttr; ++ ISP_WRAP_LDC_ATTR_S pstLdcAttr; + if( 1 == ldcInfo->ldc_en) + { + pstLdcAttr.ldc_clk_en = 1; +@@ -224,18 +224,18 @@ void isp_f2k_wrap_SetLdc(struct k510_isp_device *isp,struct isp_wrap_ldc_info *l + pstLdcAttr.ldc_clk_en = 0; + pstLdcAttr.ldc_dma_en = 0; + } +- ISP_WRAP_LDC_BUF_S *stLdcBuf = &pstLdcAttr.stLdcBuf; +- stLdcBuf->ldc_y_buf_base = ldcInfo->ldc_y_buf_base;//ISP_BUF_LDC_Y; +- stLdcBuf->ldc_uv_buf_base = ldcInfo->ldc_uv_buf_base;//ISP_BUF_LDC_UV; +- stLdcBuf->ldc_y_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_Y_STRIDE; +- stLdcBuf->ldc_uv_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_UV_STRIDE; +- Isp_Drv_F2k_Wrap_SetLdc(isp,&pstLdcAttr); ++ ISP_WRAP_LDC_BUF_S *stLdcBuf = &pstLdcAttr.stLdcBuf; ++ stLdcBuf->ldc_y_buf_base = ldcInfo->ldc_y_buf_base;//ISP_BUF_LDC_Y; ++ stLdcBuf->ldc_uv_buf_base = ldcInfo->ldc_uv_buf_base;//ISP_BUF_LDC_UV; ++ stLdcBuf->ldc_y_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_Y_STRIDE; ++ stLdcBuf->ldc_uv_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_UV_STRIDE; ++ Isp_Drv_F2k_Wrap_SetLdc(isp,&pstLdcAttr); + } + // + void isp_f2k_wrap_SetMainOut(struct k510_isp_device *isp,struct isp_wrap_main_info *mainInfo) + { +- ISP_WRAP_MAINOUT_ATTR_S pstMainOutAttr; +- pstMainOutAttr.main_out_clk_en = 1; ++ ISP_WRAP_MAINOUT_ATTR_S pstMainOutAttr; ++ pstMainOutAttr.main_out_clk_en = 1; + if( 1 == mainInfo->main_out_en) + { + pstMainOutAttr.main_out_dma_en = 1; +@@ -245,34 +245,34 @@ void isp_f2k_wrap_SetMainOut(struct k510_isp_device *isp,struct isp_wrap_main_in + { + //pstMainOutAttr.main_out_clk_en = 0; + pstMainOutAttr.main_out_dma_en = 0; +- pstMainOutAttr.pix_remap_main_en = 0; ++ pstMainOutAttr.pix_remap_main_en = 0; + } +- ISP_WRAP_MAIN_PIXEL_FORMAT_CTL_S *stMainPixelFormat = &pstMainOutAttr.stMainPixelFormat; ++ ISP_WRAP_MAIN_PIXEL_FORMAT_CTL_S *stMainPixelFormat = &pstMainOutAttr.stMainPixelFormat; + stMainPixelFormat->main_out_img_format = mainInfo->main_out_img_format;//ISP_YUV_DATA; + stMainPixelFormat->main_out_img_out_format = mainInfo->main_out_img_out_format;//IN_YUV420; + stMainPixelFormat->main_out_pixel_width = mainInfo->main_out_pxl_width;//PIXEL_8; + stMainPixelFormat->main_out_yuv422_pxl_order = mainInfo->main_out_yuv422_pxl_order;//YUYV; + stMainPixelFormat->main_out_yuv_in_format = mainInfo->main_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_MAIN_OUT_SIZE_S *stMainOutSize = &pstMainOutAttr.stMainOutSize; ++ ISP_WRAP_MAIN_OUT_SIZE_S *stMainOutSize = &pstMainOutAttr.stMainOutSize; + stMainOutSize->main_out_h_size = mainInfo->main_size.Width - 1; + stMainOutSize->main_out_v_size = mainInfo->main_size.Height - 1; +- ISP_WRAP_MAIN_BUF_S *stMainBuf = &pstMainOutAttr.stMainBuf; +- stMainBuf->main_y_buf0_base = mainInfo->main_y_buf0_base;//ISP_BUF_MAIN_Y; +- stMainBuf->main_y_buf1_base = mainInfo->main_y_buf1_base;//ISP_BUF_MAIN_Y; +- stMainBuf->main_uv_buf0_base = mainInfo->main_uv_buf0_base;//ISP_BUF_MAIN_UV; +- stMainBuf->main_uv_buf1_base = mainInfo->main_uv_buf1_base;//ISP_BUF_MAIN_UV; +- stMainBuf->main_y_line_stride = mainInfo->main_line_stride;//SP_BUF_MAIN_Y_STRIDE; +- stMainBuf->main_uv_line_stride = mainInfo->main_line_stride;//ISP_BUF_MAIN_UV_STRIDE; +- Isp_Drv_F2k_Wrap_SetMainOut(isp,&pstMainOutAttr); ++ ISP_WRAP_MAIN_BUF_S *stMainBuf = &pstMainOutAttr.stMainBuf; ++ stMainBuf->main_y_buf0_base = mainInfo->main_y_buf0_base;//ISP_BUF_MAIN_Y; ++ stMainBuf->main_y_buf1_base = mainInfo->main_y_buf1_base;//ISP_BUF_MAIN_Y; ++ stMainBuf->main_uv_buf0_base = mainInfo->main_uv_buf0_base;//ISP_BUF_MAIN_UV; ++ stMainBuf->main_uv_buf1_base = mainInfo->main_uv_buf1_base;//ISP_BUF_MAIN_UV; ++ stMainBuf->main_y_line_stride = mainInfo->main_line_stride;//SP_BUF_MAIN_Y_STRIDE; ++ stMainBuf->main_uv_line_stride = mainInfo->main_line_stride;//ISP_BUF_MAIN_UV_STRIDE; ++ Isp_Drv_F2k_Wrap_SetMainOut(isp,&pstMainOutAttr); + } + // + void isp_f2k_wrap_SetDs0Out(struct k510_isp_device *isp,struct isp_wrap_ds0_info *ds0Info) + { + unsigned int Width = ds0Info->ds0_size.Width; + unsigned int Height = ds0Info->ds0_size.Height; +- ISP_WRAP_DS0OUT_ATTR_S pstDs0OutAttr; +- ISP_WRAP_DS0_CLK_CTL_S *stDs0ClkCtl = &pstDs0OutAttr.stDs0ClkCtl; +- ISP_WRAP_DS0_DMA_EN_CTL_S *stDs0DmaEn = &pstDs0OutAttr.stDs0DmaEn; ++ ISP_WRAP_DS0OUT_ATTR_S pstDs0OutAttr; ++ ISP_WRAP_DS0_CLK_CTL_S *stDs0ClkCtl = &pstDs0OutAttr.stDs0ClkCtl; ++ ISP_WRAP_DS0_DMA_EN_CTL_S *stDs0DmaEn = &pstDs0OutAttr.stDs0DmaEn; + + stDs0ClkCtl->ds0_out_clk_en = 1; + stDs0ClkCtl->ds0_out_y_ch_clk_en = 1; +@@ -320,33 +320,33 @@ void isp_f2k_wrap_SetDs0Out(struct k510_isp_device *isp,struct isp_wrap_ds0_info + stDs0DmaEn->ds0_osd1_ch_dma_en = 0; + stDs0DmaEn->ds0_osd2_ch_dma_en = 0; + } +- pstDs0OutAttr.pix_remap_out0_en = ds0Info->pix_remap_out0_en; +- ISP_WRAP_DS0_PIXEL_FORMAT_CTL_S *stDs0PixelFormat = &pstDs0OutAttr.stDs0PixelFormat; ++ pstDs0OutAttr.pix_remap_out0_en = ds0Info->pix_remap_out0_en; ++ ISP_WRAP_DS0_PIXEL_FORMAT_CTL_S *stDs0PixelFormat = &pstDs0OutAttr.stDs0PixelFormat; + stDs0PixelFormat->ds0_out_img_format = ds0Info->ds0_out_img_format;//ISP_YUV_DATA; + stDs0PixelFormat->ds0_out_img_out_format = ds0Info->ds0_out_img_out_format;//IN_YUV420; + stDs0PixelFormat->ds0_out_pixel_width = ds0Info->ds0_out_pxl_width;//PIXEL_8; + stDs0PixelFormat->ds0_out_yuv422_pxl_order = ds0Info->ds0_out_yuv422_pxl_order;//YUYV; + stDs0PixelFormat->ds0_out_yuv_in_format = ds0Info->ds0_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_DS0_OUT_SIZE_S *stDs0OutSize = &pstDs0OutAttr.stDs0OutSize; ++ ISP_WRAP_DS0_OUT_SIZE_S *stDs0OutSize = &pstDs0OutAttr.stDs0OutSize; + stDs0OutSize->ds0_out_h_size = Width - 1; + stDs0OutSize->ds0_out_v_size = Height - 1; +- ISP_WRAP_DS0_BUF_S *stDs0Buf = &pstDs0OutAttr.stDs0Buf; +- stDs0Buf->ds0_y_buf0_base = ds0Info->ds0_y_buf0_base;//ISP_BUF_DS0_Y; +- stDs0Buf->ds0_y_buf1_base = ds0Info->ds0_y_buf1_base;//ISP_BUF_DS0_Y; +- stDs0Buf->ds0_y_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_Y_STRIDE; +- stDs0Buf->ds0_uv_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_UV_STRIDE; +- stDs0Buf->ds0_uv_buf0_base = ds0Info->ds0_uv_buf0_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; +- stDs0Buf->ds0_uv_buf1_base = ds0Info->ds0_uv_buf1_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; +- Isp_Drv_F2k_Wrap_SetDs0Out(isp,&pstDs0OutAttr); ++ ISP_WRAP_DS0_BUF_S *stDs0Buf = &pstDs0OutAttr.stDs0Buf; ++ stDs0Buf->ds0_y_buf0_base = ds0Info->ds0_y_buf0_base;//ISP_BUF_DS0_Y; ++ stDs0Buf->ds0_y_buf1_base = ds0Info->ds0_y_buf1_base;//ISP_BUF_DS0_Y; ++ stDs0Buf->ds0_y_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_Y_STRIDE; ++ stDs0Buf->ds0_uv_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_UV_STRIDE; ++ stDs0Buf->ds0_uv_buf0_base = ds0Info->ds0_uv_buf0_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; ++ stDs0Buf->ds0_uv_buf1_base = ds0Info->ds0_uv_buf1_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; ++ Isp_Drv_F2k_Wrap_SetDs0Out(isp,&pstDs0OutAttr); + } + // + void isp_f2k_wrap_SetDs1Out(struct k510_isp_device *isp,struct isp_wrap_ds1_info *ds1Info) + { +- ISP_WRAP_DS1OUT_ATTR_S pstDs1OutAttr; ++ ISP_WRAP_DS1OUT_ATTR_S pstDs1OutAttr; + unsigned int Width = ds1Info->ds1_size.Width; + unsigned int Height = ds1Info->ds1_size.Height; +- ISP_WRAP_DS1_CLK_CTL_S *stDs1ClkCtl = &pstDs1OutAttr.stDs1ClkCtl; +- ISP_WRAP_DS1_DMA_EN_CTL_S *stDs1DmaEn = &pstDs1OutAttr.stDs1DmaEn; ++ ISP_WRAP_DS1_CLK_CTL_S *stDs1ClkCtl = &pstDs1OutAttr.stDs1ClkCtl; ++ ISP_WRAP_DS1_DMA_EN_CTL_S *stDs1DmaEn = &pstDs1OutAttr.stDs1DmaEn; + + stDs1ClkCtl->ds1_out_clk_en = 1; + stDs1ClkCtl->ds1_out_y_ch_clk_en = 1; +@@ -394,33 +394,33 @@ void isp_f2k_wrap_SetDs1Out(struct k510_isp_device *isp,struct isp_wrap_ds1_info + stDs1DmaEn->ds1_osd1_ch_dma_en = 0; + stDs1DmaEn->ds1_osd2_ch_dma_en = 0; + } +- pstDs1OutAttr.pix_remap_out1_en = ds1Info->pix_remap_out1_en; +- ISP_WRAP_DS1_PIXEL_FORMAT_CTL_S *stDs1PixelFormat = &pstDs1OutAttr.stDs1PixelFormat; ++ pstDs1OutAttr.pix_remap_out1_en = ds1Info->pix_remap_out1_en; ++ ISP_WRAP_DS1_PIXEL_FORMAT_CTL_S *stDs1PixelFormat = &pstDs1OutAttr.stDs1PixelFormat; + stDs1PixelFormat->ds1_out_img_format = ds1Info->ds1_out_img_format;//ISP_YUV_DATA; + stDs1PixelFormat->ds1_out_img_out_format = ds1Info->ds1_out_img_out_format;//IN_YUV420; + stDs1PixelFormat->ds1_out_pixel_width = ds1Info->ds1_out_pxl_width;//PIXEL_8; + stDs1PixelFormat->ds1_out_yuv422_pxl_order = ds1Info->ds1_out_yuv422_pxl_order;//YUYV; + stDs1PixelFormat->ds1_out_yuv_in_format = ds1Info->ds1_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_DS1_OUT_SIZE_S *stDs1OutSize = &pstDs1OutAttr.stDs1OutSize; ++ ISP_WRAP_DS1_OUT_SIZE_S *stDs1OutSize = &pstDs1OutAttr.stDs1OutSize; + stDs1OutSize->ds1_out_h_size = ds1Info->ds1_size.Width - 1; + stDs1OutSize->ds1_out_v_size = ds1Info->ds1_size.Height - 1; +- ISP_WRAP_DS1_BUF_S *stDs1Buf = &pstDs1OutAttr.stDs1Buf; +- stDs1Buf->ds1_y_buf0_base = ds1Info->ds1_y_buf0_base;//ISP_BUF_DS1_Y; +- stDs1Buf->ds1_y_buf1_base = ds1Info->ds1_y_buf1_base;//ISP_BUF_DS1_Y; +- stDs1Buf->ds1_y_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; +- stDs1Buf->ds1_uv_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; +- stDs1Buf->ds1_uv_buf0_base = ds1Info->ds1_uv_buf0_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; +- stDs1Buf->ds1_uv_buf1_base = ds1Info->ds1_uv_buf1_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; +- Isp_Drv_F2k_Wrap_SetDs1Out(isp,&pstDs1OutAttr); ++ ISP_WRAP_DS1_BUF_S *stDs1Buf = &pstDs1OutAttr.stDs1Buf; ++ stDs1Buf->ds1_y_buf0_base = ds1Info->ds1_y_buf0_base;//ISP_BUF_DS1_Y; ++ stDs1Buf->ds1_y_buf1_base = ds1Info->ds1_y_buf1_base;//ISP_BUF_DS1_Y; ++ stDs1Buf->ds1_y_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; ++ stDs1Buf->ds1_uv_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; ++ stDs1Buf->ds1_uv_buf0_base = ds1Info->ds1_uv_buf0_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; ++ stDs1Buf->ds1_uv_buf1_base = ds1Info->ds1_uv_buf1_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; ++ Isp_Drv_F2k_Wrap_SetDs1Out(isp,&pstDs1OutAttr); + } + // + void isp_f2k_wrap_SetDs2Out(struct k510_isp_device *isp,struct isp_wrap_ds2_info *ds2Info) + { + unsigned int Width = ds2Info->ds2_size.Width; + unsigned int Height = ds2Info->ds2_size.Height; +- ISP_WRAP_DS2OUT_ATTR_S pstDs2OutAttr; +- ISP_WRAP_DS2_CLK_CTL_S *stDs2ClkCtl = &pstDs2OutAttr.stDs2ClkCtl; +- ISP_WRAP_DS2_DMA_EN_CTL_S *stDs2DmaEn = &pstDs2OutAttr.stDs2DmaEn; ++ ISP_WRAP_DS2OUT_ATTR_S pstDs2OutAttr; ++ ISP_WRAP_DS2_CLK_CTL_S *stDs2ClkCtl = &pstDs2OutAttr.stDs2ClkCtl; ++ ISP_WRAP_DS2_DMA_EN_CTL_S *stDs2DmaEn = &pstDs2OutAttr.stDs2DmaEn; + + stDs2ClkCtl->ds2_out_clk_en = 1; + stDs2ClkCtl->ds2_out_r_ch_clk_en = 1; +@@ -463,228 +463,228 @@ void isp_f2k_wrap_SetDs2Out(struct k510_isp_device *isp,struct isp_wrap_ds2_info + stDs2DmaEn->ds2_osd0_ch_dma_en = 0; + stDs2DmaEn->ds2_osd1_ch_dma_en = 0; + } +- ISP_WRAP_DS2_PIXEL_FORMAT_CTL_S *stDs2PixelFormat = &pstDs2OutAttr.stDs2PixelFormat; ++ ISP_WRAP_DS2_PIXEL_FORMAT_CTL_S *stDs2PixelFormat = &pstDs2OutAttr.stDs2PixelFormat; + stDs2PixelFormat->ds2_out_img_format = ds2Info->ds2_out_img_format;//ISP_RGBRAW_DATA; + stDs2PixelFormat->ds2_out_img_out_format = ds2Info->ds2_out_img_out_format;//OUT_ARGB; + stDs2PixelFormat->ds2_out_pixel_width = ds2Info->ds2_out_pxl_width;//PIXEL_8; + stDs2PixelFormat->ds2_out_yuv422_pxl_order = ds2Info->ds2_out_yuv422_pxl_order;//YUYV; //not need + stDs2PixelFormat->ds2_out_yuv_in_format = ds2Info->ds2_out_yuv_in_format;//IN_YUV422; //not need +- ISP_WRAP_DS2_OUT_SIZE_S *stDs2OutSize = &pstDs2OutAttr.stDs2OutSize; ++ ISP_WRAP_DS2_OUT_SIZE_S *stDs2OutSize = &pstDs2OutAttr.stDs2OutSize; + stDs2OutSize->ds2_out_h_size = ds2Info->ds2_size.Width - 1; + stDs2OutSize->ds2_out_v_size = ds2Info->ds2_size.Height - 1; +- ISP_WRAP_DS2_BUF_S *stDs2Buf = &pstDs2OutAttr.stDs2Buf; ++ ISP_WRAP_DS2_BUF_S *stDs2Buf = &pstDs2OutAttr.stDs2Buf; + stDs2Buf->ds2_r_buf0_base = ds2Info->ds2_r_buf0_base; + stDs2Buf->ds2_r_buf1_base = ds2Info->ds2_r_buf1_base; + stDs2Buf->ds2_g_buf0_base = ds2Info->ds2_g_buf0_base; + stDs2Buf->ds2_g_buf1_base = ds2Info->ds2_g_buf1_base; + stDs2Buf->ds2_b_buf0_base = ds2Info->ds2_b_buf0_base; + stDs2Buf->ds2_b_buf1_base = ds2Info->ds2_b_buf1_base; +- stDs2Buf->ds2_r_line_stride = ds2Info->ds2_line_stride; +- stDs2Buf->ds2_g_line_stride = ds2Info->ds2_line_stride; +- stDs2Buf->ds2_b_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_r_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_g_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_b_line_stride = ds2Info->ds2_line_stride; + Isp_Drv_F2k_Wrap_SetDs2Out(isp,&pstDs2OutAttr); + } + // + void isp_f2k_wrap_SetDmaConfig(struct k510_isp_device *isp) + { + +- ISP_WRAP_DMA_ATTR_S pstDmaAttr; +- unsigned int DmaChIndex = 0; ++ ISP_WRAP_DMA_ATTR_S pstDmaAttr; ++ unsigned int DmaChIndex = 0; + ISP_WRAP_DMA_MODE_S *stDmaChMode = &pstDmaAttr.stDmaChMode; +- stDmaChMode->rd_dma_arb_mode = 0;//1; +- stDmaChMode->wr_dma_arb_mode = 0;//1; +- for(DmaChIndex=0; DmaChIndexrd_dma_ch_id[DmaChIndex] = DmaChIndex; +- stDmaChMode->wr_dma_ch_id[DmaChIndex] = DmaChIndex; +- stDmaChMode->rd_dma_ch_weight[DmaChIndex] = 0x01; +- stDmaChMode->wr_dma_ch_weight[DmaChIndex] = 0x01; +- stDmaChMode->rd_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; +- stDmaChMode->wr_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; +- if(DmaChIndex < 8) +- { +- stDmaChMode->rd_dma_ch_priority[DmaChIndex] = DmaChIndex; +- stDmaChMode->wr_dma_ch_priority[DmaChIndex] = DmaChIndex; +- } +- } ++ stDmaChMode->rd_dma_arb_mode = 0;//1; ++ stDmaChMode->wr_dma_arb_mode = 0;//1; ++ for(DmaChIndex=0; DmaChIndexrd_dma_ch_id[DmaChIndex] = DmaChIndex; ++ stDmaChMode->wr_dma_ch_id[DmaChIndex] = DmaChIndex; ++ stDmaChMode->rd_dma_ch_weight[DmaChIndex] = 0x01; ++ stDmaChMode->wr_dma_ch_weight[DmaChIndex] = 0x01; ++ stDmaChMode->rd_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; ++ stDmaChMode->wr_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; ++ if(DmaChIndex < 8) ++ { ++ stDmaChMode->rd_dma_ch_priority[DmaChIndex] = DmaChIndex; ++ stDmaChMode->wr_dma_ch_priority[DmaChIndex] = DmaChIndex; ++ } ++ } + ISP_WRAP_DMA_CFG_S *stDmaCfg = &pstDmaAttr.stDmaCfg; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 7; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 7; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_burstl = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_burstl = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_int_line_num = 8; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_err_dec_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_err_dec_en = 1; +- if((DmaChIndex > 5) && (DmaChIndex < 8)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 7) && (DmaChIndex < 13)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 12)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 1) && (DmaChIndex < 4)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 14; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 15; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 1; +- } +- if((DmaChIndex > 5) && (DmaChIndex < 8)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 6; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 0; +- } +- } +- ISP_WRAP_DMA_ERR_DEC_CFG_S *stErrDecCfg = &pstDmaAttr.stErrDecCfg; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_dec_unit = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_dec_unit = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_gen_thr = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_gen_thr = 255; +- } ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 7; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 7; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_burstl = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_burstl = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_int_line_num = 8; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_err_dec_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_err_dec_en = 1; ++ if((DmaChIndex > 5) && (DmaChIndex < 8)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 7) && (DmaChIndex < 13)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 12)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 1) && (DmaChIndex < 4)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 14; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 15; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 1; ++ } ++ if((DmaChIndex > 5) && (DmaChIndex < 8)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 6; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 0; ++ } ++ } ++ ISP_WRAP_DMA_ERR_DEC_CFG_S *stErrDecCfg = &pstDmaAttr.stErrDecCfg; ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_dec_unit = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_dec_unit = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_gen_thr = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_gen_thr = 255; ++ } + ISP_WRAP_DMA_ERR_STATUS_S *stErrStatus = &pstDmaAttr.stErrStatus; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stErrStatus->stDmaErrStatus[DmaChIndex].err_y_wr_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_uv_wr_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_raw_read_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_wr_rst_req = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_rd_rst_req = 0; +- } +- Isp_Drv_F2k_Wrap_SetDma(isp,&pstDmaAttr); ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_y_wr_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_uv_wr_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_raw_read_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_wr_rst_req = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_rd_rst_req = 0; ++ } ++ Isp_Drv_F2k_Wrap_SetDma(isp,&pstDmaAttr); + } + // + int isp_f2k_wrap_SetAxiCtl(struct k510_isp_device *isp) + { +- return 0; +- ISP_WRAP_AXI_CTL_S pstAxiCtl; ++ return 0; ++ ISP_WRAP_AXI_CTL_S pstAxiCtl; + pstAxiCtl.axi_wr_ch_rst_req = 1; + pstAxiCtl.axi_rd_ch_rst_req = 1; +- Isp_Drv_F2k_Wrap_SetAxiCtl(isp,&pstAxiCtl); ++ Isp_Drv_F2k_Wrap_SetAxiCtl(isp,&pstAxiCtl); + return 0; + } + /* +-*int mask +-*/ ++ *int mask ++ */ + int isp_f2k_wrap_SetIntMask(struct k510_isp_device *isp) + { + + ISP_WRAP_CORE_INT_CTL_S stCoreIntCtl; +- stCoreIntCtl.int_raw_in_mask= 1 ; +- stCoreIntCtl.int_3a_mask= 1 ; +- stCoreIntCtl.raw_int_mask= 1 ; +- stCoreIntCtl.rgb_int_mask= 1 ; +- stCoreIntCtl.yuv_int_mask= 1 ; +- stCoreIntCtl.ldc_int_mask= 1 ; +- stCoreIntCtl.main_out_int_mask= 1 ; +- stCoreIntCtl.isp_awb_int_mask= 1 ; +- stCoreIntCtl.isp_ae_int_mask= 1 ; +- stCoreIntCtl.isp_af_int_mask= 1 ; +- Isp_Drv_F2k_Wrap_SetCoreIntCtlMask(isp,&stCoreIntCtl); +- +- ISP_WRAP_DMA_WR_INT_MASK0_S stDmaWRMask0; +- stDmaWRMask0.wr_3dnr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_err_immediate_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_err_immediate_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_frm_end_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_line_base_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_err_immediate_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_err_immediate_int_mask= 1 ; +- Isp_Drv_F2k_Wrap_SetDmaWRIntMask0(isp,&stDmaWRMask0); +- ISP_WRAP_DMA_WR_INT_MASK1_S stDmaWRMask1; +- stDmaWRMask1.ds0_out_wr_y_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_line_base_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_err_immediate_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_line_base_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_err_immediate_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_line_base_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_err_immediate_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_line_base_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_err_immediate_mask= 1 ; +- Isp_Drv_F2k_Wrap_SetDmaWRIntMask1(isp,&stDmaWRMask1); +- ISP_WRAP_DMA_RD_INT_MASK0_S stDmaRDMask0; +- stDmaRDMask0.rd_3dnr_y_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_line_base_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_err_immediate_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_line_base_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_err_immediate_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_line_base_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_err_immediate_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_line_base_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_err_immediate_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_frm_end_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_line_base_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_err_immediate_int_mask= 1 ; +- Isp_Drv_F2k_Wrap_SetDmaRDIntMask0(isp,&stDmaRDMask0); ++ stCoreIntCtl.int_raw_in_mask= 1 ; ++ stCoreIntCtl.int_3a_mask= 1 ; ++ stCoreIntCtl.raw_int_mask= 1 ; ++ stCoreIntCtl.rgb_int_mask= 1 ; ++ stCoreIntCtl.yuv_int_mask= 1 ; ++ stCoreIntCtl.ldc_int_mask= 1 ; ++ stCoreIntCtl.main_out_int_mask= 1 ; ++ stCoreIntCtl.isp_awb_int_mask= 1 ; ++ stCoreIntCtl.isp_ae_int_mask= 1 ; ++ stCoreIntCtl.isp_af_int_mask= 1 ; ++ Isp_Drv_F2k_Wrap_SetCoreIntCtlMask(isp,&stCoreIntCtl); ++ ++ ISP_WRAP_DMA_WR_INT_MASK0_S stDmaWRMask0; ++ stDmaWRMask0.wr_3dnr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_line_base_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_err_immediate_int_mask= 1 ; ++ Isp_Drv_F2k_Wrap_SetDmaWRIntMask0(isp,&stDmaWRMask0); ++ ISP_WRAP_DMA_WR_INT_MASK1_S stDmaWRMask1; ++ stDmaWRMask1.ds0_out_wr_y_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_line_base_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_line_base_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_line_base_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_line_base_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_err_immediate_mask= 1 ; ++ Isp_Drv_F2k_Wrap_SetDmaWRIntMask1(isp,&stDmaWRMask1); ++ ISP_WRAP_DMA_RD_INT_MASK0_S stDmaRDMask0; ++ stDmaRDMask0.rd_3dnr_y_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_line_base_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_line_base_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_line_base_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_line_base_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_frm_end_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_line_base_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_err_immediate_int_mask= 1 ; ++ Isp_Drv_F2k_Wrap_SetDmaRDIntMask0(isp,&stDmaRDMask0); + } + // + int isp_f2k_wrap_SetConfigDone(struct k510_isp_device *isp,unsigned int wp_en) + { + +- ISP_WRAP_CONFIG_DONE_S pstConfigDone; ++ ISP_WRAP_CONFIG_DONE_S pstConfigDone; + pstConfigDone.int_polarity = 1; + pstConfigDone.sen_reg_pro_en = wp_en;//0; + if( wp_en == 1) +@@ -693,9 +693,9 @@ int isp_f2k_wrap_SetConfigDone(struct k510_isp_device *isp,unsigned int wp_en) + } + else + { +- pstConfigDone.wrap_config_done_en = 1; ++ pstConfigDone.wrap_config_done_en = 1; + } +- Isp_Drv_F2k_Wrap_SetConfigdoneCtl(isp,&pstConfigDone); ++ Isp_Drv_F2k_Wrap_SetConfigdoneCtl(isp,&pstConfigDone); + return 0; + } + // +@@ -720,9 +720,9 @@ int isp_f2k_wrap_reset(struct k510_isp_device *isp) + printk("%s>AXI_CTL = 0x%x\n", __func__, axi_ctl); + while(1) + { +- //wait AXI request finish +- if(axi_ctl.bits.axi_wr_ch_state == 1 && axi_ctl.bits.axi_rd_ch_state == 1) +- break; ++ //wait AXI request finish ++ if(axi_ctl.bits.axi_wr_ch_state == 1 && axi_ctl.bits.axi_rd_ch_state == 1) ++ break; + } + + isp_f2k_wrap_SetConfigDone(isp,1); +@@ -742,109 +742,109 @@ int isp_f2k_wrap_reset(struct k510_isp_device *isp) + static int isp_f2k_wrap_config(struct isp_f2k_device *f2k,struct isp_wrap_cfg_info *isp_wrap_cfg) + { + struct k510_isp_device *isp = to_isp_device(f2k); +- //struct isp_wrap_cfg_info *isp_wrap_cfg =&isp_cfg->isp_wrap_cfg; ++ //struct isp_wrap_cfg_info *isp_wrap_cfg =&isp_cfg->isp_wrap_cfg; + isp_f2k_wrap_SetConfigDone(isp,1); +- // +- isp_f2k_wrap_SetComRst(isp); +- // +- isp_f2k_wrap_SetDmaRst(isp); +- // ++ // ++ isp_f2k_wrap_SetComRst(isp); ++ // ++ isp_f2k_wrap_SetDmaRst(isp); ++ // + unsigned int external_out_ch_sel = isp_wrap_cfg->isp_out_sel; + Isp_Drv_F2k_Wrap_SetModeCtl_OutSel(isp,external_out_ch_sel); +- // ++ // + unsigned int dvp_input_ch_type = isp_wrap_cfg->dvp_ch_mode; + Isp_Drv_F2k_Wrap_SetModeCtl_DvpMode(isp,dvp_input_ch_type); +- // +- isp_f2k_wrap_SetPipeClkCtl(isp); +- // +- struct isp_wrap_wdr_info *wdrInfo = &isp_wrap_cfg->wdrInfo; ++ // ++ isp_f2k_wrap_SetPipeClkCtl(isp); ++ // ++ struct isp_wrap_wdr_info *wdrInfo = &isp_wrap_cfg->wdrInfo; + isp_f2k_wrap_SetWdr(isp,wdrInfo); +- // ++ // + struct isp_wrap_3dnr_info *nr3dInfo = &isp_wrap_cfg->nr3dInfo; + isp_f2k_wrap_Set3dnr(isp,nr3dInfo); +- // ++ // + struct isp_wrap_ldc_info *ldcInfo = &isp_wrap_cfg->ldcInfo; + isp_f2k_wrap_SetLdc(isp,ldcInfo); +- // ++ // + struct isp_wrap_main_info *mainInfo = &isp_wrap_cfg->mainInfo; + isp_f2k_wrap_SetMainOut(isp,mainInfo); +- // ++ // + struct isp_wrap_ds0_info *ds0Info = &isp_wrap_cfg->ds0Info; + isp_f2k_wrap_SetDs0Out(isp,ds0Info); +- // ++ // + struct isp_wrap_ds1_info *ds1Info = &isp_wrap_cfg->ds1Info; + isp_f2k_wrap_SetDs1Out(isp,ds1Info); +- // ++ // + struct isp_wrap_ds2_info *ds2Info = &isp_wrap_cfg->ds2Info; + + isp_f2k_wrap_SetDs2Out(isp,ds2Info); + // + isp_f2k_wrap_SetDmaConfig(isp); +- // ++ // + isp_f2k_wrap_SetAxiCtl(isp); +- // ++ // + isp_f2k_wrap_SetIntMask(isp); +- // ++ // + isp_f2k_wrap_SetConfigDone(isp,0); + +- return 0; ++ return 0; + } + //wrap int + static int isp_f2k_wrap_setIntCore(struct k510_isp_device *isp,struct isp_wrap_intcore_info *intCoreEn) + { +- ISP_WRAP_CORE_INT_CTL_S coreIntMask; +- coreIntMask.int_raw_in_mask = ~intCoreEn->int_raw_in_en; +- coreIntMask.int_3a_mask = ~intCoreEn->int_3a_en; +- coreIntMask.raw_int_mask = ~intCoreEn->raw_int_en; +- coreIntMask.rgb_int_mask = ~intCoreEn->rgb_int_en; +- coreIntMask.yuv_int_mask = ~intCoreEn->yuv_int_en; +- coreIntMask.ldc_int_mask = ~intCoreEn->ldc_int_en; +- coreIntMask.main_out_int_mask = ~intCoreEn->main_out_int_en; +- coreIntMask.isp_awb_int_mask = ~intCoreEn->isp_awb_int_en; +- coreIntMask.isp_ae_int_mask = ~intCoreEn->isp_ae_int_en; +- coreIntMask.isp_af_int_mask = ~intCoreEn->isp_af_int_en; ++ ISP_WRAP_CORE_INT_CTL_S coreIntMask; ++ coreIntMask.int_raw_in_mask = ~intCoreEn->int_raw_in_en; ++ coreIntMask.int_3a_mask = ~intCoreEn->int_3a_en; ++ coreIntMask.raw_int_mask = ~intCoreEn->raw_int_en; ++ coreIntMask.rgb_int_mask = ~intCoreEn->rgb_int_en; ++ coreIntMask.yuv_int_mask = ~intCoreEn->yuv_int_en; ++ coreIntMask.ldc_int_mask = ~intCoreEn->ldc_int_en; ++ coreIntMask.main_out_int_mask = ~intCoreEn->main_out_int_en; ++ coreIntMask.isp_awb_int_mask = ~intCoreEn->isp_awb_int_en; ++ coreIntMask.isp_ae_int_mask = ~intCoreEn->isp_ae_int_en; ++ coreIntMask.isp_af_int_mask = ~intCoreEn->isp_af_int_en; + Isp_Drv_F2k_Wrap_SetCoreIntCtlMask(isp,&coreIntMask); + return 0; + }; + // + static int isp_f2k_wrap_setIntWr0(struct k510_isp_device *isp,struct isp_wrap_intwr0_info *intWr0En) + { +- ISP_WRAP_DMA_WR_INT_MASK0_S wrIntMask0; +- wrIntMask0.wr_3dnr_y_frm_end_int_mask = ~intWr0En->wr_3dnr_y_frm_end_int_en; +- wrIntMask0.wr_3dnr_y_line_base_int_mask = 1; +- wrIntMask0.wr_3dnr_y_err_frm_end_int_mask = 1; +- wrIntMask0.wr_3dnr_y_err_immediate_int_mask = 1; +- wrIntMask0.wr_3dnr_uv_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_frm_end_int_en; +- wrIntMask0.wr_3dnr_uv_line_base_int_mask = 1; +- wrIntMask0.wr_3dnr_uv_err_frm_end_int_mask = 1; +- wrIntMask0.wr_3dnr_uv_err_immediate_int_mask = 1; +- wrIntMask0.ldc_wr_y_frm_end_int_mask = ~intWr0En->ldc_wr_y_frm_end_int_en; +- wrIntMask0.ldc_wr_y_line_base_int_mask = 1; +- wrIntMask0.ldc_wr_y_err_frm_end_int_mask = 1; +- wrIntMask0.ldc_wr_y_err_immediate_int_mask = 1; +- wrIntMask0.ldc_wr_uv_frm_end_int_mask = ~intWr0En->ldc_wr_uv_frm_end_int_en; +- wrIntMask0.ldc_wr_uv_line_base_int_mask = 1; +- wrIntMask0.ldc_wr_uv_err_frm_end_int_mask = 1; +- wrIntMask0.ldc_wr_uv_err_immediate_int_mask = 1; +- wrIntMask0.wdr_wr_raw_frm_end_int_mask = ~intWr0En->wdr_wr_raw_frm_end_int_en; +- wrIntMask0.wdr_wr_raw_line_base_int_mask = 1; +- wrIntMask0.wdr_wr_raw_err_frm_end_int_mask = 1; +- wrIntMask0.wdr_wr_raw_err_immediate_int_mask = 1; +- wrIntMask0.main_out_wr_y_frm_end_int_mask = ~intWr0En->main_out_wr_y_frm_end_int_en; +- wrIntMask0.main_out_wr_y_line_base_int_mask = 1; +- wrIntMask0.main_out_wr_y_err_frm_end_int_mask = 1; +- wrIntMask0.main_out_wr_y_err_immediate_int_mask = 1; +- wrIntMask0.main_out_wr_uv_frm_end_int_mask = ~intWr0En->main_out_wr_uv_frm_end_int_en; +- wrIntMask0.main_out_wr_uv_line_base_int_mask = 1; +- wrIntMask0.main_out_wr_uv_err_frm_end_int_mask = 1; +- wrIntMask0.main_out_wr_uv_err_immediate_int_mask = 1; ++ ISP_WRAP_DMA_WR_INT_MASK0_S wrIntMask0; ++ wrIntMask0.wr_3dnr_y_frm_end_int_mask = ~intWr0En->wr_3dnr_y_frm_end_int_en; ++ wrIntMask0.wr_3dnr_y_line_base_int_mask = 1; ++ wrIntMask0.wr_3dnr_y_err_frm_end_int_mask = 1; ++ wrIntMask0.wr_3dnr_y_err_immediate_int_mask = 1; ++ wrIntMask0.wr_3dnr_uv_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_frm_end_int_en; ++ wrIntMask0.wr_3dnr_uv_line_base_int_mask = 1; ++ wrIntMask0.wr_3dnr_uv_err_frm_end_int_mask = 1; ++ wrIntMask0.wr_3dnr_uv_err_immediate_int_mask = 1; ++ wrIntMask0.ldc_wr_y_frm_end_int_mask = ~intWr0En->ldc_wr_y_frm_end_int_en; ++ wrIntMask0.ldc_wr_y_line_base_int_mask = 1; ++ wrIntMask0.ldc_wr_y_err_frm_end_int_mask = 1; ++ wrIntMask0.ldc_wr_y_err_immediate_int_mask = 1; ++ wrIntMask0.ldc_wr_uv_frm_end_int_mask = ~intWr0En->ldc_wr_uv_frm_end_int_en; ++ wrIntMask0.ldc_wr_uv_line_base_int_mask = 1; ++ wrIntMask0.ldc_wr_uv_err_frm_end_int_mask = 1; ++ wrIntMask0.ldc_wr_uv_err_immediate_int_mask = 1; ++ wrIntMask0.wdr_wr_raw_frm_end_int_mask = ~intWr0En->wdr_wr_raw_frm_end_int_en; ++ wrIntMask0.wdr_wr_raw_line_base_int_mask = 1; ++ wrIntMask0.wdr_wr_raw_err_frm_end_int_mask = 1; ++ wrIntMask0.wdr_wr_raw_err_immediate_int_mask = 1; ++ wrIntMask0.main_out_wr_y_frm_end_int_mask = ~intWr0En->main_out_wr_y_frm_end_int_en; ++ wrIntMask0.main_out_wr_y_line_base_int_mask = 1; ++ wrIntMask0.main_out_wr_y_err_frm_end_int_mask = 1; ++ wrIntMask0.main_out_wr_y_err_immediate_int_mask = 1; ++ wrIntMask0.main_out_wr_uv_frm_end_int_mask = ~intWr0En->main_out_wr_uv_frm_end_int_en; ++ wrIntMask0.main_out_wr_uv_line_base_int_mask = 1; ++ wrIntMask0.main_out_wr_uv_err_frm_end_int_mask = 1; ++ wrIntMask0.main_out_wr_uv_err_immediate_int_mask = 1; + Isp_Drv_F2k_Wrap_SetDmaWRIntMask0(isp,&wrIntMask0); + return 0; + } + // + static int isp_f2k_wrap_setIntWr1(struct k510_isp_device *isp,struct isp_wrap_intwr1_info *intWr1En) + { +- ISP_WRAP_DMA_WR_INT_MASK1_S wrIntMask1; ++ ISP_WRAP_DMA_WR_INT_MASK1_S wrIntMask1; + wrIntMask1.ds0_out_wr_y_frm_end_mask = ~intWr1En->ds0_out_wr_y_frm_end_en; + wrIntMask1.ds0_out_wr_y_line_base_mask = 1; + wrIntMask1.ds0_out_wr_y_err_frm_end_mask = 1; +@@ -879,27 +879,27 @@ static int isp_f2k_wrap_setIntWr1(struct k510_isp_device *isp,struct isp_wrap_in + // + static int isp_f2k_wrap_setIntRd0(struct k510_isp_device *isp,struct isp_wrap_intrd0_info *intRd0En) + { +- ISP_WRAP_DMA_RD_INT_MASK0_S rdIntMask0; +- rdIntMask0.rd_3dnr_y_frm_end_int_mask = ~intRd0En->rd_3dnr_y_frm_end_int_en; +- rdIntMask0.rd_3dnr_y_line_base_int_mask = 1; +- rdIntMask0.rd_3dnr_y_err_frm_end_int_mask = 1; +- rdIntMask0.rd_3dnr_y_err_immediate_int_mask = 1; +- rdIntMask0.rd_3dnr_uv_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_frm_end_int_en; +- rdIntMask0.rd_3dnr_uv_line_base_int_mask = 1; +- rdIntMask0.rd_3dnr_uv_err_frm_end_int_mask = 1; +- rdIntMask0.rd_3dnr_uv_err_immediate_int_mask = 1; +- rdIntMask0.ldc_rd_y_frm_end_int_mask = ~intRd0En->ldc_rd_y_frm_end_int_en; +- rdIntMask0.ldc_rd_y_line_base_int_mask = 1; +- rdIntMask0.ldc_rd_y_err_frm_end_int_mask = 1; +- rdIntMask0.ldc_rd_y_err_immediate_int_mask = 1; +- rdIntMask0.ldc_rd_uv_frm_end_int_mask = ~intRd0En->ldc_rd_uv_frm_end_int_en; +- rdIntMask0.ldc_rd_uv_line_base_int_mask = 1; +- rdIntMask0.ldc_rd_uv_err_frm_end_int_mask = 1; +- rdIntMask0.ldc_rd_uv_err_immediate_int_mask = 1; +- rdIntMask0.wdr_rd_raw_frm_end_int_mask = ~intRd0En->wdr_rd_raw_frm_end_int_en; +- rdIntMask0.wdr_rd_raw_line_base_int_mask = 1; +- rdIntMask0.wdr_rd_raw_err_frm_end_int_mask = 1; +- rdIntMask0.wdr_rd_raw_err_immediate_int_mask = 1; ++ ISP_WRAP_DMA_RD_INT_MASK0_S rdIntMask0; ++ rdIntMask0.rd_3dnr_y_frm_end_int_mask = ~intRd0En->rd_3dnr_y_frm_end_int_en; ++ rdIntMask0.rd_3dnr_y_line_base_int_mask = 1; ++ rdIntMask0.rd_3dnr_y_err_frm_end_int_mask = 1; ++ rdIntMask0.rd_3dnr_y_err_immediate_int_mask = 1; ++ rdIntMask0.rd_3dnr_uv_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_frm_end_int_en; ++ rdIntMask0.rd_3dnr_uv_line_base_int_mask = 1; ++ rdIntMask0.rd_3dnr_uv_err_frm_end_int_mask = 1; ++ rdIntMask0.rd_3dnr_uv_err_immediate_int_mask = 1; ++ rdIntMask0.ldc_rd_y_frm_end_int_mask = ~intRd0En->ldc_rd_y_frm_end_int_en; ++ rdIntMask0.ldc_rd_y_line_base_int_mask = 1; ++ rdIntMask0.ldc_rd_y_err_frm_end_int_mask = 1; ++ rdIntMask0.ldc_rd_y_err_immediate_int_mask = 1; ++ rdIntMask0.ldc_rd_uv_frm_end_int_mask = ~intRd0En->ldc_rd_uv_frm_end_int_en; ++ rdIntMask0.ldc_rd_uv_line_base_int_mask = 1; ++ rdIntMask0.ldc_rd_uv_err_frm_end_int_mask = 1; ++ rdIntMask0.ldc_rd_uv_err_immediate_int_mask = 1; ++ rdIntMask0.wdr_rd_raw_frm_end_int_mask = ~intRd0En->wdr_rd_raw_frm_end_int_en; ++ rdIntMask0.wdr_rd_raw_line_base_int_mask = 1; ++ rdIntMask0.wdr_rd_raw_err_frm_end_int_mask = 1; ++ rdIntMask0.wdr_rd_raw_err_immediate_int_mask = 1; + Isp_Drv_F2k_Wrap_SetDmaRDIntMask0(isp,&rdIntMask0); + return 0; + } +@@ -962,38 +962,38 @@ void k510isp_f2k_irq_enable(struct k510_isp_device *isp,struct isp_irq_info *irq + } + /********************************************************************************* + * ISP CORE +-**********************************************************************************/ ++ **********************************************************************************/ + //ITC + static int isp_f2k_core_SetItc(struct k510_isp_device *isp,ITC_INFO_S *itcInfo) + { +- ISP_CORE_ITC_CTL_S stItcCtl; ++ ISP_CORE_ITC_CTL_S stItcCtl; + stItcCtl.hsync_pol = itcInfo->hsync_pol; +- stItcCtl.vsync_pol = itcInfo->vsync_pol; +- stItcCtl.hsync_input_timing = itcInfo->hsync_input_timing; +- stItcCtl.vsync_input_timing = itcInfo->vsync_input_timing; +- stItcCtl.mirror_ctl = itcInfo->flip_ctl; +- stItcCtl.video_format_ctl = itcInfo->video_fmt_sel; +- Isp_Drv_F2k_Core_SetItcCtl(isp,&stItcCtl); ++ stItcCtl.vsync_pol = itcInfo->vsync_pol; ++ stItcCtl.hsync_input_timing = itcInfo->hsync_input_timing; ++ stItcCtl.vsync_input_timing = itcInfo->vsync_input_timing; ++ stItcCtl.mirror_ctl = itcInfo->flip_ctl; ++ stItcCtl.video_format_ctl = itcInfo->video_fmt_sel; ++ Isp_Drv_F2k_Core_SetItcCtl(isp,&stItcCtl); + return 0; + } + //IMAGE + static int isp_f2k_core_SetImage(struct k510_isp_device *isp,ITC_INFO_S *itcInfo) + { + +- ISP_CORE_IMAGE_ATTR_S stImgAttr; +- stImgAttr.image_height = itcInfo->total_size.Height - 1; +- stImgAttr.image_width = itcInfo->total_size.Width - 1; +- stImgAttr.image_v_start = itcInfo->itc_size.Height_st; +- stImgAttr.image_h_start = itcInfo->itc_size.Width_st; +- stImgAttr.image_active_width = itcInfo->itc_size.Width; +- stImgAttr.image_active_height = itcInfo->itc_size.Height; +- Isp_Drv_F2k_Core_SetImageAttr(isp,&stImgAttr); ++ ISP_CORE_IMAGE_ATTR_S stImgAttr; ++ stImgAttr.image_height = itcInfo->total_size.Height - 1; ++ stImgAttr.image_width = itcInfo->total_size.Width - 1; ++ stImgAttr.image_v_start = itcInfo->itc_size.Height_st; ++ stImgAttr.image_h_start = itcInfo->itc_size.Width_st; ++ stImgAttr.image_active_width = itcInfo->itc_size.Width; ++ stImgAttr.image_active_height = itcInfo->itc_size.Height; ++ Isp_Drv_F2k_Core_SetImageAttr(isp,&stImgAttr); + return 0; + } + //TPG + static int isp_f2k_core_SetTpgCtl(struct k510_isp_device *isp,TPG_INFO_S *tpgInfo) + { +- ISP_CORE_TEST_CTL_S stTestCtl; ++ ISP_CORE_TEST_CTL_S stTestCtl; + stTestCtl.test_pattern_en = tpgInfo->tpg_en; + stTestCtl.bayer_mode_sel = tpgInfo->bayer_mode_sel; + stTestCtl.motion_mode_sel = tpgInfo->motion_mode_sel; +@@ -1001,78 +1001,78 @@ static int isp_f2k_core_SetTpgCtl(struct k510_isp_device *isp,TPG_INFO_S *tpgInf + stTestCtl.wdr_l_mul_data = tpgInfo->wdr_l_mul_data; + stTestCtl.wdr_m_mul_data = tpgInfo->wdr_m_mul_data; + stTestCtl.wdr_s_mul_data = tpgInfo->wdr_s_mul_data; +- Isp_Drv_F2k_Core_SetTestCtl(isp,&stTestCtl); ++ Isp_Drv_F2k_Core_SetTestCtl(isp,&stTestCtl); + return 0; + } + //BLC + static int isp_f2k_core_SetBlcCtl(struct k510_isp_device *isp,BLC_INFO_S *blcInfo) + { + +- ISP_CORE_BLC_CTL_S stBlcCtl; ++ ISP_CORE_BLC_CTL_S stBlcCtl; + stBlcCtl.blc_en = blcInfo->blc_en; + stBlcCtl.blc_offset = blcInfo->blc_offset; + stBlcCtl.blc_ratio = blcInfo->blc_ratio; +- Isp_Drv_F2k_Core_SetBlcCtl(isp,&stBlcCtl); ++ Isp_Drv_F2k_Core_SetBlcCtl(isp,&stBlcCtl); + return 0; + } + //LSC + static int isp_f2k_core_SetLscCtl(struct k510_isp_device *isp,LSC_INFO_S *lscInfo) + { + +- ISP_CORE_LSC_CTL_S stLscCtl; +- stLscCtl.lsc_en = lscInfo->lsc_en; +- stLscCtl.lsc_h_center = lscInfo->lsc_h_center; +- stLscCtl.lsc_v_center = lscInfo->lsc_v_center; +- stLscCtl.lsc_red_ratio = lscInfo->lsc_r_ratio; +- stLscCtl.lsc_green_ratio = lscInfo->lsc_g_ratio; +- stLscCtl.lsc_blue_ratio = lscInfo->lsc_b_ratio; +- stLscCtl.lsc_ir_ratio = lscInfo->lsc_ir_ratio; +- Isp_Drv_F2k_Core_SetLscCtl(isp,&stLscCtl); ++ ISP_CORE_LSC_CTL_S stLscCtl; ++ stLscCtl.lsc_en = lscInfo->lsc_en; ++ stLscCtl.lsc_h_center = lscInfo->lsc_h_center; ++ stLscCtl.lsc_v_center = lscInfo->lsc_v_center; ++ stLscCtl.lsc_red_ratio = lscInfo->lsc_r_ratio; ++ stLscCtl.lsc_green_ratio = lscInfo->lsc_g_ratio; ++ stLscCtl.lsc_blue_ratio = lscInfo->lsc_b_ratio; ++ stLscCtl.lsc_ir_ratio = lscInfo->lsc_ir_ratio; ++ Isp_Drv_F2k_Core_SetLscCtl(isp,&stLscCtl); + return 0; + } + //AE + static int isp_f2k_core_SetAeCtl(struct k510_isp_device *isp,AE_INFO_S *aeInfo) + { + +- ISP_CORE_AE_CTL_S stAeCtl; +- stAeCtl.ae_as_en = aeInfo->ae_as_en; +- stAeCtl.ae_ag_en = aeInfo->ae_ag_en; +- stAeCtl.ae_airis_en = aeInfo->ae_airis_en; +- stAeCtl.ae_enter_ls_sel = aeInfo->ae_enter_ls_sel; +- stAeCtl.ae_exit_ls_sel = aeInfo->ae_exit_ls_sel; +- stAeCtl.ae_win_mode_sel = aeInfo->ae_win_mode_sel; +- stAeCtl.ae_back_light_mode_sel = aeInfo->ae_back_light_mode_sel; +- stAeCtl.ae_day_change_en = aeInfo->ae_day_change_en; +- stAeCtl.ae_day_change_sel = aeInfo->ae_day_change_sel; +- stAeCtl.ae_win_h_start = aeInfo->ae_win_size.h_start; +- stAeCtl.ae_win_v_start = aeInfo->ae_win_size.v_start; +- stAeCtl.ae_win_h_end = aeInfo->ae_win_size.h_end; +- stAeCtl.ae_win_v_end = aeInfo->ae_win_size.v_end; +- stAeCtl.ae_tar_bright = aeInfo->ae_tar_bright; +- stAeCtl.ae_tar_bright_range = aeInfo->ae_tar_bright_range; +- stAeCtl.ae_l_ex_time = aeInfo->ae_l_ex_time; +- stAeCtl.ae_m_ex_time = aeInfo->ae_m_ex_time; +- stAeCtl.ae_s_ex_time = aeInfo->ae_s_ex_time; +- stAeCtl.ae_agc = aeInfo->ae_agc; +- stAeCtl.ae_ad_shuttle_freq = aeInfo->ae_ad_shuttle_freq; +- stAeCtl.ae_ad_gain_freq = aeInfo->ae_ad_gain_freq; +- stAeCtl.ae_adjust_step_max = aeInfo->ae_adjust_step_max; +- stAeCtl.ae_ex_value_max = aeInfo->ae_ex_value_max; +- stAeCtl.ae_ex_value_mid = aeInfo->ae_ex_value_mid; +- stAeCtl.ae_ex_value_min = aeInfo->ae_ex_value_min; +- stAeCtl.ae_gain_value_max = aeInfo->ae_gain_value_max; +- stAeCtl.ae_gain_value_mid = aeInfo->ae_gain_value_mid; +- stAeCtl.ae_gain_value_min = aeInfo->ae_gain_value_min; +- stAeCtl.ae_dn_switch_ad_step_max = aeInfo->ae_dn_switch_ad_step_max; +- stAeCtl.ae_dn_switch_wait_time = aeInfo->ae_dn_switch_wait_time; +- stAeCtl.ape_max_diff = aeInfo->ape_max_diff; +- stAeCtl.ape_drv_signal_max = aeInfo->ape_drv_signal_max; +- stAeCtl.ape_coeff_distance = aeInfo->ape_coeff_distance; +- stAeCtl.ape_coeff_speed = aeInfo->ape_coeff_speed; +- stAeCtl.ape_coeff_acceleration = aeInfo->ape_coeff_acceleration; +- stAeCtl.ape_drv_manual_value = aeInfo->ape_drv_manual_value; +- stAeCtl.ape_damp_manual_value = aeInfo->ape_damp_manual_value; +- Isp_Drv_F2k_Core_SetAeCtl(isp,&stAeCtl); ++ ISP_CORE_AE_CTL_S stAeCtl; ++ stAeCtl.ae_as_en = aeInfo->ae_as_en; ++ stAeCtl.ae_ag_en = aeInfo->ae_ag_en; ++ stAeCtl.ae_airis_en = aeInfo->ae_airis_en; ++ stAeCtl.ae_enter_ls_sel = aeInfo->ae_enter_ls_sel; ++ stAeCtl.ae_exit_ls_sel = aeInfo->ae_exit_ls_sel; ++ stAeCtl.ae_win_mode_sel = aeInfo->ae_win_mode_sel; ++ stAeCtl.ae_back_light_mode_sel = aeInfo->ae_back_light_mode_sel; ++ stAeCtl.ae_day_change_en = aeInfo->ae_day_change_en; ++ stAeCtl.ae_day_change_sel = aeInfo->ae_day_change_sel; ++ stAeCtl.ae_win_h_start = aeInfo->ae_win_size.h_start; ++ stAeCtl.ae_win_v_start = aeInfo->ae_win_size.v_start; ++ stAeCtl.ae_win_h_end = aeInfo->ae_win_size.h_end; ++ stAeCtl.ae_win_v_end = aeInfo->ae_win_size.v_end; ++ stAeCtl.ae_tar_bright = aeInfo->ae_tar_bright; ++ stAeCtl.ae_tar_bright_range = aeInfo->ae_tar_bright_range; ++ stAeCtl.ae_l_ex_time = aeInfo->ae_l_ex_time; ++ stAeCtl.ae_m_ex_time = aeInfo->ae_m_ex_time; ++ stAeCtl.ae_s_ex_time = aeInfo->ae_s_ex_time; ++ stAeCtl.ae_agc = aeInfo->ae_agc; ++ stAeCtl.ae_ad_shuttle_freq = aeInfo->ae_ad_shuttle_freq; ++ stAeCtl.ae_ad_gain_freq = aeInfo->ae_ad_gain_freq; ++ stAeCtl.ae_adjust_step_max = aeInfo->ae_adjust_step_max; ++ stAeCtl.ae_ex_value_max = aeInfo->ae_ex_value_max; ++ stAeCtl.ae_ex_value_mid = aeInfo->ae_ex_value_mid; ++ stAeCtl.ae_ex_value_min = aeInfo->ae_ex_value_min; ++ stAeCtl.ae_gain_value_max = aeInfo->ae_gain_value_max; ++ stAeCtl.ae_gain_value_mid = aeInfo->ae_gain_value_mid; ++ stAeCtl.ae_gain_value_min = aeInfo->ae_gain_value_min; ++ stAeCtl.ae_dn_switch_ad_step_max = aeInfo->ae_dn_switch_ad_step_max; ++ stAeCtl.ae_dn_switch_wait_time = aeInfo->ae_dn_switch_wait_time; ++ stAeCtl.ape_max_diff = aeInfo->ape_max_diff; ++ stAeCtl.ape_drv_signal_max = aeInfo->ape_drv_signal_max; ++ stAeCtl.ape_coeff_distance = aeInfo->ape_coeff_distance; ++ stAeCtl.ape_coeff_speed = aeInfo->ape_coeff_speed; ++ stAeCtl.ape_coeff_acceleration = aeInfo->ape_coeff_acceleration; ++ stAeCtl.ape_drv_manual_value = aeInfo->ape_drv_manual_value; ++ stAeCtl.ape_damp_manual_value = aeInfo->ape_damp_manual_value; ++ Isp_Drv_F2k_Core_SetAeCtl(isp,&stAeCtl); + return 0; + } + +@@ -1095,46 +1095,46 @@ static int isp_f2k_core_GetAeSts(struct k510_isp_device *isp,struct k510isp_ae_s + //AWB + static int isp_f2k_core_SetAwbCtl(struct k510_isp_device *isp,AWB_INFO_S *awbInfo) + { +- ISP_CORE_AWB_CTL_S stAwbCtl; +- stAwbCtl.awb_d65_en = awbInfo->awb_d65_en; +- stAwbCtl.awb_ccm_en = awbInfo->awb_ccm_en; +- stAwbCtl.awb_en = awbInfo->awb_en; +- stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; +- stAwbCtl.awb_hist_mode_sel = awbInfo->awb_hist_mode_sel; +- stAwbCtl.awb_veri_en = awbInfo->awb_veri_en; +- stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; +- stAwbCtl.awb_value_save_en = awbInfo->awb_value_save_en; +- stAwbCtl.awb_ccm_adp_adjust_en = awbInfo->awb_ccm_adp_adjust_en; +- stAwbCtl.awb_stab_en = awbInfo->awb_stab_en; +- stAwbCtl.awb_d65_red_gain = awbInfo->awb_d65_red_gain; +- stAwbCtl.awb_d65_blue_gain = awbInfo->awb_d65_blue_gain; +- stAwbCtl.ccm_rr_coff = awbInfo->ccm_coff[0][0]; +- stAwbCtl.ccm_rg_coff = awbInfo->ccm_coff[0][1]; +- stAwbCtl.ccm_rb_coff = awbInfo->ccm_coff[0][2]; +- stAwbCtl.ccm_gr_coff = awbInfo->ccm_coff[1][0]; +- stAwbCtl.ccm_gg_coff = awbInfo->ccm_coff[1][1]; +- stAwbCtl.ccm_gb_coff = awbInfo->ccm_coff[1][2]; +- stAwbCtl.ccm_br_coff = awbInfo->ccm_coff[2][0]; +- stAwbCtl.ccm_bg_coff = awbInfo->ccm_coff[2][1]; +- stAwbCtl.ccm_bb_coff = awbInfo->ccm_coff[2][2]; +- stAwbCtl.ccm_correct_coff = awbInfo->ccm_correct_coff; +- stAwbCtl.awb_win_h_start = awbInfo->awb_win_size.h_start; +- stAwbCtl.awb_win_v_start = awbInfo->awb_win_size.v_start; +- stAwbCtl.awb_win_h_end = awbInfo->awb_win_size.h_end; +- stAwbCtl.awb_win_v_end = awbInfo->awb_win_size.v_end; +- stAwbCtl.awb_correct_diff_th = awbInfo->awb_correct_diff_th; +- stAwbCtl.awb_color_changeres_time = awbInfo->awb_color_changeres_time; +- stAwbCtl.awb_historgram_th = awbInfo->awb_historgram_th; +- stAwbCtl.awb_red_gain_adjust = awbInfo->awb_red_gain_adjust; +- stAwbCtl.awb_green_gain_adjust = awbInfo->awb_green_gain_adjust; +- stAwbCtl.awb_blue_gain_adjust = awbInfo->awb_blue_gain_adjust; +- stAwbCtl.awb_red_max_value = awbInfo->awb_red_max_value; +- stAwbCtl.awb_blue_max_value = awbInfo->awb_blue_max_value; +- stAwbCtl.awb_red_min_value = awbInfo->awb_red_min_value; +- stAwbCtl.awb_blue_min_value = awbInfo->awb_blue_min_value; +- stAwbCtl.awb_red_obj_value = awbInfo->awb_red_obj_value; +- stAwbCtl.awb_blue_obj_value = awbInfo->awb_blue_obj_value; +- Isp_Drv_F2k_Core_SetAwbCtl(isp,&stAwbCtl); ++ ISP_CORE_AWB_CTL_S stAwbCtl; ++ stAwbCtl.awb_d65_en = awbInfo->awb_d65_en; ++ stAwbCtl.awb_ccm_en = awbInfo->awb_ccm_en; ++ stAwbCtl.awb_en = awbInfo->awb_en; ++ stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; ++ stAwbCtl.awb_hist_mode_sel = awbInfo->awb_hist_mode_sel; ++ stAwbCtl.awb_veri_en = awbInfo->awb_veri_en; ++ stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; ++ stAwbCtl.awb_value_save_en = awbInfo->awb_value_save_en; ++ stAwbCtl.awb_ccm_adp_adjust_en = awbInfo->awb_ccm_adp_adjust_en; ++ stAwbCtl.awb_stab_en = awbInfo->awb_stab_en; ++ stAwbCtl.awb_d65_red_gain = awbInfo->awb_d65_red_gain; ++ stAwbCtl.awb_d65_blue_gain = awbInfo->awb_d65_blue_gain; ++ stAwbCtl.ccm_rr_coff = awbInfo->ccm_coff[0][0]; ++ stAwbCtl.ccm_rg_coff = awbInfo->ccm_coff[0][1]; ++ stAwbCtl.ccm_rb_coff = awbInfo->ccm_coff[0][2]; ++ stAwbCtl.ccm_gr_coff = awbInfo->ccm_coff[1][0]; ++ stAwbCtl.ccm_gg_coff = awbInfo->ccm_coff[1][1]; ++ stAwbCtl.ccm_gb_coff = awbInfo->ccm_coff[1][2]; ++ stAwbCtl.ccm_br_coff = awbInfo->ccm_coff[2][0]; ++ stAwbCtl.ccm_bg_coff = awbInfo->ccm_coff[2][1]; ++ stAwbCtl.ccm_bb_coff = awbInfo->ccm_coff[2][2]; ++ stAwbCtl.ccm_correct_coff = awbInfo->ccm_correct_coff; ++ stAwbCtl.awb_win_h_start = awbInfo->awb_win_size.h_start; ++ stAwbCtl.awb_win_v_start = awbInfo->awb_win_size.v_start; ++ stAwbCtl.awb_win_h_end = awbInfo->awb_win_size.h_end; ++ stAwbCtl.awb_win_v_end = awbInfo->awb_win_size.v_end; ++ stAwbCtl.awb_correct_diff_th = awbInfo->awb_correct_diff_th; ++ stAwbCtl.awb_color_changeres_time = awbInfo->awb_color_changeres_time; ++ stAwbCtl.awb_historgram_th = awbInfo->awb_historgram_th; ++ stAwbCtl.awb_red_gain_adjust = awbInfo->awb_red_gain_adjust; ++ stAwbCtl.awb_green_gain_adjust = awbInfo->awb_green_gain_adjust; ++ stAwbCtl.awb_blue_gain_adjust = awbInfo->awb_blue_gain_adjust; ++ stAwbCtl.awb_red_max_value = awbInfo->awb_red_max_value; ++ stAwbCtl.awb_blue_max_value = awbInfo->awb_blue_max_value; ++ stAwbCtl.awb_red_min_value = awbInfo->awb_red_min_value; ++ stAwbCtl.awb_blue_min_value = awbInfo->awb_blue_min_value; ++ stAwbCtl.awb_red_obj_value = awbInfo->awb_red_obj_value; ++ stAwbCtl.awb_blue_obj_value = awbInfo->awb_blue_obj_value; ++ Isp_Drv_F2k_Core_SetAwbCtl(isp,&stAwbCtl); + return 0; + } + +@@ -1162,233 +1162,233 @@ static int isp_f2k_core_RegGet(struct k510_isp_device *isp,struct k510isp_reg_va + static int isp_f2k_core_SetWdrCtl(struct k510_isp_device *isp,struct isp_core_wdr_Info *wdrInfo) + { + +- ISP_CORE_WDR_CTL_S stWdrCtl; +- stWdrCtl.wdr_fusion_en = wdrInfo->wdr_fusion_en; +- stWdrCtl.wdr_frame_sel = wdrInfo->wdr_frame_sel; +- stWdrCtl.wdr_adp_adjust_en = wdrInfo->wdr_adp_adjust_en; +- stWdrCtl.wdr_stab_en = wdrInfo->wdr_stab_en; +- stWdrCtl.wdr_en = wdrInfo->wdr_en; +- stWdrCtl.wdr_ghost_remove_en = wdrInfo->wdr_ghost_remove_en; +- stWdrCtl.wdr_3frame_out_mode = wdrInfo->wdr_3frame_out_mode; +- stWdrCtl.wdr_mode_sel = wdrInfo->wdr_mode_sel; +- stWdrCtl.wdr_2frame_ex_ratio = wdrInfo->wdr_2frame_ex_ratio; +- stWdrCtl.wdr_3frame_ex_ratio = wdrInfo->wdr_3frame_ex_ratio; +- stWdrCtl.wdr_stat_img_sel = wdrInfo->wdr_stat_img_sel; +- stWdrCtl.wdr_ltm_data_sel = wdrInfo->wdr_ltm_data_sel; +- stWdrCtl.wdr_tz_data_sel = wdrInfo->wdr_tz_data_sel; +- stWdrCtl.wdr_remove_purple_en = wdrInfo->wdr_remove_purple_en; +- stWdrCtl.wdr_over_ex_ratio_th1 = wdrInfo->wdr_over_ex_ratio_th1; +- stWdrCtl.wdr_over_ex_ratio_th2 = wdrInfo->wdr_over_ex_ratio_th2; +- stWdrCtl.wdr_fusion_ratio_th = wdrInfo->wdr_fusion_ratio_th; +- stWdrCtl.wdr_fusion_value1 = wdrInfo->wdr_fusion_value1; +- stWdrCtl.wdr_fusion_value2 = wdrInfo->wdr_fusion_value2; +- Isp_Drv_F2k_Core_SetWdrCtl(isp,&stWdrCtl); ++ ISP_CORE_WDR_CTL_S stWdrCtl; ++ stWdrCtl.wdr_fusion_en = wdrInfo->wdr_fusion_en; ++ stWdrCtl.wdr_frame_sel = wdrInfo->wdr_frame_sel; ++ stWdrCtl.wdr_adp_adjust_en = wdrInfo->wdr_adp_adjust_en; ++ stWdrCtl.wdr_stab_en = wdrInfo->wdr_stab_en; ++ stWdrCtl.wdr_en = wdrInfo->wdr_en; ++ stWdrCtl.wdr_ghost_remove_en = wdrInfo->wdr_ghost_remove_en; ++ stWdrCtl.wdr_3frame_out_mode = wdrInfo->wdr_3frame_out_mode; ++ stWdrCtl.wdr_mode_sel = wdrInfo->wdr_mode_sel; ++ stWdrCtl.wdr_2frame_ex_ratio = wdrInfo->wdr_2frame_ex_ratio; ++ stWdrCtl.wdr_3frame_ex_ratio = wdrInfo->wdr_3frame_ex_ratio; ++ stWdrCtl.wdr_stat_img_sel = wdrInfo->wdr_stat_img_sel; ++ stWdrCtl.wdr_ltm_data_sel = wdrInfo->wdr_ltm_data_sel; ++ stWdrCtl.wdr_tz_data_sel = wdrInfo->wdr_tz_data_sel; ++ stWdrCtl.wdr_remove_purple_en = wdrInfo->wdr_remove_purple_en; ++ stWdrCtl.wdr_over_ex_ratio_th1 = wdrInfo->wdr_over_ex_ratio_th1; ++ stWdrCtl.wdr_over_ex_ratio_th2 = wdrInfo->wdr_over_ex_ratio_th2; ++ stWdrCtl.wdr_fusion_ratio_th = wdrInfo->wdr_fusion_ratio_th; ++ stWdrCtl.wdr_fusion_value1 = wdrInfo->wdr_fusion_value1; ++ stWdrCtl.wdr_fusion_value2 = wdrInfo->wdr_fusion_value2; ++ Isp_Drv_F2k_Core_SetWdrCtl(isp,&stWdrCtl); + return 0; + } + //CSC + static int isp_f2k_core_SetCscCtl(struct k510_isp_device *isp,CSC_INFO_S *cscInfo) + { + +- ISP_CORE_CSC_CTL_S stCscCtl; +- stCscCtl.csc_r2y_00 = cscInfo->csc_r2y[0][0]; +- stCscCtl.csc_r2y_01 = cscInfo->csc_r2y[0][1]; +- stCscCtl.csc_r2y_02 = cscInfo->csc_r2y[0][2]; +- stCscCtl.csc_r2y_10 = cscInfo->csc_r2y[1][0]; +- stCscCtl.csc_r2y_11 = cscInfo->csc_r2y[1][1]; +- stCscCtl.csc_r2y_12 = cscInfo->csc_r2y[1][2]; +- stCscCtl.csc_r2y_20 = cscInfo->csc_r2y[2][0]; +- stCscCtl.csc_r2y_21 = cscInfo->csc_r2y[2][1]; +- stCscCtl.csc_r2y_22 = cscInfo->csc_r2y[2][2]; +- Isp_Drv_F2k_Core_SetCscCtl(isp,&stCscCtl); ++ ISP_CORE_CSC_CTL_S stCscCtl; ++ stCscCtl.csc_r2y_00 = cscInfo->csc_r2y[0][0]; ++ stCscCtl.csc_r2y_01 = cscInfo->csc_r2y[0][1]; ++ stCscCtl.csc_r2y_02 = cscInfo->csc_r2y[0][2]; ++ stCscCtl.csc_r2y_10 = cscInfo->csc_r2y[1][0]; ++ stCscCtl.csc_r2y_11 = cscInfo->csc_r2y[1][1]; ++ stCscCtl.csc_r2y_12 = cscInfo->csc_r2y[1][2]; ++ stCscCtl.csc_r2y_20 = cscInfo->csc_r2y[2][0]; ++ stCscCtl.csc_r2y_21 = cscInfo->csc_r2y[2][1]; ++ stCscCtl.csc_r2y_22 = cscInfo->csc_r2y[2][2]; ++ Isp_Drv_F2k_Core_SetCscCtl(isp,&stCscCtl); + return 0; + } + //ADA + static int isp_f2k_core_SetAdaCtl(struct k510_isp_device *isp,ADA_INFO_S *adaInfo) + { +- ISP_CORE_ADA_CTL_S stAdaCtl; +- stAdaCtl.ada_rgb_gamma_en = adaInfo->ada_rgb_gamma_en; +- stAdaCtl.ada_yuv_gamma_en = adaInfo->ada_yuv_gamma_en; +- stAdaCtl.ada_adjust_en = adaInfo->ada_adjust_en; +- stAdaCtl.ada_img_stab_en = adaInfo->ada_img_stab_en; +- stAdaCtl.ada_ccr_en = adaInfo->ada_ccr_en; +- stAdaCtl.ada_adp_en = adaInfo->ada_adp_en; +- stAdaCtl.ada_adp_ccr_en = adaInfo->ada_adp_ccr_en; +- stAdaCtl.ada_stat_mode_sel = adaInfo->ada_stat_mode_sel; +- stAdaCtl.ada_enh_mode_sel = adaInfo->ada_enh_mode_sel; +- stAdaCtl.ada_stat_max_value = adaInfo->ada_stat_max_value; +- stAdaCtl.ada_ad_stren_max_value = adaInfo->ada_ad_stren_max_value; +- stAdaCtl.ada_win_h_start = adaInfo->ada_win_size.h_start; +- stAdaCtl.ada_win_v_start = adaInfo->ada_win_size.v_start; +- stAdaCtl.ada_win_h_end = adaInfo->ada_win_size.h_end; +- stAdaCtl.ada_win_v_end = adaInfo->ada_win_size.v_end; +- Isp_Drv_F2k_Core_SetAdaCtl(isp,&stAdaCtl); ++ ISP_CORE_ADA_CTL_S stAdaCtl; ++ stAdaCtl.ada_rgb_gamma_en = adaInfo->ada_rgb_gamma_en; ++ stAdaCtl.ada_yuv_gamma_en = adaInfo->ada_yuv_gamma_en; ++ stAdaCtl.ada_adjust_en = adaInfo->ada_adjust_en; ++ stAdaCtl.ada_img_stab_en = adaInfo->ada_img_stab_en; ++ stAdaCtl.ada_ccr_en = adaInfo->ada_ccr_en; ++ stAdaCtl.ada_adp_en = adaInfo->ada_adp_en; ++ stAdaCtl.ada_adp_ccr_en = adaInfo->ada_adp_ccr_en; ++ stAdaCtl.ada_stat_mode_sel = adaInfo->ada_stat_mode_sel; ++ stAdaCtl.ada_enh_mode_sel = adaInfo->ada_enh_mode_sel; ++ stAdaCtl.ada_stat_max_value = adaInfo->ada_stat_max_value; ++ stAdaCtl.ada_ad_stren_max_value = adaInfo->ada_ad_stren_max_value; ++ stAdaCtl.ada_win_h_start = adaInfo->ada_win_size.h_start; ++ stAdaCtl.ada_win_v_start = adaInfo->ada_win_size.v_start; ++ stAdaCtl.ada_win_h_end = adaInfo->ada_win_size.h_end; ++ stAdaCtl.ada_win_v_end = adaInfo->ada_win_size.v_end; ++ Isp_Drv_F2k_Core_SetAdaCtl(isp,&stAdaCtl); + return 0; + } + //RGBIR + static int isp_f2k_core_SetRgbirCtl(struct k510_isp_device *isp,RGBIR_INFO_S *rgbirInfo) + { +- ISP_CORE_RGBIR_CTL_S stRgbirCtl; +- stRgbirCtl.rgbir_en = rgbirInfo->rgbir_en; +- stRgbirCtl.rgbir_rtf_en = rgbirInfo->rgbir_rtf_en; +- stRgbirCtl.rgbir_rpc_en = rgbirInfo->rgbir_rpc_en; +- stRgbirCtl.rgbir_fusion_en = rgbirInfo->rgbir_fusion_en; +- stRgbirCtl.rgbir_output_sel = rgbirInfo->rgbir_output_sel; +- stRgbirCtl.rgbir_rpc_max_value = rgbirInfo->rgbir_rpc_max_value; +- stRgbirCtl.rgbir_rpc_color_coff = rgbirInfo->rgbir_rpc_color_coff; +- stRgbirCtl.rgbir_rpc_luma_coff = rgbirInfo->rgbir_rpc_luma_coff; +- stRgbirCtl.rgbir_rpc_th = rgbirInfo->rgbir_rpc_th; +- stRgbirCtl.rgbir_rpc_th1 = rgbirInfo->rgbir_rpc_th1; +- Isp_Drv_F2k_Core_SetRgbIrCtl(isp,&stRgbirCtl); ++ ISP_CORE_RGBIR_CTL_S stRgbirCtl; ++ stRgbirCtl.rgbir_en = rgbirInfo->rgbir_en; ++ stRgbirCtl.rgbir_rtf_en = rgbirInfo->rgbir_rtf_en; ++ stRgbirCtl.rgbir_rpc_en = rgbirInfo->rgbir_rpc_en; ++ stRgbirCtl.rgbir_fusion_en = rgbirInfo->rgbir_fusion_en; ++ stRgbirCtl.rgbir_output_sel = rgbirInfo->rgbir_output_sel; ++ stRgbirCtl.rgbir_rpc_max_value = rgbirInfo->rgbir_rpc_max_value; ++ stRgbirCtl.rgbir_rpc_color_coff = rgbirInfo->rgbir_rpc_color_coff; ++ stRgbirCtl.rgbir_rpc_luma_coff = rgbirInfo->rgbir_rpc_luma_coff; ++ stRgbirCtl.rgbir_rpc_th = rgbirInfo->rgbir_rpc_th; ++ stRgbirCtl.rgbir_rpc_th1 = rgbirInfo->rgbir_rpc_th1; ++ Isp_Drv_F2k_Core_SetRgbIrCtl(isp,&stRgbirCtl); + return 0; + } + //2DNR + static int isp_f2k_core_Set2dnrCtl(struct k510_isp_device *isp,NR2D_INFO_S *nr2dInfo) + { +- ISP_CORE_2DNR_CTL_S st2dnrCtl; +- st2dnrCtl.core_2dnr_pcf_en = nr2dInfo->d2nr_pcf_en; +- st2dnrCtl.core_2dnr_raw_en = nr2dInfo->d2nr_raw_en; +- st2dnrCtl.core_2dnr_edge_en = nr2dInfo->d2nr_edge_en; +- st2dnrCtl.core_2dnr_bap_en = nr2dInfo->d2nr_bap_en; +- st2dnrCtl.core_2dnr_luma_en = nr2dInfo->d2nr_luma_en; +- st2dnrCtl.core_2dnr_chroma_en = nr2dInfo->d2nr_chroma_en; +- st2dnrCtl.core_2dnr_pcf_adp_en = nr2dInfo->d2nr_pcf_adp_en; +- st2dnrCtl.core_2dnr_raw_adp_en = nr2dInfo->d2nr_raw_adp_en; +- st2dnrCtl.core_2dnr_luma_adp_en = nr2dInfo->d2nr_luma_adp_en; +- st2dnrCtl.core_2dnr_chroma_adp_en = nr2dInfo->d2nr_chroma_adp_en; +- st2dnrCtl.core_2dnr_raw_intensity = nr2dInfo->d2nr_raw_intensity; +- st2dnrCtl.core_2dnr_bap_intensity = nr2dInfo->d2nr_bap_intensity; +- st2dnrCtl.core_2dnr_edge_intensity = nr2dInfo->d2nr_edge_intensity; +- st2dnrCtl.core_2dnr_luma_intensity = nr2dInfo->d2nr_luma_intensity; +- st2dnrCtl.core_2dnr_chroma_intensity = nr2dInfo->d2nr_chroma_intensity; +- Isp_Drv_F2k_Core_Set2DnrCtl(isp,&st2dnrCtl); ++ ISP_CORE_2DNR_CTL_S st2dnrCtl; ++ st2dnrCtl.core_2dnr_pcf_en = nr2dInfo->d2nr_pcf_en; ++ st2dnrCtl.core_2dnr_raw_en = nr2dInfo->d2nr_raw_en; ++ st2dnrCtl.core_2dnr_edge_en = nr2dInfo->d2nr_edge_en; ++ st2dnrCtl.core_2dnr_bap_en = nr2dInfo->d2nr_bap_en; ++ st2dnrCtl.core_2dnr_luma_en = nr2dInfo->d2nr_luma_en; ++ st2dnrCtl.core_2dnr_chroma_en = nr2dInfo->d2nr_chroma_en; ++ st2dnrCtl.core_2dnr_pcf_adp_en = nr2dInfo->d2nr_pcf_adp_en; ++ st2dnrCtl.core_2dnr_raw_adp_en = nr2dInfo->d2nr_raw_adp_en; ++ st2dnrCtl.core_2dnr_luma_adp_en = nr2dInfo->d2nr_luma_adp_en; ++ st2dnrCtl.core_2dnr_chroma_adp_en = nr2dInfo->d2nr_chroma_adp_en; ++ st2dnrCtl.core_2dnr_raw_intensity = nr2dInfo->d2nr_raw_intensity; ++ st2dnrCtl.core_2dnr_bap_intensity = nr2dInfo->d2nr_bap_intensity; ++ st2dnrCtl.core_2dnr_edge_intensity = nr2dInfo->d2nr_edge_intensity; ++ st2dnrCtl.core_2dnr_luma_intensity = nr2dInfo->d2nr_luma_intensity; ++ st2dnrCtl.core_2dnr_chroma_intensity = nr2dInfo->d2nr_chroma_intensity; ++ Isp_Drv_F2k_Core_Set2DnrCtl(isp,&st2dnrCtl); + return 0; + } + //3DNR + static int isp_f2k_core_Set3dnrCtl(struct k510_isp_device *isp,NR3D_INFO_S *nr3dInfo) + { +- ISP_CORE_3DNR_CTL_S st3dnrCtl; +- st3dnrCtl.core_3dnr_en = nr3dInfo->d3nr_en; +- st3dnrCtl.core_3dnr_pre_luma_en = nr3dInfo->d3nr_pre_luma_en; +- st3dnrCtl.core_3dnr_pre_chroma_en = nr3dInfo->d3nr_pre_chroma_en; +- st3dnrCtl.core_3dnr_main_luma_en = nr3dInfo->d3nr_main_luma_en; +- st3dnrCtl.core_3dnr_main_chroma_en = nr3dInfo->d3nr_main_chroma_en; +- st3dnrCtl.core_3dnr_post_luma_en = nr3dInfo->d3nr_post_luma_en; +- st3dnrCtl.core_3dnr_post_chroma_en = nr3dInfo->d3nr_post_chroma_en; +- st3dnrCtl.core_3dnr_2d_luma_en = nr3dInfo->d3nr_2d_luma_en; +- st3dnrCtl.core_3dnr_2d_chroma_en = nr3dInfo->d3nr_2d_luma_en; +- st3dnrCtl.core_3dnr_wb_en = nr3dInfo->d3nr_wb_en; +- st3dnrCtl.core_3dnr_wb_sel = nr3dInfo->d3nr_wb_sel; +- st3dnrCtl.core_3dnr_adp_luma_en = nr3dInfo->d3nr_adp_luma_en; +- st3dnrCtl.core_3dnr_adp_chroma_en = nr3dInfo->d3nr_adp_chroma_en; +- st3dnrCtl.core_3dnr_pre_luma_th = nr3dInfo->d3nr_pre_luma_th; +- st3dnrCtl.core_3dnr_pre_luma_intensity = nr3dInfo->d3nr_pre_luma_intensity; +- st3dnrCtl.core_3dnr_pre_chroma_intensity = nr3dInfo->d3nr_pre_chroma_intensity; +- st3dnrCtl.core_3dnr_mid_filter_th = nr3dInfo->d3nr_mid_filter_th; +- st3dnrCtl.core_3dnr_pre_mid_filter_th = nr3dInfo->d3nr_pre_mid_filter_th; +- st3dnrCtl.core_3dnr_cur_mid_filter_th = nr3dInfo->d3nr_cur_mid_filter_th; +- st3dnrCtl.core_3dnr_low_pass_filter_th = nr3dInfo->d3nr_low_pass_filter_th; +- st3dnrCtl.core_3dnr_luma_th = nr3dInfo->d3nr_luma_th; +- st3dnrCtl.core_3dnr_min_value = nr3dInfo->d3nr_min_value; +- st3dnrCtl.core_3dnr_luma_intensity = nr3dInfo->d3nr_luma_intensity; +- st3dnrCtl.core_3dnr_chroma_intensity = nr3dInfo->d3nr_chroma_intensity; +- st3dnrCtl.core_3dnr_post_edge_th = nr3dInfo->d3nr_post_edge_th; +- st3dnrCtl.core_3dnr_post_luma_intensity = nr3dInfo->d3nr_post_luma_intensity; +- st3dnrCtl.core_3dnr_post_chroma_intensity = nr3dInfo->d3nr_post_chroma_intensity; +- Isp_Drv_F2k_Core_Set3DnrCtl(isp,&st3dnrCtl); ++ ISP_CORE_3DNR_CTL_S st3dnrCtl; ++ st3dnrCtl.core_3dnr_en = nr3dInfo->d3nr_en; ++ st3dnrCtl.core_3dnr_pre_luma_en = nr3dInfo->d3nr_pre_luma_en; ++ st3dnrCtl.core_3dnr_pre_chroma_en = nr3dInfo->d3nr_pre_chroma_en; ++ st3dnrCtl.core_3dnr_main_luma_en = nr3dInfo->d3nr_main_luma_en; ++ st3dnrCtl.core_3dnr_main_chroma_en = nr3dInfo->d3nr_main_chroma_en; ++ st3dnrCtl.core_3dnr_post_luma_en = nr3dInfo->d3nr_post_luma_en; ++ st3dnrCtl.core_3dnr_post_chroma_en = nr3dInfo->d3nr_post_chroma_en; ++ st3dnrCtl.core_3dnr_2d_luma_en = nr3dInfo->d3nr_2d_luma_en; ++ st3dnrCtl.core_3dnr_2d_chroma_en = nr3dInfo->d3nr_2d_luma_en; ++ st3dnrCtl.core_3dnr_wb_en = nr3dInfo->d3nr_wb_en; ++ st3dnrCtl.core_3dnr_wb_sel = nr3dInfo->d3nr_wb_sel; ++ st3dnrCtl.core_3dnr_adp_luma_en = nr3dInfo->d3nr_adp_luma_en; ++ st3dnrCtl.core_3dnr_adp_chroma_en = nr3dInfo->d3nr_adp_chroma_en; ++ st3dnrCtl.core_3dnr_pre_luma_th = nr3dInfo->d3nr_pre_luma_th; ++ st3dnrCtl.core_3dnr_pre_luma_intensity = nr3dInfo->d3nr_pre_luma_intensity; ++ st3dnrCtl.core_3dnr_pre_chroma_intensity = nr3dInfo->d3nr_pre_chroma_intensity; ++ st3dnrCtl.core_3dnr_mid_filter_th = nr3dInfo->d3nr_mid_filter_th; ++ st3dnrCtl.core_3dnr_pre_mid_filter_th = nr3dInfo->d3nr_pre_mid_filter_th; ++ st3dnrCtl.core_3dnr_cur_mid_filter_th = nr3dInfo->d3nr_cur_mid_filter_th; ++ st3dnrCtl.core_3dnr_low_pass_filter_th = nr3dInfo->d3nr_low_pass_filter_th; ++ st3dnrCtl.core_3dnr_luma_th = nr3dInfo->d3nr_luma_th; ++ st3dnrCtl.core_3dnr_min_value = nr3dInfo->d3nr_min_value; ++ st3dnrCtl.core_3dnr_luma_intensity = nr3dInfo->d3nr_luma_intensity; ++ st3dnrCtl.core_3dnr_chroma_intensity = nr3dInfo->d3nr_chroma_intensity; ++ st3dnrCtl.core_3dnr_post_edge_th = nr3dInfo->d3nr_post_edge_th; ++ st3dnrCtl.core_3dnr_post_luma_intensity = nr3dInfo->d3nr_post_luma_intensity; ++ st3dnrCtl.core_3dnr_post_chroma_intensity = nr3dInfo->d3nr_post_chroma_intensity; ++ Isp_Drv_F2k_Core_Set3DnrCtl(isp,&st3dnrCtl); + return 0; + } + //ENH + static int isp_f2k_core_SetEnhCtl(struct k510_isp_device *isp,ENH_INFO_S *enhInfo) + { +- ISP_CORE_ENH_CTL_S stEnhCtl; +- stEnhCtl.enh_ltm_en = enhInfo->enh_ltm_en; +- stEnhCtl.enh_sharp_en = enhInfo->enh_sharp_en; +- stEnhCtl.enh_cc_en = enhInfo->enh_cc_en; +- stEnhCtl.enh_adp_ltm_en = enhInfo->enh_adp_ltm_en; +- stEnhCtl.enh_adp_sharp_en = enhInfo->enh_adp_sharp_en; +- stEnhCtl.enh_adp_cc_en = enhInfo->enh_adp_cc_en; +- stEnhCtl.ltm_gain = enhInfo->ltm_gain; +- stEnhCtl.ltm_th = enhInfo->ltm_th; +- stEnhCtl.enh_nr_th = enhInfo->enh_nr_th; +- stEnhCtl.enh_th1 = enhInfo->enh_th1; +- stEnhCtl.enh_th2 = enhInfo->enh_th2; +- stEnhCtl.sharp_gain = enhInfo->sharp_gain; +- Isp_Drv_F2k_Core_SetEnhLtmCtl(isp,&stEnhCtl); +- Isp_Drv_F2k_Core_SetEnhCCCtl(isp,&stEnhCtl); +- Isp_Drv_F2k_Core_SetEnhSharpenCtl(isp,&stEnhCtl); ++ ISP_CORE_ENH_CTL_S stEnhCtl; ++ stEnhCtl.enh_ltm_en = enhInfo->enh_ltm_en; ++ stEnhCtl.enh_sharp_en = enhInfo->enh_sharp_en; ++ stEnhCtl.enh_cc_en = enhInfo->enh_cc_en; ++ stEnhCtl.enh_adp_ltm_en = enhInfo->enh_adp_ltm_en; ++ stEnhCtl.enh_adp_sharp_en = enhInfo->enh_adp_sharp_en; ++ stEnhCtl.enh_adp_cc_en = enhInfo->enh_adp_cc_en; ++ stEnhCtl.ltm_gain = enhInfo->ltm_gain; ++ stEnhCtl.ltm_th = enhInfo->ltm_th; ++ stEnhCtl.enh_nr_th = enhInfo->enh_nr_th; ++ stEnhCtl.enh_th1 = enhInfo->enh_th1; ++ stEnhCtl.enh_th2 = enhInfo->enh_th2; ++ stEnhCtl.sharp_gain = enhInfo->sharp_gain; ++ Isp_Drv_F2k_Core_SetEnhLtmCtl(isp,&stEnhCtl); ++ Isp_Drv_F2k_Core_SetEnhCCCtl(isp,&stEnhCtl); ++ Isp_Drv_F2k_Core_SetEnhSharpenCtl(isp,&stEnhCtl); + return 0; + } + //POST + static int isp_f2k_core_SetPostCtl(struct k510_isp_device *isp,POST_INFO_S *postInfo) + { +- ISP_CORE_POST_CTL_S stPostCtl; +- stPostCtl.post_cont_ad_en = postInfo->post_cont_ad_en; +- stPostCtl.post_luma_ad_en = postInfo->post_luma_ad_en; +- stPostCtl.post_satu_ad_en = postInfo->post_satu_ad_en; +- stPostCtl.cont_ad_intensity = postInfo->cont_ad_intensity; +- stPostCtl.luma_ad_intensity = postInfo->luma_ad_intensity; +- stPostCtl.satu_ad_intensity = postInfo->satu_ad_intensity; +- Isp_Drv_F2k_Core_SetPostContCtl(isp,&stPostCtl); +- Isp_Drv_F2k_Core_SetPostLumaCtl(isp,&stPostCtl); +- Isp_Drv_F2k_Core_SetPostSatuCtl(isp,&stPostCtl); ++ ISP_CORE_POST_CTL_S stPostCtl; ++ stPostCtl.post_cont_ad_en = postInfo->post_cont_ad_en; ++ stPostCtl.post_luma_ad_en = postInfo->post_luma_ad_en; ++ stPostCtl.post_satu_ad_en = postInfo->post_satu_ad_en; ++ stPostCtl.cont_ad_intensity = postInfo->cont_ad_intensity; ++ stPostCtl.luma_ad_intensity = postInfo->luma_ad_intensity; ++ stPostCtl.satu_ad_intensity = postInfo->satu_ad_intensity; ++ Isp_Drv_F2k_Core_SetPostContCtl(isp,&stPostCtl); ++ Isp_Drv_F2k_Core_SetPostLumaCtl(isp,&stPostCtl); ++ Isp_Drv_F2k_Core_SetPostSatuCtl(isp,&stPostCtl); + return 0; + } + //OTC + static int isp_f2k_core_SetOtcCtl(struct k510_isp_device *isp,OTC_INFO_S *otcInfo) + { +- ISP_CORE_OTC_CTL_S stOtcCtl; +- stOtcCtl.post_otc_en = otcInfo->post_otc_en; +- stOtcCtl.otc_yc_sel = otcInfo->otc_yc_sel; +- stOtcCtl.otc_uv_format_sel = otcInfo->otc_uv_format_sel; +- stOtcCtl.otc_hsync_pol_sel = otcInfo->otc_hsync_pol_sel; +- stOtcCtl.otc_vsync_pol_sel = otcInfo->otc_vsync_pol_sel; +- stOtcCtl.otc_stt_vr = otcInfo->otc_out_size.Width_st; +- stOtcCtl.otc_stt_hr = otcInfo->otc_out_size.Height_st; +- stOtcCtl.otc_height = otcInfo->otc_out_size.Height; +- stOtcCtl.otc_width = otcInfo->otc_out_size.Width; +- Isp_Drv_F2k_Core_SetOtcCtl(isp,&stOtcCtl); ++ ISP_CORE_OTC_CTL_S stOtcCtl; ++ stOtcCtl.post_otc_en = otcInfo->post_otc_en; ++ stOtcCtl.otc_yc_sel = otcInfo->otc_yc_sel; ++ stOtcCtl.otc_uv_format_sel = otcInfo->otc_uv_format_sel; ++ stOtcCtl.otc_hsync_pol_sel = otcInfo->otc_hsync_pol_sel; ++ stOtcCtl.otc_vsync_pol_sel = otcInfo->otc_vsync_pol_sel; ++ stOtcCtl.otc_stt_vr = otcInfo->otc_out_size.Width_st; ++ stOtcCtl.otc_stt_hr = otcInfo->otc_out_size.Height_st; ++ stOtcCtl.otc_height = otcInfo->otc_out_size.Height; ++ stOtcCtl.otc_width = otcInfo->otc_out_size.Width; ++ Isp_Drv_F2k_Core_SetOtcCtl(isp,&stOtcCtl); + return 0; + } + //LDC + static int isp_f2k_core_SetLdcCtl(struct k510_isp_device *isp,LDC_INFO_S *ldcInfo) + { +- ISP_CORE_LDC_CTL_S stLdcCtl; +- stLdcCtl.ldc_en = ldcInfo->ldc_en; +- stLdcCtl.ldc_arith_en = ldcInfo->ldc_arith_en; +- stLdcCtl.ldc_req_freq = ldcInfo->ldc_req_freq; +- stLdcCtl.ldc_stt_ln = ldcInfo->ldc_stt_ln; +- stLdcCtl.ldc_h_center_pos = ldcInfo->ldc_h_center_pos; +- stLdcCtl.ldc_v_center_pos = ldcInfo->ldc_v_center_pos; +- stLdcCtl.ldc_rectify_cr = ldcInfo->ldc_rectify_cr; +- stLdcCtl.ldc_rectify_cz = ldcInfo->ldc_rectify_cz; +- Isp_Drv_F2k_Core_SetLdcCtl(isp,&stLdcCtl); ++ ISP_CORE_LDC_CTL_S stLdcCtl; ++ stLdcCtl.ldc_en = ldcInfo->ldc_en; ++ stLdcCtl.ldc_arith_en = ldcInfo->ldc_arith_en; ++ stLdcCtl.ldc_req_freq = ldcInfo->ldc_req_freq; ++ stLdcCtl.ldc_stt_ln = ldcInfo->ldc_stt_ln; ++ stLdcCtl.ldc_h_center_pos = ldcInfo->ldc_h_center_pos; ++ stLdcCtl.ldc_v_center_pos = ldcInfo->ldc_v_center_pos; ++ stLdcCtl.ldc_rectify_cr = ldcInfo->ldc_rectify_cr; ++ stLdcCtl.ldc_rectify_cz = ldcInfo->ldc_rectify_cz; ++ Isp_Drv_F2k_Core_SetLdcCtl(isp,&stLdcCtl); + return 0; + } + //AF + static int isp_f2k_core_SetAfCtl(struct k510_isp_device *isp,AF_INFO_S *afInfo) + { +- ISP_CORE_AF_CTL_S stAfCtl; ++ ISP_CORE_AF_CTL_S stAfCtl; + stAfCtl.af_stat_en = afInfo->af_stat_en; +- stAfCtl.af_stat_mode_sel= afInfo->af_stat_mode_sel; +- stAfCtl.af_stat_win_h_start= afInfo->af_win_size.h_start; +- stAfCtl.af_stat_win_v_start= afInfo->af_win_size.v_start; +- stAfCtl.af_stat_win_h_end= afInfo->af_win_size.h_end; +- stAfCtl.af_stat_win_v_end= afInfo->af_win_size.v_end; +- Isp_Drv_F2k_Core_SetAfCtl(isp,&stAfCtl); ++ stAfCtl.af_stat_mode_sel= afInfo->af_stat_mode_sel; ++ stAfCtl.af_stat_win_h_start= afInfo->af_win_size.h_start; ++ stAfCtl.af_stat_win_v_start= afInfo->af_win_size.v_start; ++ stAfCtl.af_stat_win_h_end= afInfo->af_win_size.h_end; ++ stAfCtl.af_stat_win_v_end= afInfo->af_win_size.v_end; ++ Isp_Drv_F2k_Core_SetAfCtl(isp,&stAfCtl); + return 0; + } + //3DNR FBC + static int isp_f2k_core_SetFbc(struct k510_isp_device *isp,FBC_INFO_S *fbcInfo) + { +- ISP_FBC_ATTR_S pstfbcAttr; ++ ISP_FBC_ATTR_S pstfbcAttr; + ISP_FBC_CTL_S *stIspFbcCtl = &pstfbcAttr.stIspfbcCtl; + stIspFbcCtl->fbc_out_format_cfg = fbcInfo->fbc_out_format_cfg; +- Isp_Drv_Fbc_SetCtl(isp,stIspFbcCtl); ++ Isp_Drv_Fbc_SetCtl(isp,stIspFbcCtl); + ISP_FBC_SIZE_S *stIspFbcSize = &pstfbcAttr.stIspfbcSize; + stIspFbcSize->fbc_input_width = fbcInfo->fbc_input_size.Width; + stIspFbcSize->fbc_input_height = fbcInfo->fbc_input_size.Height; +- Isp_Drv_Fbc_SetSize(isp,stIspFbcSize); +- ISP_FBC_BUF_S *stIspFbcBuf = &pstfbcAttr.stIspfbcBuf; ++ Isp_Drv_Fbc_SetSize(isp,stIspFbcSize); ++ ISP_FBC_BUF_S *stIspFbcBuf = &pstfbcAttr.stIspfbcBuf; + ISP_FBC_Y_BUF_S *stIspFbcYBuf = &stIspFbcBuf->stIspFbcYBuf; + FBCD_BUF_S *yDataBufInfo = &fbcInfo->yDataBufInfo; + stIspFbcYBuf->fbc_y_data_buf_base0 = yDataBufInfo->data_buf_base0; +@@ -1422,21 +1422,21 @@ static int isp_f2k_core_SetFbc(struct k510_isp_device *isp,FBC_INFO_S *fbcInfo) + stIspFbcUVBuf->fbc_uv_head_buf_base1 = uvHeadBufInfo->data_buf_base1; + stIspFbcUVBuf->fbc_uv_head_stride = uvHeadBufInfo->data_stride; + stIspFbcUVBuf->fbc_uv_head_wr_blen = uvHeadBufInfo->data_wr_blen; +- Isp_Drv_Fbc_SetBuf(isp,stIspFbcBuf); ++ Isp_Drv_Fbc_SetBuf(isp,stIspFbcBuf); + return 0; + } + //3DNR FBD + static int isp_f2k_core_SetFbd(struct k510_isp_device *isp,FBD_INFO_S *fbdInfo) + { +- ISP_FBD_ATTR_S pstIspFbdAttr; ++ ISP_FBD_ATTR_S pstIspFbdAttr; + ISP_FBD_CTL_S *stIspFbdCtl = &pstIspFbdAttr.stIspFbdCtl; + stIspFbdCtl->fbd_en = fbdInfo->fbd_en; + stIspFbdCtl->fbd_format_cfg = fbdInfo->fbd_format_cfg; +- Isp_Drv_Fbd_SetCtl(isp,stIspFbdCtl); ++ Isp_Drv_Fbd_SetCtl(isp,stIspFbdCtl); + ISP_FBD_SIZE_S *stIspFbdSize = &pstIspFbdAttr.stIspFbdSize; + stIspFbdSize->fbd_input_width = fbdInfo->fbd_input_size.Width; + stIspFbdSize->fbd_input_height = fbdInfo->fbd_input_size.Height; +- Isp_Drv_Fbd_SetSize(isp,stIspFbdSize); ++ Isp_Drv_Fbd_SetSize(isp,stIspFbdSize); + ISP_FBD_BUF_S *stIspFbdBuf = &pstIspFbdAttr.stIspFbdBuf; + ISP_FBD_Y_BUF_S *stIspFbdYBuf = &stIspFbdBuf->stIspFbdYBuf; + FBCD_BUF_S *yDataBufInfo = &fbdInfo->yDataBufInfo; +@@ -1465,7 +1465,7 @@ static int isp_f2k_core_SetFbd(struct k510_isp_device *isp,FBD_INFO_S *fbdInfo) + stIspFbdUVBuf->fbd_uv_head_buf_base0 = uvHeadBufInfo->data_buf_base0; + stIspFbdUVBuf->fbd_uv_head_buf_base1 = uvHeadBufInfo->data_buf_base1; + stIspFbdUVBuf->fbd_uv_head_stride = uvHeadBufInfo->data_stride; +- Isp_Drv_Fbd_SetBuf(isp,stIspFbdBuf); ++ Isp_Drv_Fbd_SetBuf(isp,stIspFbdBuf); + return 0; + } + // +@@ -1473,116 +1473,116 @@ static int isp_f2k_core_config(struct isp_f2k_device *f2k,struct isp_core_cfg_in + { + + struct k510_isp_device *isp = to_isp_device(f2k); +- //struct isp_core_cfg_info *isp_core_cfg =&isp_cfg->isp_core_cfg; +- // ++ //struct isp_core_cfg_info *isp_core_cfg =&isp_cfg->isp_core_cfg; ++ // + ITC_INFO_S *itcInfo = &isp_core_cfg->itcInfo; + isp_f2k_core_SetItc(isp,itcInfo); +- // ++ // + isp_f2k_core_SetImage(isp,itcInfo); +- // ++ // + TPG_INFO_S *tpgInfo = &isp_core_cfg->tpgInfo; + isp_f2k_core_SetTpgCtl(isp,tpgInfo); +- // ++ // + BLC_INFO_S *blcInfo = &isp_core_cfg->blcInfo; + isp_f2k_core_SetBlcCtl(isp,blcInfo); +- // ++ // + LSC_INFO_S *lscInfo = &isp_core_cfg->lscInfo; + isp_f2k_core_SetLscCtl(isp,lscInfo); +- // ++ // + AE_INFO_S *aeInfo = &isp_core_cfg->aeInfo; + isp_f2k_core_SetAeCtl(isp,aeInfo); + AWB_INFO_S *awbInfo = &isp_core_cfg->awbInfo; +- // ++ // + isp_f2k_core_SetAwbCtl(isp,awbInfo); +- // ++ // + struct isp_core_wdr_Info *wdrInfo = &isp_core_cfg->wdrInfo; + isp_f2k_core_SetWdrCtl(isp,wdrInfo); +- // ++ // + CSC_INFO_S *cscInfo = &isp_core_cfg->cscInfo; + isp_f2k_core_SetCscCtl(isp,cscInfo); +- // ++ // + ADA_INFO_S *adaInfo = &isp_core_cfg->adaInfo; + isp_f2k_core_SetAdaCtl(isp,adaInfo); + RGBIR_INFO_S *rgbirInfo = &isp_core_cfg->rgbirInfo; +- // ++ // + isp_f2k_core_SetRgbirCtl(isp,rgbirInfo); +- // ++ // + NR2D_INFO_S *nr2dInfo = &isp_core_cfg->nr2dInfo; + isp_f2k_core_Set2dnrCtl(isp,nr2dInfo); +- // ++ // + NR3D_INFO_S *nr3dInfo = &isp_core_cfg->nr3dInfo; + isp_f2k_core_Set3dnrCtl(isp,nr3dInfo); +- // ++ // + ENH_INFO_S *enhInfo= &isp_core_cfg->enhInfo; + isp_f2k_core_SetEnhCtl(isp,enhInfo); +- // ++ // + POST_INFO_S *postInfo= &isp_core_cfg->postInfo; + isp_f2k_core_SetPostCtl(isp,postInfo); +- // ++ // + OTC_INFO_S *otcInfo= &isp_core_cfg->otcInfo; + isp_f2k_core_SetOtcCtl(isp,otcInfo); +- // ++ // + LDC_INFO_S *ldcInfo= &isp_core_cfg->ldcInfo; + isp_f2k_core_SetLdcCtl(isp,ldcInfo); +- // ++ // + AF_INFO_S *afInfo= &isp_core_cfg->afInfo; + isp_f2k_core_SetAfCtl(isp,afInfo); +- // ++ // + FBC_INFO_S *fbcInfo = &isp_core_cfg->fbcInfo; + isp_f2k_core_SetFbc(isp,fbcInfo); +- // ++ // + FBD_INFO_S *fbdInfo = &isp_core_cfg->fbdInfo; + isp_f2k_core_SetFbd(isp,fbdInfo); +- return 0; ++ return 0; + } + /**************************************************************************************** + *ISP DS +-****************************************************************************************/ ++ ****************************************************************************************/ + static void isp_f2k_ds_calc_scale(IMAGE_SIZE *in_size,IMAGE_SIZE *ds_out_size,ISP_S_DS_ATTR_S *stDsAttr) + { +- unsigned int InputWidth = in_size->Width; +- unsigned int InputHeight = in_size->Height; +- unsigned int OutputWidth = ds_out_size->Width; +- unsigned int OutputHeight = ds_out_size->Height; ++ unsigned int InputWidth = in_size->Width; ++ unsigned int InputHeight = in_size->Height; ++ unsigned int OutputWidth = ds_out_size->Width; ++ unsigned int OutputHeight = ds_out_size->Height; + //printk("%s:InputWidth(%d),InputHeight(%d),OutputWidth(%d),OutputHeight(%d)\n",__func__,InputWidth,InputHeight,OutputWidth,OutputHeight); +- stDsAttr->hscalePram.hscale_pstep = (InputWidth / OutputWidth); +- stDsAttr->hscalePram.hscale_dstep = ((InputWidth % OutputWidth) * 65536 / OutputWidth); +- stDsAttr->vscalePram.vscale_pstep = (InputHeight / OutputHeight); +- stDsAttr->vscalePram.vscale_dstep = ((InputHeight % OutputHeight) * 65536 / OutputHeight); ++ stDsAttr->hscalePram.hscale_pstep = (InputWidth / OutputWidth); ++ stDsAttr->hscalePram.hscale_dstep = ((InputWidth % OutputWidth) * 65536 / OutputWidth); ++ stDsAttr->vscalePram.vscale_pstep = (InputHeight / OutputHeight); ++ stDsAttr->vscalePram.vscale_dstep = ((InputHeight % OutputHeight) * 65536 / OutputHeight); + //printk("%s:hscale_pstep(0x%x),hscale_dstep(0x%x),vscale_pstep(0x%x),vscale_dstep(0x%x)\n",__func__,stDsAttr->hscalePram.hscale_pstep,stDsAttr->hscalePram.hscale_dstep,stDsAttr->vscalePram.vscale_pstep,stDsAttr->vscalePram.vscale_dstep); +- return; ++ return; + } + // + void isp_f2k_ds_SetInputSize(struct k510_isp_device *isp,IMAGE_SIZE *dsInSizeInfo) + { +- IMAGE_SIZE inputsize; +- inputsize.Width = dsInSizeInfo->Width - 1; +- inputsize.Height = dsInSizeInfo->Height - 1; +- Isp_Drv_F2k_Ds_SetInputSize(isp,&inputsize); ++ IMAGE_SIZE inputsize; ++ inputsize.Width = dsInSizeInfo->Width - 1; ++ inputsize.Height = dsInSizeInfo->Height - 1; ++ Isp_Drv_F2k_Ds_SetInputSize(isp,&inputsize); + } + // + void isp_f2k_ds_SetRgb2YuvCoff(struct k510_isp_device *isp) + { +- unsigned int osd_rgb2yuv_coeff[3][4]; +- osd_rgb2yuv_coeff[0][0]= 0x00000132; +- osd_rgb2yuv_coeff[0][1]= 0x00000259; +- osd_rgb2yuv_coeff[0][2]= 0x00000075; +- osd_rgb2yuv_coeff[0][3]= 0x00000000; +- osd_rgb2yuv_coeff[1][0]= 0x00000f50; +- osd_rgb2yuv_coeff[1][1]= 0x00000ea5; +- osd_rgb2yuv_coeff[1][2]= 0x0000020b; +- osd_rgb2yuv_coeff[1][3]= 0x00000080; +- osd_rgb2yuv_coeff[2][0]= 0x0000020b; +- osd_rgb2yuv_coeff[2][1]= 0x00000e4a; +- osd_rgb2yuv_coeff[2][2]= 0x00000fab; +- osd_rgb2yuv_coeff[2][3]= 0x00000080; +- Isp_Drv_F2k_Ds_SetRgb2YuvCoff(isp,&osd_rgb2yuv_coeff[0][0]); ++ unsigned int osd_rgb2yuv_coeff[3][4]; ++ osd_rgb2yuv_coeff[0][0]= 0x00000132; ++ osd_rgb2yuv_coeff[0][1]= 0x00000259; ++ osd_rgb2yuv_coeff[0][2]= 0x00000075; ++ osd_rgb2yuv_coeff[0][3]= 0x00000000; ++ osd_rgb2yuv_coeff[1][0]= 0x00000f50; ++ osd_rgb2yuv_coeff[1][1]= 0x00000ea5; ++ osd_rgb2yuv_coeff[1][2]= 0x0000020b; ++ osd_rgb2yuv_coeff[1][3]= 0x00000080; ++ osd_rgb2yuv_coeff[2][0]= 0x0000020b; ++ osd_rgb2yuv_coeff[2][1]= 0x00000e4a; ++ osd_rgb2yuv_coeff[2][2]= 0x00000fab; ++ osd_rgb2yuv_coeff[2][3]= 0x00000080; ++ Isp_Drv_F2k_Ds_SetRgb2YuvCoff(isp,&osd_rgb2yuv_coeff[0][0]); + } + // + void isp_f2k_ds_SetYuv2RgbCoff(struct k510_isp_device *isp) + { +- unsigned int osd_yuv2rgb_coeff[3][4]; +- osd_yuv2rgb_coeff[0][0] = 0x00000400; ++ unsigned int osd_yuv2rgb_coeff[3][4]; ++ osd_yuv2rgb_coeff[0][0] = 0x00000400; + osd_yuv2rgb_coeff[0][1] = 0x00000000; + osd_yuv2rgb_coeff[0][2] = 0x000005a1; + osd_yuv2rgb_coeff[0][3] = 0x00000f4c; +@@ -1594,19 +1594,19 @@ void isp_f2k_ds_SetYuv2RgbCoff(struct k510_isp_device *isp) + osd_yuv2rgb_coeff[2][1] = 0x0000071e; + osd_yuv2rgb_coeff[2][2] = 0x00000000; + osd_yuv2rgb_coeff[2][3] = 0x00000f1c; +- Isp_Drv_F2k_Ds_SetYuv2RgbCoff(isp,&osd_yuv2rgb_coeff[0][0]); ++ Isp_Drv_F2k_Ds_SetYuv2RgbCoff(isp,&osd_yuv2rgb_coeff[0][0]); + } + // + void isp_f2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + { +- ISP_DS_OSD_INFO_S *stOsdInfo = &stDsOsdAttr->OsdInfo; ++ ISP_DS_OSD_INFO_S *stOsdInfo = &stDsOsdAttr->OsdInfo; + stOsdInfo->osd_enable = osdInfo->osd_enable; + stOsdInfo->osd_type = osdInfo->osd_type; + stOsdInfo->osd_alpha_tpye = osdInfo->osd_alpha_tpye; +- IMAGE_SIZE *stOsdSize = &stDsOsdAttr->OsdSize; ++ IMAGE_SIZE *stOsdSize = &stDsOsdAttr->OsdSize; + stOsdSize->Width = osdInfo->osd_size.Width; + stOsdSize->Height = osdInfo->osd_size.Height; +- ISP_DS_OSD_BUF_S *stOsdBuf = &stDsOsdAttr->OsdBuf; ++ ISP_DS_OSD_BUF_S *stOsdBuf = &stDsOsdAttr->OsdBuf; + stOsdBuf->osd_rgb_addr0 = osdInfo->osd_rgb_addr[0]; + stOsdBuf->osd_rgb_addr1 = osdInfo->osd_rgb_addr[1]; + stOsdBuf->osd_stride = osdInfo->osd_stride; +@@ -1617,7 +1617,7 @@ void isp_f2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + stOsdBuf->osd_position_stop_x = osdInfo->osd_position_win.h_end; + stOsdBuf->osd_position_start_y =osdInfo->osd_position_win.v_start; + stOsdBuf->osd_position_stop_y = osdInfo->osd_position_win.v_end; +- ISP_DS_OSD_DMA_CTL_S *stOsdDmaCtl = &stDsOsdAttr->OsdDmaCtl; ++ ISP_DS_OSD_DMA_CTL_S *stOsdDmaCtl = &stDsOsdAttr->OsdDmaCtl; + stOsdDmaCtl->osd_bd_limit_en = osdInfo->osd_bd_limit_en; + stOsdDmaCtl->osd_dma_map = osdInfo->osd_dma_map; + stOsdDmaCtl->osd_dma_request_length = osdInfo->osd_dma_request_length; +@@ -1625,85 +1625,85 @@ void isp_f2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + stOsdDmaCtl->osd_outstanding_num = osdInfo->osd_outstanding_num; + stOsdDmaCtl->osd_rgb_rev = osdInfo->osd_rgb_rev; + stOsdDmaCtl->osd_swap_64 = osdInfo->osd_swap_64; +- return; ++ return; + } + // + void isp_f2k_ds_SetSingleDS(struct k510_isp_device *isp,unsigned int u8Index,struct isp_ds_cfg_info *isp_ds_cfg) + { +- IMAGE_SIZE in_size; +- in_size.Width = isp_ds_cfg->dsInSizeInfo.Width; +- in_size.Height = isp_ds_cfg->dsInSizeInfo.Height; +- ISP_S_DS_ATTR_S stDsAttr; +- IMAGE_SIZE *dsOutSize = &stDsAttr.dsOutSize; +- ISP_DS_INFO_S *dsInfo = &isp_ds_cfg->dsInfo[u8Index]; +- dsOutSize->Width = dsInfo->ds_out_size.Width - 1; +- dsOutSize->Height = dsInfo->ds_out_size.Height - 1; +- isp_f2k_ds_calc_scale(&in_size,&dsInfo->ds_out_size,&stDsAttr); +- stDsAttr.vscalePram.scale_en = dsInfo->scale_en; +- stDsAttr.vscalePram.vscale_filter_en = dsInfo->vscale_filter_en; +- stDsAttr.hscalePram.hscale_filter_en = dsInfo->hscale_filter_en; +- ISP_DS_FORMAT_S *stDsFormat = &stDsAttr.DsFormat; +- stDsFormat->out_rgb_en = dsInfo->out_rgb_en; +- stDsFormat->out_rgb_mode = dsInfo->out_rgb_mode; +- stDsFormat->out_yuv_mode = dsInfo->out_yuv_mode; +- stDsFormat->out_uv_swap = dsInfo->out_uv_swap; +- unsigned int osdIndex = 0; +- ISP_DS_OSD_ATTR_S *stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- ISP_OSD_INFO_S *osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- osdIndex = 1; +- stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- osdIndex = 2; +- stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- Isp_Drv_F2k_Ds_SetSingleDS(isp,u8Index,&stDsAttr); +- return; ++ IMAGE_SIZE in_size; ++ in_size.Width = isp_ds_cfg->dsInSizeInfo.Width; ++ in_size.Height = isp_ds_cfg->dsInSizeInfo.Height; ++ ISP_S_DS_ATTR_S stDsAttr; ++ IMAGE_SIZE *dsOutSize = &stDsAttr.dsOutSize; ++ ISP_DS_INFO_S *dsInfo = &isp_ds_cfg->dsInfo[u8Index]; ++ dsOutSize->Width = dsInfo->ds_out_size.Width - 1; ++ dsOutSize->Height = dsInfo->ds_out_size.Height - 1; ++ isp_f2k_ds_calc_scale(&in_size,&dsInfo->ds_out_size,&stDsAttr); ++ stDsAttr.vscalePram.scale_en = dsInfo->scale_en; ++ stDsAttr.vscalePram.vscale_filter_en = dsInfo->vscale_filter_en; ++ stDsAttr.hscalePram.hscale_filter_en = dsInfo->hscale_filter_en; ++ ISP_DS_FORMAT_S *stDsFormat = &stDsAttr.DsFormat; ++ stDsFormat->out_rgb_en = dsInfo->out_rgb_en; ++ stDsFormat->out_rgb_mode = dsInfo->out_rgb_mode; ++ stDsFormat->out_yuv_mode = dsInfo->out_yuv_mode; ++ stDsFormat->out_uv_swap = dsInfo->out_uv_swap; ++ unsigned int osdIndex = 0; ++ ISP_DS_OSD_ATTR_S *stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ ISP_OSD_INFO_S *osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ osdIndex = 1; ++ stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ osdIndex = 2; ++ stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_f2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ Isp_Drv_F2k_Ds_SetSingleDS(isp,u8Index,&stDsAttr); ++ return; + } + // + static int isp_f2k_ds_config(struct isp_f2k_device *f2k,struct isp_ds_cfg_info *isp_ds_cfg) + { + struct k510_isp_device *isp = to_isp_device(f2k); +- // +- Isp_Drv_F2k_Ds_SetscaleCoeff(isp); +- // +- IMAGE_SIZE *dsInSizeInfo = &isp_ds_cfg->dsInSizeInfo; +- isp_f2k_ds_SetInputSize(isp,dsInSizeInfo); +- // +- isp_f2k_ds_SetRgb2YuvCoff(isp); +- // +- isp_f2k_ds_SetYuv2RgbCoff(isp); +- // +- unsigned int u8Index = 0; +- isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- // +- u8Index = 1; +- isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- // +- u8Index = 2; +- isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- +- return 0; ++ // ++ Isp_Drv_F2k_Ds_SetscaleCoeff(isp); ++ // ++ IMAGE_SIZE *dsInSizeInfo = &isp_ds_cfg->dsInSizeInfo; ++ isp_f2k_ds_SetInputSize(isp,dsInSizeInfo); ++ // ++ isp_f2k_ds_SetRgb2YuvCoff(isp); ++ // ++ isp_f2k_ds_SetYuv2RgbCoff(isp); ++ // ++ unsigned int u8Index = 0; ++ isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ // ++ u8Index = 1; ++ isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ // ++ u8Index = 2; ++ isp_f2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ ++ return 0; + } + /**************************************************************************** +-* +-*****************************************************************************/ ++ * ++ *****************************************************************************/ + void isp_f2k_config(struct k510_isp_device *isp,struct isp_cfg_info *isp_cfg) + { +- struct isp_f2k_device *f2k = &isp->isp_f2k; ++ struct isp_f2k_device *f2k = &isp->isp_f2k; + struct isp_wrap_cfg_info *isp_wrap_cfg = &isp_cfg->isp_wrap_cfg; + struct isp_core_cfg_info *isp_core_cfg = &isp_cfg->isp_core_cfg; + struct isp_ds_cfg_info *isp_ds_cfg =&isp_cfg->isp_ds_cfg; + struct isp_nr3d_dma nr3d_dma_old,nr3d_dma_new; +- dev_dbg(isp->dev,"%s:start\n",__func__); ++ dev_dbg(isp->dev,"%s:start\n",__func__); + if( 1 == isp_wrap_cfg->nr3dInfo.nr3d_en ) + { + nr3d_dma_new.dma_size = 2048*2048*20/8; + nr3d_dma_new.addr = dma_alloc_coherent(isp->dev, nr3d_dma_new.dma_size, +- &nr3d_dma_new.dma, +- GFP_KERNEL); ++ &nr3d_dma_new.dma, ++ GFP_KERNEL); + if (nr3d_dma_new.addr == NULL) + return -ENOMEM; + +@@ -1712,7 +1712,7 @@ void isp_f2k_config(struct k510_isp_device *isp,struct isp_cfg_info *isp_cfg) + + if (nr3d_dma_old.addr != NULL) + dma_free_coherent(isp->dev,nr3d_dma_new.dma_size, +- nr3d_dma_old.addr, nr3d_dma_old.dma); ++ nr3d_dma_old.addr, nr3d_dma_old.dma); + // + isp_wrap_cfg->nr3dInfo.nr3d_y_line_stride = (isp_core_cfg->itcInfo.itc_size.Width + 15)/16*16*12/8;//0xb40; + isp_wrap_cfg->nr3dInfo.nr3d_uv_line_stride = (isp_core_cfg->itcInfo.itc_size.Width + 15)/16*16;//0x780; +@@ -1720,15 +1720,15 @@ void isp_f2k_config(struct k510_isp_device *isp,struct isp_cfg_info *isp_cfg) + isp_wrap_cfg->nr3dInfo.nr3d_uv_buf_base = nr3d_dma_new.dma + isp_wrap_cfg->nr3dInfo.nr3d_y_line_stride * isp_core_cfg->itcInfo.itc_size.Height; + } + // +- isp_f2k_core_config(f2k,isp_core_cfg); ++ isp_f2k_core_config(f2k,isp_core_cfg); + // +- isp_f2k_ds_config(f2k,isp_ds_cfg); ++ isp_f2k_ds_config(f2k,isp_ds_cfg); + // + dev_dbg(isp->dev,"%s:main_y_buf0_base(0x%x)\n",__func__,isp_wrap_cfg->mainInfo.main_y_buf0_base); +- isp_f2k_wrap_config(f2k,isp_wrap_cfg); ++ isp_f2k_wrap_config(f2k,isp_wrap_cfg); + +- //printk("isp_f2k_config end \n"); +- return 0; ++ //printk("isp_f2k_config end \n"); ++ return 0; + } + + /* +@@ -1791,14 +1791,14 @@ static void isp_f2k_set_out0_outaddr(struct isp_f2k_device *f2k, u32 addr) + if((f2k->pingpong[DS0_VIDEO]%2) == 0) + { + isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_Y_BUF0_BASE); +- addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; +- isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); ++ addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; ++ isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); + } + else if((f2k->pingpong[DS0_VIDEO]%2) == 1) + { + isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_Y_BUF1_BASE); + addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; +- isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); ++ isp_reg_writel(isp,addr,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); + } + f2k->pingpong[DS0_VIDEO]++; + isp_reg_writel(isp,0x30001,ISP_IOMEM_F2K_WRAP,ISP_WRAP_CONFIG_DONE); //fix split screen +@@ -1882,8 +1882,8 @@ static void isp_f2k_enable(struct isp_f2k_device *f2k) + */ + #define ISP_F2K_WRAP_PRINT_REGISTER(isp, name)\ + dev_info(isp->dev, "###WRAP: " #name"(0x%x) = 0x%x\n", \ +- isp->mmio_base[ISP_IOMEM_F2K_WRAP] + name-isp->isp_regs+isp->isp_addr,\ +- isp_reg_readl(isp, ISP_IOMEM_F2K_WRAP, name)) ++ isp->mmio_base[ISP_IOMEM_F2K_WRAP] + name-isp->isp_regs+isp->isp_addr,\ ++ isp_reg_readl(isp, ISP_IOMEM_F2K_WRAP, name)) + + + static void isp_f2k_wrap_print_status(struct isp_f2k_device *f2k) +@@ -2020,15 +2020,15 @@ static void isp_f2k_wrap_print_status(struct isp_f2k_device *f2k) + dev_info(isp->dev, "-------------ISP F2K WRAP Register dump end----------\n"); + } + /*----------------------------------------------------------------------------- +-*CORE +------------------------------------------------------------------------------*/ ++ *CORE ++ -----------------------------------------------------------------------------*/ + /* + * isp_f2k_core_print_status - Prints the values of the isp f2k core module registers. + */ + #define ISP_F2K_CORE_PRINT_REGISTER(isp, name)\ + dev_info(isp->dev, "###CORE:" #name "(0x%x) = 0x%x\n", \ +- isp->mmio_base[ISP_IOMEM_F2K_CORE] + name-isp->isp_regs+isp->isp_addr,\ +- isp_reg_readl(isp, ISP_IOMEM_F2K_CORE, name)) ++ isp->mmio_base[ISP_IOMEM_F2K_CORE] + name-isp->isp_regs+isp->isp_addr,\ ++ isp_reg_readl(isp, ISP_IOMEM_F2K_CORE, name)) + + + static void isp_f2k_core_print_status(struct isp_f2k_device *f2k) +@@ -2241,15 +2241,15 @@ static void isp_f2k_core_print_status(struct isp_f2k_device *f2k) + dev_info(isp->dev, "-------------ISP F2K CORE Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*DS +---------------------------------------------------------------------------*/ ++ *DS ++ --------------------------------------------------------------------------*/ + /* + * isp_f2k_ds_print_status - Prints the values of the isp f2k ds module registers. + */ + #define ISP_F2K_DS_PRINT_REGISTER(isp, name)\ + dev_info(isp->dev, "###DS: " #name "(0x%x) = 0x%x\n", \ +- isp->mmio_base[ISP_IOMEM_F2K_DS] + name-isp->isp_regs+isp->isp_addr,\ +- isp_reg_readl(isp, ISP_IOMEM_F2K_DS, name)) ++ isp->mmio_base[ISP_IOMEM_F2K_DS] + name-isp->isp_regs+isp->isp_addr,\ ++ isp_reg_readl(isp, ISP_IOMEM_F2K_DS, name)) + + + static void isp_f2k_ds_print_status(struct isp_f2k_device *f2k) +@@ -2402,14 +2402,14 @@ static void isp_f2k_ds_print_status(struct isp_f2k_device *f2k) + dev_info(isp->dev, "-------------isp f2k ds Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*3DNR FBC +---------------------------------------------------------------------------*/ ++ *3DNR FBC ++ --------------------------------------------------------------------------*/ + /* + * isp_3dnr_mfbc_print_status - Prints the values of the isp 3dnr mfbc module registers. + */ + #define ISP_3DNR_MFBC_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###3DNR_FBC: " #name "= 0x%x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_F2K_FBC, name)) ++ isp_reg_readl(isp, ISP_IOMEM_F2K_FBC, name)) + + + static void isp_3dnr_mfbc_print_status(struct isp_f2k_device *f2k) +@@ -2450,17 +2450,17 @@ static void isp_3dnr_mfbc_print_status(struct isp_f2k_device *f2k) + ISP_3DNR_MFBC_PRINT_REGISTER(isp,ISP_FBC_YL_HEAD_LINE_STRIDE ); + ISP_3DNR_MFBC_PRINT_REGISTER(isp,ISP_FBC_YL_HEAD_WR_BLEN ); + +- dev_dbg(isp->dev, "-------------ISP 3DNR MFBC Register dump end----------\n"); ++ dev_dbg(isp->dev, "-------------ISP 3DNR MFBC Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*3DNR MFBD +---------------------------------------------------------------------------*/ ++ *3DNR MFBD ++ --------------------------------------------------------------------------*/ + /* + * isp_3dnr_mfbd_print_status - Prints the values of the 3dnr mfbd module registers. + */ + #define ISP_3DNR_MFBD_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###3DNR_FBD: " #name "= 0x%x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_F2K_FBD, name)) ++ isp_reg_readl(isp, ISP_IOMEM_F2K_FBD, name)) + + + static void isp_3dnr_mfbd_print_status(struct isp_f2k_device *f2k) +@@ -2490,11 +2490,11 @@ static void isp_3dnr_mfbd_print_status(struct isp_f2k_device *f2k) + ISP_3DNR_MFBD_PRINT_REGISTER(isp,ISP_FBD_YL_HEAD_BUF_BASE1 ); + ISP_3DNR_MFBD_PRINT_REGISTER(isp,ISP_FBD_YL_HEAD_LINE_STRIDE ); + +- dev_dbg(isp->dev, "-------------ISP 3DNR MFBD Register dump end----------\n"); ++ dev_dbg(isp->dev, "-------------ISP 3DNR MFBD Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*REMAP +---------------------------------------------------------------------------*/ ++ *REMAP ++ --------------------------------------------------------------------------*/ + static int isp_f2k_remap_main_config(struct isp_f2k_device *f2k,struct isp_remap_cfg_info *isp_remap_cfg) + { + struct k510_isp_device *isp = to_isp_device(f2k); +@@ -2581,18 +2581,18 @@ static int isp_f2k_remap_out1_config(struct isp_f2k_device *f2k,struct isp_remap + */ + #define ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###MAIN_REMAP: " #name "= 0x%x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_F2K_MAIN_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_F2K_MAIN_REMAP, name)) + #define ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###OUT0_REMAP: " #name "= 0x%x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_F2K_OUT0_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_F2K_OUT0_REMAP, name)) + #define ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###OUT1_REMAP:" #name "= 0x%x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_F2K_OUT1_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_F2K_OUT1_REMAP, name)) + + static void isp_f2k_remap_print_status(struct isp_f2k_device *f2k) + { + struct k510_isp_device *isp = to_isp_device(f2k); +- // ++ // + dev_dbg(isp->dev, "-------------ISP F2K MAIN REMAP Register dump start----------\n"); + ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); +@@ -2691,10 +2691,10 @@ static void isp_f2k_remap_print_status(struct isp_f2k_device *f2k) + ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_F2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP F2K MAIN REMAP Register dump end----------\n"); +- // ++ dev_dbg(isp->dev, "-------------ISP F2K MAIN REMAP Register dump end----------\n"); ++ // + dev_dbg(isp->dev, "-------------ISP F2K OUT0 REMAP Register dump start----------\n"); +- ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); ++ ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_01_0_CTRL); + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_01_1_CTRL); +@@ -2791,8 +2791,8 @@ static void isp_f2k_remap_print_status(struct isp_f2k_device *f2k) + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_F2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP F2K OUT0 REMAP Register dump end----------\n"); +- // ++ dev_dbg(isp->dev, "-------------ISP F2K OUT0 REMAP Register dump end----------\n"); ++ // + dev_dbg(isp->dev, "-------------ISP F2K OUT1 REMAP Register dump start----------\n"); + ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); +@@ -2891,14 +2891,14 @@ static void isp_f2k_remap_print_status(struct isp_f2k_device *f2k) + ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_F2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP F2K OUT1 REMAP Register dump end----------\n"); ++ dev_dbg(isp->dev, "-------------ISP F2K OUT1 REMAP Register dump end----------\n"); + } + /* ----------------------------------------------------------------------------- + * Interrupt handling + -----------------------------------------------------------------------------*/ + static void video_buffer_next(struct isp_f2k_device *f2k, enum video_type dsNum) + { +- struct k510isp_video *video = &f2k->video_out[dsNum]; ++ struct k510isp_video *video = &f2k->video_out[dsNum]; + struct k510isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); + enum vb2_buffer_state vb_state; + struct k510isp_buffer *buf, *next_buf; +@@ -2913,7 +2913,7 @@ static void video_buffer_next(struct isp_f2k_device *f2k, enum video_type dsNum) + spin_unlock_irqrestore(&video->irqlock, flags); + if(isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en == 0 && dsNum == DS0_VIDEO) + { +- return; ++ return; + } + f2k->profile[dsNum].no_buf_drop_cnt++; + return; +@@ -2923,7 +2923,7 @@ static void video_buffer_next(struct isp_f2k_device *f2k, enum video_type dsNum) + spin_unlock_irqrestore(&video->irqlock, flags); + if(isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en == 0 && dsNum == DS0_VIDEO) + { +- return; ++ return; + } + f2k->profile[dsNum].no_buf_drop_cnt++; + return; +@@ -2931,72 +2931,73 @@ static void video_buffer_next(struct isp_f2k_device *f2k, enum video_type dsNum) + + buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); + +- if(f2k->profile[dsNum].drop_threshold > 0LL) ++ if ((f2k->profile[dsNum].drop_threshold > 0LL) ++ && (dsNum == DS0_VIDEO || dsNum == DS1_VIDEO)) + { +- if(f2k->profile[dsNum].cur_int_interval > f2k->profile[dsNum].drop_threshold || +- f2k->profile[dsNum].cur_int_interval < f2k->profile[dsNum].drop_threshold/2) +- { +- drop = 1; +- f2k->profile[dsNum].drop_cnt++; +- spin_unlock_irqrestore(&video->irqlock, flags); +- return; +- } ++ if(f2k->profile[dsNum].cur_int_interval > f2k->profile[dsNum].drop_threshold || ++ f2k->profile[dsNum].cur_int_interval < f2k->profile[dsNum].drop_threshold/2) ++ { ++ drop = 1; ++ f2k->profile[dsNum].drop_cnt++; ++ spin_unlock_irqrestore(&video->irqlock, flags); ++ return; ++ } + } + + if(drop) + { +- next_buf = buf; ++ next_buf = buf; + } +- else +- { +- list_del(&buf->irqlist); +- next_buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); +- } +- +- if(next_buf != NULL) +- { +- if(dsNum == MAIN_VIDEO) +- isp_f2k_set_main_outaddr(f2k, next_buf->dma); +- else if(dsNum == DS0_VIDEO) +- isp_f2k_set_out0_outaddr(f2k, next_buf->dma); +- else if(dsNum == DS1_VIDEO) +- isp_f2k_set_out1_outaddr(f2k, next_buf->dma); +- else if(dsNum == DS2_VIDEO) +- isp_f2k_set_out2_outaddr(f2k, next_buf->dma); ++ else ++ { ++ list_del(&buf->irqlist); ++ next_buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); ++ } ++ ++ if(next_buf != NULL) ++ { ++ if(dsNum == MAIN_VIDEO) ++ isp_f2k_set_main_outaddr(f2k, next_buf->dma); ++ else if(dsNum == DS0_VIDEO) ++ isp_f2k_set_out0_outaddr(f2k, next_buf->dma); ++ else if(dsNum == DS1_VIDEO) ++ isp_f2k_set_out1_outaddr(f2k, next_buf->dma); ++ else if(dsNum == DS2_VIDEO) ++ isp_f2k_set_out2_outaddr(f2k, next_buf->dma); + } + + spin_unlock_irqrestore(&video->irqlock, flags); + + if(!drop) +- { +- buf->vb.vb2_buf.timestamp = ktime_get_ns(); +- +- /* Do frame number propagation only if this is the output video node. +- * Frame number either comes from the CSI receivers or it gets +- * incremented here if H3A is not active. +- * Note: There is no guarantee that the output buffer will finish +- * first, so the input number might lag behind by 1 in some cases. +- */ +- if (video == pipe->output && !pipe->do_propagation) +- buf->vb.sequence = +- atomic_inc_return(&pipe->frame_number); +- else +- buf->vb.sequence = atomic_read(&pipe->frame_number); +- +- if (pipe->field != V4L2_FIELD_NONE) +- buf->vb.sequence /= 2; +- +- buf->vb.field = pipe->field; +- +- /* Report pipeline errors to userspace on the capture device side. */ +- if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { +- vb_state = VB2_BUF_STATE_ERROR; +- pipe->error = false; +- } else { +- vb_state = VB2_BUF_STATE_DONE; +- } +- +- vb2_buffer_done(&buf->vb.vb2_buf, vb_state); ++ { ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); ++ ++ /* Do frame number propagation only if this is the output video node. ++ * Frame number either comes from the CSI receivers or it gets ++ * incremented here if H3A is not active. ++ * Note: There is no guarantee that the output buffer will finish ++ * first, so the input number might lag behind by 1 in some cases. ++ */ ++ if (video == pipe->output && !pipe->do_propagation) ++ buf->vb.sequence = ++ atomic_inc_return(&pipe->frame_number); ++ else ++ buf->vb.sequence = atomic_read(&pipe->frame_number); ++ ++ if (pipe->field != V4L2_FIELD_NONE) ++ buf->vb.sequence /= 2; ++ ++ buf->vb.field = pipe->field; ++ ++ /* Report pipeline errors to userspace on the capture device side. */ ++ if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { ++ vb_state = VB2_BUF_STATE_ERROR; ++ pipe->error = false; ++ } else { ++ vb_state = VB2_BUF_STATE_DONE; ++ } ++ ++ vb2_buffer_done(&buf->vb.vb2_buf, vb_state); + } + + spin_lock_irqsave(&video->irqlock, flags); +@@ -3008,10 +3009,10 @@ static void video_buffer_next(struct isp_f2k_device *f2k, enum video_type dsNum) + + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + state = ISP_PIPELINE_QUEUE_OUTPUT +- | ISP_PIPELINE_STREAM; ++ | ISP_PIPELINE_STREAM; + else + state = ISP_PIPELINE_QUEUE_INPUT +- | ISP_PIPELINE_STREAM; ++ | ISP_PIPELINE_STREAM; + + spin_lock_irqsave(&pipe->lock, flags); + pipe->state &= ~state; +@@ -3307,82 +3308,82 @@ static long f2k_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) + struct isp_ds_cfg_info *isp_ds_cfg = &f2k->isp_cfg.isp_ds_cfg; + + switch (cmd) { +- case VIDIOC_K510ISP_F2K_WRAP_CFG: +- mutex_lock(&f2k->ioctl_lock); +- //ret = isp_f2k_wrap_config(f2k, arg); +- memcpy(isp_wrap_cfg,arg,sizeof(struct isp_wrap_cfg_info)); +- //dev_dbg(f2k->isp->dev,"%s:main_y_buf0_base(0x%x)\n",__func__,isp_wrap_cfg->mainInfo.main_y_buf0_base); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_CORE_CFG: +- mutex_lock(&f2k->ioctl_lock); +- memcpy((void*)isp_core_cfg,arg,sizeof(struct isp_core_cfg_info)); +- ret = isp_f2k_core_config(f2k, arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_DS_CFG: +- mutex_lock(&f2k->ioctl_lock); +- //ret = isp_f2k_ds_config(f2k, arg); +- memcpy((void*)isp_ds_cfg,arg,sizeof(struct isp_ds_cfg_info)); +- +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_REMAP_MAIN_CFG: +- mutex_lock(&f2k->ioctl_lock); +- ret = isp_f2k_remap_main_config(f2k, arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_REMAP_OUT0_CFG: +- mutex_lock(&f2k->ioctl_lock); +- ret = isp_f2k_remap_out0_config(f2k, arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_REMAP_OUT1_CFG: +- mutex_lock(&f2k->ioctl_lock); +- ret = isp_f2k_remap_out1_config(f2k, arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_AE_STAT_REQ: +- mutex_lock(&f2k->ioctl_lock); +- isp_f2k_core_GetAeSts(f2k->isp,arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_CFG_SET: +- mutex_lock(&f2k->ioctl_lock); +- isp_f2k_config(f2k->isp,&f2k->isp_cfg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_CORE_CFG_GET: +- mutex_lock(&f2k->ioctl_lock); +- +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_SYSCTL_RST_F2K: +- mutex_lock(&f2k->ioctl_lock); +- reset_control_reset(f2k->isp->reset[ISP_F2K_RST]); +- reset_control_reset(f2k->isp->reset[FBC_RST]); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_CORE_REG_SET: +- mutex_lock(&f2k->ioctl_lock); +- isp_f2k_core_RegSet(f2k->isp,arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_F2K_CORE_REG_GET: +- mutex_lock(&f2k->ioctl_lock); +- isp_f2k_core_RegGet(f2k->isp,arg); +- mutex_unlock(&f2k->ioctl_lock); +- break; +- default: +- dev_err(f2k->isp->dev,"%s:cmd(0x%x) err!\n",__func__,cmd); +- return -ENOIOCTLCMD; ++ case VIDIOC_K510ISP_F2K_WRAP_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ //ret = isp_f2k_wrap_config(f2k, arg); ++ memcpy(isp_wrap_cfg,arg,sizeof(struct isp_wrap_cfg_info)); ++ //dev_dbg(f2k->isp->dev,"%s:main_y_buf0_base(0x%x)\n",__func__,isp_wrap_cfg->mainInfo.main_y_buf0_base); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_CORE_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ memcpy((void*)isp_core_cfg,arg,sizeof(struct isp_core_cfg_info)); ++ ret = isp_f2k_core_config(f2k, arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_DS_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ //ret = isp_f2k_ds_config(f2k, arg); ++ memcpy((void*)isp_ds_cfg,arg,sizeof(struct isp_ds_cfg_info)); ++ ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_REMAP_MAIN_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ ret = isp_f2k_remap_main_config(f2k, arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_REMAP_OUT0_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ ret = isp_f2k_remap_out0_config(f2k, arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_REMAP_OUT1_CFG: ++ mutex_lock(&f2k->ioctl_lock); ++ ret = isp_f2k_remap_out1_config(f2k, arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_AE_STAT_REQ: ++ mutex_lock(&f2k->ioctl_lock); ++ isp_f2k_core_GetAeSts(f2k->isp,arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_CFG_SET: ++ mutex_lock(&f2k->ioctl_lock); ++ isp_f2k_config(f2k->isp,&f2k->isp_cfg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_CORE_CFG_GET: ++ mutex_lock(&f2k->ioctl_lock); ++ ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_SYSCTL_RST_F2K: ++ mutex_lock(&f2k->ioctl_lock); ++ reset_control_reset(f2k->isp->reset[ISP_F2K_RST]); ++ reset_control_reset(f2k->isp->reset[FBC_RST]); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_CORE_REG_SET: ++ mutex_lock(&f2k->ioctl_lock); ++ isp_f2k_core_RegSet(f2k->isp,arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_F2K_CORE_REG_GET: ++ mutex_lock(&f2k->ioctl_lock); ++ isp_f2k_core_RegGet(f2k->isp,arg); ++ mutex_unlock(&f2k->ioctl_lock); ++ break; ++ default: ++ dev_err(f2k->isp->dev,"%s:cmd(0x%x) err!\n",__func__,cmd); ++ return -ENOIOCTLCMD; + } + + return 0; + } + + static int f2k_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, +- struct v4l2_event_subscription *sub) ++ struct v4l2_event_subscription *sub) + { + if (sub->type != V4L2_EVENT_FRAME_SYNC) + return -EINVAL; +@@ -3395,7 +3396,7 @@ static int f2k_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, + } + + static int f2k_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, +- struct v4l2_event_subscription *sub) ++ struct v4l2_event_subscription *sub) + { + return v4l2_event_unsubscribe(fh, sub); + } +@@ -3415,7 +3416,7 @@ static int f2k_set_stream(struct v4l2_subdev *sd, int enable) + struct k510_isp_device *isp = to_isp_device(f2k); + struct device *dev = to_device(f2k); + struct isp_cfg_info *isp_cfg = &f2k->isp_cfg; +- struct isp_irq_info irq_info; ++ struct isp_irq_info irq_info; + int ret; + int i; + int ds_en[VIDEO_NUM_MAX]; +@@ -3436,77 +3437,77 @@ static int f2k_set_stream(struct v4l2_subdev *sd, int enable) + } + + switch (enable) { +- case ISP_PIPELINE_STREAM_CONTINUOUS: +- mutex_lock(&f2k->ioctl_lock); +- isp_f2k_config(isp,isp_cfg); +- mutex_unlock(&f2k->ioctl_lock); +- dev_dbg(f2k->isp->dev,"%s:main_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.mainInfo.main_out_en); +- dev_dbg(f2k->isp->dev,"%s:ds0_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en); +- dev_dbg(f2k->isp->dev,"%s:ds1_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en); +- dev_dbg(f2k->isp->dev,"%s:ds2_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en); +- memset(&irq_info,0,sizeof(struct isp_irq_info)); +- irq_info.main_dma_en = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; +- irq_info.ds0_en = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; +- irq_info.ds1_en = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; +- irq_info.ds2_en = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; ++ case ISP_PIPELINE_STREAM_CONTINUOUS: ++ mutex_lock(&f2k->ioctl_lock); ++ isp_f2k_config(isp,isp_cfg); ++ mutex_unlock(&f2k->ioctl_lock); ++ dev_dbg(f2k->isp->dev,"%s:main_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.mainInfo.main_out_en); ++ dev_dbg(f2k->isp->dev,"%s:ds0_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en); ++ dev_dbg(f2k->isp->dev,"%s:ds1_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en); ++ dev_dbg(f2k->isp->dev,"%s:ds2_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en); ++ memset(&irq_info,0,sizeof(struct isp_irq_info)); ++ irq_info.main_dma_en = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; ++ irq_info.ds0_en = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; ++ irq_info.ds1_en = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; ++ irq_info.ds2_en = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; + #if 1 +- irq_info.ae_en = 1; +- irq_info.awb_en = 1; +- irq_info.af_en = 1; ++ irq_info.ae_en = 1; ++ irq_info.awb_en = 1; ++ irq_info.af_en = 1; + #endif +- memset(&f2k->profile,0,sizeof(struct k510_isp_profile)*VIDEO_NUM_MAX); +- for(i=0; iisp_ds_cfg.dsInSizeInfo.Width == 1920 && +- isp_cfg->isp_ds_cfg.dsInSizeInfo.Height >= 1080) +- { +- f2k->profile[i].drop_threshold = 1000000LL/30 + DROP_THRESHOLD_GAP; +- f2k->profile[i].min_int_interval = 0xfffffLL; +- } +- else +- { +- f2k->profile[i].drop_threshold = 0LL; +- } +- } +- k510isp_f2k_irq_enable(isp,&irq_info); +- unsigned int intmask0 = isp_reg_readl(isp,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK0); +- unsigned int intmask1 = isp_reg_readl(isp,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK1); +- dev_dbg(f2k->isp->dev,"%s:intmask0(0x%x),intmask1(0x%x)\n",__func__,intmask0,intmask1); +- break; +- +- case ISP_PIPELINE_STREAM_STOPPED: +- //if (isp_module_sync_idle(&sd->entity, &f2k->wait, +- // &f2k->stopping)) +- // dev_dbg(dev, "%s: module stop timeout.\n", sd->name); +- //if (f2k->input == ISP_F2K_INPUT_VI) { +- // f2k_if_enable(f2k, 0); +- //} +- f2k->state == ISP_PIPELINE_STREAM_STOPPED; +- memset(&irq_info,0,sizeof(struct isp_irq_info)); +- mutex_lock(&f2k->ioctl_lock); +- k510isp_f2k_irq_enable(isp,&irq_info); +- k510isp_f2k_reset(isp); +- mutex_unlock(&f2k->ioctl_lock); +- +- ds_en[0] = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; +- ds_en[1] = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; +- ds_en[2] = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; +- ds_en[3] = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; +- for(i=0; iisp->dev,"f2k ds%d no_buf_drop_cnt %d, total %d\n", i, f2k->profile[i].no_buf_drop_cnt, f2k->profile[i].pic_cnt); +- if(f2k->profile[i].drop_threshold > 0) +- { +- dev_info(f2k->isp->dev,"f2k ds%d jump drop_cnt %d\n", i, f2k->profile[i].drop_cnt); +- dev_info(f2k->isp->dev,"f2k ds%d interrupt: max interval %lld us, big_cnt %d\n", i, f2k->profile[i].max_int_interval, f2k->profile[i].big_inter_cnt); +- dev_info(f2k->isp->dev,"f2k ds%d interrupt: min interval %lld us, small_cnt %d\n", i, f2k->profile[i].min_int_interval, f2k->profile[i].small_inter_cnt); +- } +- } +- } +- dev_info(f2k->isp->dev,"f2k dmaErrCnt %d\n", f2k->dmaErrCnt); +- break; ++ memset(&f2k->profile,0,sizeof(struct k510_isp_profile)*VIDEO_NUM_MAX); ++ for(i=0; iisp_ds_cfg.dsInSizeInfo.Width == 1920 && ++ isp_cfg->isp_ds_cfg.dsInSizeInfo.Height >= 1080) ++ { ++ f2k->profile[i].drop_threshold = 1000000LL/30 + DROP_THRESHOLD_GAP; ++ f2k->profile[i].min_int_interval = 0xfffffLL; ++ } ++ else ++ { ++ f2k->profile[i].drop_threshold = 0LL; ++ } ++ } ++ k510isp_f2k_irq_enable(isp,&irq_info); ++ unsigned int intmask0 = isp_reg_readl(isp,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK0); ++ unsigned int intmask1 = isp_reg_readl(isp,ISP_IOMEM_F2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK1); ++ dev_dbg(f2k->isp->dev,"%s:intmask0(0x%x),intmask1(0x%x)\n",__func__,intmask0,intmask1); ++ break; ++ ++ case ISP_PIPELINE_STREAM_STOPPED: ++ //if (isp_module_sync_idle(&sd->entity, &f2k->wait, ++ // &f2k->stopping)) ++ // dev_dbg(dev, "%s: module stop timeout.\n", sd->name); ++ //if (f2k->input == ISP_F2K_INPUT_VI) { ++ // f2k_if_enable(f2k, 0); ++ //} ++ f2k->state == ISP_PIPELINE_STREAM_STOPPED; ++ memset(&irq_info,0,sizeof(struct isp_irq_info)); ++ mutex_lock(&f2k->ioctl_lock); ++ k510isp_f2k_irq_enable(isp,&irq_info); ++ k510isp_f2k_reset(isp); ++ mutex_unlock(&f2k->ioctl_lock); ++ ++ ds_en[0] = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; ++ ds_en[1] = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; ++ ds_en[2] = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; ++ ds_en[3] = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; ++ for(i=0; iisp->dev,"f2k ds%d no_buf_drop_cnt %d, total %d\n", i, f2k->profile[i].no_buf_drop_cnt, f2k->profile[i].pic_cnt); ++ if(f2k->profile[i].drop_threshold > 0) ++ { ++ dev_info(f2k->isp->dev,"f2k ds%d jump drop_cnt %d\n", i, f2k->profile[i].drop_cnt); ++ dev_info(f2k->isp->dev,"f2k ds%d interrupt: max interval %lld us, big_cnt %d\n", i, f2k->profile[i].max_int_interval, f2k->profile[i].big_inter_cnt); ++ dev_info(f2k->isp->dev,"f2k ds%d interrupt: min interval %lld us, small_cnt %d\n", i, f2k->profile[i].min_int_interval, f2k->profile[i].small_inter_cnt); ++ } ++ } ++ } ++ dev_info(f2k->isp->dev,"f2k dmaErrCnt %d\n", f2k->dmaErrCnt); ++ break; + } + + f2k->state = enable; +@@ -3544,9 +3545,9 @@ static const unsigned int f2k_fmts[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + }; + +-static struct v4l2_mbus_framefmt * ++ static struct v4l2_mbus_framefmt * + __f2k_get_format(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, +- unsigned int pad, enum v4l2_subdev_format_whence which) ++ unsigned int pad, enum v4l2_subdev_format_whence which) + { + if (which == V4L2_SUBDEV_FORMAT_TRY) + return v4l2_subdev_get_try_format(&f2k->subdev, cfg, pad); +@@ -3554,7 +3555,7 @@ __f2k_get_format(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + return &f2k->formats[pad]; + } + +-static struct v4l2_rect * ++ static struct v4l2_rect * + __f2k_get_crop(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + enum v4l2_subdev_format_whence which) + { +@@ -3571,7 +3572,7 @@ __f2k_get_crop(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + * @pad: Pad number + * @fmt: Format + */ +-static void ++ static void + f2k_try_format(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + unsigned int pad, struct v4l2_mbus_framefmt *fmt, + enum v4l2_subdev_format_whence which) +@@ -3585,73 +3586,73 @@ f2k_try_format(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + unsigned int i; + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); + switch (pad) { +- case ISP_F2K_PAD_SINK: +- for (i = 0; i < ARRAY_SIZE(f2k_fmts); i++) { +- if (fmt->code == f2k_fmts[i]) +- break; +- } ++ case ISP_F2K_PAD_SINK: ++ for (i = 0; i < ARRAY_SIZE(f2k_fmts); i++) { ++ if (fmt->code == f2k_fmts[i]) ++ break; ++ } + +- /* If not found, use SGRBG10 as default */ +- if (i >= ARRAY_SIZE(f2k_fmts)) +- fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10;//MEDIA_BUS_FMT_SGRBG10_1X10; +- +- /* Clamp the input size. */ +- fmt->width = clamp_t(u32, width, 32, 4096); +- fmt->height = clamp_t(u32, height, 32, 4096); +- +- /* Default to progressive field order. */ +- if (fmt->field == V4L2_FIELD_ANY) +- fmt->field = V4L2_FIELD_NONE; +- +- break; +- +- case ISP_F2K_PAD_MAIN_SOURCE: +- case ISP_F2K_PAD_DS0_SOURCE: +- case ISP_F2K_PAD_DS1_SOURCE: +- case ISP_F2K_PAD_DS2_SOURCE: +- pixelcode = fmt->code; +- field = fmt->field; +- *fmt = *__f2k_get_format(f2k, cfg, ISP_F2K_PAD_SINK, which); +- +- /* In SYNC mode the bridge converts YUV formats from 2X8 to +- * 1X16. In BT.656 no such conversion occurs. As we don't know +- * at this point whether the source will use SYNC or BT.656 mode +- * let's pretend the conversion always occurs. The f2k will be +- * configured to pack bytes in BT.656, hiding the inaccuracy. +- * In all cases bytes can be swapped. +- */ +- if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 || +- fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) { +- /* Use the user requested format if YUV. */ +- if (pixelcode == MEDIA_BUS_FMT_YUYV8_2X8 || +- pixelcode == MEDIA_BUS_FMT_UYVY8_2X8 || +- pixelcode == MEDIA_BUS_FMT_YUYV8_1X16 || +- pixelcode == MEDIA_BUS_FMT_UYVY8_1X16) +- fmt->code = pixelcode; +- +- if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8) +- fmt->code = MEDIA_BUS_FMT_YUYV8_1X16; +- else if (fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) +- fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; +- } ++ /* If not found, use SGRBG10 as default */ ++ if (i >= ARRAY_SIZE(f2k_fmts)) ++ fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10;//MEDIA_BUS_FMT_SGRBG10_1X10; + +- /* Hardcode the output size to the crop rectangle size. */ +- crop = __f2k_get_crop(f2k, cfg, which); +- fmt->width = crop->width; +- fmt->height = crop->height; ++ /* Clamp the input size. */ ++ fmt->width = clamp_t(u32, width, 32, 4096); ++ fmt->height = clamp_t(u32, height, 32, 4096); + +- /* When input format is interlaced with alternating fields the +- * F2K can interleave the fields. +- */ +- if (fmt->field == V4L2_FIELD_ALTERNATE && +- (field == V4L2_FIELD_INTERLACED_TB || +- field == V4L2_FIELD_INTERLACED_BT)) { +- fmt->field = field; +- fmt->height *= 2; +- } ++ /* Default to progressive field order. */ ++ if (fmt->field == V4L2_FIELD_ANY) ++ fmt->field = V4L2_FIELD_NONE; ++ ++ break; ++ ++ case ISP_F2K_PAD_MAIN_SOURCE: ++ case ISP_F2K_PAD_DS0_SOURCE: ++ case ISP_F2K_PAD_DS1_SOURCE: ++ case ISP_F2K_PAD_DS2_SOURCE: ++ pixelcode = fmt->code; ++ field = fmt->field; ++ *fmt = *__f2k_get_format(f2k, cfg, ISP_F2K_PAD_SINK, which); ++ ++ /* In SYNC mode the bridge converts YUV formats from 2X8 to ++ * 1X16. In BT.656 no such conversion occurs. As we don't know ++ * at this point whether the source will use SYNC or BT.656 mode ++ * let's pretend the conversion always occurs. The f2k will be ++ * configured to pack bytes in BT.656, hiding the inaccuracy. ++ * In all cases bytes can be swapped. ++ */ ++ if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 || ++ fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) { ++ /* Use the user requested format if YUV. */ ++ if (pixelcode == MEDIA_BUS_FMT_YUYV8_2X8 || ++ pixelcode == MEDIA_BUS_FMT_UYVY8_2X8 || ++ pixelcode == MEDIA_BUS_FMT_YUYV8_1X16 || ++ pixelcode == MEDIA_BUS_FMT_UYVY8_1X16) ++ fmt->code = pixelcode; ++ ++ if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8) ++ fmt->code = MEDIA_BUS_FMT_YUYV8_1X16; ++ else if (fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) ++ fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; ++ } ++ ++ /* Hardcode the output size to the crop rectangle size. */ ++ crop = __f2k_get_crop(f2k, cfg, which); ++ fmt->width = crop->width; ++ fmt->height = crop->height; + +- break; +- } ++ /* When input format is interlaced with alternating fields the ++ * F2K can interleave the fields. ++ */ ++ if (fmt->field == V4L2_FIELD_ALTERNATE && ++ (field == V4L2_FIELD_INTERLACED_TB || ++ field == V4L2_FIELD_INTERLACED_BT)) { ++ fmt->field = field; ++ fmt->height *= 2; ++ } ++ ++ break; ++ } + /* Data is written to memory unpacked, each 10-bit or 12-bit pixel is + * stored on 2 bytes. + */ +@@ -3666,8 +3667,8 @@ f2k_try_format(struct isp_f2k_device *f2k, struct v4l2_subdev_pad_config *cfg, + * @crop: crop rectangle to be validated + */ + static void f2k_try_crop(struct isp_f2k_device *f2k, +- const struct v4l2_mbus_framefmt *sink, +- struct v4l2_rect *crop) ++ const struct v4l2_mbus_framefmt *sink, ++ struct v4l2_rect *crop) + { + const struct k510isp_format_info *info; + unsigned int max_width; +@@ -3691,9 +3692,9 @@ static void f2k_try_crop(struct isp_f2k_device *f2k, + */ + max_width = (sink->width - crop->left + 15) & ~15; + crop->width = clamp_t(u32, crop->width, F2K_MIN_WIDTH, max_width) +- & ~15; ++ & ~15; + crop->height = clamp_t(u32, crop->height, F2K_MIN_HEIGHT, +- sink->height - crop->top); ++ sink->height - crop->top); + + /* Odd width/height values don't make sense for Bayer formats. */ + if (info->flavor != MEDIA_BUS_FMT_Y8_1X8) { +@@ -3711,65 +3712,65 @@ static void f2k_try_crop(struct isp_f2k_device *f2k, + * return -EINVAL or zero on success + */ + static int f2k_enum_mbus_code(struct v4l2_subdev *sd, +- struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_mbus_code_enum *code) ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_mbus_code_enum *code) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); + switch (code->pad) { +- case ISP_F2K_PAD_SINK: +- if (code->index >= ARRAY_SIZE(f2k_fmts)) +- { +- dev_err(f2k->isp->dev,"%s:code->index %d\n",__func__,code->index); +- return -EINVAL; +- } +- code->code = f2k_fmts[code->index]; +- break; +- +- case ISP_F2K_PAD_MAIN_SOURCE: +- case ISP_F2K_PAD_DS0_SOURCE: +- case ISP_F2K_PAD_DS1_SOURCE: +- case ISP_F2K_PAD_DS2_SOURCE: +- format = __f2k_get_format(f2k, cfg, code->pad, +- code->which); +- +- if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || +- format->code == MEDIA_BUS_FMT_UYVY8_2X8) { +- /* In YUV mode the f2k can swap bytes. */ +- if (code->index == 0) +- code->code = MEDIA_BUS_FMT_YUYV8_1X16; +- else if (code->index == 1) +- code->code = MEDIA_BUS_FMT_UYVY8_1X16; +- else ++ case ISP_F2K_PAD_SINK: ++ if (code->index >= ARRAY_SIZE(f2k_fmts)) + { +- dev_err(f2k->isp->dev,"%s:code->index1 %d\n",__func__,code->index); ++ dev_err(f2k->isp->dev,"%s:code->index %d\n",__func__,code->index); + return -EINVAL; + } +- } else { +- /* In raw mode, no configurable format confversion is +- * available. +- */ +- if (code->index == 0) +- code->code = format->code; +- else +- { +- dev_err(f2k->isp->dev,"%s:code->index2 %d\n",__func__,code->index); +- return -EINVAL; ++ code->code = f2k_fmts[code->index]; ++ break; ++ ++ case ISP_F2K_PAD_MAIN_SOURCE: ++ case ISP_F2K_PAD_DS0_SOURCE: ++ case ISP_F2K_PAD_DS1_SOURCE: ++ case ISP_F2K_PAD_DS2_SOURCE: ++ format = __f2k_get_format(f2k, cfg, code->pad, ++ code->which); ++ ++ if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || ++ format->code == MEDIA_BUS_FMT_UYVY8_2X8) { ++ /* In YUV mode the f2k can swap bytes. */ ++ if (code->index == 0) ++ code->code = MEDIA_BUS_FMT_YUYV8_1X16; ++ else if (code->index == 1) ++ code->code = MEDIA_BUS_FMT_UYVY8_1X16; ++ else ++ { ++ dev_err(f2k->isp->dev,"%s:code->index1 %d\n",__func__,code->index); ++ return -EINVAL; ++ } ++ } else { ++ /* In raw mode, no configurable format confversion is ++ * available. ++ */ ++ if (code->index == 0) ++ code->code = format->code; ++ else ++ { ++ dev_err(f2k->isp->dev,"%s:code->index2 %d\n",__func__,code->index); ++ return -EINVAL; ++ } + } +- } +- break; ++ break; + +- default: +- return -EINVAL; ++ default: ++ return -EINVAL; + } + dev_dbg(f2k->isp->dev,"%s:end\n",__func__); + return 0; + } + + static int f2k_enum_frame_size(struct v4l2_subdev *sd, +- struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_frame_size_enum *fse) ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_frame_size_enum *fse) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt format; +@@ -3815,38 +3816,38 @@ static int f2k_enum_frame_size(struct v4l2_subdev *sd, + * Return 0 on success or a negative error code otherwise. + */ + static int f2k_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_selection *sel) ++ struct v4l2_subdev_selection *sel) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); + if (sel->pad != ISP_F2K_PAD_MAIN_SOURCE || +- sel->pad != ISP_F2K_PAD_DS0_SOURCE || +- sel->pad != ISP_F2K_PAD_DS1_SOURCE || +- sel->pad != ISP_F2K_PAD_DS2_SOURCE ) ++ sel->pad != ISP_F2K_PAD_DS0_SOURCE || ++ sel->pad != ISP_F2K_PAD_DS1_SOURCE || ++ sel->pad != ISP_F2K_PAD_DS2_SOURCE ) + { + dev_err(f2k->isp->dev,"%s:no pad\n",__func__); + return -EINVAL; + } + + switch (sel->target) { +- case V4L2_SEL_TGT_CROP_BOUNDS: +- sel->r.left = 0; +- sel->r.top = 0; +- sel->r.width = INT_MAX; +- sel->r.height = INT_MAX; +- +- format = __f2k_get_format(f2k, cfg, ISP_F2K_PAD_SINK, sel->which); +- f2k_try_crop(f2k, format, &sel->r); +- break; ++ case V4L2_SEL_TGT_CROP_BOUNDS: ++ sel->r.left = 0; ++ sel->r.top = 0; ++ sel->r.width = INT_MAX; ++ sel->r.height = INT_MAX; ++ ++ format = __f2k_get_format(f2k, cfg, ISP_F2K_PAD_SINK, sel->which); ++ f2k_try_crop(f2k, format, &sel->r); ++ break; + +- case V4L2_SEL_TGT_CROP: +- sel->r = *__f2k_get_crop(f2k, cfg, sel->which); +- break; ++ case V4L2_SEL_TGT_CROP: ++ sel->r = *__f2k_get_crop(f2k, cfg, sel->which); ++ break; + +- default: +- dev_err(f2k->isp->dev,"%s:no target\n",__func__); +- return -EINVAL; ++ default: ++ dev_err(f2k->isp->dev,"%s:no target\n",__func__); ++ return -EINVAL; + } + dev_dbg(f2k->isp->dev,"%s:end\n",__func__); + return 0; +@@ -3863,17 +3864,17 @@ static int f2k_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_conf + * Return 0 on success or a negative error code otherwise. + */ + static int f2k_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_selection *sel) ++ struct v4l2_subdev_selection *sel) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); + if (sel->target != V4L2_SEL_TGT_CROP || +- sel->pad != ISP_F2K_PAD_MAIN_SOURCE || +- sel->pad != ISP_F2K_PAD_DS0_SOURCE || +- sel->pad != ISP_F2K_PAD_DS1_SOURCE || +- sel->pad != ISP_F2K_PAD_DS2_SOURCE ) ++ sel->pad != ISP_F2K_PAD_MAIN_SOURCE || ++ sel->pad != ISP_F2K_PAD_DS0_SOURCE || ++ sel->pad != ISP_F2K_PAD_DS1_SOURCE || ++ sel->pad != ISP_F2K_PAD_DS2_SOURCE ) + { + dev_err(f2k->isp->dev,"%s:pad == NULL\n",__func__); + return -EINVAL; +@@ -3938,7 +3939,7 @@ static int f2k_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_conf + * to the format type. + */ + static int f2k_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_format *fmt) ++ struct v4l2_subdev_format *fmt) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; +@@ -3965,7 +3966,7 @@ static int f2k_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config + * to the format type. + */ + static int f2k_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_format *fmt) ++ struct v4l2_subdev_format *fmt) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; +@@ -4049,16 +4050,16 @@ static int f2k_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config + } + + static int f2k_link_validate(struct v4l2_subdev *sd, +- struct media_link *link, +- struct v4l2_subdev_format *source_fmt, +- struct v4l2_subdev_format *sink_fmt) ++ struct media_link *link, ++ struct v4l2_subdev_format *source_fmt, ++ struct v4l2_subdev_format *sink_fmt) + { + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); + + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); + /* Check if the two ends match */ + if (source_fmt->format.width != sink_fmt->format.width || +- source_fmt->format.height != sink_fmt->format.height) ++ source_fmt->format.height != sink_fmt->format.height) + { + dev_err(f2k->isp->dev,"%s:format error\n",__func__); + return -EPIPE; +@@ -4140,8 +4141,8 @@ static const struct v4l2_subdev_internal_ops f2k_v4l2_internal_ops = { + * return -EINVAL on error or zero on success + */ + static int f2k_link_setup(struct media_entity *entity, +- const struct media_pad *local, +- const struct media_pad *remote, u32 flags) ++ const struct media_pad *local, ++ const struct media_pad *remote, u32 flags) + { + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct isp_f2k_device *f2k = v4l2_get_subdevdata(sd); +@@ -4153,84 +4154,84 @@ static int f2k_link_setup(struct media_entity *entity, + index |= 2 << 16; + + switch (index) { +- case ISP_F2K_PAD_SINK: +- case ISP_F2K_PAD_SINK | 2 << 16: +- /* Read from vi */ +- if (!(flags & MEDIA_LNK_FL_ENABLED)) { +- f2k->input = ISP_F2K_INPUT_NONE; +- break; +- } +- +- if (f2k->input != ISP_F2K_INPUT_NONE) +- { +- dev_err(f2k->isp->dev,"%s:!ISP_F2K_INPUT_NONE\n",__func__); +- return -EBUSY; +- } ++ case ISP_F2K_PAD_SINK: ++ case ISP_F2K_PAD_SINK | 2 << 16: ++ /* Read from vi */ ++ if (!(flags & MEDIA_LNK_FL_ENABLED)) { ++ f2k->input = ISP_F2K_INPUT_NONE; ++ break; ++ } + +- if (remote->entity == &f2k->subdev.entity) +- f2k->input = ISP_F2K_INPUT_VI; +- else +- f2k->input = ISP_F2K_INPUT_NONE; +- break; +- case ISP_F2K_PAD_MAIN_SOURCE: +- case ISP_F2K_PAD_MAIN_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (f2k->output & ISP_F2K_OUTPUT_MAIN_MEM) ++ if (f2k->input != ISP_F2K_INPUT_NONE) + { +- dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_MAIN_SOURCE\n",__func__); ++ dev_err(f2k->isp->dev,"%s:!ISP_F2K_INPUT_NONE\n",__func__); + return -EBUSY; + } +- f2k->output |= ISP_F2K_OUTPUT_MAIN_MEM; +- } else { +- f2k->output &= ~ISP_F2K_OUTPUT_MAIN_MEM; +- } +- break; +- case ISP_F2K_PAD_DS0_SOURCE: +- case ISP_F2K_PAD_DS0_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (f2k->output & ISP_F2K_OUTPUT_DS0_MEM) +- { +- dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS0_SOURCE\n",__func__); +- return -EBUSY; ++ ++ if (remote->entity == &f2k->subdev.entity) ++ f2k->input = ISP_F2K_INPUT_VI; ++ else ++ f2k->input = ISP_F2K_INPUT_NONE; ++ break; ++ case ISP_F2K_PAD_MAIN_SOURCE: ++ case ISP_F2K_PAD_MAIN_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (f2k->output & ISP_F2K_OUTPUT_MAIN_MEM) ++ { ++ dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_MAIN_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ f2k->output |= ISP_F2K_OUTPUT_MAIN_MEM; ++ } else { ++ f2k->output &= ~ISP_F2K_OUTPUT_MAIN_MEM; + } +- f2k->output |= ISP_F2K_OUTPUT_DS0_MEM; +- } else { +- f2k->output &= ~ISP_F2K_OUTPUT_DS0_MEM; +- } +- break; +- case ISP_F2K_PAD_DS1_SOURCE: +- case ISP_F2K_PAD_DS1_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (f2k->output & ISP_F2K_OUTPUT_DS1_MEM) +- { +- dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS1_SOURCE\n",__func__); +- return -EBUSY; ++ break; ++ case ISP_F2K_PAD_DS0_SOURCE: ++ case ISP_F2K_PAD_DS0_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (f2k->output & ISP_F2K_OUTPUT_DS0_MEM) ++ { ++ dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS0_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ f2k->output |= ISP_F2K_OUTPUT_DS0_MEM; ++ } else { ++ f2k->output &= ~ISP_F2K_OUTPUT_DS0_MEM; + } +- f2k->output |= ISP_F2K_OUTPUT_DS1_MEM; +- } else { +- f2k->output &= ~ISP_F2K_OUTPUT_DS1_MEM; +- } +- break; +- case ISP_F2K_PAD_DS2_SOURCE: +- case ISP_F2K_PAD_DS2_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (f2k->output & ISP_F2K_OUTPUT_DS2_MEM) +- { +- dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS2_SOURCE\n",__func__); +- return -EBUSY; ++ break; ++ case ISP_F2K_PAD_DS1_SOURCE: ++ case ISP_F2K_PAD_DS1_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (f2k->output & ISP_F2K_OUTPUT_DS1_MEM) ++ { ++ dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS1_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ f2k->output |= ISP_F2K_OUTPUT_DS1_MEM; ++ } else { ++ f2k->output &= ~ISP_F2K_OUTPUT_DS1_MEM; + } +- f2k->output |= ISP_F2K_OUTPUT_DS2_MEM; +- } else { +- f2k->output &= ~ISP_F2K_OUTPUT_DS2_MEM; +- } +- break; +- default: +- dev_dbg(f2k->isp->dev,"%s:!no index\n",__func__); +- return -EINVAL; ++ break; ++ case ISP_F2K_PAD_DS2_SOURCE: ++ case ISP_F2K_PAD_DS2_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (f2k->output & ISP_F2K_OUTPUT_DS2_MEM) ++ { ++ dev_err(f2k->isp->dev,"%s:!ISP_F2K_PAD_DS2_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ f2k->output |= ISP_F2K_OUTPUT_DS2_MEM; ++ } else { ++ f2k->output &= ~ISP_F2K_OUTPUT_DS2_MEM; ++ } ++ break; ++ default: ++ dev_dbg(f2k->isp->dev,"%s:!no index\n",__func__); ++ return -EINVAL; + } + + dev_dbg(f2k->isp->dev,"%s:end\n",__func__); +@@ -4262,7 +4263,7 @@ void k510isp_f2k_unregister_entities(struct isp_f2k_device *f2k) + * return negative error code or zero on success + */ + int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, +- struct v4l2_device *vdev) ++ struct v4l2_device *vdev) + { + int ret; + dev_dbg(f2k->isp->dev,"%s:start\n",__func__); +@@ -4271,7 +4272,7 @@ int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, + if (ret < 0) + { + dev_err(f2k->isp->dev, "%s: v4l2_device_register_subdev failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error; + } + +@@ -4279,7 +4280,7 @@ int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, + if (ret < 0) + { + dev_err(f2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error; + } + +@@ -4287,7 +4288,7 @@ int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, + if (ret < 0) + { + dev_err(f2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_main; + } + +@@ -4295,7 +4296,7 @@ int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, + if (ret < 0) + { + dev_err(f2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_ds0; + } + +@@ -4303,7 +4304,7 @@ int k510isp_f2k_register_entities(struct isp_f2k_device *f2k, + if (ret < 0) + { + dev_err(f2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_ds1; + } + dev_dbg(f2k->isp->dev,"k510isp_f2k_register_entities end\n"); +@@ -4363,7 +4364,7 @@ static int k510isp_f2k_init_entities(struct isp_f2k_device *f2k) + } + dev_dbg(isp->dev,"%s:media_entity_pads_init end\n",__func__); + f2k_init_formats(sd, NULL); +-// ++ // + f2k->video_out[MAIN_VIDEO].type = V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;//V4L2_BUF_TYPE_VIDEO_OUTPUT; + f2k->video_out[MAIN_VIDEO].ops = &f2k_video_ops; + f2k->video_out[MAIN_VIDEO].isp = to_isp_device(f2k); +@@ -4378,7 +4379,7 @@ static int k510isp_f2k_init_entities(struct isp_f2k_device *f2k) + dev_err(isp->dev,"%s:k510isp_video_init ret:%d\n",__func__,ret); + goto error_video; + } +-// ++ // + f2k->video_out[DS0_VIDEO].type = V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;//V4L2_BUF_TYPE_VIDEO_OUTPUT; + f2k->video_out[DS0_VIDEO].ops = &f2k_video_ops; + f2k->video_out[DS0_VIDEO].isp = to_isp_device(f2k); +@@ -4393,7 +4394,7 @@ static int k510isp_f2k_init_entities(struct isp_f2k_device *f2k) + dev_err(isp->dev,"%s:k510isp_video_init ret:%d\n",__func__,ret); + goto error_main_video; + } +-// ++ // + f2k->video_out[DS1_VIDEO].type = V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;//V4L2_BUF_TYPE_VIDEO_OUTPUT; + f2k->video_out[DS1_VIDEO].ops = &f2k_video_ops; + f2k->video_out[DS1_VIDEO].isp = to_isp_device(f2k); +@@ -4409,7 +4410,7 @@ static int k510isp_f2k_init_entities(struct isp_f2k_device *f2k) + goto error_ds0_video; + } + +-// ++ // + f2k->video_out[DS2_VIDEO].type = V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_CAPTURE;//V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;//V4L2_BUF_TYPE_VIDEO_OUTPUT; + f2k->video_out[DS2_VIDEO].ops = &f2k_video_ops; + f2k->video_out[DS2_VIDEO].isp = to_isp_device(f2k); +@@ -4492,7 +4493,7 @@ void k510isp_f2k_cleanup(struct k510_isp_device *isp) + + if (f2k->nr3d_dma.addr != NULL) + dma_free_coherent(isp->dev, f2k->nr3d_dma.dma_size, f2k->nr3d_dma.addr, +- f2k->nr3d_dma.dma); +-// ++ f2k->nr3d_dma.dma); ++ // + mutex_destroy(&f2k->ioctl_lock); + } +diff --git a/drivers/media/platform/canaan-isp/isp_2k/isp_r2k.c b/drivers/media/platform/canaan-isp/isp_2k/isp_r2k.c +old mode 100755 +new mode 100644 +index d59117a7..9d13bbe1 +--- a/drivers/media/platform/canaan-isp/isp_2k/isp_r2k.c ++++ b/drivers/media/platform/canaan-isp/isp_2k/isp_r2k.c +@@ -3,7 +3,7 @@ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +-*/ ++ */ + #include + #include + #include +@@ -38,13 +38,13 @@ static unsigned long long get_usec(void) + } + + /**************************************************************************** +-*wrap +-*****************************************************************************/ ++ *wrap ++ *****************************************************************************/ + // + void isp_r2k_wrap_SetComRst(struct k510_isp_device *isp) + { + +- ISP_WRAP_RST_CTL_S stRstCtl; ++ ISP_WRAP_RST_CTL_S stRstCtl; + stRstCtl.sw_3dnr_rst = 1; + stRstCtl.wdr_2_frame_rst = 1; + stRstCtl.wdr_3_frame_rst =1; +@@ -59,83 +59,83 @@ void isp_r2k_wrap_SetComRst(struct k510_isp_device *isp) + stRstCtl.core_cfg_rst = 1; + stRstCtl.axi_wr_ch_rst = 1; + stRstCtl.axi_rd_ch_rst = 1; +- Isp_Drv_R2k_Wrap_SetPipeReset(isp,&stRstCtl); ++ Isp_Drv_R2k_Wrap_SetPipeReset(isp,&stRstCtl); + } + // + void isp_r2k_wrap_SetDmaRst(struct k510_isp_device *isp) + { + +- ISP_WRAP_DMA_RST_CTL_S stDmaRstCtl; +- stDmaRstCtl.y_3dnr_wr_ch_rst = 1; +- stDmaRstCtl.uv_3dnr_wr_ch_rst = 1; +- stDmaRstCtl.ldc_y_wr_ch_rst = 1; +- stDmaRstCtl.ldc_uv_wr_ch_rst = 1; +- stDmaRstCtl.wdr_raw_wr_ch_rst = 1; +- stDmaRstCtl.main_out_y_wr_ch_rst = 1; +- stDmaRstCtl.main_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.y_3dnr_rd_ch_rst = 1; +- stDmaRstCtl.uv_3dnr_rd_ch_rst = 1; +- stDmaRstCtl.ldc_y_rd_ch_rst = 1; +- stDmaRstCtl.ldc_uv_rd_ch_rst = 1; +- stDmaRstCtl.wdr_raw_rd_ch_rst = 1; +- stDmaRstCtl.ds0_out_y_wr_ch_rst = 1; +- stDmaRstCtl.ds0_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.ds1_out_y_wr_ch_rst = 1; +- stDmaRstCtl.ds1_out_uv_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_r_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_g_wr_ch_rst = 1; +- stDmaRstCtl.ds2_out_b_wr_ch_rst = 1; +- stDmaRstCtl.ds0_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds0_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd0_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd1_rd_ch_rst = 1; +- stDmaRstCtl.ds1_osd2_rd_ch_rst = 1; +- stDmaRstCtl.ds2_osd2_rd_ch_rst = 1; +- Isp_Drv_R2k_Wrap_SetDmaReset(isp,&stDmaRstCtl); ++ ISP_WRAP_DMA_RST_CTL_S stDmaRstCtl; ++ stDmaRstCtl.y_3dnr_wr_ch_rst = 1; ++ stDmaRstCtl.uv_3dnr_wr_ch_rst = 1; ++ stDmaRstCtl.ldc_y_wr_ch_rst = 1; ++ stDmaRstCtl.ldc_uv_wr_ch_rst = 1; ++ stDmaRstCtl.wdr_raw_wr_ch_rst = 1; ++ stDmaRstCtl.main_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.main_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.y_3dnr_rd_ch_rst = 1; ++ stDmaRstCtl.uv_3dnr_rd_ch_rst = 1; ++ stDmaRstCtl.ldc_y_rd_ch_rst = 1; ++ stDmaRstCtl.ldc_uv_rd_ch_rst = 1; ++ stDmaRstCtl.wdr_raw_rd_ch_rst = 1; ++ stDmaRstCtl.ds0_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.ds0_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.ds1_out_y_wr_ch_rst = 1; ++ stDmaRstCtl.ds1_out_uv_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_r_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_g_wr_ch_rst = 1; ++ stDmaRstCtl.ds2_out_b_wr_ch_rst = 1; ++ stDmaRstCtl.ds0_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds0_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd0_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd1_rd_ch_rst = 1; ++ stDmaRstCtl.ds1_osd2_rd_ch_rst = 1; ++ stDmaRstCtl.ds2_osd2_rd_ch_rst = 1; ++ Isp_Drv_R2k_Wrap_SetDmaReset(isp,&stDmaRstCtl); + } + // + void isp_r2k_wrap_SetPipeClkCtl(struct k510_isp_device *isp) + { + +- ISP_WRAP_PIPE_CLK_CTL_S pstPipeClkCtl; +- pstPipeClkCtl.wrap_com_clk_en = 1; +- pstPipeClkCtl.wrap_cfg_clk_en = 1; +- pstPipeClkCtl.core_com_clk_en = 1; +- pstPipeClkCtl.core_cfg_clk_en = 1; +- pstPipeClkCtl.axi_wr_ch_en = 1; +- pstPipeClkCtl.axi_rd_ch_en = 1; ++ ISP_WRAP_PIPE_CLK_CTL_S pstPipeClkCtl; ++ pstPipeClkCtl.wrap_com_clk_en = 1; ++ pstPipeClkCtl.wrap_cfg_clk_en = 1; ++ pstPipeClkCtl.core_com_clk_en = 1; ++ pstPipeClkCtl.core_cfg_clk_en = 1; ++ pstPipeClkCtl.axi_wr_ch_en = 1; ++ pstPipeClkCtl.axi_rd_ch_en = 1; + Isp_Drv_R2k_Wrap_SetComClkCtl(isp,&pstPipeClkCtl); + } + // + void isp_r2k_wrap_SetLdc(struct k510_isp_device *isp,struct isp_wrap_ldc_info *ldcInfo) + { + +- ISP_WRAP_LDC_ATTR_S pstLdcAttr; +- if( 1 == ldcInfo->ldc_en) +- { +- pstLdcAttr.ldc_clk_en = 1; +- pstLdcAttr.ldc_dma_en = 1; +- } +- else +- { +- pstLdcAttr.ldc_clk_en = 0; +- pstLdcAttr.ldc_dma_en = 0; +- } +- ISP_WRAP_LDC_BUF_S *stLdcBuf = &pstLdcAttr.stLdcBuf; +- stLdcBuf->ldc_y_buf_base = ldcInfo->ldc_y_buf_base;//ISP_BUF_LDC_Y; +- stLdcBuf->ldc_uv_buf_base = ldcInfo->ldc_uv_buf_base;//ISP_BUF_LDC_UV; +- stLdcBuf->ldc_y_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_Y_STRIDE; +- stLdcBuf->ldc_uv_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_UV_STRIDE; +- Isp_Drv_R2k_Wrap_SetLdc(isp,&pstLdcAttr); ++ ISP_WRAP_LDC_ATTR_S pstLdcAttr; ++ if( 1 == ldcInfo->ldc_en) ++ { ++ pstLdcAttr.ldc_clk_en = 1; ++ pstLdcAttr.ldc_dma_en = 1; ++ } ++ else ++ { ++ pstLdcAttr.ldc_clk_en = 0; ++ pstLdcAttr.ldc_dma_en = 0; ++ } ++ ISP_WRAP_LDC_BUF_S *stLdcBuf = &pstLdcAttr.stLdcBuf; ++ stLdcBuf->ldc_y_buf_base = ldcInfo->ldc_y_buf_base;//ISP_BUF_LDC_Y; ++ stLdcBuf->ldc_uv_buf_base = ldcInfo->ldc_uv_buf_base;//ISP_BUF_LDC_UV; ++ stLdcBuf->ldc_y_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_Y_STRIDE; ++ stLdcBuf->ldc_uv_line_stride = ldcInfo->ldc_line_stride;//ISP_BUF_LDC_UV_STRIDE; ++ Isp_Drv_R2k_Wrap_SetLdc(isp,&pstLdcAttr); + } + // + void isp_r2k_wrap_SetMainOut(struct k510_isp_device *isp,struct isp_wrap_main_info *mainInfo) + { + +- ISP_WRAP_MAINOUT_ATTR_S pstMainOutAttr; +- pstMainOutAttr.main_out_clk_en = 1; ++ ISP_WRAP_MAINOUT_ATTR_S pstMainOutAttr; ++ pstMainOutAttr.main_out_clk_en = 1; + if( 1 == mainInfo->main_out_en) + { + pstMainOutAttr.main_out_dma_en = 1; +@@ -145,34 +145,34 @@ void isp_r2k_wrap_SetMainOut(struct k510_isp_device *isp,struct isp_wrap_main_in + { + //pstMainOutAttr.main_out_clk_en = 0; + pstMainOutAttr.main_out_dma_en = 0; +- pstMainOutAttr.pix_remap_main_en = 0; ++ pstMainOutAttr.pix_remap_main_en = 0; + } +- ISP_WRAP_MAIN_PIXEL_FORMAT_CTL_S *stMainPixelFormat = &pstMainOutAttr.stMainPixelFormat; ++ ISP_WRAP_MAIN_PIXEL_FORMAT_CTL_S *stMainPixelFormat = &pstMainOutAttr.stMainPixelFormat; + stMainPixelFormat->main_out_img_format = mainInfo->main_out_img_format;//ISP_YUV_DATA; + stMainPixelFormat->main_out_img_out_format = mainInfo->main_out_img_out_format;//IN_YUV420; + stMainPixelFormat->main_out_pixel_width = mainInfo->main_out_pxl_width;//PIXEL_8; + stMainPixelFormat->main_out_yuv422_pxl_order = mainInfo->main_out_yuv422_pxl_order;//YUYV; + stMainPixelFormat->main_out_yuv_in_format = mainInfo->main_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_MAIN_OUT_SIZE_S *stMainOutSize = &pstMainOutAttr.stMainOutSize; ++ ISP_WRAP_MAIN_OUT_SIZE_S *stMainOutSize = &pstMainOutAttr.stMainOutSize; + stMainOutSize->main_out_h_size = mainInfo->main_size.Width - 1; + stMainOutSize->main_out_v_size = mainInfo->main_size.Height - 1; +- ISP_WRAP_MAIN_BUF_S *stMainBuf = &pstMainOutAttr.stMainBuf; +- stMainBuf->main_y_buf0_base = mainInfo->main_y_buf0_base;//ISP_BUF_MAIN_Y; +- stMainBuf->main_y_buf1_base = mainInfo->main_y_buf1_base;//ISP_BUF_MAIN_Y; +- stMainBuf->main_uv_buf0_base = mainInfo->main_uv_buf0_base;//ISP_BUF_MAIN_UV; +- stMainBuf->main_uv_buf1_base = mainInfo->main_uv_buf1_base;//ISP_BUF_MAIN_UV; +- stMainBuf->main_y_line_stride = mainInfo->main_line_stride;//SP_BUF_MAIN_Y_STRIDE; +- stMainBuf->main_uv_line_stride = mainInfo->main_line_stride;//ISP_BUF_MAIN_UV_STRIDE; +- Isp_Drv_R2k_Wrap_SetMainOut(isp,&pstMainOutAttr); ++ ISP_WRAP_MAIN_BUF_S *stMainBuf = &pstMainOutAttr.stMainBuf; ++ stMainBuf->main_y_buf0_base = mainInfo->main_y_buf0_base;//ISP_BUF_MAIN_Y; ++ stMainBuf->main_y_buf1_base = mainInfo->main_y_buf1_base;//ISP_BUF_MAIN_Y; ++ stMainBuf->main_uv_buf0_base = mainInfo->main_uv_buf0_base;//ISP_BUF_MAIN_UV; ++ stMainBuf->main_uv_buf1_base = mainInfo->main_uv_buf1_base;//ISP_BUF_MAIN_UV; ++ stMainBuf->main_y_line_stride = mainInfo->main_line_stride;//SP_BUF_MAIN_Y_STRIDE; ++ stMainBuf->main_uv_line_stride = mainInfo->main_line_stride;//ISP_BUF_MAIN_UV_STRIDE; ++ Isp_Drv_R2k_Wrap_SetMainOut(isp,&pstMainOutAttr); + } + // + void isp_r2k_wrap_SetDs0Out(struct k510_isp_device *isp,struct isp_wrap_ds0_info *ds0Info) + { + unsigned int Width = ds0Info->ds0_size.Width; + unsigned int Height = ds0Info->ds0_size.Height; +- ISP_WRAP_DS0OUT_ATTR_S pstDs0OutAttr; +- ISP_WRAP_DS0_CLK_CTL_S *stDs0ClkCtl = &pstDs0OutAttr.stDs0ClkCtl; +- ISP_WRAP_DS0_DMA_EN_CTL_S *stDs0DmaEn = &pstDs0OutAttr.stDs0DmaEn; ++ ISP_WRAP_DS0OUT_ATTR_S pstDs0OutAttr; ++ ISP_WRAP_DS0_CLK_CTL_S *stDs0ClkCtl = &pstDs0OutAttr.stDs0ClkCtl; ++ ISP_WRAP_DS0_DMA_EN_CTL_S *stDs0DmaEn = &pstDs0OutAttr.stDs0DmaEn; + + stDs0ClkCtl->ds0_out_clk_en = 1; + stDs0ClkCtl->ds0_out_y_ch_clk_en = 1; +@@ -220,34 +220,34 @@ void isp_r2k_wrap_SetDs0Out(struct k510_isp_device *isp,struct isp_wrap_ds0_info + stDs0DmaEn->ds0_osd1_ch_dma_en = 0; + stDs0DmaEn->ds0_osd2_ch_dma_en = 0; + } +- pstDs0OutAttr.pix_remap_out0_en = ds0Info->pix_remap_out0_en; +- ISP_WRAP_DS0_PIXEL_FORMAT_CTL_S *stDs0PixelFormat = &pstDs0OutAttr.stDs0PixelFormat; ++ pstDs0OutAttr.pix_remap_out0_en = ds0Info->pix_remap_out0_en; ++ ISP_WRAP_DS0_PIXEL_FORMAT_CTL_S *stDs0PixelFormat = &pstDs0OutAttr.stDs0PixelFormat; + stDs0PixelFormat->ds0_out_img_format = ds0Info->ds0_out_img_format;//ISP_YUV_DATA; + stDs0PixelFormat->ds0_out_img_out_format = ds0Info->ds0_out_img_out_format;//IN_YUV420; + stDs0PixelFormat->ds0_out_pixel_width = ds0Info->ds0_out_pxl_width;//PIXEL_8; + stDs0PixelFormat->ds0_out_yuv422_pxl_order = ds0Info->ds0_out_yuv422_pxl_order;//YUYV; + stDs0PixelFormat->ds0_out_yuv_in_format = ds0Info->ds0_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_DS0_OUT_SIZE_S *stDs0OutSize = &pstDs0OutAttr.stDs0OutSize; ++ ISP_WRAP_DS0_OUT_SIZE_S *stDs0OutSize = &pstDs0OutAttr.stDs0OutSize; + stDs0OutSize->ds0_out_h_size = Width - 1; + stDs0OutSize->ds0_out_v_size = Height - 1; +- ISP_WRAP_DS0_BUF_S *stDs0Buf = &pstDs0OutAttr.stDs0Buf; +- stDs0Buf->ds0_y_buf0_base = ds0Info->ds0_y_buf0_base;//ISP_BUF_DS0_Y; +- stDs0Buf->ds0_y_buf1_base = ds0Info->ds0_y_buf1_base;//ISP_BUF_DS0_Y; +- stDs0Buf->ds0_y_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_Y_STRIDE; +- stDs0Buf->ds0_uv_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_UV_STRIDE; +- stDs0Buf->ds0_uv_buf0_base = ds0Info->ds0_uv_buf0_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; +- stDs0Buf->ds0_uv_buf1_base = ds0Info->ds0_uv_buf1_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; +- Isp_Drv_R2k_Wrap_SetDs0Out(isp,&pstDs0OutAttr); ++ ISP_WRAP_DS0_BUF_S *stDs0Buf = &pstDs0OutAttr.stDs0Buf; ++ stDs0Buf->ds0_y_buf0_base = ds0Info->ds0_y_buf0_base;//ISP_BUF_DS0_Y; ++ stDs0Buf->ds0_y_buf1_base = ds0Info->ds0_y_buf1_base;//ISP_BUF_DS0_Y; ++ stDs0Buf->ds0_y_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_Y_STRIDE; ++ stDs0Buf->ds0_uv_line_stride = ds0Info->ds0_line_stride;//(Width + 15)/16*16;//ISP_BUF_DS0_UV_STRIDE; ++ stDs0Buf->ds0_uv_buf0_base = ds0Info->ds0_uv_buf0_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; ++ stDs0Buf->ds0_uv_buf1_base = ds0Info->ds0_uv_buf1_base;//ISP_BUF_DS0_Y + stDs0Buf->ds0_y_line_stride * Height;//ISP_BUF_DS0_UV; ++ Isp_Drv_R2k_Wrap_SetDs0Out(isp,&pstDs0OutAttr); + } + // + void isp_r2k_wrap_SetDs1Out(struct k510_isp_device *isp,struct isp_wrap_ds1_info *ds1Info) + { + +- ISP_WRAP_DS1OUT_ATTR_S pstDs1OutAttr; ++ ISP_WRAP_DS1OUT_ATTR_S pstDs1OutAttr; + unsigned int Width = ds1Info->ds1_size.Width; + unsigned int Height = ds1Info->ds1_size.Height; +- ISP_WRAP_DS1_CLK_CTL_S *stDs1ClkCtl = &pstDs1OutAttr.stDs1ClkCtl; +- ISP_WRAP_DS1_DMA_EN_CTL_S *stDs1DmaEn = &pstDs1OutAttr.stDs1DmaEn; ++ ISP_WRAP_DS1_CLK_CTL_S *stDs1ClkCtl = &pstDs1OutAttr.stDs1ClkCtl; ++ ISP_WRAP_DS1_DMA_EN_CTL_S *stDs1DmaEn = &pstDs1OutAttr.stDs1DmaEn; + + stDs1ClkCtl->ds1_out_clk_en = 1; + stDs1ClkCtl->ds1_out_y_ch_clk_en = 1; +@@ -295,24 +295,24 @@ void isp_r2k_wrap_SetDs1Out(struct k510_isp_device *isp,struct isp_wrap_ds1_info + stDs1DmaEn->ds1_osd1_ch_dma_en = 0; + stDs1DmaEn->ds1_osd2_ch_dma_en = 0; + } +- pstDs1OutAttr.pix_remap_out1_en = ds1Info->pix_remap_out1_en; +- ISP_WRAP_DS1_PIXEL_FORMAT_CTL_S *stDs1PixelFormat = &pstDs1OutAttr.stDs1PixelFormat; ++ pstDs1OutAttr.pix_remap_out1_en = ds1Info->pix_remap_out1_en; ++ ISP_WRAP_DS1_PIXEL_FORMAT_CTL_S *stDs1PixelFormat = &pstDs1OutAttr.stDs1PixelFormat; + stDs1PixelFormat->ds1_out_img_format = ds1Info->ds1_out_img_format;//ISP_YUV_DATA; + stDs1PixelFormat->ds1_out_img_out_format = ds1Info->ds1_out_img_out_format;//IN_YUV420; + stDs1PixelFormat->ds1_out_pixel_width = ds1Info->ds1_out_pxl_width;//PIXEL_8; + stDs1PixelFormat->ds1_out_yuv422_pxl_order = ds1Info->ds1_out_yuv422_pxl_order;//YUYV; + stDs1PixelFormat->ds1_out_yuv_in_format = ds1Info->ds1_out_yuv_in_format;//IN_YUV422; +- ISP_WRAP_DS1_OUT_SIZE_S *stDs1OutSize = &pstDs1OutAttr.stDs1OutSize; ++ ISP_WRAP_DS1_OUT_SIZE_S *stDs1OutSize = &pstDs1OutAttr.stDs1OutSize; + stDs1OutSize->ds1_out_h_size = ds1Info->ds1_size.Width - 1; + stDs1OutSize->ds1_out_v_size = ds1Info->ds1_size.Height - 1; +- ISP_WRAP_DS1_BUF_S *stDs1Buf = &pstDs1OutAttr.stDs1Buf; +- stDs1Buf->ds1_y_buf0_base = ds1Info->ds1_y_buf0_base;//ISP_BUF_DS1_Y; +- stDs1Buf->ds1_y_buf1_base = ds1Info->ds1_y_buf1_base;//ISP_BUF_DS1_Y; +- stDs1Buf->ds1_y_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; +- stDs1Buf->ds1_uv_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; +- stDs1Buf->ds1_uv_buf0_base = ds1Info->ds1_uv_buf0_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; +- stDs1Buf->ds1_uv_buf1_base = ds1Info->ds1_uv_buf1_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; +- Isp_Drv_R2k_Wrap_SetDs1Out(isp,&pstDs1OutAttr); ++ ISP_WRAP_DS1_BUF_S *stDs1Buf = &pstDs1OutAttr.stDs1Buf; ++ stDs1Buf->ds1_y_buf0_base = ds1Info->ds1_y_buf0_base;//ISP_BUF_DS1_Y; ++ stDs1Buf->ds1_y_buf1_base = ds1Info->ds1_y_buf1_base;//ISP_BUF_DS1_Y; ++ stDs1Buf->ds1_y_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; ++ stDs1Buf->ds1_uv_line_stride = ds1Info->ds1_line_stride;//(Width +15)/16*16;//ISP_BUF_DS1_Y_STRIDE; ++ stDs1Buf->ds1_uv_buf0_base = ds1Info->ds1_uv_buf0_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; ++ stDs1Buf->ds1_uv_buf1_base = ds1Info->ds1_uv_buf1_base;//ISP_BUF_DS1_Y + stDs1Buf->ds1_y_line_stride *Height;//ISP_BUF_DS1_UV; ++ Isp_Drv_R2k_Wrap_SetDs1Out(isp,&pstDs1OutAttr); + } + // + void isp_r2k_wrap_SetDs2Out(struct k510_isp_device *isp,struct isp_wrap_ds2_info *ds2Info) +@@ -320,9 +320,9 @@ void isp_r2k_wrap_SetDs2Out(struct k510_isp_device *isp,struct isp_wrap_ds2_info + + unsigned int Width = ds2Info->ds2_size.Width; + unsigned int Height = ds2Info->ds2_size.Height; +- ISP_WRAP_DS2OUT_ATTR_S pstDs2OutAttr; +- ISP_WRAP_DS2_CLK_CTL_S *stDs2ClkCtl = &pstDs2OutAttr.stDs2ClkCtl; +- ISP_WRAP_DS2_DMA_EN_CTL_S *stDs2DmaEn = &pstDs2OutAttr.stDs2DmaEn; ++ ISP_WRAP_DS2OUT_ATTR_S pstDs2OutAttr; ++ ISP_WRAP_DS2_CLK_CTL_S *stDs2ClkCtl = &pstDs2OutAttr.stDs2ClkCtl; ++ ISP_WRAP_DS2_DMA_EN_CTL_S *stDs2DmaEn = &pstDs2OutAttr.stDs2DmaEn; + + stDs2ClkCtl->ds2_out_clk_en = 1; + stDs2ClkCtl->ds2_out_r_ch_clk_en = 1; +@@ -365,227 +365,227 @@ void isp_r2k_wrap_SetDs2Out(struct k510_isp_device *isp,struct isp_wrap_ds2_info + stDs2DmaEn->ds2_osd0_ch_dma_en = 0; + stDs2DmaEn->ds2_osd1_ch_dma_en = 0; + } +- ISP_WRAP_DS2_PIXEL_FORMAT_CTL_S *stDs2PixelFormat = &pstDs2OutAttr.stDs2PixelFormat; ++ ISP_WRAP_DS2_PIXEL_FORMAT_CTL_S *stDs2PixelFormat = &pstDs2OutAttr.stDs2PixelFormat; + stDs2PixelFormat->ds2_out_img_format = ds2Info->ds2_out_img_format;//ISP_RGBRAW_DATA; + stDs2PixelFormat->ds2_out_img_out_format = ds2Info->ds2_out_img_out_format;//OUT_ARGB; + stDs2PixelFormat->ds2_out_pixel_width = ds2Info->ds2_out_pxl_width;//PIXEL_8; + stDs2PixelFormat->ds2_out_yuv422_pxl_order = ds2Info->ds2_out_yuv422_pxl_order;//YUYV; //not need + stDs2PixelFormat->ds2_out_yuv_in_format = ds2Info->ds2_out_yuv_in_format;//IN_YUV422; //not need +- ISP_WRAP_DS2_OUT_SIZE_S *stDs2OutSize = &pstDs2OutAttr.stDs2OutSize; ++ ISP_WRAP_DS2_OUT_SIZE_S *stDs2OutSize = &pstDs2OutAttr.stDs2OutSize; + stDs2OutSize->ds2_out_h_size = ds2Info->ds2_size.Width - 1; + stDs2OutSize->ds2_out_v_size = ds2Info->ds2_size.Height - 1; +- ISP_WRAP_DS2_BUF_S *stDs2Buf = &pstDs2OutAttr.stDs2Buf; ++ ISP_WRAP_DS2_BUF_S *stDs2Buf = &pstDs2OutAttr.stDs2Buf; + stDs2Buf->ds2_r_buf0_base = ds2Info->ds2_r_buf0_base; + stDs2Buf->ds2_r_buf1_base = ds2Info->ds2_r_buf1_base; + stDs2Buf->ds2_g_buf0_base = ds2Info->ds2_g_buf0_base; + stDs2Buf->ds2_g_buf1_base = ds2Info->ds2_g_buf1_base; + stDs2Buf->ds2_b_buf0_base = ds2Info->ds2_b_buf0_base; + stDs2Buf->ds2_b_buf1_base = ds2Info->ds2_b_buf1_base; +- stDs2Buf->ds2_r_line_stride = ds2Info->ds2_line_stride; +- stDs2Buf->ds2_g_line_stride = ds2Info->ds2_line_stride; +- stDs2Buf->ds2_b_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_r_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_g_line_stride = ds2Info->ds2_line_stride; ++ stDs2Buf->ds2_b_line_stride = ds2Info->ds2_line_stride; + Isp_Drv_R2k_Wrap_SetDs2Out(isp,&pstDs2OutAttr); + } + // + void isp_r2k_wrap_SetDmaConfig(struct k510_isp_device *isp) + { + +- ISP_WRAP_DMA_ATTR_S pstDmaAttr; +- unsigned int DmaChIndex = 0; ++ ISP_WRAP_DMA_ATTR_S pstDmaAttr; ++ unsigned int DmaChIndex = 0; + ISP_WRAP_DMA_MODE_S *stDmaChMode = &pstDmaAttr.stDmaChMode; +- stDmaChMode->rd_dma_arb_mode = 0;//1; +- stDmaChMode->wr_dma_arb_mode = 0;//1; +- for(DmaChIndex=0; DmaChIndexrd_dma_ch_id[DmaChIndex] = DmaChIndex; +- stDmaChMode->wr_dma_ch_id[DmaChIndex] = DmaChIndex; +- stDmaChMode->rd_dma_ch_weight[DmaChIndex] = 0x01; +- stDmaChMode->wr_dma_ch_weight[DmaChIndex] = 0x01; +- stDmaChMode->rd_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; +- stDmaChMode->wr_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; +- if(DmaChIndex < 8) +- { +- stDmaChMode->rd_dma_ch_priority[DmaChIndex] = DmaChIndex; +- stDmaChMode->wr_dma_ch_priority[DmaChIndex] = DmaChIndex; +- } +- } ++ stDmaChMode->rd_dma_arb_mode = 0;//1; ++ stDmaChMode->wr_dma_arb_mode = 0;//1; ++ for(DmaChIndex=0; DmaChIndexrd_dma_ch_id[DmaChIndex] = DmaChIndex; ++ stDmaChMode->wr_dma_ch_id[DmaChIndex] = DmaChIndex; ++ stDmaChMode->rd_dma_ch_weight[DmaChIndex] = 0x01; ++ stDmaChMode->wr_dma_ch_weight[DmaChIndex] = 0x01; ++ stDmaChMode->rd_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; ++ stDmaChMode->wr_dma_ch_priority[DmaChIndex] = ISP_DMA_CH_NUM-DmaChIndex-1; ++ if(DmaChIndex < 8) ++ { ++ stDmaChMode->rd_dma_ch_priority[DmaChIndex] = DmaChIndex; ++ stDmaChMode->wr_dma_ch_priority[DmaChIndex] = DmaChIndex; ++ } ++ } + ISP_WRAP_DMA_CFG_S *stDmaCfg = &pstDmaAttr.stDmaCfg; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_burstl = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_burstl = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_int_line_num = 8; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_err_dec_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_err_dec_en = 1; +- if((DmaChIndex > 5) && (DmaChIndex < 8)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 7) && (DmaChIndex < 13)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 12)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; +- } +- if((DmaChIndex > 1) && (DmaChIndex < 4)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 14; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 15; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 1; +- } +- if((DmaChIndex > 5) && (DmaChIndex < 8)) +- { +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 6; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; +- stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 0; +- } +- } +- ISP_WRAP_DMA_ERR_DEC_CFG_S *stErrDecCfg = &pstDmaAttr.stErrDecCfg; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_dec_unit = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_dec_unit = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_gen_thr = 255; +- stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_gen_thr = 255; +- } ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_burstl = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_burstl = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_int_line_num = 8; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_err_dec_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_err_dec_en = 1; ++ if((DmaChIndex > 5) && (DmaChIndex < 8)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 0; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 7) && (DmaChIndex < 13)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 12)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_noncon_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].y_uv_swap_en = 1; ++ } ++ if((DmaChIndex > 1) && (DmaChIndex < 4)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 14; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 15; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 1; ++ } ++ if((DmaChIndex > 5) && (DmaChIndex < 8)) ++ { ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_ch_outst = 6; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_ch_outst = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].wr_outst_en = 1; ++ stDmaCfg->stDmaChcfg[DmaChIndex].rd_outst_en = 0; ++ } ++ } ++ ISP_WRAP_DMA_ERR_DEC_CFG_S *stErrDecCfg = &pstDmaAttr.stErrDecCfg; ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_dec_unit = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_dec_unit = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].wr_err_gen_thr = 255; ++ stErrDecCfg->stDmaChErrDecCfg[DmaChIndex].rd_err_gen_thr = 255; ++ } + ISP_WRAP_DMA_ERR_STATUS_S *stErrStatus = &pstDmaAttr.stErrStatus; +- for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) +- { +- stErrStatus->stDmaErrStatus[DmaChIndex].err_y_wr_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_uv_wr_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_raw_read_status = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_wr_rst_req = 0; +- stErrStatus->stDmaErrStatus[DmaChIndex].err_rd_rst_req = 0; +- } +- Isp_Drv_R2k_Wrap_SetDma(isp,&pstDmaAttr); ++ for(DmaChIndex=0; DmaChIndex < ISP_DMA_CH_NUM; DmaChIndex++) ++ { ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_y_wr_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_uv_wr_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_raw_read_status = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_wr_rst_req = 0; ++ stErrStatus->stDmaErrStatus[DmaChIndex].err_rd_rst_req = 0; ++ } ++ Isp_Drv_R2k_Wrap_SetDma(isp,&pstDmaAttr); + } + // + int isp_r2k_wrap_SetAxiCtl(struct k510_isp_device *isp) + { +- return 0; +- ISP_WRAP_AXI_CTL_S pstAxiCtl; ++ return 0; ++ ISP_WRAP_AXI_CTL_S pstAxiCtl; + pstAxiCtl.axi_wr_ch_rst_req = 1; + pstAxiCtl.axi_rd_ch_rst_req = 1; +- Isp_Drv_R2k_Wrap_SetAxiCtl(isp,&pstAxiCtl); ++ Isp_Drv_R2k_Wrap_SetAxiCtl(isp,&pstAxiCtl); + return 0; + } + /* +-*int mask +-*/ ++ *int mask ++ */ + int isp_r2k_wrap_SetIntMask(struct k510_isp_device *isp) + { + + ISP_WRAP_CORE_INT_CTL_S stCoreIntCtl; +- stCoreIntCtl.int_raw_in_mask= 1 ; +- stCoreIntCtl.int_3a_mask= 1 ; +- stCoreIntCtl.raw_int_mask= 1 ; +- stCoreIntCtl.rgb_int_mask= 1 ; +- stCoreIntCtl.yuv_int_mask= 1 ; +- stCoreIntCtl.ldc_int_mask= 1 ; +- stCoreIntCtl.main_out_int_mask= 1 ; +- stCoreIntCtl.isp_awb_int_mask= 1 ; +- stCoreIntCtl.isp_ae_int_mask= 1 ; +- stCoreIntCtl.isp_af_int_mask= 1 ; +- Isp_Drv_R2k_Wrap_SetCoreIntCtlMask(isp,&stCoreIntCtl); +- ISP_WRAP_DMA_WR_INT_MASK0_S stDmaWRMask0; +- stDmaWRMask0.wr_3dnr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wr_3dnr_uv_err_immediate_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.ldc_wr_uv_err_immediate_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_frm_end_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_line_base_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.wdr_wr_raw_err_immediate_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_line_base_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_y_err_immediate_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_line_base_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_err_frm_end_int_mask= 1 ; +- stDmaWRMask0.main_out_wr_uv_err_immediate_int_mask= 1 ; +- Isp_Drv_R2k_Wrap_SetDmaWRIntMask0(isp,&stDmaWRMask0); +- ISP_WRAP_DMA_WR_INT_MASK1_S stDmaWRMask1; +- stDmaWRMask1.ds0_out_wr_y_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_line_base_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_y_err_immediate_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_line_base_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds0_out_wr_uv_err_immediate_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_line_base_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_y_err_immediate_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_line_base_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds1_out_wr_uv_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_r_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_g_err_immediate_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_line_base_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_err_frm_end_mask= 1 ; +- stDmaWRMask1.ds2_out_wr_b_err_immediate_mask= 1 ; +- Isp_Drv_R2k_Wrap_SetDmaWRIntMask1(isp,&stDmaWRMask1); +- ISP_WRAP_DMA_RD_INT_MASK0_S stDmaRDMask0; +- stDmaRDMask0.rd_3dnr_y_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_line_base_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_y_err_immediate_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_line_base_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.rd_3dnr_uv_err_immediate_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_line_base_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_y_err_immediate_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_line_base_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.ldc_rd_uv_err_immediate_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_frm_end_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_line_base_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_err_frm_end_int_mask= 1 ; +- stDmaRDMask0.wdr_rd_raw_err_immediate_int_mask= 1 ; +- Isp_Drv_R2k_Wrap_SetDmaRDIntMask0(isp,&stDmaRDMask0); ++ stCoreIntCtl.int_raw_in_mask= 1 ; ++ stCoreIntCtl.int_3a_mask= 1 ; ++ stCoreIntCtl.raw_int_mask= 1 ; ++ stCoreIntCtl.rgb_int_mask= 1 ; ++ stCoreIntCtl.yuv_int_mask= 1 ; ++ stCoreIntCtl.ldc_int_mask= 1 ; ++ stCoreIntCtl.main_out_int_mask= 1 ; ++ stCoreIntCtl.isp_awb_int_mask= 1 ; ++ stCoreIntCtl.isp_ae_int_mask= 1 ; ++ stCoreIntCtl.isp_af_int_mask= 1 ; ++ Isp_Drv_R2k_Wrap_SetCoreIntCtlMask(isp,&stCoreIntCtl); ++ ISP_WRAP_DMA_WR_INT_MASK0_S stDmaWRMask0; ++ stDmaWRMask0.wr_3dnr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wr_3dnr_uv_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.ldc_wr_uv_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_line_base_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.wdr_wr_raw_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_line_base_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_y_err_immediate_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_line_base_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_err_frm_end_int_mask= 1 ; ++ stDmaWRMask0.main_out_wr_uv_err_immediate_int_mask= 1 ; ++ Isp_Drv_R2k_Wrap_SetDmaWRIntMask0(isp,&stDmaWRMask0); ++ ISP_WRAP_DMA_WR_INT_MASK1_S stDmaWRMask1; ++ stDmaWRMask1.ds0_out_wr_y_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_line_base_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_y_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_line_base_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds0_out_wr_uv_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_line_base_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_y_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_line_base_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds1_out_wr_uv_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_r_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_g_err_immediate_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_line_base_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_err_frm_end_mask= 1 ; ++ stDmaWRMask1.ds2_out_wr_b_err_immediate_mask= 1 ; ++ Isp_Drv_R2k_Wrap_SetDmaWRIntMask1(isp,&stDmaWRMask1); ++ ISP_WRAP_DMA_RD_INT_MASK0_S stDmaRDMask0; ++ stDmaRDMask0.rd_3dnr_y_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_line_base_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_y_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_line_base_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.rd_3dnr_uv_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_line_base_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_y_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_line_base_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.ldc_rd_uv_err_immediate_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_frm_end_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_line_base_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_err_frm_end_int_mask= 1 ; ++ stDmaRDMask0.wdr_rd_raw_err_immediate_int_mask= 1 ; ++ Isp_Drv_R2k_Wrap_SetDmaRDIntMask0(isp,&stDmaRDMask0); + } + // + int isp_r2k_wrap_SetConfigDone(struct k510_isp_device *isp,unsigned int wp_en) + { + +- ISP_WRAP_CONFIG_DONE_S pstConfigDone; ++ ISP_WRAP_CONFIG_DONE_S pstConfigDone; + pstConfigDone.int_polarity = 1; + pstConfigDone.sen_reg_pro_en = wp_en;//0; + if( wp_en == 1) +@@ -594,9 +594,9 @@ int isp_r2k_wrap_SetConfigDone(struct k510_isp_device *isp,unsigned int wp_en) + } + else + { +- pstConfigDone.wrap_config_done_en = 1; ++ pstConfigDone.wrap_config_done_en = 1; + } +- Isp_Drv_R2k_Wrap_SetConfigdoneCtl(isp,&pstConfigDone); ++ Isp_Drv_R2k_Wrap_SetConfigdoneCtl(isp,&pstConfigDone); + return 0; + } + // +@@ -621,9 +621,9 @@ int isp_r2k_wrap_reset(struct k510_isp_device *isp) + printk("%s>AXI_CTL = 0x%x\n", __func__, axi_ctl); + while(1) + { +- //wait AXI request finish +- if(axi_ctl.bits.axi_wr_ch_state == 1 && axi_ctl.bits.axi_rd_ch_state == 1) +- break; ++ //wait AXI request finish ++ if(axi_ctl.bits.axi_wr_ch_state == 1 && axi_ctl.bits.axi_rd_ch_state == 1) ++ break; + } + + isp_r2k_wrap_SetConfigDone(isp,1); +@@ -645,61 +645,61 @@ static int isp_r2k_wrap_config(struct isp_r2k_device *r2k,struct isp_wrap_cfg_in + + struct k510_isp_device *isp = to_isp_device(r2k); + isp_r2k_wrap_SetConfigDone(isp,1); +- // +- isp_r2k_wrap_SetComRst(isp); +- // +- isp_r2k_wrap_SetDmaRst(isp); +- // ++ // ++ isp_r2k_wrap_SetComRst(isp); ++ // ++ isp_r2k_wrap_SetDmaRst(isp); ++ // + unsigned int external_out_ch_sel = isp_wrap_cfg->isp_out_sel; + Isp_Drv_R2k_Wrap_SetModeCtl_OutSel(isp,external_out_ch_sel); +- // ++ // + unsigned int dvp_input_ch_type = isp_wrap_cfg->dvp_ch_mode; + Isp_Drv_R2k_Wrap_SetModeCtl_DvpMode(isp,dvp_input_ch_type); +- // +- isp_r2k_wrap_SetPipeClkCtl(isp); +- // ++ // ++ isp_r2k_wrap_SetPipeClkCtl(isp); ++ // + struct isp_wrap_ldc_info *ldcInfo = &isp_wrap_cfg->ldcInfo; + isp_r2k_wrap_SetLdc(isp,ldcInfo); +- // ++ // + struct isp_wrap_main_info *mainInfo = &isp_wrap_cfg->mainInfo; + isp_r2k_wrap_SetMainOut(isp,mainInfo); +- // ++ // + struct isp_wrap_ds0_info *ds0Info = &isp_wrap_cfg->ds0Info; + isp_r2k_wrap_SetDs0Out(isp,ds0Info); +- // ++ // + struct isp_wrap_ds1_info *ds1Info = &isp_wrap_cfg->ds1Info; + isp_r2k_wrap_SetDs1Out(isp,ds1Info); +- // ++ // + struct isp_wrap_ds2_info *ds2Info = &isp_wrap_cfg->ds2Info; + + isp_r2k_wrap_SetDs2Out(isp,ds2Info); + // + isp_r2k_wrap_SetDmaConfig(isp); +- // ++ // + isp_r2k_wrap_SetAxiCtl(isp); +- // ++ // + isp_r2k_wrap_SetIntMask(isp); +- // ++ // + isp_r2k_wrap_SetConfigDone(isp,0); + + return 0; + } + /**************************************************************************** +-*wrap int +-*****************************************************************************/ ++ *wrap int ++ *****************************************************************************/ + int isp_r2k_wrap_setIntCore(struct k510_isp_device *isp,struct isp_wrap_intcore_info *intCoreEn) + { +- ISP_WRAP_CORE_INT_CTL_S coreIntMask; +- coreIntMask.int_raw_in_mask = ~intCoreEn->int_raw_in_en; +- coreIntMask.int_3a_mask = ~intCoreEn->int_3a_en; +- coreIntMask.raw_int_mask = ~intCoreEn->raw_int_en; +- coreIntMask.rgb_int_mask = ~intCoreEn->rgb_int_en; +- coreIntMask.yuv_int_mask = ~intCoreEn->yuv_int_en; +- coreIntMask.ldc_int_mask = ~intCoreEn->ldc_int_en; +- coreIntMask.main_out_int_mask = ~intCoreEn->main_out_int_en; +- coreIntMask.isp_awb_int_mask = ~intCoreEn->isp_awb_int_en; +- coreIntMask.isp_ae_int_mask = ~intCoreEn->isp_ae_int_en; +- coreIntMask.isp_af_int_mask = ~intCoreEn->isp_af_int_en; ++ ISP_WRAP_CORE_INT_CTL_S coreIntMask; ++ coreIntMask.int_raw_in_mask = ~intCoreEn->int_raw_in_en; ++ coreIntMask.int_3a_mask = ~intCoreEn->int_3a_en; ++ coreIntMask.raw_int_mask = ~intCoreEn->raw_int_en; ++ coreIntMask.rgb_int_mask = ~intCoreEn->rgb_int_en; ++ coreIntMask.yuv_int_mask = ~intCoreEn->yuv_int_en; ++ coreIntMask.ldc_int_mask = ~intCoreEn->ldc_int_en; ++ coreIntMask.main_out_int_mask = ~intCoreEn->main_out_int_en; ++ coreIntMask.isp_awb_int_mask = ~intCoreEn->isp_awb_int_en; ++ coreIntMask.isp_ae_int_mask = ~intCoreEn->isp_ae_int_en; ++ coreIntMask.isp_af_int_mask = ~intCoreEn->isp_af_int_en; + Isp_Drv_R2k_Wrap_SetCoreIntCtlMask(isp,&coreIntMask); + return 0; + }; +@@ -707,35 +707,35 @@ int isp_r2k_wrap_setIntCore(struct k510_isp_device *isp,struct isp_wrap_intcore_ + int isp_r2k_wrap_setIntWr0(struct k510_isp_device *isp,struct isp_wrap_intwr0_info *intWr0En) + { + +- ISP_WRAP_DMA_WR_INT_MASK0_S wrIntMask0; +- wrIntMask0.wr_3dnr_y_frm_end_int_mask = ~intWr0En->wr_3dnr_y_frm_end_int_en; +- wrIntMask0.wr_3dnr_y_line_base_int_mask = ~intWr0En->wr_3dnr_y_line_base_int_en; +- wrIntMask0.wr_3dnr_y_err_frm_end_int_mask = ~intWr0En->wr_3dnr_y_err_frm_end_int_en; +- wrIntMask0.wr_3dnr_y_err_immediate_int_mask = ~intWr0En->wr_3dnr_y_err_immediate_int_en; +- wrIntMask0.wr_3dnr_uv_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_frm_end_int_en; +- wrIntMask0.wr_3dnr_uv_line_base_int_mask = ~intWr0En->wr_3dnr_uv_line_base_int_en; +- wrIntMask0.wr_3dnr_uv_err_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_err_frm_end_int_en; +- wrIntMask0.wr_3dnr_uv_err_immediate_int_mask = ~intWr0En->wr_3dnr_uv_err_immediate_int_en; +- wrIntMask0.ldc_wr_y_frm_end_int_mask = ~intWr0En->ldc_wr_y_frm_end_int_en; +- wrIntMask0.ldc_wr_y_line_base_int_mask = ~intWr0En->ldc_wr_y_line_base_int_en; +- wrIntMask0.ldc_wr_y_err_frm_end_int_mask = ~intWr0En->ldc_wr_y_err_frm_end_int_en; +- wrIntMask0.ldc_wr_y_err_immediate_int_mask = ~intWr0En->ldc_wr_y_err_immediate_int_en; +- wrIntMask0.ldc_wr_uv_frm_end_int_mask = ~intWr0En->ldc_wr_uv_frm_end_int_en; +- wrIntMask0.ldc_wr_uv_line_base_int_mask = ~intWr0En->ldc_wr_uv_line_base_int_en; +- wrIntMask0.ldc_wr_uv_err_frm_end_int_mask = ~intWr0En->ldc_wr_uv_err_frm_end_int_en; +- wrIntMask0.ldc_wr_uv_err_immediate_int_mask = ~intWr0En->ldc_wr_uv_err_immediate_int_en; +- wrIntMask0.wdr_wr_raw_frm_end_int_mask = ~intWr0En->wdr_wr_raw_frm_end_int_en; +- wrIntMask0.wdr_wr_raw_line_base_int_mask = ~intWr0En->wdr_wr_raw_line_base_int_en; +- wrIntMask0.wdr_wr_raw_err_frm_end_int_mask = ~intWr0En->wdr_wr_raw_err_frm_end_int_en; +- wrIntMask0.wdr_wr_raw_err_immediate_int_mask = ~intWr0En->wdr_wr_raw_err_immediate_int_en; +- wrIntMask0.main_out_wr_y_frm_end_int_mask = ~intWr0En->main_out_wr_y_frm_end_int_en; +- wrIntMask0.main_out_wr_y_line_base_int_mask = ~intWr0En->main_out_wr_y_line_base_int_en; +- wrIntMask0.main_out_wr_y_err_frm_end_int_mask = ~intWr0En->main_out_wr_y_err_frm_end_int_en; +- wrIntMask0.main_out_wr_y_err_immediate_int_mask = ~intWr0En->main_out_wr_y_err_immediate_int_en; +- wrIntMask0.main_out_wr_uv_frm_end_int_mask = ~intWr0En->main_out_wr_uv_frm_end_int_en; +- wrIntMask0.main_out_wr_uv_line_base_int_mask = ~intWr0En->main_out_wr_uv_line_base_int_en; +- wrIntMask0.main_out_wr_uv_err_frm_end_int_mask = ~intWr0En->main_out_wr_uv_err_frm_end_int_en; +- wrIntMask0.main_out_wr_uv_err_immediate_int_mask = ~intWr0En->main_out_wr_uv_err_immediate_int_en; ++ ISP_WRAP_DMA_WR_INT_MASK0_S wrIntMask0; ++ wrIntMask0.wr_3dnr_y_frm_end_int_mask = ~intWr0En->wr_3dnr_y_frm_end_int_en; ++ wrIntMask0.wr_3dnr_y_line_base_int_mask = ~intWr0En->wr_3dnr_y_line_base_int_en; ++ wrIntMask0.wr_3dnr_y_err_frm_end_int_mask = ~intWr0En->wr_3dnr_y_err_frm_end_int_en; ++ wrIntMask0.wr_3dnr_y_err_immediate_int_mask = ~intWr0En->wr_3dnr_y_err_immediate_int_en; ++ wrIntMask0.wr_3dnr_uv_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_frm_end_int_en; ++ wrIntMask0.wr_3dnr_uv_line_base_int_mask = ~intWr0En->wr_3dnr_uv_line_base_int_en; ++ wrIntMask0.wr_3dnr_uv_err_frm_end_int_mask = ~intWr0En->wr_3dnr_uv_err_frm_end_int_en; ++ wrIntMask0.wr_3dnr_uv_err_immediate_int_mask = ~intWr0En->wr_3dnr_uv_err_immediate_int_en; ++ wrIntMask0.ldc_wr_y_frm_end_int_mask = ~intWr0En->ldc_wr_y_frm_end_int_en; ++ wrIntMask0.ldc_wr_y_line_base_int_mask = ~intWr0En->ldc_wr_y_line_base_int_en; ++ wrIntMask0.ldc_wr_y_err_frm_end_int_mask = ~intWr0En->ldc_wr_y_err_frm_end_int_en; ++ wrIntMask0.ldc_wr_y_err_immediate_int_mask = ~intWr0En->ldc_wr_y_err_immediate_int_en; ++ wrIntMask0.ldc_wr_uv_frm_end_int_mask = ~intWr0En->ldc_wr_uv_frm_end_int_en; ++ wrIntMask0.ldc_wr_uv_line_base_int_mask = ~intWr0En->ldc_wr_uv_line_base_int_en; ++ wrIntMask0.ldc_wr_uv_err_frm_end_int_mask = ~intWr0En->ldc_wr_uv_err_frm_end_int_en; ++ wrIntMask0.ldc_wr_uv_err_immediate_int_mask = ~intWr0En->ldc_wr_uv_err_immediate_int_en; ++ wrIntMask0.wdr_wr_raw_frm_end_int_mask = ~intWr0En->wdr_wr_raw_frm_end_int_en; ++ wrIntMask0.wdr_wr_raw_line_base_int_mask = ~intWr0En->wdr_wr_raw_line_base_int_en; ++ wrIntMask0.wdr_wr_raw_err_frm_end_int_mask = ~intWr0En->wdr_wr_raw_err_frm_end_int_en; ++ wrIntMask0.wdr_wr_raw_err_immediate_int_mask = ~intWr0En->wdr_wr_raw_err_immediate_int_en; ++ wrIntMask0.main_out_wr_y_frm_end_int_mask = ~intWr0En->main_out_wr_y_frm_end_int_en; ++ wrIntMask0.main_out_wr_y_line_base_int_mask = ~intWr0En->main_out_wr_y_line_base_int_en; ++ wrIntMask0.main_out_wr_y_err_frm_end_int_mask = ~intWr0En->main_out_wr_y_err_frm_end_int_en; ++ wrIntMask0.main_out_wr_y_err_immediate_int_mask = ~intWr0En->main_out_wr_y_err_immediate_int_en; ++ wrIntMask0.main_out_wr_uv_frm_end_int_mask = ~intWr0En->main_out_wr_uv_frm_end_int_en; ++ wrIntMask0.main_out_wr_uv_line_base_int_mask = ~intWr0En->main_out_wr_uv_line_base_int_en; ++ wrIntMask0.main_out_wr_uv_err_frm_end_int_mask = ~intWr0En->main_out_wr_uv_err_frm_end_int_en; ++ wrIntMask0.main_out_wr_uv_err_immediate_int_mask = ~intWr0En->main_out_wr_uv_err_immediate_int_en; + dev_dbg(isp->dev,"%s:wrIntMask0(0x%x)\n",__func__,wrIntMask0); + Isp_Drv_R2k_Wrap_SetDmaWRIntMask0(isp,&wrIntMask0); + return 0; +@@ -743,7 +743,7 @@ int isp_r2k_wrap_setIntWr0(struct k510_isp_device *isp,struct isp_wrap_intwr0_in + // + int isp_r2k_wrap_setIntWr1(struct k510_isp_device *isp,struct isp_wrap_intwr1_info *intWr1En) + { +- ISP_WRAP_DMA_WR_INT_MASK1_S wrIntMask1; ++ ISP_WRAP_DMA_WR_INT_MASK1_S wrIntMask1; + wrIntMask1.ds0_out_wr_y_frm_end_mask = ~intWr1En->ds0_out_wr_y_frm_end_en; + wrIntMask1.ds0_out_wr_y_line_base_mask = ~intWr1En->ds0_out_wr_y_line_base_en; + wrIntMask1.ds0_out_wr_y_err_frm_end_mask = ~intWr1En->ds0_out_wr_y_err_frm_end_en; +@@ -780,27 +780,27 @@ int isp_r2k_wrap_setIntWr1(struct k510_isp_device *isp,struct isp_wrap_intwr1_in + int isp_r2k_wrap_setIntRd0(struct k510_isp_device *isp,struct isp_wrap_intrd0_info *intRd0En) + { + +- ISP_WRAP_DMA_RD_INT_MASK0_S rdIntMask0; +- rdIntMask0.rd_3dnr_y_frm_end_int_mask = ~intRd0En->rd_3dnr_y_frm_end_int_en; +- rdIntMask0.rd_3dnr_y_line_base_int_mask = ~intRd0En->rd_3dnr_y_line_base_int_en; +- rdIntMask0.rd_3dnr_y_err_frm_end_int_mask = ~intRd0En->rd_3dnr_y_err_frm_end_int_en; +- rdIntMask0.rd_3dnr_y_err_immediate_int_mask = ~intRd0En->rd_3dnr_y_err_immediate_int_en; +- rdIntMask0.rd_3dnr_uv_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_frm_end_int_en; +- rdIntMask0.rd_3dnr_uv_line_base_int_mask = ~intRd0En->rd_3dnr_uv_line_base_int_en; +- rdIntMask0.rd_3dnr_uv_err_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_err_frm_end_int_en; +- rdIntMask0.rd_3dnr_uv_err_immediate_int_mask = ~intRd0En->rd_3dnr_uv_err_immediate_int_en; +- rdIntMask0.ldc_rd_y_frm_end_int_mask = ~intRd0En->ldc_rd_y_frm_end_int_en; +- rdIntMask0.ldc_rd_y_line_base_int_mask = ~intRd0En->ldc_rd_y_line_base_int_en; +- rdIntMask0.ldc_rd_y_err_frm_end_int_mask = ~intRd0En->ldc_rd_y_err_frm_end_int_en; +- rdIntMask0.ldc_rd_y_err_immediate_int_mask = ~intRd0En->ldc_rd_y_err_immediate_int_en; +- rdIntMask0.ldc_rd_uv_frm_end_int_mask = ~intRd0En->ldc_rd_uv_frm_end_int_en; +- rdIntMask0.ldc_rd_uv_line_base_int_mask = ~intRd0En->ldc_rd_uv_line_base_int_en; +- rdIntMask0.ldc_rd_uv_err_frm_end_int_mask = ~intRd0En->ldc_rd_uv_err_frm_end_int_en; +- rdIntMask0.ldc_rd_uv_err_immediate_int_mask = ~intRd0En->ldc_rd_uv_err_immediate_int_en; +- rdIntMask0.wdr_rd_raw_frm_end_int_mask = ~intRd0En->wdr_rd_raw_frm_end_int_en; +- rdIntMask0.wdr_rd_raw_line_base_int_mask = ~intRd0En->wdr_rd_raw_line_base_int_en; +- rdIntMask0.wdr_rd_raw_err_frm_end_int_mask = ~intRd0En->wdr_rd_raw_err_frm_end_int_en; +- rdIntMask0.wdr_rd_raw_err_immediate_int_mask = ~intRd0En->wdr_rd_raw_err_immediate_int_en; ++ ISP_WRAP_DMA_RD_INT_MASK0_S rdIntMask0; ++ rdIntMask0.rd_3dnr_y_frm_end_int_mask = ~intRd0En->rd_3dnr_y_frm_end_int_en; ++ rdIntMask0.rd_3dnr_y_line_base_int_mask = ~intRd0En->rd_3dnr_y_line_base_int_en; ++ rdIntMask0.rd_3dnr_y_err_frm_end_int_mask = ~intRd0En->rd_3dnr_y_err_frm_end_int_en; ++ rdIntMask0.rd_3dnr_y_err_immediate_int_mask = ~intRd0En->rd_3dnr_y_err_immediate_int_en; ++ rdIntMask0.rd_3dnr_uv_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_frm_end_int_en; ++ rdIntMask0.rd_3dnr_uv_line_base_int_mask = ~intRd0En->rd_3dnr_uv_line_base_int_en; ++ rdIntMask0.rd_3dnr_uv_err_frm_end_int_mask = ~intRd0En->rd_3dnr_uv_err_frm_end_int_en; ++ rdIntMask0.rd_3dnr_uv_err_immediate_int_mask = ~intRd0En->rd_3dnr_uv_err_immediate_int_en; ++ rdIntMask0.ldc_rd_y_frm_end_int_mask = ~intRd0En->ldc_rd_y_frm_end_int_en; ++ rdIntMask0.ldc_rd_y_line_base_int_mask = ~intRd0En->ldc_rd_y_line_base_int_en; ++ rdIntMask0.ldc_rd_y_err_frm_end_int_mask = ~intRd0En->ldc_rd_y_err_frm_end_int_en; ++ rdIntMask0.ldc_rd_y_err_immediate_int_mask = ~intRd0En->ldc_rd_y_err_immediate_int_en; ++ rdIntMask0.ldc_rd_uv_frm_end_int_mask = ~intRd0En->ldc_rd_uv_frm_end_int_en; ++ rdIntMask0.ldc_rd_uv_line_base_int_mask = ~intRd0En->ldc_rd_uv_line_base_int_en; ++ rdIntMask0.ldc_rd_uv_err_frm_end_int_mask = ~intRd0En->ldc_rd_uv_err_frm_end_int_en; ++ rdIntMask0.ldc_rd_uv_err_immediate_int_mask = ~intRd0En->ldc_rd_uv_err_immediate_int_en; ++ rdIntMask0.wdr_rd_raw_frm_end_int_mask = ~intRd0En->wdr_rd_raw_frm_end_int_en; ++ rdIntMask0.wdr_rd_raw_line_base_int_mask = ~intRd0En->wdr_rd_raw_line_base_int_en; ++ rdIntMask0.wdr_rd_raw_err_frm_end_int_mask = ~intRd0En->wdr_rd_raw_err_frm_end_int_en; ++ rdIntMask0.wdr_rd_raw_err_immediate_int_mask = ~intRd0En->wdr_rd_raw_err_immediate_int_en; + Isp_Drv_R2k_Wrap_SetDmaRDIntMask0(isp,&rdIntMask0); + return 0; + } +@@ -866,40 +866,40 @@ void k510isp_r2k_irq_enable(struct k510_isp_device *isp,struct isp_irq_info *irq + } + /********************************************************************************* + * ISP CORE +-**********************************************************************************/ ++ **********************************************************************************/ + //ITC + static int isp_r2k_core_SetItc(struct k510_isp_device *isp,ITC_INFO_S *itcInfo) + { + +- ISP_CORE_ITC_CTL_S stItcCtl; ++ ISP_CORE_ITC_CTL_S stItcCtl; + stItcCtl.hsync_pol = itcInfo->hsync_pol; +- stItcCtl.vsync_pol = itcInfo->vsync_pol; +- stItcCtl.hsync_input_timing = itcInfo->hsync_input_timing; +- stItcCtl.vsync_input_timing = itcInfo->vsync_input_timing; +- stItcCtl.mirror_ctl = itcInfo->flip_ctl; +- stItcCtl.video_format_ctl = itcInfo->video_fmt_sel; +- Isp_Drv_R2k_Core_SetItcCtl(isp,&stItcCtl); ++ stItcCtl.vsync_pol = itcInfo->vsync_pol; ++ stItcCtl.hsync_input_timing = itcInfo->hsync_input_timing; ++ stItcCtl.vsync_input_timing = itcInfo->vsync_input_timing; ++ stItcCtl.mirror_ctl = itcInfo->flip_ctl; ++ stItcCtl.video_format_ctl = itcInfo->video_fmt_sel; ++ Isp_Drv_R2k_Core_SetItcCtl(isp,&stItcCtl); + return 0; + } + //IMAGE + static int isp_r2k_core_SetImage(struct k510_isp_device *isp,ITC_INFO_S *itcInfo) + { + +- ISP_CORE_IMAGE_ATTR_S stImgAttr; +- stImgAttr.image_height = itcInfo->total_size.Height - 1; +- stImgAttr.image_width = itcInfo->total_size.Width - 1; +- stImgAttr.image_v_start = itcInfo->itc_size.Height_st; +- stImgAttr.image_h_start = itcInfo->itc_size.Width_st; +- stImgAttr.image_active_width = itcInfo->itc_size.Width; +- stImgAttr.image_active_height = itcInfo->itc_size.Height; +- Isp_Drv_R2k_Core_SetImageAttr(isp,&stImgAttr); ++ ISP_CORE_IMAGE_ATTR_S stImgAttr; ++ stImgAttr.image_height = itcInfo->total_size.Height - 1; ++ stImgAttr.image_width = itcInfo->total_size.Width - 1; ++ stImgAttr.image_v_start = itcInfo->itc_size.Height_st; ++ stImgAttr.image_h_start = itcInfo->itc_size.Width_st; ++ stImgAttr.image_active_width = itcInfo->itc_size.Width; ++ stImgAttr.image_active_height = itcInfo->itc_size.Height; ++ Isp_Drv_R2k_Core_SetImageAttr(isp,&stImgAttr); + return 0; + } + //TPG + static int isp_r2k_core_SetTpgCtl(struct k510_isp_device *isp,TPG_INFO_S *tpgInfo) + { + +- ISP_CORE_TEST_CTL_S stTestCtl; ++ ISP_CORE_TEST_CTL_S stTestCtl; + stTestCtl.test_pattern_en = tpgInfo->tpg_en; + stTestCtl.bayer_mode_sel = tpgInfo->bayer_mode_sel; + stTestCtl.motion_mode_sel = tpgInfo->motion_mode_sel; +@@ -907,78 +907,78 @@ static int isp_r2k_core_SetTpgCtl(struct k510_isp_device *isp,TPG_INFO_S *tpgInf + stTestCtl.wdr_l_mul_data = tpgInfo->wdr_l_mul_data; + stTestCtl.wdr_m_mul_data = tpgInfo->wdr_m_mul_data; + stTestCtl.wdr_s_mul_data = tpgInfo->wdr_s_mul_data; +- Isp_Drv_R2k_Core_SetTestCtl(isp,&stTestCtl); ++ Isp_Drv_R2k_Core_SetTestCtl(isp,&stTestCtl); + return 0; + } + //BLC + static int isp_r2k_core_SetBlcCtl(struct k510_isp_device *isp,BLC_INFO_S *blcInfo) + { + +- ISP_CORE_BLC_CTL_S stBlcCtl; ++ ISP_CORE_BLC_CTL_S stBlcCtl; + stBlcCtl.blc_en = blcInfo->blc_en; + stBlcCtl.blc_offset = blcInfo->blc_offset; + stBlcCtl.blc_ratio = blcInfo->blc_ratio; +- Isp_Drv_R2k_Core_SetBlcCtl(isp,&stBlcCtl); ++ Isp_Drv_R2k_Core_SetBlcCtl(isp,&stBlcCtl); + return 0; + } + //LSC + static int isp_r2k_core_SetLscCtl(struct k510_isp_device *isp,LSC_INFO_S *lscInfo) + { + +- ISP_CORE_LSC_CTL_S stLscCtl; +- stLscCtl.lsc_en = lscInfo->lsc_en; +- stLscCtl.lsc_h_center = lscInfo->lsc_h_center; +- stLscCtl.lsc_v_center = lscInfo->lsc_v_center; +- stLscCtl.lsc_red_ratio = lscInfo->lsc_r_ratio; +- stLscCtl.lsc_green_ratio = lscInfo->lsc_g_ratio; +- stLscCtl.lsc_blue_ratio = lscInfo->lsc_b_ratio; +- stLscCtl.lsc_ir_ratio = lscInfo->lsc_ir_ratio; +- Isp_Drv_R2k_Core_SetLscCtl(isp,&stLscCtl); ++ ISP_CORE_LSC_CTL_S stLscCtl; ++ stLscCtl.lsc_en = lscInfo->lsc_en; ++ stLscCtl.lsc_h_center = lscInfo->lsc_h_center; ++ stLscCtl.lsc_v_center = lscInfo->lsc_v_center; ++ stLscCtl.lsc_red_ratio = lscInfo->lsc_r_ratio; ++ stLscCtl.lsc_green_ratio = lscInfo->lsc_g_ratio; ++ stLscCtl.lsc_blue_ratio = lscInfo->lsc_b_ratio; ++ stLscCtl.lsc_ir_ratio = lscInfo->lsc_ir_ratio; ++ Isp_Drv_R2k_Core_SetLscCtl(isp,&stLscCtl); + return 0; + } + //AE + static int isp_r2k_core_SetAeCtl(struct k510_isp_device *isp,AE_INFO_S *aeInfo) + { + +- ISP_CORE_AE_CTL_S stAeCtl; +- stAeCtl.ae_as_en = aeInfo->ae_as_en; +- stAeCtl.ae_ag_en = aeInfo->ae_ag_en; +- stAeCtl.ae_airis_en = aeInfo->ae_airis_en; +- stAeCtl.ae_enter_ls_sel = aeInfo->ae_enter_ls_sel; +- stAeCtl.ae_exit_ls_sel = aeInfo->ae_exit_ls_sel; +- stAeCtl.ae_win_mode_sel = aeInfo->ae_win_mode_sel; +- stAeCtl.ae_back_light_mode_sel = aeInfo->ae_back_light_mode_sel; +- stAeCtl.ae_day_change_en = aeInfo->ae_day_change_en; +- stAeCtl.ae_day_change_sel = aeInfo->ae_day_change_sel; +- stAeCtl.ae_win_h_start = aeInfo->ae_win_size.h_start; +- stAeCtl.ae_win_v_start = aeInfo->ae_win_size.v_start; +- stAeCtl.ae_win_h_end = aeInfo->ae_win_size.h_end; +- stAeCtl.ae_win_v_end = aeInfo->ae_win_size.v_end; +- stAeCtl.ae_tar_bright = aeInfo->ae_tar_bright; +- stAeCtl.ae_tar_bright_range = aeInfo->ae_tar_bright_range; +- stAeCtl.ae_l_ex_time = aeInfo->ae_l_ex_time; +- stAeCtl.ae_m_ex_time = aeInfo->ae_m_ex_time; +- stAeCtl.ae_s_ex_time = aeInfo->ae_s_ex_time; +- stAeCtl.ae_agc = aeInfo->ae_agc; +- stAeCtl.ae_ad_shuttle_freq = aeInfo->ae_ad_shuttle_freq; +- stAeCtl.ae_ad_gain_freq = aeInfo->ae_ad_gain_freq; +- stAeCtl.ae_adjust_step_max = aeInfo->ae_adjust_step_max; +- stAeCtl.ae_ex_value_max = aeInfo->ae_ex_value_max; +- stAeCtl.ae_ex_value_mid = aeInfo->ae_ex_value_mid; +- stAeCtl.ae_ex_value_min = aeInfo->ae_ex_value_min; +- stAeCtl.ae_gain_value_max = aeInfo->ae_gain_value_max; +- stAeCtl.ae_gain_value_mid = aeInfo->ae_gain_value_mid; +- stAeCtl.ae_gain_value_min = aeInfo->ae_gain_value_min; +- stAeCtl.ae_dn_switch_ad_step_max = aeInfo->ae_dn_switch_ad_step_max; +- stAeCtl.ae_dn_switch_wait_time = aeInfo->ae_dn_switch_wait_time; +- stAeCtl.ape_max_diff = aeInfo->ape_max_diff; +- stAeCtl.ape_drv_signal_max = aeInfo->ape_drv_signal_max; +- stAeCtl.ape_coeff_distance = aeInfo->ape_coeff_distance; +- stAeCtl.ape_coeff_speed = aeInfo->ape_coeff_speed; +- stAeCtl.ape_coeff_acceleration = aeInfo->ape_coeff_acceleration; +- stAeCtl.ape_drv_manual_value = aeInfo->ape_drv_manual_value; +- stAeCtl.ape_damp_manual_value = aeInfo->ape_damp_manual_value; +- Isp_Drv_R2k_Core_SetAeCtl(isp,&stAeCtl); ++ ISP_CORE_AE_CTL_S stAeCtl; ++ stAeCtl.ae_as_en = aeInfo->ae_as_en; ++ stAeCtl.ae_ag_en = aeInfo->ae_ag_en; ++ stAeCtl.ae_airis_en = aeInfo->ae_airis_en; ++ stAeCtl.ae_enter_ls_sel = aeInfo->ae_enter_ls_sel; ++ stAeCtl.ae_exit_ls_sel = aeInfo->ae_exit_ls_sel; ++ stAeCtl.ae_win_mode_sel = aeInfo->ae_win_mode_sel; ++ stAeCtl.ae_back_light_mode_sel = aeInfo->ae_back_light_mode_sel; ++ stAeCtl.ae_day_change_en = aeInfo->ae_day_change_en; ++ stAeCtl.ae_day_change_sel = aeInfo->ae_day_change_sel; ++ stAeCtl.ae_win_h_start = aeInfo->ae_win_size.h_start; ++ stAeCtl.ae_win_v_start = aeInfo->ae_win_size.v_start; ++ stAeCtl.ae_win_h_end = aeInfo->ae_win_size.h_end; ++ stAeCtl.ae_win_v_end = aeInfo->ae_win_size.v_end; ++ stAeCtl.ae_tar_bright = aeInfo->ae_tar_bright; ++ stAeCtl.ae_tar_bright_range = aeInfo->ae_tar_bright_range; ++ stAeCtl.ae_l_ex_time = aeInfo->ae_l_ex_time; ++ stAeCtl.ae_m_ex_time = aeInfo->ae_m_ex_time; ++ stAeCtl.ae_s_ex_time = aeInfo->ae_s_ex_time; ++ stAeCtl.ae_agc = aeInfo->ae_agc; ++ stAeCtl.ae_ad_shuttle_freq = aeInfo->ae_ad_shuttle_freq; ++ stAeCtl.ae_ad_gain_freq = aeInfo->ae_ad_gain_freq; ++ stAeCtl.ae_adjust_step_max = aeInfo->ae_adjust_step_max; ++ stAeCtl.ae_ex_value_max = aeInfo->ae_ex_value_max; ++ stAeCtl.ae_ex_value_mid = aeInfo->ae_ex_value_mid; ++ stAeCtl.ae_ex_value_min = aeInfo->ae_ex_value_min; ++ stAeCtl.ae_gain_value_max = aeInfo->ae_gain_value_max; ++ stAeCtl.ae_gain_value_mid = aeInfo->ae_gain_value_mid; ++ stAeCtl.ae_gain_value_min = aeInfo->ae_gain_value_min; ++ stAeCtl.ae_dn_switch_ad_step_max = aeInfo->ae_dn_switch_ad_step_max; ++ stAeCtl.ae_dn_switch_wait_time = aeInfo->ae_dn_switch_wait_time; ++ stAeCtl.ape_max_diff = aeInfo->ape_max_diff; ++ stAeCtl.ape_drv_signal_max = aeInfo->ape_drv_signal_max; ++ stAeCtl.ape_coeff_distance = aeInfo->ape_coeff_distance; ++ stAeCtl.ape_coeff_speed = aeInfo->ape_coeff_speed; ++ stAeCtl.ape_coeff_acceleration = aeInfo->ape_coeff_acceleration; ++ stAeCtl.ape_drv_manual_value = aeInfo->ape_drv_manual_value; ++ stAeCtl.ape_damp_manual_value = aeInfo->ape_damp_manual_value; ++ Isp_Drv_R2k_Core_SetAeCtl(isp,&stAeCtl); + return 0; + } + static int isp_r2k_core_GetAeSts(struct k510_isp_device *isp,struct k510isp_ae_stats *ae_stats) +@@ -1001,46 +1001,46 @@ static int isp_r2k_core_GetAeSts(struct k510_isp_device *isp,struct k510isp_ae_s + static int isp_r2k_core_SetAwbCtl(struct k510_isp_device *isp,AWB_INFO_S *awbInfo) + { + +- ISP_CORE_AWB_CTL_S stAwbCtl; +- stAwbCtl.awb_d65_en = awbInfo->awb_d65_en; +- stAwbCtl.awb_ccm_en = awbInfo->awb_ccm_en; +- stAwbCtl.awb_en = awbInfo->awb_en; +- stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; +- stAwbCtl.awb_hist_mode_sel = awbInfo->awb_hist_mode_sel; +- stAwbCtl.awb_veri_en = awbInfo->awb_veri_en; +- stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; +- stAwbCtl.awb_value_save_en = awbInfo->awb_value_save_en; +- stAwbCtl.awb_ccm_adp_adjust_en = awbInfo->awb_ccm_adp_adjust_en; +- stAwbCtl.awb_stab_en = awbInfo->awb_stab_en; +- stAwbCtl.awb_d65_red_gain = awbInfo->awb_d65_red_gain; +- stAwbCtl.awb_d65_blue_gain = awbInfo->awb_d65_blue_gain; +- stAwbCtl.ccm_rr_coff = awbInfo->ccm_coff[0][0]; +- stAwbCtl.ccm_rg_coff = awbInfo->ccm_coff[0][1]; +- stAwbCtl.ccm_rb_coff = awbInfo->ccm_coff[0][2]; +- stAwbCtl.ccm_gr_coff = awbInfo->ccm_coff[1][0]; +- stAwbCtl.ccm_gg_coff = awbInfo->ccm_coff[1][1]; +- stAwbCtl.ccm_gb_coff = awbInfo->ccm_coff[1][2]; +- stAwbCtl.ccm_br_coff = awbInfo->ccm_coff[2][0]; +- stAwbCtl.ccm_bg_coff = awbInfo->ccm_coff[2][1]; +- stAwbCtl.ccm_bb_coff = awbInfo->ccm_coff[2][2]; +- stAwbCtl.ccm_correct_coff = awbInfo->ccm_correct_coff; +- stAwbCtl.awb_win_h_start = awbInfo->awb_win_size.h_start; +- stAwbCtl.awb_win_v_start = awbInfo->awb_win_size.v_start; +- stAwbCtl.awb_win_h_end = awbInfo->awb_win_size.h_end; +- stAwbCtl.awb_win_v_end = awbInfo->awb_win_size.v_end; +- stAwbCtl.awb_correct_diff_th = awbInfo->awb_correct_diff_th; +- stAwbCtl.awb_color_changeres_time = awbInfo->awb_color_changeres_time; +- stAwbCtl.awb_historgram_th = awbInfo->awb_historgram_th; +- stAwbCtl.awb_red_gain_adjust = awbInfo->awb_red_gain_adjust; +- stAwbCtl.awb_green_gain_adjust = awbInfo->awb_green_gain_adjust; +- stAwbCtl.awb_blue_gain_adjust = awbInfo->awb_blue_gain_adjust; +- stAwbCtl.awb_red_max_value = awbInfo->awb_red_max_value; +- stAwbCtl.awb_blue_max_value = awbInfo->awb_blue_max_value; +- stAwbCtl.awb_red_min_value = awbInfo->awb_red_min_value; +- stAwbCtl.awb_blue_min_value = awbInfo->awb_blue_min_value; +- stAwbCtl.awb_red_obj_value = awbInfo->awb_red_obj_value; +- stAwbCtl.awb_blue_obj_value = awbInfo->awb_blue_obj_value; +- Isp_Drv_R2k_Core_SetAwbCtl(isp,&stAwbCtl); ++ ISP_CORE_AWB_CTL_S stAwbCtl; ++ stAwbCtl.awb_d65_en = awbInfo->awb_d65_en; ++ stAwbCtl.awb_ccm_en = awbInfo->awb_ccm_en; ++ stAwbCtl.awb_en = awbInfo->awb_en; ++ stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; ++ stAwbCtl.awb_hist_mode_sel = awbInfo->awb_hist_mode_sel; ++ stAwbCtl.awb_veri_en = awbInfo->awb_veri_en; ++ stAwbCtl.awb_mode_sel = awbInfo->awb_mode_sel; ++ stAwbCtl.awb_value_save_en = awbInfo->awb_value_save_en; ++ stAwbCtl.awb_ccm_adp_adjust_en = awbInfo->awb_ccm_adp_adjust_en; ++ stAwbCtl.awb_stab_en = awbInfo->awb_stab_en; ++ stAwbCtl.awb_d65_red_gain = awbInfo->awb_d65_red_gain; ++ stAwbCtl.awb_d65_blue_gain = awbInfo->awb_d65_blue_gain; ++ stAwbCtl.ccm_rr_coff = awbInfo->ccm_coff[0][0]; ++ stAwbCtl.ccm_rg_coff = awbInfo->ccm_coff[0][1]; ++ stAwbCtl.ccm_rb_coff = awbInfo->ccm_coff[0][2]; ++ stAwbCtl.ccm_gr_coff = awbInfo->ccm_coff[1][0]; ++ stAwbCtl.ccm_gg_coff = awbInfo->ccm_coff[1][1]; ++ stAwbCtl.ccm_gb_coff = awbInfo->ccm_coff[1][2]; ++ stAwbCtl.ccm_br_coff = awbInfo->ccm_coff[2][0]; ++ stAwbCtl.ccm_bg_coff = awbInfo->ccm_coff[2][1]; ++ stAwbCtl.ccm_bb_coff = awbInfo->ccm_coff[2][2]; ++ stAwbCtl.ccm_correct_coff = awbInfo->ccm_correct_coff; ++ stAwbCtl.awb_win_h_start = awbInfo->awb_win_size.h_start; ++ stAwbCtl.awb_win_v_start = awbInfo->awb_win_size.v_start; ++ stAwbCtl.awb_win_h_end = awbInfo->awb_win_size.h_end; ++ stAwbCtl.awb_win_v_end = awbInfo->awb_win_size.v_end; ++ stAwbCtl.awb_correct_diff_th = awbInfo->awb_correct_diff_th; ++ stAwbCtl.awb_color_changeres_time = awbInfo->awb_color_changeres_time; ++ stAwbCtl.awb_historgram_th = awbInfo->awb_historgram_th; ++ stAwbCtl.awb_red_gain_adjust = awbInfo->awb_red_gain_adjust; ++ stAwbCtl.awb_green_gain_adjust = awbInfo->awb_green_gain_adjust; ++ stAwbCtl.awb_blue_gain_adjust = awbInfo->awb_blue_gain_adjust; ++ stAwbCtl.awb_red_max_value = awbInfo->awb_red_max_value; ++ stAwbCtl.awb_blue_max_value = awbInfo->awb_blue_max_value; ++ stAwbCtl.awb_red_min_value = awbInfo->awb_red_min_value; ++ stAwbCtl.awb_blue_min_value = awbInfo->awb_blue_min_value; ++ stAwbCtl.awb_red_obj_value = awbInfo->awb_red_obj_value; ++ stAwbCtl.awb_blue_obj_value = awbInfo->awb_blue_obj_value; ++ Isp_Drv_R2k_Core_SetAwbCtl(isp,&stAwbCtl); + return 0; + } + +@@ -1068,270 +1068,270 @@ static int isp_r2k_core_RegGet(struct k510_isp_device *isp,struct k510isp_reg_va + static int isp_r2k_core_SetCscCtl(struct k510_isp_device *isp,CSC_INFO_S *cscInfo) + { + +- ISP_CORE_CSC_CTL_S stCscCtl; +- stCscCtl.csc_r2y_00 = cscInfo->csc_r2y[0][0]; +- stCscCtl.csc_r2y_01 = cscInfo->csc_r2y[0][1]; +- stCscCtl.csc_r2y_02 = cscInfo->csc_r2y[0][2]; +- stCscCtl.csc_r2y_10 = cscInfo->csc_r2y[1][0]; +- stCscCtl.csc_r2y_11 = cscInfo->csc_r2y[1][1]; +- stCscCtl.csc_r2y_12 = cscInfo->csc_r2y[1][2]; +- stCscCtl.csc_r2y_20 = cscInfo->csc_r2y[2][0]; +- stCscCtl.csc_r2y_21 = cscInfo->csc_r2y[2][1]; +- stCscCtl.csc_r2y_22 = cscInfo->csc_r2y[2][2]; +- Isp_Drv_R2k_Core_SetCscCtl(isp,&stCscCtl); ++ ISP_CORE_CSC_CTL_S stCscCtl; ++ stCscCtl.csc_r2y_00 = cscInfo->csc_r2y[0][0]; ++ stCscCtl.csc_r2y_01 = cscInfo->csc_r2y[0][1]; ++ stCscCtl.csc_r2y_02 = cscInfo->csc_r2y[0][2]; ++ stCscCtl.csc_r2y_10 = cscInfo->csc_r2y[1][0]; ++ stCscCtl.csc_r2y_11 = cscInfo->csc_r2y[1][1]; ++ stCscCtl.csc_r2y_12 = cscInfo->csc_r2y[1][2]; ++ stCscCtl.csc_r2y_20 = cscInfo->csc_r2y[2][0]; ++ stCscCtl.csc_r2y_21 = cscInfo->csc_r2y[2][1]; ++ stCscCtl.csc_r2y_22 = cscInfo->csc_r2y[2][2]; ++ Isp_Drv_R2k_Core_SetCscCtl(isp,&stCscCtl); + return 0; + } + //ADA + static int isp_r2k_core_SetAdaCtl(struct k510_isp_device *isp,ADA_INFO_S *adaInfo) + { + +- ISP_CORE_ADA_CTL_S stAdaCtl; +- stAdaCtl.ada_rgb_gamma_en = adaInfo->ada_rgb_gamma_en; +- stAdaCtl.ada_yuv_gamma_en = adaInfo->ada_yuv_gamma_en; +- stAdaCtl.ada_adjust_en = adaInfo->ada_adjust_en; +- stAdaCtl.ada_img_stab_en = adaInfo->ada_img_stab_en; +- stAdaCtl.ada_ccr_en = adaInfo->ada_ccr_en; +- stAdaCtl.ada_adp_en = adaInfo->ada_adp_en; +- stAdaCtl.ada_adp_ccr_en = adaInfo->ada_adp_ccr_en; +- stAdaCtl.ada_stat_mode_sel = adaInfo->ada_stat_mode_sel; +- stAdaCtl.ada_enh_mode_sel = adaInfo->ada_enh_mode_sel; +- stAdaCtl.ada_stat_max_value = adaInfo->ada_stat_max_value; +- stAdaCtl.ada_ad_stren_max_value = adaInfo->ada_ad_stren_max_value; +- stAdaCtl.ada_win_h_start = adaInfo->ada_win_size.h_start; +- stAdaCtl.ada_win_v_start = adaInfo->ada_win_size.v_start; +- stAdaCtl.ada_win_h_end = adaInfo->ada_win_size.h_end; +- stAdaCtl.ada_win_v_end = adaInfo->ada_win_size.v_end; +- Isp_Drv_R2k_Core_SetAdaCtl(isp,&stAdaCtl); ++ ISP_CORE_ADA_CTL_S stAdaCtl; ++ stAdaCtl.ada_rgb_gamma_en = adaInfo->ada_rgb_gamma_en; ++ stAdaCtl.ada_yuv_gamma_en = adaInfo->ada_yuv_gamma_en; ++ stAdaCtl.ada_adjust_en = adaInfo->ada_adjust_en; ++ stAdaCtl.ada_img_stab_en = adaInfo->ada_img_stab_en; ++ stAdaCtl.ada_ccr_en = adaInfo->ada_ccr_en; ++ stAdaCtl.ada_adp_en = adaInfo->ada_adp_en; ++ stAdaCtl.ada_adp_ccr_en = adaInfo->ada_adp_ccr_en; ++ stAdaCtl.ada_stat_mode_sel = adaInfo->ada_stat_mode_sel; ++ stAdaCtl.ada_enh_mode_sel = adaInfo->ada_enh_mode_sel; ++ stAdaCtl.ada_stat_max_value = adaInfo->ada_stat_max_value; ++ stAdaCtl.ada_ad_stren_max_value = adaInfo->ada_ad_stren_max_value; ++ stAdaCtl.ada_win_h_start = adaInfo->ada_win_size.h_start; ++ stAdaCtl.ada_win_v_start = adaInfo->ada_win_size.v_start; ++ stAdaCtl.ada_win_h_end = adaInfo->ada_win_size.h_end; ++ stAdaCtl.ada_win_v_end = adaInfo->ada_win_size.v_end; ++ Isp_Drv_R2k_Core_SetAdaCtl(isp,&stAdaCtl); + return 0; + } + //RGBIR + static int isp_r2k_core_SetRgbirCtl(struct k510_isp_device *isp,RGBIR_INFO_S *rgbirInfo) + { + +- ISP_CORE_RGBIR_CTL_S stRgbirCtl; +- stRgbirCtl.rgbir_en = rgbirInfo->rgbir_en; +- stRgbirCtl.rgbir_rtf_en = rgbirInfo->rgbir_rtf_en; +- stRgbirCtl.rgbir_rpc_en = rgbirInfo->rgbir_rpc_en; +- stRgbirCtl.rgbir_fusion_en = rgbirInfo->rgbir_fusion_en; +- stRgbirCtl.rgbir_output_sel = rgbirInfo->rgbir_output_sel; +- stRgbirCtl.rgbir_rpc_max_value = rgbirInfo->rgbir_rpc_max_value; +- stRgbirCtl.rgbir_rpc_color_coff = rgbirInfo->rgbir_rpc_color_coff; +- stRgbirCtl.rgbir_rpc_luma_coff = rgbirInfo->rgbir_rpc_luma_coff; +- stRgbirCtl.rgbir_rpc_th = rgbirInfo->rgbir_rpc_th; +- stRgbirCtl.rgbir_rpc_th1 = rgbirInfo->rgbir_rpc_th1; +- Isp_Drv_R2k_Core_SetRgbIrCtl(isp,&stRgbirCtl); ++ ISP_CORE_RGBIR_CTL_S stRgbirCtl; ++ stRgbirCtl.rgbir_en = rgbirInfo->rgbir_en; ++ stRgbirCtl.rgbir_rtf_en = rgbirInfo->rgbir_rtf_en; ++ stRgbirCtl.rgbir_rpc_en = rgbirInfo->rgbir_rpc_en; ++ stRgbirCtl.rgbir_fusion_en = rgbirInfo->rgbir_fusion_en; ++ stRgbirCtl.rgbir_output_sel = rgbirInfo->rgbir_output_sel; ++ stRgbirCtl.rgbir_rpc_max_value = rgbirInfo->rgbir_rpc_max_value; ++ stRgbirCtl.rgbir_rpc_color_coff = rgbirInfo->rgbir_rpc_color_coff; ++ stRgbirCtl.rgbir_rpc_luma_coff = rgbirInfo->rgbir_rpc_luma_coff; ++ stRgbirCtl.rgbir_rpc_th = rgbirInfo->rgbir_rpc_th; ++ stRgbirCtl.rgbir_rpc_th1 = rgbirInfo->rgbir_rpc_th1; ++ Isp_Drv_R2k_Core_SetRgbIrCtl(isp,&stRgbirCtl); + return 0; + } + //2DNR + static int isp_r2k_core_Set2dnrCtl(struct k510_isp_device *isp,NR2D_INFO_S *nr2dInfo) + { + +- ISP_CORE_2DNR_CTL_S st2dnrCtl; +- st2dnrCtl.core_2dnr_pcf_en = nr2dInfo->d2nr_pcf_en; +- st2dnrCtl.core_2dnr_raw_en = nr2dInfo->d2nr_raw_en; +- st2dnrCtl.core_2dnr_edge_en = nr2dInfo->d2nr_edge_en; +- st2dnrCtl.core_2dnr_bap_en = nr2dInfo->d2nr_bap_en; +- st2dnrCtl.core_2dnr_luma_en = nr2dInfo->d2nr_luma_en; +- st2dnrCtl.core_2dnr_chroma_en = nr2dInfo->d2nr_chroma_en; +- st2dnrCtl.core_2dnr_pcf_adp_en = nr2dInfo->d2nr_pcf_adp_en; +- st2dnrCtl.core_2dnr_raw_adp_en = nr2dInfo->d2nr_raw_adp_en; +- st2dnrCtl.core_2dnr_luma_adp_en = nr2dInfo->d2nr_luma_adp_en; +- st2dnrCtl.core_2dnr_chroma_adp_en = nr2dInfo->d2nr_chroma_adp_en; +- st2dnrCtl.core_2dnr_raw_intensity = nr2dInfo->d2nr_raw_intensity; +- st2dnrCtl.core_2dnr_bap_intensity = nr2dInfo->d2nr_bap_intensity; +- st2dnrCtl.core_2dnr_edge_intensity = nr2dInfo->d2nr_edge_intensity; +- st2dnrCtl.core_2dnr_luma_intensity = nr2dInfo->d2nr_luma_intensity; +- st2dnrCtl.core_2dnr_chroma_intensity = nr2dInfo->d2nr_chroma_intensity; +- Isp_Drv_R2k_Core_Set2DnrCtl(isp,&st2dnrCtl); ++ ISP_CORE_2DNR_CTL_S st2dnrCtl; ++ st2dnrCtl.core_2dnr_pcf_en = nr2dInfo->d2nr_pcf_en; ++ st2dnrCtl.core_2dnr_raw_en = nr2dInfo->d2nr_raw_en; ++ st2dnrCtl.core_2dnr_edge_en = nr2dInfo->d2nr_edge_en; ++ st2dnrCtl.core_2dnr_bap_en = nr2dInfo->d2nr_bap_en; ++ st2dnrCtl.core_2dnr_luma_en = nr2dInfo->d2nr_luma_en; ++ st2dnrCtl.core_2dnr_chroma_en = nr2dInfo->d2nr_chroma_en; ++ st2dnrCtl.core_2dnr_pcf_adp_en = nr2dInfo->d2nr_pcf_adp_en; ++ st2dnrCtl.core_2dnr_raw_adp_en = nr2dInfo->d2nr_raw_adp_en; ++ st2dnrCtl.core_2dnr_luma_adp_en = nr2dInfo->d2nr_luma_adp_en; ++ st2dnrCtl.core_2dnr_chroma_adp_en = nr2dInfo->d2nr_chroma_adp_en; ++ st2dnrCtl.core_2dnr_raw_intensity = nr2dInfo->d2nr_raw_intensity; ++ st2dnrCtl.core_2dnr_bap_intensity = nr2dInfo->d2nr_bap_intensity; ++ st2dnrCtl.core_2dnr_edge_intensity = nr2dInfo->d2nr_edge_intensity; ++ st2dnrCtl.core_2dnr_luma_intensity = nr2dInfo->d2nr_luma_intensity; ++ st2dnrCtl.core_2dnr_chroma_intensity = nr2dInfo->d2nr_chroma_intensity; ++ Isp_Drv_R2k_Core_Set2DnrCtl(isp,&st2dnrCtl); + return 0; + } + //ENH + static int isp_r2k_core_SetEnhCtl(struct k510_isp_device *isp,ENH_INFO_S *enhInfo) + { + +- ISP_CORE_ENH_CTL_S stEnhCtl; +- stEnhCtl.enh_ltm_en = enhInfo->enh_ltm_en; +- stEnhCtl.enh_sharp_en = enhInfo->enh_sharp_en; +- stEnhCtl.enh_cc_en = enhInfo->enh_cc_en; +- stEnhCtl.enh_adp_ltm_en = enhInfo->enh_adp_ltm_en; +- stEnhCtl.enh_adp_sharp_en = enhInfo->enh_adp_sharp_en; +- stEnhCtl.enh_adp_cc_en = enhInfo->enh_adp_cc_en; +- stEnhCtl.ltm_gain = enhInfo->ltm_gain; +- stEnhCtl.ltm_th = enhInfo->ltm_th; +- stEnhCtl.enh_nr_th = enhInfo->enh_nr_th; +- stEnhCtl.enh_th1 = enhInfo->enh_th1; +- stEnhCtl.enh_th2 = enhInfo->enh_th2; +- stEnhCtl.sharp_gain = enhInfo->sharp_gain; +- Isp_Drv_R2k_Core_SetEnhLtmCtl(isp,&stEnhCtl); +- Isp_Drv_R2k_Core_SetEnhCCCtl(isp,&stEnhCtl); +- Isp_Drv_R2k_Core_SetEnhSharpenCtl(isp,&stEnhCtl); ++ ISP_CORE_ENH_CTL_S stEnhCtl; ++ stEnhCtl.enh_ltm_en = enhInfo->enh_ltm_en; ++ stEnhCtl.enh_sharp_en = enhInfo->enh_sharp_en; ++ stEnhCtl.enh_cc_en = enhInfo->enh_cc_en; ++ stEnhCtl.enh_adp_ltm_en = enhInfo->enh_adp_ltm_en; ++ stEnhCtl.enh_adp_sharp_en = enhInfo->enh_adp_sharp_en; ++ stEnhCtl.enh_adp_cc_en = enhInfo->enh_adp_cc_en; ++ stEnhCtl.ltm_gain = enhInfo->ltm_gain; ++ stEnhCtl.ltm_th = enhInfo->ltm_th; ++ stEnhCtl.enh_nr_th = enhInfo->enh_nr_th; ++ stEnhCtl.enh_th1 = enhInfo->enh_th1; ++ stEnhCtl.enh_th2 = enhInfo->enh_th2; ++ stEnhCtl.sharp_gain = enhInfo->sharp_gain; ++ Isp_Drv_R2k_Core_SetEnhLtmCtl(isp,&stEnhCtl); ++ Isp_Drv_R2k_Core_SetEnhCCCtl(isp,&stEnhCtl); ++ Isp_Drv_R2k_Core_SetEnhSharpenCtl(isp,&stEnhCtl); + return 0; + } + //POST + static int isp_r2k_core_SetPostCtl(struct k510_isp_device *isp,POST_INFO_S *postInfo) + { + +- ISP_CORE_POST_CTL_S stPostCtl; +- stPostCtl.post_cont_ad_en = postInfo->post_cont_ad_en; +- stPostCtl.post_luma_ad_en = postInfo->post_luma_ad_en; +- stPostCtl.post_satu_ad_en = postInfo->post_satu_ad_en; +- stPostCtl.cont_ad_intensity = postInfo->cont_ad_intensity; +- stPostCtl.luma_ad_intensity = postInfo->luma_ad_intensity; +- stPostCtl.satu_ad_intensity = postInfo->satu_ad_intensity; +- Isp_Drv_R2k_Core_SetPostContCtl(isp,&stPostCtl); +- Isp_Drv_R2k_Core_SetPostLumaCtl(isp,&stPostCtl); +- Isp_Drv_R2k_Core_SetPostSatuCtl(isp,&stPostCtl); ++ ISP_CORE_POST_CTL_S stPostCtl; ++ stPostCtl.post_cont_ad_en = postInfo->post_cont_ad_en; ++ stPostCtl.post_luma_ad_en = postInfo->post_luma_ad_en; ++ stPostCtl.post_satu_ad_en = postInfo->post_satu_ad_en; ++ stPostCtl.cont_ad_intensity = postInfo->cont_ad_intensity; ++ stPostCtl.luma_ad_intensity = postInfo->luma_ad_intensity; ++ stPostCtl.satu_ad_intensity = postInfo->satu_ad_intensity; ++ Isp_Drv_R2k_Core_SetPostContCtl(isp,&stPostCtl); ++ Isp_Drv_R2k_Core_SetPostLumaCtl(isp,&stPostCtl); ++ Isp_Drv_R2k_Core_SetPostSatuCtl(isp,&stPostCtl); + return 0; + } + //OTC + static int isp_r2k_core_SetOtcCtl(struct k510_isp_device *isp,OTC_INFO_S *otcInfo) + { + +- ISP_CORE_OTC_CTL_S stOtcCtl; +- stOtcCtl.post_otc_en = otcInfo->post_otc_en; +- stOtcCtl.otc_yc_sel = otcInfo->otc_yc_sel; +- stOtcCtl.otc_uv_format_sel = otcInfo->otc_uv_format_sel; +- stOtcCtl.otc_hsync_pol_sel = otcInfo->otc_hsync_pol_sel; +- stOtcCtl.otc_vsync_pol_sel = otcInfo->otc_vsync_pol_sel; +- stOtcCtl.otc_stt_vr = otcInfo->otc_out_size.Width_st; +- stOtcCtl.otc_stt_hr = otcInfo->otc_out_size.Height_st; +- stOtcCtl.otc_height = otcInfo->otc_out_size.Height; +- stOtcCtl.otc_width = otcInfo->otc_out_size.Width; +- Isp_Drv_R2k_Core_SetOtcCtl(isp,&stOtcCtl); ++ ISP_CORE_OTC_CTL_S stOtcCtl; ++ stOtcCtl.post_otc_en = otcInfo->post_otc_en; ++ stOtcCtl.otc_yc_sel = otcInfo->otc_yc_sel; ++ stOtcCtl.otc_uv_format_sel = otcInfo->otc_uv_format_sel; ++ stOtcCtl.otc_hsync_pol_sel = otcInfo->otc_hsync_pol_sel; ++ stOtcCtl.otc_vsync_pol_sel = otcInfo->otc_vsync_pol_sel; ++ stOtcCtl.otc_stt_vr = otcInfo->otc_out_size.Width_st; ++ stOtcCtl.otc_stt_hr = otcInfo->otc_out_size.Height_st; ++ stOtcCtl.otc_height = otcInfo->otc_out_size.Height; ++ stOtcCtl.otc_width = otcInfo->otc_out_size.Width; ++ Isp_Drv_R2k_Core_SetOtcCtl(isp,&stOtcCtl); + return 0; + } + //LDC + static int isp_r2k_core_SetLdcCtl(struct k510_isp_device *isp,LDC_INFO_S *ldcInfo) + { + +- ISP_CORE_LDC_CTL_S stLdcCtl; +- stLdcCtl.ldc_en = ldcInfo->ldc_en; +- stLdcCtl.ldc_arith_en = ldcInfo->ldc_arith_en; +- stLdcCtl.ldc_req_freq = ldcInfo->ldc_req_freq; +- stLdcCtl.ldc_stt_ln = ldcInfo->ldc_stt_ln; +- stLdcCtl.ldc_h_center_pos = ldcInfo->ldc_h_center_pos; +- stLdcCtl.ldc_v_center_pos = ldcInfo->ldc_v_center_pos; +- stLdcCtl.ldc_rectify_cr = ldcInfo->ldc_rectify_cr; +- stLdcCtl.ldc_rectify_cz = ldcInfo->ldc_rectify_cz; +- Isp_Drv_R2k_Core_SetLdcCtl(isp,&stLdcCtl); ++ ISP_CORE_LDC_CTL_S stLdcCtl; ++ stLdcCtl.ldc_en = ldcInfo->ldc_en; ++ stLdcCtl.ldc_arith_en = ldcInfo->ldc_arith_en; ++ stLdcCtl.ldc_req_freq = ldcInfo->ldc_req_freq; ++ stLdcCtl.ldc_stt_ln = ldcInfo->ldc_stt_ln; ++ stLdcCtl.ldc_h_center_pos = ldcInfo->ldc_h_center_pos; ++ stLdcCtl.ldc_v_center_pos = ldcInfo->ldc_v_center_pos; ++ stLdcCtl.ldc_rectify_cr = ldcInfo->ldc_rectify_cr; ++ stLdcCtl.ldc_rectify_cz = ldcInfo->ldc_rectify_cz; ++ Isp_Drv_R2k_Core_SetLdcCtl(isp,&stLdcCtl); + return 0; + } + //AF + static int isp_r2k_core_SetAfCtl(struct k510_isp_device *isp,AF_INFO_S *afInfo) + { + +- ISP_CORE_AF_CTL_S stAfCtl; ++ ISP_CORE_AF_CTL_S stAfCtl; + stAfCtl.af_stat_en = afInfo->af_stat_en; +- stAfCtl.af_stat_mode_sel= afInfo->af_stat_mode_sel; +- stAfCtl.af_stat_win_h_start= afInfo->af_win_size.h_start; +- stAfCtl.af_stat_win_v_start= afInfo->af_win_size.v_start; +- stAfCtl.af_stat_win_h_end= afInfo->af_win_size.h_end; +- stAfCtl.af_stat_win_v_end= afInfo->af_win_size.v_end; +- Isp_Drv_R2k_Core_SetAfCtl(isp,&stAfCtl); ++ stAfCtl.af_stat_mode_sel= afInfo->af_stat_mode_sel; ++ stAfCtl.af_stat_win_h_start= afInfo->af_win_size.h_start; ++ stAfCtl.af_stat_win_v_start= afInfo->af_win_size.v_start; ++ stAfCtl.af_stat_win_h_end= afInfo->af_win_size.h_end; ++ stAfCtl.af_stat_win_v_end= afInfo->af_win_size.v_end; ++ Isp_Drv_R2k_Core_SetAfCtl(isp,&stAfCtl); + return 0; + } + // + static int isp_r2k_core_config(struct isp_r2k_device *r2k,struct isp_core_cfg_info *isp_core_cfg) + { + struct k510_isp_device *isp = to_isp_device(r2k); +- //struct isp_core_cfg_info *isp_core_cfg =&isp_cfg->isp_core_cfg; +- // ++ //struct isp_core_cfg_info *isp_core_cfg =&isp_cfg->isp_core_cfg; ++ // + ITC_INFO_S *itcInfo = &isp_core_cfg->itcInfo; + isp_r2k_core_SetItc(isp,itcInfo); +- // ++ // + isp_r2k_core_SetImage(isp,itcInfo); +- // ++ // + TPG_INFO_S *tpgInfo = &isp_core_cfg->tpgInfo; + isp_r2k_core_SetTpgCtl(isp,tpgInfo); +- // ++ // + BLC_INFO_S *blcInfo = &isp_core_cfg->blcInfo; + isp_r2k_core_SetBlcCtl(isp,blcInfo); +- // ++ // + LSC_INFO_S *lscInfo = &isp_core_cfg->lscInfo; + isp_r2k_core_SetLscCtl(isp,lscInfo); +- // ++ // + AE_INFO_S *aeInfo = &isp_core_cfg->aeInfo; + isp_r2k_core_SetAeCtl(isp,aeInfo); + AWB_INFO_S *awbInfo = &isp_core_cfg->awbInfo; +- // ++ // + isp_r2k_core_SetAwbCtl(isp,awbInfo); +- // ++ // + CSC_INFO_S *cscInfo = &isp_core_cfg->cscInfo; + isp_r2k_core_SetCscCtl(isp,cscInfo); +- // ++ // + ADA_INFO_S *adaInfo = &isp_core_cfg->adaInfo; + isp_r2k_core_SetAdaCtl(isp,adaInfo); + RGBIR_INFO_S *rgbirInfo = &isp_core_cfg->rgbirInfo; +- // ++ // + isp_r2k_core_SetRgbirCtl(isp,rgbirInfo); +- // ++ // + NR2D_INFO_S *nr2dInfo = &isp_core_cfg->nr2dInfo; + isp_r2k_core_Set2dnrCtl(isp,nr2dInfo); +- // ++ // + ENH_INFO_S *enhInfo= &isp_core_cfg->enhInfo; + isp_r2k_core_SetEnhCtl(isp,enhInfo); +- // ++ // + POST_INFO_S *postInfo= &isp_core_cfg->postInfo; + isp_r2k_core_SetPostCtl(isp,postInfo); +- // ++ // + OTC_INFO_S *otcInfo= &isp_core_cfg->otcInfo; + isp_r2k_core_SetOtcCtl(isp,otcInfo); +- // ++ // + LDC_INFO_S *ldcInfo= &isp_core_cfg->ldcInfo; + isp_r2k_core_SetLdcCtl(isp,ldcInfo); +- // ++ // + AF_INFO_S *afInfo= &isp_core_cfg->afInfo; + isp_r2k_core_SetAfCtl(isp,afInfo); +- return 0; ++ return 0; + } + /**************************************************************************************** + *ISP DS +-****************************************************************************************/ ++ ****************************************************************************************/ + static void isp_r2k_ds_calc_scale(IMAGE_SIZE *in_size,IMAGE_SIZE *ds_out_size,ISP_S_DS_ATTR_S *stDsAttr) + { +- unsigned int InputWidth = in_size->Width; +- unsigned int InputHeight = in_size->Height; +- unsigned int OutputWidth = ds_out_size->Width; +- unsigned int OutputHeight = ds_out_size->Height; +- stDsAttr->hscalePram.hscale_pstep = (InputWidth / OutputWidth); +- stDsAttr->hscalePram.hscale_dstep = ((InputWidth % OutputWidth) * 65536 / OutputWidth); +- stDsAttr->vscalePram.vscale_pstep = (InputHeight / OutputHeight); +- stDsAttr->vscalePram.vscale_dstep = ((InputHeight % OutputHeight) * 65536 / OutputHeight); +- return; ++ unsigned int InputWidth = in_size->Width; ++ unsigned int InputHeight = in_size->Height; ++ unsigned int OutputWidth = ds_out_size->Width; ++ unsigned int OutputHeight = ds_out_size->Height; ++ stDsAttr->hscalePram.hscale_pstep = (InputWidth / OutputWidth); ++ stDsAttr->hscalePram.hscale_dstep = ((InputWidth % OutputWidth) * 65536 / OutputWidth); ++ stDsAttr->vscalePram.vscale_pstep = (InputHeight / OutputHeight); ++ stDsAttr->vscalePram.vscale_dstep = ((InputHeight % OutputHeight) * 65536 / OutputHeight); ++ return; + } + // + void isp_r2k_ds_SetInputSize(struct k510_isp_device *isp,IMAGE_SIZE *dsInSizeInfo) + { +- IMAGE_SIZE inputsize; +- inputsize.Width = dsInSizeInfo->Width - 1; +- inputsize.Height = dsInSizeInfo->Height - 1; +- Isp_Drv_R2k_Ds_SetInputSize(isp,&inputsize); ++ IMAGE_SIZE inputsize; ++ inputsize.Width = dsInSizeInfo->Width - 1; ++ inputsize.Height = dsInSizeInfo->Height - 1; ++ Isp_Drv_R2k_Ds_SetInputSize(isp,&inputsize); + } + // + void isp_r2k_ds_SetRgb2YuvCoff(struct k510_isp_device *isp) + { + +- unsigned int osd_rgb2yuv_coeff[3][4]; +- osd_rgb2yuv_coeff[0][0]= 0x00000132; +- osd_rgb2yuv_coeff[0][1]= 0x00000259; +- osd_rgb2yuv_coeff[0][2]= 0x00000075; +- osd_rgb2yuv_coeff[0][3]= 0x00000000; +- osd_rgb2yuv_coeff[1][0]= 0x00000f50; +- osd_rgb2yuv_coeff[1][1]= 0x00000ea5; +- osd_rgb2yuv_coeff[1][2]= 0x0000020b; +- osd_rgb2yuv_coeff[1][3]= 0x00000080; +- osd_rgb2yuv_coeff[2][0]= 0x0000020b; +- osd_rgb2yuv_coeff[2][1]= 0x00000e4a; +- osd_rgb2yuv_coeff[2][2]= 0x00000fab; +- osd_rgb2yuv_coeff[2][3]= 0x00000080; +- Isp_Drv_R2k_Ds_SetRgb2YuvCoff(isp,&osd_rgb2yuv_coeff[0][0]); ++ unsigned int osd_rgb2yuv_coeff[3][4]; ++ osd_rgb2yuv_coeff[0][0]= 0x00000132; ++ osd_rgb2yuv_coeff[0][1]= 0x00000259; ++ osd_rgb2yuv_coeff[0][2]= 0x00000075; ++ osd_rgb2yuv_coeff[0][3]= 0x00000000; ++ osd_rgb2yuv_coeff[1][0]= 0x00000f50; ++ osd_rgb2yuv_coeff[1][1]= 0x00000ea5; ++ osd_rgb2yuv_coeff[1][2]= 0x0000020b; ++ osd_rgb2yuv_coeff[1][3]= 0x00000080; ++ osd_rgb2yuv_coeff[2][0]= 0x0000020b; ++ osd_rgb2yuv_coeff[2][1]= 0x00000e4a; ++ osd_rgb2yuv_coeff[2][2]= 0x00000fab; ++ osd_rgb2yuv_coeff[2][3]= 0x00000080; ++ Isp_Drv_R2k_Ds_SetRgb2YuvCoff(isp,&osd_rgb2yuv_coeff[0][0]); + } + // + void isp_r2k_ds_SetYuv2RgbCoff(struct k510_isp_device *isp) + { + +- unsigned int osd_yuv2rgb_coeff[3][4]; +- osd_yuv2rgb_coeff[0][0] = 0x00000400; ++ unsigned int osd_yuv2rgb_coeff[3][4]; ++ osd_yuv2rgb_coeff[0][0] = 0x00000400; + osd_yuv2rgb_coeff[0][1] = 0x00000000; + osd_yuv2rgb_coeff[0][2] = 0x000005a1; + osd_yuv2rgb_coeff[0][3] = 0x00000f4c; +@@ -1343,19 +1343,19 @@ void isp_r2k_ds_SetYuv2RgbCoff(struct k510_isp_device *isp) + osd_yuv2rgb_coeff[2][1] = 0x0000071e; + osd_yuv2rgb_coeff[2][2] = 0x00000000; + osd_yuv2rgb_coeff[2][3] = 0x00000f1c; +- Isp_Drv_R2k_Ds_SetYuv2RgbCoff(isp,&osd_yuv2rgb_coeff[0][0]); ++ Isp_Drv_R2k_Ds_SetYuv2RgbCoff(isp,&osd_yuv2rgb_coeff[0][0]); + } + // + void isp_r2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + { +- ISP_DS_OSD_INFO_S *stOsdInfo = &stDsOsdAttr->OsdInfo; ++ ISP_DS_OSD_INFO_S *stOsdInfo = &stDsOsdAttr->OsdInfo; + stOsdInfo->osd_enable = osdInfo->osd_enable; + stOsdInfo->osd_type = osdInfo->osd_type; + stOsdInfo->osd_alpha_tpye = osdInfo->osd_alpha_tpye; +- IMAGE_SIZE *stOsdSize = &stDsOsdAttr->OsdSize; ++ IMAGE_SIZE *stOsdSize = &stDsOsdAttr->OsdSize; + stOsdSize->Width = osdInfo->osd_size.Width; + stOsdSize->Height = osdInfo->osd_size.Height; +- ISP_DS_OSD_BUF_S *stOsdBuf = &stDsOsdAttr->OsdBuf; ++ ISP_DS_OSD_BUF_S *stOsdBuf = &stDsOsdAttr->OsdBuf; + stOsdBuf->osd_rgb_addr0 = osdInfo->osd_rgb_addr[0]; + stOsdBuf->osd_rgb_addr1 = osdInfo->osd_rgb_addr[1]; + stOsdBuf->osd_stride = osdInfo->osd_stride; +@@ -1366,7 +1366,7 @@ void isp_r2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + stOsdBuf->osd_position_stop_x = osdInfo->osd_position_win.h_end; + stOsdBuf->osd_position_start_y =osdInfo->osd_position_win.v_start; + stOsdBuf->osd_position_stop_y = osdInfo->osd_position_win.v_end; +- ISP_DS_OSD_DMA_CTL_S *stOsdDmaCtl = &stDsOsdAttr->OsdDmaCtl; ++ ISP_DS_OSD_DMA_CTL_S *stOsdDmaCtl = &stDsOsdAttr->OsdDmaCtl; + stOsdDmaCtl->osd_bd_limit_en = osdInfo->osd_bd_limit_en; + stOsdDmaCtl->osd_dma_map = osdInfo->osd_dma_map; + stOsdDmaCtl->osd_dma_request_length = osdInfo->osd_dma_request_length; +@@ -1374,85 +1374,85 @@ void isp_r2k_ds_SetOSD(ISP_DS_OSD_ATTR_S *stDsOsdAttr,ISP_OSD_INFO_S *osdInfo) + stOsdDmaCtl->osd_outstanding_num = osdInfo->osd_outstanding_num; + stOsdDmaCtl->osd_rgb_rev = osdInfo->osd_rgb_rev; + stOsdDmaCtl->osd_swap_64 = osdInfo->osd_swap_64; +- return; ++ return; + } + // + void isp_r2k_ds_SetSingleDS(struct k510_isp_device *isp,unsigned int u8Index,struct isp_ds_cfg_info *isp_ds_cfg) + { +- IMAGE_SIZE in_size; +- in_size.Width = isp_ds_cfg->dsInSizeInfo.Width; +- in_size.Height = isp_ds_cfg->dsInSizeInfo.Height; +- ISP_S_DS_ATTR_S stDsAttr; +- IMAGE_SIZE *dsOutSize = &stDsAttr.dsOutSize; +- ISP_DS_INFO_S *dsInfo = &isp_ds_cfg->dsInfo[u8Index]; +- dsOutSize->Width = dsInfo->ds_out_size.Width - 1; +- dsOutSize->Height = dsInfo->ds_out_size.Height - 1; +- isp_r2k_ds_calc_scale(&in_size,&dsInfo->ds_out_size,&stDsAttr); +- stDsAttr.vscalePram.scale_en = dsInfo->scale_en; +- stDsAttr.vscalePram.vscale_filter_en = dsInfo->vscale_filter_en; +- stDsAttr.hscalePram.hscale_filter_en = dsInfo->hscale_filter_en; +- ISP_DS_FORMAT_S *stDsFormat = &stDsAttr.DsFormat; +- stDsFormat->out_rgb_en = dsInfo->out_rgb_en; +- stDsFormat->out_rgb_mode = dsInfo->out_rgb_mode; +- stDsFormat->out_yuv_mode = dsInfo->out_yuv_mode; +- stDsFormat->out_uv_swap = dsInfo->out_uv_swap; +- unsigned int osdIndex = 0; +- ISP_DS_OSD_ATTR_S *stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- ISP_OSD_INFO_S *osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- osdIndex = 1; +- stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- osdIndex = 2; +- stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; +- osdInfo = &dsInfo->osdInfo[osdIndex]; +- isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); +- Isp_Drv_R2k_Ds_SetSingleDS(isp,u8Index,&stDsAttr); +- return; ++ IMAGE_SIZE in_size; ++ in_size.Width = isp_ds_cfg->dsInSizeInfo.Width; ++ in_size.Height = isp_ds_cfg->dsInSizeInfo.Height; ++ ISP_S_DS_ATTR_S stDsAttr; ++ IMAGE_SIZE *dsOutSize = &stDsAttr.dsOutSize; ++ ISP_DS_INFO_S *dsInfo = &isp_ds_cfg->dsInfo[u8Index]; ++ dsOutSize->Width = dsInfo->ds_out_size.Width - 1; ++ dsOutSize->Height = dsInfo->ds_out_size.Height - 1; ++ isp_r2k_ds_calc_scale(&in_size,&dsInfo->ds_out_size,&stDsAttr); ++ stDsAttr.vscalePram.scale_en = dsInfo->scale_en; ++ stDsAttr.vscalePram.vscale_filter_en = dsInfo->vscale_filter_en; ++ stDsAttr.hscalePram.hscale_filter_en = dsInfo->hscale_filter_en; ++ ISP_DS_FORMAT_S *stDsFormat = &stDsAttr.DsFormat; ++ stDsFormat->out_rgb_en = dsInfo->out_rgb_en; ++ stDsFormat->out_rgb_mode = dsInfo->out_rgb_mode; ++ stDsFormat->out_yuv_mode = dsInfo->out_yuv_mode; ++ stDsFormat->out_uv_swap = dsInfo->out_uv_swap; ++ unsigned int osdIndex = 0; ++ ISP_DS_OSD_ATTR_S *stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ ISP_OSD_INFO_S *osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ osdIndex = 1; ++ stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ osdIndex = 2; ++ stDsOsdAttr = &stDsAttr.DsOsdAttr[osdIndex]; ++ osdInfo = &dsInfo->osdInfo[osdIndex]; ++ isp_r2k_ds_SetOSD(stDsOsdAttr,osdInfo); ++ Isp_Drv_R2k_Ds_SetSingleDS(isp,u8Index,&stDsAttr); ++ return; + } + // + static int isp_r2k_ds_config(struct isp_r2k_device *r2k,struct isp_ds_cfg_info *isp_ds_cfg) + { + + struct k510_isp_device *isp = to_isp_device(r2k); +- //struct isp_ds_cfg_info *isp_ds_cfg =&isp_cfg->isp_ds_cfg; +- // +- Isp_Drv_R2k_Ds_SetscaleCoeff(isp); +- // +- IMAGE_SIZE *dsInSizeInfo = &isp_ds_cfg->dsInSizeInfo; +- isp_r2k_ds_SetInputSize(isp,dsInSizeInfo); +- // +- isp_r2k_ds_SetRgb2YuvCoff(isp); +- // +- isp_r2k_ds_SetYuv2RgbCoff(isp); +- // +- unsigned int u8Index = 0; +- isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- // +- u8Index = 1; +- isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- // +- u8Index = 2; +- isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); +- +- return 0; ++ //struct isp_ds_cfg_info *isp_ds_cfg =&isp_cfg->isp_ds_cfg; ++ // ++ Isp_Drv_R2k_Ds_SetscaleCoeff(isp); ++ // ++ IMAGE_SIZE *dsInSizeInfo = &isp_ds_cfg->dsInSizeInfo; ++ isp_r2k_ds_SetInputSize(isp,dsInSizeInfo); ++ // ++ isp_r2k_ds_SetRgb2YuvCoff(isp); ++ // ++ isp_r2k_ds_SetYuv2RgbCoff(isp); ++ // ++ unsigned int u8Index = 0; ++ isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ // ++ u8Index = 1; ++ isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ // ++ u8Index = 2; ++ isp_r2k_ds_SetSingleDS(isp,u8Index,isp_ds_cfg); ++ ++ return 0; + } + /**************************************************************************** +-* +-*****************************************************************************/ ++ * ++ *****************************************************************************/ + static int isp_r2k_config(struct k510_isp_device *isp,struct isp_cfg_info *isp_cfg) + { + struct isp_r2k_device *r2k = &isp->isp_r2k; + struct isp_core_cfg_info *isp_core_cfg =&isp_cfg->isp_core_cfg; +- isp_r2k_core_config(r2k,isp_core_cfg); ++ isp_r2k_core_config(r2k,isp_core_cfg); + struct isp_ds_cfg_info *isp_ds_cfg =&isp_cfg->isp_ds_cfg; + isp_r2k_ds_config(r2k,isp_ds_cfg); + struct isp_wrap_cfg_info *isp_wrap_cfg =&isp_cfg->isp_wrap_cfg; + dev_dbg(isp->dev,"%s:main_y_buf0_base(0x%x)\n",__func__,isp_wrap_cfg->mainInfo.main_y_buf0_base); +- isp_r2k_wrap_config(r2k,isp_wrap_cfg); +-// printk("isp_r2k_config end \n"); +- return 0; ++ isp_r2k_wrap_config(r2k,isp_wrap_cfg); ++ // printk("isp_r2k_config end \n"); ++ return 0; + } + // + /* +@@ -1511,27 +1511,27 @@ static void isp_r2k_set_out0_outaddr(struct isp_r2k_device *r2k, u32 addr) + struct isp_wrap_ds0_info *ds0_info = &isp_wrap_cfg->ds0Info; + + #ifdef SET_DIFF_BUFF +- if((r2k->pingpong[DS0_VIDEO]%2) == 0) +- { +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF0_BASE); +- addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); +- } +- else if((r2k->pingpong[DS0_VIDEO]%2) == 1) +- { +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF1_BASE); +- addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); +- } +- r2k->pingpong[DS0_VIDEO]++; +- isp_reg_writel(isp,0x30001,ISP_IOMEM_R2K_WRAP,ISP_WRAP_CONFIG_DONE); ++ if((r2k->pingpong[DS0_VIDEO]%2) == 0) ++ { ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF0_BASE); ++ addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); ++ } ++ else if((r2k->pingpong[DS0_VIDEO]%2) == 1) ++ { ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF1_BASE); ++ addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); ++ } ++ r2k->pingpong[DS0_VIDEO]++; ++ isp_reg_writel(isp,0x30001,ISP_IOMEM_R2K_WRAP,ISP_WRAP_CONFIG_DONE); + #else +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF0_BASE); +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF1_BASE); +- addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); +- isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); +- isp_reg_writel(isp,0x30001,ISP_IOMEM_R2K_WRAP,ISP_WRAP_CONFIG_DONE); ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF0_BASE); ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_Y_BUF1_BASE); ++ addr = addr + ds0_info->ds0_line_stride*ds0_info->ds0_size.Height;//1920*1080; ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF0_BASE); ++ isp_reg_writel(isp,addr,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DS0_UV_BUF1_BASE); ++ isp_reg_writel(isp,0x30001,ISP_IOMEM_R2K_WRAP,ISP_WRAP_CONFIG_DONE); + #endif + } + /* +@@ -1609,7 +1609,7 @@ static void isp_r2k_enable(struct isp_r2k_device *r2k) + */ + #define ISP_R2K_WRAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_WRAP " #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_WRAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_WRAP, name)) + + + void isp_r2k_wrap_print_status(struct isp_r2k_device *r2k) +@@ -1747,14 +1747,14 @@ void isp_r2k_wrap_print_status(struct isp_r2k_device *r2k) + dev_dbg(isp->dev, "-------------ISP R2K WRAP Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*CORE +---------------------------------------------------------------------------*/ ++ *CORE ++ --------------------------------------------------------------------------*/ + /* + * isp_r2k_core_print_status - Prints the values of the isp r2k core module registers. + */ + #define ISP_R2K_CORE_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_CORE" #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_CORE, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_CORE, name)) + + + static void isp_r2k_core_print_status(struct isp_r2k_device *r2k) +@@ -1943,14 +1943,14 @@ static void isp_r2k_core_print_status(struct isp_r2k_device *r2k) + dev_dbg(isp->dev, "-------------ISP R2K CORE Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*DS +---------------------------------------------------------------------------*/ ++ *DS ++ --------------------------------------------------------------------------*/ + /* + * isp_r2k_ds_print_status - Prints the values of the isp r2k ds module registers. + */ + #define ISP_R2K_DS_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_DS " #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_DS, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_DS, name)) + + + static void isp_r2k_ds_print_status(struct isp_r2k_device *r2k) +@@ -2103,8 +2103,8 @@ static void isp_r2k_ds_print_status(struct isp_r2k_device *r2k) + dev_dbg(isp->dev, "-------------isp r2k ds Register dump end----------\n"); + } + /*-------------------------------------------------------------------------- +-*REMAP +---------------------------------------------------------------------------*/ ++ *REMAP ++ --------------------------------------------------------------------------*/ + static int isp_r2k_remap_main_config(struct isp_r2k_device *r2k,struct isp_remap_cfg_info *isp_remap_cfg) + { + struct k510_isp_device *isp = to_isp_device(r2k); +@@ -2191,20 +2191,20 @@ static int isp_r2k_remap_out1_config(struct isp_r2k_device *r2k,struct isp_remap + */ + #define ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_MAIN_REMAP " #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_MAIN_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_MAIN_REMAP, name)) + #define ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_OUT0_REMAP " #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_OUT0_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_OUT0_REMAP, name)) + #define ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp, name)\ + dev_dbg(isp->dev, "###ISP_R2K_OUT1_REMAP " #name "=0x%08x\n", \ +- isp_reg_readl(isp, ISP_IOMEM_R2K_OUT1_REMAP, name)) ++ isp_reg_readl(isp, ISP_IOMEM_R2K_OUT1_REMAP, name)) + + static void isp_r2k_remap_print_status(struct isp_r2k_device *r2k) + { + + + struct k510_isp_device *isp = to_isp_device(r2k); +- // ++ // + dev_dbg(isp->dev, "-------------ISP R2K MAIN REMAP Register dump start----------\n"); + ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); +@@ -2303,10 +2303,10 @@ static void isp_r2k_remap_print_status(struct isp_r2k_device *r2k) + ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_R2K_MAIN_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP R2K MAIN REMAP Register dump end----------\n"); +- // ++ dev_dbg(isp->dev, "-------------ISP R2K MAIN REMAP Register dump end----------\n"); ++ // + dev_dbg(isp->dev, "-------------ISP R2K OUT0 REMAP Register dump start----------\n"); +- ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); ++ ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_01_0_CTRL); + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_01_1_CTRL); +@@ -2403,8 +2403,8 @@ static void isp_r2k_remap_print_status(struct isp_r2k_device *r2k) + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_R2K_OUT0_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP R2K OUT0 REMAP Register dump end----------\n"); +- // ++ dev_dbg(isp->dev, "-------------ISP R2K OUT0 REMAP Register dump end----------\n"); ++ // + dev_dbg(isp->dev, "-------------ISP R2K OUT1 REMAP Register dump start----------\n"); + ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_0_CTRL); + ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_INFO_AREA_00_1_CTRL); +@@ -2503,7 +2503,7 @@ static void isp_r2k_remap_print_status(struct isp_r2k_device *r2k) + ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_29_0_CTRL); + ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_30_0_CTRL); + ISP_R2K_OUT1_REMAP_PRINT_REGISTER(isp,ISP_FILL_DATA_AREA_31_0_CTRL); +- dev_dbg(isp->dev, "-------------ISP R2K OUT1 REMAP Register dump end----------\n"); ++ dev_dbg(isp->dev, "-------------ISP R2K OUT1 REMAP Register dump end----------\n"); + } + + /* ----------------------------------------------------------------------------- +@@ -2511,7 +2511,7 @@ static void isp_r2k_remap_print_status(struct isp_r2k_device *r2k) + -----------------------------------------------------------------------------*/ + static void video_buffer_next(struct isp_r2k_device *r2k, enum video_type dsNum) + { +- struct k510isp_video *video = &r2k->video_out[dsNum]; ++ struct k510isp_video *video = &r2k->video_out[dsNum]; + struct k510isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); + enum vb2_buffer_state vb_state; + struct k510isp_buffer *buf, *next_buf; +@@ -2526,7 +2526,7 @@ static void video_buffer_next(struct isp_r2k_device *r2k, enum video_type dsNum) + spin_unlock_irqrestore(&video->irqlock, flags); + if(isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en == 0 && dsNum == DS0_VIDEO) + { +- return; ++ return; + } + r2k->profile[dsNum].no_buf_drop_cnt++; + return; +@@ -2536,7 +2536,7 @@ static void video_buffer_next(struct isp_r2k_device *r2k, enum video_type dsNum) + spin_unlock_irqrestore(&video->irqlock, flags); + if(isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en == 0 && dsNum == DS0_VIDEO) + { +- return; ++ return; + } + r2k->profile[dsNum].no_buf_drop_cnt++; + return; +@@ -2544,72 +2544,73 @@ static void video_buffer_next(struct isp_r2k_device *r2k, enum video_type dsNum) + + buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); + +- if(r2k->profile[dsNum].drop_threshold > 0LL) ++ if ((r2k->profile[dsNum].drop_threshold > 0LL) ++ && (dsNum == DS0_VIDEO || dsNum == DS1_VIDEO)) + { +- if(r2k->profile[dsNum].cur_int_interval > r2k->profile[dsNum].drop_threshold || +- r2k->profile[dsNum].cur_int_interval < r2k->profile[dsNum].drop_threshold/2) +- { +- drop = 1; +- r2k->profile[dsNum].drop_cnt++; +- spin_unlock_irqrestore(&video->irqlock, flags); +- return; +- } ++ if(r2k->profile[dsNum].cur_int_interval > r2k->profile[dsNum].drop_threshold || ++ r2k->profile[dsNum].cur_int_interval < r2k->profile[dsNum].drop_threshold/2) ++ { ++ drop = 1; ++ r2k->profile[dsNum].drop_cnt++; ++ spin_unlock_irqrestore(&video->irqlock, flags); ++ return; ++ } + } + + if(drop) + { +- next_buf = buf; +- } +- else +- { +- list_del(&buf->irqlist); +- next_buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); +- } +- +- if(next_buf != NULL) +- { +- if(dsNum == MAIN_VIDEO) +- isp_r2k_set_main_outaddr(r2k, next_buf->dma); +- else if(dsNum == DS0_VIDEO) +- isp_r2k_set_out0_outaddr(r2k, next_buf->dma); +- else if(dsNum == DS1_VIDEO) +- isp_r2k_set_out1_outaddr(r2k, next_buf->dma); +- else if(dsNum == DS2_VIDEO) +- isp_r2k_set_out2_outaddr(r2k, next_buf->dma); ++ next_buf = buf; ++ } ++ else ++ { ++ list_del(&buf->irqlist); ++ next_buf = list_first_entry(&video->dmaqueue, struct k510isp_buffer, irqlist); ++ } ++ ++ if(next_buf != NULL) ++ { ++ if(dsNum == MAIN_VIDEO) ++ isp_r2k_set_main_outaddr(r2k, next_buf->dma); ++ else if(dsNum == DS0_VIDEO) ++ isp_r2k_set_out0_outaddr(r2k, next_buf->dma); ++ else if(dsNum == DS1_VIDEO) ++ isp_r2k_set_out1_outaddr(r2k, next_buf->dma); ++ else if(dsNum == DS2_VIDEO) ++ isp_r2k_set_out2_outaddr(r2k, next_buf->dma); + } + + spin_unlock_irqrestore(&video->irqlock, flags); + +- if(!drop) +- { +- buf->vb.vb2_buf.timestamp = ktime_get_ns(); ++ if(!drop) ++ { ++ buf->vb.vb2_buf.timestamp = ktime_get_ns(); + +- /* Do frame number propagation only if this is the output video node. +- * Frame number either comes from the CSI receivers or it gets +- * incremented here if H3A is not active. +- * Note: There is no guarantee that the output buffer will finish +- * first, so the input number might lag behind by 1 in some cases. +- */ +- if (video == pipe->output && !pipe->do_propagation) +- buf->vb.sequence = +- atomic_inc_return(&pipe->frame_number); +- else +- buf->vb.sequence = atomic_read(&pipe->frame_number); ++ /* Do frame number propagation only if this is the output video node. ++ * Frame number either comes from the CSI receivers or it gets ++ * incremented here if H3A is not active. ++ * Note: There is no guarantee that the output buffer will finish ++ * first, so the input number might lag behind by 1 in some cases. ++ */ ++ if (video == pipe->output && !pipe->do_propagation) ++ buf->vb.sequence = ++ atomic_inc_return(&pipe->frame_number); ++ else ++ buf->vb.sequence = atomic_read(&pipe->frame_number); + +- if (pipe->field != V4L2_FIELD_NONE) +- buf->vb.sequence /= 2; ++ if (pipe->field != V4L2_FIELD_NONE) ++ buf->vb.sequence /= 2; + +- buf->vb.field = pipe->field; ++ buf->vb.field = pipe->field; + +- /* Report pipeline errors to userspace on the capture device side. */ +- if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { +- vb_state = VB2_BUF_STATE_ERROR; +- pipe->error = false; +- } else { +- vb_state = VB2_BUF_STATE_DONE; +- } ++ /* Report pipeline errors to userspace on the capture device side. */ ++ if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { ++ vb_state = VB2_BUF_STATE_ERROR; ++ pipe->error = false; ++ } else { ++ vb_state = VB2_BUF_STATE_DONE; ++ } + +- vb2_buffer_done(&buf->vb.vb2_buf, vb_state); ++ vb2_buffer_done(&buf->vb.vb2_buf, vb_state); + } + + spin_lock_irqsave(&video->irqlock, flags); +@@ -2621,10 +2622,10 @@ static void video_buffer_next(struct isp_r2k_device *r2k, enum video_type dsNum) + + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + state = ISP_PIPELINE_QUEUE_OUTPUT +- | ISP_PIPELINE_STREAM; ++ | ISP_PIPELINE_STREAM; + else + state = ISP_PIPELINE_QUEUE_INPUT +- | ISP_PIPELINE_STREAM; ++ | ISP_PIPELINE_STREAM; + + spin_lock_irqsave(&pipe->lock, flags); + pipe->state &= ~state; +@@ -2780,7 +2781,7 @@ int k510isp_r2k_ds2_isr(struct isp_r2k_device *r2k,u32 events) + r2k_isr_out2_buffer(r2k); + return 0; + } +- /* ----------------------------------------------------------------------------- ++/* ----------------------------------------------------------------------------- + * ISP r2k video device node + *-----------------------------------------------------------------------------/ + /* +@@ -2905,78 +2906,78 @@ static long r2k_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) + struct isp_ds_cfg_info *isp_ds_cfg = &r2k->isp_cfg.isp_ds_cfg; + + switch (cmd) { +- case VIDIOC_K510ISP_R2K_WRAP_CFG: +- mutex_lock(&r2k->ioctl_lock); +- //ret = isp_R2K_WRAP_config(r2k, arg); +- memcpy(isp_wrap_cfg,arg,sizeof(struct isp_wrap_cfg_info)); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_CORE_CFG: +- mutex_lock(&r2k->ioctl_lock); +- memcpy((void*)isp_core_cfg,arg,sizeof(struct isp_core_cfg_info)); +- ret = isp_r2k_core_config(r2k, arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_DS_CFG: +- mutex_lock(&r2k->ioctl_lock); +- //ret = isp_r2k_ds_config(r2k, arg); +- memcpy((void*)isp_ds_cfg,arg,sizeof(struct isp_ds_cfg_info)); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_REMAP_MAIN_CFG: +- mutex_lock(&r2k->ioctl_lock); +- ret = isp_r2k_remap_main_config(r2k, arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_REMAP_OUT0_CFG: +- mutex_lock(&r2k->ioctl_lock); +- ret = isp_r2k_remap_out0_config(r2k, arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_REMAP_OUT1_CFG: +- mutex_lock(&r2k->ioctl_lock); +- ret = isp_r2k_remap_out1_config(r2k, arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_AE_STAT_REQ: +- mutex_lock(&r2k->ioctl_lock); +- isp_r2k_core_GetAeSts(r2k->isp,arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_CFG_SET: +- mutex_lock(&r2k->ioctl_lock); +- isp_r2k_config(r2k->isp,&r2k->isp_cfg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_CORE_CFG_GET: +- mutex_lock(&r2k->ioctl_lock); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_SYSCTL_RST_R2K: +- mutex_lock(&r2k->ioctl_lock); +- reset_control_reset(r2k->isp->reset[ISP_R2K_RST]); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_CORE_REG_SET: +- mutex_lock(&r2k->ioctl_lock); +- isp_r2k_core_RegSet(r2k->isp,arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- case VIDIOC_K510ISP_R2K_CORE_REG_GET: +- mutex_lock(&r2k->ioctl_lock); +- isp_r2k_core_RegGet(r2k->isp,arg); +- mutex_unlock(&r2k->ioctl_lock); +- break; +- default: +- dev_err(r2k->isp->dev,"%s:cmd(0x%x) err!\n",__func__,cmd); +- return -ENOIOCTLCMD; ++ case VIDIOC_K510ISP_R2K_WRAP_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ //ret = isp_R2K_WRAP_config(r2k, arg); ++ memcpy(isp_wrap_cfg,arg,sizeof(struct isp_wrap_cfg_info)); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_CORE_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ memcpy((void*)isp_core_cfg,arg,sizeof(struct isp_core_cfg_info)); ++ ret = isp_r2k_core_config(r2k, arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_DS_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ //ret = isp_r2k_ds_config(r2k, arg); ++ memcpy((void*)isp_ds_cfg,arg,sizeof(struct isp_ds_cfg_info)); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_REMAP_MAIN_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ ret = isp_r2k_remap_main_config(r2k, arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_REMAP_OUT0_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ ret = isp_r2k_remap_out0_config(r2k, arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_REMAP_OUT1_CFG: ++ mutex_lock(&r2k->ioctl_lock); ++ ret = isp_r2k_remap_out1_config(r2k, arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_AE_STAT_REQ: ++ mutex_lock(&r2k->ioctl_lock); ++ isp_r2k_core_GetAeSts(r2k->isp,arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_CFG_SET: ++ mutex_lock(&r2k->ioctl_lock); ++ isp_r2k_config(r2k->isp,&r2k->isp_cfg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_CORE_CFG_GET: ++ mutex_lock(&r2k->ioctl_lock); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_SYSCTL_RST_R2K: ++ mutex_lock(&r2k->ioctl_lock); ++ reset_control_reset(r2k->isp->reset[ISP_R2K_RST]); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_CORE_REG_SET: ++ mutex_lock(&r2k->ioctl_lock); ++ isp_r2k_core_RegSet(r2k->isp,arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ case VIDIOC_K510ISP_R2K_CORE_REG_GET: ++ mutex_lock(&r2k->ioctl_lock); ++ isp_r2k_core_RegGet(r2k->isp,arg); ++ mutex_unlock(&r2k->ioctl_lock); ++ break; ++ default: ++ dev_err(r2k->isp->dev,"%s:cmd(0x%x) err!\n",__func__,cmd); ++ return -ENOIOCTLCMD; + } + + return 0; + } + + static int r2k_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, +- struct v4l2_event_subscription *sub) ++ struct v4l2_event_subscription *sub) + { + if (sub->type != V4L2_EVENT_FRAME_SYNC) + return -EINVAL; +@@ -2989,7 +2990,7 @@ static int r2k_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, + } + + static int r2k_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, +- struct v4l2_event_subscription *sub) ++ struct v4l2_event_subscription *sub) + { + return v4l2_event_unsubscribe(fh, sub); + } +@@ -3030,80 +3031,80 @@ static int r2k_set_stream(struct v4l2_subdev *sd, int enable) + } + + switch (enable) { +- case ISP_PIPELINE_STREAM_CONTINUOUS: +- mutex_lock(&r2k->ioctl_lock); +- isp_r2k_config(isp,isp_cfg); +- mutex_unlock(&r2k->ioctl_lock); +- dev_dbg(r2k->isp->dev,"%s:main_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.mainInfo.main_out_en); +- dev_dbg(r2k->isp->dev,"%s:ds0_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en); +- dev_dbg(r2k->isp->dev,"%s:ds1_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en); +- dev_dbg(r2k->isp->dev,"%s:ds2_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en); +- memset(&irq_info,0,sizeof(struct isp_irq_info)); +- irq_info.main_dma_en = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; +- irq_info.ds0_en = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; +- irq_info.ds1_en = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; +- irq_info.ds2_en = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; ++ case ISP_PIPELINE_STREAM_CONTINUOUS: ++ mutex_lock(&r2k->ioctl_lock); ++ isp_r2k_config(isp,isp_cfg); ++ mutex_unlock(&r2k->ioctl_lock); ++ dev_dbg(r2k->isp->dev,"%s:main_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.mainInfo.main_out_en); ++ dev_dbg(r2k->isp->dev,"%s:ds0_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en); ++ dev_dbg(r2k->isp->dev,"%s:ds1_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en); ++ dev_dbg(r2k->isp->dev,"%s:ds2_out_en(0x%x)\n",__func__,isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en); ++ memset(&irq_info,0,sizeof(struct isp_irq_info)); ++ irq_info.main_dma_en = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; ++ irq_info.ds0_en = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; ++ irq_info.ds1_en = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; ++ irq_info.ds2_en = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; + + #if 1 +- irq_info.ae_en = 1; +- irq_info.awb_en = 1; +- irq_info.af_en = 1; ++ irq_info.ae_en = 1; ++ irq_info.awb_en = 1; ++ irq_info.af_en = 1; + #endif + +- memset(&r2k->profile,0,sizeof(struct k510_isp_profile)*VIDEO_NUM_MAX); +- for(i=0; iisp_ds_cfg.dsInSizeInfo.Width == 1920 && +- isp_cfg->isp_ds_cfg.dsInSizeInfo.Height >= 1080) +- { +- r2k->profile[i].drop_threshold = 1000000LL/30 + DROP_THRESHOLD_GAP; +- r2k->profile[i].min_int_interval = 0xfffffLL; +- } +- else +- { +- r2k->profile[i].drop_threshold = 0LL; +- } +- } +- mutex_lock(&r2k->ioctl_lock); +- k510isp_r2k_irq_enable(isp,&irq_info); +- mutex_unlock(&r2k->ioctl_lock); +- unsigned int intmask0 = isp_reg_readl(isp,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK0); +- unsigned int intmask1 = isp_reg_readl(isp,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK1); +- dev_dbg(r2k->isp->dev,"%s:intmask0(0x%x),intmask1(0x%x)\n",__func__,intmask0,intmask1); +- break; +- +- case ISP_PIPELINE_STREAM_STOPPED: +- //if (isp_module_sync_idle(&sd->entity, &r2k->wait, +- // &r2k->stopping)) +- // dev_dbg(dev, "%s: module stop timeout.\n", sd->name); +- //if (r2k->input == ISP_R2K_INPUT_VI) { +- // r2k_if_enable(r2k, 0); +- //} +- r2k->state == ISP_PIPELINE_STREAM_STOPPED; +- memset(&irq_info,0,sizeof(struct isp_irq_info)); +- mutex_lock(&r2k->ioctl_lock); +- k510isp_r2k_irq_enable(isp,&irq_info); +- k510isp_r2k_reset(isp); +- mutex_unlock(&r2k->ioctl_lock); +- ds_en[0] = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; +- ds_en[1] = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; +- ds_en[2] = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; +- ds_en[3] = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; +- for(i=0; iisp->dev,"r2k ds%d no_buf_drop_cnt %d, total %d\n", i, r2k->profile[i].no_buf_drop_cnt, r2k->profile[i].pic_cnt); +- if(r2k->profile[i].drop_threshold > 0) +- { +- dev_info(r2k->isp->dev,"r2k ds%d jump drop_cnt %d\n", i, r2k->profile[i].drop_cnt); +- dev_info(r2k->isp->dev,"r2k ds%d interrupt: max interval %lld us, big_cnt %d\n", i, r2k->profile[i].max_int_interval, r2k->profile[i].big_inter_cnt); +- dev_info(r2k->isp->dev,"r2k ds%d interrupt: min interval %lld us, small_cnt %d\n", i, r2k->profile[i].min_int_interval, r2k->profile[i].small_inter_cnt); +- } +- } +- } +- dev_info(r2k->isp->dev,"r2k dmaErrCnt %d\n", r2k->dmaErrCnt); +- break; ++ memset(&r2k->profile,0,sizeof(struct k510_isp_profile)*VIDEO_NUM_MAX); ++ for(i=0; iisp_ds_cfg.dsInSizeInfo.Width == 1920 && ++ isp_cfg->isp_ds_cfg.dsInSizeInfo.Height >= 1080) ++ { ++ r2k->profile[i].drop_threshold = 1000000LL/30 + DROP_THRESHOLD_GAP; ++ r2k->profile[i].min_int_interval = 0xfffffLL; ++ } ++ else ++ { ++ r2k->profile[i].drop_threshold = 0LL; ++ } ++ } ++ mutex_lock(&r2k->ioctl_lock); ++ k510isp_r2k_irq_enable(isp,&irq_info); ++ mutex_unlock(&r2k->ioctl_lock); ++ unsigned int intmask0 = isp_reg_readl(isp,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK0); ++ unsigned int intmask1 = isp_reg_readl(isp,ISP_IOMEM_R2K_WRAP,ISP_WRAP_DMA_WR_INT_MASK1); ++ dev_dbg(r2k->isp->dev,"%s:intmask0(0x%x),intmask1(0x%x)\n",__func__,intmask0,intmask1); ++ break; ++ ++ case ISP_PIPELINE_STREAM_STOPPED: ++ //if (isp_module_sync_idle(&sd->entity, &r2k->wait, ++ // &r2k->stopping)) ++ // dev_dbg(dev, "%s: module stop timeout.\n", sd->name); ++ //if (r2k->input == ISP_R2K_INPUT_VI) { ++ // r2k_if_enable(r2k, 0); ++ //} ++ r2k->state == ISP_PIPELINE_STREAM_STOPPED; ++ memset(&irq_info,0,sizeof(struct isp_irq_info)); ++ mutex_lock(&r2k->ioctl_lock); ++ k510isp_r2k_irq_enable(isp,&irq_info); ++ k510isp_r2k_reset(isp); ++ mutex_unlock(&r2k->ioctl_lock); ++ ds_en[0] = isp_cfg->isp_wrap_cfg.mainInfo.main_out_en; ++ ds_en[1] = isp_cfg->isp_wrap_cfg.ds0Info.ds0_out_en; ++ ds_en[2] = isp_cfg->isp_wrap_cfg.ds1Info.ds1_out_en; ++ ds_en[3] = isp_cfg->isp_wrap_cfg.ds2Info.ds2_out_en; ++ for(i=0; iisp->dev,"r2k ds%d no_buf_drop_cnt %d, total %d\n", i, r2k->profile[i].no_buf_drop_cnt, r2k->profile[i].pic_cnt); ++ if(r2k->profile[i].drop_threshold > 0) ++ { ++ dev_info(r2k->isp->dev,"r2k ds%d jump drop_cnt %d\n", i, r2k->profile[i].drop_cnt); ++ dev_info(r2k->isp->dev,"r2k ds%d interrupt: max interval %lld us, big_cnt %d\n", i, r2k->profile[i].max_int_interval, r2k->profile[i].big_inter_cnt); ++ dev_info(r2k->isp->dev,"r2k ds%d interrupt: min interval %lld us, small_cnt %d\n", i, r2k->profile[i].min_int_interval, r2k->profile[i].small_inter_cnt); ++ } ++ } ++ } ++ dev_info(r2k->isp->dev,"r2k dmaErrCnt %d\n", r2k->dmaErrCnt); ++ break; + } + + r2k->state = enable; +@@ -3141,9 +3142,9 @@ static const unsigned int r2k_fmts[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + }; + +-static struct v4l2_mbus_framefmt * ++ static struct v4l2_mbus_framefmt * + __r2k_get_format(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, +- unsigned int pad, enum v4l2_subdev_format_whence which) ++ unsigned int pad, enum v4l2_subdev_format_whence which) + { + if (which == V4L2_SUBDEV_FORMAT_TRY) + return v4l2_subdev_get_try_format(&r2k->subdev, cfg, pad); +@@ -3151,7 +3152,7 @@ __r2k_get_format(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, + return &r2k->formats[pad]; + } + +-static struct v4l2_rect * ++ static struct v4l2_rect * + __r2k_get_crop(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, + enum v4l2_subdev_format_whence which) + { +@@ -3168,7 +3169,7 @@ __r2k_get_crop(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, + * @pad: Pad number + * @fmt: Format + */ +-static void ++ static void + r2k_try_format(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, + unsigned int pad, struct v4l2_mbus_framefmt *fmt, + enum v4l2_subdev_format_whence which) +@@ -3182,72 +3183,72 @@ r2k_try_format(struct isp_r2k_device *r2k, struct v4l2_subdev_pad_config *cfg, + unsigned int i; + dev_dbg(r2k->isp->dev,"%s:start\n",__func__); + switch (pad) { +- case ISP_R2K_PAD_SINK: +- for (i = 0; i < ARRAY_SIZE(r2k_fmts); i++) { +- if (fmt->code == r2k_fmts[i]) +- break; +- } ++ case ISP_R2K_PAD_SINK: ++ for (i = 0; i < ARRAY_SIZE(r2k_fmts); i++) { ++ if (fmt->code == r2k_fmts[i]) ++ break; ++ } + +- /* If not found, use SGRBG10 as default */ +- if (i >= ARRAY_SIZE(r2k_fmts)) +- fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10;//MEDIA_BUS_FMT_SGRBG10_1X10; +- +- /* Clamp the input size. */ +- fmt->width = clamp_t(u32, width, 32, 4096); +- fmt->height = clamp_t(u32, height, 32, 4096); +- +- /* Default to progressive field order. */ +- if (fmt->field == V4L2_FIELD_ANY) +- fmt->field = V4L2_FIELD_NONE; +- +- break; +- +- case ISP_R2K_PAD_MAIN_SOURCE: +- case ISP_R2K_PAD_DS0_SOURCE: +- case ISP_R2K_PAD_DS1_SOURCE: +- case ISP_R2K_PAD_DS2_SOURCE: +- pixelcode = fmt->code; +- field = fmt->field; +- *fmt = *__r2k_get_format(r2k, cfg, ISP_R2K_PAD_SINK, which); +- +- /* In SYNC mode the bridge converts YUV formats from 2X8 to +- * 1X16. In BT.656 no such conversion occurs. As we don't know +- * at this point whether the source will use SYNC or BT.656 mode +- * let's pretend the conversion always occurs. The r2k will be +- * configured to pack bytes in BT.656, hiding the inaccuracy. +- * In all cases bytes can be swapped. +- */ +- if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 || +- fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) { +- /* Use the user requested format if YUV. */ +- if (pixelcode == MEDIA_BUS_FMT_YUYV8_2X8 || +- pixelcode == MEDIA_BUS_FMT_UYVY8_2X8 || +- pixelcode == MEDIA_BUS_FMT_YUYV8_1X16 || +- pixelcode == MEDIA_BUS_FMT_UYVY8_1X16) +- fmt->code = pixelcode; +- +- if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8) +- fmt->code = MEDIA_BUS_FMT_YUYV8_1X16; +- else if (fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) +- fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; +- } ++ /* If not found, use SGRBG10 as default */ ++ if (i >= ARRAY_SIZE(r2k_fmts)) ++ fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10;//MEDIA_BUS_FMT_SGRBG10_1X10; + +- /* Hardcode the output size to the crop rectangle size. */ +- crop = __r2k_get_crop(r2k, cfg, which); +- fmt->width = crop->width; +- fmt->height = crop->height; ++ /* Clamp the input size. */ ++ fmt->width = clamp_t(u32, width, 32, 4096); ++ fmt->height = clamp_t(u32, height, 32, 4096); + +- /* When input format is interlaced with alternating fields the +- * r2k can interleave the fields. +- */ +- if (fmt->field == V4L2_FIELD_ALTERNATE && +- (field == V4L2_FIELD_INTERLACED_TB || +- field == V4L2_FIELD_INTERLACED_BT)) { +- fmt->field = field; +- fmt->height *= 2; +- } ++ /* Default to progressive field order. */ ++ if (fmt->field == V4L2_FIELD_ANY) ++ fmt->field = V4L2_FIELD_NONE; + +- break; ++ break; ++ ++ case ISP_R2K_PAD_MAIN_SOURCE: ++ case ISP_R2K_PAD_DS0_SOURCE: ++ case ISP_R2K_PAD_DS1_SOURCE: ++ case ISP_R2K_PAD_DS2_SOURCE: ++ pixelcode = fmt->code; ++ field = fmt->field; ++ *fmt = *__r2k_get_format(r2k, cfg, ISP_R2K_PAD_SINK, which); ++ ++ /* In SYNC mode the bridge converts YUV formats from 2X8 to ++ * 1X16. In BT.656 no such conversion occurs. As we don't know ++ * at this point whether the source will use SYNC or BT.656 mode ++ * let's pretend the conversion always occurs. The r2k will be ++ * configured to pack bytes in BT.656, hiding the inaccuracy. ++ * In all cases bytes can be swapped. ++ */ ++ if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 || ++ fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) { ++ /* Use the user requested format if YUV. */ ++ if (pixelcode == MEDIA_BUS_FMT_YUYV8_2X8 || ++ pixelcode == MEDIA_BUS_FMT_UYVY8_2X8 || ++ pixelcode == MEDIA_BUS_FMT_YUYV8_1X16 || ++ pixelcode == MEDIA_BUS_FMT_UYVY8_1X16) ++ fmt->code = pixelcode; ++ ++ if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8) ++ fmt->code = MEDIA_BUS_FMT_YUYV8_1X16; ++ else if (fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) ++ fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; ++ } ++ ++ /* Hardcode the output size to the crop rectangle size. */ ++ crop = __r2k_get_crop(r2k, cfg, which); ++ fmt->width = crop->width; ++ fmt->height = crop->height; ++ ++ /* When input format is interlaced with alternating fields the ++ * r2k can interleave the fields. ++ */ ++ if (fmt->field == V4L2_FIELD_ALTERNATE && ++ (field == V4L2_FIELD_INTERLACED_TB || ++ field == V4L2_FIELD_INTERLACED_BT)) { ++ fmt->field = field; ++ fmt->height *= 2; ++ } ++ ++ break; + } + /* Data is written to memory unpacked, each 10-bit or 12-bit pixel is + * stored on 2 bytes. +@@ -3286,9 +3287,9 @@ static void r2k_try_crop(struct isp_r2k_device *r2k,const struct v4l2_mbus_frame + */ + max_width = (sink->width - crop->left + 15) & ~15; + crop->width = clamp_t(u32, crop->width, R2K_MIN_WIDTH, max_width) +- & ~15; ++ & ~15; + crop->height = clamp_t(u32, crop->height, R2K_MIN_HEIGHT, +- sink->height - crop->top); ++ sink->height - crop->top); + + /* Odd width/height values don't make sense for Bayer formats. */ + if (info->flavor != MEDIA_BUS_FMT_Y8_1X8) { +@@ -3306,65 +3307,65 @@ static void r2k_try_crop(struct isp_r2k_device *r2k,const struct v4l2_mbus_frame + * return -EINVAL or zero on success + */ + static int r2k_enum_mbus_code(struct v4l2_subdev *sd, +- struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_mbus_code_enum *code) ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_mbus_code_enum *code) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + dev_dbg(r2k->isp->dev,"%s:start\n",__func__); + switch (code->pad) { +- case ISP_R2K_PAD_SINK: +- if (code->index >= ARRAY_SIZE(r2k_fmts)) +- { +- dev_err(r2k->isp->dev,"%s:code->index %d\n",__func__,code->index); +- return -EINVAL; +- } +- code->code = r2k_fmts[code->index]; +- break; +- +- case ISP_R2K_PAD_MAIN_SOURCE: +- case ISP_R2K_PAD_DS0_SOURCE: +- case ISP_R2K_PAD_DS1_SOURCE: +- case ISP_R2K_PAD_DS2_SOURCE: +- format = __r2k_get_format(r2k, cfg, code->pad, +- code->which); +- +- if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || +- format->code == MEDIA_BUS_FMT_UYVY8_2X8) { +- /* In YUV mode the r2k can swap bytes. */ +- if (code->index == 0) +- code->code = MEDIA_BUS_FMT_YUYV8_1X16; +- else if (code->index == 1) +- code->code = MEDIA_BUS_FMT_UYVY8_1X16; +- else ++ case ISP_R2K_PAD_SINK: ++ if (code->index >= ARRAY_SIZE(r2k_fmts)) + { +- dev_err(r2k->isp->dev,"%s:code->index1 %d\n",__func__,code->index); ++ dev_err(r2k->isp->dev,"%s:code->index %d\n",__func__,code->index); + return -EINVAL; + } +- } else { +- /* In raw mode, no configurable format confversion is +- * available. +- */ +- if (code->index == 0) +- code->code = format->code; +- else +- { +- dev_err(r2k->isp->dev,"%s:code->index2 %d\n",__func__,code->index); +- return -EINVAL; ++ code->code = r2k_fmts[code->index]; ++ break; ++ ++ case ISP_R2K_PAD_MAIN_SOURCE: ++ case ISP_R2K_PAD_DS0_SOURCE: ++ case ISP_R2K_PAD_DS1_SOURCE: ++ case ISP_R2K_PAD_DS2_SOURCE: ++ format = __r2k_get_format(r2k, cfg, code->pad, ++ code->which); ++ ++ if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || ++ format->code == MEDIA_BUS_FMT_UYVY8_2X8) { ++ /* In YUV mode the r2k can swap bytes. */ ++ if (code->index == 0) ++ code->code = MEDIA_BUS_FMT_YUYV8_1X16; ++ else if (code->index == 1) ++ code->code = MEDIA_BUS_FMT_UYVY8_1X16; ++ else ++ { ++ dev_err(r2k->isp->dev,"%s:code->index1 %d\n",__func__,code->index); ++ return -EINVAL; ++ } ++ } else { ++ /* In raw mode, no configurable format confversion is ++ * available. ++ */ ++ if (code->index == 0) ++ code->code = format->code; ++ else ++ { ++ dev_err(r2k->isp->dev,"%s:code->index2 %d\n",__func__,code->index); ++ return -EINVAL; ++ } + } +- } +- break; ++ break; + +- default: +- return -EINVAL; ++ default: ++ return -EINVAL; + } + dev_dbg(r2k->isp->dev,"%s:end\n",__func__); + return 0; + } + + static int r2k_enum_frame_size(struct v4l2_subdev *sd, +- struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_frame_size_enum *fse) ++ struct v4l2_subdev_pad_config *cfg, ++ struct v4l2_subdev_frame_size_enum *fse) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt format; +@@ -3410,38 +3411,38 @@ static int r2k_enum_frame_size(struct v4l2_subdev *sd, + * Return 0 on success or a negative error code otherwise. + */ + static int r2k_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_selection *sel) ++ struct v4l2_subdev_selection *sel) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + dev_dbg(r2k->isp->dev,"%s:start\n",__func__); + if (sel->pad != ISP_R2K_PAD_MAIN_SOURCE|| +- sel->pad != ISP_R2K_PAD_DS0_SOURCE || +- sel->pad != ISP_R2K_PAD_DS1_SOURCE || +- sel->pad != ISP_R2K_PAD_DS2_SOURCE ) ++ sel->pad != ISP_R2K_PAD_DS0_SOURCE || ++ sel->pad != ISP_R2K_PAD_DS1_SOURCE || ++ sel->pad != ISP_R2K_PAD_DS2_SOURCE ) + { + dev_err(r2k->isp->dev,"%s:no pad\n",__func__); + return -EINVAL; + } + + switch (sel->target) { +- case V4L2_SEL_TGT_CROP_BOUNDS: +- sel->r.left = 0; +- sel->r.top = 0; +- sel->r.width = INT_MAX; +- sel->r.height = INT_MAX; +- +- format = __r2k_get_format(r2k, cfg, ISP_R2K_PAD_SINK, sel->which); +- r2k_try_crop(r2k, format, &sel->r); +- break; ++ case V4L2_SEL_TGT_CROP_BOUNDS: ++ sel->r.left = 0; ++ sel->r.top = 0; ++ sel->r.width = INT_MAX; ++ sel->r.height = INT_MAX; ++ ++ format = __r2k_get_format(r2k, cfg, ISP_R2K_PAD_SINK, sel->which); ++ r2k_try_crop(r2k, format, &sel->r); ++ break; + +- case V4L2_SEL_TGT_CROP: +- sel->r = *__r2k_get_crop(r2k, cfg, sel->which); +- break; ++ case V4L2_SEL_TGT_CROP: ++ sel->r = *__r2k_get_crop(r2k, cfg, sel->which); ++ break; + +- default: +- dev_err(r2k->isp->dev,"%s:no target\n",__func__); +- return -EINVAL; ++ default: ++ dev_err(r2k->isp->dev,"%s:no target\n",__func__); ++ return -EINVAL; + } + dev_dbg(r2k->isp->dev,"%s:end\n",__func__); + return 0; +@@ -3458,17 +3459,17 @@ static int r2k_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_conf + * Return 0 on success or a negative error code otherwise. + */ + static int r2k_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_selection *sel) ++ struct v4l2_subdev_selection *sel) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; + + dev_dbg(r2k->isp->dev,"%s:start\n",__func__); + if (sel->target != V4L2_SEL_TGT_CROP || +- sel->pad != ISP_R2K_PAD_MAIN_SOURCE || +- sel->pad != ISP_R2K_PAD_DS0_SOURCE || +- sel->pad != ISP_R2K_PAD_DS1_SOURCE || +- sel->pad != ISP_R2K_PAD_DS2_SOURCE ) ++ sel->pad != ISP_R2K_PAD_MAIN_SOURCE || ++ sel->pad != ISP_R2K_PAD_DS0_SOURCE || ++ sel->pad != ISP_R2K_PAD_DS1_SOURCE || ++ sel->pad != ISP_R2K_PAD_DS2_SOURCE ) + { + dev_err(r2k->isp->dev,"%s:pad == NULL\n",__func__); + return -EINVAL; +@@ -3507,13 +3508,13 @@ static int r2k_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_conf + format = __r2k_get_format(r2k, cfg, sel->pad, sel->which); + r2k_try_format(r2k, cfg, sel->pad, format, sel->which); + } +-// ++ // + if( sel->pad == ISP_R2K_PAD_DS1_SOURCE) + { + format = __r2k_get_format(r2k, cfg, sel->pad, sel->which); + r2k_try_format(r2k, cfg, sel->pad, format, sel->which); + } +-// ++ // + if( sel->pad == ISP_R2K_PAD_DS2_SOURCE) + { + format = __r2k_get_format(r2k, cfg, sel->pad, sel->which); +@@ -3533,7 +3534,7 @@ static int r2k_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_conf + * to the format type. + */ + static int r2k_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_format *fmt) ++ struct v4l2_subdev_format *fmt) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; +@@ -3560,7 +3561,7 @@ static int r2k_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config + * to the format type. + */ + static int r2k_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, +- struct v4l2_subdev_format *fmt) ++ struct v4l2_subdev_format *fmt) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + struct v4l2_mbus_framefmt *format; +@@ -3642,16 +3643,16 @@ static int r2k_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config + return 0; + } + static int r2k_link_validate(struct v4l2_subdev *sd, +- struct media_link *link, +- struct v4l2_subdev_format *source_fmt, +- struct v4l2_subdev_format *sink_fmt) ++ struct media_link *link, ++ struct v4l2_subdev_format *source_fmt, ++ struct v4l2_subdev_format *sink_fmt) + { + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); + + dev_dbg(r2k->isp->dev,"%s:start\n",__func__); + /* Check if the two ends match */ + if (source_fmt->format.width != sink_fmt->format.width || +- source_fmt->format.height != sink_fmt->format.height) ++ source_fmt->format.height != sink_fmt->format.height) + { + dev_err(r2k->isp->dev,"%s:format error\n",__func__); + return -EPIPE; +@@ -3732,8 +3733,8 @@ static const struct v4l2_subdev_internal_ops r2k_v4l2_internal_ops = { + * return -EINVAL on error or zero on success + */ + static int r2k_link_setup(struct media_entity *entity, +- const struct media_pad *local, +- const struct media_pad *remote, u32 flags) ++ const struct media_pad *local, ++ const struct media_pad *remote, u32 flags) + { + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct isp_r2k_device *r2k = v4l2_get_subdevdata(sd); +@@ -3746,84 +3747,84 @@ static int r2k_link_setup(struct media_entity *entity, + + dev_dbg(r2k->isp->dev,"%s:r2k->output(0x%x)\n",__func__,r2k->output); + switch (index) { +- case ISP_R2K_PAD_SINK: +- case ISP_R2K_PAD_SINK | 2 << 16: +- /* Read from vi */ +- if (!(flags & MEDIA_LNK_FL_ENABLED)) { +- r2k->input = ISP_R2K_INPUT_NONE; +- break; +- } +- +- if (r2k->input != ISP_R2K_INPUT_NONE) +- { +- dev_err(r2k->isp->dev,"%s:!ISP_R2K_INPUT_NONE\n",__func__); +- return -EBUSY; +- } ++ case ISP_R2K_PAD_SINK: ++ case ISP_R2K_PAD_SINK | 2 << 16: ++ /* Read from vi */ ++ if (!(flags & MEDIA_LNK_FL_ENABLED)) { ++ r2k->input = ISP_R2K_INPUT_NONE; ++ break; ++ } + +- if (remote->entity == &r2k->subdev.entity) +- r2k->input = ISP_R2K_INPUT_VI; +- else +- r2k->input = ISP_R2K_INPUT_NONE; +- break; +- case ISP_R2K_PAD_MAIN_SOURCE: +- case ISP_R2K_PAD_MAIN_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (r2k->output & ISP_R2K_OUTPUT_MAIN_MEM) ++ if (r2k->input != ISP_R2K_INPUT_NONE) + { +- dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_MAIN_SOURCE\n",__func__); ++ dev_err(r2k->isp->dev,"%s:!ISP_R2K_INPUT_NONE\n",__func__); + return -EBUSY; + } +- r2k->output |= ISP_R2K_OUTPUT_MAIN_MEM; +- } else { +- r2k->output &= ~ISP_R2K_OUTPUT_MAIN_MEM; +- } +- break; +- case ISP_R2K_PAD_DS0_SOURCE: +- case ISP_R2K_PAD_DS0_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (r2k->output & ISP_R2K_OUTPUT_DS0_MEM) +- { +- dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS0_SOURCE\n",__func__); +- return -EBUSY; ++ ++ if (remote->entity == &r2k->subdev.entity) ++ r2k->input = ISP_R2K_INPUT_VI; ++ else ++ r2k->input = ISP_R2K_INPUT_NONE; ++ break; ++ case ISP_R2K_PAD_MAIN_SOURCE: ++ case ISP_R2K_PAD_MAIN_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (r2k->output & ISP_R2K_OUTPUT_MAIN_MEM) ++ { ++ dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_MAIN_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ r2k->output |= ISP_R2K_OUTPUT_MAIN_MEM; ++ } else { ++ r2k->output &= ~ISP_R2K_OUTPUT_MAIN_MEM; + } +- r2k->output |= ISP_R2K_OUTPUT_DS0_MEM; +- } else { +- r2k->output &= ~ISP_R2K_OUTPUT_DS0_MEM; +- } +- break; +- case ISP_R2K_PAD_DS1_SOURCE: +- case ISP_R2K_PAD_DS1_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (r2k->output & ISP_R2K_OUTPUT_DS1_MEM) +- { +- dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS1_SOURCE\n",__func__); +- return -EBUSY; ++ break; ++ case ISP_R2K_PAD_DS0_SOURCE: ++ case ISP_R2K_PAD_DS0_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (r2k->output & ISP_R2K_OUTPUT_DS0_MEM) ++ { ++ dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS0_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ r2k->output |= ISP_R2K_OUTPUT_DS0_MEM; ++ } else { ++ r2k->output &= ~ISP_R2K_OUTPUT_DS0_MEM; + } +- r2k->output |= ISP_R2K_OUTPUT_DS1_MEM; +- } else { +- r2k->output &= ~ISP_R2K_OUTPUT_DS1_MEM; +- } +- break; +- case ISP_R2K_PAD_DS2_SOURCE: +- case ISP_R2K_PAD_DS2_SOURCE | 2 << 16: +- /* Write to memory */ +- if (flags & MEDIA_LNK_FL_ENABLED) { +- if (r2k->output & ISP_R2K_OUTPUT_DS2_MEM) +- { +- dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS2_SOURCE\n",__func__); +- return -EBUSY; ++ break; ++ case ISP_R2K_PAD_DS1_SOURCE: ++ case ISP_R2K_PAD_DS1_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (r2k->output & ISP_R2K_OUTPUT_DS1_MEM) ++ { ++ dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS1_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ r2k->output |= ISP_R2K_OUTPUT_DS1_MEM; ++ } else { ++ r2k->output &= ~ISP_R2K_OUTPUT_DS1_MEM; + } +- r2k->output |= ISP_R2K_OUTPUT_DS2_MEM; +- } else { +- r2k->output &= ~ISP_R2K_OUTPUT_DS2_MEM; +- } +- break; +- default: +- dev_dbg(r2k->isp->dev,"%s:!no index\n",__func__); +- return -EINVAL; ++ break; ++ case ISP_R2K_PAD_DS2_SOURCE: ++ case ISP_R2K_PAD_DS2_SOURCE | 2 << 16: ++ /* Write to memory */ ++ if (flags & MEDIA_LNK_FL_ENABLED) { ++ if (r2k->output & ISP_R2K_OUTPUT_DS2_MEM) ++ { ++ dev_err(r2k->isp->dev,"%s:!ISP_R2K_PAD_DS2_SOURCE\n",__func__); ++ return -EBUSY; ++ } ++ r2k->output |= ISP_R2K_OUTPUT_DS2_MEM; ++ } else { ++ r2k->output &= ~ISP_R2K_OUTPUT_DS2_MEM; ++ } ++ break; ++ default: ++ dev_dbg(r2k->isp->dev,"%s:!no index\n",__func__); ++ return -EINVAL; + } + + dev_dbg(r2k->isp->dev,"%s:end\n",__func__); +@@ -3856,7 +3857,7 @@ void k510isp_r2k_unregister_entities(struct isp_r2k_device *r2k) + */ + + int k510isp_r2k_register_entities(struct isp_r2k_device *r2k, +- struct v4l2_device *vdev) ++ struct v4l2_device *vdev) + { + int ret = 0; + dev_dbg(r2k->isp->dev,"%s: start\n",__func__); +@@ -3865,39 +3866,39 @@ int k510isp_r2k_register_entities(struct isp_r2k_device *r2k, + if (ret < 0) + { + dev_err(r2k->isp->dev, "%s: v4l2_device_register_subdev failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error; + } +-// ++ // + ret = k510isp_video_register(&r2k->video_out[MAIN_VIDEO], vdev); + if (ret < 0) + { + dev_err(r2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error; + } +-// ++ // + ret = k510isp_video_register(&r2k->video_out[DS0_VIDEO], vdev); + if (ret < 0) + { + dev_err(r2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_main; + } +-// ++ // + ret = k510isp_video_register(&r2k->video_out[DS1_VIDEO], vdev); + if (ret < 0) + { + dev_err(r2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_ds0; + } +-// ++ // + ret = k510isp_video_register(&r2k->video_out[DS2_VIDEO], vdev); + if (ret < 0) + { + dev_err(r2k->isp->dev, "%s: k510isp_video_register failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_ds1; + } + dev_dbg(r2k->isp->dev,"%s: end\n",__func__); +diff --git a/drivers/media/platform/canaan-isp/k510_isp.c b/drivers/media/platform/canaan-isp/k510_isp.c +old mode 100755 +new mode 100644 +index a69270b1..58d29764 +--- a/drivers/media/platform/canaan-isp/k510_isp.c ++++ b/drivers/media/platform/canaan-isp/k510_isp.c +@@ -3,7 +3,7 @@ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +-*/ ++ */ + + #include + #include +@@ -67,7 +67,7 @@ static void k510isp_addr_init(struct k510_isp_device *isp) + isp->mmio_base[ISP_IOMEM_MIPI_DPHY] = isp->isp_regs + MIPI_DPHY_BASE; + isp->mmio_base[ISP_IOMEM_MIPI_CORNER] = isp->isp_regs + MIPI_CORNER_BASE; + isp->mmio_base[ISP_IOMEM_CSI0_HOST] = isp->isp_regs + CSI_HOST_BASE; +- isp->mmio_base[ISP_IOMEM_CSI1_HOST] = isp->isp_regs + CSI1_HOST_BASE; ++ isp->mmio_base[ISP_IOMEM_CSI1_HOST] = isp->isp_regs + CSI1_HOST_BASE; + isp->mmio_base[ISP_IOMEM_VI_WRAP] = isp->isp_regs + VI_WRAP_BASE; + isp->mmio_base[ISP_IOMEM_VI_PIPE_CSI00] = isp->isp_regs + VI_PIPE_CSI_0_0_REG_BASE; + isp->mmio_base[ISP_IOMEM_VI_PIPE_CSI01] = isp->isp_regs + VI_PIPE_CSI_0_1_REG_BASE; +@@ -75,7 +75,7 @@ static void k510isp_addr_init(struct k510_isp_device *isp) + isp->mmio_base[ISP_IOMEM_VI_PIPE_CSI10] = isp->isp_regs + VI_PIPE_CSI_1_0_REG_BASE; + isp->mmio_base[ISP_IOMEM_VI_PIPE_CSI11] = isp->isp_regs + VI_PIPE_CSI_1_1_REG_BASE; + isp->mmio_base[ISP_IOMEM_VI_PIPE_CSI12] = isp->isp_regs + VI_PIPE_CSI_1_2_REG_BASE; +- isp->mmio_base[ISP_IOMEM_VI_PIPE_DVP0] = isp->isp_regs + VI_PIPE_DVP_0_REG_BASE; ++ isp->mmio_base[ISP_IOMEM_VI_PIPE_DVP0] = isp->isp_regs + VI_PIPE_DVP_0_REG_BASE; + isp->mmio_base[ISP_IOMEM_VI_PIPE_DVP1] = isp->isp_regs + VI_PIPE_DVP_1_REG_BASE; + isp->mmio_base[ISP_IOMEM_F2K_WRAP] = isp->isp_regs + ISP_F2K_WRAP_BASE; + isp->mmio_base[ISP_IOMEM_F2K_CORE] = isp->isp_regs + ISP_F2K_CORE_BASE; +@@ -83,16 +83,16 @@ static void k510isp_addr_init(struct k510_isp_device *isp) + isp->mmio_base[ISP_IOMEM_F2K_FBC] = isp->isp_regs + ISP_F2K_FBC_BASE; + isp->mmio_base[ISP_IOMEM_F2K_FBD] = isp->isp_regs + ISP_F2K_FBD_BASE; + isp->mmio_base[ISP_IOMEM_F2K_DS] = isp->isp_regs + ISP_F2K_DS_BASE; +- isp->mmio_base[ISP_IOMEM_F2K_MAIN_REMAP] = isp->isp_regs + ISP_F2K_MAIN_REMAP_BASE; ++ isp->mmio_base[ISP_IOMEM_F2K_MAIN_REMAP] = isp->isp_regs + ISP_F2K_MAIN_REMAP_BASE; + isp->mmio_base[ISP_IOMEM_F2K_OUT0_REMAP] = isp->isp_regs + ISP_F2K_OUT0_REMAP_BASE; +- isp->mmio_base[ISP_IOMEM_F2K_OUT1_REMAP] = isp->isp_regs + ISP_F2K_OUT1_REMAP_BASE; ++ isp->mmio_base[ISP_IOMEM_F2K_OUT1_REMAP] = isp->isp_regs + ISP_F2K_OUT1_REMAP_BASE; + isp->mmio_base[ISP_IOMEM_R2K_WRAP] = isp->isp_regs + ISP_R2K_WRAP_BASE; + isp->mmio_base[ISP_IOMEM_R2K_CORE] = isp->isp_regs + ISP_R2K_CORE_BASE; + isp->mmio_base[ISP_IOMEM_R2K_CORE_TABLE] = isp->isp_regs + ISP_R2K_CORE_TABLE_BASE; + isp->mmio_base[ISP_IOMEM_R2K_DS] = isp->isp_regs + ISP_R2K_DS_BASE; +- isp->mmio_base[ISP_IOMEM_R2K_MAIN_REMAP] = isp->isp_regs + ISP_R2K_MAIN_REMAP_BASE; ++ isp->mmio_base[ISP_IOMEM_R2K_MAIN_REMAP] = isp->isp_regs + ISP_R2K_MAIN_REMAP_BASE; + isp->mmio_base[ISP_IOMEM_R2K_OUT0_REMAP] = isp->isp_regs + ISP_R2K_OUT0_REMAP_BASE; +- isp->mmio_base[ISP_IOMEM_R2K_OUT1_REMAP] = isp->isp_regs + ISP_R2K_OUT1_REMAP_BASE; ++ isp->mmio_base[ISP_IOMEM_R2K_OUT1_REMAP] = isp->isp_regs + ISP_R2K_OUT1_REMAP_BASE; + } + + #if (PROFILE_FRAME_RATE | PROFILE_INTERRUPT) +@@ -171,7 +171,7 @@ static void __k510isp_subclk_update(struct k510_isp_device *isp) + } + + void k510isp_subclk_enable(struct k510_isp_device *isp, +- enum k510isp_subclk_resource res) ++ enum k510isp_subclk_resource res) + { + isp->subclk_resources |= res; + +@@ -179,7 +179,7 @@ void k510isp_subclk_enable(struct k510_isp_device *isp, + } + + void k510isp_subclk_disable(struct k510_isp_device *isp, +- enum k510isp_subclk_resource res) ++ enum k510isp_subclk_resource res) + { + isp->subclk_resources &= ~res; + +@@ -199,25 +199,25 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[MIPI_CORNER]); + if(ret){ + dev_err(isp->dev, "failed to enable mipi corner clk\n"); +- goto out_mipi_corner_clk; ++ goto out_mipi_corner_clk; + } + // + ret = clk_prepare_enable(isp->clock[MIPI_REF]); + if(ret){ + dev_err(isp->dev, "failed to enable mipi ref clk\n"); +- goto out_mipi_ref_clk; ++ goto out_mipi_ref_clk; + } + // + ret = clk_prepare_enable(isp->clock[MIPI_RXPHY_REF]); + if(ret){ + dev_err(isp->dev, "failed to enable mipi rxphy ref clk\n"); +- goto out_mipi_rxphy_ref_clk; ++ goto out_mipi_rxphy_ref_clk; + } + // + ret = clk_prepare_enable(isp->clock[CSI0_SYSTEM]); + if(ret){ + dev_err(isp->dev, "failed to enable csi0 system clk\n"); +- goto out_csi0_system_clk; ++ goto out_csi0_system_clk; + } + + ret = clk_set_rate(isp->clock[CSI0_SYSTEM], SYSTEM_16600_CLK); +@@ -229,13 +229,13 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[CSI0_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable csi0 apb clk\n"); +- goto out_csi0_apb_clk; ++ goto out_csi0_apb_clk; + } +- // ++ // + ret = clk_prepare_enable(isp->clock[CSI0_PIXEL]); + if(ret){ + dev_err(isp->dev, "failed to enable csi0 pixel clk\n"); +- goto out_csi0_pixel_clk; ++ goto out_csi0_pixel_clk; + } + + ret = clk_set_rate(isp->clock[CSI0_PIXEL], PIXEL_14850_CLK); +@@ -247,7 +247,7 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[CSI1_SYSTEM]); + if(ret){ + dev_err(isp->dev, "failed to enable csi1 system clk\n"); +- goto out_csi1_system_clk; ++ goto out_csi1_system_clk; + } + + ret = clk_set_rate(isp->clock[CSI1_SYSTEM], SYSTEM_16600_CLK); +@@ -259,13 +259,13 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[CSI1_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable csi1 apb clk\n"); +- goto out_csi1_apb_clk; +- } ++ goto out_csi1_apb_clk; ++ } + // + ret = clk_prepare_enable(isp->clock[CSI1_PIXEL]); + if(ret){ + dev_err(isp->dev, "failed to enable csi1 pixel clk\n"); +- goto out_csi1_pixel_clk; ++ goto out_csi1_pixel_clk; + } + + ret = clk_set_rate(isp->clock[CSI1_PIXEL], PIXEL_14850_CLK); +@@ -277,19 +277,19 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[VI_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable vi apb clk\n"); +- goto out_vi_apb_clk; ++ goto out_vi_apb_clk; + } + // + ret = clk_prepare_enable(isp->clock[VI_AXI]); + if(ret){ + dev_err(isp->dev, "failed to enable vi axi clk\n"); +- goto out_vi_axi_clk; ++ goto out_vi_axi_clk; + } + // + ret = clk_prepare_enable(isp->clock[TPG_PIXEL]); + if(ret){ + dev_err(isp->dev, "failed to enable tpg pixel clk\n"); +- goto out_tpg_pixel_clk; ++ goto out_tpg_pixel_clk; + } + + ret = clk_set_rate(isp->clock[TPG_PIXEL], PIXEL_7425_CLK); +@@ -301,49 +301,49 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + ret = clk_prepare_enable(isp->clock[ISP_F2K_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable isp f2k apb clk\n"); +- goto out_isp_f2k_apb_clk; ++ goto out_isp_f2k_apb_clk; + } + // + ret = clk_prepare_enable(isp->clock[ISP_F2K_AXI]); + if(ret){ + dev_err(isp->dev, "failed to enable isp f2k axi clk\n"); +- goto out_isp_f2k_axi_clk; ++ goto out_isp_f2k_axi_clk; + } + // + ret = clk_prepare_enable(isp->clock[ISP_R2K_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable isp r2k apb clk\n"); +- goto out_isp_r2k_apb_clk; ++ goto out_isp_r2k_apb_clk; + } + // + ret = clk_prepare_enable(isp->clock[ISP_R2K_AXI]); + if(ret){ + dev_err(isp->dev, "failed to enable isp r2k axi clk\n"); +- goto out_isp_r2k_axi_clk; ++ goto out_isp_r2k_axi_clk; + } + // + ret = clk_prepare_enable(isp->clock[ISP_TOF_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable isp tof apb clk\n"); +- goto out_isp_tof_apb_clk; ++ goto out_isp_tof_apb_clk; + } + // + ret = clk_prepare_enable(isp->clock[ISP_TOF_AXI]); + if(ret){ + dev_err(isp->dev, "failed to enable isp tof axi clk\n"); +- goto out_isp_tof_axi_clk; ++ goto out_isp_tof_axi_clk; + } + // + ret = clk_prepare_enable(isp->clock[FBC_APB]); + if(ret){ + dev_err(isp->dev, "failed to enable fbc apb clk\n"); +- goto out_fbc_apb_clk; ++ goto out_fbc_apb_clk; + } + // + ret = clk_prepare_enable(isp->clock[FBC_AXI]); + if(ret){ + dev_err(isp->dev, "failed to enable fbc axi clk\n"); +- goto out_fbc_axi_clk; ++ goto out_fbc_axi_clk; + } + return 0; + +@@ -357,7 +357,7 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + clk_disable_unprepare(isp->clock[ISP_R2K_AXI]); + out_isp_r2k_axi_clk: + clk_disable_unprepare(isp->clock[ISP_R2K_APB]); +-out_isp_r2k_apb_clk: ++out_isp_r2k_apb_clk: + clk_disable_unprepare(isp->clock[ISP_F2K_AXI]); + out_isp_f2k_axi_clk: + clk_disable_unprepare(isp->clock[ISP_F2K_APB]); +@@ -382,7 +382,7 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + out_csi0_system_clk: + clk_disable_unprepare(isp->clock[MIPI_RXPHY_REF]); + out_mipi_rxphy_ref_clk: +- clk_disable_unprepare(isp->clock[MIPI_REF]); ++ clk_disable_unprepare(isp->clock[MIPI_REF]); + out_mipi_ref_clk: + clk_disable_unprepare(isp->clock[MIPI_CORNER]); + out_mipi_corner_clk: +@@ -397,8 +397,8 @@ int k510isp_enable_clocks(struct k510_isp_device *isp) + rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); + if (rate != CM_CAM_MCLK_HZ) + dev_warn(isp->dev, "unexpected cam_mclk rate:\n" +- " expected : %d\n" +- " actual : %ld\n", CM_CAM_MCLK_HZ, rate); ++ " expected : %d\n" ++ " actual : %ld\n", CM_CAM_MCLK_HZ, rate); + + + +@@ -416,10 +416,10 @@ void k510isp_disable_clocks(struct k510_isp_device *isp) + clk_disable_unprepare(isp->clock[MIPI_REF]); + clk_disable_unprepare(isp->clock[MIPI_RXPHY_REF]); + clk_disable_unprepare(isp->clock[CSI0_SYSTEM]); +- clk_disable_unprepare(isp->clock[CSI0_APB]); ++ clk_disable_unprepare(isp->clock[CSI0_APB]); + clk_disable_unprepare(isp->clock[CSI0_PIXEL]); + clk_disable_unprepare(isp->clock[CSI1_SYSTEM]); +- clk_disable_unprepare(isp->clock[CSI1_APB]); ++ clk_disable_unprepare(isp->clock[CSI1_APB]); + clk_disable_unprepare(isp->clock[CSI1_PIXEL]); + clk_disable_unprepare(isp->clock[VI_AXI]); + clk_disable_unprepare(isp->clock[VI_APB]); +@@ -439,10 +439,10 @@ static const char *k510isp_clocks[] = { + "mipi_ref", + "mipi_rxphy_ref", + "csi0_system", +- "csi0_apb", ++ "csi0_apb", + "csi0_pixel", + "csi1_system", +- "csi1_apb", ++ "csi1_apb", + "csi1_pixel", + "vi_axi", + "vi_apb", +@@ -526,7 +526,7 @@ static int k510isp_reset(struct k510_isp_device *isp) + reset_control_reset(isp->reset[ISP_F2K_RST]); + reset_control_reset(isp->reset[FBC_RST]); + reset_control_reset(isp->reset[ISP_R2K_RST]); +- reset_control_reset(isp->reset[ISP_TOF_RST]); ++ reset_control_reset(isp->reset[ISP_TOF_RST]); + isp->stop_failure = false; + media_entity_enum_zero(&isp->crashed); + return 0; +@@ -627,10 +627,10 @@ static struct k510_isp_device *__k510isp_get(struct k510_isp_device *isp, bool i + return __isp; + } + /** +- * @brief +- * +- * @param isp +- * @return struct k510_isp_device* ++ * @brief ++ * ++ * @param isp ++ * @return struct k510_isp_device* + */ + struct k510_isp_device *k510isp_get(struct k510_isp_device *isp) + { +@@ -662,7 +662,7 @@ static void __k510isp_put(struct k510_isp_device *isp, bool save_ctx) + * only way to recover from such conditions. + */ + if (!media_entity_enum_empty(&isp->crashed) || +- isp->stop_failure) ++ isp->stop_failure) + k510isp_reset(isp); + k510isp_disable_clocks(isp); + } +@@ -671,9 +671,9 @@ static void __k510isp_put(struct k510_isp_device *isp, bool save_ctx) + } + + /** +- * @brief +- * +- * @param isp ++ * @brief ++ * ++ * @param isp + */ + void k510isp_put(struct k510_isp_device *isp) + { +@@ -683,76 +683,76 @@ void k510isp_put(struct k510_isp_device *isp) + + static void profile_int_interval(struct k510_isp_profile *profile) + { +-#ifdef PROFILE_INTERRUPT +- profile->int_time = get_usec(); +- if(profile->prev_int_time != 0) +- { +- unsigned long long time; +- time = profile->int_time - profile->prev_int_time; +- if(time > profile->max_int_interval) +- { +- profile->max_int_interval = time; +- } +- if(time < profile->min_int_interval) +- { +- profile->min_int_interval = time; +- } +- if(time > INT_BIG_INTERVAL) +- { +- profile->big_inter_cnt++; +- } +- if(time < INT_BIG_INTERVAL/2) +- { +- profile->small_inter_cnt++; +- } +- profile->cur_int_interval = time; +- } +- profile->prev_int_time = profile->int_time; +- +- profile->pic_cnt++; ++#ifdef PROFILE_INTERRUPT ++ profile->int_time = get_usec(); ++ if(profile->prev_int_time != 0) ++ { ++ unsigned long long time; ++ time = profile->int_time - profile->prev_int_time; ++ if(time > profile->max_int_interval) ++ { ++ profile->max_int_interval = time; ++ } ++ if(time < profile->min_int_interval) ++ { ++ profile->min_int_interval = time; ++ } ++ if(time > INT_BIG_INTERVAL) ++ { ++ profile->big_inter_cnt++; ++ } ++ if(time < INT_BIG_INTERVAL/2) ++ { ++ profile->small_inter_cnt++; ++ } ++ profile->cur_int_interval = time; ++ } ++ profile->prev_int_time = profile->int_time; ++ ++ profile->pic_cnt++; + #endif + + } + + static void profile_int_duration(struct k510_isp_profile *profile) + { +-#ifdef PROFILE_INTERRUPT +- if(profile->int_time != 0) +- { +- unsigned long long time; +- +- time = get_usec() - profile->int_time; +- if(time > profile->max_int_duration) +- { +- profile->max_int_duration = time; +- } +- if(time > INT_BIG_DURATION) +- { +- profile->big_dur_cnt++; +- } +- profile->cur_int_duration = time; +- } ++#ifdef PROFILE_INTERRUPT ++ if(profile->int_time != 0) ++ { ++ unsigned long long time; ++ ++ time = get_usec() - profile->int_time; ++ if(time > profile->max_int_duration) ++ { ++ profile->max_int_duration = time; ++ } ++ if(time > INT_BIG_DURATION) ++ { ++ profile->big_dur_cnt++; ++ } ++ profile->cur_int_duration = time; ++ } + #endif + } + + static void profile_int_framerate(struct k510_isp_profile *profile) + { + #ifdef PROFILE_FRAME_RATE +- if(profile->pic_cnt == 1) +- { +- profile->start_time = get_usec(); +- } +- +- if(profile->pic_cnt % 150 == 0) +- { +- unsigned long long tmp1, tmp2, tmp3; +- +- tmp1 = profile->pic_cnt*1000; +- tmp2 = (get_usec()-profile->start_time)/1000; +- tmp3 = tmp1/tmp2; +- printk("isp profile %d pictures. Average FrameRate = %lld Fps\n", profile->pic_cnt, tmp3); +- } +-#endif ++ if(profile->pic_cnt == 1) ++ { ++ profile->start_time = get_usec(); ++ } ++ ++ if(profile->pic_cnt % 150 == 0) ++ { ++ unsigned long long tmp1, tmp2, tmp3; ++ ++ tmp1 = profile->pic_cnt*1000; ++ tmp2 = (get_usec()-profile->start_time)/1000; ++ tmp3 = tmp1/tmp2; ++ printk("isp profile %d pictures. Average FrameRate = %lld Fps\n", profile->pic_cnt, tmp3); ++ } ++#endif + + } + +@@ -765,18 +765,17 @@ static void profile_int_framerate(struct k510_isp_profile *profile) + */ + + int isp_status = 0; +-static irqreturn_t k510isp_f2k_isr(int irq, void *_isp) ++static irqreturn_t k510isp_f2k_isr(int irq, void *_isp) + { + struct k510_isp_device *isp = _isp; + u32 f2k_core_irqstatus; + u32 f2k_irqstatus0; + u32 f2k_irqstatus1; + u32 reg ; +- if(v4l2_init_flag == 0) +- return IRQ_HANDLED; ++ + dev_dbg(isp->dev,"%s:start\n",__func__); + +- ++ + static u32 events = IRQW0_STS_MAIN_Y_FRAME_IRQ|IRQW0_STS_MAIN_UV_FRAME_IRQ; + static u32 ds0_events = 0; + static u32 ds1_events = 0; +@@ -804,50 +803,53 @@ static irqreturn_t k510isp_f2k_isr(int irq, void *_isp) + f2k_irqstatus1 = isp_reg_readl(isp, ISP_IOMEM_F2K_WRAP, ISP_WRAP_DMA_WR_INT_STATUS1); + isp_reg_writel(isp, f2k_irqstatus1, ISP_IOMEM_F2K_WRAP, ISP_WRAP_DMA_WR_INT_STATUS1); + ++ if (v4l2_init_flag == 0) ++ return IRQ_HANDLED; ++ + if(f2k_irqstatus1 & IRQW1_STS_OUT0_Y_FRAME_ERR_IRQ) + { +- isp->isp_f2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_f2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(f2k_irqstatus1 & IRQW1_STS_OUT0_Y_IMM_ERR_IRQ) + { +- isp->isp_f2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_f2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(f2k_irqstatus1 & IRQW1_STS_OUT0_UV_FRAME_ERR_IRQ) + { +- isp->isp_f2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_f2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(f2k_irqstatus1 & IRQW1_STS_OUT0_UV_IMM_ERR_IRQ) + { +- isp->isp_f2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_f2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + + if(f2k_irqstatus0 & IRQW0_STS_MAIN_Y_FRAME_IRQ) + { +- events |= IRQW0_STS_MAIN_Y_FRAME_IRQ; ++ events |= IRQW0_STS_MAIN_Y_FRAME_IRQ; + } + if(f2k_irqstatus0 & IRQW0_STS_MAIN_UV_FRAME_IRQ) + { +- events |= IRQW0_STS_MAIN_UV_FRAME_IRQ; ++ events |= IRQW0_STS_MAIN_UV_FRAME_IRQ; + } + if(f2k_irqstatus1 & IRQW1_STS_OUT0_Y_FRAME_IRQ) + { +- ds0_events |= IRQW1_STS_OUT0_Y_FRAME_IRQ; ++ ds0_events |= IRQW1_STS_OUT0_Y_FRAME_IRQ; + } + if(f2k_irqstatus1 & IRQW1_STS_OUT0_UV_FRAME_IRQ) + { +- ds0_events |= IRQW1_STS_OUT0_UV_FRAME_IRQ; ++ ds0_events |= IRQW1_STS_OUT0_UV_FRAME_IRQ; + } + if(f2k_irqstatus1 & IRQW1_STS_OUT1_Y_FRAME_IRQ) + { +- ds1_events |= IRQW1_STS_OUT1_Y_FRAME_IRQ; ++ ds1_events |= IRQW1_STS_OUT1_Y_FRAME_IRQ; + } + if(f2k_irqstatus1 & IRQW1_STS_OUT1_UV_FRAME_IRQ) + { +- ds1_events |= IRQW1_STS_OUT1_UV_FRAME_IRQ; ++ ds1_events |= IRQW1_STS_OUT1_UV_FRAME_IRQ; + } + if(ds0_events == (IRQW1_STS_OUT0_Y_FRAME_IRQ|IRQW1_STS_OUT0_UV_FRAME_IRQ)) + { +@@ -861,25 +863,25 @@ static irqreturn_t k510isp_f2k_isr(int irq, void *_isp) + if(f2k_core_irqstatus & CORE_STS_3A_OUT_IRQ) + { + +-// k510isp_stat_isr(&isp->isp_f2k_ae); +-// k510isp_stat_isr(&isp->isp_f2k_awb); ++ // k510isp_stat_isr(&isp->isp_f2k_ae); ++ // k510isp_stat_isr(&isp->isp_f2k_awb); + +- isp->isp_ae_flag = 1; +- wake_up_interruptible(&isp->isp_wait_ae_irq); /* 唤醒休眠的进程,即调用read函数的进程 */ ++ isp->isp_ae_flag = 1; ++ wake_up_interruptible(&isp->isp_wait_ae_irq); /* 唤醒休眠的进程,即调用read函数的进程 */ + + +- // k510isp_stat_isr(&isp->isp_f2k_af); +- } +- ++ // k510isp_stat_isr(&isp->isp_f2k_af); ++ } ++ + if(events == (IRQW0_STS_MAIN_Y_FRAME_IRQ|IRQW0_STS_MAIN_UV_FRAME_IRQ)) + { + k510isp_f2k_main_isr(&isp->isp_f2k, f2k_irqstatus0 & events); + events = 0; + } +- ++ + if(ds0_events == (IRQW1_STS_OUT0_Y_FRAME_IRQ|IRQW1_STS_OUT0_UV_FRAME_IRQ)) + { +- profile_int_framerate(&isp->isp_f2k.profile[1]); ++ profile_int_framerate(&isp->isp_f2k.profile[1]); + + k510isp_f2k_ds0_isr(&isp->isp_f2k, ds0_events); + ds0_events = 0; +@@ -904,7 +906,7 @@ static irqreturn_t k510isp_f2k_isr(int irq, void *_isp) + * Handles the corresponding callback if plugged in. + */ + static int r2k_cut = 0; +-static irqreturn_t k510isp_r2k_isr(int irq, void *_isp) ++static irqreturn_t k510isp_r2k_isr(int irq, void *_isp) + { + struct k510_isp_device *isp = _isp; + u32 r2k_core_irqstatus; +@@ -927,48 +929,48 @@ static irqreturn_t k510isp_r2k_isr(int irq, void *_isp) + + if(r2k_irqstatus1 & IRQW1_STS_OUT0_Y_FRAME_ERR_IRQ) + { +- isp->isp_r2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_r2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(r2k_irqstatus1 & IRQW1_STS_OUT0_Y_IMM_ERR_IRQ) + { +- isp->isp_r2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_r2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(r2k_irqstatus1 & IRQW1_STS_OUT0_UV_FRAME_ERR_IRQ) + { +- isp->isp_r2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_r2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + else if(r2k_irqstatus1 & IRQW1_STS_OUT0_UV_IMM_ERR_IRQ) + { +- isp->isp_r2k.dmaErrCnt++; +- return IRQ_HANDLED; ++ isp->isp_r2k.dmaErrCnt++; ++ return IRQ_HANDLED; + } + +- if(r2k_irqstatus0 & IRQW0_STS_MAIN_Y_FRAME_IRQ) +- { +- events |= IRQW0_STS_MAIN_Y_FRAME_IRQ; ++ if(r2k_irqstatus0 & IRQW0_STS_MAIN_Y_FRAME_IRQ) ++ { ++ events |= IRQW0_STS_MAIN_Y_FRAME_IRQ; + } + if(r2k_irqstatus0 & IRQW0_STS_MAIN_UV_FRAME_IRQ) + { +- events |= IRQW0_STS_MAIN_UV_FRAME_IRQ; ++ events |= IRQW0_STS_MAIN_UV_FRAME_IRQ; + } + if(r2k_irqstatus1 & IRQW1_STS_OUT0_Y_FRAME_IRQ) + { +- ds0_events |= IRQW1_STS_OUT0_Y_FRAME_IRQ; ++ ds0_events |= IRQW1_STS_OUT0_Y_FRAME_IRQ; + } + if(r2k_irqstatus1 & IRQW1_STS_OUT0_UV_FRAME_IRQ) + { +- ds0_events |= IRQW1_STS_OUT0_UV_FRAME_IRQ; ++ ds0_events |= IRQW1_STS_OUT0_UV_FRAME_IRQ; + } + if(r2k_irqstatus1 & IRQW1_STS_OUT1_Y_FRAME_IRQ) + { +- ds1_events |= IRQW1_STS_OUT1_Y_FRAME_IRQ; ++ ds1_events |= IRQW1_STS_OUT1_Y_FRAME_IRQ; + } + if(r2k_irqstatus1 & IRQW1_STS_OUT1_UV_FRAME_IRQ) + { +- ds1_events |= IRQW1_STS_OUT1_UV_FRAME_IRQ; ++ ds1_events |= IRQW1_STS_OUT1_UV_FRAME_IRQ; + } + if(ds0_events == (IRQW1_STS_OUT0_Y_FRAME_IRQ|IRQW1_STS_OUT0_UV_FRAME_IRQ)) + { +@@ -977,33 +979,33 @@ static irqreturn_t k510isp_r2k_isr(int irq, void *_isp) + if(ds1_events == (IRQW1_STS_OUT1_Y_FRAME_IRQ|IRQW1_STS_OUT1_UV_FRAME_IRQ)) + { + profile_int_interval(&isp->isp_r2k.profile[2]); +- } ++ } + +- if(r2k_core_irqstatus & CORE_STS_3A_OUT_IRQ) ++ if(r2k_core_irqstatus & CORE_STS_3A_OUT_IRQ) + { +- + +- // k510isp_stat_isr(&isp->isp_r2k_ae); +- // k510isp_stat_isr(&isp->isp_r2k_awb); + +- isp->isp_r2k_ae_flag = 1; +- wake_up_interruptible(&isp->isp_wait_r2k_ae_irq); /* 唤醒休眠的进程,即调用read函数的进程 */ ++ // k510isp_stat_isr(&isp->isp_r2k_ae); ++ // k510isp_stat_isr(&isp->isp_r2k_awb); ++ ++ isp->isp_r2k_ae_flag = 1; ++ wake_up_interruptible(&isp->isp_wait_r2k_ae_irq); /* 唤醒休眠的进程,即调用read函数的进程 */ + + // k510isp_stat_isr(&isp->isp_r2k_af); +- } ++ } + + if(events == (IRQW0_STS_MAIN_Y_FRAME_IRQ|IRQW0_STS_MAIN_UV_FRAME_IRQ)) + { + k510isp_r2k_main_isr(&isp->isp_r2k, r2k_irqstatus0 & events); + events = 0; +- } +- ++ } ++ + if(ds0_events == (IRQW1_STS_OUT0_Y_FRAME_IRQ|IRQW1_STS_OUT0_UV_FRAME_IRQ)) + { +- profile_int_framerate(&isp->isp_r2k.profile[1]); ++ profile_int_framerate(&isp->isp_r2k.profile[1]); + + k510isp_r2k_ds0_isr(&isp->isp_r2k, ds0_events); +- ds0_events = 0; ++ ds0_events = 0; + } + + if(ds1_events == (IRQW1_STS_OUT1_Y_FRAME_IRQ|IRQW1_STS_OUT1_UV_FRAME_IRQ)) +@@ -1018,8 +1020,8 @@ static irqreturn_t k510isp_r2k_isr(int irq, void *_isp) + return IRQ_HANDLED; + } + /** +- * @brief +- * ++ * @brief ++ * + */ + static const struct media_device_ops k510isp_media_ops = { + .link_notify = v4l2_pipeline_link_notify, +@@ -1039,7 +1041,7 @@ static const struct media_device_ops k510isp_media_ops = { + * operation otherwise. + */ + static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, +- enum k510isp_pipeline_stream_state mode) ++ enum k510isp_pipeline_stream_state mode) + { + struct k510_isp_device *isp = pipe->output->isp; + struct media_entity *entity; +@@ -1066,7 +1068,7 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + { + dev_err(isp->dev,"%s:media_entity_enum_intersects\n",__func__); + return -EIO; +- } ++ } + + spin_lock_irqsave(&pipe->lock, flags); + pipe->state &= ~(ISP_PIPELINE_IDLE_INPUT | ISP_PIPELINE_IDLE_OUTPUT); +@@ -1088,13 +1090,13 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + { + dev_warn(isp->dev,"%s:is_media_entity_v4l2_subdev pad->flags(0x%x)\n",__func__,pad->flags); + break; +- } ++ } + + pad = media_entity_remote_pad(pad); + if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) + { + dev_warn(isp->dev,"%s:is_media_entity_v4l2_subdev pad(0x%x)\n",__func__,pad); +- break; ++ break; + } + + entity = pad->entity; +@@ -1106,30 +1108,30 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + { + dev_err(isp->dev,"%s:ret(%d)\n",__func__,ret); + return ret; +- } ++ } + + if(i == 0) + { + if((cur_video == &isp->isp_f2k.video_out[0].video)||(cur_video == &isp->isp_f2k.video_out[1].video) +- ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_f2k.video_out[2].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) + { + dev_info(isp->dev,"%s:f2k cur_video(%p) f2k_used[0] (%d)\n",__func__,cur_video,isp->f2k_used[0]); +- if(isp->f2k_used[0] == 1) ++ if(isp->f2k_used[0] == 1) + { + dev_info(isp->dev,"%s:i(%d) f2k_used[0] (%d)f2k multivideo!\n",__func__,i,isp->f2k_used[0]); +- break; ++ break; + } + } + if((cur_video == &isp->isp_r2k.video_out[0].video)||(cur_video == &isp->isp_r2k.video_out[1].video) +- ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_r2k.video_out[2].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) + { + dev_info(isp->dev,"%s:r2k cur_video(%p) r2k_used[0](%d)\n",__func__,cur_video,isp->r2k_used[0]); + if(isp->r2k_used[0] == 1) + { + dev_info(isp->dev,"%s:i(%d) r2k_used[0](%d) r2k multivideo!\n",__func__,i,isp->r2k_used[0]); +- break; ++ break; + } +- ++ + } + } + +@@ -1143,7 +1145,7 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + pipe->do_propagation = true; + use_f2k = 1; + } +-// ++ // + if (subdev == &isp->isp_r2k.subdev) { + v4l2_subdev_call(&isp->isp_r2k_awb.subdev, video, + s_stream, mode); +@@ -1152,7 +1154,7 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + v4l2_subdev_call(&isp->isp_r2k_af.subdev, video, + s_stream, mode); + pipe->do_propagation = true; +- use_r2k = 1; ++ use_r2k = 1; + sink_pads[2] = VI_PAD_SINK_CSI1;//2; + sink_pads[3] = CSI2_PAD_SINK1;//1; + } +@@ -1164,24 +1166,24 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + { + sensor_pad = media_entity_remote_pad(&isp->isp_csi2.pads[CSI2_PAD_SINK0]); + sensor = media_entity_to_v4l2_subdev(sensor_pad->entity); +- v4l2_subdev_call(sensor, video, s_stream, mode); ++ v4l2_subdev_call(sensor, video, s_stream, mode); + } + + if(1 == use_r2k) + { + sensor_pad = media_entity_remote_pad(&isp->isp_csi2.pads[CSI2_PAD_SINK1]); + sensor = media_entity_to_v4l2_subdev(sensor_pad->entity); +- v4l2_subdev_call(sensor, video, s_stream, mode); ++ v4l2_subdev_call(sensor, video, s_stream, mode); + } +- if(i >= 2) ++ if(i >= 2) + { + dev_info(isp->dev,"%s:i(%d) use the second camera!\n",__func__,i); + break; //dual camera + } + } +- else ++ else + { +- if(i >= 4) ++ if(i >= 4) + { + dev_info(isp->dev,"%s:i(%d) use the first camera!\n",__func__,i); + break; //dual camera +@@ -1191,7 +1193,7 @@ static int k510isp_pipeline_enable(struct k510isp_pipeline *pipe, + dev_dbg(isp->dev,"%s:i(%d) end while\n",__func__,i); + // + struct isp_cfg_info *isp_cfg = &isp->isp_f2k.isp_cfg; +- struct isp_core_wdr_Info *wdrCoreInfo = &isp_cfg->isp_core_cfg.wdrInfo; ++ struct isp_core_wdr_Info *wdrCoreInfo = &isp_cfg->isp_core_cfg.wdrInfo; + if((1 == use_f2k) && (isp->f2k_used[0] == 0)) + { + isp_f2k_core_table_init(isp,wdrCoreInfo); +@@ -1236,7 +1238,7 @@ static int k510isp_pipeline_wait_r2k(struct k510_isp_device *isp) + #define ISP_STOP_TIMEOUT msecs_to_jiffies(1000) + + static int k510isp_pipeline_wait(struct k510_isp_device *isp, +- int(*busy)(struct k510_isp_device *isp)) ++ int(*busy)(struct k510_isp_device *isp)) + { + unsigned long timeout = jiffies + ISP_STOP_TIMEOUT; + dev_dbg(isp->dev,"%s:start\n",__func__); +@@ -1274,10 +1276,10 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + unsigned long use_r2k = 0; + + v4l2_init_flag = 0; +- cur_video = &pipe->output->video; ++ cur_video = &pipe->output->video; + dev_info(isp->dev,"%s:cur_video(%p) video (%p) pipe(%p)start\n",__func__,cur_video,video,pipe); + cur_video = (struct video_device*)video; +- dev_info(isp->dev,"%s:cur_video(%p) video (%p) pipe(%p)start\n",__func__,cur_video,video,pipe); ++ dev_info(isp->dev,"%s:cur_video(%p) video (%p) pipe(%p)start\n",__func__,cur_video,video,pipe); + /* + * We need to stop all the modules after CCDC first or they'll + * never stop since they may not get a full frame from CCDC. +@@ -1308,16 +1310,16 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + if( j == 0) + { + if((cur_video == &isp->isp_f2k.video_out[0].video)||(cur_video == &isp->isp_f2k.video_out[1].video) +- ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) + { +- v4l2_subdev_call(&isp->isp_f2k_awb.subdev, +- video, s_stream, 0); +- v4l2_subdev_call(&isp->isp_f2k_af.subdev, +- video, s_stream, 0); +- v4l2_subdev_call(&isp->isp_f2k_ae.subdev, +- video, s_stream, 0); +- use_f2k = 1; +- subdev = &isp->isp_f2k.subdev; ++ v4l2_subdev_call(&isp->isp_f2k_awb.subdev, ++ video, s_stream, 0); ++ v4l2_subdev_call(&isp->isp_f2k_af.subdev, ++ video, s_stream, 0); ++ v4l2_subdev_call(&isp->isp_f2k_ae.subdev, ++ video, s_stream, 0); ++ use_f2k = 1; ++ subdev = &isp->isp_f2k.subdev; + } + } + +@@ -1325,17 +1327,17 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + if( j == 0) + { + if((cur_video == &isp->isp_r2k.video_out[0].video)||(cur_video == &isp->isp_r2k.video_out[1].video) +- ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) + { +- v4l2_subdev_call(&isp->isp_r2k_awb.subdev, +- video, s_stream, 0); +- v4l2_subdev_call(&isp->isp_r2k_af.subdev, +- video, s_stream, 0); +- v4l2_subdev_call(&isp->isp_r2k_ae.subdev, +- video, s_stream, 0); +- sink_pads[2] = VI_PAD_SINK_CSI1;//2; +- sink_pads[3] = CSI2_PAD_SINK1;//1; +- use_r2k = 1; ++ v4l2_subdev_call(&isp->isp_r2k_awb.subdev, ++ video, s_stream, 0); ++ v4l2_subdev_call(&isp->isp_r2k_af.subdev, ++ video, s_stream, 0); ++ v4l2_subdev_call(&isp->isp_r2k_ae.subdev, ++ video, s_stream, 0); ++ sink_pads[2] = VI_PAD_SINK_CSI1;//2; ++ sink_pads[3] = CSI2_PAD_SINK1;//1; ++ use_r2k = 1; + subdev = &isp->isp_r2k.subdev; + } + } +@@ -1346,21 +1348,21 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + if( i == 0) + { + if((cur_video == &isp->isp_f2k.video_out[0].video)||(cur_video == &isp->isp_f2k.video_out[1].video) +- ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) + { +- if(isp->f2k_used[1] == 1) ++ if(isp->f2k_used[1] == 1) + { + dev_info(isp->dev,"%s:i(%d) isp->f2k_used[1](%d)f2k multivideo!\n",__func__,i,isp->f2k_used[1]); +- break; ++ break; + } + } + if((cur_video == &isp->isp_r2k.video_out[0].video)||(cur_video == &isp->isp_r2k.video_out[1].video) +- ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) + { + if(isp->r2k_used[1] == 1) + { + dev_info(isp->dev,"%s:i(%d) isp->r2k_used[1](%d)r2k multivideo!\n",__func__,i,isp->r2k_used[1]); +- break; ++ break; + } + } + } +@@ -1373,7 +1375,7 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + ret |= k510isp_pipeline_wait(isp, k510isp_pipeline_wait_f2k); + if (subdev == &isp->isp_r2k.subdev) + ret |= k510isp_pipeline_wait(isp, k510isp_pipeline_wait_r2k); +- ++ + /* Handle stop failures. An entity that fails to stop can + * usually just be restarted. Flag the stop failure nonetheless + * to trigger an ISP reset the next time the device is released, +@@ -1399,24 +1401,24 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + { + sensor_pad = media_entity_remote_pad(&isp->isp_csi2.pads[CSI2_PAD_SINK0]); + sensor = media_entity_to_v4l2_subdev(sensor_pad->entity); +- v4l2_subdev_call(sensor, video, s_stream, 0); ++ v4l2_subdev_call(sensor, video, s_stream, 0); + } + + if(1 == use_r2k) + { + sensor_pad = media_entity_remote_pad(&isp->isp_csi2.pads[CSI2_PAD_SINK1]); + sensor = media_entity_to_v4l2_subdev(sensor_pad->entity); +- v4l2_subdev_call(sensor, video, s_stream, 0); ++ v4l2_subdev_call(sensor, video, s_stream, 0); + } +- if(i >= 2) ++ if(i >= 2) + { + dev_info(isp->dev,"%s:i(%d) use the second camera!\n",__func__,i); + break; //dual camera + } + } +- else ++ else + { +- if(i >= 4) ++ if(i >= 4) + { + dev_info(isp->dev,"%s:i(%d) use the first camera!\n",__func__,i); + break; //dual camera +@@ -1426,14 +1428,14 @@ static int k510isp_pipeline_disable(struct k510isp_pipeline *pipe,struct k510isp + if( i == 0) + { + if((cur_video == &isp->isp_f2k.video_out[0].video)||(cur_video == &isp->isp_f2k.video_out[1].video) +- ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_f2k.video_out[1].video) ||(cur_video == &isp->isp_f2k.video_out[3].video)) + { + isp->f2k_used[1] = 1; + isp->dualcamera_used[1] = 1; + } + + if((cur_video == &isp->isp_r2k.video_out[0].video)||(cur_video == &isp->isp_r2k.video_out[1].video) +- ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) ++ ||(cur_video == &isp->isp_r2k.video_out[1].video) ||(cur_video == &isp->isp_r2k.video_out[3].video)) + { + isp->r2k_used[1] = 1; + isp->dualcamera_used[1] = 1; +@@ -1582,13 +1584,13 @@ static void k510isp_resume_module_pipeline(struct media_entity *me) + * yes, makes the caller to sleep while waiting for such event. + */ + int k510isp_module_sync_idle(struct media_entity *me, wait_queue_head_t *wait, +- atomic_t *stopping) ++ atomic_t *stopping) + { + struct k510isp_pipeline *pipe = to_isp_pipeline(me); + + if (pipe->stream_state == ISP_PIPELINE_STREAM_STOPPED || +- (pipe->stream_state == ISP_PIPELINE_STREAM_SINGLESHOT && +- !k510isp_pipeline_ready(pipe))) ++ (pipe->stream_state == ISP_PIPELINE_STREAM_SINGLESHOT && ++ !k510isp_pipeline_ready(pipe))) + return 0; + + /* +@@ -1639,7 +1641,7 @@ int k510isp_module_sync_idle(struct media_entity *me, wait_queue_head_t *wait, + * Returns 1 if it was stopping or 0 otherwise. + */ + int k510isp_module_sync_is_stopping(wait_queue_head_t *wait, +- atomic_t *stopping) ++ atomic_t *stopping) + { + if (atomic_cmpxchg(stopping, 1, 0)) { + wake_up(wait); +@@ -1666,7 +1668,7 @@ static int k510isp_suspend_modules(struct k510_isp_device *isp) + k510isp_stat_suspend(&isp->isp_r2k_ae); + k510isp_stat_suspend(&isp->isp_r2k_awb); + k510isp_suspend_module_pipeline(&isp->isp_csi2.subdev.entity); +- k510isp_suspend_module_pipeline(&isp->isp_vi.subdev.entity); ++ k510isp_suspend_module_pipeline(&isp->isp_vi.subdev.entity); + k510isp_suspend_module_pipeline(&isp->isp_f2k.subdev.entity); + k510isp_suspend_module_pipeline(&isp->isp_r2k.subdev.entity); + +@@ -1692,9 +1694,9 @@ static void k510isp_resume_modules(struct k510_isp_device *isp) + + } + /** +- * @brief +- * +- * @param isp ++ * @brief ++ * ++ * @param isp + */ + static void k510isp_unregister_entities(struct k510_isp_device *isp) + { +@@ -1715,15 +1717,15 @@ static void k510isp_unregister_entities(struct k510_isp_device *isp) + media_device_cleanup(&isp->media_dev); + } + /** +- * @brief +- * +- * @param isp +- * @param entity +- * @param interface +- * @return int ++ * @brief ++ * ++ * @param isp ++ * @param entity ++ * @param interface ++ * @return int + */ + static int k510isp_link_entity(struct k510_isp_device *isp, struct media_entity *entity, +- enum k510isp_interface_type interface) ++ enum k510isp_interface_type interface) + { + struct media_entity *input; + unsigned int flags; +@@ -1738,27 +1740,27 @@ static int k510isp_link_entity(struct k510_isp_device *isp, struct media_entity + + switch (interface) { + +- case ISP_INTERFACE_DVP: +- input = &isp->isp_f2k.subdev.entity; +- pad = ISP_F2K_PAD_SINK; +- flags = 0; +- break; +- +- case ISP_INTERFACE_CSI1: +- input = &isp->isp_csi2.subdev.entity; +- pad = CSI2_PAD_SINK0; +- flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED; +- break; +- case ISP_INTERFACE_CSI2: +- input = &isp->isp_csi2.subdev.entity; +- pad = CSI2_PAD_SINK1; +- flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED; +- break; +- +- default: +- dev_err(isp->dev, "%s: invalid interface type %u\n", __func__, +- interface); +- return -EINVAL; ++ case ISP_INTERFACE_DVP: ++ input = &isp->isp_f2k.subdev.entity; ++ pad = ISP_F2K_PAD_SINK; ++ flags = 0; ++ break; ++ ++ case ISP_INTERFACE_CSI1: ++ input = &isp->isp_csi2.subdev.entity; ++ pad = CSI2_PAD_SINK0; ++ flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED; ++ break; ++ case ISP_INTERFACE_CSI2: ++ input = &isp->isp_csi2.subdev.entity; ++ pad = CSI2_PAD_SINK1; ++ flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED; ++ break; ++ ++ default: ++ dev_err(isp->dev, "%s: invalid interface type %u\n", __func__, ++ interface); ++ return -EINVAL; + } + + /* +@@ -1769,7 +1771,7 @@ static int k510isp_link_entity(struct k510_isp_device *isp, struct media_entity + */ + if (!input->num_pads) { + dev_err(isp->dev, "%s: invalid input %u\n", entity->name, +- interface); ++ interface); + return -EINVAL; + } + +@@ -1779,7 +1781,7 @@ static int k510isp_link_entity(struct k510_isp_device *isp, struct media_entity + } + if (i == entity->num_pads) { + dev_err(isp->dev, "%s: no source pad in external entity %s\n", +- __func__, entity->name); ++ __func__, entity->name); + return -EINVAL; + } + +@@ -1787,10 +1789,10 @@ static int k510isp_link_entity(struct k510_isp_device *isp, struct media_entity + return media_create_pad_link(entity, i, input, pad, flags); + } + /** +- * @brief +- * +- * @param isp +- * @return int ++ * @brief ++ * ++ * @param isp ++ * @return int + */ + static int k510isp_register_entities(struct k510_isp_device *isp) + { +@@ -1799,7 +1801,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + + isp->media_dev.dev = isp->dev; + strlcpy(isp->media_dev.model, "CANAAN K510 ISP", +- sizeof(isp->media_dev.model)); ++ sizeof(isp->media_dev.model)); + isp->media_dev.hw_revision = isp->f2k_revision; + isp->media_dev.ops = &k510isp_media_ops; + media_device_init(&isp->media_dev); +@@ -1808,18 +1810,18 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + ret = v4l2_device_register(isp->dev, &isp->v4l2_dev); + if (ret < 0) { + dev_err(isp->dev, "%s: V4L2 device registration failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +- dev_dbg(isp->dev,"%s: Register internal entities\n",__func__); ++ dev_dbg(isp->dev,"%s: Register internal entities\n",__func__); + /* Register internal entities */ + dev_dbg(isp->dev,"%s: k510isp_csi2_register_entities\n",__func__); + ret = k510isp_csi2_register_entities(&isp->isp_csi2, &isp->v4l2_dev); + if (ret < 0) + { + dev_err(isp->dev, "%s: k510isp_csi2_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1828,17 +1830,17 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: k510isp_vi_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + + +- dev_dbg(isp->dev,"%s: k510isp_f2k_register_entities\n",__func__); ++ dev_dbg(isp->dev,"%s: k510isp_f2k_register_entities\n",__func__); + ret = k510isp_f2k_register_entities(&isp->isp_f2k,&isp->v4l2_dev); + if (ret < 0) + { + dev_err(isp->dev, "%s: k510isp_f2k_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1847,7 +1849,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: k510isp_r2k_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1855,7 +1857,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_f2k_af k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1863,7 +1865,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_f2k_ae k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1871,7 +1873,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_f2k_awb k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1879,7 +1881,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_r2k_af k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1887,7 +1889,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_r2k_ae k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1895,7 +1897,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: isp_r2k_awb k510isp_stat_register_entities failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto done; + } + +@@ -1904,7 +1906,7 @@ static int k510isp_register_entities(struct k510_isp_device *isp) + done: + k510isp_unregister_entities(isp); + dev_err(isp->dev, "%s: k510isp_register_entities end(%d)\n", +- __func__, ret); ++ __func__, ret); + return ret; + } + +@@ -1930,8 +1932,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -1940,8 +1942,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -1950,8 +1952,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -1960,8 +1962,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + /* Create links between entities and video nodes.*/ +@@ -1973,8 +1975,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -1983,8 +1985,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -1993,8 +1995,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2003,8 +2005,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2013,8 +2015,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2023,8 +2025,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2033,8 +2035,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + // + ret = media_create_pad_link( +@@ -2043,8 +2045,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2053,8 +2055,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2063,8 +2065,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2073,8 +2075,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2083,8 +2085,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2093,8 +2095,8 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + + ret = media_create_pad_link( +@@ -2103,15 +2105,15 @@ static int k510isp_create_links(struct k510_isp_device *isp) + if (ret < 0) + { + dev_err(isp->dev, "%s: media_create_pad_link failed (%d)\n", +- __func__, ret); +- return ret; ++ __func__, ret); ++ return ret; + } + return 0; + } + /** +- * @brief +- * +- * @param isp ++ * @brief ++ * ++ * @param isp + */ + static void k510isp_cleanup_modules(struct k510_isp_device *isp) + { +@@ -2128,10 +2130,10 @@ static void k510isp_cleanup_modules(struct k510_isp_device *isp) + k510isp_r2k_cleanup(isp); + } + /** +- * @brief +- * +- * @param isp +- * @return int ++ * @brief ++ * ++ * @param isp ++ * @return int + */ + static int k510isp_initialize_modules(struct k510_isp_device *isp) + { +@@ -2142,77 +2144,77 @@ static int k510isp_initialize_modules(struct k510_isp_device *isp) + ret = k510isp_dphy_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_dphy_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + return ret; + } + + ret = k510isp_csi2_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_csi2_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_csi2; + } + + ret = k510isp_vi_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_vi_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_vi; + } + + ret = k510isp_f2k_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_f2k_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_f2k; + } +-// ++ // + ret = k510isp_r2k_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_r2k_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_r2k; + } +-// ++ // + ret = k510isp_f2k_ae_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_f2k_ae_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_f2k_ae; + } + + ret = k510isp_f2k_awb_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_f2k_awb_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_f2k_awb; + } + + ret = k510isp_f2k_af_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_f2k_af_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_f2k_af; + } + + ret = k510isp_r2k_ae_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_r2k_ae_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_r2k_ae; + } + + ret = k510isp_r2k_awb_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_r2k_awb_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_r2k_awb; + } + + ret = k510isp_r2k_af_init(isp); + if (ret < 0) { + dev_err(isp->dev, "%s: k510isp_r2k_af_init failed (%d)\n", +- __func__, ret); ++ __func__, ret); + goto error_r2k_af; + } + +@@ -2222,7 +2224,7 @@ static int k510isp_initialize_modules(struct k510_isp_device *isp) + error_r2k_af: + k510isp_r2k_awb_cleanup(isp); + error_r2k_awb: +- k510isp_r2k_ae_cleanup(isp); ++ k510isp_r2k_ae_cleanup(isp); + error_r2k_ae: + k510isp_f2k_af_cleanup(isp); + error_f2k_af: +@@ -2244,7 +2246,7 @@ static int k510isp_initialize_modules(struct k510_isp_device *isp) + return ret; + } + /***************************************************************** +- * ++ * + * **************************************************************/ + static void k510isp_detach_iommu(struct k510_isp_device *isp) + { +@@ -2309,10 +2311,10 @@ static int k510isp_remove(struct platform_device *pdev) + } + + /** +- * @brief +- * +- * @param isp +- * @return int ++ * @brief ++ * ++ * @param isp ++ * @return int + */ + static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cfg *buscfg) + { +@@ -2390,7 +2392,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + } + + rval = fwnode_property_read_u32_array(fwnode, "data-lanes",NULL, 0); +- if (rval > 0) ++ if (rval > 0) + { + csi2_info->csi0_lane_nb = min_t(int, V4L2_FWNODE_CSI2_MAX_DATA_LANES, rval); + fwnode_property_read_u32_array(fwnode, "data-lanes",lane_num, csi2_info->csi0_lane_nb); +@@ -2408,7 +2410,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get data-type\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + csi2_info->csi00_datatype_select0 = out_val; + csi2_info->csi00_datatype_select1 = out_val; +@@ -2421,7 +2423,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get tpg_r_en\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].tpg_r_en = out_val; + +@@ -2429,7 +2431,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get tpg_w_en\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].tpg_w_en = out_val; + +@@ -2437,7 +2439,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get wdr_sensor_vendor\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].wdr_sensor_vendor = (WDR_SENSOR_VENDOR_E)out_val; + csi2_info->csi0_sony_wdr = 0; +@@ -2450,7 +2452,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get wdr_mode\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].wdr_mode = (VI_PIPE_WDR_MODE_E)out_val; + +@@ -2458,7 +2460,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get mipi_csi_mode\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].mipi_mode = (MIPI_CSI_MODE_E)out_val; + +@@ -2466,7 +2468,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get isp_pipeline\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[0].isp_pipeline = (ISP_PIPELINE_E)out_val; + } +@@ -2492,7 +2494,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + } + + rval = fwnode_property_read_u32_array(fwnode, "data-lanes",NULL,0); +- if (rval > 0) ++ if (rval > 0) + { + csi2_info->csi1_lane_nb = min_t(int, V4L2_FWNODE_CSI2_MAX_DATA_LANES, rval); + fwnode_property_read_u32_array(fwnode, "data-lanes",lane_num, csi2_info->csi1_lane_nb); +@@ -2509,7 +2511,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get data-type\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + csi2_info->csi10_datatype_select0 = out_val; + csi2_info->csi10_datatype_select1 = out_val; +@@ -2519,7 +2521,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get tpg_r_en\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].tpg_r_en = out_val; + +@@ -2527,7 +2529,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get tpg_w_en\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].tpg_w_en = out_val; + +@@ -2535,7 +2537,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get wdr_sensor_vendor\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].wdr_sensor_vendor = (WDR_SENSOR_VENDOR_E)out_val; + csi2_info->csi1_sony_wdr = 0; +@@ -2548,7 +2550,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get wdr_mode\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].wdr_mode = (VI_PIPE_WDR_MODE_E)out_val; + +@@ -2556,7 +2558,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get mipi_csi_mode\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].mipi_mode = (MIPI_CSI_MODE_E)out_val; + +@@ -2564,7 +2566,7 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + if(rval != 0) + { + dev_err(dev, "%s:Failed to get isp_pipeline\n",__func__); +- return -EINVAL; ++ return -EINVAL; + } + vi_wrap_cfg->sensor_info[1].isp_pipeline = (ISP_PIPELINE_E)out_val; + } +@@ -2576,15 +2578,15 @@ static int k510isp_parse_of(struct k510_isp_device *isp)//,struct k510isp_bus_cf + } + + /** +- * @brief +- * +- * @param dev +- * @param vep +- * @param asd +- * @return int ++ * @brief ++ * ++ * @param dev ++ * @param vep ++ * @param asd ++ * @return int + */ + static int k510isp_fwnode_parse(struct device *dev,struct v4l2_fwnode_endpoint *vep, +- struct v4l2_async_subdev *asd) ++ struct v4l2_async_subdev *asd) + { + struct k510isp_async_subdev *isd = + container_of(asd, struct k510isp_async_subdev, asd); +@@ -2595,36 +2597,36 @@ static int k510isp_fwnode_parse(struct device *dev,struct v4l2_fwnode_endpoint * + dev_dbg(dev, "%s:parsing %pOF, interface %u\n",__func__,to_of_node(vep->base.local_fwnode), vep->base.port); + + switch (vep->base.port) { +- case 0: +- buscfg->interface = ISP_INTERFACE_DVP; +- break; +- case 1: +- buscfg->interface = ISP_INTERFACE_CSI1; +- break; +- case 2: +- buscfg->interface = ISP_INTERFACE_CSI2; +- break; +- default: +- dev_warn(dev, "%pOF: invalid interface %u\n", +- to_of_node(vep->base.local_fwnode), vep->base.port); +- return -EINVAL; ++ case 0: ++ buscfg->interface = ISP_INTERFACE_DVP; ++ break; ++ case 1: ++ buscfg->interface = ISP_INTERFACE_CSI1; ++ break; ++ case 2: ++ buscfg->interface = ISP_INTERFACE_CSI2; ++ break; ++ default: ++ dev_warn(dev, "%pOF: invalid interface %u\n", ++ to_of_node(vep->base.local_fwnode), vep->base.port); ++ return -EINVAL; + } + + return 0; + } + /*----------------------------------------------------------------------------- +-* +-*-----------------------------------------------------------------------------*/ ++ * ++ *-----------------------------------------------------------------------------*/ + /** +- * @brief +- * +- * @param async +- * @return int ++ * @brief ++ * ++ * @param async ++ * @return int + */ + static int k510isp_subdev_notifier_complete(struct v4l2_async_notifier *async) + { + struct k510_isp_device *isp = container_of(async, struct k510_isp_device, +- notifier); ++ notifier); + struct v4l2_device *v4l2_dev = &isp->v4l2_dev; + struct v4l2_subdev *sd; + int ret; +@@ -2638,7 +2640,7 @@ static int k510isp_subdev_notifier_complete(struct v4l2_async_notifier *async) + continue; + + ret = k510isp_link_entity(isp, &sd->entity, +- v4l2_subdev_to_bus_cfg(sd)->interface); ++ v4l2_subdev_to_bus_cfg(sd)->interface); + if (ret < 0) + return ret; + } +@@ -2650,8 +2652,8 @@ static int k510isp_subdev_notifier_complete(struct v4l2_async_notifier *async) + return media_device_register(&isp->media_dev); + } + /** +- * @brief +- * ++ * @brief ++ * + */ + static const struct v4l2_async_notifier_operations k510isp_subdev_notifier_ops = { + .complete = k510isp_subdev_notifier_complete, +@@ -2660,19 +2662,19 @@ static const struct v4l2_async_notifier_operations k510isp_subdev_notifier_ops = + + static int f2k_ae_open(struct inode *inode, struct file *file) + { +- struct k510_isp_device *isp = container_of(file->private_data, +- struct k510_isp_device, misc_ae); ++ struct k510_isp_device *isp = container_of(file->private_data, ++ struct k510_isp_device, misc_ae); + +- file->private_data = isp; ++ file->private_data = isp; + +- return 0; ++ return 0; + } + + static int f2k_ae_release(struct inode *inode, struct file *file) + { +- struct kendryte_td *kendryte_td = file->private_data; +- +- return 0; ++ struct kendryte_td *kendryte_td = file->private_data; ++ ++ return 0; + } + + +@@ -2682,37 +2684,37 @@ static unsigned int f2k_ae_poll(struct file *filp, poll_table *wait) + __poll_t ret = 0; + + poll_wait(filp, &isp->isp_wait_ae_irq, wait);//将当前进程放到gnne_waitq列表 +- if(isp->isp_ae_flag) { +- ret |= POLLIN; //说明有数据被取到了 +- isp->isp_ae_flag = 0; +- } ++ if(isp->isp_ae_flag) { ++ ret |= POLLIN; //说明有数据被取到了 ++ isp->isp_ae_flag = 0; ++ } + + return ret; + } + + static const struct file_operations k510_f2k_ae_file_ops = { +- .owner = THIS_MODULE, +- .open = f2k_ae_open, +- .release = f2k_ae_release, +- .poll = f2k_ae_poll, ++ .owner = THIS_MODULE, ++ .open = f2k_ae_open, ++ .release = f2k_ae_release, ++ .poll = f2k_ae_poll, + }; + + + static int r2k_ae_open(struct inode *inode, struct file *file) + { +- struct k510_isp_device *isp = container_of(file->private_data, +- struct k510_isp_device, misc_r2k_ae); ++ struct k510_isp_device *isp = container_of(file->private_data, ++ struct k510_isp_device, misc_r2k_ae); + +- file->private_data = isp; ++ file->private_data = isp; + +- return 0; ++ return 0; + } + + static int r2k_ae_release(struct inode *inode, struct file *file) + { +- struct kendryte_td *kendryte_td = file->private_data; +- +- return 0; ++ struct kendryte_td *kendryte_td = file->private_data; ++ ++ return 0; + } + + +@@ -2722,24 +2724,24 @@ static unsigned int r2k_ae_poll(struct file *filp, poll_table *wait) + __poll_t ret = 0; + + poll_wait(filp, &isp->isp_wait_r2k_ae_irq, wait);//将当前进程放到gnne_waitq列表 +- if(isp->isp_r2k_ae_flag) { +- ret |= POLLIN; //说明有数据被取到了 +- isp->isp_r2k_ae_flag = 0; +- } ++ if(isp->isp_r2k_ae_flag) { ++ ret |= POLLIN; //说明有数据被取到了 ++ isp->isp_r2k_ae_flag = 0; ++ } + + return ret; + } + + static const struct file_operations k510_r2k_ae_file_ops = { +- .owner = THIS_MODULE, +- .open = r2k_ae_open, +- .release = r2k_ae_release, +- .poll = r2k_ae_poll, ++ .owner = THIS_MODULE, ++ .open = r2k_ae_open, ++ .release = r2k_ae_release, ++ .poll = r2k_ae_poll, + }; + + /*----------------------------------------------------------------------------- +-*probe +-*-----------------------------------------------------------------------------*/ ++ *probe ++ *-----------------------------------------------------------------------------*/ + /* + * isp_probe - Probe ISP platform device + * @pdev: Pointer to ISP platform device +@@ -2764,11 +2766,11 @@ static int k510isp_probe(struct platform_device *pdev) + + dev_info(&pdev->dev,"%s:start\n",__func__); + +- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (!mem) { +- dev_err(&pdev->dev,"get resource failed \n"); +- return -ENOMEM; +- } ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!mem) { ++ dev_err(&pdev->dev,"get resource failed \n"); ++ return -ENOMEM; ++ } + + isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL); + if (!isp) { +@@ -2777,26 +2779,26 @@ static int k510isp_probe(struct platform_device *pdev) + } + + isp->isp_addr = mem->start; +- isp->isp_regs = ioremap(mem->start, resource_size(mem)); +- if(!isp->isp_regs) { +- dev_err(&pdev->dev,"ioremap failed \n"); +- goto error; +- } ++ isp->isp_regs = ioremap(mem->start, resource_size(mem)); ++ if(!isp->isp_regs) { ++ dev_err(&pdev->dev,"ioremap failed \n"); ++ goto error; ++ } + + isp->isp_ae_flag = 0; + init_waitqueue_head(&isp->isp_wait_ae_irq); + + isp->misc_ae.minor = F2K_MAJOR; +- isp->misc_ae.name = "f2k-ae"; +- isp->misc_ae.fops = &k510_f2k_ae_file_ops; ++ isp->misc_ae.name = "f2k-ae"; ++ isp->misc_ae.fops = &k510_f2k_ae_file_ops; + misc_register(&isp->misc_ae); + + isp->isp_r2k_ae_flag = 0; + init_waitqueue_head(&isp->isp_wait_r2k_ae_irq); + + isp->misc_r2k_ae.minor = R2K_MAJOR; +- isp->misc_r2k_ae.name = "r2k-ae"; +- isp->misc_r2k_ae.fops = &k510_r2k_ae_file_ops; ++ isp->misc_r2k_ae.name = "r2k-ae"; ++ isp->misc_r2k_ae.fops = &k510_r2k_ae_file_ops; + misc_register(&isp->misc_r2k_ae); + + dev_info(&pdev->dev,"mem->start = 0x%x,isp->isp_regs= 0x%x\n",mem->start,isp->isp_regs); +@@ -2805,8 +2807,8 @@ static int k510isp_probe(struct platform_device *pdev) + spin_lock_init(&isp->stat_lock); + + ret = v4l2_async_notifier_parse_fwnode_endpoints( +- &pdev->dev, &isp->notifier, sizeof(struct k510isp_async_subdev), +- k510isp_fwnode_parse); ++ &pdev->dev, &isp->notifier, sizeof(struct k510isp_async_subdev), ++ k510isp_fwnode_parse); + if (ret < 0) + { + dev_err(&pdev->dev,"%s:v4l2_async_notifier_parse_fwnode_endpoints ret:(%d)\n",__func__,ret); +@@ -2859,26 +2861,26 @@ static int k510isp_probe(struct platform_device *pdev) + + isp->f2k_revision = Isp_Drv_F2k_Wrap_GetRevison(isp); + dev_info(isp->dev, "f2k_revision %d.%d.%d.%d.%d found\n", +- (isp->f2k_revision & 0xf000000) >> 24,(isp->f2k_revision & 0xff0000) >> 16, +- (isp->f2k_revision & 0xff00) >> 8, (isp->f2k_revision & 0xf0) >> 4, isp->f2k_revision & 0x0f); ++ (isp->f2k_revision & 0xf000000) >> 24,(isp->f2k_revision & 0xff0000) >> 16, ++ (isp->f2k_revision & 0xff00) >> 8, (isp->f2k_revision & 0xf0) >> 4, isp->f2k_revision & 0x0f); + clk_disable(isp->clock[ISP_F2K_APB]); + // + if (__k510isp_get(isp, false) == NULL) { + dev_info(isp->dev,"%s:ret(%d)\n",__func__,-ENODEV); + ret = -ENODEV; + goto error; +- } ++ } + + /* +- *resets +- */ ++ *resets ++ */ + ret = k510isp_get_resets(isp); + if (ret < 0) + goto error; + + ret = k510isp_reset(isp); + if (ret < 0) +- goto error_isp; ++ goto error_isp; + + /* IOMMU */ + ret = k510isp_attach_iommu(isp); +@@ -2896,7 +2898,7 @@ static int k510isp_probe(struct platform_device *pdev) + isp->irq_num[0] = ret; + dev_dbg(&pdev->dev,"f2k_irq_num =%d\n",isp->irq_num[0]); + if (devm_request_irq(isp->dev, isp->irq_num[0], k510isp_f2k_isr, IRQF_SHARED, +- "k510 ISP F2K", isp)) { ++ "k510 ISP F2K", isp)) { + dev_err(isp->dev, "Unable to request IRQ\n"); + ret = -EINVAL; + goto error_iommu; +@@ -2913,7 +2915,7 @@ static int k510isp_probe(struct platform_device *pdev) + dev_dbg(&pdev->dev,"r2k_irq_num =%d\n",isp->irq_num[1]); + + if (devm_request_irq(isp->dev, isp->irq_num[1], k510isp_r2k_isr, IRQF_SHARED, +- "k510 ISP R2K", isp)) { ++ "k510 ISP R2K", isp)) { + dev_err(isp->dev, "Unable to request IRQ\n"); + ret = -EINVAL; + goto error_irq0; +@@ -2939,7 +2941,7 @@ static int k510isp_probe(struct platform_device *pdev) + dev_err(&pdev->dev,"%s:k510isp_create_links ret:(%d)\n",__func__,ret); + goto error_register_entities; + } +- ++ + isp->notifier.ops = &k510isp_subdev_notifier_ops; + ret = v4l2_async_notifier_register(&isp->v4l2_dev, &isp->notifier); + if (ret) +@@ -2958,21 +2960,21 @@ static int k510isp_probe(struct platform_device *pdev) + error_modules: + k510isp_cleanup_modules(isp); + error_irq0: +- devm_free_irq(isp->dev,isp->irq_num[0],isp); ++ devm_free_irq(isp->dev,isp->irq_num[0],isp); + error_iommu: + k510isp_detach_iommu(isp); + error_isp: + __k510isp_put(isp, false); + error: + v4l2_async_notifier_cleanup(&isp->notifier); +- mutex_destroy(&isp->isp_mutex); ++ mutex_destroy(&isp->isp_mutex); + kfree(isp); + dev_dbg(&pdev->dev,"%s:end ret:(%d)\n",__func__,ret); + return ret; + } + /*----------------------------------------------------------------------------- +-*Power management support +-*-----------------------------------------------------------------------------*/ ++ *Power management support ++ *-----------------------------------------------------------------------------*/ + #ifdef CONFIG_PM + /* + * Power management support. +@@ -3010,10 +3012,10 @@ static int k510isp_pm_prepare(struct device *dev) + return 0; + } + /** +- * @brief +- * +- * @param dev +- * @return int ++ * @brief ++ * ++ * @param dev ++ * @return int + */ + static int k510isp_pm_suspend(struct device *dev) + { +@@ -3027,10 +3029,10 @@ static int k510isp_pm_suspend(struct device *dev) + return 0; + } + /** +- * @brief +- * +- * @param dev +- * @return int ++ * @brief ++ * ++ * @param dev ++ * @return int + */ + static int k510isp_pm_resume(struct device *dev) + { +@@ -3042,9 +3044,9 @@ static int k510isp_pm_resume(struct device *dev) + return k510isp_enable_clocks(isp); + } + /** +- * @brief +- * +- * @param dev ++ * @brief ++ * ++ * @param dev + */ + static void k510isp_pm_complete(struct device *dev) + { +@@ -3067,8 +3069,8 @@ static void k510isp_pm_complete(struct device *dev) + + #endif /* CONFIG_PM */ + /** +- * @brief +- * ++ * @brief ++ * + */ + static const struct dev_pm_ops k510isp_pm_ops = { + .prepare = k510isp_pm_prepare, +@@ -3077,11 +3079,11 @@ static const struct dev_pm_ops k510isp_pm_ops = { + .complete = k510isp_pm_complete, + }; + /*----------------------------------------------------------------------------- +-* +-*-----------------------------------------------------------------------------*/ ++ * ++ *-----------------------------------------------------------------------------*/ + /** +- * @brief +- * ++ * @brief ++ * + */ + static struct platform_device_id k510isp_id_table[] = { + { "k510-isp1", 0 }, +@@ -3089,8 +3091,8 @@ static struct platform_device_id k510isp_id_table[] = { + }; + MODULE_DEVICE_TABLE(platform, k510isp_id_table); + /** +- * @brief +- * ++ * @brief ++ * + */ + static const struct of_device_id k510isp_of_table[] = { + { .compatible = "canaan,k510-isp1" }, +@@ -3098,8 +3100,8 @@ static const struct of_device_id k510isp_of_table[] = { + }; + MODULE_DEVICE_TABLE(of, k510isp_of_table); + /** +- * @brief +- * ++ * @brief ++ * + */ + static struct platform_driver k510isp_driver = { + .probe = k510isp_probe, +-- +2.25.1 + diff --git a/package/patches/uboot/0015-display-reset-the-soc-when-the-display-init-error.patch b/package/patches/uboot/0015-display-reset-the-soc-when-the-display-init-error.patch new file mode 100644 index 0000000..b756a95 --- /dev/null +++ b/package/patches/uboot/0015-display-reset-the-soc-when-the-display-init-error.patch @@ -0,0 +1,589 @@ +From 9b24e500bec429fe71a226ffed59262e17d66bd6 Mon Sep 17 00:00:00 2001 +From: "Chenggen.Wang" +Date: Wed, 28 Sep 2022 15:03:21 +0800 +Subject: [PATCH] display: reset the soc when the display init error. + +Signed-off-by: Chenggen.Wang +--- + .../controler/video/mipi/dsi/cnds_dsi_test.c | 11 ++ + board/Canaan/dsi_logo/test/log/main.c | 45 ++++--- + board/Canaan/dsi_logo/test/log/vo/vo.h | 115 +++++++++--------- + board/Canaan/k510_crb_lp3/sysctl_clk.c | 36 +++--- + 4 files changed, 117 insertions(+), 90 deletions(-) + mode change 100644 => 100755 board/Canaan/dsi_logo/bsp/controler/video/mipi/dsi/cnds_dsi_test.c + +diff --git a/board/Canaan/dsi_logo/bsp/controler/video/mipi/dsi/cnds_dsi_test.c b/board/Canaan/dsi_logo/bsp/controler/video/mipi/dsi/cnds_dsi_test.c +old mode 100644 +new mode 100755 +index b2510e4f..a1db253f +--- a/board/Canaan/dsi_logo/bsp/controler/video/mipi/dsi/cnds_dsi_test.c ++++ b/board/Canaan/dsi_logo/bsp/controler/video/mipi/dsi/cnds_dsi_test.c +@@ -2385,6 +2385,17 @@ int32_t get_lcd_id(void) + return lcd_id; + } + ++int32_t read_display_status(void) ++{ ++ int32_t status; ++ status = DsiRegRd(VID_MODE_STS_OFFSET); ++ if (status != 0x00000001) { ++ printf("######## display err, status:0x%08X ########\n", status); ++ return -1; ++ } ++ return 0; ++} ++ + int32_t get_panel_id(void) + { + int32_t reg; +diff --git a/board/Canaan/dsi_logo/test/log/main.c b/board/Canaan/dsi_logo/test/log/main.c +index cff381ed..e96b5262 100755 +--- a/board/Canaan/dsi_logo/test/log/main.c ++++ b/board/Canaan/dsi_logo/test/log/main.c +@@ -47,38 +47,38 @@ void SYSCTL_DRV_Init(void) + //a. enable clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_CSI_0_PIXEL, TRUE); + sysctl_clk_set_leaf_en(SYSCTL_CLK_CSI_1_PIXEL, TRUE); +- ++ + //b. set pix clk to 74.25M by default + sysctl_clk_set_leaf_div(SYSCTL_CLK_CSI_0_PIXEL,1, 8); + sysctl_clk_set_leaf_div(SYSCTL_CLK_CSI_1_PIXEL,1, 8); + +- //2. init csi system clk ++ //2. init csi system clk + //a. enable clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_CSI_0_SYSTEM, TRUE); + sysctl_clk_set_leaf_en(SYSCTL_CLK_CSI_1_SYSTEM, TRUE); +- ++ + //b. set system clk to 166M by default + sysctl_clk_set_leaf_div(SYSCTL_CLK_CSI_0_SYSTEM,1, 2); + sysctl_clk_set_leaf_div(SYSCTL_CLK_CSI_1_SYSTEM,1, 2); + +- //3. init dsi pix clk ++ //3. init dsi pix clk + //a. enable clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_DISPLAY_PIXEL, TRUE); +- ++ + //b. set pix clk to 74.25M by default +- sysctl_clk_set_leaf_div(SYSCTL_CLK_DISPLAY_PIXEL,1, 8); /// p30 594 / 8 594 / 4 = 148.5 p60 +- +- //4. init dsi system clk ++ sysctl_clk_set_leaf_div(SYSCTL_CLK_DISPLAY_PIXEL,1, 8); /// p30 594 / 8 594 / 4 = 148.5 p60 ++ ++ //4. init dsi system clk + //a. enable clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_DISP_SYS_AND_APB_CLK_DIV_DSI_SYSTEM, TRUE); +- ++ + //b. set system clk to 166M by default, all display subsystem apb clk will be set to 166M together. + sysctl_clk_set_leaf_div(SYSCTL_CLK_DISP_SYS_AND_APB_CLK_DIV,1, 2); + + //5. init tpg pix clk + //a. enable clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_TPG_PIXEL, TRUE); +- ++ + //b. set tpg pix clk to 594/5=118.8M by default + sysctl_clk_set_leaf_div(SYSCTL_CLK_TPG_PIXEL,1, 5); + +@@ -93,14 +93,14 @@ void SYSCTL_DRV_Init(void) + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_TOF_APB, 1); + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_MFBC_APB, 1); + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_VI_APB, 1); +- ++ + + //enable video axi clk + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_VI_AXI, 1); + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_ISP_F2K_AXI, 1); + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_ISP_R2K_AXI, 1); + sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_ISP_TOF_AXI, 1); +- sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_MFBC_AXI, 1); ++ sysctl_clk_set_leaf_en(SYSCTL_CLK_NOC_CLK_1_MFBC_AXI, 1); + + //7. enable display subsystem apb and axi clk + //enable display apb clk +@@ -129,8 +129,8 @@ void fill_ddr(void) + *(volatile unsigned int *)(0x01000000 + cnt) = 0x33333333; + usleep(1); + *(volatile unsigned int *)(0x02000000 + cnt) = 0x33333333; +- +- } ++ ++ } + #endif + + } +@@ -146,12 +146,12 @@ int load_dsi_logo_to_ddr() + //fatload mmc 1:1 0x600000 bootm-bbl.img ; + char *pcmd = DSI_LOG_LOAD_CMD_EMMC; + sysctl_boot_mode_e boot_media = sysctl_boot_get_boot_mode(); +- +- ++ ++ + if( boot_media == SYSCTL_BOOT_SDCARD ){ + pcmd = DSI_LOG_LOAD_CMD_SD; + } +- ++ + run_command(pcmd, 0); + + return 0; +@@ -161,6 +161,7 @@ int main_logo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) + { + unsigned long time; + int panel_id; ++ int ret = 0; + + *(uint32_t *)0x970E00FC = 0x0fffff00;// (0x2 << 8) | (0x2 << 12) | (0x2 << 16) | (0x2 << 20) | (0x2 << 24); + *(uint32_t *)0x970E0100 = 0x000000ff;// (0x3 << 4) | 0x3; +@@ -174,7 +175,7 @@ int main_logo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) + display_gpio_init(); + + SYSCTL_DRV_Init(); +- ++ + mipi_rxdphy_init(RXDPHY_SPEED_MODE_1500M, RXDPHY_CHCFG_1X4); + + mipi_txdphy_init(); +@@ -192,6 +193,12 @@ int main_logo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) + + time = get_timer(time); + printf("dsi logo end use %lu msec\n", time); ++ ++ ret = read_display_status(); ++ if (ret < 0) { ++ printf("display init error reset!!!!!!!!\n"); ++ sysctl_boot_reset_soc(); ++ } + return 0; + } + +@@ -211,7 +218,7 @@ ulong board_get_usable_ram_top(ulong total_size) + return 0; + #endif + return gd->ram_top - 0x200000; +-} ++} + + #define WS2812_PIN 122 + +diff --git a/board/Canaan/dsi_logo/test/log/vo/vo.h b/board/Canaan/dsi_logo/test/log/vo/vo.h +index c0ace7aa..961203b6 100755 +--- a/board/Canaan/dsi_logo/test/log/vo/vo.h ++++ b/board/Canaan/dsi_logo/test/log/vo/vo.h +@@ -81,7 +81,7 @@ + #define OSD_LAYER2_H_SIZE 256 + #define OSD_LAYER2_V_SIZE 200 + #define OSD_LAYER2_RD_STRIDE 2048 +- ++ + #define LAYER0_Y_BASEAddr0 0x20000000 // # y base: 0x800000 + #define LAYER0_Y_BASEAddr1 0x20000000 // # uv base: 0x900000 + #define LAYER0_UV_BASEaddr0 0x20280000 // # y base: 0x800000 +@@ -91,22 +91,22 @@ + #define LAYER1_Y_BASEAddr1 0x20600000 // # uv base: 0x900000 + #define LAYER1_UV_BASEaddr0 0x20880000 // # y base: 0x800000 + #define LAYER1_UV_BASEaddr1 0x20880000 // # uv base: 0x900000 +- ++ + #define LAYER2_Y_BASEAddr0 0x20A00000 // # y base: 0x800000 + #define LAYER2_Y_BASEAddr1 0x20A00000 // # uv base: 0x900000 + #define LAYER2_UV_BASEaddr0 0x20C80000 // # y base: 0x800000 + #define LAYER2_UV_BASEaddr1 0x20C80000 // # uv base: 0x900000 +- ++ + #define LAYER3_Y_BASEAddr0 0x20A00000 // # y base: 0x800000 + #define LAYER3_Y_BASEAddr1 0x20A00000 // # uv base: 0x900000 + #define LAYER3_UV_BASEaddr0 0x20C80000 // # y base: 0x800000 + #define LAYER3_UV_BASEaddr1 0x20C80000 // # uv base: 0x900000 +- ++ + #define OSD0_VLU_ADDR0 0x20E00000// # y base: 0x800000 --argb mode --32bit + #define OSD0_VLU_ADDR1 0x20E00000// # uv base: 0x900000 + #define OSD0_ALP_ADDR0 0x20E00000// # y base: 0x800000 + #define OSD0_ALP_ADDR1 0x20E00000// # uv base: 0x900000 +- ++ + #define OSD1_VLU_ADDR0 0x20E00000 // # y base: 0x800000 + #define OSD1_VLU_ADDR1 0x20E00000 // # uv base: 0x900000 + #define OSD1_ALP_ADDR0 0x20E00000 // # y base: 0x800000 +@@ -152,24 +152,24 @@ + #define OSD_LOAD_VLU_SRAM_ADDR0 0x000C0000 + #define OSD_LOAD_VLU_SRAM_ADDR1 0x000C0000 + +-#define DUMP_Y_MFBD_DATA_ADDR0 0x24000000 +-#define DUMP_Y_MFBD_HEAD_ADDR0 0x25000000 +-#define DUMP_Y_MFBD_DATA_STRIDE0 0x800 +-#define DUMP_Y_MFBD_HEAD_STRIDE0 0x800 +- +-#define DUMP_Y_MFBD_DATA_ADDR1 0x26000000 +-#define DUMP_Y_MFBD_HEAD_ADDR1 0x27000000 +-#define DUMP_Y_MFBD_DATA_STRIDE1 0x800 +-#define DUMP_Y_MFBD_HEAD_STRIDE1 0x800 +- +-#define DUMP_UV_MFBD_DATA_ADDR0 0x24280000 +-#define DUMP_UV_MFBD_HEAD_ADDR0 0x25280000 +-#define DUMP_UV_MFBD_DATA_STRIDE0 0x800 +-#define DUMP_UV_MFBD_HEAD_STRIDE0 0x800 +-#define DUMP_UV_MFBD_DATA_ADDR1 0x26280000 +-#define DUMP_UV_MFBD_HEAD_ADDR1 0x27280000 +-#define DUMP_UV_MFBD_DATA_STRIDE1 0x800 +-#define DUMP_UV_MFBD_HEAD_STRIDE1 0x800 ++#define DUMP_Y_MFBD_DATA_ADDR0 0x24000000 ++#define DUMP_Y_MFBD_HEAD_ADDR0 0x25000000 ++#define DUMP_Y_MFBD_DATA_STRIDE0 0x800 ++#define DUMP_Y_MFBD_HEAD_STRIDE0 0x800 ++ ++#define DUMP_Y_MFBD_DATA_ADDR1 0x26000000 ++#define DUMP_Y_MFBD_HEAD_ADDR1 0x27000000 ++#define DUMP_Y_MFBD_DATA_STRIDE1 0x800 ++#define DUMP_Y_MFBD_HEAD_STRIDE1 0x800 ++ ++#define DUMP_UV_MFBD_DATA_ADDR0 0x24280000 ++#define DUMP_UV_MFBD_HEAD_ADDR0 0x25280000 ++#define DUMP_UV_MFBD_DATA_STRIDE0 0x800 ++#define DUMP_UV_MFBD_HEAD_STRIDE0 0x800 ++#define DUMP_UV_MFBD_DATA_ADDR1 0x26280000 ++#define DUMP_UV_MFBD_HEAD_ADDR1 0x27280000 ++#define DUMP_UV_MFBD_DATA_STRIDE1 0x800 ++#define DUMP_UV_MFBD_HEAD_STRIDE1 0x800 + // + typedef enum _VO_VIDEOLAYER_YUV_MODE_E + { +@@ -190,11 +190,11 @@ typedef enum _VO_VIDEOLAYER_UV_ENDIAN_E + VO_VIDEO_LAYER_UV_ENDIAN_MODE0 = 0x0,//U2 V2 U3 V3 U0 V0 U1 V1 + VO_VIDEO_LAYER_UV_ENDIAN_MODE1 = 0x1,//V2 U2 V3 U3 V0 U0 V1 U1 + VO_VIDEO_LAYER_UV_ENDIAN_MODE2 = 0x2,//U3 V3 U2 V2 U1 V1 U0 V0 +- VO_VIDEO_LAYER_UV_ENDIAN_MODE3 = 0x3,//V3 U3 V2 U2 V1 U1 V0 U0 +- VO_VIDEO_LAYER_UV_ENDIAN_MODE4 = 0x4,//U0 V0 U1 V1 U2 V2 U3 V3 +- VO_VIDEO_LAYER_UV_ENDIAN_MODE5 = 0x5,//V0 U0 V1 U1 V2 U2 V3 U3 ++ VO_VIDEO_LAYER_UV_ENDIAN_MODE3 = 0x3,//V3 U3 V2 U2 V1 U1 V0 U0 ++ VO_VIDEO_LAYER_UV_ENDIAN_MODE4 = 0x4,//U0 V0 U1 V1 U2 V2 U3 V3 ++ VO_VIDEO_LAYER_UV_ENDIAN_MODE5 = 0x5,//V0 U0 V1 U1 V2 U2 V3 U3 + VO_VIDEO_LAYER_UV_ENDIAN_MODE6 = 0x6,//U1 V1 U0 V0 U3 V3 U2 V2 +- VO_VIDEO_LAYER_UV_ENDIAN_MODE7 = 0x7//V1 U1 V0 U0 V3 U3 V2 U2 ++ VO_VIDEO_LAYER_UV_ENDIAN_MODE7 = 0x7//V1 U1 V0 U0 V3 U3 V2 U2 + } VO_VIDEOLAYER_UV_ENDIAN_E; + + typedef enum _VO_SYSTEM_MODE_E +@@ -219,7 +219,7 @@ typedef enum _VO_SYSTEM_MODE_E + VO_SYSTEM_MODE_1080x1920x30P, + //! System mode is 800x1280 at 30 Hz. + VO_SYSTEM_MODE_800x1280x30P, +- ++ + }VO_SYSTEM_MODE_E; + + typedef enum _VO_MIXER_ORDER_E +@@ -254,12 +254,12 @@ typedef struct _VO_DISP_INFO_S + unsigned int dispHsync2Ctl_start; + unsigned int dispHsync2Ctl_stop; + unsigned int dispVsync2Ctl_start; +- unsigned int dispVsync2Ctl_stop; ++ unsigned int dispVsync2Ctl_stop; + unsigned int vcntbit0 ; + unsigned int secndfoffset; + unsigned int framesyncdly; + unsigned int hsize; +- unsigned int vsize; ++ unsigned int vsize; + }VO_DISP_INFO_S; + //LAYER0 + typedef struct _VO_LAYER0_DAT_MODE_INFO_S +@@ -320,17 +320,17 @@ typedef struct _VO_LAYER0_MFBD_INFO_S + { + unsigned int mfbd_en; + unsigned int y_addr0; +- unsigned int y_stride0; ++ unsigned int y_stride0; + unsigned int y_addr1; + unsigned int y_stride1; + unsigned int y_head_addr0; +- unsigned int y_head_stride0; ++ unsigned int y_head_stride0; + unsigned int y_head_addr1; + unsigned int y_head_stride1; + unsigned int uv_addr0; + unsigned int uv_stride0; + unsigned int uv_addr1; +- unsigned int uv_stride1; ++ unsigned int uv_stride1; + unsigned int uv_head_addr0; + unsigned int uv_head_stride0; + unsigned int uv_head_addr1; +@@ -340,7 +340,7 @@ typedef struct _VO_LAYER0_MFBD_INFO_S + typedef struct _VO_LAYER0_INFO_S + { + unsigned int layer0DispEn; +- unsigned int layer0En; ++ unsigned int layer0En; + unsigned int scalerBlen; + // + VO_LAYER0_DAT_MODE_INFO_S datModeInfo; +@@ -364,9 +364,9 @@ typedef struct _VO_LAYER_INFO_S + unsigned int enable ; + unsigned int yuv422en ; + unsigned int yuv420en ; +- unsigned int endiany ; +- unsigned int endianuv ; +- unsigned int uvswap ; ++ unsigned int endiany ; ++ unsigned int endianuv ; ++ unsigned int uvswap ; + } VO_LAYER_INFO_S; + // + typedef struct _VO_LAYER_SIZE_INFO_S +@@ -379,7 +379,7 @@ typedef struct _VO_LAYER_SIZE_INFO_S + // + typedef struct _VO_IMG_IN_BLENTH_INFO_S + { +- unsigned int blen ; ++ unsigned int blen ; + unsigned int voffset; + } VO_IMG_IN_BLENTH_INFO_S; + // +@@ -393,11 +393,11 @@ typedef struct _VO_LAYER1_INFO_S + // + VO_YUV_BUF_INFO_S bufInfo; + // +- VO_LAYER_SIZE_INFO_S layer1SizeInfo; ++ VO_LAYER_SIZE_INFO_S layer1SizeInfo; + // +- VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; ++ VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; + // +- VO_BASE_MODE_INFO_S baseModeInfo; ++ VO_BASE_MODE_INFO_S baseModeInfo; + }VO_LAYER1_INFO_S; + //LAYER2 + typedef struct _VO_LAYER2_INFO_S +@@ -410,11 +410,11 @@ typedef struct _VO_LAYER2_INFO_S + // + VO_YUV_BUF_INFO_S bufInfo; + // +- VO_LAYER_SIZE_INFO_S layer2SizeInfo; ++ VO_LAYER_SIZE_INFO_S layer2SizeInfo; + // +- VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; ++ VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; + // +- VO_BASE_MODE_INFO_S baseModeInfo; ++ VO_BASE_MODE_INFO_S baseModeInfo; + }VO_LAYER2_INFO_S; + //LAYER3 + typedef struct _VO_LAYER3_INFO_S +@@ -427,24 +427,24 @@ typedef struct _VO_LAYER3_INFO_S + // + VO_YUV_BUF_INFO_S bufInfo; + // +- VO_LAYER_SIZE_INFO_S layer3SizeInfo; ++ VO_LAYER_SIZE_INFO_S layer3SizeInfo; + // +- VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; ++ VO_IMG_IN_BLENTH_INFO_S imgInBlenthInfo; + // +- VO_BASE_MODE_INFO_S baseModeInfo; ++ VO_BASE_MODE_INFO_S baseModeInfo; + }VO_LAYER3_INFO_S; + //osd0 + typedef struct _VO_OSD_SIZE_INFO_S + { + unsigned int width; +- unsigned int height; ++ unsigned int height; + } VO_OSD_SIZE_INFO_S; + // + typedef struct _VO_OSD_BUF_INFO_S + { + unsigned int alp_addr0; + unsigned int alp_addr1; +- unsigned int alpstride; ++ unsigned int alpstride; + unsigned int vlu_addr0; + unsigned int vlu_addr1; + unsigned int osdstride; +@@ -454,7 +454,7 @@ typedef struct _VO_OSD_DMA_INFO_S + { + unsigned int dmarequestlen; + unsigned int dmamap ; +- unsigned int rgbrev ; ++ unsigned int rgbrev ; + } VO_OSD_DMA_INFO_S; + // + typedef struct _VO_OSD0_INFO_S +@@ -467,7 +467,7 @@ typedef struct _VO_OSD0_INFO_S + VO_OSD_SIZE_INFO_S osd0SizeInfo; + VO_OSD_BUF_INFO_S osd0BufInfo; + VO_BASE_MODE_INFO_S osd0BaseModeInfo; +- VO_OSD_DMA_INFO_S osd0DmaInfo; ++ VO_OSD_DMA_INFO_S osd0DmaInfo; + }VO_OSD0_INFO_S; + //osd1 + typedef struct _VO_OSD1_INFO_S +@@ -588,7 +588,7 @@ typedef struct _VO_WB_INFO_CLR_INFO_S + } VO_WB_INFO_CLR_INFO_S; + // + typedef struct _VO_WB_CH_INFO_S +-{ ++{ + unsigned int err_unit; + unsigned int err_threshold; + unsigned int request; +@@ -620,7 +620,7 @@ typedef struct _VO_CORE_INFO_S + VO_OSD1_INFO_S osd1Info; + VO_OSD2_INFO_S osd2Info; + VO_OSD_RGB2YUV_INFO_S osdRgb2YuvInfo; +- VO_YUV2RGB_INFO_S yuv2rgbInfo; ++ VO_YUV2RGB_INFO_S yuv2rgbInfo; + VO_DISP_MIX_INFO_S dispMixCtlInfo; + unsigned int ditherctlen; + unsigned int clutctlen; +@@ -640,13 +640,13 @@ typedef struct _VO_REMAP_CTRL_INFO_S + unsigned int line_start_pos_x ; + unsigned int line_end_pos_x ; + unsigned int line_start_pos_y ; +- unsigned int line_end_pos_y ; ++ unsigned int line_end_pos_y ; + unsigned int line_width_l; +- unsigned int line_width_h; ++ unsigned int line_width_h; + unsigned int fill_value_cr; + unsigned int fill_value_cb; + unsigned int fill_value_y ; +- unsigned int fill_alpha ; ++ unsigned int fill_alpha ; + } VO_REMAP_CTRL_INFO_S; + + typedef struct _VO_REMAP_CMD_INFO_S +@@ -660,7 +660,7 @@ typedef struct _VO_REMAP_CMD_INFO_S + typedef struct _VO_REMAP_INFO_S + { + VO_REMAP_CMD_INFO_S CmdInfo; +- VO_REMAP_CTRL_INFO_S CtlInfo[VO_LINE_DRAW_AREA_MAX]; ++ VO_REMAP_CTRL_INFO_S CtlInfo[VO_LINE_DRAW_AREA_MAX]; + }VO_REMAP_INFO_S; + + typedef struct _VO_INFO_S +@@ -739,5 +739,6 @@ int VO_TEST_SetRemap(unsigned int draw_num,VO_REMAP_INFO_S *voRemapInfo); + // + int VO_TEST_VideoOut(VO_TEST_CASE_E voTestCase); + int32_t get_panel_id(void); ++int32_t read_display_status(void); + + #endif /*_VO_DEF_H_*/ +diff --git a/board/Canaan/k510_crb_lp3/sysctl_clk.c b/board/Canaan/k510_crb_lp3/sysctl_clk.c +index 4384e359..da974559 100755 +--- a/board/Canaan/k510_crb_lp3/sysctl_clk.c ++++ b/board/Canaan/k510_crb_lp3/sysctl_clk.c +@@ -121,7 +121,7 @@ void sysctl_boot_set_root_clk_bypass(sysctl_clk_node_e clk, bool enable) + } + } + +-/* ++/* + Enable pll, enable 25M clock&pll, only when both 25m clock and PLL are enabled, can PLL output clock + */ + bool sysctl_boot_get_root_clk_en(sysctl_clk_node_e clk) +@@ -157,7 +157,7 @@ bool sysctl_boot_get_root_clk_en(sysctl_clk_node_e clk) + } + } + +-/* ++/* + Enable pll, enable 25M clock&pll, only when both 25m clock and PLL are enabled, can PLL output clock + */ + void sysctl_boot_set_root_clk_en(sysctl_clk_node_e clk, bool enable) +@@ -1316,14 +1316,14 @@ sysctl_clk_node_e sysctl_clk_get_leaf_parent(sysctl_clk_node_e leaf) + { + if(0 == (sysctl_clk->gnne_sysclk_cfg & 0x1)) + return SYSCTL_CLK_ROOT_PLL0_DIV_2; +- else ++ else + return SYSCTL_CLK_ROOT_PLL1_DIV_2; + } + case SYSCTL_CLK_GNNE_AXI: + { + if(0 == (sysctl_clk->ai_gnne_aclk_cfg & 0x1)) + return SYSCTL_CLK_ROOT_PLL0_DIV_2; +- else ++ else + return SYSCTL_CLK_ROOT_PLL1_DIV_2; + } + case SYSCTL_CLK_GNNE_AXI_NOC: +@@ -2245,7 +2245,7 @@ bool sysctl_clk_get_leaf_en(sysctl_clk_node_e leaf) + case SYSCTL_CLK_AX25M_CORE_1: + return (0 == ((sysctl_clk->ax25m_clk_cfg >> 9) & 0x1)) ? false: true; + case SYSCTL_CLK_AX25M_CORE_0_DC: +- return (0 == ((sysctl_clk->ax25m_clk_cfg >> 10) & 0x1)) ? false: true; ++ return (0 == ((sysctl_clk->ax25m_clk_cfg >> 10) & 0x1)) ? false: true; + case SYSCTL_CLK_AX25M_CORE_1_DC: + return (0 == ((sysctl_clk->ax25m_clk_cfg >> 11) & 0x1)) ? false: true; + case SYSCTL_CLK_AX25M_MTIMER: +@@ -2445,7 +2445,7 @@ bool sysctl_clk_get_leaf_en(sysctl_clk_node_e leaf) + /*---------------------------csi1_system_clk----------------------------*/ + case SYSCTL_CLK_CSI_1_SYSTEM: + return (0 == ((sysctl_clk->csi1_sys_clk_cfg >> 8) & 1)) ? false:true; +- ++ + /*---------------------------csi0_pixel_clk------------------------------*/ + case SYSCTL_CLK_CSI_0_PIXEL: + return (0 == ((sysctl_clk->csi0_pixel_clk_cfg >> 8) & 1)) ? false:true; +@@ -3369,7 +3369,7 @@ double sysctl_clk_get_leaf_div(sysctl_clk_node_e leaf) + /*---------------------------NOC1------------------------------------*/ + case SYSCTL_CLK_NOC_CLK_1: + return (double)(6.0 - ((sysctl_clk->noc_clk_cfg >> 8) & 0x7)) / 6.0; +- ++ + case SYSCTL_CLK_NOC_CLK_1_AXI_MCTL: + case SYSCTL_CLK_NOC_CLK_1_H264_AXI: + case SYSCTL_CLK_NOC_CLK_1_VO_AXI: +@@ -3719,14 +3719,14 @@ uint32_t sysctl_clk_get_leaf_freq(sysctl_clk_node_e leaf) + } + + /* Find the approximate div and mul */ +-int sysctl_clk_find_approximate(uint32_t mul_min, +- uint32_t mul_max, +- uint32_t div_min, +- uint32_t div_max, ++int sysctl_clk_find_approximate(uint32_t mul_min, ++ uint32_t mul_max, ++ uint32_t div_min, ++ uint32_t div_max, + sysctl_clk_mul_div_methord_e method, +- unsigned long rate, ++ unsigned long rate, + unsigned long parent_rate, +- uint32_t *div, ++ uint32_t *div, + uint32_t *mul) + { + long abs_min; +@@ -3755,7 +3755,7 @@ int sysctl_clk_find_approximate(uint32_t mul_min, + + *div = div_min; + break; +- } ++ } + /* only div can be changeable, 1/1,1/2,1/3...*/ + case SYSCTL_CLK_DIV_CHANGEABLE: { + perfect_divide = (long)((parent_rate*1000) / rate); +@@ -3849,3 +3849,11 @@ sysctl_boot_mode_e sysctl_boot_get_boot_mode(void) + return SYSCTL_BOOT_DOWNLOAD; + } + } ++ ++void sysctl_boot_reset_soc(void) ++{ ++ sysctl_boot->soc_glb_rst = ((1 << 0) | (1 << 16)); ++ while(1) ++ { ++ } ++} +-- +2.25.1 +