From 6d2cdaaa0361ca1da8a05b680a4e62aac8e0bd3f Mon Sep 17 00:00:00 2001 From: Sheng Nan Date: Fri, 12 Oct 2012 16:21:05 +0800 Subject: [PATCH] ENGR00229323 Capture: ov5640 mipi: code type warning generated by script clear code type warning generated by script Signed-off-by: Sheng Nan --- drivers/media/video/mxc/capture/ov5640_mipi.c | 134 +++++++++--------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/drivers/media/video/mxc/capture/ov5640_mipi.c b/drivers/media/video/mxc/capture/ov5640_mipi.c index f19fdc38d5fc..cfb863ed5e9b 100644 --- a/drivers/media/video/mxc/capture/ov5640_mipi.c +++ b/drivers/media/video/mxc/capture/ov5640_mipi.c @@ -705,7 +705,7 @@ static s32 ov5640_read_reg(u16 reg, u8 *val) return u8RdVal; } -static int preview_sysclk, preview_HTS, preview_sysclk; +static int prev_sysclk, prev_HTS, prev_sysclk; static int AE_low, AE_high, AE_Target = 52; static int XVCLK = 2200; @@ -869,10 +869,10 @@ int OV5640_set_gain16(int gain16) return 0; } -int OV5640_get_light_frequency(void) +int OV5640_get_light_freq(void) { /* get banding filter value */ - int temp, temp1, light_frequency = 0; + int temp, temp1, light_freq = 0; u8 tmp; temp = ov5640_read_reg(0x3c01, &tmp); @@ -882,52 +882,52 @@ int OV5640_get_light_frequency(void) temp1 = ov5640_read_reg(0x3c00, &tmp); if (temp1 & 0x04) { /* 50Hz */ - light_frequency = 50; + light_freq = 50; } else { /* 60Hz */ - light_frequency = 60; + light_freq = 60; } } else { /* auto */ temp1 = ov5640_read_reg(0x3c0c, &tmp); if (temp1 & 0x01) { /* 50Hz */ - light_frequency = 50; + light_freq = 50; } else { /* 60Hz */ } } - return light_frequency; + return light_freq; } void OV5640_set_bandingfilter(void) { - int preview_VTS; + int prev_VTS; int band_step60, max_band60, band_step50, max_band50; /* read preview PCLK */ - preview_sysclk = OV5640_get_sysclk(); + prev_sysclk = OV5640_get_sysclk(); /* read preview HTS */ - preview_HTS = OV5640_get_HTS(); + prev_HTS = OV5640_get_HTS(); /* read preview VTS */ - preview_VTS = OV5640_get_VTS(); + prev_VTS = OV5640_get_VTS(); /* calculate banding filter */ /* 60Hz */ - band_step60 = preview_sysclk * 100/preview_HTS * 100/120; + band_step60 = prev_sysclk * 100/prev_HTS * 100/120; ov5640_write_reg(0x3a0a, (band_step60 >> 8)); ov5640_write_reg(0x3a0b, (band_step60 & 0xff)); - max_band60 = (int)((preview_VTS-4)/band_step60); + max_band60 = (int)((prev_VTS-4)/band_step60); ov5640_write_reg(0x3a0d, max_band60); /* 50Hz */ - band_step50 = preview_sysclk * 100/preview_HTS; + band_step50 = prev_sysclk * 100/prev_HTS; ov5640_write_reg(0x3a08, (band_step50 >> 8)); ov5640_write_reg(0x3a09, (band_step50 & 0xff)); - max_band50 = (int)((preview_VTS-4)/band_step50); + max_band50 = (int)((prev_VTS-4)/band_step50); ov5640_write_reg(0x3a0e, max_band50); } @@ -979,7 +979,7 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, { struct reg_value *pModeSetting = NULL; s32 i = 0; - s32 iModeSettingArySize = 0; + s32 ArySize = 0; register u32 Delay_ms = 0; register u16 RegAddr = 0; register u8 Mask = 0; @@ -1026,12 +1026,12 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, if (mode == ov5640_mode_INIT) { pModeSetting = ov5640_init_setting_30fps_VGA; - iModeSettingArySize = ARRAY_SIZE(ov5640_init_setting_30fps_VGA); + ArySize = ARRAY_SIZE(ov5640_init_setting_30fps_VGA); ov5640_data.pix.width = 640; ov5640_data.pix.height = 480; - for (i = 0; i < iModeSettingArySize; ++i, ++pModeSetting) { + for (i = 0; i < ArySize; ++i, ++pModeSetting) { Delay_ms = pModeSetting->u32Delay_ms; RegAddr = pModeSetting->u16RegAddr; Val = pModeSetting->u8Val; @@ -1057,9 +1057,9 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, pModeSetting = ov5640_setting_30fps_VGA_640_480; - iModeSettingArySize = ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480); + ArySize = ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480); - for (i = 0; i < iModeSettingArySize; ++i, ++pModeSetting) { + for (i = 0; i < ArySize; ++i, ++pModeSetting) { Delay_ms = pModeSetting->u32Delay_ms; RegAddr = pModeSetting->u16RegAddr; Val = pModeSetting->u8Val; @@ -1086,11 +1086,11 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, /* set OV5640 to capture mode */ u8 ae_ag_ctrl, average; - int preview_shutter, preview_gain16; - int capture_shutter, capture_gain16; - int capture_sysclk, capture_HTS, capture_VTS; - int light_frequency, capture_bandingfilter, capture_max_band; - long capture_gain16_shutter; + int prev_shutter, prev_gain16; + int cap_shutter, cap_gain16; + int cap_sysclk, cap_HTS, cap_VTS; + int light_freq, cap_bandfilt, cap_maxband; + long cap_gain16_shutter; /* auto focus */ /* OV5640_auto_focus();//if no af function, just skip it */ @@ -1101,14 +1101,13 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, ov5640_write_reg(0x3503, ae_ag_ctrl); /* read preview shutter */ - - preview_shutter = OV5640_get_shutter(); + prev_shutter = OV5640_get_shutter(); if ((binning_on()) && (mode != ov5640_mode_720P_1280_720) && (mode != ov5640_mode_1080P_1920_1080)) - preview_shutter *= 2; + prev_shutter *= 2; /* read preview gain */ - preview_gain16 = OV5640_get_gain16(); + prev_gain16 = OV5640_get_gain16(); /* get average */ ov5640_read_reg(0x56a1, &average); @@ -1122,10 +1121,9 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, OV5640_stream_off(); /* Write capture setting */ - pModeSetting = ov5640_mode_info_data[frame_rate][mode].init_data_ptr; - iModeSettingArySize = + ArySize = ov5640_mode_info_data[frame_rate][mode].init_data_size; ov5640_data.pix.width = @@ -1134,10 +1132,10 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, ov5640_mode_info_data[frame_rate][mode].height; if (ov5640_data.pix.width == 0 || ov5640_data.pix.height == 0 || - pModeSetting == NULL || iModeSettingArySize == 0) + pModeSetting == NULL || ArySize == 0) return -EINVAL; - for (i = 0; i < iModeSettingArySize; ++i, ++pModeSetting) { + for (i = 0; i < ArySize; ++i, ++pModeSetting) { Delay_ms = pModeSetting->u32Delay_ms; RegAddr = pModeSetting->u16RegAddr; Val = pModeSetting->u8Val; @@ -1163,71 +1161,75 @@ static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, /* read capture VTS */ - capture_VTS = OV5640_get_VTS(); - capture_HTS = OV5640_get_HTS(); - capture_sysclk = OV5640_get_sysclk(); + cap_VTS = OV5640_get_VTS(); + cap_HTS = OV5640_get_HTS(); + cap_sysclk = OV5640_get_sysclk(); /* calculate capture banding filter */ - light_frequency = OV5640_get_light_frequency(); - if (light_frequency == 60) { + light_freq = OV5640_get_light_freq(); + if (light_freq == 60) { /* 60Hz */ - capture_bandingfilter = capture_sysclk * 100 / capture_HTS * 100 / 120; + cap_bandfilt = cap_sysclk * 100 / cap_HTS * 100 / 120; } else { /* 50Hz */ - capture_bandingfilter = capture_sysclk * 100 / capture_HTS; + cap_bandfilt = cap_sysclk * 100 / cap_HTS; } - capture_max_band = (int)((capture_VTS - 4)/capture_bandingfilter); + cap_maxband = (int)((cap_VTS - 4)/cap_bandfilt); /* calculate capture shutter/gain16 */ if (average > AE_low && average < AE_high) { /* in stable range */ - capture_gain16_shutter = preview_gain16 * preview_shutter * capture_sysclk/preview_sysclk \ - * preview_HTS/capture_HTS * AE_Target / average; + cap_gain16_shutter = + prev_gain16 * prev_shutter * cap_sysclk/prev_sysclk + * prev_HTS/cap_HTS * AE_Target / average; } else { - capture_gain16_shutter = preview_gain16 * preview_shutter * capture_sysclk/preview_sysclk \ - * preview_HTS/capture_HTS; + cap_gain16_shutter = + prev_gain16 * prev_shutter * cap_sysclk/prev_sysclk + * prev_HTS/cap_HTS; } /* gain to shutter */ - if (capture_gain16_shutter < (capture_bandingfilter * 16)) { + if (cap_gain16_shutter < (cap_bandfilt * 16)) { /* shutter < 1/100 */ - capture_shutter = capture_gain16_shutter/16; - if (capture_shutter < 1) - capture_shutter = 1; + cap_shutter = cap_gain16_shutter/16; + if (cap_shutter < 1) + cap_shutter = 1; - capture_gain16 = capture_gain16_shutter/capture_shutter; - if (capture_gain16 < 16) - capture_gain16 = 16; + cap_gain16 = cap_gain16_shutter/cap_shutter; + if (cap_gain16 < 16) + cap_gain16 = 16; } else { - if (capture_gain16_shutter > (capture_bandingfilter*capture_max_band*16)) { - /* exposure reach max */ - capture_shutter = capture_bandingfilter*capture_max_band; - capture_gain16 = capture_gain16_shutter / capture_shutter; + if (cap_gain16_shutter > + (cap_bandfilt * cap_maxband * 16)) { + /* exposure reach max */ + cap_shutter = cap_bandfilt * cap_maxband; + cap_gain16 = cap_gain16_shutter / cap_shutter; } else { - /* 1/100 < capture_shutter =< max, capture_shutter = n/100 */ - capture_shutter = ((int) (capture_gain16_shutter/16/capture_bandingfilter))\ - * capture_bandingfilter; - capture_gain16 = capture_gain16_shutter / capture_shutter; + /* 1/100 < (cap_shutter = n/100) =< max */ + cap_shutter = + ((int) (cap_gain16_shutter/16 / cap_bandfilt)) + *cap_bandfilt; + cap_gain16 = cap_gain16_shutter / cap_shutter; } } /* write capture gain */ - OV5640_set_gain16(capture_gain16); + OV5640_set_gain16(cap_gain16); /* write capture shutter */ - if (capture_shutter > (capture_VTS - 4)) { - capture_VTS = capture_shutter + 4; - OV5640_set_VTS(capture_VTS); + if (cap_shutter > (cap_VTS - 4)) { + cap_VTS = cap_shutter + 4; + OV5640_set_VTS(cap_VTS); } - OV5640_set_shutter(capture_shutter); + OV5640_set_shutter(cap_shutter); OV5640_stream_on(); } OV5640_set_AE_target(AE_Target); - OV5640_get_light_frequency(); + OV5640_get_light_freq(); OV5640_set_bandingfilter(); ov5640_set_virtual_channel(ov5640_data.csi); -- 2.39.5