X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fsid130B.c;h=a022859546cfcb993a463d208fa00ab26539bd9a;hb=e82146650ea5de8205f8890eaf4cb98615c51d9a;hp=89cbcfa1e8e5ae808dc983d799aa09c0cb3ba120;hpb=7c35ccce3aacd7a83f7e7f6e81d5aaaed170899d;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/media/video/sid130B.c b/drivers/media/video/sid130B.c index 89cbcfa1e8e5..a022859546cf 100755 --- a/drivers/media/video/sid130B.c +++ b/drivers/media/video/sid130B.c @@ -19,7 +19,7 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #include #include #include -#include +#include static int debug; module_param(debug, int, S_IRUGO|S_IWUSR); @@ -50,9 +50,9 @@ module_param(debug, int, S_IRUGO|S_IWUSR); #define SENSOR_MIN_HEIGHT 144 #define SENSOR_MAX_WIDTH 1600 #define SENSOR_MAX_HEIGHT 1200 -#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */ -#define SENSOR_INIT_HEIGHT 480 -#define SENSOR_INIT_WINSEQADR sensor_vga +#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */ +#define SENSOR_INIT_HEIGHT 600 +#define SENSOR_INIT_WINSEQADR sensor_svga #define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8 #define CONFIG_SENSOR_WhiteBalance 1 @@ -64,7 +64,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR); #define CONFIG_SENSOR_DigitalZoom 0 #define CONFIG_SENSOR_Focus 0 #define CONFIG_SENSOR_Exposure 0 -#define CONFIG_SENSOR_Flash 0 +#define CONFIG_SENSOR_Flash 1 #define CONFIG_SENSOR_Mirror 0 #define CONFIG_SENSOR_Flip 0 @@ -89,9 +89,9 @@ module_param(debug, int, S_IRUGO|S_IWUSR); #define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a)) #define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a) -#define SENSOR_AF_IS_ERR (0x00<<0) -#define SENSOR_AF_IS_OK (0x01<<0) -#define SENSOR_INIT_IS_ERR (0x00<<28) +#define SENSOR_AF_IS_ERR (0x00<<0) +#define SENSOR_AF_IS_OK (0x01<<0) +#define SENSOR_INIT_IS_ERR (0x00<<28) #define SENSOR_INIT_IS_OK (0x01<<28) struct reginfo @@ -100,10 +100,23 @@ struct reginfo u8 val; }; +//flash off in fixed time to prevent from too hot , zyc +struct flash_timer{ + struct soc_camera_device *icd; + struct hrtimer timer; +}; +static enum hrtimer_restart flash_off_func(struct hrtimer *timer); + +static struct flash_timer flash_off_timer; +//for user defined if user want to customize the series , zyc +#ifdef CONFIG_SID130B_USER_DEFINED_SERIES +#include "sid130B_user_series.c" +#else /* init 352X288 SVGA */ static struct reginfo sensor_init_data[] = { - {0x00, 0x00}, +#if 0 + {0x00, 0x00}, {0x04, 0x00}, //Group A 0x10 {0x05, 0x0F}, //UXGA Output {0x06, 0x86}, @@ -738,8 +751,716 @@ static struct reginfo sensor_init_data[] = {0x00, 0x02}, {0x10, 0xd3}, {0xff, 0xff}, +#else + + {0x00, 0x00}, + {0x04, 0x00}, //Group A 0x10 + {0x05, 0x0F}, //UXGA Output + {0x06, 0x86}, + {0x07, 0x08}, + + + {0x08, 0xa2}, //PLL on + {0x09, 0x12}, + {0x0A, 0x12}, + {0x10, 0x13},//17}, + {0x11, 0x01}, + {0x12, 0x8A}, + + {0x13, 0x1a},//16}, + {0x15, 0x22},//16}, + {0x14, 0x27},//16}, + {0x17, 0xcb},//CF}, + {0x18, 0x38},//34}, + {0x41, 0x17}, + {0x42, 0x52}, + + //Flicker - 50Hz - Still mode + {0x00, 0x00}, + {0x20, 0x00}, + {0x21, 0x02}, + {0x23, 0x29},//15}, + {0x00, 0x01}, + {0x35, 0x50},//3c}, + //Flicker - 50Hz - Preview mode 24MHz MCLK + {0x00, 0x00}, + {0x24, 0x00}, + {0x25, 0xe6},//10}, + {0x27, 0x0d},//4b}, + {0x00, 0x01}, + {0x34, 0x80},//64}, + + //AE Block + {0x00, 0x01}, + {0x10, 0x80}, + {0x11, 0x0A}, + {0x12, 0x74}, + {0x13, 0x74}, + {0x14, 0x70}, + {0x17, 0xC4}, + {0x1c, 0x02}, + + {0x19, 0x00},//0x + {0x1A, 0x00},//0x + {0x1c, 0x02}, + + {0x36, 0x26}, + + {0x40, 0x40}, //M +#if 0 + {0x41, 0x28}, + {0x42, 0x28}, + {0x43, 0x08}, + {0x44, 0x08}, + {0x45, 0x09}, + {0x46, 0x17}, + {0x47, 0x1D}, + {0x48, 0x21}, + {0x49, 0x23}, + {0x4A, 0x24}, + {0x4B, 0x26}, + {0x4C, 0x27}, + {0x4D, 0x27}, + {0x4E, 0x1A}, + {0x4F, 0x14}, + {0x50, 0x11}, + {0x51, 0x0F}, + {0x52, 0x0D}, + {0x53, 0x0C}, + {0x54, 0x0A}, + {0x55, 0x09}, +#else + {0x41, 0x20}, + {0x42, 0x20}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x01}, + {0x46, 0x0c}, + {0x47, 0x11}, + {0x48, 0x15}, + {0x49, 0x17}, + {0x4A, 0x1a}, + {0x4B, 0x1c}, + {0x4C, 0x1e}, + {0x4D, 0x1e}, + {0x4E, 0x0f}, + {0x4F, 0x09}, + {0x50, 0x07}, + {0x51, 0x05}, + {0x52, 0x04}, + {0x53, 0x03}, + {0x54, 0x02}, + {0x55, 0x01}, + {0x60, 0x7e}, + {0x61, 0xff}, + {0x62, 0xff}, + {0x63, 0xff}, + {0x64, 0xff}, + {0x65, 0x7e}, + {0x66, 0x50}, + {0x67, 0x50}, + {0x68, 0x50}, + {0x69, 0x50}, + {0x6A, 0x50}, + {0x6B, 0x00}, + {0x6C, 0x06}, + {0x9a, 0x80}, + {0x6b, 0x80}, + + +#endif + + //AWB Block + {0x00, 0x02}, + {0x10, 0xD3}, + {0x11, 0x11}, + {0x13, 0x80}, + {0x14, 0x80}, + {0x15, 0xE0},//FE}, + {0x16, 0x88}, + {0x17, 0xD0}, + {0x18, 0x78}, + {0x19, 0x98}, + {0x1A, 0x68}, + {0x1B, 0x8d}, + {0x1C, 0x68}, + {0x1D, 0x8C}, + {0x1E, 0x74}, + {0x20, 0xF0}, + {0x21, 0x70}, + {0x22, 0xa8}, + {0x23, 0x10}, + {0x25, 0x20}, + {0x26, 0x05}, + {0x27, 0x63}, + {0x28, 0x63}, + {0x29, 0xA0}, + {0x2A, 0x89}, + {0x30, 0x00}, + {0x31, 0x10}, + {0x32, 0x00}, + {0x33, 0x10}, + {0x34, 0x06}, + {0x35, 0x30}, + {0x36, 0x04}, + {0x37, 0xA0}, + {0x40, 0x01}, + {0x41, 0x04}, + {0x42, 0x08}, + {0x43, 0x10}, + {0x44, 0x13}, + {0x45, 0x6B}, + {0x46, 0x82}, + {0x52, 0x82}, + + + + //CMA change -D65~A + {0x53, 0x86}, //A + {0x54, 0xA0}, //A + {0x55, 0x88}, //A + {0x56, 0x9F}, //A + {0x57, 0xA5}, //A + {0x58, 0x89}, //A + {0x59, 0xA6}, //A + {0x5A, 0x87}, //A + + {0x64, 0x00}, //T + {0x65, 0x00}, + {0x66, 0x00}, //T + {0x67, 0x00}, + {0x68, 0xA5}, //T + {0x69, 0xB4}, + {0x6A, 0xB3}, //T + {0x6B, 0xAC}, + {0x6C, 0xB7}, //T + {0x6D, 0x98}, + {0x6E, 0xBA}, //T + {0x6F, 0x90}, + {0x70, 0xBF}, //T + {0x71, 0x9B}, + {0x72, 0xCE}, //T + {0x73, 0x8C}, + + + //IDP + + + {0x74, 0x7F}, //T + {0x75, 0x8C}, //T + {0x76, 0xAD}, //T + {0x77, 0xBA}, //T + {0x78, 0x8F}, //T + {0x79, 0x9A}, //T + {0x7A, 0xA3}, //T + {0x7B, 0xAC}, //T + {0x7C, 0xA0}, //T + {0x7D, 0xA9}, //T + {0x7E, 0x95}, //T + {0x7F, 0xAC}, //T + {0x80, 0xAD}, //T + {0x81, 0xBC}, //T + {0x82, 0x98}, //T + {0x83, 0xA4}, //T + {0x84, 0x00}, //T + {0x85, 0x00}, //T + {0x86, 0x00}, //T + {0x87, 0x00}, //T + {0x88, 0xC9}, //T + {0x89, 0xD5}, //T + {0x8A, 0x70}, //T + {0x8B, 0x7B}, //T + {0x8C, 0xD0}, //T + {0x8D, 0xE5}, //T + {0x8E, 0x58}, //T + {0x8F, 0x70}, //T + + {0xB4, 0x05}, + {0xB5, 0x0F}, + {0xB6, 0x06}, + {0xB7, 0x06}, + {0xB8, 0x40}, + {0xB9, 0x10}, + {0xBA, 0x06}, + + //IDP + {0x00, 0x03}, + {0x10, 0xFF}, + {0x11, 0x1D}, + {0x12, 0x1D}, + {0x13, 0xFB}, + {0x14, 0x00}, + {0x15, 0xc0}, + + //DPC + {0x30, 0x88}, //D + {0x31, 0x14},//04}, //D + {0x32, 0x10}, //D + {0x33, 0x0C}, //D + {0x34, 0x08}, //D + {0x35, 0x04}, //D + {0x36, 0x44}, //D + {0x37, 0x66}, //D + {0x38, 0x00}, //0 + {0x39, 0x08}, //0 + {0x3A, 0x08}, //0 + {0x3B, 0x20}, //0 + {0x3C, 0x20}, // + {0x3D, 0x04}, //N + {0x3E, 0x08}, //N + {0x3F, 0x10}, //N + {0x40, 0x10}, //N + {0x41, 0x20}, //N + {0x42, 0xFF}, //N + {0x43, 0x40},//F0}, //N + {0x44, 0x40}, //B + {0x45, 0x06},//09}, //S + {0x46, 0x40}, //S + {0x47, 0x30}, //I + + //DPC + #if 0 + //Shading + {0x50, 0x24}, //R + {0x51, 0x44}, //R + {0x52, 0x20}, //R + {0x53, 0x30}, //R + + {0x54, 0x20}, //G + {0x55, 0x20}, //G + {0x56, 0x00}, //G + {0x57, 0x10}, //G + + {0x58, 0x20}, //G + {0x59, 0x20}, //G + {0x5A, 0x00}, //G + {0x5B, 0x10}, //G + + {0x5C, 0x34}, //B + {0x5D, 0x48}, //B + {0x5E, 0x18}, //B + {0x5F, 0x2a}, //B + + {0x60, 0x32}, //# + {0x61, 0x00}, //# + {0x62, 0x67}, //# + + {0x6B, 0x23}, + {0x6C, 0x44}, + {0x6D, 0x45}, + {0x6E, 0x67}, + {0x6F, 0x8a}, + {0x70, 0x89}, + + {0x71, 0x34}, + {0x72, 0x45}, + {0x73, 0x56}, + {0x74, 0x77}, + {0x75, 0x78}, + {0x76, 0x89}, + + {0x77, 0x34}, + {0x78, 0x45}, + {0x79, 0x56}, + {0x7A, 0x77}, + {0x7B, 0x78}, + {0x7C, 0x89}, + + {0x7D, 0x22}, + {0x7E, 0x32}, + {0x7F, 0x34}, + {0x80, 0x45}, + {0x81, 0x56}, + {0x82, 0x67}, + {0x83, 0x1f}, + {0x84, 0x50}, +#endif + + //Shading + {0x50, 0x0b}, //R + {0x51, 0x0b}, //R + {0x52, 0x19}, //R + {0x53, 0x18}, //R + + {0x54, 0x10}, //G + {0x55, 0x00}, //G + {0x56, 0x08}, //G + {0x57, 0x00}, //G + + {0x58, 0x10}, //G + {0x59, 0x00}, //G + {0x5A, 0x08}, //G + {0x5B, 0x00}, //G + + {0x5C, 0x14}, //B + {0x5D, 0x0f}, //B + {0x5E, 0x24}, //B + {0x5F, 0x12}, //B + + {0x60, 0x32}, //# + {0x61, 0x00}, //# + {0x62, 0x67}, //# + + {0x6B, 0x23}, + {0x6C, 0x44}, + {0x6D, 0x44}, + {0x6E, 0x45}, + {0x6F, 0x44}, + {0x70, 0x00}, + + {0x71, 0x23}, + {0x72, 0x44}, + {0x73, 0x55}, + {0x74, 0x55}, + {0x75, 0x55}, + {0x76, 0x00}, + + {0x77, 0x23}, + {0x78, 0x44}, + {0x79, 0x55}, + {0x7A, 0x55}, + {0x7B, 0x55}, + {0x7C, 0x00}, + + {0x7D, 0x23}, + {0x7E, 0x44}, + {0x7F, 0x34}, + {0x80, 0x43}, + {0x81, 0x44}, + {0x82, 0x00}, + {0x83, 0x12}, + {0x84, 0x14}, + + + //Interpolation + {0xA0, 0x2F}, + {0xA1, 0xB7}, + {0xA2, 0xB7}, + {0xA3, 0xB7}, + {0xA4, 0x04}, + {0xA5, 0xFF}, + {0xA6, 0x06}, + {0xA7, 0xFF}, + {0xA8, 0x00}, + {0xA9, 0x00}, + {0xAA, 0x00}, + {0xAB, 0x00}, + {0xAC, 0x60}, + {0xAD, 0x18}, + {0xAE, 0x0c}, + {0xAF, 0x14}, + {0xB0, 0x08}, + {0xB1, 0x00}, + + + //Color Matrix for D65 + {0xC0, 0xAF},// C + {0xC1, 0x66}, + {0xC2, 0xd4}, + {0xC3, 0x06}, + {0xC4, 0xf0}, + {0xC5, 0x5a}, + {0xC6, 0xF6}, + {0xC7, 0xF9}, + {0xC8, 0xbf}, + {0xC9, 0x88}, + {0xCA, 0x00}, + {0xCB, 0x00}, + {0xCC, 0x00}, + {0xCD, 0x00}, + {0xCE, 0x00}, + //Color Matrix for CWF + {0xD0, 0x2F}, + {0xD1, 0x72}, + {0xD2, 0xC9}, + {0xD3, 0x04}, + {0xD4, 0xE3}, + {0xD5, 0x60}, + {0xD6, 0xFC}, + {0xD7, 0xF5}, + {0xD8, 0xb0}, + {0xD9, 0x99}, + {0xDA, 0xC3}, + {0xDB, 0x14}, + {0xDC, 0x3A}, + {0xDD, 0xAD}, + {0xDE, 0x09}, + + //Color Matrix for A + {0xE0, 0x2F}, + {0xE1, 0x5C}, + {0xE2, 0xDD}, + {0xE3, 0x06}, + {0xE4, 0xE0}, + {0xE5, 0x69}, + {0xE6, 0xF6}, + {0xE7, 0xE5}, + {0xE8, 0xAB}, + {0xE9, 0xAE}, + {0xEA, 0x6A}, + {0xEB, 0x01}, + {0xEC, 0x2D}, + {0xED, 0xEE}, + {0xEE, 0x04}, + + //IDP 2 + {0x00, 0x04}, + + //Gamma - R + {0x10, 0x00}, + {0x11, 0x06}, + {0x12, 0x0e}, + {0x13, 0x20}, + {0x14, 0x40}, + {0x15, 0x5e}, + {0x16, 0x74}, + {0x17, 0x87}, + {0x18, 0x98}, + {0x19, 0xa6}, + {0x1A, 0xb3}, + {0x1B, 0xca}, + {0x1C, 0xde}, + {0x1D, 0xf0}, + {0x1E, 0xf8}, + {0x1F, 0xff}, + + + //Gamma - G + {0x20, 0x00}, + {0x21, 0x06}, + {0x22, 0x0e}, + {0x23, 0x20}, + {0x24, 0x40}, + {0x25, 0x5e}, + {0x26, 0x74}, + {0x27, 0x87}, + {0x28, 0x98}, + {0x29, 0xa6}, + {0x2A, 0xb3}, + {0x2B, 0xca}, + {0x2C, 0xde}, + {0x2D, 0xf0}, + {0x2E, 0xf8}, + {0x2F, 0xff}, + + //Gamma - B + {0x30, 0x00}, + {0x31, 0x06}, + {0x32, 0x0e}, + {0x33, 0x20}, + {0x34, 0x40}, + {0x35, 0x5e}, + {0x36, 0x74}, + {0x37, 0x87}, + {0x38, 0x98}, + {0x39, 0xa6}, + {0x3A, 0xb3}, + {0x3B, 0xca}, + {0x3C, 0xde}, + {0x3D, 0xf0}, + {0x3E, 0xf8}, + {0x3F, 0xff}, + + //CSC + {0x60, 0x33}, + {0x61, 0x20}, + {0x62, 0xE4}, + {0x63, 0xFA}, + {0x64, 0x13}, + {0x65, 0x25}, + {0x66, 0x07}, + {0x67, 0xF5}, + {0x68, 0xEA}, + {0x69, 0x20}, + {0x6A, 0xC8}, + {0x6B, 0xC4}, + {0x6C, 0x84}, + {0x6D, 0x04}, + {0x6E, 0x0C}, + {0x6F, 0x00}, + + + //Edge + {0x80, 0xa2}, + {0x81, 0x10}, + {0x82, 0x10}, + {0x83, 0x04}, + {0x84, 0x0a}, + {0x85, 0x06}, + {0x86, 0x00}, + {0x87, 0x04}, + {0x88, 0x0a}, + {0x89, 0x06}, + {0x8a, 0x10}, + {0x8b, 0x30}, + {0x8c, 0x30}, + {0X90, 0x16}, + {0x91, 0x03}, + {0x93, 0xE0}, + + //Cr/Cb Coring + {0x94, 0x00}, + {0x95, 0x00}, + {0x96, 0x4c}, + {0x97, 0x66}, + {0x9A, 0xf5}, + {0xA1, 0x08}, + {0xA2, 0x10}, + {0xA3, 0x16}, + {0xA4, 0x14}, + {0xA5, 0x18}, + {0xA6, 0xa0}, + {0xA7, 0x06}, + {0xA8, 0x40}, + + {0xA9, 0x20}, + {0xAA, 0x28}, + {0xAc, 0xff}, + {0xAd, 0x09}, + {0xAe, 0x18}, + {0xAf, 0x18}, + + {0xB2, 0x24}, + {0xB3, 0x54}, + {0xB6, 0x08}, + + //Color Saturation + {0xBC, 0x10}, + {0xBD, 0x10}, + {0xBE, 0x10}, + {0xBF, 0x10}, + {0xc2, 0x12}, + {0xc3, 0x12}, + + //IDP 3 + {0x00, 0x05}, + + //Memory + {0x40, 0x15}, + {0x41, 0x28}, + {0x42, 0x04}, + {0x43, 0x15}, + {0x44, 0x28}, + {0x45, 0x04}, + {0x46, 0x15}, + {0x47, 0x28}, + {0x48, 0x04}, + + //Knee + {0x90, 0x00}, // + {0x91, 0x00}, //k + {0x92, 0x00}, //k + {0x93, 0x00}, //K + {0x94, 0x00}, //[ + {0x95, 0x00}, //k + {0x96, 0x00}, //k + + //ADG + #if 0 + {0x99, 0xC0}, + {0xA0, 0x10}, + {0xA1, 0x22}, + {0xA2, 0x36}, + {0xA3, 0x49}, + {0xA4, 0x5D}, + {0xA5, 0x70}, + {0xA6, 0x82}, + {0xA7, 0x94}, + {0xA8, 0xA5}, + {0xA9, 0xB5}, + {0xAA, 0xC3}, + {0xAB, 0xD1}, + {0xAC, 0xDE}, + {0xAD, 0xEA}, + {0xAE, 0xF5}, + {0xAF, 0xFF}, + //YXGMA + {0xB0, 0xc0}, //Y + {0xB1, 0x04}, //Y + {0xB8, 0x0f}, //D + {0xB9, 0x10}, //D + //{0xBA, 0x38}, / + //{0xBB, 0x39}, / + {0xC0, 0x03}, + {0xC1, 0x0E}, + {0xC2, 0x16}, + {0xC3, 0x24}, + {0xC4, 0x3F}, + {0xC5, 0x56}, + {0xC6, 0x6A}, + {0xC7, 0x7C}, + {0xC8, 0x8C}, + {0xC9, 0x98}, + {0xCA, 0xA2}, + {0xCB, 0xB8}, + {0xCC, 0xCD}, + {0xCD, 0xE2}, + {0xCE, 0xF0}, + {0xCF, 0xFF}, + #else + {0x99, 0x00}, + {0xA0, 0x00}, + {0xA1, 0x00}, + {0xA2, 0x00}, + {0xA3, 0x00}, + {0xA4, 0x00}, + {0xA5, 0x00}, + {0xA6, 0x00}, + {0xA7, 0x00}, + {0xA8, 0x00}, + {0xA9, 0x00}, + {0xAA, 0x00}, + {0xAB, 0x00}, + {0xAC, 0x00}, + {0xAD, 0x00}, + {0xAE, 0x00}, + {0xAF, 0x00}, + + //YXGMA + {0xB0, 0x00}, //Y + {0xB1, 0x00}, //Y + {0xB8, 0x00}, //D + {0xB9, 0x00}, //D + //{0xBA, 0x38}, / + //{0xBB, 0x39}, / + {0xC0, 0x00}, + {0xC1, 0x00}, + {0xC2, 0x00}, + {0xC3, 0x00}, + {0xC4, 0x00}, + {0xC5, 0x00}, + {0xC6, 0x00}, + {0xC7, 0x00}, + {0xC8, 0x00}, + {0xC9, 0x00}, + {0xCA, 0x00}, + {0xCB, 0x00}, + {0xCC, 0x00}, + {0xCD, 0x00}, + {0xCE, 0x00}, + {0xCF, 0x00}, + {0xe0, 0x01}, + {0xe1, 0x03}, + {0xe2, 0x04}, + {0xe3, 0x0c}, + {0xe4, 0x11}, + {0xe5, 0x16}, + {0xe6, 0x1b}, + {0xe7, 0x24}, + {0xe8, 0x30}, + #endif + //Sensor on + {0x00, 0x00}, + {0x03, 0xc5}, + {0x00, 0x01}, + {0x10, 0x84}, + {0x00, 0x02}, + {0x10, 0xd3}, + {0xff, 0xff}, + +#endif }; /* 1600X1200 UXGA */ @@ -830,7 +1551,7 @@ static struct reginfo sensor_qcif[] = {0x97,0x90}, {0xff, 0xff}, }; - +#endif static struct reginfo sensor_ClrFmt_YUYV[]= { {0xff, 0xff} @@ -1176,7 +1897,7 @@ static struct reginfo sensor_Zoom3[] = }; static struct reginfo *sensor_ZoomSeqe[] = {sensor_Zoom0, sensor_Zoom1, sensor_Zoom2, sensor_Zoom3, NULL,}; #endif -static const struct v4l2_querymenu sensor_menus[] = +static struct v4l2_querymenu sensor_menus[] = { #if CONFIG_SENSOR_WhiteBalance { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 0, .name = "auto", .reserved = 0, }, { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 1, .name = "incandescent", .reserved = 0,}, @@ -1200,7 +1921,7 @@ static const struct v4l2_querymenu sensor_menus[] = #endif }; -static const struct v4l2_queryctrl sensor_controls[] = +static struct v4l2_queryctrl sensor_controls[] = { #if CONFIG_SENSOR_WhiteBalance { @@ -1393,28 +2114,28 @@ static struct soc_camera_ops sensor_ops = .num_menus = ARRAY_SIZE(sensor_menus), }; -/* only one fixed colorspace per pixelcode */ -struct sensor_datafmt { - enum v4l2_mbus_pixelcode code; - enum v4l2_colorspace colorspace; -}; - -/* Find a data format by a pixel code in an array */ -static const struct sensor_datafmt *sensor_find_datafmt( - enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt, - int n) -{ - int i; - for (i = 0; i < n; i++) - if (fmt[i].code == code) - return fmt + i; - - return NULL; -} - -static const struct sensor_datafmt sensor_colour_fmts[] = { - {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}, - {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG} +/* only one fixed colorspace per pixelcode */ +struct sensor_datafmt { + enum v4l2_mbus_pixelcode code; + enum v4l2_colorspace colorspace; +}; + +/* Find a data format by a pixel code in an array */ +static const struct sensor_datafmt *sensor_find_datafmt( + enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt, + int n) +{ + int i; + for (i = 0; i < n; i++) + if (fmt[i].code == code) + return fmt + i; + + return NULL; +} + +static const struct sensor_datafmt sensor_colour_fmts[] = { + {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}, + {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG} }; typedef struct sensor_info_priv_s @@ -1504,6 +2225,7 @@ static int sensor_write(struct i2c_client *client, u8 reg, u8 val) //buf[0] = reg >> 8; buf[0] = reg & 0xFF; buf[1] = val; + //printk("%s----%d-----\n",__func__,__LINE__); msg->addr = client->addr; msg->flags = client->flags; @@ -1528,7 +2250,7 @@ static int sensor_write(struct i2c_client *client, u8 reg, u8 val) return err; } - +#if 0 /* sensor register read */ static int sensor_read(struct i2c_client *client, u8 reg, u8 *val) { @@ -1569,7 +2291,7 @@ static int sensor_read(struct i2c_client *client, u8 reg, u8 *val) return err; } - +#endif /* write a array of registers */ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray) { @@ -1662,6 +2384,11 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd if (sensor->sensor_io_request && sensor->sensor_io_request->sensor_ioctrl) { sensor->sensor_io_request->sensor_ioctrl(icd->pdev,Cam_Flash, on); + if(on){ + //flash off after 2 secs + hrtimer_cancel(&(flash_off_timer.timer)); + hrtimer_start(&(flash_off_timer.timer),ktime_set(0, 800*1000*1000),HRTIMER_MODE_REL); + } } break; } @@ -1674,15 +2401,22 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd sensor_power_end: return ret; } + +static enum hrtimer_restart flash_off_func(struct hrtimer *timer){ + struct flash_timer *fps_timer = container_of(timer, struct flash_timer, timer); + sensor_ioctrl(fps_timer->icd,Sensor_Flash,0); + SENSOR_DG("%s %s !!!!!!",SENSOR_NAME_STRING(),__FUNCTION__); + return 0; + +} static int sensor_init(struct v4l2_subdev *sd, u32 val) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; struct sensor *sensor = to_sensor(client); const struct v4l2_queryctrl *qctrl; const struct sensor_datafmt *fmt; - char value; - int ret,pid = 0; + int ret; SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__); @@ -1743,6 +2477,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val) goto sensor_INIT_ERR; } #endif + ret = sensor_write_array(client, sensor_init_data); if (ret != 0) { @@ -1752,11 +2487,11 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val) sensor_task_lock(client,0); sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR; fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts)); - if (!fmt) { - SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING()); - ret = -EINVAL; - goto sensor_INIT_ERR; - } + if (!fmt) { + SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING()); + ret = -EINVAL; + goto sensor_INIT_ERR; + } sensor->info_priv.fmt = *fmt; /* sensor sensor information for initialization */ @@ -1801,10 +2536,11 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val) #endif #if CONFIG_SENSOR_Flash - sensor_set_flash(); qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH); if (qctrl) sensor->info_priv.flash = qctrl->default_value; + flash_off_timer.icd = icd; + flash_off_timer.timer.function = flash_off_func; #endif SENSOR_DG("\n%s..%s.. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),((val == 0)?__FUNCTION__:"sensor_reinit"),icd->user_width,icd->user_height); @@ -1897,58 +2633,58 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd) return soc_camera_apply_sensor_flags(icl, flags); } -static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) -{ - struct i2c_client *client = sd->priv; - struct soc_camera_device *icd = client->dev.platform_data; - struct sensor *sensor = to_sensor(client); - - mf->width = icd->user_width; - mf->height = icd->user_height; - mf->code = sensor->info_priv.fmt.code; - mf->colorspace = sensor->info_priv.fmt.colorspace; - mf->field = V4L2_FIELD_NONE; - - return 0; -} -static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) -{ - bool ret = false; - - if ((mf->width == 1024) && (mf->height == 768)) { - ret = true; - } else if ((mf->width == 1280) && (mf->height == 1024)) { - ret = true; - } else if ((mf->width == 1600) && (mf->height == 1200)) { - ret = true; - } else if ((mf->width == 2048) && (mf->height == 1536)) { - ret = true; - } else if ((mf->width == 2592) && (mf->height == 1944)) { - ret = true; - } - - if (ret == true) - SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height); - return ret; -} - -static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) -{ - bool ret = false; - - if ((mf->width == 1280) && (mf->height == 720)) { - ret = true; - } else if ((mf->width == 1920) && (mf->height == 1080)) { - ret = true; - } - - if (ret == true) - SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height); - return ret; -} +static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct soc_camera_device *icd = client->dev.platform_data; + struct sensor *sensor = to_sensor(client); + + mf->width = icd->user_width; + mf->height = icd->user_height; + mf->code = sensor->info_priv.fmt.code; + mf->colorspace = sensor->info_priv.fmt.colorspace; + mf->field = V4L2_FIELD_NONE; + + return 0; +} +static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) +{ + bool ret = false; + + if ((mf->width == 1024) && (mf->height == 768)) { + ret = true; + } else if ((mf->width == 1280) && (mf->height == 1024)) { + ret = true; + } else if ((mf->width == 1600) && (mf->height == 1200)) { + ret = true; + } else if ((mf->width == 2048) && (mf->height == 1536)) { + ret = true; + } else if ((mf->width == 2592) && (mf->height == 1944)) { + ret = true; + } + + if (ret == true) + SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height); + return ret; +} + +static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) +{ + bool ret = false; + + if ((mf->width == 1280) && (mf->height == 720)) { + ret = true; + } else if ((mf->width == 1920) && (mf->height == 1080)) { + ret = true; + } + + if (ret == true) + SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height); + return ret; +} static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct sensor *sensor = to_sensor(client); const struct sensor_datafmt *fmt; const struct v4l2_queryctrl *qctrl; @@ -1956,40 +2692,40 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) struct reginfo *winseqe_set_addr=NULL; int ret=0, set_w,set_h; - fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts, - ARRAY_SIZE(sensor_colour_fmts)); - if (!fmt) { - ret = -EINVAL; - goto sensor_s_fmt_end; - } - - if (sensor->info_priv.fmt.code != mf->code) { - switch (mf->code) - { - case V4L2_MBUS_FMT_YUYV8_2X8: - { - winseqe_set_addr = sensor_ClrFmt_YUYV; - break; - } - case V4L2_MBUS_FMT_UYVY8_2X8: - { - winseqe_set_addr = sensor_ClrFmt_UYVY; - break; - } - default: - break; - } - if (winseqe_set_addr != NULL) { - sensor_write_array(client, winseqe_set_addr); - sensor->info_priv.fmt.code = mf->code; - sensor->info_priv.fmt.colorspace= mf->colorspace; - SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code); - } else { - SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code); - } - } - - set_w = mf->width; + fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts, + ARRAY_SIZE(sensor_colour_fmts)); + if (!fmt) { + ret = -EINVAL; + goto sensor_s_fmt_end; + } + + if (sensor->info_priv.fmt.code != mf->code) { + switch (mf->code) + { + case V4L2_MBUS_FMT_YUYV8_2X8: + { + winseqe_set_addr = sensor_ClrFmt_YUYV; + break; + } + case V4L2_MBUS_FMT_UYVY8_2X8: + { + winseqe_set_addr = sensor_ClrFmt_UYVY; + break; + } + default: + break; + } + if (winseqe_set_addr != NULL) { + sensor_write_array(client, winseqe_set_addr); + sensor->info_priv.fmt.code = mf->code; + sensor->info_priv.fmt.colorspace= mf->colorspace; + SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code); + } else { + SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code); + } + } + + set_w = mf->width; set_h = mf->height; if (((set_w <= 176) && (set_h <= 144)) &&( sensor_qcif[0].reg!=0xff)) @@ -2050,7 +2786,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) if ((int)winseqe_set_addr != sensor->info_priv.winseqe_cur_addr) { #if CONFIG_SENSOR_Flash - if (sensor_fmt_capturechk(sd,f) == true) { /* ddl@rock-chips.com : Capture */ + if (sensor_fmt_capturechk(sd,mf) == true) { /* ddl@rock-chips.com : Capture */ if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) { sensor_ioctrl(icd, Sensor_Flash, Flash_On); SENSOR_DG("%s flash on in capture!\n", SENSOR_NAME_STRING()); @@ -2066,7 +2802,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) if (ret != 0) { SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING()); #if CONFIG_SENSOR_Flash - if (sensor_fmt_capturechk(sd,f) == true) { + if (sensor_fmt_capturechk(sd,mf) == true) { if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) { sensor_ioctrl(icd, Sensor_Flash, Flash_Off); SENSOR_TR("%s Capture format set fail, flash off !\n", SENSOR_NAME_STRING()); @@ -2126,38 +2862,88 @@ sensor_s_fmt_end: return ret; } -static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) -{ - struct i2c_client *client = sd->priv; - struct sensor *sensor = to_sensor(client); - const struct sensor_datafmt *fmt; - int ret = 0; - - fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts, - ARRAY_SIZE(sensor_colour_fmts)); - if (fmt == NULL) { - fmt = &sensor->info_priv.fmt; - mf->code = fmt->code; - } - - if (mf->height > SENSOR_MAX_HEIGHT) - mf->height = SENSOR_MAX_HEIGHT; - else if (mf->height < SENSOR_MIN_HEIGHT) - mf->height = SENSOR_MIN_HEIGHT; - - if (mf->width > SENSOR_MAX_WIDTH) - mf->width = SENSOR_MAX_WIDTH; - else if (mf->width < SENSOR_MIN_WIDTH) - mf->width = SENSOR_MIN_WIDTH; - - mf->colorspace = fmt->colorspace; - - return ret; +static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct sensor *sensor = to_sensor(client); + const struct sensor_datafmt *fmt; + int ret = 0,set_w,set_h; + + fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts, + ARRAY_SIZE(sensor_colour_fmts)); + if (fmt == NULL) { + fmt = &sensor->info_priv.fmt; + mf->code = fmt->code; + } + + if (mf->height > SENSOR_MAX_HEIGHT) + mf->height = SENSOR_MAX_HEIGHT; + else if (mf->height < SENSOR_MIN_HEIGHT) + mf->height = SENSOR_MIN_HEIGHT; + + if (mf->width > SENSOR_MAX_WIDTH) + mf->width = SENSOR_MAX_WIDTH; + else if (mf->width < SENSOR_MIN_WIDTH) + mf->width = SENSOR_MIN_WIDTH; + + set_w = mf->width; + set_h = mf->height; + + if (((set_w <= 176) && (set_h <= 144)) &&( sensor_qcif[0].reg!=0xff)) + { + set_w = 176; + set_h = 144; + } + else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=0xff)) + { + set_w = 320; + set_h = 240; + } + else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=0xff)) + { + set_w = 352; + set_h = 288; + } + else if (((set_w <= 640) && (set_h <= 480)) &&( sensor_vga[0].reg!=0xff)) + { + set_w =640; + set_h = 480; + } + else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=0xff)) + { + set_w = 800; + set_h = 600; + } + else if (((set_w <= 1024) && (set_h <= 768)) &&( sensor_xga[0].reg!=0xff)) + { + set_w = 1024; + set_h = 768; + } + else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=0xff)) + { + set_w = 1280; + set_h = 1024; + } + else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=0xff)) + { + set_w = 1600; + set_h = 1200; + } + else + { + set_w = SENSOR_INIT_WIDTH; + set_h = SENSOR_INIT_HEIGHT; + } + mf->width = set_w; + mf->height = set_h; + mf->colorspace = fmt->colorspace; + + return ret; } static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) return -EINVAL; @@ -2441,7 +3227,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct sensor *sensor = to_sensor(client); const struct v4l2_queryctrl *qctrl; @@ -2500,7 +3286,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl) static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct sensor *sensor = to_sensor(client); struct soc_camera_device *icd = client->dev.platform_data; const struct v4l2_queryctrl *qctrl; @@ -2790,7 +3576,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; int i, error_cnt=0, error_idx=-1; @@ -2815,7 +3601,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; int i, error_cnt=0, error_idx=-1; @@ -2843,9 +3629,8 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control static int sensor_video_probe(struct soc_camera_device *icd, struct i2c_client *client) { - char value; - int ret,pid = 0; - struct sensor *sensor = to_sensor(client); + int ret; + /* We must have a parent by now. And it cannot be a wrong one. * So this entire test is completely redundant. */ @@ -2902,7 +3687,7 @@ sensor_video_probe_err: } static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { - struct i2c_client *client = sd->priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; struct sensor *sensor = to_sensor(client); int ret = 0; @@ -2923,12 +3708,17 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { sensor->sensor_io_request = (struct rk29camera_platform_data*)arg; if (sensor->sensor_io_request != NULL) { - if (sensor->sensor_io_request->gpio_res[0].dev_name && - (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) { - sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0]; - } else if (sensor->sensor_io_request->gpio_res[1].dev_name && - (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) { - sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1]; + sensor->sensor_gpio_res = NULL; + for (i=0; isensor_io_request->gpio_res[i].dev_name && + (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) { + sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i]; + } + } + if (sensor->sensor_gpio_res == NULL) { + SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__); + ret = -EINVAL; + goto sensor_ioctl_end; } } else { SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__); @@ -2942,11 +3732,18 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) { for (i = 0; i < icd->ops->num_controls; i++) { if (V4L2_CID_FLASH == icd->ops->controls[i].id) { - memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl)); + //memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl)); + sensor_controls[i].id=0xffff; } } sensor->info_priv.flash = 0xff; SENSOR_DG("%s flash gpio is invalidate!\n",SENSOR_NAME_STRING()); + }else{ //two cameras are the same,need to deal diffrently ,zyc + for (i = 0; i < icd->ops->num_controls; i++) { + if(0xffff == icd->ops->controls[i].id){ + sensor_controls[i].id=V4L2_CID_FLASH; + } + } } } #endif @@ -2962,14 +3759,14 @@ sensor_ioctl_end: return ret; } -static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index, - enum v4l2_mbus_pixelcode *code) -{ - if (index >= ARRAY_SIZE(sensor_colour_fmts)) - return -EINVAL; - - *code = sensor_colour_fmts[index].code; - return 0; +static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index, + enum v4l2_mbus_pixelcode *code) +{ + if (index >= ARRAY_SIZE(sensor_colour_fmts)) + return -EINVAL; + + *code = sensor_colour_fmts[index].code; + return 0; } static struct v4l2_subdev_core_ops sensor_subdev_core_ops = { .init = sensor_init, @@ -2981,11 +3778,11 @@ static struct v4l2_subdev_core_ops sensor_subdev_core_ops = { .ioctl = sensor_ioctl, }; -static struct v4l2_subdev_video_ops sensor_subdev_video_ops = { - .s_mbus_fmt = sensor_s_fmt, - .g_mbus_fmt = sensor_g_fmt, - .try_mbus_fmt = sensor_try_fmt, - .enum_mbus_fmt = sensor_enum_fmt, +static struct v4l2_subdev_video_ops sensor_subdev_video_ops = { + .s_mbus_fmt = sensor_s_fmt, + .g_mbus_fmt = sensor_g_fmt, + .try_mbus_fmt = sensor_try_fmt, + .enum_mbus_fmt = sensor_enum_fmt, }; static struct v4l2_subdev_ops sensor_subdev_ops = { @@ -3040,6 +3837,7 @@ static int sensor_probe(struct i2c_client *client, kfree(sensor); sensor = NULL; } + hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL); SENSOR_DG("\n%s..%s..%d ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret); return ret; } @@ -3088,4 +3886,4 @@ module_exit(sensor_mod_exit); MODULE_DESCRIPTION(SENSOR_NAME_STRING(Camera sensor driver)); MODULE_AUTHOR("ddl "); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL");