diff --git a/release/files_common b/release/files_common index 398ce8f941..828479f0ef 100644 --- a/release/files_common +++ b/release/files_common @@ -302,7 +302,6 @@ selfdrive/camerad/cameras/camera_common.h selfdrive/camerad/cameras/camera_common.cc selfdrive/camerad/cameras/camera_replay.cc selfdrive/camerad/cameras/camera_replay.h -selfdrive/camerad/cameras/sensor_i2c.h selfdrive/camerad/cameras/sensor2_i2c.h selfdrive/camerad/transforms/rgb_to_yuv.cc diff --git a/selfdrive/camerad/cameras/sensor_i2c.h b/selfdrive/camerad/cameras/sensor_i2c.h deleted file mode 100644 index b46ebb370a..0000000000 --- a/selfdrive/camerad/cameras/sensor_i2c.h +++ /dev/null @@ -1,651 +0,0 @@ -static struct msm_camera_i2c_reg_array init_array_imx298[] = { - {0x101,0x0,0}, // IMAGE_ORIENT - {0x601,0x0,0}, // test pattern - //{0xb02,0,0}, // green correction? - // external clock setting - {0x136,0x18,0}, {0x137,0x0,0}, // EXCK_FREQ = Extclk_frequency_mhz - // global setting? - {0x30f4,0x1,0}, - {0x30f5,0x7a,0}, - {0x30f6,0x0,0}, - {0x30f7,0xec,0}, - {0x30fc,0x1,0}, - {0x3101,0x1,0}, - {0x5b2f,0x8,0}, - {0x5d32,0x5,0}, - {0x5d7c,0x0,0}, - {0x5d7d,0x0,0}, - {0x5db9,0x1,0}, - {0x5e43,0x0,0}, - {0x6300,0x0,0}, - {0x6301,0xea,0}, - {0x6302,0x0,0}, - {0x6303,0xb4,0}, - {0x6564,0x0,0}, - {0x6565,0xb6,0}, - {0x6566,0x0,0}, - {0x6567,0xe6,0}, - {0x6714,0x1,0}, - {0x6758,0xb,0}, - {0x6910,0x4,0}, - {0x6916,0x1,0}, - {0x6918,0x4,0}, - {0x691e,0x1,0}, - {0x6931,0x1,0}, - {0x6937,0x2,0}, - {0x693b,0x2,0}, - {0x6d00,0x4a,0}, - {0x6d01,0x41,0}, - {0x6d02,0x23,0}, - {0x6d05,0x4c,0}, - {0x6d06,0x10,0}, - {0x6d08,0x30,0}, - {0x6d09,0x38,0}, - {0x6d0a,0x2c,0}, - {0x6d0b,0x2d,0}, - {0x6d0c,0x34,0}, - {0x6d0d,0x42,0}, - {0x6d19,0x1c,0}, - {0x6d1a,0x71,0}, - {0x6d1b,0xc6,0}, - {0x6d1c,0x94,0}, - {0x6d24,0xe4,0}, - {0x6d30,0xa,0}, - {0x6d31,0x1,0}, - {0x6d33,0xb,0}, - {0x6d34,0x5,0}, - {0x6d35,0x0,0}, - {0x83c2,0x3,0}, - {0x83c3,0x8,0}, - {0x83c4,0x48,0}, - {0x83c7,0x8,0}, - {0x83cb,0x0,0}, - {0xb101,0xff,0}, - {0xb103,0xff,0}, - {0xb105,0xff,0}, - {0xb107,0xff,0}, - {0xb109,0xff,0}, - {0xb10b,0xff,0}, - {0xb10d,0xff,0}, - {0xb10f,0xff,0}, - {0xb111,0xff,0}, - {0xb163,0x3c,0}, - {0xc2a0,0x8,0}, - {0xc2a3,0x3,0}, - {0xc2a5,0x8,0}, - {0xc2a6,0x48,0}, - {0xc2a9,0x0,0}, - {0xf800,0x5e,0}, - {0xf801,0x5e,0}, - {0xf802,0xcd,0}, - {0xf803,0x20,0}, - {0xf804,0x55,0}, - {0xf805,0xd4,0}, - {0xf806,0x1f,0}, - {0xf808,0xf8,0}, - {0xf809,0x3a,0}, - {0xf80a,0xf1,0}, - {0xf80b,0x7e,0}, - {0xf80c,0x55,0}, - {0xf80d,0x38,0}, - {0xf80e,0xe3,0}, - {0xf810,0x74,0}, - {0xf811,0x41,0}, - {0xf812,0xbf,0}, - {0xf844,0x40,0}, - {0xf845,0xba,0}, - {0xf846,0x70,0}, - {0xf847,0x47,0}, - {0xf848,0xc0,0}, - {0xf849,0xba,0}, - {0xf84a,0x70,0}, - {0xf84b,0x47,0}, - {0xf84c,0x82,0}, - {0xf84d,0xf6,0}, - {0xf84e,0x32,0}, - {0xf84f,0xfd,0}, - {0xf851,0xf0,0}, - {0xf852,0x2,0}, - {0xf853,0xf8,0}, - {0xf854,0x81,0}, - {0xf855,0xf6,0}, - {0xf856,0xc0,0}, - {0xf857,0xff,0}, - {0xf858,0x10,0}, - {0xf859,0xb5,0}, - {0xf85a,0xd,0}, - {0xf85b,0x48,0}, - {0xf85c,0x40,0}, - {0xf85d,0x7a,0}, - {0xf85e,0x1,0}, - {0xf85f,0x28,0}, - {0xf860,0x15,0}, - {0xf861,0xd1,0}, - {0xf862,0xc,0}, - {0xf863,0x49,0}, - {0xf864,0xc,0}, - {0xf865,0x46,0}, - {0xf866,0x40,0}, - {0xf867,0x3c,0}, - {0xf868,0x48,0}, - {0xf869,0x8a,0}, - {0xf86a,0x62,0}, - {0xf86b,0x8a,0}, - {0xf86c,0x80,0}, - {0xf86d,0x1a,0}, - {0xf86e,0x8a,0}, - {0xf86f,0x89,0}, - {0xf871,0xb2,0}, - {0xf872,0x10,0}, - {0xf873,0x18,0}, - {0xf874,0xa,0}, - {0xf875,0x46,0}, - {0xf876,0x20,0}, - {0xf877,0x32,0}, - {0xf878,0x12,0}, - {0xf879,0x88,0}, - {0xf87a,0x90,0}, - {0xf87b,0x42,0}, - {0xf87d,0xda,0}, - {0xf87e,0x10,0}, - {0xf87f,0x46,0}, - {0xf880,0x80,0}, - {0xf881,0xb2,0}, - {0xf882,0x88,0}, - {0xf883,0x81,0}, - {0xf884,0x84,0}, - {0xf885,0xf6,0}, - {0xf886,0xd2,0}, - {0xf887,0xf9,0}, - {0xf888,0xe0,0}, - {0xf889,0x67,0}, - {0xf88a,0x85,0}, - {0xf88b,0xf6,0}, - {0xf88c,0xa1,0}, - {0xf88d,0xfc,0}, - {0xf88e,0x10,0}, - {0xf88f,0xbd,0}, - {0xf891,0x18,0}, - {0xf892,0x21,0}, - {0xf893,0x24,0}, - {0xf895,0x18,0}, - {0xf896,0x19,0}, - {0xf897,0xb4,0}, - {0x4e29,0x1,0}, - // PDAF stuff - {0x3166,0x1,0}, //AREA_EN_0 - {0x3167,0x1,0}, - {0x3168,0x1,0}, - {0x3169,0x1,0}, - {0x316a,0x1,0}, - {0x316b,0x1,0}, - {0x316c,0x1,0}, - {0x316d,0x1,0}, - {0x3158,0x2,0}, - {0x3159,0x2,0}, - {0x315a,0x2,0}, - {0x315b,0x3,0}, - {0x3013,0x7,0}, //RMSC_NR_MODE - {0x3035,0x1,0}, - {0x3051,0x0,0}, - {0x3056,0x2,0}, - {0x3057,0x1,0}, - {0x3060,0x0,0}, - {0x8435,0x0,0}, - {0x8455,0x0,0}, - {0x847c,0x0,0}, - {0x84fb,0x1,0}, - {0x9619,0xa0,0}, - {0x961b,0xa0,0}, - {0x961d,0xa0,0}, - {0x961f,0x20,0}, - {0x9621,0x20,0}, - {0x9623,0x20,0}, - {0x9625,0xa0,0}, - {0x9627,0xa0,0}, - {0x9629,0xa0,0}, - {0x962b,0x20,0}, - {0x962d,0x20,0}, - {0x962f,0x20,0}, - {0x9901,0x35,0}, - {0x9903,0x23,0}, - {0x9905,0x23,0}, - {0x9906,0x0,0}, - {0x9907,0x31,0}, - {0x9908,0x0,0}, - {0x9909,0x1b,0}, - {0x990a,0x0,0}, - {0x990b,0x15,0}, - {0x990d,0x3f,0}, - {0x990f,0x3f,0}, - {0x9911,0x3f,0}, - {0x9913,0x64,0}, - {0x9915,0x64,0}, - {0x9917,0x64,0}, - {0x9919,0x50,0}, - {0x991b,0x60,0}, - {0x991d,0x65,0}, - {0x991f,0x1,0}, - {0x9921,0x1,0}, - {0x9923,0x1,0}, - {0x9925,0x23,0}, - {0x9927,0x23,0}, - {0x9929,0x23,0}, - {0x992b,0x2f,0}, - {0x992d,0x1a,0}, - {0x992f,0x14,0}, - {0x9931,0x3f,0}, - {0x9933,0x3f,0}, - {0x9935,0x3f,0}, - {0x9937,0x6b,0}, - {0x9939,0x7c,0}, - {0x993b,0x81,0}, - {0x9943,0xf,0}, - {0x9945,0xf,0}, - {0x9947,0xf,0}, - {0x9949,0xf,0}, - {0x994b,0xf,0}, - {0x994d,0xf,0}, - {0x994f,0x42,0}, - {0x9951,0xf,0}, - {0x9953,0xb,0}, - {0x9955,0x5a,0}, - {0x9957,0x13,0}, - {0x9959,0xc,0}, - {0x995a,0x0,0}, - {0x995b,0x0,0}, - {0x995c,0x0,0}, - {0x996b,0x0,0}, - {0x996d,0x10,0}, - {0x996f,0x10,0}, - {0x9971,0xc8,0}, - {0x9973,0x32,0}, - {0x9975,0x4,0}, - {0x9976,0xa,0}, - {0x9977,0xa,0}, - {0x9978,0xa,0}, - {0x99a4,0x2f,0}, - {0x99a5,0x2f,0}, - {0x99a6,0x2f,0}, - {0x99a7,0xa,0}, - {0x99a8,0xa,0}, - {0x99a9,0xa,0}, - {0x99aa,0x2f,0}, - {0x99ab,0x2f,0}, - {0x99ac,0x2f,0}, - {0x99ad,0x0,0}, - {0x99ae,0x0,0}, - {0x99af,0x0,0}, - {0x99b0,0x40,0}, - {0x99b1,0x40,0}, - {0x99b2,0x40,0}, - {0x99b3,0x30,0}, - {0x99b4,0x30,0}, - {0x99b5,0x30,0}, - {0x99bb,0xa,0}, - {0x99bd,0xa,0}, - {0x99bf,0xa,0}, - {0x99c0,0x9,0}, - {0x99c1,0x9,0}, - {0x99c2,0x9,0}, - {0x99c6,0x3c,0}, - {0x99c7,0x3c,0}, - {0x99c8,0x3c,0}, - {0x99c9,0xff,0}, - {0x99ca,0xff,0}, - {0x99cb,0xff,0}, - {0x9b01,0x35,0}, - {0x9b03,0x14,0}, - {0x9b05,0x14,0}, - {0x9b07,0x31,0}, - {0x9b09,0x1b,0}, - {0x9b0b,0x15,0}, - {0x9b0d,0x1e,0}, - {0x9b0f,0x1e,0}, - {0x9b11,0x1e,0}, - {0x9b13,0x64,0}, - {0x9b15,0x64,0}, - {0x9b17,0x64,0}, - {0x9b19,0x50,0}, - {0x9b1b,0x60,0}, - {0x9b1d,0x65,0}, - {0x9b1f,0x1,0}, - {0x9b21,0x1,0}, - {0x9b23,0x1,0}, - {0x9b25,0x14,0}, - {0x9b27,0x14,0}, - {0x9b29,0x14,0}, - {0x9b2b,0x2f,0}, - {0x9b2d,0x1a,0}, - {0x9b2f,0x14,0}, - {0x9b31,0x1e,0}, - {0x9b33,0x1e,0}, - {0x9b35,0x1e,0}, - {0x9b37,0x6b,0}, - {0x9b39,0x7c,0}, - {0x9b3b,0x81,0}, - {0x9b43,0xf,0}, - {0x9b45,0xf,0}, - {0x9b47,0xf,0}, - {0x9b49,0xf,0}, - {0x9b4b,0xf,0}, - {0x9b4d,0xf,0}, - {0x9b4f,0x2d,0}, - {0x9b51,0xb,0}, - {0x9b53,0x8,0}, - {0x9b55,0x40,0}, - {0x9b57,0xd,0}, - {0x9b59,0x8,0}, - {0x9b5a,0x0,0}, - {0x9b5b,0x0,0}, - {0x9b5c,0x0,0}, - {0x9b6b,0x0,0}, - {0x9b6d,0x10,0}, - {0x9b6f,0x10,0}, - {0x9b71,0xc8,0}, - {0x9b73,0x32,0}, - {0x9b75,0x4,0}, - {0x9bb0,0x40,0}, - {0x9bb1,0x40,0}, - {0x9bb2,0x40,0}, - {0x9bb3,0x30,0}, - {0x9bb4,0x30,0}, - {0x9bb5,0x30,0}, - {0x9bbb,0xa,0}, - {0x9bbd,0xa,0}, - {0x9bbf,0xa,0}, - {0x9bc0,0x9,0}, - {0x9bc1,0x9,0}, - {0x9bc2,0x9,0}, - {0x9bc6,0x18,0}, - {0x9bc7,0x18,0}, - {0x9bc8,0x18,0}, - {0x9bc9,0xff,0}, - {0x9bca,0xff,0}, - {0x9bcb,0xff,0}, - {0xb2b2,0x1,0}, -}; - -static struct msm_camera_i2c_reg_array mode_setting_array_imx298[] = { -// i2c settings for mode 3 -// { -// .x_output = 2328, -// .y_output = 1748, -// .line_length_pclk = 5536, -// .frame_length_lines = 1802, -// .vt_pixel_clk = 299300000, -// .op_pixel_clk = 299300000, -// .binning_factor = 2, -// .min_fps = 15.000000, -// .max_fps = 30.020000, -// .mode = 1, -// .offset_x = 0, -// .offset_y = 0, -// .scale_factor = 1.000000, -// .is_pdaf_supported = 1, -// } - -// mode settings - -// hdr settings -{0x0114, 0x03, 0}, // CSI_LANE_MODE = 4-lane -/*{0x0220, 0x00, 0}, // HDR_MODE = disable -{0x0221, 0x11, 0}, // HDR_RESO_REDU_H/V = Full Pixel -{0x0222, 0x10, 0}, // EXPO_RATIO = 16*/ -{0x0220, 0x01, 0}, // HDR_MODE = enable with combined gain and 16x ratio -{0x0221, 0x22, 0}, // HDR_RESO_REDU_H/V = 2 binning -{0x0222, 0x10, 0}, // EXPO_RATIO = 16 - -{0x0340, 0x07, 0}, {0x0341, 0x0a, 0}, // FRM_LENGTH = frame_length_lines = 1802 -{0x0342, 0x15, 0}, {0x0343, 0xa0, 0}, // LINE_LENGTH = line_length_pclk = 5536 -{0x0344, 0x00, 0}, {0x0345, 0x00, 0}, // x_addr_start -{0x0346, 0x00, 0}, {0x0347, 0x00, 0}, // y_addr_start -{0x0348, 0x12, 0}, {0x0349, 0x2f, 0}, // x_addr_end -{0x034a, 0x0d, 0}, {0x034b, 0xa7, 0}, // y_addr_end -{0x0381, 0x01, 0}, // x_even_inc -{0x0383, 0x01, 0}, // x_odd_inc -{0x0385, 0x01, 0}, // y_even_inc -{0x0387, 0x01, 0}, // y_odd_inc -{0x0900, 0x01, 0}, // BINNING_MODE = enable -{0x0901, 0x22, 0}, // BINING_TYPE_H/V = 2binning -{0x0902, 0x00, 0}, // binning_weighting = average - -{0x0b06, 1, 0}, // SING_DEF_CORR_EN -{0x0b0a, 1, 0}, // combined defect correct - -{0x3010, 0x66, 0}, // HDR_OUTPUT_CTRL = ATR + HDR compose + DPC1D + DCP2D -{0x3011, 0x01, 0}, // HDR_OUTPUT_CTRL2 = PD enable -{0x30c0, 0x11, 0}, // RED_GAIN_CB? -{0x300d, 0x00, 0}, // FORCE_FDSUM = disable -{0x30fd, 0x00, 0}, -{0x8493, 0x00, 0}, -{0x8863, 0x00, 0}, -{0x90d7, 0x19, 0}, - -// set black level -{0x3090, 1, 0}, -{0x3092, 0, 0}, -{0x3093, 0x38, 0}, - -// output size settings -{0x0112, 0x0a, 0}, {0x0113, 0x0a, 0}, // CS_DT_FMT_H = 0x0a0a (RAW10 output) -{0x034c, 0x09, 0}, {0x034d, 0x18, 0}, // X_OUT_SIZE = 2328 (1164*2) -{0x034e, 0x06, 0}, {0x034f, 0xd4, 0}, // Y_OUT_SIZE = 1748 (874*2) -{0x0401, 0x00, 0}, // SCALING_MODE -{0x0404, 0x00, 0}, {0x0405, 0x10, 0}, // SCALE_M -{0x0408, 0x00, 0}, {0x0409, 0x00, 0}, // DCROP_XOFS -{0x040a, 0x00, 0}, {0x040b, 0x00, 0}, // DCROP_YOFS -{0x040c, 0x09, 0}, {0x040d, 0x18, 0}, // DCROP_WIDTH -{0x040e, 0x06, 0}, {0x040f, 0xd4, 0}, // DCROP_HIGT - -// clock settings -// 299300000 -/* -{0x0301, 0x05, 0}, // VT_PIX_CLK_DIV -{0x0303, 0x02, 0}, // VT_SYS_CLK_DIV -{0x0305, 0x04, 0}, // PRE_PLL_CLK_DIV -{0x0306, 0x00, 0}, {0x0307, 0x7d, 0}, // PLL_MULTIPLIER . mode 1: 0xf6 -{0x0309, 0x0a, 0}, // OP_PIX_CLK_DIV -{0x030b, 0x01, 0}, // OP_SYS_CLK_DIV -{0x030d, 0x0f, 0}, // PREPLLCK_OP_DIV -{0x030e, 0x03, 0}, {0x030f, 0x41, 0}, // PLL_OP_MPY -{0x0310, 0x00, 0}, // PLL_MULT_DRIV -*/ -// 600000000 -{0x0301, 0x05, 0}, -{0x0303, 0x02, 0}, -{0x0305, 0x04, 0}, -{0x0306, 0x00, 0}, -{0x0307, 0xfa, 0}, -{0x0309, 0x0a, 0}, -{0x030b, 0x01, 0}, -{0x030d, 0x0f, 0}, -{0x030e, 0x03, 0}, {0x030f, 0x41, 0}, -{0x0310, 0x00, 0}, - -// data rate settings -/*{0x0820, 0x0b, 0}, // requested_link_bit_rate_mbps = 3000 -{0x0821, 0xb8, 0}, -{0x0822, 0x00, 0}, -{0x0823, 0x00, 0},*/ -{0x0820, 0x17, 0}, // requested_link_bit_rate_mbps = 6000 -{0x0821, 0x70, 0}, -{0x0822, 0x00, 0}, -{0x0823, 0x00, 0}, - -//integration time settings -{0x0202, 0x07, 0}, {0x0203, 0x00, 0}, // INTEG_TIME = 1792 -{0x0224, 0x01, 0}, {0x0225, 0xf4, 0}, // ST_COARSE_INTEG_TIME = 506 - -// gain settings -{0x0204, 0x00, 0}, {0x0205, 0x00, 0}, // ANA_GAIN_GLOBAL = 512 / (512 - X) -{0x0216, 0x00, 0}, {0x0217, 0x00, 0}, // ST_ANA_GAIN_GLOBAL[8] -{0x020e, 0x01, 0}, {0x020f, 0x00, 0}, // DIG_GAIN_GR -{0x0210, 0x01, 0}, {0x0211, 0x00, 0}, // DIG_GAIN_R -{0x0212, 0x01, 0}, {0x0213, 0x00, 0}, // DIG_GAIN_B -{0x0214, 0x01, 0}, {0x0215, 0x00, 0}, // DIG_GAIN_GB - -// HDR white balance settings (ABS_GAIN) -{0xb8e, 0x01, 0}, {0xb8f, 0x00, 0}, // GR -{0xb90, 0x02, 0}, {0xb91, 0x2b, 0}, // R -{0xb92, 0x01, 0}, {0xb93, 0xd4, 0}, // B -{0xb94, 0x01, 0}, {0xb95, 0x00, 0}, // GB - -// phase detection settings -{0x3058, 0x00, 0}, // NML_NR_EN -{0x3103, 0x01, 0}, // NML_PD_CAL_ENABLE = enable -{0x3108, 0x00, 0}, {0x3109, 0x2c, 0}, //PD_AREA_X_OFFSET -{0x310a, 0x00, 0}, {0x310b, 0x24, 0}, //PD_AREA_Y_OFFSET -{0x310c, 0x01, 0}, {0x310d, 0xa4, 0}, //PD_AREA_WIDTH -{0x310e, 0x01, 0}, {0x310f, 0xa4, 0}, //PD_AREA_HEIGHT -// whole size is 0x918 x 0x6d4 -{0x3110, 0x03, 0}, // PD_AREA_0 = 0x375-0x4d1, 0x258-0x3b6 -{0x3111, 0x75, 0}, -{0x3112, 0x02, 0}, -{0x3113, 0x58, 0}, -{0x3114, 0x04, 0}, -{0x3115, 0xd1, 0}, -{0x3116, 0x03, 0}, -{0x3117, 0xb6, 0}, -{0x3118, 0x04, 0}, // PD_AREA_1 = 0x446-0x5a2, 0x258-0x3b6 -{0x3119, 0x46, 0}, -{0x311a, 0x02, 0}, -{0x311b, 0x58, 0}, -{0x311c, 0x05, 0}, -{0x311d, 0xa2, 0}, -{0x311e, 0x03, 0}, -{0x311f, 0xb6, 0}, -{0x3120, 0x03, 0}, // PD_AREA_2 = 0x375-0x4d1, 0x32a-0x488 -{0x3121, 0x75, 0}, -{0x3122, 0x03, 0}, -{0x3123, 0x2a, 0}, -{0x3124, 0x04, 0}, -{0x3125, 0xd1, 0}, -{0x3126, 0x04, 0}, -{0x3127, 0x88, 0}, -{0x3128, 0x04, 0}, // PD_AREA_3 = 0x446-0x5a2, 0x32a-0x488 -{0x3129, 0x46, 0}, -{0x312a, 0x03, 0}, -{0x312b, 0x2a, 0}, -{0x312c, 0x05, 0}, -{0x312d, 0xa2, 0}, -{0x312e, 0x04, 0}, -{0x312f, 0x88, 0}, -{0x3130, 0x03, 0}, // PD_AREA_4 = 0x375-0x5a2, 0x258-0x488 -{0x3131, 0x75, 0}, -{0x3132, 0x02, 0}, -{0x3133, 0x58, 0}, -{0x3134, 0x05, 0}, -{0x3135, 0xa2, 0}, -{0x3136, 0x04, 0}, -{0x3137, 0x88, 0}, -{0x3138, 0x02, 0}, // PD_AREA_5 = 0x2ba-0x65d, 0x210-0x4d0 -{0x3139, 0xba, 0}, -{0x313a, 0x02, 0}, -{0x313b, 0x10, 0}, -{0x313c, 0x06, 0}, -{0x313d, 0x5d, 0}, -{0x313e, 0x04, 0}, -{0x313f, 0xd0, 0}, -{0x3140, 0x00, 0}, // PD_AREA_6 = 0xa1-0x876, 0x6b-0x676 -{0x3141, 0xa1, 0}, -{0x3142, 0x00, 0}, -{0x3143, 0x6b, 0}, -{0x3144, 0x08, 0}, -{0x3145, 0x76, 0}, -{0x3146, 0x06, 0}, -{0x3147, 0x76, 0}, -{0x3148, 0x00, 0}, // PD_AREA_7 = 0xa1-0x876, 0x5e-0x34c -{0x3149, 0xa1, 0}, -{0x314a, 0x00, 0}, -{0x314b, 0x5e, 0}, -{0x314c, 0x08, 0}, -{0x314d, 0x76, 0}, -{0x314e, 0x03, 0}, -{0x314f, 0x4c, 0}, -{0x3165, 0x02, 0}, // AREA_EN_0 = free area -}; - -// static struct msm_camera_i2c_reg_array reg_array3[] = { -// // REG_HOLD ON -// {0x104,0x1,0}, -// // from regression -// {0x3002,0x0,0}, -// // FRM_LENGTH, 1802 vs 3554 -// // {0x340,0x7,0}, {0x341,0xa,0}, // camera start {0x340,0xd,0}, {0x341,0xe2,0}, -// // INTEG_TIME aka coarse_int_time_addr aka shutter speed -// {0x202,0x03,0}, {0x203,0xda,0}, -// // global_gain_addr -// {0x204,0x0,0}, {0x205,0x0,0}, - -// //?? -// {0x20e,0x1,0}, {0x20f,0x0,0}, -// {0x210,0x1,0}, {0x211,0x0,0}, -// {0x212,0x1,0}, {0x213,0x0,0}, -// {0x214,0x1,0}, {0x215,0x0,0}, - -// // REG_HOLD: mode setting -// {0x104,0x0,0}, -// }; - -// start, remove standby mode -static struct msm_camera_i2c_reg_array start_reg_array[] = {{0x100,0x1,0}}; - -// stop, enable standby mode -static struct msm_camera_i2c_reg_array stop_reg_array[] = {{0x100,0x0,0}}; - -/* -// still mode settings: - {0x847f, 0x0c0c,}, //_M_EQCTL - - {0x8436, 0xfd7f,}, //_M_Kgxdr - {0x8440, 0xf07f,}, //_M_X_LMT - {0x8443, 0xb41e,}, //_M_X_TGT - {0x841b, 0x4001,}, //_M_Kgx10 - - {0x84b6, 0xfd7f,}, //_M_Kgydr - {0x84c0, 0xf07f,}, //_M_Y_LMT - {0x84c3, 0xb41e,}, //_M_Y_TGT - {0x849b, 0x4001,}, //_M_Kgy10 - - {0x8438, 0x2d0f,}, //_M_Kgx11 - {0x84b8, 0x2d0f,}, //_M_Kgy11 - {0x8447, 0x002b,}, //_M_KgxTG - {0x84c7, 0x002b,}, //_M_KgyTG - - {0x847f, 0x0d0d,}, //_M_EQCTL -*/ - -static struct msm_camera_i2c_reg_array init_array_ov8865[] = { -// round 1 -//{0x103,0x1,0}, // software reset -{0x100,0x0,0}, // standby on -{0x3638,0xff,0}, -{0x302,0x1e,0}, {0x303,0x0,0}, {0x304,0x3,0}, {0x30d,0x1e,0}, {0x30e,0x0,0}, {0x30f,0x9,0}, {0x312,0x1,0}, {0x31e,0xc,0}, // PLL control -{0x3015,0x1,0}, {0x3018,0x72,0}, {0x3020,0x93,0}, {0x3022,0x1,0}, -{0x3031,0xa,0}, // 10-bit mode -{0x3106,0x1,0}, {0x3305,0xf1,0}, {0x3308,0x0,0}, {0x3309,0x28,0}, {0x330a,0x0,0}, {0x330b,0x20,0}, {0x330c,0x0,0}, {0x330d,0x0,0}, {0x330e,0x0,0}, {0x330f,0x40,0}, {0x3307,0x4,0}, {0x3604,0x4,0}, {0x3602,0x30,0}, {0x3605,0x0,0}, {0x3607,0x20,0}, {0x3608,0x11,0}, {0x3609,0x68,0}, {0x360a,0x40,0}, {0x360c,0xdd,0}, {0x360e,0xc,0}, {0x3610,0x7,0}, {0x3612,0x86,0}, {0x3613,0x58,0}, {0x3614,0x28,0}, {0x3617,0x40,0}, {0x3618,0x5a,0}, {0x3619,0x9b,0}, {0x361c,0x0,0}, {0x361d,0x60,0}, {0x3631,0x60,0}, {0x3633,0x10,0}, {0x3634,0x10,0}, {0x3635,0x10,0}, {0x3636,0x10,0}, {0x3641,0x55,0}, {0x3646,0x86,0}, {0x3647,0x27,0}, {0x364a,0x1b,0}, {0x3500,0x0,0}, {0x3501,0x4c,0}, {0x3502,0x0,0}, {0x3503,0x0,0}, {0x3508,0x2,0}, -{0x3509,0x0,0}, // AEC GAIN -{0x3700,0x24,0}, {0x3701,0xc,0}, {0x3702,0x28,0}, {0x3703,0x19,0}, {0x3704,0x14,0}, {0x3705,0x0,0}, {0x3706,0x38,0}, {0x3707,0x4,0}, {0x3708,0x24,0}, {0x3709,0x40,0}, {0x370a,0x0,0}, {0x370b,0xb8,0}, {0x370c,0x4,0}, {0x3718,0x12,0}, {0x3719,0x31,0}, {0x3712,0x42,0}, {0x3714,0x12,0}, {0x371e,0x19,0}, {0x371f,0x40,0}, {0x3720,0x5,0}, {0x3721,0x5,0}, {0x3724,0x2,0}, {0x3725,0x2,0}, {0x3726,0x6,0}, {0x3728,0x5,0}, {0x3729,0x2,0}, {0x372a,0x3,0}, {0x372b,0x53,0}, {0x372c,0xa3,0}, {0x372d,0x53,0}, {0x372e,0x6,0}, {0x372f,0x10,0}, {0x3730,0x1,0}, {0x3731,0x6,0}, {0x3732,0x14,0}, {0x3733,0x10,0}, {0x3734,0x40,0}, {0x3736,0x20,0}, {0x373a,0x2,0}, {0x373b,0xc,0}, {0x373c,0xa,0}, {0x373e,0x3,0}, {0x3755,0x40,0}, {0x3758,0x0,0}, {0x3759,0x4c,0}, {0x375a,0x6,0}, {0x375b,0x13,0}, {0x375c,0x40,0}, {0x375d,0x2,0}, {0x375e,0x0,0}, {0x375f,0x14,0}, {0x3767,0x1c,0}, {0x3768,0x4,0}, {0x3769,0x20,0}, {0x376c,0xc0,0}, {0x376d,0xc0,0}, {0x376a,0x8,0}, {0x3761,0x0,0}, {0x3762,0x0,0}, {0x3763,0x0,0}, {0x3766,0xff,0}, {0x376b,0x42,0}, {0x3772,0x23,0}, {0x3773,0x2,0}, {0x3774,0x16,0}, {0x3775,0x12,0}, {0x3776,0x8,0}, {0x37a0,0x44,0}, {0x37a1,0x3d,0}, {0x37a2,0x3d,0}, {0x37a3,0x1,0}, {0x37a4,0x0,0}, {0x37a5,0x8,0}, {0x37a6,0x0,0}, {0x37a7,0x44,0}, {0x37a8,0x58,0}, {0x37a9,0x58,0}, {0x3760,0x0,0}, {0x376f,0x1,0}, {0x37aa,0x44,0}, {0x37ab,0x2e,0}, {0x37ac,0x2e,0}, {0x37ad,0x33,0}, {0x37ae,0xd,0}, {0x37af,0xd,0}, {0x37b0,0x0,0}, {0x37b1,0x0,0}, {0x37b2,0x0,0}, {0x37b3,0x42,0}, {0x37b4,0x42,0}, {0x37b5,0x33,0}, {0x37b6,0x0,0}, {0x37b7,0x0,0}, {0x37b8,0x0,0}, {0x37b9,0xff,0}, {0x3800,0x0,0}, {0x3801,0xc,0}, {0x3802,0x0,0}, {0x3803,0xc,0}, -{0x3804,0xc,0}, {0x3805,0xd3,0}, // 3283 -{0x3806,0x9,0}, {0x3807,0xa3,0}, // 2467 -{0x3808,0x6,0}, {0x3809,0x60,0}, // 0x660 = 1632 (width) -{0x380a,0x4,0}, {0x380b,0xc8,0}, // 0x4c8 = 1224 (height) -{0x380c,0x6,0}, {0x380d,0x42,0}, // line_length_pck -{0x380e,0x5,0}, {0x380f,0xda,0}, // frame_length_lines -{0x3810,0x0,0}, {0x3811,0x4,0}, {0x3813,0x4,0}, -{0x3814,0x3,0}, {0x3815,0x1,0}, // H-binning -{0x3820,0x6,0}, // format1 -{0x3821,0x40,0}, // format2 -{0x382a,0x3,0}, {0x382b,0x1,0}, // V-binning -{0x382d,0x7f,0}, {0x3830,0x8,0}, {0x3836,0x2,0}, {0x3837,0x18,0}, -{0x3841,0xff,0}, -{0x3846,0x88,0}, {0x3d85,0x6,0}, {0x3d8c,0x75,0}, {0x3d8d,0xef,0}, {0x3f08,0xb,0}, {0x4000,0xf1,0}, {0x4001,0x14,0}, {0x4005,0x10,0}, {0x4006,0x1,0}, {0x4007,0x1,0}, {0x400b,0xc,0}, {0x400d,0x10,0}, {0x401b,0x0,0}, {0x401d,0x0,0}, {0x4020,0x0,0}, {0x4021,0x0,0}, {0x4022,0x4,0}, {0x4023,0x1f,0}, {0x4024,0x6,0}, {0x4025,0x20,0}, {0x4026,0x6,0}, {0x4027,0x4f,0}, {0x4028,0x0,0}, {0x4029,0x2,0}, {0x402a,0x4,0}, {0x402b,0x4,0}, {0x402c,0x2,0}, {0x402d,0x2,0}, {0x402e,0x8,0}, {0x402f,0x2,0}, {0x401f,0x0,0}, {0x4034,0x3f,0}, {0x4300,0xff,0}, {0x4301,0x0,0}, {0x4302,0xf,0}, {0x4500,0x40,0}, {0x4503,0x10,0}, {0x4601,0x74,0}, {0x481f,0x32,0}, {0x4837,0x15,0}, {0x4850,0x10,0}, {0x4851,0x32,0}, {0x4b00,0x2a,0}, {0x4b0d,0x0,0}, {0x4d00,0x4,0}, {0x4d01,0x18,0}, {0x4d02,0xc3,0}, {0x4d03,0xff,0}, {0x4d04,0xff,0}, {0x4d05,0xff,0}, {0x5000,0x96,0}, {0x5001,0x1,0}, {0x5002,0x8,0}, {0x5901,0x0,0}, -{0x5e00,0x0,0}, -//{0x5e00,0x80,0}, -{0x5e01,0x41,0}, {0x5b00,0x2,0}, {0x5b01,0xd0,0}, {0x5b02,0x3,0}, {0x5b03,0xff,0}, {0x5b05,0x6c,0}, {0x5780,0xfc,0}, {0x5781,0xdf,0}, {0x5782,0x3f,0}, {0x5783,0x8,0}, {0x5784,0xc,0}, {0x5786,0x20,0}, {0x5787,0x40,0}, {0x5788,0x8,0}, {0x5789,0x8,0}, {0x578a,0x2,0}, {0x578b,0x1,0}, {0x578c,0x1,0}, {0x578d,0xc,0}, {0x578e,0x2,0}, {0x578f,0x1,0}, {0x5790,0x1,0}, {0x5800,0x1d,0}, {0x5801,0xe,0}, {0x5802,0xc,0}, {0x5803,0xc,0}, {0x5804,0xf,0}, {0x5805,0x22,0}, {0x5806,0xa,0}, {0x5807,0x6,0}, {0x5808,0x5,0}, {0x5809,0x5,0}, {0x580a,0x7,0}, {0x580b,0xa,0}, {0x580c,0x6,0}, {0x580d,0x2,0}, {0x580e,0x0,0}, {0x580f,0x0,0}, {0x5810,0x3,0}, {0x5811,0x7,0}, {0x5812,0x6,0}, {0x5813,0x2,0}, {0x5814,0x0,0}, {0x5815,0x0,0}, {0x5816,0x3,0}, {0x5817,0x7,0}, {0x5818,0x9,0}, {0x5819,0x6,0}, {0x581a,0x4,0}, {0x581b,0x4,0}, {0x581c,0x6,0}, {0x581d,0xa,0}, {0x581e,0x19,0}, {0x581f,0xd,0}, {0x5820,0xb,0}, {0x5821,0xb,0}, {0x5822,0xe,0}, {0x5823,0x22,0}, {0x5824,0x23,0}, {0x5825,0x28,0}, {0x5826,0x29,0}, {0x5827,0x27,0}, {0x5828,0x13,0}, {0x5829,0x26,0}, {0x582a,0x33,0}, {0x582b,0x32,0}, {0x582c,0x33,0}, {0x582d,0x16,0}, {0x582e,0x14,0}, {0x582f,0x30,0}, {0x5830,0x31,0}, {0x5831,0x30,0}, {0x5832,0x15,0}, {0x5833,0x26,0}, {0x5834,0x23,0}, {0x5835,0x21,0}, {0x5836,0x23,0}, {0x5837,0x5,0}, {0x5838,0x36,0}, {0x5839,0x27,0}, {0x583a,0x28,0}, {0x583b,0x26,0}, {0x583c,0x24,0}, {0x583d,0xdf,0}, -//{0x100,0x1,0}, -// round 2 (color calibration) -{0x7010,0x0,0}, {0x7011,0x0,0}, {0x7012,0x0,0}, {0x7013,0x0,0}, {0x7014,0x0,0}, {0x7015,0x0,0}, {0x7016,0x0,0}, {0x7017,0x0,0}, {0x7018,0x0,0}, {0x7019,0x0,0}, {0x701a,0x0,0}, {0x701b,0x0,0}, {0x701c,0x0,0}, {0x701d,0x0,0}, {0x701e,0x0,0}, {0x701f,0x0,0}, {0x7020,0x0,0}, {0x7021,0x0,0}, {0x7022,0x0,0}, {0x7023,0x0,0}, {0x7024,0x0,0}, {0x7025,0x0,0}, {0x7026,0x0,0}, {0x7027,0x0,0}, {0x7028,0x0,0}, {0x7029,0x0,0}, {0x702a,0x0,0}, {0x702b,0x0,0}, {0x702c,0x0,0}, {0x702d,0x0,0}, {0x702e,0x0,0}, {0x702f,0x0,0}, {0x7030,0x0,0}, {0x7031,0x0,0}, {0x7032,0x0,0}, {0x7033,0x0,0}, {0x7034,0x0,0}, {0x7035,0x0,0}, {0x7036,0x0,0}, {0x7037,0x0,0}, {0x7038,0x0,0}, {0x7039,0x0,0}, {0x703a,0x0,0}, {0x703b,0x0,0}, {0x703c,0x0,0}, {0x703d,0x0,0}, {0x703e,0x0,0}, {0x703f,0x0,0}, {0x7040,0x0,0}, {0x7041,0x0,0}, {0x7042,0x0,0}, {0x7043,0x0,0}, {0x7044,0x0,0}, {0x7045,0x0,0}, {0x7046,0x0,0}, {0x7047,0x0,0}, {0x7048,0x0,0}, {0x7049,0x0,0}, {0x704a,0x0,0}, {0x704b,0x0,0}, {0x704c,0x0,0}, {0x704d,0x0,0}, {0x704e,0x0,0}, {0x704f,0x0,0}, {0x7050,0x0,0}, {0x7051,0x0,0}, {0x7052,0x0,0}, {0x7053,0x0,0}, {0x7054,0x0,0}, {0x7055,0x0,0}, {0x7056,0x0,0}, {0x7057,0x0,0}, {0x7058,0x0,0}, {0x7059,0x0,0}, {0x705a,0x0,0}, {0x705b,0x0,0}, {0x705c,0x0,0}, {0x705d,0x0,0}, {0x705e,0x0,0}, {0x705f,0x0,0}, {0x7060,0x0,0}, {0x7061,0x0,0}, {0x7062,0x0,0}, {0x7063,0x0,0}, {0x7064,0x0,0}, {0x7065,0x0,0}, {0x7066,0x0,0}, {0x7067,0x0,0}, {0x7068,0x0,0}, {0x7069,0x0,0}, {0x706a,0x0,0}, {0x706b,0x0,0}, {0x706c,0x0,0}, {0x706d,0x0,0}, {0x706e,0x0,0}, {0x706f,0x0,0}, {0x7070,0x0,0}, {0x7071,0x0,0}, {0x7072,0x0,0}, {0x7073,0x0,0}, {0x7074,0x0,0}, {0x7075,0x0,0}, {0x7076,0x0,0}, {0x7077,0x0,0}, {0x7078,0x0,0}, {0x7079,0x0,0}, {0x707a,0x0,0}, {0x707b,0x0,0}, {0x707c,0x0,0}, {0x707d,0x0,0}, {0x707e,0x0,0}, {0x707f,0x0,0}, {0x7080,0x0,0}, {0x7081,0x0,0}, {0x7082,0x0,0}, {0x7083,0x0,0}, {0x7084,0x0,0}, {0x7085,0x0,0}, {0x7086,0x0,0}, {0x7087,0x0,0}, {0x7088,0x0,0}, {0x7089,0x0,0}, {0x708a,0x0,0}, {0x708b,0x0,0}, {0x708c,0x0,0}, {0x708d,0x0,0}, {0x708e,0x0,0}, {0x708f,0x0,0}, {0x7090,0x0,0}, {0x7091,0x0,0}, {0x7092,0x0,0}, {0x7093,0x0,0}, {0x7094,0x0,0}, {0x7095,0x0,0}, {0x7096,0x0,0}, {0x7097,0x0,0}, {0x7098,0x0,0}, {0x7099,0x0,0}, {0x709a,0x0,0}, {0x709b,0x0,0}, {0x709c,0x0,0}, {0x709d,0x0,0}, {0x709e,0x0,0}, {0x709f,0x0,0}, {0x70a0,0x0,0}, {0x70a1,0x0,0}, {0x70a2,0x0,0}, {0x70a3,0x0,0}, {0x70a4,0x0,0}, {0x70a5,0x0,0}, {0x70a6,0x0,0}, {0x70a7,0x0,0}, {0x70a8,0x0,0}, {0x70a9,0x0,0}, {0x70aa,0x0,0}, {0x70ab,0x0,0}, {0x70ac,0x0,0}, {0x70ad,0x0,0}, {0x70ae,0x0,0}, {0x70af,0x0,0}, {0x70b0,0x0,0}, {0x70b1,0x0,0}, {0x70b2,0x0,0}, {0x70b3,0x0,0}, {0x70b4,0x0,0}, {0x70b5,0x0,0}, {0x70b6,0x0,0}, {0x70b7,0x0,0}, {0x70b8,0x0,0}, {0x70b9,0x0,0}, {0x70ba,0x0,0}, {0x70bb,0x0,0}, {0x70bc,0x0,0}, {0x70bd,0x0,0}, {0x70be,0x0,0}, {0x70bf,0x0,0}, {0x70c0,0x0,0}, {0x70c1,0x0,0}, {0x70c2,0x0,0}, {0x70c3,0x0,0}, {0x70c4,0x0,0}, {0x70c5,0x0,0}, {0x70c6,0x0,0}, {0x70c7,0x0,0}, {0x70c8,0x0,0}, {0x70c9,0x0,0}, {0x70ca,0x0,0}, {0x70cb,0x0,0}, {0x70cc,0x0,0}, {0x70cd,0x0,0}, {0x70ce,0x0,0}, {0x70cf,0x0,0}, {0x70d0,0x0,0}, {0x70d1,0x0,0}, {0x70d2,0x0,0}, {0x70d3,0x0,0}, {0x70d4,0x0,0}, {0x70d5,0x0,0}, {0x70d6,0x0,0}, {0x70d7,0x0,0}, {0x70d8,0x0,0}, {0x70d9,0x0,0}, {0x70da,0x0,0}, {0x70db,0x0,0}, {0x70dc,0x0,0}, {0x70dd,0x0,0}, {0x70de,0x0,0}, {0x70df,0x0,0}, {0x70e0,0x0,0}, {0x70e1,0x0,0}, {0x70e2,0x0,0}, {0x70e3,0x0,0}, {0x70e4,0x0,0}, {0x70e5,0x0,0}, {0x70e6,0x0,0}, {0x70e7,0x0,0}, {0x70e8,0x0,0}, {0x70e9,0x0,0}, {0x70ea,0x0,0}, {0x70eb,0x0,0}, {0x70ec,0x0,0}, {0x70ed,0x0,0}, {0x70ee,0x0,0}, {0x70ef,0x0,0}, {0x70f0,0x0,0}, {0x70f1,0x0,0}, {0x70f2,0x0,0}, {0x70f3,0x0,0}, {0x70f4,0x0,0}, {0x70f5,0x0,0}, {0x70f6,0x0,0}, {0x70f7,0x0,0}, {0x70f8,0x0,0}, {0x70f9,0x0,0}, {0x70fa,0x0,0}, {0x70fb,0x0,0}, {0x70fc,0x0,0}, {0x70fd,0x0,0}, {0x70fe,0x0,0}, {0x70ff,0x0,0}, {0x7100,0x0,0}, {0x7101,0x0,0}, {0x7102,0x0,0}, {0x7103,0x0,0}, {0x7104,0x0,0}, {0x7105,0x0,0}, {0x7106,0x0,0}, {0x7107,0x0,0}, {0x7108,0x0,0}, {0x7109,0x0,0}, {0x710a,0x0,0}, {0x710b,0x0,0}, {0x710c,0x0,0}, {0x710d,0x0,0}, {0x710e,0x0,0}, {0x710f,0x0,0}, {0x7110,0x0,0}, {0x7111,0x0,0}, {0x7112,0x0,0}, {0x7113,0x0,0}, {0x7114,0x0,0}, {0x7115,0x0,0}, {0x7116,0x0,0}, {0x7117,0x0,0}, {0x7118,0x0,0}, {0x7119,0x0,0}, {0x711a,0x0,0}, {0x711b,0x0,0}, {0x711c,0x0,0}, {0x711d,0x0,0}, {0x711e,0x0,0}, {0x711f,0x0,0}, {0x7120,0x0,0}, {0x7121,0x0,0}, {0x7122,0x0,0}, {0x7123,0x0,0}, {0x7124,0x0,0}, {0x7125,0x0,0}, {0x7126,0x0,0}, {0x7127,0x0,0}, {0x7128,0x0,0}, {0x7129,0x0,0}, {0x712a,0x0,0}, {0x712b,0x0,0}, {0x712c,0x0,0}, {0x712d,0x0,0}, {0x712e,0x0,0}, {0x712f,0x0,0}, {0x7130,0x0,0}, {0x7131,0x0,0}, {0x7132,0x0,0}, {0x501a,0x10,0}, {0x501b,0xd,0}, {0x501c,0x10,0}, {0x501d,0x13,0}, {0x5000,0x96,0}, {0x5800,0x14,0}, {0x5801,0xd,0}, {0x5802,0xa,0}, {0x5803,0xa,0}, {0x5804,0xd,0}, {0x5805,0x13,0}, {0x5806,0xa,0}, {0x5807,0x5,0}, {0x5808,0x3,0}, {0x5809,0x3,0}, {0x580a,0x5,0}, {0x580b,0x9,0}, {0x580c,0x6,0}, {0x580d,0x2,0}, {0x580e,0x0,0}, {0x580f,0x0,0}, {0x5810,0x2,0}, {0x5811,0x5,0}, {0x5812,0x6,0}, {0x5813,0x2,0}, {0x5814,0x0,0}, {0x5815,0x0,0}, {0x5816,0x2,0}, {0x5817,0x5,0}, {0x5818,0xb,0}, {0x5819,0x6,0}, {0x581a,0x3,0}, {0x581b,0x3,0}, {0x581c,0x5,0}, {0x581d,0xa,0}, {0x581e,0x16,0}, {0x581f,0xf,0}, {0x5820,0xb,0}, {0x5821,0xb,0}, {0x5822,0xf,0}, {0x5823,0x15,0}, {0x5824,0x32,0}, {0x5825,0x23,0}, {0x5826,0x23,0}, {0x5827,0x23,0}, {0x5828,0x22,0}, {0x5829,0x21,0}, {0x582a,0x21,0}, {0x582b,0x22,0}, {0x582c,0x21,0},{0x582d,0x11,0}, {0x582e,0x22,0}, {0x582f,0x31,0}, {0x5830,0x41,0}, {0x5831,0x31,0}, {0x5832,0x1,0}, {0x5833,0x21,0}, {0x5834,0x21,0}, {0x5835,0x21,0}, {0x5836,0x11,0}, {0x5837,0x11,0}, {0x5838,0x22,0}, {0x5839,0x22,0}, {0x583a,0x12,0}, {0x583b,0x22,0}, {0x583c,0x22,0}, {0x583d,0xdf,0}, -}; - diff --git a/selfdrive/hardware/base.py b/selfdrive/hardware/base.py index 7e580b1027..8684386f62 100644 --- a/selfdrive/hardware/base.py +++ b/selfdrive/hardware/base.py @@ -78,30 +78,6 @@ class HardwareBase(ABC): def set_bandwidth_limit(upload_speed_kbps: int, download_speed_kbps: int) -> None: pass - @abstractmethod - def get_battery_capacity(self): - pass - - @abstractmethod - def get_battery_status(self): - pass - - @abstractmethod - def get_battery_current(self): - pass - - @abstractmethod - def get_battery_voltage(self): - pass - - @abstractmethod - def get_battery_charging(self): - pass - - @abstractmethod - def set_battery_charging(self, on): - pass - @abstractmethod def get_usb_present(self): pass diff --git a/selfdrive/hardware/pc/hardware.py b/selfdrive/hardware/pc/hardware.py index 0d85f28bed..2f5db925a9 100644 --- a/selfdrive/hardware/pc/hardware.py +++ b/selfdrive/hardware/pc/hardware.py @@ -50,24 +50,6 @@ class Pc(HardwareBase): def get_network_strength(self, network_type): return NetworkStrength.unknown - def get_battery_capacity(self): - return 100 - - def get_battery_status(self): - return "" - - def get_battery_current(self): - return 0 - - def get_battery_voltage(self): - return 0 - - def get_battery_charging(self): - return True - - def set_battery_charging(self, on): - pass - def get_usb_present(self): return False diff --git a/selfdrive/hardware/tici/hardware.py b/selfdrive/hardware/tici/hardware.py index 1005866d69..037afa3891 100644 --- a/selfdrive/hardware/tici/hardware.py +++ b/selfdrive/hardware/tici/hardware.py @@ -355,25 +355,6 @@ class Tici(HardwareBase): pass return ret - # We don't have a battery, so let's use some sane constants - def get_battery_capacity(self): - return 100 - - def get_battery_status(self): - return "" - - def get_battery_current(self): - return 0 - - def get_battery_voltage(self): - return 0 - - def get_battery_charging(self): - return True - - def set_battery_charging(self, on): - pass - def get_usb_present(self): # Not sure if relevant on tici, but the file exists return self.read_param_file("/sys/class/power_supply/usb/present", lambda x: bool(int(x)), False) diff --git a/selfdrive/thermald/power_monitoring.py b/selfdrive/thermald/power_monitoring.py index 25b1bad04d..d7a1f2a360 100644 --- a/selfdrive/thermald/power_monitoring.py +++ b/selfdrive/thermald/power_monitoring.py @@ -1,7 +1,4 @@ -import random import threading -import time -from statistics import mean from typing import Optional from cereal import log @@ -82,52 +79,8 @@ class PowerMonitoring: self.car_battery_capacity_uWh += (CAR_CHARGING_RATE_W * 1e6 * integration_time_h) self.last_measurement_time = now else: - # No ignition, we integrate the offroad power used by the device - is_uno = peripheralState.pandaType == log.PandaState.PandaType.uno # Get current power draw somehow - current_power = HARDWARE.get_current_power_draw() # pylint: disable=assignment-from-none - if current_power is not None: - pass - elif (self.next_pulsed_measurement_time is not None) and (self.next_pulsed_measurement_time <= now): - # TODO: Figure out why this is off by a factor of 3/4??? - FUDGE_FACTOR = 1.33 - - # Turn off charging for about 10 sec in a thread that does not get killed on SIGINT, and perform measurement here to avoid blocking thermal - def perform_pulse_measurement(now): - try: - HARDWARE.set_battery_charging(False) - time.sleep(5) - - # Measure for a few sec to get a good average - voltages = [] - currents = [] - for _ in range(6): - voltages.append(HARDWARE.get_battery_voltage()) - currents.append(HARDWARE.get_battery_current()) - time.sleep(1) - current_power = ((mean(voltages) / 1000000) * (mean(currents) / 1000000)) - - self._perform_integration(now, current_power * FUDGE_FACTOR) - - # Enable charging again - HARDWARE.set_battery_charging(True) - except Exception: - cloudlog.exception("Pulsed power measurement failed") - - # Start pulsed measurement and return - threading.Thread(target=perform_pulse_measurement, args=(now,)).start() - self.next_pulsed_measurement_time = None - return - - elif self.next_pulsed_measurement_time is None and not is_uno: - # On a charging EON with black panda, or drawing more than 400mA out of a white/grey one - # Only way to get the power draw is to turn off charging for a few sec and check what the discharging rate is - # We shouldn't do this very often, so make sure it has been some long-ish random time interval - self.next_pulsed_measurement_time = now + random.randint(120, 180) - return - else: - # Do nothing - return + current_power = HARDWARE.get_current_power_draw() # Do the integration self._perform_integration(now, current_power) @@ -178,11 +131,9 @@ class PowerMonitoring: now = sec_since_boot() panda_charging = (peripheralState.usbPowerMode != log.PeripheralState.UsbPowerMode.client) - BATT_PERC_OFF = 10 should_shutdown = False # Wait until we have shut down charging before powering down should_shutdown |= (not panda_charging and self.should_disable_charging(ignition, in_car, offroad_timestamp)) - should_shutdown |= ((HARDWARE.get_battery_capacity() < BATT_PERC_OFF) and (not HARDWARE.get_battery_charging()) and ((now - offroad_timestamp) > 60)) should_shutdown &= started_seen or (now > MIN_ON_TIME_S) return should_shutdown diff --git a/selfdrive/thermald/tests/test_power_monitoring.py b/selfdrive/thermald/tests/test_power_monitoring.py index 9eeb5f0c6d..c0524add69 100755 --- a/selfdrive/thermald/tests/test_power_monitoring.py +++ b/selfdrive/thermald/tests/test_power_monitoring.py @@ -21,10 +21,7 @@ with patch("common.realtime.sec_since_boot", new=mock_sec_since_boot): CAR_CHARGING_RATE_W, VBATT_PAUSE_CHARGING TEST_DURATION_S = 50 -ALL_PANDA_TYPES = [(hw_type,) for hw_type in [log.PandaState.PandaType.whitePanda, - log.PandaState.PandaType.greyPanda, - log.PandaState.PandaType.blackPanda, - log.PandaState.PandaType.uno]] +ALL_PANDA_TYPES = [(log.PandaState.PandaType.dos,)] def pm_patch(name, value, constant=False): if constant: @@ -121,12 +118,8 @@ class TestPowerMonitoring(unittest.TestCase): # Test to check policy of stopping charging after MAX_TIME_OFFROAD_S @parameterized.expand(ALL_PANDA_TYPES) def test_max_time_offroad(self, hw_type): - BATT_VOLTAGE = 4 - BATT_CURRENT = 0 # To stop shutting down for other reasons MOCKED_MAX_OFFROAD_TIME = 3600 - with pm_patch("HARDWARE.get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("HARDWARE.get_battery_current", BATT_CURRENT * 1e6), \ - pm_patch("HARDWARE.get_battery_status", "Discharging"), pm_patch("MAX_TIME_OFFROAD_S", MOCKED_MAX_OFFROAD_TIME, constant=True), \ - pm_patch("HARDWARE.get_current_power_draw", None): + with pm_patch("MAX_TIME_OFFROAD_S", MOCKED_MAX_OFFROAD_TIME, constant=True), pm_patch("HARDWARE.get_current_power_draw", None): pm = PowerMonitoring() pm.car_battery_capacity_uWh = CAR_BATTERY_CAPACITY_uWh start_time = ssb diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 24aafcbfe0..7c88dd5790 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -240,8 +240,6 @@ def thermald_thread(end_event, hw_queue): msg.deviceState.modemTempC = last_hw_state.modem_temps msg.deviceState.screenBrightnessPercent = HARDWARE.get_screen_brightness() - msg.deviceState.batteryPercent = HARDWARE.get_battery_capacity() - msg.deviceState.batteryCurrent = HARDWARE.get_battery_current() msg.deviceState.usbOnline = HARDWARE.get_usb_present() current_filter.update(msg.deviceState.batteryCurrent / 1e6)