SHARE
TWEET

Untitled

a guest Aug 12th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. techmik@michaels-laptop:~$ diff ~/android/system/kernel/samsung/2.6.35/drivers/media/video/ce147.c ~/xcal/gb/drivers/media/video/ce147.c
  2. 2,5c2
  3. <  *  Driver for CE147 (5MP Camera) from NEC
  4. <  *
  5. <  * Copyright © 2010 Samsung Electronics
  6. <  * Copyright 2010 Kolja Dummann <k.dummann@gmail.com>
  7. ---
  8. >  * Driver for CE147 (5MP Camera) from NEC
  9. 15d11
  10. < #include <linux/version.h>
  11. 16a13,14
  12. > #include <linux/rtc.h>
  13. > #include <linux/completion.h>
  14. 18d15
  15. < #include <media/v4l2-subdev.h>
  16. 26,32c23
  17. < #include <linux/rtc.h>
  18. < #include <mach/gpio.h>
  19. < #include <plat/gpio-cfg.h>
  20. < #include <mach/regs-gpio.h>
  21. < #include <mach/regs-clock.h>
  22. <
  23. < //#define MDNIE_TUNING
  24. ---
  25. > /* #define MDNIE_TUNING */
  26. 34c25
  27. < #define CE147_DRIVER_NAME "CE147"
  28. ---
  29. > #define   CE147_DRIVER_NAME   "CE147"
  30. 36,37c27,28
  31. < #define FORMAT_FLAGS_COMPRESSED       0x3
  32. < #define SENSOR_JPEG_SNAPSHOT_MEMSIZE  0x360000
  33. ---
  34. > #define   FORMAT_FLAGS_COMPRESSED     0x3
  35. > #define   SENSOR_JPEG_SNAPSHOT_MEMSIZE    0x360000
  36. 39,41c30,31
  37. < //#define CE147_DEBUG
  38. < //#define CE147_INFO
  39. < #define CE147_CAM_POWER
  40. ---
  41. > /* #define CE147_DEBUG */
  42. > /* #define CE147_INFO */
  43. 44c34
  44. < #define ce147_msg dev_err
  45. ---
  46. > #define   ce147_msg   dev_err
  47. 46c36
  48. < #define ce147_msg     dev_dbg
  49. ---
  50. > #define   ce147_msg   dev_dbg
  51. 50c40
  52. < #define ce147_info    dev_err
  53. ---
  54. > #define   ce147_info  dev_err
  55. 52c42
  56. < #define ce147_info    dev_dbg
  57. ---
  58. > #define   ce147_info  dev_dbg
  59. 55,56d44
  60. < #define LOGV pr_warn
  61. <
  62. 58,60c46,48
  63. < #define DEFAULT_PIX_FMT       V4L2_PIX_FMT_UYVY   /* YUV422 */
  64. < #define DEFUALT_MCLK      24000000
  65. < #define POLL_TIME_MS      10
  66. ---
  67. > #define   DEFAULT_PIX_FMT     V4L2_PIX_FMT_UYVY   /* YUV422 */
  68. > #define   DEFUALT_MCLK        24000000
  69. > #define   POLL_TIME_MS        10
  70. 63,128c51,124
  71. < #define CMD_VERSION           0x00
  72. < #define DATA_VERSION_FW       0x00
  73. < #define DATA_VERSION_DATE 0x01
  74. < #define CMD_GET_BATCH_REFLECTION_STATUS   0x02
  75. < #define DATA_VERSION_SENSOR   0x03
  76. < #define CMD_HD_PREVIEW        0x03
  77. < #define CMD_SET_WB            0x04
  78. < #define DATA_VERSION_AF       0x05
  79. < #define CMD_SET_FLASH_MANUAL  0x06
  80. < #define CMD_SET_EXIF_CTRL     0x07//ykh
  81. < #define CMD_AE_WB_LOCK        0x11
  82. < #define CMD_SET_ANTI_BANDING  0x14
  83. < #define CMD_SET_WB_AUTO       0x1A
  84. < #define CMD_SET_AUTO_FOCUS_MODE 0x20
  85. < #define CMD_START_AUTO_FOCUS_SEARCH 0x23
  86. < #define CMD_CHECK_AUTO_FOCUS_SEARCH 0x24
  87. < #define CMD_STOP_LENS_MOVEMENT 0x35
  88. < #define CMD_SET_EFFECT        0x3D
  89. < #define CMD_SET_TOUCH_AUTO_FOCUS 0x4D
  90. < #define CMD_START_OT      0x50
  91. < #define CMD_CHECK_OT      0x51
  92. < #define CMD_PREVIEW_SIZE  0x54
  93. < #define CMD_FPS               0x5A
  94. < #define CMD_SET_ANTI_SHAKE    0x5B
  95. < #define CMD_SET_DATA      0x65
  96. < #define CMD_DATA_OUT_REQ  0x66
  97. < #define CMD_PREVIEW           0x6B
  98. < #define   CMD_PREVIEW_STATUS  0x6C
  99. < #define CMD_CAPTURE_SIZE  0x73
  100. < #define CMD_BUFFERING_CAPTURE 0x74
  101. < #define CMD_SET_SMART_AUTO  0x82
  102. < #define CMD_GET_SMART_AUTO_STATUS 0x83
  103. < #define CMD_SET_WDR           0x88
  104. < #define CMD_JPEG_SIZE     0x8E
  105. < #define CMD_JPEG_BUFFERING    0x8F
  106. < #define CMD_JPEG_CONFIG       0x90
  107. < #define CMD_JPEG_BUFFERING2       0x92//ykh
  108. < #define CMD_SET_FACE_DETECTION 0x9A
  109. < #define CMD_SET_FACE_LOCK     0x9C
  110. < #define CMD_INFO_EXIF     0xA0
  111. < #define CMD_INFO_MODEL        0xA1
  112. < #define CMD_INFO_ROT      0xA2
  113. < #define CMD_INFO_LONGITUDE_LATITUDE       0xA3
  114. < #define CMD_INFO_ALTITUDE     0xA4
  115. < #define CMD_SET_FLASH     0xB2
  116. < #define CMD_SET_DZOOM     0xB9
  117. < #define CMD_GET_DZOOM_LEVEL 0xBA
  118. < #define CMD_SET_EFFECT_SHOT 0xC0
  119. < #define DATA_VERSION_GAMMA    0x0E0
  120. < #define DATA_VERSION_SENSOR_MAKER 0xE0
  121. < #define CMD_CHECK_DATALINE    0xEC
  122. < #define CMD_INIT          0xF0
  123. < #define CMD_FW_INFO           0xF2
  124. < #define CMD_FWU_UPDATE        0xF3
  125. < #define CMD_FW_UPDATE     0xF4
  126. < #define CMD_FW_STATUS     0xF5
  127. < #define CMD_FW_DUMP           0xFB
  128. < #define CMD_GPS_TIMESTAMP     0xA7
  129. <
  130. < #define CE147_FW_F2_PATH  "/system/vendor/firmware/CE147F02.bin"
  131. <
  132. < static unsigned char  MAIN_SW_FW[4]           = {0x0, 0x0, 0x0, 0x0};/* {FW Maj, FW Min, PRM Maj, PRM Min} */
  133. < static int                MAIN_SW_DATE_INFO[3]    = {0x0, 0x0, 0x0};      /* {Year, Month, Date} */
  134. <
  135. < static unsigned char ce147_buf_set_dzoom[31] = {0xff,0xe7,0xd3,0xc2,0xb4,0xa7,0x9c,0x93,0x8b,0x83,0x7c,0x76,0x71,0x6c,0x67,0x63,0x5f,0x5b,0x58,0x55,0x52,0x4f,0x4d,0x4a,0x48,0x46,0x44,0x42,0x41,0x40,0x3f};
  136. < static int DZoom_State = 0;
  137. ---
  138. > #define   CMD_VERSION         0x00
  139. > #define   DATA_VERSION_FW         0x00
  140. > #define   DATA_VERSION_DATE       0x01
  141. > #define   CMD_GET_BATCH_REFLECTION_STATUS 0x02
  142. > #define   DATA_VERSION_SENSOR     0x03
  143. > #define   CMD_HD_PREVIEW          0x03
  144. > #define   CMD_SET_WB          0x04
  145. > #define   DATA_VERSION_AF         0x05
  146. > #define   CMD_SET_FLASH_MANUAL        0x06
  147. > #define   CMD_SET_EXIF_CTRL       0x07
  148. > #define   CMD_AE_WB_LOCK          0x11
  149. > #define   CMD_SET_ANTI_BANDING        0x14
  150. > #define   CMD_SET_WB_AUTO         0x1A
  151. > #define   CMD_SET_AUTO_FOCUS_MODE     0x20
  152. > #define   CMD_START_AUTO_FOCUS_SEARCH 0x23
  153. > #define   CMD_CHECK_AUTO_FOCUS_SEARCH 0x24
  154. > #define   CMD_STOP_LENS_MOVEMENT      0x35
  155. > #define   CMD_SET_EFFECT          0x3D
  156. > #define   CMD_SET_TOUCH_AUTO_FOCUS    0x4D
  157. > #define   CMD_START_OT            0x50
  158. > #define   CMD_CHECK_OT            0x51
  159. > #define   CMD_PREVIEW_SIZE        0x54
  160. > #define   CMD_FPS             0x5A
  161. > #define   CMD_SET_ANTI_SHAKE      0x5B
  162. > #define   CMD_SET_DATA            0x65
  163. > #define   CMD_DATA_OUT_REQ        0x66
  164. > #define   CMD_PREVIEW         0x6B
  165. > #define   CMD_PREVIEW_STATUS      0x6C
  166. > #define   CMD_CAPTURE_SIZE        0x73
  167. > #define   CMD_BUFFERING_CAPTURE       0x74
  168. > #define   CMD_SET_SMART_AUTO      0x82
  169. > #define   CMD_GET_SMART_AUTO_STATUS   0x83
  170. > #define   CMD_SET_WDR         0x88
  171. > #define   CMD_JPEG_SIZE           0x8E
  172. > #define   CMD_JPEG_BUFFERING      0x8F
  173. > #define   CMD_JPEG_CONFIG         0x90
  174. > #define   CMD_JPEG_BUFFERING2     0x92
  175. > #define   CMD_SET_FACE_DETECTION      0x9A
  176. > #define   CMD_SET_FACE_LOCK       0x9C
  177. > #define   CMD_INFO_EXIF           0xA0
  178. > #define   CMD_INFO_MODEL          0xA1
  179. > #define   CMD_INFO_ROT            0xA2
  180. > #define   CMD_INFO_LONGITUDE_LATITUDE 0xA3
  181. > #define   CMD_INFO_ALTITUDE       0xA4
  182. > #define   CMD_SET_FLASH           0xB2
  183. > #define   CMD_SET_DZOOM           0xB9
  184. > #define   CMD_GET_DZOOM_LEVEL     0xBA
  185. > #define   CMD_SET_EFFECT_SHOT     0xC0
  186. > #define   DATA_VERSION_GAMMA      0xE0
  187. > #define   DATA_VERSION_SENSOR_MAKER   0xE0
  188. > #define   CMD_CHECK_DATALINE      0xEC
  189. > #define   CMD_INIT            0xF0
  190. > #define   CMD_FW_INFO         0xF2
  191. > #define   CMD_FWU_UPDATE          0xF3
  192. > #define   CMD_FW_UPDATE           0xF4
  193. > #define   CMD_FW_STATUS           0xF5
  194. > #define   CMD_FW_DUMP         0xFB
  195. > #define   CMD_GPS_TIMESTAMP       0xA7
  196. >
  197. > #define   CE147_FW_F2_PATH    "/system/firmware/CE147F02.bin"
  198. > #define   FACTORY_CHECK
  199. >
  200. > /* { FW   Maj, FW Min, PRM Maj, PRM Min } */
  201. > static unsigned   char    MAIN_SW_FW[4]       = { 0x0, 0x0, 0x0, 0x0 };
  202. > /* { Year, Month, Date } */
  203. > static int        MAIN_SW_DATE_INFO[3]    = { 0x0, 0x0, 0x0 };
  204. >
  205. > static unsigned char ce147_buf_set_dzoom[31] = {
  206. >   0xff, 0xe7, 0xd3, 0xc2, 0xb4, 0xa7, 0x9c, 0x93, 0x8b, 0x83,
  207. >   0x7c, 0x76, 0x71, 0x6c, 0x67, 0x63, 0x5f, 0x5b, 0x58, 0x55,
  208. >   0x52, 0x4f, 0x4d, 0x4a, 0x48, 0x46, 0x44, 0x42, 0x41, 0x40,
  209. >   0x3f
  210. > };
  211. > static int DZoom_State;
  212. 137,144c133,155
  213. < static int ce147_set_iso(struct v4l2_subdev * sd, int iso);
  214. < static int ce147_set_metering(struct v4l2_subdev * sd, int metring);
  215. < static int ce147_set_ev(struct v4l2_subdev * sd, int ev);
  216. < static int ce147_set_slow_ae(struct v4l2_subdev * sd, int ae);
  217. < static int ce147_set_gamma(struct v4l2_subdev * sd, int gamma);
  218. < static int ce147_set_effect(struct v4l2_subdev * sd, int effect);
  219. < static int ce147_set_white_balance(struct v4l2_subdev * sd, int wb);
  220. < static int ce147_s_ext_ctrl(struct v4l2_subdev *sd, struct v4l2_ext_control *ctrl);
  221. ---
  222. > static int ce147_set_iso(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
  223. > static int ce147_set_metering(struct v4l2_subdev *sd,
  224. >               struct v4l2_control *ctrl);
  225. > static int ce147_set_ev(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
  226. > static int ce147_set_slow_ae(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
  227. > static int ce147_set_gamma(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
  228. > static int ce147_set_effect(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
  229. > static int ce147_set_white_balance(struct v4l2_subdev *sd,
  230. >               struct v4l2_control *ctrl);
  231. > static int ce147_s_ext_ctrl(struct v4l2_subdev *sd,
  232. >               struct v4l2_ext_control *ctrl);
  233. >
  234. > enum {
  235. >   AUTO_FOCUS_FAILED,
  236. >   AUTO_FOCUS_DONE,
  237. >   AUTO_FOCUS_CANCELLED,
  238. > };
  239. >
  240. > enum af_operation_status {
  241. >   AF_NONE = 0,
  242. >   AF_START,
  243. >   AF_CANCEL,
  244. > };
  245. 155,162c166,174
  246. <   CE147_CAPTURE_VGA, /* 640 x 480 */ 
  247. <   CE147_CAPTURE_WVGA, /* 800 x 480 */
  248. <   CE147_CAPTURE_W1MP, /* 1600 x 960 */
  249. <   CE147_CAPTURE_2MP, /* UXGA  - 1600 x 1200 */
  250. <   CE147_CAPTURE_W2MP, /* 35mm Academy Offset Standard 1.66  - 2048 x 1232, 2.4MP */  
  251. <   CE147_CAPTURE_3MP, /* QXGA  - 2048 x 1536 */
  252. <   CE147_CAPTURE_W4MP, /* WQXGA - 2560 x 1536 */
  253. <   CE147_CAPTURE_5MP, /* 2560 x 1920 */
  254. ---
  255. >   CE147_CAPTURE_VGA,  /* 640 x 480 */
  256. >   CE147_CAPTURE_WVGA, /* 800 x 480 */
  257. >   CE147_CAPTURE_W1MP, /* 1600 x 960 */
  258. >   CE147_CAPTURE_2MP,  /* UXGA  - 1600 x 1200 */
  259. >   CE147_CAPTURE_W2MP, /* 35mm Academy Offset Standard 1.66
  260. >                  - 2048 x 1232, 2.4MP */
  261. >   CE147_CAPTURE_3MP,  /* QXGA  - 2048 x 1536 */
  262. >   CE147_CAPTURE_W4MP, /* WQXGA - 2560 x 1536 */
  263. >   CE147_CAPTURE_5MP,  /* 2560 x 1920 */
  264. 166c178
  265. <   /* mode is 0 for preview, 1 for capture */
  266. ---
  267. >   /* mode is 0 for preview, 1 for capture */
  268. 170c182
  269. <   unsigned int height;   
  270. ---
  271. >   unsigned int height;
  272. 174,180c186,192
  273. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_QCIF,       176,  144 },
  274. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_QVGA,       320,  240 },
  275. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_592x480,    592,  480 },
  276. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_VGA,        640,  480 },
  277. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_D1,         720,  480 },
  278. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_WVGA,       800,  480 },
  279. <   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_720P,      1280,  720 },
  280. ---
  281. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_QCIF,   176,  144 },
  282. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_QVGA,   320,  240 },
  283. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_592x480,    592,  480 },
  284. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_VGA,    640,  480 },
  285. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_D1,     720,  480 },
  286. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_WVGA,   800,  480 },
  287. >   { CE147_OPRMODE_VIDEO, CE147_PREVIEW_720P,  1280,  720 },
  288. 182,189c194,201
  289. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_VGA,        640,  480 },
  290. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_WVGA,       800,  480 },
  291. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W1MP,      1600,  960 },
  292. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_2MP,       1600, 1200 },
  293. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W2MP,      2048, 1232 },
  294. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_3MP,       2048, 1536 },
  295. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W4MP,      2560, 1536 },
  296. <   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_5MP,       2560, 1920 },
  297. ---
  298. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_VGA,    640,  480 },
  299. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_WVGA,   800,  480 },
  300. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W1MP,  1600,  960 },
  301. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_2MP,   1600, 1200 },
  302. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W2MP,  2048, 1232 },
  303. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_3MP,   2048, 1536 },
  304. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_W4MP,  2560, 1536 },
  305. >   { CE147_OPRMODE_IMAGE, CE147_CAPTURE_5MP,   2560, 1920 },
  306. 205c217
  307. <   CE147_RUNMODE_IDLE,
  308. ---
  309. >   CE147_RUNMODE_IDLE,
  310. 207c219
  311. <   CE147_RUNMODE_RUNNING,
  312. ---
  313. >   CE147_RUNMODE_RUNNING,
  314. 233c245
  315. <   unsigned int main_size;  /* Main JPEG file size */
  316. ---
  317. >   unsigned int main_size;  /* Main JPEG file size */
  318. 238c250
  319. < } ;
  320. ---
  321. > } ;
  322. 243c255
  323. < } ;
  324. ---
  325. > } ;
  326. 245c257
  327. < struct ce147_gps_info{
  328. ---
  329. > struct ce147_gps_info {
  330. 248,249c260,261
  331. <   unsigned long gps_timeStamp;//ykh
  332. <   char gps_processingmethod[50];//ykh
  333. ---
  334. >   unsigned long gps_timeStamp;
  335. >   char gps_processingmethod[50];
  336. 252c264
  337. < struct ce147_sensor_maker{
  338. ---
  339. > struct ce147_sensor_maker {
  340. 257c269
  341. < struct ce147_version_af{
  342. ---
  343. > struct ce147_version_af {
  344. 262c274
  345. < struct ce147_gamma{
  346. ---
  347. > struct ce147_gamma {
  348. 266c278
  349. <   unsigned int bg_high;  
  350. ---
  351. >   unsigned int bg_high;
  352. 271,279c283,291
  353. <    int     tm_sec;         /* seconds */
  354. <    int     tm_min;         /* minutes */
  355. <    int     tm_hour;        /* hours */
  356. <    int     tm_mday;        /* day of the month */
  357. <    int     tm_mon;         /* month */
  358. <    int     tm_year;        /* year */
  359. <    int     tm_wday;        /* day of the week */
  360. <    int     tm_yday;        /* day in the year */
  361. <    int     tm_isdst;       /* daylight saving time */
  362. ---
  363. >    int       tm_sec;     /* seconds */
  364. >    int       tm_min;     /* minutes */
  365. >    int       tm_hour;    /* hours */
  366. >    int       tm_mday;    /* day of the month */
  367. >    int       tm_mon;     /* month */
  368. >    int       tm_year;    /* year */
  369. >    int       tm_wday;    /* day of the week */
  370. >    int       tm_yday;    /* day in the year */
  371. >    int       tm_isdst;       /* daylight saving time */
  372. 281,282c293,294
  373. <    long int tm_gmtoff;     /* Seconds east of UTC.  */
  374. <    const char *tm_zone;    /* Timezone abbreviation.  */
  375. ---
  376. >    long   int tm_gmtoff;     /* Seconds east of UTC. */
  377. >    const char *tm_zone;      /* Timezone abbreviation. */
  378. 287,288c299,300
  379. <   unsigned int    direction;
  380. <   unsigned int    dgree;
  381. ---
  382. >   unsigned int    direction;
  383. >   unsigned int    dgree;
  384. 305c317
  385. <   struct ce147_sensor_maker sensor_info; 
  386. ---
  387. >   struct ce147_sensor_maker sensor_info;
  388. 309a322,323
  389. >   struct mutex ctrl_lock;
  390. >   struct completion af_complete;
  391. 318c332
  392. <   int anti_banding;  
  393. ---
  394. >   int anti_banding;
  395. 322,323c336,337
  396. <   int pre_af_status;
  397. <   int cur_af_status;
  398. ---
  399. >   int pre_focus_mode;
  400. >   enum af_operation_status af_status;
  401. 337c351
  402. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  403. ---
  404. > #if defined(CONFIG_ARIES_NTT) /* Modify   NTTS1 */
  405. 340,341c354,355
  406. <   int exif_ctrl;//ykh
  407. <   int thumb_null;//ykh
  408. ---
  409. >   int exif_ctrl;
  410. >   int thumb_null;
  411. 344c358
  412. < static int condition = 0;
  413. ---
  414. > static int condition;
  415. 346,353c360,367
  416. < const static struct v4l2_fmtdesc capture_fmts[] = {
  417. <         {
  418. <                 .index          = 0,
  419. <                 .type           = V4L2_BUF_TYPE_VIDEO_CAPTURE,
  420. <                 .flags          = FORMAT_FLAGS_COMPRESSED,
  421. <                 .description    = "JPEG + Postview",
  422. <                 .pixelformat    = V4L2_PIX_FMT_JPEG,
  423. <         },
  424. ---
  425. > static const struct v4l2_fmtdesc capture_fmts[] = {
  426. >   {
  427. >       .index      = 0,
  428. >       .type       = V4L2_BUF_TYPE_VIDEO_CAPTURE,
  429. >       .flags      = FORMAT_FLAGS_COMPRESSED,
  430. >       .description    = "JPEG + Postview",
  431. >       .pixelformat    = V4L2_PIX_FMT_JPEG,
  432. >   },
  433. 361,362c375,376
  434. < /**
  435. <  * ce147_i2c_write_multi: Write (I2C) multiple bytes to the camera sensor
  436. ---
  437. > /**
  438. >  * ce147_i2c_write_multi: Write (I2C) multiple bytes to the camera sensor
  439. 370c384
  440. < static int ce147_i2c_write_multi(struct i2c_client *client, unsigned char cmd,
  441. ---
  442. > static int ce147_i2c_write_multi(struct i2c_client *client, unsigned char cmd,
  443. 374,375c388,389
  444. <   unsigned char buf[w_len+1];
  445. <   struct i2c_msg msg = {client->addr, 0, w_len+1, buf};
  446. ---
  447. >   unsigned char buf[w_len + 1];
  448. >   struct i2c_msg msg = { client->addr, 0, w_len + 1, buf };
  449. 380c394
  450. <   memcpy(buf+1, w_data, w_len);
  451. ---
  452. >   memcpy(buf + 1, w_data, w_len);
  453. 383,386c397,402
  454. <         int j;
  455. <   pr_err("W: ");
  456. <   for(j = 0; j <= w_len; j++){
  457. <       pr_err("0x%02x ", buf[j]);
  458. ---
  459. >   {
  460. >       int j;
  461. >       pr_debug("W: ");
  462. >       for (j = 0; j <= w_len; j++)
  463. >           pr_debug("0x%02x ", buf[j]);
  464. >       pr_debug("\n");
  465. 390,392c406,408
  466. <   while(retry_count--){
  467. <       ret  = i2c_transfer(client->adapter, &msg, 1);
  468. <       if(ret == 1)
  469. ---
  470. >   while (retry_count--) {
  471. >       ret = i2c_transfer(client->adapter, &msg, 1);
  472. >       if (ret == 1)
  473. 394d409
  474. <       pr_err("%s: comfail0r retry\n", __func__);
  475. 397,399d411
  476. <  
  477. <   if(ret != 1)
  478. <           pr_err("%s: i2c tranfer failed\n", __func__);
  479. 404,405c416,417
  480. < /**
  481. <  * ce147_i2c_read_multi: Read (I2C) multiple bytes to the camera sensor
  482. ---
  483. > /**
  484. >  * ce147_i2c_read_multi: Read (I2C) multiple bytes to the camera sensor
  485. 415,416c427,428
  486. < static int ce147_i2c_read_multi(struct i2c_client *client, unsigned char cmd,
  487. <       unsigned char *w_data, unsigned int w_len,
  488. ---
  489. > static int ce147_i2c_read_multi(struct i2c_client *client, unsigned char cmd,
  490. >       unsigned char *w_data, unsigned int w_len,
  491. 419,420c431,432
  492. <   unsigned char buf[w_len+1];
  493. <   struct i2c_msg msg = {client->addr, 0, w_len + 1, buf};
  494. ---
  495. >   unsigned char buf[w_len + 1];
  496. >   struct i2c_msg msg = { client->addr, 0, w_len + 1, buf };
  497. 425c437
  498. <   memcpy(buf+1, w_data, w_len);
  499. ---
  500. >   memcpy(buf + 1, w_data, w_len);
  501. 430,434c442,445
  502. <       printk("R: ");
  503. <       for(j = 0; j <= w_len; j++){
  504. <           printk("0x%02x ", buf[j]);
  505. <       }
  506. <       printk("\n");
  507. ---
  508. >       pr_debug("R: ");
  509. >       for (j = 0; j <= w_len; j++)
  510. >           pr_debug("0x%02x ", buf[j]);
  511. >       pr_debug("\n");
  512. 438c449
  513. <   while(retry_count--){
  514. ---
  515. >   while (retry_count--) {
  516. 440c451
  517. <       if(ret == 1)
  518. ---
  519. >       if (ret == 1)
  520. 445c456
  521. <   if(ret < 0)
  522. ---
  523. >   if (ret < 0)
  524. 449,450c460,461
  525. <   msg.len = r_len;
  526. <   msg.buf = r_data;
  527. ---
  528. >   msg.len = r_len;
  529. >   msg.buf = r_data;
  530. 453,455c464,466
  531. <   while(retry_count--){
  532. <       ret  = i2c_transfer(client->adapter, &msg, 1);
  533. <       if(ret == 1)
  534. ---
  535. >   while (retry_count--) {
  536. >       ret = i2c_transfer(client->adapter, &msg, 1);
  537. >       if (ret == 1)
  538. 463,465d473
  539. < #ifdef CE147_CAM_POWER
  540. <
  541. <
  542. 476c484
  543. <   pdata = client->dev.platform_data;
  544. ---
  545. >   pdata = client->dev.platform_data;
  546. 478,481c486,489
  547. <   if (pdata->cam_power) {
  548. <           pdata->cam_power(onoff);
  549. <           msleep(5);
  550. <   }
  551. ---
  552. >   if (onoff == 1)
  553. >       pdata->power_en(1);
  554. >   else
  555. >       pdata->power_en(0);
  556. 486,487d493
  557. < #endif //ifdef CE147_CAM_POWER
  558. <
  559. 490c496
  560. <  *  through the 'cmd' command register.
  561. ---
  562. >  *  through the 'cmd' command register.
  563. 495,496c501,502
  564. <  *    o 'timeout' (in ms) expires
  565. <  *    o the data read from device matches 'value'
  566. ---
  567. >  *    o 'timeout' (in ms) expires
  568. >  *    o the data read from device matches 'value'
  569. 502c508,509
  570. < static int ce147_waitfordone_timeout(struct i2c_client *client, unsigned char cmd, unsigned char value,
  571. ---
  572. > static int ce147_waitfordone_timeout(struct i2c_client *client,
  573. >                   unsigned char cmd, unsigned char value,
  574. 508c515,516
  575. <   unsigned long jiffies_timeout = jiffies_start + msecs_to_jiffies(timeout);
  576. ---
  577. >   unsigned long jiffies_timeout =
  578. >               jiffies_start + msecs_to_jiffies(timeout);
  579. 510c518
  580. <   if(polling_interval < 0)
  581. ---
  582. >   if (polling_interval < 0)
  583. 513c521
  584. <   while(time_before(jiffies, jiffies_timeout)){
  585. ---
  586. >   while (time_before(jiffies, jiffies_timeout)) {
  587. 515,516c523,525
  588. <       err = ce147_i2c_read_multi(client, cmd, NULL, 0, &cam_status, 1);
  589. <       if(err < 0)
  590. ---
  591. >       err = ce147_i2c_read_multi(client,
  592. >                       cmd, NULL, 0, &cam_status, 1);
  593. >       if (err < 0)
  594. 519c528,529
  595. <       ce147_msg(&client->dev, "Status check returns %02x\n", cam_status);
  596. ---
  597. >       ce147_msg(&client->dev, "Status check returns %02x\n",
  598. >               cam_status);
  599. 521c531
  600. <       if(cam_status == value)
  601. ---
  602. >       if (cam_status == value)
  603. 527c537
  604. <   if(cam_status != value)
  605. ---
  606. >   if (cam_status != value)
  607. 535c545
  608. <   int err;       
  609. ---
  610. >   int err;
  611. 539c549
  612. <   unsigned char ce147_buf_batch_data[1] = {0x00};
  613. ---
  614. >   unsigned char ce147_buf_batch_data[1] = { 0x00 };
  615. 543,544c553,555
  616. <   if(err < 0){
  617. <       dev_err(&client->dev, "%s: failed: i2c_write forget_batch_reflection_status\n", __func__);
  618. ---
  619. >   if (err < 0) {
  620. >       dev_err(&client->dev, "%s: failed: i2c_write "
  621. >               "forget_batch_reflection_status\n", __func__);
  622. 548,554c559,569
  623. <   //To Do: This code needs timeout API for do-while
  624. <   do
  625. <   {
  626. <       msleep(10);
  627. <         err = ce147_i2c_read_multi(client, CMD_GET_BATCH_REFLECTION_STATUS, NULL, 0, &ce147_batch_ref_status, 1);
  628. <       if(err < 0){
  629. <           dev_err(&client->dev, "%s: failed: i2c_read for get_batch_reflection_status\n", __func__);
  630. ---
  631. >   /* TODO: This code needs timeout API for do-while */
  632. >   do {
  633. >       msleep(10);
  634. >       err = ce147_i2c_read_multi(client,
  635. >           CMD_GET_BATCH_REFLECTION_STATUS, NULL, 0,
  636. >           &ce147_batch_ref_status, 1);
  637. >
  638. >       if (err < 0) {
  639. >           dev_err(&client->dev, "%s: failed: i2c_read "
  640. >                   "for get_batch_reflection_status\n",
  641. >                   __func__);
  642. 558c573
  643. <   } while(ce147_batch_ref_status && end_cnt < 200);
  644. ---
  645. >   } while (ce147_batch_ref_status && end_cnt < 200);
  646. 560,562c575,577
  647. <   if(end_cnt > 5)
  648. <   {
  649. <       ce147_msg(&client->dev, "%s: count(%d) status(%02x) \n", __func__, end_cnt, ce147_batch_ref_status);
  650. ---
  651. >   if (end_cnt > 5) {
  652. >       ce147_msg(&client->dev, "%s: count(%d) status(%02x)\n",
  653. >               __func__, end_cnt, ce147_batch_ref_status);
  654. 564,567c579,582
  655. <      
  656. <   if (ce147_batch_ref_status != 0x00)
  657. <   {
  658. <       dev_err(&client->dev, "%s: failed: to get_batch_reflection_status\n", __func__);
  659. ---
  660. >
  661. >   if (ce147_batch_ref_status != 0x00) {
  662. >       dev_err(&client->dev, "%s: failed: "
  663. >               "to get_batch_reflection_status\n", __func__);
  664. 578c593
  665. <   char*       buffer = NULL;
  666. ---
  667. >   char *buffer = NULL;
  668. 584,585d598
  669. <   //printk("ce147_read_main_SW_fw_version is called...\n");
  670. <
  671. 588,589c601
  672. <   if (filep && (filep != ERR_PTR(-ENOENT)))
  673. <   {
  674. ---
  675. >   if (filep && (filep != ERR_PTR(-ENOENT))) {
  676. 592c604
  677. <      
  678. ---
  679. >
  680. 595,597c607,609
  681. <      
  682. <       buffer = (char*)kmalloc(file_size+1, GFP_KERNEL);
  683. <      
  684. ---
  685. >
  686. >       buffer = kmalloc(file_size + 1, GFP_KERNEL);
  687. >
  688. 600c612
  689. <      
  690. ---
  691. >
  692. 605,608c617,618
  693. <       printk("File size : %d\n", file_size);
  694. <   }
  695. <   else
  696. <   {
  697. ---
  698. >       pr_debug("File size : %d\n", file_size);
  699. >   } else
  700. 610d619
  701. <   }
  702. 613c622
  703. <   *fwSize = file_size;
  704. ---
  705. >   *fwSize = file_size;
  706. 623c632
  707. <   char fw_data[20] = {0, };
  708. ---
  709. >   char fw_data[20] = { 0, };
  710. 632c641
  711. <   printk(KERN_DEBUG "ce147_get_main_sw_fw_version Enter \n");
  712. ---
  713. >   pr_debug("ce147_get_main_sw_fw_version Enter\n");
  714. 634,635c643,644
  715. <   if((MAIN_SW_DATE_INFO[0] == 0x00) && (MAIN_SW_DATE_INFO[1] == 0x00) && (MAIN_SW_DATE_INFO[2] == 0x00))
  716. <   {
  717. ---
  718. >   if ((MAIN_SW_DATE_INFO[0] == 0x00) && (MAIN_SW_DATE_INFO[1] == 0x00)
  719. >           && (MAIN_SW_DATE_INFO[2] == 0x00)) {
  720. 637,639c646,647
  721. <       if(err < 0)
  722. <       {
  723. <           printk("fail : read main_sw_version \n");
  724. ---
  725. >       if (err < 0) {
  726. >           pr_debug("fail : read main_sw_version\n");
  727. 644c652
  728. <       printk("fw_size : %d \n", fw_size);
  729. ---
  730. >       pr_debug("fw_size : %d\n", fw_size);
  731. 646,649c654,655
  732. <       for(i = 0; i < fw_size; i++)
  733. <       {
  734. <           printk("fw_data : %x \n", fw_data[i]);
  735. <       }
  736. ---
  737. >       for (i = 0; i < fw_size; i++)
  738. >           pr_debug("fw_data : %x\n", fw_data[i]);
  739. 652c658
  740. <       /* Main SW FW/PRM info */
  741. ---
  742. >       /* Main SW FW/PRM info */
  743. 654,656c660,662
  744. <       MAIN_SW_FW[1] = fw_data[main_sw_fw_prm_offset+1];
  745. <       MAIN_SW_FW[2] = fw_data[main_sw_fw_prm_offset+2];
  746. <       MAIN_SW_FW[3] = fw_data[main_sw_fw_prm_offset+3];
  747. ---
  748. >       MAIN_SW_FW[1] = fw_data[main_sw_fw_prm_offset + 1];
  749. >       MAIN_SW_FW[2] = fw_data[main_sw_fw_prm_offset + 2];
  750. >       MAIN_SW_FW[3] = fw_data[main_sw_fw_prm_offset + 3];
  751. 658c664
  752. <       /* Main SW Date info */
  753. ---
  754. >       /* Main SW Date info */
  755. 660,661c666,667
  756. <       MAIN_SW_DATE_INFO[1] = fw_data[main_sw_date_offset+1];
  757. <          MAIN_SW_DATE_INFO[2] = fw_data[main_sw_date_offset+2];
  758. ---
  759. >       MAIN_SW_DATE_INFO[1] = fw_data[main_sw_date_offset + 1];
  760. >       MAIN_SW_DATE_INFO[2] = fw_data[main_sw_date_offset + 2];
  761. 663,669c669,676
  762. <       printk(KERN_DEBUG "fw M:%d m:%d |prm M:%d m:%d \n", MAIN_SW_FW[0], MAIN_SW_FW[1], MAIN_SW_FW[2], MAIN_SW_FW[3]);
  763. <       printk(KERN_DEBUG "y. m. d = %d.%d.%d \n", MAIN_SW_DATE_INFO[0], MAIN_SW_DATE_INFO[1], MAIN_SW_DATE_INFO[2]);
  764. <   }
  765. <   else
  766. <   {
  767. <       printk(KERN_DEBUG "already read main sw version \n");
  768. <   }
  769. ---
  770. >       pr_debug("fw M:%d m:%d |prm M:%d m:%d\n",
  771. >               MAIN_SW_FW[0], MAIN_SW_FW[1],
  772. >               MAIN_SW_FW[2], MAIN_SW_FW[3]);
  773. >       pr_debug("y. m. d = %d.%d.%d\n",
  774. >               MAIN_SW_DATE_INFO[0], MAIN_SW_DATE_INFO[1],
  775. >               MAIN_SW_DATE_INFO[2]);
  776. >   } else
  777. >       pr_debug("already read main sw version\n");
  778. 677a685
  779. >
  780. 684c692
  781. <         struct ce147_state *state = to_state(sd);
  782. ---
  783. >   struct ce147_state *state = to_state(sd);
  784. 688,690c696,699
  785. <  
  786. <         /** Just before this function call, we enable the power and clock. Hence
  787. <    *  we need to wait for some time before we can start communicating with the sensor.
  788. ---
  789. >
  790. >   /* Just before this function call, we enable the power and clock. Hence
  791. >    * we need to wait for some time before we can start communicating
  792. >    * with the sensor.
  793. 692c701
  794. <         //msleep(10);
  795. ---
  796. >   msleep(10);
  797. 694,696c703,706
  798. <         err = ce147_i2c_write_multi(client, CMD_INIT, ce147_regbuf_init, ce147_reglen_init);
  799. <         if(err < 0)
  800. <                 return -EIO;
  801. ---
  802. >   err = ce147_i2c_write_multi(client, CMD_INIT,
  803. >                   ce147_regbuf_init, ce147_reglen_init);
  804. >   if (err < 0)
  805. >       return -EIO;
  806. 698,699c708,710
  807. <         /* At least 700ms delay required to load the firmware for ce147 camera ISP */
  808. <         msleep(700);
  809. ---
  810. >   /* At least 700ms delay required to load the firmware
  811. >    * for ce147 camera ISP */
  812. >   msleep(700);
  813. 707c718,719
  814. < static int ce147_get_version(struct v4l2_subdev *sd, int object_id, unsigned char version_info[])
  815. ---
  816. > static int ce147_get_version(struct v4l2_subdev *sd, int object_id,
  817. >               unsigned char version_info[])
  818. 710c722
  819. <   unsigned char cmd_buf[1] = {0x00};
  820. ---
  821. >   unsigned char cmd_buf[1] = { 0x00 };
  822. 714,716c726,727
  823. <  
  824. <   switch(object_id)
  825. <   {
  826. ---
  827. >
  828. >   switch (object_id) {
  829. 721c732
  830. <   case DATA_VERSION_AF:          
  831. ---
  832. >   case DATA_VERSION_AF:
  833. 728,730c739,742
  834. <         err = ce147_i2c_read_multi(client, CMD_VERSION, cmd_buf, cmd_len, version_info, info_len);
  835. <         if(err < 0)
  836. <                 return -EIO;
  837. ---
  838. >   err = ce147_i2c_read_multi(client, CMD_VERSION, cmd_buf, cmd_len,
  839. >                   version_info, info_len);
  840. >   if (err < 0)
  841. >       return -EIO;
  842. 737,738c749,750
  843. <     struct ce147_state *state = to_state(sd);
  844. <   unsigned char version_info[4] = {0x00, 0x00, 0x00, 0x00};
  845. ---
  846. >   struct ce147_state *state = to_state(sd);
  847. >   unsigned char version_info[4] = { 0x00, 0x00, 0x00, 0x00 };
  848. 743,744c755,756
  849. <   if(err < 0)
  850. <       return  err;
  851. ---
  852. >   if (err < 0)
  853. >       return err;
  854. 746,747c758,759
  855. <   state->fw.minor = version_info[0];
  856. <   state->fw.major = version_info[1];
  857. ---
  858. >   state->fw.minor = version_info[0];
  859. >   state->fw.major = version_info[1];
  860. 757,758c769,770
  861. <     struct ce147_state *state = to_state(sd);
  862. <   unsigned char version_info[4] = {0x00, 0x00, 0x00, 0x00};
  863. ---
  864. >   struct ce147_state *state = to_state(sd);
  865. >   unsigned char version_info[4] = { 0x00, 0x00, 0x00, 0x00 };
  866. 763,764c775,776
  867. <   if(err < 0)
  868. <       return  err;
  869. ---
  870. >   if (err < 0)
  871. >       return err;
  872. 775,776c787,788
  873. <     struct ce147_state *state = to_state(sd);
  874. <   unsigned char version_info[4] = {0x00, 0x00, 0x00, 0x00};
  875. ---
  876. >   struct ce147_state *state = to_state(sd);
  877. >   unsigned char version_info[4] = { 0x00, 0x00, 0x00, 0x00 };
  878. 781,782c793,794
  879. <   if(err < 0)
  880. <       return  err;
  881. ---
  882. >   if (err < 0)
  883. >       return err;
  884. 791,792c803,804
  885. <     struct ce147_state *state = to_state(sd);
  886. <   unsigned char version_info[4] = {0x00, 0x00, 0x00, 0x00};
  887. ---
  888. >   struct ce147_state *state = to_state(sd);
  889. >   unsigned char version_info[4] = { 0x00, 0x00, 0x00, 0x00 };
  890. 797,798c809,810
  891. <   if(err < 0)
  892. <       return  err;
  893. ---
  894. >   if (err < 0)
  895. >       return err;
  896. 808,809c820,821
  897. <     struct ce147_state *state = to_state(sd);
  898. <   unsigned char version_info[4] = {0x00, 0x00, 0x00, 0x00};
  899. ---
  900. >   struct ce147_state *state = to_state(sd);
  901. >   unsigned char version_info[4] = { 0x00, 0x00, 0x00, 0x00 };
  902. 814,815c826,827
  903. <   if(err < 0)
  904. <       return  err;
  905. ---
  906. >   if (err < 0)
  907. >       return err;
  908. 817c829,830
  909. <   //printk("ce147_get_af_version: data0: 0x%02x, data1: 0x%02x\n", version_info[0], version_info[1]);
  910. ---
  911. >   /* pr_debug("ce147_get_af_version: data0: 0x%02x, data1: 0x%02x\n",
  912. >           version_info[0], version_info[1]); */
  913. 828,830c841,843
  914. <     struct ce147_state *state = to_state(sd);
  915. <   unsigned char gamma_info[2] = {0x00, 0x00};
  916. <   unsigned int info_len = 2; 
  917. ---
  918. >   struct ce147_state *state = to_state(sd);
  919. >   unsigned char gamma_info[2] = { 0x00, 0x00 };
  920. >   unsigned int info_len = 2;
  921. 833,836c846,849
  922. <   unsigned char rg_low_buf[2] = {0x0C, 0x00};
  923. <   unsigned char rg_high_buf[2] = {0x0D, 0x00};
  924. <   unsigned char bg_low_buf[2] = {0x0E, 0x00};
  925. <   unsigned char bg_high_buf[2] = {0x0F, 0x00};   
  926. ---
  927. >   unsigned char rg_low_buf[2] = { 0x0C, 0x00 };
  928. >   unsigned char rg_high_buf[2] = { 0x0D, 0x00 };
  929. >   unsigned char bg_low_buf[2] = { 0x0E, 0x00 };
  930. >   unsigned char bg_high_buf[2] = { 0x0F, 0x00 };
  931. 840,842c853,856
  932. <     err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA, rg_low_buf, buf_len, gamma_info, info_len);
  933. <     if(err < 0)
  934. <             return -EIO; 
  935. ---
  936. >   err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA,
  937. >               rg_low_buf, buf_len, gamma_info, info_len);
  938. >   if (err < 0)
  939. >       return -EIO;
  940. 845c859,860
  941. <   //printk("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n", gamma_info[0], gamma_info[1]);    
  942. ---
  943. >   /* pr_debug("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n",
  944. >           gamma_info[0], gamma_info[1]); */
  945. 847,849c862,865
  946. <     err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA, rg_high_buf, buf_len, gamma_info, info_len);
  947. <     if(err < 0)
  948. <             return -EIO; 
  949. ---
  950. >   err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA,
  951. >           rg_high_buf, buf_len, gamma_info, info_len);
  952. >   if (err < 0)
  953. >       return -EIO;
  954. 852c868,874
  955. <   //printk("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n", gamma_info[0], gamma_info[1]);
  956. ---
  957. >   /* pr_debug("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n",
  958. >           gamma_info[0], gamma_info[1]); */
  959. >
  960. >   err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA,
  961. >           bg_low_buf, buf_len, gamma_info, info_len);
  962. >   if (err < 0)
  963. >       return -EIO;
  964. 854,857d875
  965. <     err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA, bg_low_buf, buf_len, gamma_info, info_len);
  966. <     if(err < 0)
  967. <             return -EIO; 
  968. <  
  969. 859c877,878
  970. <   //printk("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n", gamma_info[0], gamma_info[1]);
  971. ---
  972. >   /* pr_debug("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n",
  973. >           gamma_info[0], gamma_info[1]); */
  974. 861,863c880,883
  975. <     err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA, bg_high_buf, buf_len, gamma_info, info_len);
  976. <     if(err < 0)
  977. <             return -EIO;     
  978. ---
  979. >   err = ce147_i2c_read_multi(client, DATA_VERSION_GAMMA,
  980. >           bg_high_buf, buf_len, gamma_info, info_len);
  981. >   if (err < 0)
  982. >       return -EIO;
  983. 865,866c885,887
  984. <   state->gamma.bg_high= gamma_info[1];
  985. <   //printk("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n", gamma_info[0], gamma_info[1]);
  986. ---
  987. >   state->gamma.bg_high = gamma_info[1];
  988. >   /* pr_debug("ce147_get_gamma_version1: data1: 0x%02x, data1: 0x%02x\n",
  989. >           gamma_info[0], gamma_info[1]); */
  990. 871c892
  991. < #ifndef MDNIE_TUNING
  992. ---
  993. > #ifndef   MDNIE_TUNING
  994. 875c896
  995. <     struct ce147_state *state = to_state(sd);
  996. ---
  997. >   struct ce147_state *state = to_state(sd);
  998. 883c904
  999. <   const unsigned int packet_size = 129; //Data 128 + Checksum 1
  1000. ---
  1001. >   const unsigned int packet_size = 129; /* Data 128 + Checksum 1 */
  1002. 889c910,911
  1003. <   //dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n", __func__, (void*)state->fw_info.addr, state->fw_info.size);
  1004. ---
  1005. >   /* dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n",
  1006. >       __func__, (void*)state->fw_info.addr, state->fw_info.size); */
  1007. 893c915
  1008. <   if(NULL == mbuf){
  1009. ---
  1010. >   if (NULL == mbuf)
  1011. 895d916
  1012. <   }
  1013. 897c918,919
  1014. <   if (copy_from_user(mbuf, (void*)state->fw_info.addr, state->fw_info.size)){
  1015. ---
  1016. >   if (copy_from_user(mbuf, (void *)state->fw_info.addr,
  1017. >               state->fw_info.size)) {
  1018. 902,906c924,931
  1019. <   /** The firmware buffer is now copied to mbuf, so the firmware code is now in mbuf.
  1020. <    *  We can use mbuf with i2c_tranfer call  */
  1021. <   for(i = 0; i < 4; i++){
  1022. <       if(index > state->fw_info.size - 4){
  1023. <           dev_err(&client->dev, "%s:Error size parameter\n", __func__);
  1024. ---
  1025. >   /* The firmware buffer is now copied to mbuf,
  1026. >    * so the firmware code is now in mbuf.
  1027. >    * We can use mbuf with i2c_tranfer call
  1028. >    */
  1029. >   for (i = 0; i < 4; i++) {
  1030. >       if (index > state->fw_info.size - 4) {
  1031. >           dev_err(&client->dev, "%s:Error size parameter\n",
  1032. >                   __func__);
  1033. 909c934
  1034. <       memcpy(fw_size+i, mbuf + index, 4);
  1035. ---
  1036. >       memcpy(fw_size + i, mbuf + index, 4);
  1037. 912,913c937,939
  1038. <       index += ((fw_size[i]-1) & (~0x3)) + 4;
  1039. <       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n", __func__, i, fw_size[i], fw_buf[i]);
  1040. ---
  1041. >       index += ((fw_size[i] - 1) & (~0x3)) + 4;
  1042. >       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n",
  1043. >               __func__, i, fw_size[i], fw_buf[i]);
  1044. 916,918c942,945
  1045. <   err = ce147_power_en(1,sd);
  1046. <     if(err < 0){ 
  1047. <           dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n", __func__);
  1048. ---
  1049. >   err = ce147_power_en(1, sd);
  1050. >   if (err < 0) {
  1051. >       dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n",
  1052. >               __func__);
  1053. 921c948
  1054. <     }
  1055. ---
  1056. >   }
  1057. 925,928c952,958
  1058. <   // [1] set fw updater info
  1059. <     err = ce147_i2c_write_multi(client, CMD_FW_INFO, fw_buf[0], 4);
  1060. <     if(err < 0){ 
  1061. <       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, fw_size[0]: %d, fw_buf[0]: 0x%02x\n", __func__, fw_size[0], (unsigned int)(fw_buf[0]));
  1062. ---
  1063. >   /* [1] set fw updater info */
  1064. >   err = ce147_i2c_write_multi(client, CMD_FW_INFO, fw_buf[0], 4);
  1065. >   if (err < 0) {
  1066. >       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, "
  1067. >               "fw_size[0]: %d, fw_buf[0]: 0x%02x\n",
  1068. >               __func__, fw_size[0],
  1069. >               (unsigned int)(fw_buf[0]));
  1070. 931,932c961,962
  1071. <     }
  1072. <     msleep(100);
  1073. ---
  1074. >   }
  1075. >   msleep(100);
  1076. 934c964,966
  1077. <   //printk("ce147_update_fw: i2c_write for 0xf2, fw_size[0]: %d, fw_buf[0]: 0x%02x\n", fw_size[0], fw_buf[0]);
  1078. ---
  1079. >   /* pr_debug("ce147_update_fw: i2c_write for 0xf2, "
  1080. >           "fw_size[0]: %d, fw_buf[0]: 0x%02x\n",
  1081. >           fw_size[0], fw_buf[0]); */
  1082. 938,939c970,971
  1083. <   // [2] update firmware
  1084. <   for (k = 0; k < packet_num; k++){  
  1085. ---
  1086. >   /* [2] update firmware */
  1087. >   for (k = 0; k < packet_num; k++) {
  1088. 941,943c973,977
  1089. <         err = ce147_i2c_read_multi(client, CMD_FWU_UPDATE, data, packet_size, &res, 1);
  1090. <         if(err < 0){
  1091. <               dev_err(&client->dev, "%s: fail: i2c_read for 0xf3, data: 0x%02x\n", __func__, data[0]);
  1092. ---
  1093. >       err = ce147_i2c_read_multi(client, CMD_FWU_UPDATE,
  1094. >               data, packet_size, &res, 1);
  1095. >       if (err < 0) {
  1096. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xf3, "
  1097. >                   "data: 0x%02x\n", __func__, data[0]);
  1098. 946c980
  1099. <         }
  1100. ---
  1101. >       }
  1102. 948,949c982,984
  1103. <       j = j + 129;
  1104. <       //printk("ce147_update_fw: i2c_read for 0xf3, data: 0x%02x, count: %d\n", data[0], k);     
  1105. ---
  1106. >       j += 129;
  1107. >       /* pr_debug("ce147_update_fw: i2c_read for 0xf3, "
  1108. >               "data: 0x%02x, count: %d\n", data[0], k); */
  1109. 953c988
  1110. <   // [3] get fw status
  1111. ---
  1112. >   /* [3] get fw status */
  1113. 956,959c991,996
  1114. <                  
  1115. <       err = ce147_i2c_read_multi(client, CMD_FW_STATUS, NULL, 0, &res, 1);
  1116. <           if(err < 0){
  1117. <                   dev_err(&client->dev, "%s: fail: i2c_read for 0xf5", __func__);            
  1118. ---
  1119. >
  1120. >       err = ce147_i2c_read_multi(client, CMD_FW_STATUS, NULL, 0,
  1121. >               &res, 1);
  1122. >       if (err < 0) {
  1123. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xf5",
  1124. >                   __func__);
  1125. 962,963c999,1001
  1126. <         }
  1127. <       //printk("ce147_update_fw: i2c_read for 0xf5, data: 0x%02x\n", res);   
  1128. ---
  1129. >       }
  1130. >       /* pr_debug("ce147_update_fw: i2c_read for 0xf5, "
  1131. >               "data: 0x%02x\n", res); */
  1132. 966,967c1004,1006
  1133. <       if(k == 500) break;
  1134. <   } while(res != 0x05);
  1135. ---
  1136. >       if (k == 500)
  1137. >           break;
  1138. >   } while (res != 0x05);
  1139. 973c1012
  1140. <   // [4] set fw updater info
  1141. ---
  1142. >   /* [4] set fw updater info */
  1143. 975,976c1014,1018
  1144. <   if(err < 0){
  1145. <       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, fw_size[2]: %d, fw_buf[2]: 0x%02x\n", __func__, fw_size[2], (unsigned int)(fw_buf[2]));
  1146. ---
  1147. >   if (err < 0) {
  1148. >       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, "
  1149. >               "fw_size[2]: %d, fw_buf[2]: 0x%02x\n",
  1150. >               __func__, fw_size[2],
  1151. >               (unsigned int)(fw_buf[2]));
  1152. 982c1024,1025
  1153. <   //printk("ce147_update_fw: i2c_write for 0xf2, fw_size[2]: %d, fw_buf[2]: 0x%02x\n", fw_size[2], fw_buf[2]);   
  1154. ---
  1155. >   /* pr_debug("ce147_update_fw: i2c_write for 0xf2, fw_size[2]: %d,
  1156. >      fw_buf[2]: 0x%02x\n", fw_size[2], fw_buf[2]); */
  1157. 984c1027
  1158. <   packet_num = *(fw_buf[2]) + (*(fw_buf[2]+1)<<8);
  1159. ---
  1160. >   packet_num = *(fw_buf[2]) + (*(fw_buf[2] + 1) << 8);
  1161. 986c1029
  1162. <   //printk("ce147_update_fw: packet_num: %d\n", packet_num);
  1163. ---
  1164. >   /* pr_debug("ce147_update_fw: packet_num: %d\n", packet_num); */
  1165. 989,995c1032,1041
  1166. <  
  1167. <   // [5] update firmware
  1168. <   for (l = 0; l < packet_num; l++){  
  1169. <       memcpy(&data2[0], fw_buf[3]+j, packet_size);
  1170. <       err = ce147_i2c_write_multi(client, CMD_FW_UPDATE, data2, packet_size);
  1171. <       if(err < 0){
  1172. <               dev_err(&client->dev, "%s: fail: i2c_read for 0xf4, data:2 0x%02x\n", __func__, data2[0]); 
  1173. ---
  1174. >
  1175. >   /* [5] update firmware */
  1176. >   for (l = 0; l < packet_num; l++) {
  1177. >       memcpy(&data2[0], fw_buf[3] + j, packet_size);
  1178. >       err = ce147_i2c_write_multi(client, CMD_FW_UPDATE,
  1179. >                       data2, packet_size);
  1180. >       if (err < 0) {
  1181. >               dev_err(&client->dev, "%s: fail: i2c_read "
  1182. >                       "for 0xf4, data:2 0x%02x\n",
  1183. >                           __func__, data2[0]);
  1184. 1000,1001c1046,1048
  1185. <       //printk("ce147_update_fw: i2c_write for 0xf4, data2: 0x%02x, count: %d\n", data2[0], l);
  1186. <      
  1187. ---
  1188. >       /* pr_debug("ce147_update_fw: i2c_write for 0xf4, "
  1189. >               "data2: 0x%02x, count: %d\n", data2[0], l); */
  1190. >
  1191. 1003c1050
  1192. <       j = j + 129;
  1193. ---
  1194. >       j += 129;
  1195. 1005c1052
  1196. <  
  1197. ---
  1198. >
  1199. 1007c1054
  1200. <   // [6] get fw status
  1201. ---
  1202. >   /* [6] get fw status */
  1203. 1009d1055
  1204. <      
  1205. 1011,1014c1057,1062
  1206. <                  
  1207. <       err = ce147_i2c_read_multi(client, CMD_FW_STATUS, NULL, 0, &res, 1);
  1208. <           if(err < 0){
  1209. <                   dev_err(&client->dev, "%s: fail: i2c_read for 0xf5", __func__);        
  1210. ---
  1211. >
  1212. >       err = ce147_i2c_read_multi(client, CMD_FW_STATUS,
  1213. >               NULL, 0, &res, 1);
  1214. >       if (err < 0) {
  1215. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xf5",
  1216. >                   __func__);
  1217. 1017,1018c1065,1067
  1218. <           }    
  1219. <       //printk("ce147_update_fw: i2c_read for 0xf5, data: 0x%02x\n", res);       
  1220. ---
  1221. >       }
  1222. >       /* pr_debug("ce147_update_fw: i2c_read for 0xf5, "
  1223. >               "data: 0x%02x\n", res); */
  1224. 1020,1022c1069,1072
  1225. <       l++;   
  1226. <       if(l == 500) break;
  1227. <   } while(res != 0x06);
  1228. ---
  1229. >       l++;
  1230. >       if (l == 500)
  1231. >           break;
  1232. >   } while (res != 0x06);
  1233. 1025,1030c1075,1081
  1234. <  
  1235. <   err = ce147_power_en(0,sd);
  1236. <     if(err < 0){ 
  1237. <           dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n", __func__);
  1238. <           return -EIO;
  1239. <     }
  1240. ---
  1241. >
  1242. >   err = ce147_power_en(0, sd);
  1243. >   if (err < 0) {
  1244. >       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n",
  1245. >                   __func__);
  1246. >       return -EIO;
  1247. >   }
  1248. 1033c1084
  1249. <  
  1250. ---
  1251. >
  1252. 1050c1101
  1253. <     struct ce147_state *state = to_state(sd);
  1254. ---
  1255. >   struct ce147_state *state = to_state(sd);
  1256. 1055c1106
  1257. <   int i = 0;
  1258. ---
  1259. >   int i = 0;
  1260. 1058c1109
  1261. <   const unsigned int packet_size = 129; //Data 128 + Checksum 1
  1262. ---
  1263. >   const unsigned int packet_size = 129; /* Data 128 + Checksum 1 */
  1264. 1064c1115,1117
  1265. <   //dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n", __func__, (void*)state->fw_info.addr, state->fw_info.size);
  1266. ---
  1267. >   /* dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n",
  1268. >           __func__, (void*)state->fw_info.addr,
  1269. >           state->fw_info.size); */
  1270. 1068c1121
  1271. <   if(NULL == mbuf){
  1272. ---
  1273. >   if (!mbuf)
  1274. 1070d1122
  1275. <   }
  1276. 1072c1124,1125
  1277. <   if (copy_from_user(mbuf, (void*)state->fw_info.addr, state->fw_info.size)){
  1278. ---
  1279. >   if (copy_from_user(mbuf, (void *)state->fw_info.addr,
  1280. >                   state->fw_info.size)) {
  1281. 1077,1081c1130,1136
  1282. <   /** The firmware buffer is now copied to mbuf, so the firmware code is now in mbuf.
  1283. <    *  We can use mbuf with i2c_tranfer call  */
  1284. <   for(i = 0; i < 4; i++){
  1285. <       if(index > state->fw_info.size - 4){
  1286. <           dev_err(&client->dev, "%s:Error size parameter\n", __func__);
  1287. ---
  1288. >   /* The firmware buffer is now copied to mbuf,
  1289. >    * so the firmware code is now in mbuf.
  1290. >    * We can use mbuf with i2c_tranfer call */
  1291. >   for (i = 0; i < 4; i++) {
  1292. >       if (index > state->fw_info.size - 4) {
  1293. >           dev_err(&client->dev, "%s:Error size parameter\n",
  1294. >                   __func__);
  1295. 1084c1139
  1296. <       memcpy(fw_size+i, mbuf + index, 4);
  1297. ---
  1298. >       memcpy(fw_size + i, mbuf + index, 4);
  1299. 1087,1088c1142,1144
  1300. <       index += ((fw_size[i]-1) & (~0x3)) + 4;
  1301. <       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n", __func__, i, fw_size[i], fw_buf[i]);
  1302. ---
  1303. >       index += ((fw_size[i] - 1) & (~0x3)) + 4;
  1304. >       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n",
  1305. >               __func__, i, fw_size[i], fw_buf[i]);
  1306. 1090c1146
  1307. <  
  1308. ---
  1309. >
  1310. 1092,1097d1147
  1311. <  
  1312. <   for(j = 0; j < fw_size[0]; j++){
  1313. <           printk("ce147_update_fw: , fw_size[0]: %d, test[0]: 0x%x\n", fw_size[0], test[0][j]);
  1314. <           test[0][j] = ((test[0][j]&0xff00)>>8)|((test[0][j]&0x00ff)<<8);
  1315. <           printk("ce147_update_fw: , test1[0]: 0x%x\n", test[0][j]);             
  1316. <       }
  1317. 1099,1100c1149,1158
  1318. <   /*for mdnie tuning*/
  1319. <  
  1320. ---
  1321. >   for (j = 0; j < fw_size[0]; j++) {
  1322. >       pr_debug("ce147_update_fw: , fw_size[0]: %d, test[0]: 0x%x\n",
  1323. >               fw_size[0], test[0][j]);
  1324. >       test[0][j] = ((test[0][j] & 0xff00) >> 8) |
  1325. >               ((test[0][j] & 0x00ff) << 8);
  1326. >       pr_debug("ce147_update_fw: , test1[0]: 0x%x\n", test[0][j]);
  1327. >   }
  1328. >
  1329. >   /* for mdnie tuning */
  1330. >
  1331. 1102,1103c1160,1161
  1332. <   //mDNIe_txtbuf_to_parsing_for_lightsensor();
  1333. <   //mDNIe_txtbuf_to_parsing_for_backlight();
  1334. ---
  1335. >   /* mDNIe_txtbuf_to_parsing_for_lightsensor(); */
  1336. >   /* mDNIe_txtbuf_to_parsing_for_backlight(); */
  1337. 1109d1166
  1338. <
  1339. 1113c1170
  1340. <     struct ce147_state *state = to_state(sd);
  1341. ---
  1342. >   struct ce147_state *state = to_state(sd);
  1343. 1121,1122c1178,1179
  1344. <   const unsigned int packet_size = 129; //Data 128 + Checksum 1
  1345. <   unsigned int packet_num, k, j = 0, l = 0;
  1346. ---
  1347. >   const unsigned int packet_size = 129; /* Data 128 + Checksum 1 */
  1348. >   unsigned int packet_num, k, j = 0, l = 0;
  1349. 1126,1128c1183,1185
  1350. <   unsigned char addr[4] = {0x03, 0x00, 0x00, 0x01};  
  1351. <   unsigned int addr_len = 4; 
  1352. <   unsigned char dump[1] = {0x00};
  1353. ---
  1354. >   unsigned char addr[4] = { 0x03, 0x00, 0x00, 0x01 };
  1355. >   unsigned int addr_len = 4;
  1356. >   unsigned char dump[1] = { 0x00 };
  1357. 1130c1187,1188
  1358. <   //dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n", __func__, (void*)state->fw_info.addr, state->fw_info.size);
  1359. ---
  1360. >   /* dev_err(&client->dev, "%s: ce147_fw: buf = 0x%p, len = %d\n",
  1361. >       __func__, (void*)state->fw_info.addr, state->fw_info.size); */
  1362. 1134c1192
  1363. <   if(NULL == mbuf){
  1364. ---
  1365. >   if (NULL == mbuf)
  1366. 1136d1193
  1367. <   }
  1368. 1138c1195,1196
  1369. <   if (copy_from_user(mbuf, (void*)state->fw_info.addr, state->fw_info.size)){
  1370. ---
  1371. >   if (copy_from_user(mbuf, (void *)state->fw_info.addr,
  1372. >                   state->fw_info.size)) {
  1373. 1143,1147c1201,1207
  1374. <   /** The firmware buffer is now copied to mbuf, so the firmware code is now in mbuf.
  1375. <    *  We can use mbuf with i2c_tranfer call  */
  1376. <   for(i = 0; i < 4; i++){
  1377. <       if(index > state->fw_info.size - 4){
  1378. <           dev_err(&client->dev, "%s:Error size parameter\n", __func__);
  1379. ---
  1380. >   /* The firmware buffer is now copied to mbuf,
  1381. >    * so the firmware code is now in mbuf.
  1382. >    * We can use mbuf with i2c_tranfer call */
  1383. >   for (i = 0; i < 4; i++) {
  1384. >       if (index > state->fw_info.size - 4) {
  1385. >           dev_err(&client->dev, "%s:Error size parameter\n",
  1386. >                   __func__);
  1387. 1153,1154c1213,1215
  1388. <       index += ((fw_size[i]-1) & (~0x3)) + 4;
  1389. <       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n", __func__, i, fw_size[i], fw_buf[i]);
  1390. ---
  1391. >       index += ((fw_size[i] - 1) & (~0x3)) + 4;
  1392. >       dev_err(&client->dev, "%s: [%d] fw_size = %d, fw_buf = 0x%p\n",
  1393. >               __func__, i, fw_size[i], fw_buf[i]);
  1394. 1158,1159c1219,1221
  1395. <     if(err < 0){ 
  1396. <           dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n", __func__);
  1397. ---
  1398. >   if (err < 0) {
  1399. >       dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n",
  1400. >               __func__);
  1401. 1162c1224
  1402. <     }
  1403. ---
  1404. >   }
  1405. 1166,1169c1228,1234
  1406. <   // [1] set fw updater info
  1407. <     err = ce147_i2c_write_multi(client, CMD_FW_INFO, fw_buf[0], 4);
  1408. <     if(err < 0){ 
  1409. <       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, fw_size[0]: %d, fw_buf[0]: 0x%02x\n", __func__, fw_size[0], (unsigned int)(fw_buf[0]));
  1410. ---
  1411. >   /* [1] set fw updater info */
  1412. >   err = ce147_i2c_write_multi(client, CMD_FW_INFO, fw_buf[0], 4);
  1413. >   if (err < 0) {
  1414. >       dev_err(&client->dev, "%s: failed: i2c_write for 0xf2, "
  1415. >               "fw_size[0]: %d, fw_buf[0]: 0x%02x\n",
  1416. >                   __func__, fw_size[0],
  1417. >                   (unsigned int)(fw_buf[0]));
  1418. 1172,1173c1237,1238
  1419. <     }
  1420. <     msleep(100);
  1421. ---
  1422. >   }
  1423. >   msleep(100);
  1424. 1175c1240,1241
  1425. <   //printk("ce147_update_fw: i2c_write for 0xf2, fw_size[0]: %d, fw_buf[0]: 0x%02x\n", fw_size[0], fw_buf[0]);
  1426. ---
  1427. >   /* pr_debug("ce147_update_fw: i2c_write for 0xf2, fw_size[0]: %d, "
  1428. >           "fw_buf[0]: 0x%02x\n", fw_size[0], fw_buf[0]); */
  1429. 1177c1243
  1430. <   packet_num = *(fw_buf[0]) + (*(fw_buf[0]+1)<<8);
  1431. ---
  1432. >   packet_num = *(fw_buf[0]) + (*(fw_buf[0] + 1) << 8);
  1433. 1179,1184c1245,1252
  1434. <   // [2] update firmware
  1435. <   for (k = 0; k < packet_num; k++){  
  1436. <       memcpy(&data[0], fw_buf[1]+j, packet_size);
  1437. <         err = ce147_i2c_read_multi(client, CMD_FWU_UPDATE, data, packet_size, &res, 1);
  1438. <         if(err < 0){
  1439. <               dev_err(&client->dev, "%s: fail: i2c_read for 0xf3, data: 0x%02x\n", __func__, data[0]);
  1440. ---
  1441. >   /* [2] update firmware */
  1442. >   for (k = 0; k < packet_num; k++) {
  1443. >       memcpy(&data[0], fw_buf[1] + j, packet_size);
  1444. >       err = ce147_i2c_read_multi(client, CMD_FWU_UPDATE,
  1445. >               data, packet_size, &res, 1);
  1446. >       if (err < 0) {
  1447. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xf3, "
  1448. >                   "data: 0x%02x\n", __func__, data[0]);
  1449. 1187c1255
  1450. <         }
  1451. ---
  1452. >       }
  1453. 1189,1190c1257,1259
  1454. <       j = j + 129;
  1455. <       //printk("ce147_update_fw: i2c_read for 0xf3, data: 0x%02x, count: %d\n", data[0], k);     
  1456. ---
  1457. >       j += 129;
  1458. >       /* pr_debug("ce147_update_fw: i2c_read for 0xf3, data: 0x%02x, "
  1459. >               "count: %d\n", data[0], k); */
  1460. 1194c1263
  1461. <   // [3] get fw status
  1462. ---
  1463. >   /* [3] get fw status */
  1464. 1197,1200c1266,1271
  1465. <                  
  1466. <       err = ce147_i2c_read_multi(client, CMD_FW_STATUS, NULL, 0, &res, 1);
  1467. <           if(err < 0){
  1468. <                   dev_err(&client->dev, "%s: fail: i2c_read for 0xf5", __func__);            
  1469. ---
  1470. >
  1471. >       err = ce147_i2c_read_multi(client, CMD_FW_STATUS, NULL, 0,
  1472. >                       &res, 1);
  1473. >       if (err < 0) {
  1474. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xf5",
  1475. >                   __func__);
  1476. 1203,1204c1274,1276
  1477. <         }
  1478. <       //printk("ce147_update_fw: i2c_read for 0xf5, data: 0x%02x\n", res);   
  1479. ---
  1480. >       }
  1481. >       /* pr_debug("ce147_update_fw: i2c_read for 0xf5, "
  1482. >               "data: 0x%02x\n", res); */
  1483. 1207,1208c1279,1281
  1484. <       if(k == 500) break;
  1485. <   } while(res != 0x05);
  1486. ---
  1487. >       if (k == 500)
  1488. >           break;
  1489. >   } while (res != 0x05);
  1490. 1212c1285
  1491. <   // [4] change from dump mode
  1492. ---
  1493. >   /* [4] change from dump mode */
  1494. 1214,1215c1287,1289
  1495. <   if(err < 0){
  1496. <           dev_err(&client->dev, "%s: failed: i2c_write for 0xfb, 0x00", __func__);
  1497. ---
  1498. >   if (err < 0) {
  1499. >       dev_err(&client->dev, "%s: failed: i2c_write for 0xfb, 0x00",
  1500. >               __func__);
  1501. 1223c1297
  1502. <   // [5] check fw mode is in dump mode
  1503. ---
  1504. >   /* [5] check fw mode is in dump mode */
  1505. 1225,1226c1299,1300
  1506. <   if(err < 0){
  1507. <           dev_err(&client->dev, "%s: fail: i2c_read for 0xfb", __func__);            
  1508. ---
  1509. >   if (err < 0) {
  1510. >       dev_err(&client->dev, "%s: fail: i2c_read for 0xfb", __func__);
  1511. 1229c1303
  1512. <   }
  1513. ---
  1514. >   }
  1515. 1231,1232c1305,1306
  1516. <   if(res != 1){
  1517. <       dev_err(&client->dev, "%s: fail: res is %x", __func__, res);    
  1518. ---
  1519. >   if (res != 1) {
  1520. >       dev_err(&client->dev, "%s: fail: res is %x", __func__, res);
  1521. 1235c1309
  1522. <   }  
  1523. ---
  1524. >   }
  1525. 1239c1313
  1526. <   // [6] set dump start address
  1527. ---
  1528. >   /* [6] set dump start address */
  1529. 1241,1242c1315,1317
  1530. <   if(err < 0){
  1531. <           dev_err(&client->dev, "%s: failed: i2c_write for 0xfb, 0x03", __func__);
  1532. ---
  1533. >   if (err < 0) {
  1534. >       dev_err(&client->dev, "%s: failed: i2c_write for 0xfb, 0x03",
  1535. >               __func__);
  1536. 1250,1251c1325,1327
  1537. <   packet_num = *(fw_buf[2]) + (*(fw_buf[2]+1)<<8);
  1538. <   //printk("ce147_update_fw: i2c_read for 0xfb, packet_num: %d\n", packet_num);  
  1539. ---
  1540. >   packet_num = *(fw_buf[2]) + (*(fw_buf[2] + 1) << 8);
  1541. >   /* pr_debug("ce147_update_fw: i2c_read for 0xfb, packet_num: %d\n",
  1542. >           packet_num); */
  1543. 1255,1259c1331,1337
  1544. <   // [7] dump firmware data
  1545. <   for (l = 0; l < packet_num; l++){  
  1546. <         err = ce147_i2c_read_multi(client, CMD_FW_DUMP, dump, 1, data2, packet_size+1);
  1547. <         if(err < 0){
  1548. <               dev_err(&client->dev, "%s: fail: i2c_read for 0xfb,0x04\n", __func__);
  1549. ---
  1550. >   /* [7] dump firmware data */
  1551. >   for (l = 0; l < packet_num; l++) {
  1552. >       err = ce147_i2c_read_multi(client, CMD_FW_DUMP, dump, 1,
  1553. >                       data2, packet_size + 1);
  1554. >       if (err < 0) {
  1555. >           dev_err(&client->dev, "%s: fail: i2c_read for 0xfb, "
  1556. >                   "0x04\n", __func__);
  1557. 1262,1264c1340,1342
  1558. <         }
  1559. <       memcpy(fw_buf[3]+j, &data2[0], packet_size - 1);
  1560. <      
  1561. ---
  1562. >       }
  1563. >       memcpy(fw_buf[3] + j, &data2[0], packet_size - 1);
  1564. >
  1565. 1266,1267c1344,1346
  1566. <       j = j + 129;
  1567. <       //printk("ce147_update_fw: i2c_read for 0xfb, count: %d\n", l);
  1568. ---
  1569. >       j += 129;
  1570. >       /* pr_debug("ce147_update_fw: i2c_read for 0xfb, count: %d\n",
  1571. >               l); */
  1572. 1272c1351,1352
  1573. <   if (copy_to_user((void *)(state->fw_info.addr), fw_buf[3], state->fw_dump_size))    {
  1574. ---
  1575. >   if (copy_to_user((void *)(state->fw_info.addr), fw_buf[3],
  1576. >               state->fw_dump_size)) {
  1577. 1276c1356
  1578. <  
  1579. ---
  1580. >
  1581. 1278c1358
  1582. <  
  1583. ---
  1584. >
  1585. 1280,1283c1360,1364
  1586. <     if(err < 0){ 
  1587. <           dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n", __func__);
  1588. <           return -EIO;
  1589. <     }
  1590. ---
  1591. >   if (err < 0) {
  1592. >       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n",
  1593. >               __func__);
  1594. >       return -EIO;
  1595. >   }
  1596. 1286c1367
  1597. <  
  1598. ---
  1599. >
  1600. 1302,1304c1383,1387
  1601. <   err = ce147_i2c_write_multi(client, CMD_CHECK_DATALINE, ce147_buf_check_dataline, ce147_len_check_dataline);
  1602. <   if(err < 0){
  1603. <       dev_err(&client->dev, "%s: failed: i2c_write for check_dataline\n", __func__);
  1604. ---
  1605. >   err = ce147_i2c_write_multi(client, CMD_CHECK_DATALINE,
  1606. >           ce147_buf_check_dataline, ce147_len_check_dataline);
  1607. >   if (err < 0) {
  1608. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  1609. >               "check_dataline\n", __func__);
  1610. 1321,1323c1404,1408
  1611. <   err = ce147_i2c_write_multi(client, CMD_CHECK_DATALINE, ce147_buf_check_dataline, ce147_len_check_dataline);
  1612. <   if(err < 0){
  1613. <       dev_err(&client->dev, "%s: failed: i2c_write for check_dataline stop\n", __func__);
  1614. ---
  1615. >   err = ce147_i2c_write_multi(client, CMD_CHECK_DATALINE,
  1616. >           ce147_buf_check_dataline, ce147_len_check_dataline);
  1617. >   if (err < 0) {
  1618. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  1619. >               "check_dataline stop\n", __func__);
  1620. 1338c1423,1424
  1621. <   unsigned char ce147_regbuf_preview_size[2] = { 0x04, 0x01 }; /* Default VGA resolution */
  1622. ---
  1623. >   /* Default VGA resolution = { 0x04, 0x01 } */
  1624. >   unsigned char ce147_regbuf_preview_size[2] = { 0x04, 0x01 };
  1625. 1345,1351c1431,1437
  1626. <   switch(index){
  1627. <       case CE147_PREVIEW_QCIF:
  1628. <           ce147_regbuf_preview_size[0] = 0x1E;
  1629. <           break;
  1630. <           case CE147_PREVIEW_QVGA:
  1631. <           ce147_regbuf_preview_size[0] = 0x02;
  1632. <           break;
  1633. ---
  1634. >   switch (index) {
  1635. >   case CE147_PREVIEW_QCIF:
  1636. >       ce147_regbuf_preview_size[0] = 0x1E;
  1637. >       break;
  1638. >   case CE147_PREVIEW_QVGA:
  1639. >       ce147_regbuf_preview_size[0] = 0x02;
  1640. >       break;
  1641. 1353,1355c1439,1441
  1642. <       case CE147_PREVIEW_592x480:
  1643. <           ce147_regbuf_preview_size[0] = 0x24;
  1644. <           break;
  1645. ---
  1646. >   case CE147_PREVIEW_592x480:
  1647. >       ce147_regbuf_preview_size[0] = 0x24;
  1648. >       break;
  1649. 1357,1378c1443,1465
  1650. <       case CE147_PREVIEW_VGA:
  1651. <           ce147_regbuf_preview_size[0] = 0x04;
  1652. <           break;
  1653. <       case CE147_PREVIEW_WVGA:
  1654. <           ce147_regbuf_preview_size[0] = 0x13;
  1655. <           break;
  1656. <       case CE147_PREVIEW_D1:
  1657. <           ce147_regbuf_preview_size[0] = 0x20;
  1658. <           break;
  1659. <           case CE147_PREVIEW_720P:
  1660. <           ce147_regbuf_preview_size[0] = 0x16;
  1661. <           ce147_regbuf_preview_size[1] = 0x02;
  1662. <           break;
  1663. <       case CE147_PREVIEW_VERTICAL_QCIF:
  1664. <           ce147_regbuf_preview_size[0] = 0x26;
  1665. <           break;
  1666. <       default:
  1667. <           /* When running in image capture mode, the call comes here.
  1668. <           * Set the default video resolution - CE147_PREVIEW_VGA
  1669. <           */
  1670. <           ce147_msg(&client->dev, "Setting preview resoution as VGA for image capture mode\n");
  1671. <           break;
  1672. ---
  1673. >   case CE147_PREVIEW_VGA:
  1674. >       ce147_regbuf_preview_size[0] = 0x04;
  1675. >       break;
  1676. >   case CE147_PREVIEW_WVGA:
  1677. >       ce147_regbuf_preview_size[0] = 0x13;
  1678. >       break;
  1679. >   case CE147_PREVIEW_D1:
  1680. >       ce147_regbuf_preview_size[0] = 0x20;
  1681. >       break;
  1682. >   case CE147_PREVIEW_720P:
  1683. >       ce147_regbuf_preview_size[0] = 0x16;
  1684. >       ce147_regbuf_preview_size[1] = 0x02;
  1685. >       break;
  1686. >   case CE147_PREVIEW_VERTICAL_QCIF:
  1687. >       ce147_regbuf_preview_size[0] = 0x26;
  1688. >       break;
  1689. >   default:
  1690. >       /* When running in image capture mode, the call comes here.
  1691. >        * Set the default video resolution - CE147_PREVIEW_VGA
  1692. >        */
  1693. >       ce147_msg(&client->dev, "Setting preview resoution as VGA "
  1694. >               "for image capture mode\n");
  1695. >       break;
  1696. 1381,1382c1468
  1697. <   if(index == CE147_PREVIEW_720P)
  1698. <   {
  1699. ---
  1700. >   if (index == CE147_PREVIEW_720P) {
  1701. 1384,1395c1470,1485
  1702. <       //state->hd_preview_on = 1;
  1703. <       //printk("[5B] ce147_set_preview_size: preview_size is HD (%d)\n", state->hd_preview_on);
  1704. <       err = ce147_i2c_write_multi(client, CMD_HD_PREVIEW, ce147_regbuf_hd_preview, ce147_reglen_hd_preview);
  1705. <       if(err < 0)
  1706. <             return -EIO;
  1707. <   }
  1708. <   else
  1709. <   {
  1710. <       //state->hd_preview_on = 0;
  1711. <       //printk("[5B] ce147_set_preview_size: preview_size is not HD (%d)\n", state->hd_preview_on);
  1712. <       err = ce147_i2c_write_multi(client, CMD_HD_PREVIEW, ce147_regbuf_hd_preview, ce147_reglen_hd_preview);
  1713. <       if(err < 0)
  1714. ---
  1715. >       state->hd_preview_on = 1;
  1716. >       pr_info("%s: preview_size is HD (%d)\n",
  1717. >               __func__, state->hd_preview_on);
  1718. >       err = ce147_i2c_write_multi(client, CMD_HD_PREVIEW,
  1719. >               ce147_regbuf_hd_preview,
  1720. >               ce147_reglen_hd_preview);
  1721. >       if (err < 0)
  1722. >           return -EIO;
  1723. >   } else {
  1724. >       state->hd_preview_on = 0;
  1725. >       pr_info("%s: preview_size is not HD (%d)\n",
  1726. >               __func__, state->hd_preview_on);
  1727. >       err = ce147_i2c_write_multi(client, CMD_HD_PREVIEW,
  1728. >               ce147_regbuf_hd_preview,
  1729. >               ce147_reglen_hd_preview);
  1730. >       if (err < 0)
  1731. 1400,1419c1490,1495
  1732. <     err = ce147_i2c_write_multi(client, CMD_PREVIEW_SIZE, ce147_regbuf_preview_size, ce147_reglen_preview_size);
  1733. <     if(err < 0)
  1734. <             return -EIO;
  1735. <
  1736. <   ce147_msg(&client->dev, "Done\n"); 
  1737. <
  1738. <   return err;
  1739. < }
  1740. < #if 0
  1741. < static int ce147_set_fps(struct v4l2_subdev *sd)
  1742. < {
  1743. <   int err;
  1744. <   struct i2c_client *client = v4l2_get_subdevdata(sd);
  1745. <   struct ce147_state *state = to_state(sd);
  1746. <   int ce147_reglen_fps = 2;
  1747. <   unsigned char ce147_regbuf_fps[2] = { 0x1E, 0x00 }; /* Default 30 fps */
  1748. <
  1749. <   if(state->fps <= 0 || state->fps > 30){
  1750. <       dev_err(&client->dev, "%s: Currently %d fps not supported.\n",__func__, state->fps);
  1751. <       return -EINVAL;
  1752. ---
  1753. >   err = ce147_i2c_write_multi(client, CMD_PREVIEW_SIZE,
  1754. >           ce147_regbuf_preview_size, ce147_reglen_preview_size);
  1755. >   if (err < 0) {
  1756. >       pr_info("%s: preview_size is not HD (%d)\n",
  1757. >               __func__, state->hd_preview_on);
  1758. >       return -EIO;
  1759. 1421,1426d1496
  1760. <  
  1761. <   ce147_regbuf_fps[0] = state->fps;
  1762. <
  1763. <         err = ce147_i2c_write_multi(client, CMD_FPS, ce147_regbuf_fps, ce147_reglen_fps);
  1764. <         if(err < 0)
  1765. <                 return -EIO;
  1766. 1428c1498
  1767. <   ce147_msg(&client->dev, "FPS = %d\n", state->fps);
  1768. ---
  1769. >   ce147_msg(&client->dev, "Done\n");
  1770. 1430c1500
  1771. <   return 0;
  1772. ---
  1773. >   return err;
  1774. 1432c1502
  1775. < #endif
  1776. ---
  1777. >
  1778. 1437c1507
  1779. <   struct ce147_state *state = to_state(sd);  
  1780. ---
  1781. >   struct ce147_state *state = to_state(sd);
  1782. 1440,1445c1510,1514
  1783. <   unsigned int ce147_reglen_fps = 2;
  1784. <  
  1785. <   switch(state->fps)
  1786. <   {
  1787. <       case FRAME_RATE_7:
  1788. <           ce147_regbuf_fps[0] = 0x07;
  1789. ---
  1790. >   unsigned int ce147_reglen_fps = 2;
  1791. >
  1792. >   switch (state->fps) {
  1793. >   case FRAME_RATE_7:
  1794. >       ce147_regbuf_fps[0] = 0x07;
  1795. 1448,1449c1517,1518
  1796. <       case FRAME_RATE_15:
  1797. <           ce147_regbuf_fps[0] = 0x0F;
  1798. ---
  1799. >   case FRAME_RATE_10:
  1800. >       ce147_regbuf_fps[0] = 0x0A;
  1801. 1452,1453c1521,1522
  1802. <       case FRAME_RATE_60:
  1803. <           ce147_regbuf_fps[0] = 0x3C;
  1804. ---
  1805. >   case FRAME_RATE_15:
  1806. >       ce147_regbuf_fps[0] = 0x0F;
  1807. 1456,1457c1525,1531
  1808. <       case FRAME_RATE_120:
  1809. <           ce147_regbuf_fps[0] = 0x78;
  1810. ---
  1811. >   case FRAME_RATE_20:
  1812. >       ce147_regbuf_fps[0] = 0x14;
  1813. >       break;
  1814. >
  1815. >   case FRAME_RATE_30:
  1816. >       ce147_regbuf_fps[0] = 0x1E;
  1817. >       break;
  1818. 1459,1461c1533,1535
  1819. <       case FRAME_RATE_30:
  1820. <       default:
  1821. <           ce147_regbuf_fps[0] = 0x1E;
  1822. ---
  1823. >   case FRAME_RATE_60:
  1824. >       ce147_regbuf_fps[0] = 0x3C;
  1825. >       break;
  1826. 1462a1537,1538
  1827. >   case FRAME_RATE_120:
  1828. >       ce147_regbuf_fps[0] = 0x78;
  1829. 1463a1540,1542
  1830. >
  1831. >   default:       
  1832. >       return -EINVAL;
  1833. 1466,1468c1545,1549
  1834. <   err = ce147_i2c_write_multi(client, CMD_FPS, ce147_regbuf_fps, ce147_reglen_fps);
  1835. <   if(err < 0){
  1836. <       dev_err(&client->dev, "%s: failed: i2c_write for set_frame_rate\n", __func__);
  1837. ---
  1838. >   err = ce147_i2c_write_multi(client, CMD_FPS, ce147_regbuf_fps,
  1839. >                   ce147_reglen_fps);
  1840. >   if (err < 0) {
  1841. >       dev_err(&client->dev, "%s: failed: i2c_write "
  1842. >               "for set_frame_rate\n", __func__);
  1843. 1471c1552
  1844. < #if 0 //remove batch 
  1845. ---
  1846. > #if 0 /* remove   batch */
  1847. 1473,1475c1554,1557
  1848. <   if(err < 0){
  1849. <       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_frame_rate\n", __func__);
  1850. <       return -EIO;
  1851. ---
  1852. >   if (err < 0) {
  1853. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection"
  1854. >               "_status for set_frame_rate\n", __func__);
  1855. >       return -EIO;
  1856. 1487c1569
  1857. <   struct ce147_state *state = to_state(sd);  
  1858. ---
  1859. >   struct ce147_state *state = to_state(sd);
  1860. 1492,1495c1574,1576
  1861. <   switch(state->anti_banding)
  1862. <   {
  1863. <       case ANTI_BANDING_OFF:
  1864. <           ce147_regbuf_anti_banding[0] = 0x00;
  1865. ---
  1866. >   switch (state->anti_banding) {
  1867. >   case ANTI_BANDING_OFF:
  1868. >       ce147_regbuf_anti_banding[0] = 0x00;
  1869. 1498,1499c1579,1580
  1870. <       case ANTI_BANDING_AUTO:
  1871. <           ce147_regbuf_anti_banding[0] = 0x01;
  1872. ---
  1873. >   case ANTI_BANDING_AUTO:
  1874. >       ce147_regbuf_anti_banding[0] = 0x01;
  1875. 1502,1503c1583,1584
  1876. <       case ANTI_BANDING_50HZ:
  1877. <           ce147_regbuf_anti_banding[0] = 0x02;
  1878. ---
  1879. >   case ANTI_BANDING_50HZ:
  1880. >       ce147_regbuf_anti_banding[0] = 0x02;
  1881. 1506,1508c1587,1589
  1882. <       case ANTI_BANDING_60HZ:
  1883. <       default:
  1884. <           ce147_regbuf_anti_banding[0] = 0x03;
  1885. ---
  1886. >   case ANTI_BANDING_60HZ:
  1887. >   default:
  1888. >       ce147_regbuf_anti_banding[0] = 0x03;
  1889. 1512,1514c1593,1597
  1890. <   err = ce147_i2c_write_multi(client, CMD_SET_ANTI_BANDING, ce147_regbuf_anti_banding, ce147_reglen_anti_banding);
  1891. <   if(err < 0){
  1892. <       dev_err(&client->dev, "%s: failed: i2c_write for anti_banding\n", __func__);
  1893. ---
  1894. >   err = ce147_i2c_write_multi(client, CMD_SET_ANTI_BANDING,
  1895. >           ce147_regbuf_anti_banding, ce147_reglen_anti_banding);
  1896. >   if (err < 0) {
  1897. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  1898. >               "anti_banding\n", __func__);
  1899. 1531c1614
  1900. <   //printk("[5B] ce147_set_preview_stop: (%d)\n", state->runmode);
  1901. ---
  1902. >   /* pr_debug("%s: (%d)\n", __func__, state->runmode); */
  1903. 1533,1536c1616,1622
  1904. <   if(CE147_RUNMODE_RUNNING == state->runmode){
  1905. <       err = ce147_i2c_write_multi(client, CMD_PREVIEW, ce147_regbuf_preview_stop, ce147_reglen_preview);
  1906. <       if(err < 0){
  1907. <           dev_err(&client->dev, "%s: failed: i2c_write for preview_stop\n", __func__);
  1908. ---
  1909. >   if (CE147_RUNMODE_RUNNING == state->runmode) {
  1910. >       err = ce147_i2c_write_multi(client, CMD_PREVIEW,
  1911. >               ce147_regbuf_preview_stop,
  1912. >               ce147_reglen_preview);
  1913. >       if (err < 0) {
  1914. >           dev_err(&client->dev, "%s: failed: i2c_write "
  1915. >                   "for preview_stop\n", __func__);
  1916. 1540,1542c1626,1630
  1917. <       err = ce147_waitfordone_timeout(client, CMD_PREVIEW_STATUS, 0x00, 3000, POLL_TIME_MS);
  1918. <       if(err < 0){
  1919. <           dev_err(&client->dev, "%s: Wait for preview_stop failed\n", __func__ );
  1920. ---
  1921. >       err = ce147_waitfordone_timeout(client, CMD_PREVIEW_STATUS,
  1922. >                       0x00, 3000, POLL_TIME_MS);
  1923. >       if (err < 0) {
  1924. >           dev_err(&client->dev, "%s: Wait for preview_stop "
  1925. >                   "failed\n", __func__);
  1926. 1545c1633,1634
  1927. <       ce147_msg(&client->dev, "%s: preview_stop - wait time %d ms\n", __func__, err);
  1928. ---
  1929. >       ce147_msg(&client->dev, "%s: preview_stop - wait time %d ms\n",
  1930. >               __func__, err);
  1931. 1561,1565c1650,1656
  1932. <  
  1933. <   if(CE147_RUNMODE_RUNNING == state->runmode){
  1934. <       err = ce147_i2c_write_multi(client, CMD_SET_DZOOM, &ce147_buf_set_dzoom[ctrl->value], 1);
  1935. <       if(err < 0){
  1936. <           dev_err(&client->dev, "%s: failed: i2c_write for set_dzoom\n", __func__);
  1937. ---
  1938. >
  1939. >   if (CE147_RUNMODE_RUNNING == state->runmode) {
  1940. >       err = ce147_i2c_write_multi(client, CMD_SET_DZOOM,
  1941. >               &ce147_buf_set_dzoom[ctrl->value], 1);
  1942. >       if (err < 0) {
  1943. >           dev_err(&client->dev, "%s: failed: i2c_write "
  1944. >                   "for set_dzoom\n", __func__);
  1945. 1569,1574c1660,1669
  1946. <       //To Do: This code needs to use ce147_waitfordone_timeout() API
  1947. <       for(count = 0; count < 300; count++)
  1948. <       {
  1949. <           err = ce147_i2c_read_multi(client, CMD_GET_DZOOM_LEVEL, NULL, 0, ce147_buf_get_dzoom_status, ce147_len_get_dzoom_status);
  1950. <           if(err < 0){
  1951. <               dev_err(&client->dev, "%s: failed: i2c_read for set_dzoom\n", __func__);
  1952. ---
  1953. >       /* TODO: This code needs to use
  1954. >        * ce147_waitfordone_timeout() API
  1955. >        */
  1956. >       for (count = 0; count < 300; count++) {
  1957. >           err = ce147_i2c_read_multi(client, CMD_GET_DZOOM_LEVEL,
  1958. >                   NULL, 0, ce147_buf_get_dzoom_status,
  1959. >                   ce147_len_get_dzoom_status);
  1960. >           if (err < 0) {
  1961. >               dev_err(&client->dev, "%s: failed: i2c_read "
  1962. >                       "for set_dzoom\n", __func__);
  1963. 1577c1672,1673
  1964. <           if(ce147_buf_get_dzoom_status[1] == 0x00) break;
  1965. ---
  1966. >           if (ce147_buf_get_dzoom_status[1] == 0x00)
  1967. >               break;
  1968. 1599c1695
  1969. <   unsigned int ce147_len_get_dzoom_status = 2;   
  1970. ---
  1971. >   unsigned int ce147_len_get_dzoom_status = 2;
  1972. 1601c1697
  1973. <   if( !state->pix.width || !state->pix.height || !state->fps){
  1974. ---
  1975. >   if (!state->pix.width || !state->pix.height || !state->fps)
  1976. 1603d1698
  1977. <   }
  1978. 1605,1608c1700,1701
  1979. <   //This is for 15 testmode
  1980. <   if(state->check_dataline)
  1981. <   {
  1982. <       LOGV("%s state->check_dataline = 1", __func__);
  1983. ---
  1984. >   /* This is for 15 testmode */
  1985. >   if (state->check_dataline) {
  1986. 1610,1611c1703,1705
  1987. <       if(err < 0){
  1988. <           dev_err(&client->dev, "%s: failed: Could not check data line.\n", __func__);
  1989. ---
  1990. >       if (err < 0) {
  1991. >           dev_err(&client->dev, "%s: failed: Could not check data"
  1992. >                   "line.\n", __func__);
  1993. 1614,1619c1708,1709
  1994. <   }
  1995. <   //Normal preview sequence
  1996. <   else
  1997. <   {
  1998. <       LOGV("%s state->check_dataline = Normal preview sequence", __func__);
  1999. <       /* Stop it if it is already running */
  2000. ---
  2001. >   } else { /* Normal preview sequence */
  2002. >       /* Stop it if it is already running */
  2003. 1621,1622c1711,1713
  2004. <       if(err < 0){
  2005. <           dev_err(&client->dev, "%s: failed: Could not stop the running preview.\n", __func__);
  2006. ---
  2007. >       if (err < 0) {
  2008. >           dev_err(&client->dev, "%s: failed: Could not stop the "
  2009. >                   "running preview.\n", __func__);
  2010. 1627,1635c1718,1730
  2011. <       if(err < 0){
  2012. <           dev_err(&client->dev, "%s: failed: Could not set preview size\n", __func__);
  2013. <           return -EIO;
  2014. <       }
  2015. <
  2016. <       if(DZoom_State != 0){
  2017. <           err = ce147_i2c_write_multi(client, CMD_SET_DZOOM, &ce147_buf_set_dzoom[DZoom_State], 1);
  2018. <           if(err < 0){
  2019. <               dev_err(&client->dev, "%s: failed: i2c_write for set_dzoom in preview_start\n", __func__);
  2020. ---
  2021. >       if (err < 0) {
  2022. >           dev_err(&client->dev, "%s: failed: Could not set "
  2023. >                   "preview size\n", __func__);
  2024. >           return -EIO;
  2025. >       }
  2026. >
  2027. >       if (DZoom_State != 0) {
  2028. >           err = ce147_i2c_write_multi(client, CMD_SET_DZOOM,
  2029. >                   &ce147_buf_set_dzoom[DZoom_State], 1);
  2030. >           if (err < 0) {
  2031. >               dev_err(&client->dev, "%s: failed: i2c_write "
  2032. >                       "for set_dzoom in "
  2033. >                       "preview_start\n", __func__);
  2034. 1639,1643c1734,1743
  2035. <           for(count = 0; count < 300; count++)
  2036. <           {
  2037. <               err = ce147_i2c_read_multi(client, CMD_GET_DZOOM_LEVEL, NULL, 0, ce147_buf_get_dzoom_status, ce147_len_get_dzoom_status);
  2038. <               if(err < 0){
  2039. <                   dev_err(&client->dev, "%s: failed: i2c_read for set_dzoom in preview_start\n", __func__);
  2040. ---
  2041. >           for (count = 0; count < 300; count++) {
  2042. >               err = ce147_i2c_read_multi(client,
  2043. >                       CMD_GET_DZOOM_LEVEL, NULL, 0,
  2044. >                       ce147_buf_get_dzoom_status,
  2045. >                       ce147_len_get_dzoom_status);
  2046. >               if (err < 0) {
  2047. >                   dev_err(&client->dev, "%s: failed: "
  2048. >                           "i2c_read for set_dzoom"
  2049. >                           "in preview_start\n",
  2050. >                               __func__);
  2051. 1646c1746,1747
  2052. <               if(ce147_buf_get_dzoom_status[1] == 0x00) break;
  2053. ---
  2054. >               if (ce147_buf_get_dzoom_status[1] == 0x00)
  2055. >                   break;
  2056. 1651,1654c1752,1756
  2057. <       if(err < 0){
  2058. <           dev_err(&client->dev, "%s: failed: Could not set anti banding\n", __func__);
  2059. <           return -EIO;
  2060. <       }
  2061. ---
  2062. >       if (err < 0) {
  2063. >           dev_err(&client->dev, "%s: failed: Could not set anti "
  2064. >                   "banding\n", __func__);
  2065. >           return -EIO;
  2066. >       }
  2067. 1657,1660c1759,1763
  2068. <           if(err < 0){
  2069. <           dev_err(&client->dev, "%s: failed: Could not set fps\n", __func__);
  2070. <                   return -EIO;
  2071. <           }
  2072. ---
  2073. >       if (err < 0) {
  2074. >           dev_err(&client->dev, "%s: failed: Could not set fps\n",
  2075. >                   __func__);
  2076. >           return -EIO;
  2077. >       }
  2078. 1662,1664c1765
  2079. <       if(state->runmode != CE147_RUNMODE_READY)
  2080. <       {
  2081. <           LOGV("%s CE147_RUNMODE_READY", __func__);
  2082. ---
  2083. >       if (state->runmode != CE147_RUNMODE_READY) {
  2084. 1666,1669c1767,1771
  2085. <           //ctrl.value = state->iso;
  2086. <           err = ce147_set_iso(sd, ISO_AUTO);
  2087. <           if(err < 0){
  2088. <               dev_err(&client->dev, "%s: failed: ce147_set_iso, err %d\n", __func__, err);
  2089. ---
  2090. >           ctrl.value = state->iso;
  2091. >           err = ce147_set_iso(sd, &ctrl);
  2092. >           if (err < 0) {
  2093. >               dev_err(&client->dev, "%s: failed: ce147_set_"
  2094. >                       "iso, err %d\n", __func__, err);
  2095. 1674,1677c1776,1781
  2096. <           //ctrl.value = state->metering;
  2097. <           err = ce147_set_metering(sd, METERING_MATRIX);
  2098. <           if(err < 0){
  2099. <               dev_err(&client->dev, "%s: failed: ce147_set_metering, err %d\n", __func__, err);
  2100. ---
  2101. >           ctrl.value = state->metering;
  2102. >           err = ce147_set_metering(sd, &ctrl);
  2103. >           if (err < 0) {
  2104. >               dev_err(&client->dev, "%s: failed: ce147_set_"
  2105. >                       "metering, err %d\n",
  2106. >                           __func__, err);
  2107. 1682,1685c1786,1790
  2108. <           //ctrl.value = state->ev;
  2109. <           err = ce147_set_ev(sd, EV_DEFAULT);
  2110. <           if(err < 0){
  2111. <               dev_err(&client->dev, "%s: failed: ce147_set_ev, err %d\n", __func__, err);
  2112. ---
  2113. >           ctrl.value = state->ev;
  2114. >           err = ce147_set_ev(sd, &ctrl);
  2115. >           if (err < 0) {
  2116. >               dev_err(&client->dev, "%s: failed: ce147_set_"
  2117. >                       "ev, err %d\n", __func__, err);
  2118. 1688c1793
  2119. <          
  2120. ---
  2121. >
  2122. 1690,1693c1795,1800
  2123. <           //ctrl.value = state->effect;
  2124. <           err = ce147_set_effect(sd, IMAGE_EFFECT_NONE);
  2125. <           if(err < 0){
  2126. <               dev_err(&client->dev, "%s: failed: ce147_set_effect, err %d\n", __func__, err);
  2127. ---
  2128. >           ctrl.value = state->effect;
  2129. >           err = ce147_set_effect(sd, &ctrl);
  2130. >           if (err < 0) {
  2131. >               dev_err(&client->dev, "%s: failed: ce147_set_"
  2132. >                       "effect, err %d\n",
  2133. >                           __func__, err);
  2134. 1697,1701c1804,1810
  2135. <           /* wb*/
  2136. <           //ctrl.value = state->wb;
  2137. <           err = ce147_set_white_balance(sd, WHITE_BALANCE_AUTO);
  2138. <           if(err < 0){
  2139. <               dev_err(&client->dev, "%s: failed: ce147_set_white_balance, err %d\n", __func__, err);
  2140. ---
  2141. >           /* wb */
  2142. >           ctrl.value = state->wb;
  2143. >           err = ce147_set_white_balance(sd, &ctrl);
  2144. >           if (err < 0) {
  2145. >               dev_err(&client->dev, "%s: failed: ce147_set_"
  2146. >                       "white_balance, err %d\n",
  2147. >                           __func__, err);
  2148. 1704d1812
  2149. <                      
  2150. 1706,1710c1814,1819
  2151. <       /* slow ae */
  2152. <       //ctrl.value = state->hd_slow_ae;
  2153. <       err = ce147_set_slow_ae(sd, state->hd_slow_ae);
  2154. <       if(err < 0){
  2155. <           dev_err(&client->dev, "%s: failed: ce147_set_slow_ae, err %d\n", __func__, err);
  2156. ---
  2157. >       /* slow ae */
  2158. >       ctrl.value = state->hd_slow_ae;
  2159. >       err = ce147_set_slow_ae(sd, &ctrl);
  2160. >       if (err < 0) {
  2161. >           dev_err(&client->dev, "%s: failed: ce147_set_slow_ae, "
  2162. >                   "err %d\n", __func__, err);
  2163. 1715,1718c1824,1828
  2164. <       //ctrl.value = state->hd_gamma;
  2165. <       err = ce147_set_gamma(sd, state->hd_gamma);
  2166. <       if(err < 0){
  2167. <           dev_err(&client->dev, "%s: failed: ce147_set_gamma, err %d\n", __func__, err);
  2168. ---
  2169. >       ctrl.value = state->hd_gamma;
  2170. >       err = ce147_set_gamma(sd, &ctrl);
  2171. >       if (err < 0) {
  2172. >           dev_err(&client->dev, "%s: failed: ce147_set_gamma, "
  2173. >                   "err %d\n", __func__, err);
  2174. 1724,1726c1834,1838
  2175. <       if(err < 0){
  2176. <           dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_frame_rate\n", __func__);
  2177. <           return -EIO;
  2178. ---
  2179. >       if (err < 0) {
  2180. >           dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  2181. >                   "reflection_status for "
  2182. >                   "set_frame_rate\n", __func__);
  2183. >           return -EIO;
  2184. 1729c1841
  2185. <       /* Release AWB unLock */
  2186. ---
  2187. >       /* Release AWB unLock */
  2188. 1731,1732c1843,1845
  2189. <       if(err < 0){
  2190. <           dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, err %d\n", __func__, err);
  2191. ---
  2192. >       if (err < 0) {
  2193. >           dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, "
  2194. >                   "err %d\n", __func__, err);
  2195. 1735c1848
  2196. <                  
  2197. ---
  2198. >
  2199. 1737,1745c1850,1863
  2200. <           err = ce147_i2c_write_multi(client, CMD_PREVIEW, ce147_regbuf_preview_start, ce147_reglen_preview);
  2201. <           if(err < 0){
  2202. <           dev_err(&client->dev, "%s: failed: i2c_write for preview_start\n", __func__);
  2203. <                   return -EIO;
  2204. <           }
  2205. <
  2206. <       err = ce147_waitfordone_timeout(client, CMD_PREVIEW_STATUS, 0x08, 3000, POLL_TIME_MS);
  2207. <       if(err < 0){
  2208. <           dev_err(&client->dev, "%s: Wait for preview_start failed\n", __func__ );
  2209. ---
  2210. >       err = ce147_i2c_write_multi(client, CMD_PREVIEW,
  2211. >                       ce147_regbuf_preview_start,
  2212. >                       ce147_reglen_preview);
  2213. >       if (err < 0) {
  2214. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  2215. >                   "preview_start\n", __func__);
  2216. >           return -EIO;
  2217. >       }
  2218. >
  2219. >       err = ce147_waitfordone_timeout(client, CMD_PREVIEW_STATUS,
  2220. >               0x08, 3000, POLL_TIME_MS);
  2221. >       if (err < 0) {
  2222. >           dev_err(&client->dev, "%s: Wait for preview_start "
  2223. >                   "failed\n", __func__);
  2224. 1748c1866,1867
  2225. <       ce147_msg(&client->dev, "%s: preview_start - wait time %d ms\n", __func__, err);   
  2226. ---
  2227. >       ce147_msg(&client->dev, "%s: preview_start - wait time %d ms\n",
  2228. >               __func__, err);
  2229. 1763c1882,1883
  2230. <   unsigned char ce147_regbuf_capture_size[4] = { 0x0B, 0x00, 0x01, 0x00}; /* Default 5 MP */
  2231. ---
  2232. >   /* Default 5 MP = { 0x08, 0x00, 0x01, 0x00 } */
  2233. >   unsigned char ce147_regbuf_capture_size[4] = { 0x0B, 0x00, 0x01, 0x00 };
  2234. 1766c1886
  2235. <   switch(index){
  2236. ---
  2237. >   switch (index) {
  2238. 1775c1895
  2239. <       break;     
  2240. ---
  2241. >       break;
  2242. 1792,1793c1912,1913
  2243. <       /* The framesize index was not set properly.
  2244. <        * Check s_fmt call - it must be for video mode. */
  2245. ---
  2246. >       /* The framesize index was not set properly.
  2247. >        * Check s_fmt call - it must be for video mode. */
  2248. 1798,1801c1918,1923
  2249. <   err = ce147_i2c_write_multi(client, CMD_CAPTURE_SIZE, ce147_regbuf_capture_size, ce147_reglen_capture_size);
  2250. <   if(err < 0){
  2251. <       dev_err(&client->dev, "%s: failed: i2c_write for capture_resolution\n", __func__);
  2252. <       return -EIO;
  2253. ---
  2254. >   err = ce147_i2c_write_multi(client, CMD_CAPTURE_SIZE,
  2255. >           ce147_regbuf_capture_size, ce147_reglen_capture_size);
  2256. >   if (err < 0) {
  2257. >       dev_err(&client->dev, "%s: failed: i2c_write "
  2258. >               "for capture_resolution\n", __func__);
  2259. >       return -EIO;
  2260. 1804,1813c1926,1934
  2261. <   //This is for postview
  2262. <   if(ce147_regbuf_capture_size[0] < 0x0C)
  2263. <   {
  2264. <       state->preview_size = CE147_PREVIEW_VGA;
  2265. <       //printk("[5B] ce147_set_capture_size: preview_size is VGA (%d)\n", state->preview_size);
  2266. <   }
  2267. <   else
  2268. <   {
  2269. <       state->preview_size = CE147_PREVIEW_WVGA;
  2270. <       //printk("[5B] ce147_set_capture_size: preview_size is WVGA (%d)\n", state->preview_size);     
  2271. ---
  2272. >   /* This is for postview */
  2273. >   if (ce147_regbuf_capture_size[0] < 0x0C) {
  2274. >       state->preview_size = CE147_PREVIEW_VGA;
  2275. >       /* pr_debug("%s: preview_size is VGA (%d)\n",
  2276. >               __func__, state->preview_size); */
  2277. >   } else {
  2278. >       state->preview_size = CE147_PREVIEW_WVGA;
  2279. >       /* pr_debug("%s: preview_size is WVGA (%d)\n",
  2280. >               __func__, state->preview_size); */
  2281. 1816c1937
  2282. <   //printk("ce147_set_capture_size: 0x%02x\n", index);
  2283. ---
  2284. >   /* pr_debug("%s: 0x%02x\n", __func__, index); */
  2285. 1818c1939
  2286. <   return 0;  
  2287. ---
  2288. >   return 0;
  2289. 1821c1942
  2290. < static int ce147_set_ae_awb(struct v4l2_subdev *sd, int ae_awb)
  2291. ---
  2292. > static int ce147_set_ae_awb(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  2293. 1827,1832d1947
  2294. <  
  2295. <   switch(ae_awb)
  2296. <   {
  2297. <       case AE_LOCK_AWB_UNLOCK:
  2298. <           ce147_buf_set_ae_awb[0] = 0x01;
  2299. <           break;
  2300. 1834,1840c1949,1960
  2301. <       case AE_UNLOCK_AWB_LOCK:
  2302. <           ce147_buf_set_ae_awb[0] = 0x10;
  2303. <           break;
  2304. <          
  2305. <       case AE_LOCK_AWB_LOCK:
  2306. <           ce147_buf_set_ae_awb[0] = 0x11;
  2307. <           break;
  2308. ---
  2309. >   switch (ctrl->value) {
  2310. >   case AE_LOCK_AWB_UNLOCK:
  2311. >       ce147_buf_set_ae_awb[0] = 0x01;
  2312. >       break;
  2313. >
  2314. >   case AE_UNLOCK_AWB_LOCK:
  2315. >       ce147_buf_set_ae_awb[0] = 0x10;
  2316. >       break;
  2317. >
  2318. >   case AE_LOCK_AWB_LOCK:
  2319. >       ce147_buf_set_ae_awb[0] = 0x11;
  2320. >       break;
  2321. 1842,1844c1962,1964
  2322. <       case AE_UNLOCK_AWB_UNLOCK:  
  2323. <       default:
  2324. <           ce147_buf_set_ae_awb[0] = 0x00;        
  2325. ---
  2326. >   case AE_UNLOCK_AWB_UNLOCK:
  2327. >   default:
  2328. >       ce147_buf_set_ae_awb[0] = 0x00;
  2329. 1847,1849c1967,1971
  2330. <   err = ce147_i2c_write_multi(client, CMD_AE_WB_LOCK, ce147_buf_set_ae_awb, 1);
  2331. <   if(err < 0){
  2332. <       dev_err(&client->dev, "%s: failed: i2c_write for set_effect\n", __func__);
  2333. ---
  2334. >   err = ce147_i2c_write_multi(client, CMD_AE_WB_LOCK,
  2335. >                   ce147_buf_set_ae_awb, 1);
  2336. >   if (err < 0) {
  2337. >       dev_err(&client->dev, "%s: failed: i2c_write for set_effect\n",
  2338. >                       __func__);
  2339. 1859c1981
  2340. <  *  lock: 1 to lock, 0 to unlock
  2341. ---
  2342. >  *  lock: 1 to lock, 0 to unlock
  2343. 1869c1991
  2344. <   if(lock)
  2345. ---
  2346. >   if (lock)
  2347. 1874,1876c1996,2000
  2348. <   err = ce147_i2c_write_multi(client, CMD_AE_WB_LOCK, ce147_regbuf_awb_lock, ce147_reglen_awb_lock);
  2349. <   if(err < 0){
  2350. <       dev_err(&client->dev, "%s: failed: i2c_write for awb_lock\n", __func__);
  2351. ---
  2352. >   err = ce147_i2c_write_multi(client, CMD_AE_WB_LOCK,
  2353. >           ce147_regbuf_awb_lock, ce147_reglen_awb_lock);
  2354. >   if (err < 0) {
  2355. >       dev_err(&client->dev, "%s: failed: i2c_write for awb_lock\n",
  2356. >               __func__);
  2357. 1893,1895c2017,2022
  2358. <   err = ce147_i2c_write_multi(client, CMD_BUFFERING_CAPTURE, ce147_regbuf_buffering_capture, ce147_reglen_buffering_capture);
  2359. <   if(err < 0){
  2360. <       dev_err(&client->dev, "%s: failed: i2c_write for buffering_capture\n", __func__);
  2361. ---
  2362. >   err = ce147_i2c_write_multi(client, CMD_BUFFERING_CAPTURE,
  2363. >           ce147_regbuf_buffering_capture,
  2364. >           ce147_reglen_buffering_capture);
  2365. >   if (err < 0) {
  2366. >       dev_err(&client->dev, "%s: failed: i2c_write "
  2367. >               "for buffering_capture\n", __func__);
  2368. 1912c2039
  2369. <   if ((onoff == 0) && (state->thumb_null ==0))
  2370. ---
  2371. >   if ((onoff == 0) && (state->thumb_null == 0))
  2372. 1914c2041
  2373. <   else if ((onoff == 1) && (state->thumb_null ==0))
  2374. ---
  2375. >   else if ((onoff == 1) && (state->thumb_null == 0))
  2376. 1916c2043
  2377. <   else if ((onoff == 0) && (state->thumb_null ==0))
  2378. ---
  2379. >   else if ((onoff == 0) && (state->thumb_null == 0))
  2380. 1918c2045
  2381. <   else if ((onoff == 0) && (state->thumb_null ==1))
  2382. ---
  2383. >   else if ((onoff == 0) && (state->thumb_null == 1))
  2384. 1920c2047
  2385. <   else if((onoff == 1) && (state->thumb_null ==1))
  2386. ---
  2387. >   else if ((onoff == 1) && (state->thumb_null == 1))
  2388. 1923,1927c2050,2054
  2389. <       //ce147_regbuf_exif_ctrl[1] = 0x00;
  2390. <
  2391. <   err = ce147_i2c_write_multi(client, CMD_SET_EXIF_CTRL, ce147_regbuf_exif_ctrl, ce147_reglen_exif_ctrl);
  2392. <   if(err < 0){
  2393. <       dev_err(&client->dev, "%s: failed: i2c_write for ce147_reglen_exif_ctrl\n", __func__);
  2394. ---
  2395. >   err = ce147_i2c_write_multi(client, CMD_SET_EXIF_CTRL,
  2396. >           ce147_regbuf_exif_ctrl, ce147_reglen_exif_ctrl);
  2397. >   if (err < 0) {
  2398. >       dev_err(&client->dev, "%s: failed: i2c_write "
  2399. >               "for ce147_reglen_exif_ctrl\n", __func__);
  2400. 1934a2062
  2401. >
  2402. 1937,1939d2064
  2403. <   LOGV("%s ENTER", __func__);
  2404. <  
  2405. < #if 0
  2406. 1944c2069
  2407. <   struct rtc_time gps_timestamp;//ykh
  2408. ---
  2409. >   struct rtc_time gps_timestamp;
  2410. 1946c2071,2073
  2411. <   unsigned char ce147_regbuf_exif[7] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  2412. ---
  2413. >   unsigned char ce147_regbuf_exif[7] = {
  2414. >       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  2415. >   };
  2416. 1949c2076,2078
  2417. <   unsigned char ce147_regbuf_timestamp[7] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  2418. ---
  2419. >   unsigned char ce147_regbuf_timestamp[7] = {
  2420. >       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  2421. >   };
  2422. 1953c2082
  2423. <   unsigned int ce147_reglen_rot = 1;
  2424. ---
  2425. >   unsigned int ce147_reglen_rot = 1;
  2426. 1955,1959c2084,2088
  2427. <   unsigned char ce147_model_name[130] = {0x00,};
  2428. <   unsigned int ce147_reglen_model = 130; 
  2429. <  
  2430. <   unsigned char ce147_gps_processing[130] = {0x00,};
  2431. <   unsigned int ce147_reglen_gps_processing = 130;
  2432. ---
  2433. >   unsigned char ce147_model_name[130] = { 0x00, };
  2434. >   unsigned int ce147_reglen_model = 130;
  2435. >
  2436. >   unsigned char ce147_gps_processing[130] = { 0x00, };
  2437. >   unsigned int ce147_reglen_gps_processing = 130;
  2438. 1962c2091
  2439. < #else // Modify NTTS1
  2440. ---
  2441. > #else /* Modify   NTTS1 */
  2442. 1965c2094,2097
  2443. <
  2444. ---
  2445. > #if 0
  2446. >   struct timeval curr_time;
  2447. >   struct rtc_time time;
  2448. > #endif
  2449. 1968,1969c2100,2101
  2450. <   LOGV("%s WTH GPS in KERNAL", __func__);
  2451. <   memcpy(ce147_model_name+2, ce147_str_model, sizeof(ce147_str_model));  
  2452. ---
  2453. >
  2454. >   memcpy(ce147_model_name + 2, ce147_str_model, sizeof(ce147_str_model));
  2455. 1973,1974d2104
  2456. <   LOGV("%s WTH GPS in KERNAL", __func__);
  2457. <   //memcpy(ce147_gps_processing+2, state->gpsInfo.gps_processingmethod, sizeof(state->gpsInfo.gps_processingmethod));
  2458. 1976,1984c2106,2107
  2459. <   //state->exifTimeInfo->tm_year += 1900;
  2460. <   //state->exifTimeInfo->tm_mon += 1;
  2461. <   //ce147_regbuf_exif[0] = (state->exifTimeInfo->tm_year & 0x00FF);
  2462. <   //ce147_regbuf_exif[1] = (state->exifTimeInfo->tm_year & 0xFF00) >> 8;
  2463. <   //ce147_regbuf_exif[2] = state->exifTimeInfo->tm_mon;
  2464. <   //ce147_regbuf_exif[3] = state->exifTimeInfo->tm_mday;
  2465. <   //ce147_regbuf_exif[4] = state->exifTimeInfo->tm_hour;
  2466. <   //ce147_regbuf_exif[5] = state->exifTimeInfo->tm_min;
  2467. <   //ce147_regbuf_exif[6] = state->exifTimeInfo->tm_sec;  
  2468. ---
  2469. >   memcpy(ce147_gps_processing + 2, state->gpsInfo.gps_processingmethod,
  2470. >           sizeof(state->gpsInfo.gps_processingmethod));
  2471. 1986,2008c2109,2161
  2472. <   LOGV("%s WTH GPS in KERNAL", __func__);
  2473. <  
  2474. <   //FIXME get time from rtc not GPS
  2475. <   //rtc_time_to_tm(state->gpsInfo.gps_timeStamp, &gps_timestamp);
  2476. <   //gps_timestamp.tm_year += 2000;
  2477. <   //gps_timestamp.tm_mon += 1;
  2478. <
  2479. <   //LOGV("====!! Exif Time YEAR: %ld, MONTH: %d, DAY: %d, HOUR: %d, MIN: %d, SEC: %d\n", \
  2480. <   //gps_timestamp.tm_year, gps_timestamp.tm_mon, gps_timestamp.tm_mday, \
  2481. <   //gps_timestamp.tm_hour, gps_timestamp.tm_min, gps_timestamp.tm_sec);
  2482. <
  2483. <   //ce147_regbuf_timestamp[0] = (gps_timestamp.tm_year & 0x00FF);
  2484. <   //ce147_regbuf_timestamp[1] = (gps_timestamp.tm_year & 0xFF00) >> 8;
  2485. <   //ce147_regbuf_timestamp[2] = gps_timestamp.tm_mon;
  2486. <   //ce147_regbuf_timestamp[3] = gps_timestamp.tm_mday;
  2487. <   //ce147_regbuf_timestamp[4] = gps_timestamp.tm_hour;
  2488. <   //ce147_regbuf_timestamp[5] = gps_timestamp.tm_min;
  2489. <   //ce147_regbuf_timestamp[6] = gps_timestamp.tm_sec;
  2490. <
  2491. <
  2492. <   //LOGV(KERN_DEBUG "Exif Time YEAR: %ld, MONTH: %d, DAY: %d, HOUR: %d, MIN: %d, SEC: %d\n", \
  2493. <   //state->exifTimeInfo->tm_year, state->exifTimeInfo->tm_mon, state->exifTimeInfo->tm_mday, \
  2494. <   //state->exifTimeInfo->tm_hour, state->exifTimeInfo->tm_min, state->exifTimeInfo->tm_sec);
  2495. ---
  2496. > #if 0
  2497. >   do_gettimeofday(&curr_time);
  2498. >   rtc_time_to_tm(curr_time.tv_sec, &time);
  2499. >
  2500. >   time.tm_year += 1900;
  2501. >   time.tm_mon += 1;
  2502. >
  2503. >   ce147_regbuf_exif[0] = (time.tm_year & 0x00FF);
  2504. >   ce147_regbuf_exif[1] = (time.tm_year & 0xFF00) >> 8;
  2505. >   ce147_regbuf_exif[2] = time.tm_mon;
  2506. >   ce147_regbuf_exif[3] = time.tm_mday;
  2507. >   ce147_regbuf_exif[4] = time.tm_hour;
  2508. >   ce147_regbuf_exif[5] = time.tm_min;
  2509. >   ce147_regbuf_exif[6] = time.tm_sec;
  2510. > #else
  2511. >   state->exifTimeInfo->tm_year += 1900;
  2512. >   state->exifTimeInfo->tm_mon += 1;
  2513. >   ce147_regbuf_exif[0] = (state->exifTimeInfo->tm_year & 0x00FF);
  2514. >   ce147_regbuf_exif[1] = (state->exifTimeInfo->tm_year & 0xFF00) >> 8;
  2515. >   ce147_regbuf_exif[2] = state->exifTimeInfo->tm_mon;
  2516. >   ce147_regbuf_exif[3] = state->exifTimeInfo->tm_mday;
  2517. >   ce147_regbuf_exif[4] = state->exifTimeInfo->tm_hour;
  2518. >   ce147_regbuf_exif[5] = state->exifTimeInfo->tm_min;
  2519. >   ce147_regbuf_exif[6] = state->exifTimeInfo->tm_sec;
  2520. > #endif
  2521. >
  2522. >   rtc_time_to_tm(state->gpsInfo.gps_timeStamp, &gps_timestamp);
  2523. >   gps_timestamp.tm_year += 1900;
  2524. >   gps_timestamp.tm_mon += 1;
  2525. >
  2526. >   pr_debug("====!! Exif Time YEAR: %d, MONTH: %d, "
  2527. >           "DAY: %d, HOUR: %d, MIN: %d, SEC: %d\n",
  2528. >               gps_timestamp.tm_year, gps_timestamp.tm_mon,
  2529. >               gps_timestamp.tm_mday, gps_timestamp.tm_hour,
  2530. >               gps_timestamp.tm_min, gps_timestamp.tm_sec);
  2531. >
  2532. >   ce147_regbuf_timestamp[0] = (gps_timestamp.tm_year & 0x00FF);
  2533. >   ce147_regbuf_timestamp[1] = (gps_timestamp.tm_year & 0xFF00) >> 8;
  2534. >   ce147_regbuf_timestamp[2] = gps_timestamp.tm_mon;
  2535. >   ce147_regbuf_timestamp[3] = gps_timestamp.tm_mday;
  2536. >   ce147_regbuf_timestamp[4] = gps_timestamp.tm_hour;
  2537. >   ce147_regbuf_timestamp[5] = gps_timestamp.tm_min;
  2538. >   ce147_regbuf_timestamp[6] = gps_timestamp.tm_sec;
  2539. >
  2540. >
  2541. >   pr_debug("Exif Time YEAR: %ld, MONTH: %d, DAY: %d, "
  2542. >           "HOUR: %d, MIN: %d, SEC: %d\n",
  2543. >           state->exifTimeInfo->tm_year,
  2544. >           state->exifTimeInfo->tm_mon,
  2545. >           state->exifTimeInfo->tm_mday,
  2546. >           state->exifTimeInfo->tm_hour,
  2547. >           state->exifTimeInfo->tm_min,
  2548. >           state->exifTimeInfo->tm_sec);
  2549. 2012,2014c2165,2169
  2550. <   err = ce147_i2c_write_multi(client, CMD_INFO_MODEL, ce147_model_name, ce147_reglen_model);
  2551. <   if(err < 0){
  2552. <       dev_err(&client->dev, "%s: failed: i2c_write for exif model name\n", __func__);
  2553. ---
  2554. >   err = ce147_i2c_write_multi(client, CMD_INFO_MODEL, ce147_model_name,
  2555. >                   ce147_reglen_model);
  2556. >   if (err < 0) {
  2557. >       dev_err(&client->dev, "%s: failed: i2c_write for exif model "
  2558. >               "name\n", __func__);
  2559. 2018,2020c2173,2177
  2560. <   err = ce147_i2c_write_multi(client, CMD_INFO_EXIF, ce147_regbuf_exif, ce147_reglen_exif);
  2561. <   if(err < 0){
  2562. <       dev_err(&client->dev, "%s: failed: i2c_write for exif\n", __func__);
  2563. ---
  2564. >   err = ce147_i2c_write_multi(client, CMD_INFO_EXIF, ce147_regbuf_exif,
  2565. >                   ce147_reglen_exif);
  2566. >   if (err < 0) {
  2567. >       dev_err(&client->dev, "%s: failed: i2c_write for exif\n",
  2568. >               __func__);
  2569. 2024,2026c2181,2219
  2570. <   err = ce147_i2c_write_multi(client, CMD_INFO_ROT, ce147_regbuf_rot, ce147_reglen_rot);
  2571. <   if(err < 0){
  2572. <       dev_err(&client->dev, "%s: failed: i2c_write for exif\n", __func__);
  2573. ---
  2574. >   err = ce147_i2c_write_multi(client, CMD_INFO_ROT, ce147_regbuf_rot,
  2575. >                   ce147_reglen_rot);
  2576. >   if (err < 0) {
  2577. >       dev_err(&client->dev, "%s: failed: i2c_write for exif\n",
  2578. >               __func__);
  2579. >       return -EIO;
  2580. >   }
  2581. >
  2582. >   err = ce147_i2c_write_multi(client, CMD_INFO_LONGITUDE_LATITUDE,
  2583. >           state->gpsInfo.ce147_gps_buf,
  2584. >           sizeof(state->gpsInfo.ce147_gps_buf));
  2585. >   if (err < 0) {
  2586. >       dev_err(&client->dev, "%s: failed: i2c_write for gps "
  2587. >               "longitude latitude\n", __func__);
  2588. >       return -EIO;
  2589. >   }
  2590. >
  2591. >   err = ce147_i2c_write_multi(client, CMD_INFO_ALTITUDE,
  2592. >           state->gpsInfo.ce147_altitude_buf,
  2593. >           sizeof(state->gpsInfo.ce147_altitude_buf));
  2594. >   if (err < 0) {
  2595. >       dev_err(&client->dev, "%s: failed: i2c_write for gps "
  2596. >               "altitude\n", __func__);
  2597. >       return -EIO;
  2598. >   }
  2599. >
  2600. >   err = ce147_i2c_write_multi(client, CMD_GPS_TIMESTAMP,
  2601. >           ce147_regbuf_timestamp, ce147_reglen_timestamp);
  2602. >   if (err < 0) {
  2603. >       dev_err(&client->dev, "%s: failed: i2c_write for gps "
  2604. >               "timestamp\n", __func__);
  2605. >       return -EIO;
  2606. >   }
  2607. >
  2608. >   err = ce147_i2c_write_multi(client, CMD_INFO_MODEL,
  2609. >           ce147_gps_processing, ce147_reglen_gps_processing);
  2610. >   if (err < 0) {
  2611. >       dev_err(&client->dev, "%s: failed: i2c_write for gps method\n",
  2612. >               __func__);
  2613. 2030,2053d2222
  2614. <   //err = ce147_i2c_write_multi(client, CMD_INFO_LONGITUDE_LATITUDE, state->gpsInfo.ce147_gps_buf, sizeof(state->gpsInfo.ce147_gps_buf));
  2615. <   //if(err < 0){
  2616. <   //  dev_err(&client->dev, "%s: failed: i2c_write for gps longitude latitude\n", __func__);
  2617. <   //  return -EIO;
  2618. <   //}
  2619. <  
  2620. <   //err = ce147_i2c_write_multi(client, CMD_INFO_ALTITUDE, state->gpsInfo.ce147_altitude_buf, sizeof(state->gpsInfo.ce147_altitude_buf));
  2621. <   //if(err < 0){
  2622. <   //  dev_err(&client->dev, "%s: failed: i2c_write for gps altitude\n", __func__);
  2623. <   //  return -EIO;
  2624. <   //}
  2625. <      
  2626. <   //err = ce147_i2c_write_multi(client, CMD_GPS_TIMESTAMP, ce147_regbuf_timestamp, ce147_reglen_timestamp);
  2627. <   //if(err < 0){
  2628. <   //  dev_err(&client->dev, "%s: failed: i2c_write for gps timestamp\n", __func__);
  2629. <   //  return -EIO;
  2630. <   //}
  2631. <  
  2632. <   //err = ce147_i2c_write_multi(client, CMD_INFO_MODEL, ce147_gps_processing, ce147_reglen_gps_processing);
  2633. <   //if(err < 0){
  2634. <   //  dev_err(&client->dev, "%s: failed: i2c_write for gps method\n", __func__);
  2635. <   //  return -EIO;
  2636. <   //}
  2637. <      
  2638. 2055,2056c2224
  2639. < #endif
  2640. <   LOGV("%s OUT", __func__);
  2641. ---
  2642. >
  2643. 2066c2234,2236
  2644. <   unsigned char ce147_regbuf_jpeg_comp_level[7] = { 0x00, 0xF4, 0x01, 0x90, 0x01, 0x05, 0x01 };
  2645. ---
  2646. >   unsigned char ce147_regbuf_jpeg_comp_level[7] = {
  2647. >       0x00, 0xF4, 0x01, 0x90, 0x01, 0x05, 0x01
  2648. >   };
  2649. 2073c2243
  2650. <   if(state->jpeg.quality < 0)
  2651. ---
  2652. >   if (state->jpeg.quality < 0)
  2653. 2075c2245
  2654. <   if(state->jpeg.quality > 100)
  2655. ---
  2656. >   if (state->jpeg.quality > 100)
  2657. 2079,2082c2249,2253
  2658. <   ce147_regbuf_jpeg_comp_level[1] = comp_ratio & 0xFF;
  2659. <   ce147_regbuf_jpeg_comp_level[2] = (comp_ratio & 0xFF00) >> 8;
  2660. <  
  2661. <   ce147_msg(&client->dev, "Quality = %d, Max value = %d\n", state->jpeg.quality, comp_ratio);
  2662. ---
  2663. >   ce147_regbuf_jpeg_comp_level[1] = comp_ratio & 0xFF;
  2664. >   ce147_regbuf_jpeg_comp_level[2] = (comp_ratio & 0xFF00) >> 8;
  2665. >
  2666. >   ce147_msg(&client->dev, "Quality = %d, Max value = %d\n",
  2667. >           state->jpeg.quality, comp_ratio);
  2668. 2084,2086c2255,2258
  2669. <   comp_ratio = (comp_ratio * 9) / 10;  /* 10% range for final JPEG image size */
  2670. <   ce147_regbuf_jpeg_comp_level[3] = comp_ratio & 0xFF;
  2671. <   ce147_regbuf_jpeg_comp_level[4] = (comp_ratio & 0xFF00) >> 8;
  2672. ---
  2673. >   /* 10% range for final JPEG image size */
  2674. >   comp_ratio = (comp_ratio * 9) / 10;
  2675. >   ce147_regbuf_jpeg_comp_level[3] = comp_ratio & 0xFF;
  2676. >   ce147_regbuf_jpeg_comp_level[4] = (comp_ratio & 0xFF00) >> 8;
  2677. 2088c2260,2261
  2678. <   ce147_msg(&client->dev, "Quality = %d, Min Comp Ratio = %d\n", state->jpeg.quality, comp_ratio);
  2679. ---
  2680. >   ce147_msg(&client->dev, "Quality = %d, Min Comp Ratio = %d\n",
  2681. >           state->jpeg.quality, comp_ratio);
  2682. 2091c2264,2266
  2683. <   unsigned char ce147_regbuf_jpeg_comp_level[7] = { 0x00, 0xA4, 0x06, 0x78, 0x05, 0x05, 0x01 };
  2684. ---
  2685. >   unsigned char ce147_regbuf_jpeg_comp_level[7] = {
  2686. >       0x00, 0xA4, 0x06, 0x78, 0x05, 0x05, 0x01
  2687. >   };
  2688. 2094c2269
  2689. <   unsigned int compressionRatio = 0;
  2690. ---
  2691. >   unsigned int compressionRatio = 0;
  2692. 2098,2142c2273,2295
  2693. < //    dev_err(&client->dev, "%s: quality = %d\n", __func__, quality);
  2694. <
  2695. <   if(quality >= 91 && quality <= 100) { // 91 ~ 100
  2696. <       compressionRatio = 17; // 17%
  2697. <   }
  2698. <
  2699. <   else if(quality >= 81 && quality <= 90) {   // 81 ~ 90
  2700. <       compressionRatio = 16; // 16%
  2701. <   }
  2702. <
  2703. <   else if(quality >= 71 && quality <= 80) { // 71 ~ 80
  2704. <       compressionRatio = 15; // 15%
  2705. <   }
  2706. <
  2707. <   else if(quality >= 61 && quality <= 70) { // 61 ~ 70
  2708. <       compressionRatio = 14; // 14%
  2709. <   }
  2710. <
  2711. <   else if(quality >= 51 && quality <= 60) { // 51 ~ 60
  2712. <       compressionRatio = 13; // 13%
  2713. <   }
  2714. <  
  2715. <   else if(quality >= 41 && quality <= 50) { // 41 ~ 50
  2716. <       compressionRatio = 12; // 12%
  2717. <   }
  2718. <
  2719. <   else if(quality >= 31 && quality <= 40) { // 31 ~ 40
  2720. <       compressionRatio = 11; // 11%
  2721. <   }
  2722. <
  2723. <   else if(quality >= 21 && quality <= 30) { // 21 ~ 30
  2724. <       compressionRatio = 10; // 10%
  2725. <   }
  2726. <
  2727. <   else if(quality >= 11 && quality <= 20) { // 11 ~ 20
  2728. <       compressionRatio = 9; // 9%
  2729. <   }
  2730. <  
  2731. <   else if(quality >= 1 && quality <= 10) { // 1 ~ 10
  2732. <       compressionRatio = 8; // 8%
  2733. <   }
  2734. <
  2735. <   else {     
  2736. <       dev_err(&client->dev, "%s: Invalid Quality(%d)\n", __func__, quality);
  2737. <      
  2738. ---
  2739. >   if (quality >= 91 && quality <= 100) { /* 91 ~ 100 */
  2740. >       compressionRatio = 17; /* 17% */
  2741. >   } else if (quality >= 81 && quality <= 90) { /* 81 ~ 90 */
  2742. >       compressionRatio = 16; /* 16% */
  2743. >   } else if (quality >= 71 && quality <= 80) { /* 71 ~ 80 */
  2744. >       compressionRatio = 15; /* 15% */
  2745. >   } else if (quality >= 61 && quality <= 70) { /* 61 ~ 70 */
  2746. >       compressionRatio = 14; /* 14% */
  2747. >   } else if (quality >= 51 && quality <= 60) { /* 51 ~ 60 */
  2748. >       compressionRatio = 13; /* 13% */
  2749. >   } else if (quality >= 41 && quality <= 50) { /* 41 ~ 50 */
  2750. >       compressionRatio = 12; /* 12% */
  2751. >   } else if (quality >= 31 && quality <= 40) { /* 31 ~ 40 */
  2752. >       compressionRatio = 11; /* 11% */
  2753. >   } else if (quality >= 21 && quality <= 30) { /* 21 ~ 30 */
  2754. >       compressionRatio = 10; /* 10% */
  2755. >   } else if (quality >= 11 && quality <= 20) { /* 11 ~ 20 */
  2756. >       compressionRatio = 9; /* 9% */
  2757. >   } else if (quality >= 1 && quality <= 10) { /* 1 ~ 10 */
  2758. >       compressionRatio = 8; /* 8% */
  2759. >   } else {
  2760. >       dev_err(&client->dev, "%s: Invalid Quality(%d)\n",
  2761. >               __func__, quality);
  2762. 2146,2160c2299,2315
  2763. <   minimumCompressionRatio = compressionRatio - 3; // ex) if compression ratio is 17%, minimum compression ratio is 14%
  2764. <   ce147_regbuf_jpeg_comp_level[1] = (compressionRatio * 100) & 0xFF;
  2765. <   ce147_regbuf_jpeg_comp_level[2] = ((compressionRatio * 100) & 0xFF00) >> 8;
  2766. <   ce147_regbuf_jpeg_comp_level[3] = (minimumCompressionRatio * 100) & 0xFF;
  2767. <   ce147_regbuf_jpeg_comp_level[4] = ((minimumCompressionRatio * 100) & 0xFF00) >> 8;
  2768. <  
  2769. < //    dev_err(&client->dev, "%s: compression ratio low byte: 0x%x, high byte: 0x%x\n", __func__, ce147_regbuf_jpeg_comp_level[1], ce147_regbuf_jpeg_comp_level[2]);
  2770. <
  2771. < //    dev_err(&client->dev, "%s: minimum compression ratio low byte: 0x%x, high byte: 0x%x\n", __func__, ce147_regbuf_jpeg_comp_level[3], ce147_regbuf_jpeg_comp_level[4]);
  2772. <
  2773. <   err = ce147_i2c_write_multi(client, CMD_JPEG_CONFIG, ce147_regbuf_jpeg_comp_level, ce147_reglen_jpeg_comp_level);
  2774. <  
  2775. <   if(err < 0){
  2776. <       dev_err(&client->dev, "%s: failed: i2c_write for jpeg_comp_level\n", __func__);
  2777. <
  2778. ---
  2779. >   /* ex) if compression ratio is 17%, minimum compression ratio is 14%*/
  2780. >   minimumCompressionRatio = compressionRatio - 3;
  2781. >   ce147_regbuf_jpeg_comp_level[1] = (compressionRatio * 100) & 0xFF;
  2782. >   ce147_regbuf_jpeg_comp_level[2] = ((compressionRatio * 100) & 0xFF00)
  2783. >                       >> 8;
  2784. >   ce147_regbuf_jpeg_comp_level[3] = (minimumCompressionRatio * 100)
  2785. >                       & 0xFF;
  2786. >   ce147_regbuf_jpeg_comp_level[4] = ((minimumCompressionRatio * 100)
  2787. >                       & 0xFF00) >> 8;
  2788. >
  2789. >   err = ce147_i2c_write_multi(client, CMD_JPEG_CONFIG,
  2790. >           ce147_regbuf_jpeg_comp_level,
  2791. >           ce147_reglen_jpeg_comp_level);
  2792. >
  2793. >   if (err < 0) {
  2794. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  2795. >               "jpeg_comp_level\n", __func__);
  2796. 2177,2178c2332,2333
  2797. <   unsigned char ce147_regbuf_set_lump2[1] = {0x00};
  2798. <   unsigned int ce147_reglen_set_lump2 = 1;
  2799. ---
  2800. >   /* unsigned char ce147_regbuf_set_lump2[1] = {0x00};
  2801. >   unsigned int ce147_reglen_set_lump2 = 1; */
  2802. 2181,2182c2336,2338
  2803. <   if(err < 0){
  2804. <       dev_err(&client->dev, "%s: failed: ce147_set_jpeg_quality\n", __func__);
  2805. ---
  2806. >   if (err < 0) {
  2807. >       dev_err(&client->dev, "%s: failed: ce147_set_jpeg_quality\n",
  2808. >               __func__);
  2809. 2186,2188c2342,2344
  2810. <   if(preview_size != CE147_PREVIEW_VGA)
  2811. <   {
  2812. <       //printk("[5B] ce147_set_jpeg_config: preview_size is WVGA (%d)\n", preview_size);
  2813. ---
  2814. >   if (preview_size != CE147_PREVIEW_VGA) {
  2815. >       /* pr_debug("[5B] ce147_set_jpeg_config: preview_size is WVGA "
  2816. >          "(%d)\n", preview_size); */
  2817. 2192,2198c2348,2357
  2818. <   //if(!state->thumb_null)
  2819. <   err = ce147_i2c_write_multi(client, CMD_JPEG_BUFFERING, ce147_regbuf_set_lump, ce147_reglen_set_lump);
  2820. <   //else if(state->thumb_null)
  2821. <       //err = ce147_i2c_write_multi(client, CMD_JPEG_BUFFERING2, ce147_regbuf_set_lump2, ce147_reglen_set_lump2);
  2822. <
  2823. <   if(err < 0){
  2824. <       dev_err(&client->dev, "%s: failed: i2c_write for set_lump\n", __func__);
  2825. ---
  2826. >   /* if (!state->thumb_null) */
  2827. >   err = ce147_i2c_write_multi(client, CMD_JPEG_BUFFERING,
  2828. >           ce147_regbuf_set_lump, ce147_reglen_set_lump);
  2829. >   /* else if (state->thumb_null) */
  2830. >       /* err = ce147_i2c_write_multi(client, CMD_JPEG_BUFFERING2,
  2831. >           ce147_regbuf_set_lump2, ce147_reglen_set_lump2); */
  2832. >
  2833. >   if (err < 0) {
  2834. >       dev_err(&client->dev, "%s: failed: i2c_write for set_lump\n",
  2835. >               __func__);
  2836. 2220c2379
  2837. <   unsigned char jpeg_status_len = 3;
  2838. ---
  2839. >   unsigned char jpeg_status_len = 3;
  2840. 2222,2223c2381,2382
  2841. <   unsigned char jpeg_framesize[4] = { 0x00, 0x00, 0x00, 0x00 };
  2842. <   unsigned int jpeg_framesize_len = 4;
  2843. ---
  2844. >   unsigned char jpeg_framesize[4] = { 0x00, 0x00, 0x00, 0x00 };
  2845. >   unsigned int jpeg_framesize_len = 4;
  2846. 2225c2384
  2847. <   if(state->jpeg.enable){
  2848. ---
  2849. >   if (state->jpeg.enable) {
  2850. 2228,2230c2387,2392
  2851. <       err = ce147_i2c_read_multi(client, CMD_JPEG_SIZE, cmd_buf_framesize, cmd_len_framesize, jpeg_framesize, jpeg_framesize_len);
  2852. <       if(err < 0){
  2853. <           dev_err(&client->dev, "%s: failed: i2c_read for jpeg_framesize\n", __func__);
  2854. ---
  2855. >       err = ce147_i2c_read_multi(client, CMD_JPEG_SIZE,
  2856. >               cmd_buf_framesize, cmd_len_framesize,
  2857. >               jpeg_framesize, jpeg_framesize_len);
  2858. >       if (err < 0) {
  2859. >           dev_err(&client->dev, "%s: failed: i2c_read for "
  2860. >                   "jpeg_framesize\n", __func__);
  2861. 2232,2233c2394,2397
  2862. <       }          
  2863. <       state->jpeg.main_size = jpeg_framesize[1] | (jpeg_framesize[2] << 8) | (jpeg_framesize[3] << 16);
  2864. ---
  2865. >       }
  2866. >       state->jpeg.main_size = jpeg_framesize[1]
  2867. >                       | (jpeg_framesize[2] << 8)
  2868. >                       | (jpeg_framesize[3] << 16);
  2869. 2235c2399,2400
  2870. <       ce147_info(&client->dev, "%s: JPEG main filesize = %d bytes\n", __func__, state->jpeg.main_size );
  2871. ---
  2872. >       ce147_info(&client->dev, "%s: JPEG main filesize = %d bytes\n",
  2873. >               __func__, state->jpeg.main_size);
  2874. 2238,2248c2403,2417
  2875. <       if(!state->thumb_null)
  2876. <       {
  2877. <       cmd_buf_framesize[0] = 0x01;
  2878. <       err = ce147_i2c_read_multi(client, CMD_JPEG_SIZE, cmd_buf_framesize, cmd_len_framesize, jpeg_framesize, jpeg_framesize_len);
  2879. <       if(err < 0){
  2880. <           dev_err(&client->dev, "%s: failed: i2c_read for jpeg_framesize\n", __func__);
  2881. <           return -EIO;
  2882. <       }          
  2883. <       state->jpeg.thumb_size = jpeg_framesize[1] | (jpeg_framesize[2] << 8) | (jpeg_framesize[3] << 16);
  2884. <       }
  2885. <       else
  2886. ---
  2887. >       if (!state->thumb_null) {
  2888. >           cmd_buf_framesize[0] = 0x01;
  2889. >           err = ce147_i2c_read_multi(client, CMD_JPEG_SIZE,
  2890. >               cmd_buf_framesize, cmd_len_framesize,
  2891. >               jpeg_framesize, jpeg_framesize_len);
  2892. >           if (err < 0) {
  2893. >               dev_err(&client->dev, "%s: failed: i2c_read "
  2894. >                       "for jpeg_framesize\n",
  2895. >                           __func__);
  2896. >               return -EIO;
  2897. >           }
  2898. >           state->jpeg.thumb_size = jpeg_framesize[1]
  2899. >                       | (jpeg_framesize[2] << 8)
  2900. >                       | (jpeg_framesize[3] << 16);
  2901. >       } else
  2902. 2251c2420,2421
  2903. <       ce147_msg(&client->dev, "%s: JPEG thumb filesize = %d bytes\n", __func__, state->jpeg.thumb_size );
  2904. ---
  2905. >       ce147_msg(&client->dev, "%s: JPEG thumb filesize = %d bytes\n",
  2906. >               __func__, state->jpeg.thumb_size);
  2907. 2253c2423
  2908. <       state->jpeg.main_offset = 0;
  2909. ---
  2910. >       state->jpeg.main_offset = 0;
  2911. 2258c2428
  2912. <   if(state->jpeg.enable)
  2913. ---
  2914. >   if (state->jpeg.enable)
  2915. 2263,2265c2433,2438
  2916. <   err = ce147_i2c_read_multi(client, CMD_SET_DATA, cmd_buf_setdata, cmd_len_setdata, jpeg_status, jpeg_status_len);
  2917. <   if(err < 0){
  2918. <       dev_err(&client->dev, "%s: failed: i2c_read for set_data\n", __func__);
  2919. ---
  2920. >   err = ce147_i2c_read_multi(client, CMD_SET_DATA,
  2921. >           cmd_buf_setdata, cmd_len_setdata,
  2922. >           jpeg_status, jpeg_status_len);
  2923. >   if (err < 0) {
  2924. >       dev_err(&client->dev, "%s: failed: i2c_read for set_data\n",
  2925. >               __func__);
  2926. 2268,2270c2441,2443
  2927. <   ce147_msg(&client->dev, "%s:JPEG framesize (after set_data_out) = 0x%02x.%02x.%02x\n",__func__,\
  2928. <           jpeg_status[2], jpeg_status[1],jpeg_status[0]);
  2929. <
  2930. ---
  2931. >   ce147_msg(&client->dev, "%s:JPEG framesize (after set_data_out) = "
  2932. >           "0x%02x.%02x.%02x\n", __func__,
  2933. >               jpeg_status[2], jpeg_status[1], jpeg_status[0]);
  2934. 2273,2275c2446,2450
  2935. <   err = ce147_i2c_read_multi(client, CMD_DATA_OUT_REQ, NULL, 0, jpeg_status, jpeg_status_len);
  2936. <   if(err < 0){
  2937. <       dev_err(&client->dev, "%s: failed: i2c_read for set_data_request\n", __func__);
  2938. ---
  2939. >   err = ce147_i2c_read_multi(client, CMD_DATA_OUT_REQ, NULL, 0,
  2940. >                   jpeg_status, jpeg_status_len);
  2941. >   if (err < 0) {
  2942. >       dev_err(&client->dev, "%s: failed: i2c_read for "
  2943. >               "set_data_request\n", __func__);
  2944. 2278,2279c2453,2455
  2945. <   ce147_msg(&client->dev, "%s:JPEG framesize (after set_data_request) = 0x%02x.%02x.%02x\n",__func__,\
  2946. <           jpeg_status[2], jpeg_status[1],jpeg_status[0]);
  2947. ---
  2948. >   ce147_msg(&client->dev, "%s:JPEG framesize (after set_data_request) "
  2949. >           "= 0x%02x.%02x.%02x\n", __func__,
  2950. >               jpeg_status[2], jpeg_status[1], jpeg_status[0]);
  2951. 2286c2462,2463
  2952. < static int ce147_set_capture_config(struct v4l2_subdev *sd)
  2953. ---
  2954. > static int ce147_set_capture_config(struct v4l2_subdev *sd,
  2955. >                   struct v4l2_control *ctrl)
  2956. 2290d2466
  2957. <   struct ce147_state *state = to_state(sd);
  2958. 2296,2298c2472,2475
  2959. <   if(err < 0){
  2960. <       dev_err(&client->dev, "%s: failed: i2c_write for capture_resolution\n", __func__);
  2961. <       return -EIO;
  2962. ---
  2963. >   if (err < 0) {
  2964. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  2965. >               "capture_resolution\n", __func__);
  2966. >       return -EIO;
  2967. 2300c2477
  2968. <  
  2969. ---
  2970. >
  2971. 2302,2306c2479,2481
  2972. <    * Set DZoom
  2973. <    */
  2974. <    
  2975. <  #if 0
  2976. <   if(DZoom_State != 0){
  2977. ---
  2978. >    * Set DZoom
  2979. >    */
  2980. >   if (DZoom_State != 0) {
  2981. 2309,2311c2484,2487
  2982. <       if(err < 0){
  2983. <       dev_err(&client->dev, "%s: failed: Could not set Zoom in Capture_start \n", __func__);
  2984. <       return -EIO;
  2985. ---
  2986. >       if (err < 0) {
  2987. >           dev_err(&client->dev, "%s: failed: Could not set Zoom "
  2988. >                   "in Capture_start\n", __func__);
  2989. >           return -EIO;
  2990. 2314,2315c2490
  2991. < #endif
  2992. <  
  2993. ---
  2994. >
  2995. 2317,2318c2492,2493
  2996. <    * Set AWB Lock
  2997. <    */
  2998. ---
  2999. >    * Set AWB Lock
  3000. >    */
  3001. 2320,2321c2495,2497
  3002. <   if(err < 0){
  3003. <       dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, err %d\n", __func__, err);
  3004. ---
  3005. >   if (err < 0) {
  3006. >       dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, "
  3007. >               "err %d\n", __func__, err);
  3008. 2328,2330c2504,2507
  3009. <   if(err < 0){
  3010. <                 dev_err(&client->dev, "%s: failed: set_capture_cmd failed\n", __func__);
  3011. <                 return err;
  3012. ---
  3013. >   if (err < 0) {
  3014. >       dev_err(&client->dev, "%s: failed: set_capture_cmd failed\n",
  3015. >               __func__);
  3016. >       return err;
  3017. 2332c2509
  3018. <  
  3019. ---
  3020. >
  3021. 2336c2513,2514
  3022. < static int ce147_set_capture_start(struct v4l2_subdev *sd)
  3023. ---
  3024. > static int ce147_set_capture_start(struct v4l2_subdev *sd,
  3025. >                   struct v4l2_control *ctrl)
  3026. 2344c2522,2523
  3027. <    * 3. Wait for capture to complete for ce147_set_capture_cmd() in ce147_set_capture_config()
  3028. ---
  3029. >    * 3. Wait for capture to complete for ce147_set_capture_cmd()
  3030. >    * in ce147_set_capture_config()
  3031. 2346d2524
  3032. <   LOGV("%s 1", __func__);
  3033. 2348,2349c2526,2528
  3034. <   if(err < 0){
  3035. <       dev_err(&client->dev, "%s: failed: Wait for buffering_capture\n", __func__ );
  3036. ---
  3037. >   if (err < 0) {
  3038. >       dev_err(&client->dev, "%s: failed: Wait for "
  3039. >               "buffering_capture\n", __func__);
  3040. 2352,2353c2531,2533
  3041. <   LOGV("%s 2", __func__);
  3042. <   ce147_msg(&client->dev, "%s: buffering_capture - wait time %d ms\n", __func__, err);
  3043. ---
  3044. >   ce147_msg(&client->dev, "%s: buffering_capture - wait time %d ms\n",
  3045. >           __func__, err);
  3046. >
  3047. 2355d2534
  3048. <   LOGV("%s 3", __func__);
  3049. 2357,2363c2536,2543
  3050. <   if(err < 0){
  3051. <               dev_err(&client->dev, "%s: failed: set_capture_cmd failed\n", __func__);
  3052. <               return err;
  3053. <   }
  3054. <          
  3055. <   LOGV("%s 4", __func__);
  3056. <   if(state->jpeg.enable){
  3057. ---
  3058. >   if (err < 0) {
  3059. >       dev_err(&client->dev, "%s: failed: set_capture_cmd failed\n",
  3060. >               __func__);
  3061. >       return err;
  3062. >   }
  3063. >
  3064. >
  3065. >   if (state->jpeg.enable) {
  3066. 2366,2367c2546
  3067. <        */
  3068. <       LOGV("%s 5", __func__);
  3069. ---
  3070. >        */
  3071. 2369,2370c2548,2550
  3072. <       if(err < 0){
  3073. <           dev_err(&client->dev, "%s: failed: i2c_write for exif\n", __func__);
  3074. ---
  3075. >       if (err < 0) {
  3076. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3077. >                   "exif\n", __func__);
  3078. 2377d2556
  3079. <       LOGV("%s 6", __func__);
  3080. 2379,2380c2558,2560
  3081. <       if(err < 0){
  3082. <           dev_err(&client->dev, "%s: Setting JPEG encoding parameters\n", __func__);
  3083. ---
  3084. >       if (err < 0) {
  3085. >           dev_err(&client->dev, "%s: Setting JPEG encoding "
  3086. >                   "parameters\n", __func__);
  3087. 2386,2389c2566,2570
  3088. <       LOGV("%s 7", __func__);
  3089. <       err = ce147_waitfordone_timeout(client, 0x6C, 0x00, 3000, POLL_TIME_MS);
  3090. <       if(err < 0){
  3091. <           dev_err(&client->dev, "%s: failed: Wait for jpeg_encoding\n", __func__ );
  3092. ---
  3093. >       err = ce147_waitfordone_timeout(client, 0x6C, 0x00, 3000,
  3094. >                           POLL_TIME_MS);
  3095. >       if (err < 0) {
  3096. >           dev_err(&client->dev, "%s: failed: Wait for "
  3097. >                   "jpeg_encoding\n", __func__);
  3098. 2392c2573,2574
  3099. <       ce147_msg(&client->dev, "%s: jpeg_encoding - wait time %d ms\n", __func__, err);
  3100. ---
  3101. >       ce147_msg(&client->dev, "%s: jpeg_encoding - wait time %d ms\n",
  3102. >               __func__, err);
  3103. 2396,2397c2578
  3104. <    */
  3105. <    LOGV("%s 8", __func__);
  3106. ---
  3107. >    */
  3108. 2399,2400c2580,2582
  3109. <   if(err < 0){
  3110. <       dev_err(&client->dev, "%s: failed: get_snapshot_data\n", __func__);
  3111. ---
  3112. >   if (err < 0) {
  3113. >       dev_err(&client->dev, "%s: failed: get_snapshot_data\n",
  3114. >               __func__);
  3115. 2404c2586
  3116. <    * 9. Wait for done
  3117. ---
  3118. >    * 9. Wait for done
  3119. 2406d2587
  3120. <    LOGV("%s 9", __func__);
  3121. 2408,2409c2589,2591
  3122. <   if(err < 0){
  3123. <       dev_err(&client->dev, "%s: failed: Wait for data_transfer\n", __func__ );
  3124. ---
  3125. >   if (err < 0) {
  3126. >       dev_err(&client->dev, "%s: failed: Wait for data_transfer\n",
  3127. >               __func__);
  3128. 2411,2413c2593,2596
  3129. <   }  
  3130. <   ce147_msg(&client->dev, "%s: data_transfer - wait time %d ms\n", __func__, err);
  3131. <  
  3132. ---
  3133. >   }
  3134. >   ce147_msg(&client->dev, "%s: data_transfer - wait time %d ms\n",
  3135. >           __func__, err);
  3136. >
  3137. 2417c2600,2601
  3138. < static int ce147_get_focus_mode(struct i2c_client *client, unsigned char cmd, unsigned char *value)
  3139. ---
  3140. > static int ce147_get_focus_mode(struct i2c_client *client, unsigned char cmd,
  3141. >                   unsigned char *value)
  3142. 2424c2608
  3143. <   // set focus mode: AF or MACRO
  3144. ---
  3145. >   /* set focus mode: AF or MACRO */
  3146. 2426,2427c2610,2612
  3147. <   if(err < 0){
  3148. <       dev_err(&client->dev, "%s: failed: i2c_write for get_focus_mode\n", __func__);
  3149. ---
  3150. >   if (err < 0) {
  3151. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  3152. >               "get_focus_mode\n", __func__);
  3153. 2429,2432c2614,2616
  3154. <   }  
  3155. <   //check whether af data is valid or not
  3156. <   for(count = 0; count < 600; count++)
  3157. <   {
  3158. ---
  3159. >   }
  3160. >   /* check whether af data is valid or not */
  3161. >   for (count = 0; count < 600; count++) {
  3162. 2435,2437c2619,2623
  3163. <       err = ce147_i2c_read_multi(client, CMD_CHECK_AUTO_FOCUS_SEARCH, NULL, 0, ce147_buf_get_af_status, 1);
  3164. <       if(err < 0){
  3165. <           dev_err(&client->dev, "%s: failed: i2c_read for get_focus_mode\n", __func__);
  3166. ---
  3167. >       err = ce147_i2c_read_multi(client, CMD_CHECK_AUTO_FOCUS_SEARCH,
  3168. >               NULL, 0, ce147_buf_get_af_status, 1);
  3169. >       if (err < 0) {
  3170. >           dev_err(&client->dev, "%s: failed: i2c_read for "
  3171. >                   "get_focus_mode\n", __func__);
  3172. 2440c2626,2627
  3173. <       if((ce147_buf_get_af_status[0]&0x01) == 0x00) break;
  3174. ---
  3175. >       if ((ce147_buf_get_af_status[0] & 0x01) == 0x00)
  3176. >           break;
  3177. 2443c2630
  3178. <   if((ce147_buf_get_af_status[0]&0x01) != 0x00)
  3179. ---
  3180. >   if ((ce147_buf_get_af_status[0] & 0x01) != 0x00)
  3181. 2446c2633
  3182. <       return ce147_buf_get_af_status[0]&0x01;
  3183. ---
  3184. >       return ce147_buf_get_af_status[0] & 0x01;
  3185. 2460,2465c2647,2653
  3186. <   if(state->runmode > CE147_RUNMODE_IDLE)
  3187. <   {
  3188. <       // make lens landing mode
  3189. <       err = ce147_i2c_write_multi(client, CMD_SET_AUTO_FOCUS_MODE, ce147_buf_set_af_land, ce147_len_set_af_land);
  3190. <       if(err < 0){
  3191. <           dev_err(&client->dev, "%s: failed: i2c_write for auto_focus\n", __func__);
  3192. ---
  3193. >   if (state->runmode > CE147_RUNMODE_IDLE) {
  3194. >       /* make lens landing mode */
  3195. >       err = ce147_i2c_write_multi(client, CMD_SET_AUTO_FOCUS_MODE,
  3196. >               ce147_buf_set_af_land, ce147_len_set_af_land);
  3197. >       if (err < 0) {
  3198. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3199. >                   "auto_focus\n", __func__);
  3200. 2467,2470c2655,2657
  3201. <       }  
  3202. <       //check whether af data is valid or not
  3203. <       for(count = 0; count < 600; count++)
  3204. <       {
  3205. ---
  3206. >       }
  3207. >       /* check whether af data is valid or not */
  3208. >       for (count = 0; count < 600; count++) {
  3209. 2473,2475c2660,2666
  3210. <           err = ce147_i2c_read_multi(client, CMD_CHECK_AUTO_FOCUS_SEARCH, NULL, 0, ce147_buf_get_af_status, 1);
  3211. <           if(err < 0){
  3212. <               dev_err(&client->dev, "%s: failed: i2c_read for get_focus_mode\n", __func__);
  3213. ---
  3214. >           err = ce147_i2c_read_multi(client,
  3215. >                   CMD_CHECK_AUTO_FOCUS_SEARCH, NULL, 0,
  3216. >                   ce147_buf_get_af_status, 1);
  3217. >           if (err < 0) {
  3218. >               dev_err(&client->dev, "%s: failed: i2c_read "
  3219. >                       "for get_focus_mode\n",
  3220. >                           __func__);
  3221. 2478c2669,2670
  3222. <           if((ce147_buf_get_af_status[0]) == 0x08) break;
  3223. ---
  3224. >           if ((ce147_buf_get_af_status[0]) == 0x08)
  3225. >               break;
  3226. 2484c2676
  3227. < static int ce147_set_flash(struct v4l2_subdev *sd, int flash)
  3228. ---
  3229. > static int ce147_set_flash(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  3230. 2493,2498d2684
  3231. <  
  3232. <   switch(flash)
  3233. <   {
  3234. <       case FLASH_MODE_OFF:
  3235. <           ce147_buf_set_flash[1] = 0x00;
  3236. <       break;
  3237. 2500,2501c2686,2688
  3238. <       case FLASH_MODE_AUTO:
  3239. <           ce147_buf_set_flash[1] = 0x02;
  3240. ---
  3241. >   switch (ctrl->value) {
  3242. >   case FLASH_MODE_OFF:
  3243. >       ce147_buf_set_flash[1] = 0x00;
  3244. 2504,2505c2691,2692
  3245. <       case FLASH_MODE_ON:
  3246. <           ce147_buf_set_flash[1] = 0x01;
  3247. ---
  3248. >   case FLASH_MODE_AUTO:
  3249. >       ce147_buf_set_flash[1] = 0x02;
  3250. 2508,2509c2695,2696
  3251. <       case FLASH_MODE_TORCH:
  3252. <           ce147_buf_set_flash_manual[1] = 0x01;
  3253. ---
  3254. >   case FLASH_MODE_ON:
  3255. >       ce147_buf_set_flash[1] = 0x01;
  3256. 2512,2513c2699,2701
  3257. <       default:
  3258. <           ce147_buf_set_flash[1] = 0x00;
  3259. ---
  3260. >   case FLASH_MODE_TORCH:
  3261. >       ce147_buf_set_flash_manual[1] = 0x01;
  3262. >       break;
  3263. 2514a2703,2704
  3264. >   default:
  3265. >       ce147_buf_set_flash[1] = 0x00;
  3266. 2518,2523c2708,2715
  3267. <   //need to modify flash off for torch mode
  3268. <   if(flash == FLASH_MODE_OFF)
  3269. <   {
  3270. <       err = ce147_i2c_write_multi(client, CMD_SET_FLASH_MANUAL, ce147_buf_set_flash_manual, ce147_len_set_flash_manual);
  3271. <       if(err < 0){
  3272. <           dev_err(&client->dev, "%s: failed: i2c_write for set_flash\n", __func__);
  3273. ---
  3274. >   /* need to modify flash off for torch mode */
  3275. >   if (ctrl->value == FLASH_MODE_OFF) {
  3276. >       err = ce147_i2c_write_multi(client, CMD_SET_FLASH_MANUAL,
  3277. >               ce147_buf_set_flash_manual,
  3278. >               ce147_len_set_flash_manual);
  3279. >       if (err < 0) {
  3280. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3281. >                   "set_flash\n", __func__);
  3282. 2525c2717
  3283. <       }  
  3284. ---
  3285. >       }
  3286. 2528,2530c2720,2724
  3287. <   err = ce147_i2c_write_multi(client, CMD_SET_FLASH, ce147_buf_set_flash, ce147_len_set_flash);
  3288. <   if(err < 0){
  3289. <       dev_err(&client->dev, "%s: failed: i2c_write for set_flash\n", __func__);
  3290. ---
  3291. >   err = ce147_i2c_write_multi(client, CMD_SET_FLASH,
  3292. >           ce147_buf_set_flash, ce147_len_set_flash);
  3293. >   if (err < 0) {
  3294. >       dev_err(&client->dev, "%s: failed: i2c_write for set_flash\n",
  3295. >               __func__);
  3296. 2533,2534c2727,2729
  3297. <  
  3298. <   ce147_msg(&client->dev, "%s: done, flash: 0x%02x\n", __func__, ce147_buf_set_flash[1]);
  3299. ---
  3300. >
  3301. >   ce147_msg(&client->dev, "%s: done, flash: 0x%02x\n",
  3302. >           __func__, ce147_buf_set_flash[1]);
  3303. 2539c2734
  3304. < static int ce147_set_effect(struct v4l2_subdev *sd, int effect)
  3305. ---
  3306. > static int ce147_set_effect(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  3307. 2546,2551d2740
  3308. <  
  3309. <   switch(effect)
  3310. <   {
  3311. <       case IMAGE_EFFECT_NONE:
  3312. <           ce147_buf_set_effect[1] = 0x00;
  3313. <       break;
  3314. 2553,2554c2742,2744
  3315. <       case IMAGE_EFFECT_BNW:
  3316. <           ce147_buf_set_effect[1] = 0x01;
  3317. ---
  3318. >   switch (ctrl->value) {
  3319. >   case IMAGE_EFFECT_NONE:
  3320. >       ce147_buf_set_effect[1] = 0x00;
  3321. 2557,2558c2747,2748
  3322. <       case IMAGE_EFFECT_SEPIA:
  3323. <           ce147_buf_set_effect[1] = 0x03;
  3324. ---
  3325. >   case IMAGE_EFFECT_BNW:
  3326. >       ce147_buf_set_effect[1] = 0x01;
  3327. 2561,2562c2751,2752
  3328. <       case IMAGE_EFFECT_AQUA:
  3329. <           ce147_buf_set_effect[1] = 0x0D;
  3330. ---
  3331. >   case IMAGE_EFFECT_SEPIA:
  3332. >       ce147_buf_set_effect[1] = 0x03;
  3333. 2565,2566c2755,2756
  3334. <       case IMAGE_EFFECT_ANTIQUE:
  3335. <           ce147_buf_set_effect[1] = 0x06;
  3336. ---
  3337. >   case IMAGE_EFFECT_AQUA:
  3338. >       ce147_buf_set_effect[1] = 0x0D;
  3339. 2569,2570c2759,2760
  3340. <       case IMAGE_EFFECT_NEGATIVE:
  3341. <           ce147_buf_set_effect[1] = 0x05;
  3342. ---
  3343. >   case IMAGE_EFFECT_ANTIQUE:
  3344. >       ce147_buf_set_effect[1] = 0x06;
  3345. 2573,2574c2763,2764
  3346. <       case IMAGE_EFFECT_SHARPEN:
  3347. <           ce147_buf_set_effect[1] = 0x04;
  3348. ---
  3349. >   case IMAGE_EFFECT_NEGATIVE:
  3350. >       ce147_buf_set_effect[1] = 0x05;
  3351. 2577,2578c2767,2769
  3352. <       default:
  3353. <           ce147_buf_set_effect[1] = 0x00;
  3354. ---
  3355. >   case IMAGE_EFFECT_SHARPEN:
  3356. >       ce147_buf_set_effect[1] = 0x04;
  3357. >       break;
  3358. 2579a2771,2772
  3359. >   default:
  3360. >       ce147_buf_set_effect[1] = 0x00;
  3361. 2583,2585c2776,2780
  3362. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_effect, ce147_len_set_effect);
  3363. <   if(err < 0){
  3364. <       dev_err(&client->dev, "%s: failed: i2c_write for set_effect\n", __func__);
  3365. ---
  3366. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  3367. >           ce147_buf_set_effect, ce147_len_set_effect);
  3368. >   if (err < 0) {
  3369. >       dev_err(&client->dev, "%s: failed: i2c_write for set_effect\n",
  3370. >               __func__);
  3371. 2588c2783
  3372. < #if 0 //remove batch 
  3373. ---
  3374. > #if 0 /* remove batch */
  3375. 2590,2592c2785,2788
  3376. <   if(err < 0){
  3377. <       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_effect\n", __func__);
  3378. <       return -EIO;
  3379. ---
  3380. >   if (err < 0) {
  3381. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  3382. >               "reflection_status for set_effect\n", __func__);
  3383. >       return -EIO;
  3384. 2600c2796,2797
  3385. < static int ce147_set_saturation(struct v4l2_subdev *sd, int saturation)
  3386. ---
  3387. > static int ce147_set_saturation(struct v4l2_subdev *sd,
  3388. >                   struct v4l2_control *ctrl)
  3389. 2607,2612d2803
  3390. <  
  3391. <   switch(saturation)
  3392. <   {
  3393. <       case SATURATION_MINUS_2:
  3394. <           ce147_buf_set_saturation[1] = 0x01;
  3395. <       break;
  3396. 2614,2615c2805,2807
  3397. <       case SATURATION_MINUS_1:
  3398. <           ce147_buf_set_saturation[1] = 0x02;
  3399. ---
  3400. >   switch (ctrl->value) {
  3401. >   case SATURATION_MINUS_2:
  3402. >       ce147_buf_set_saturation[1] = 0x01;
  3403. 2618,2619c2810,2811
  3404. <       case SATURATION_DEFAULT:
  3405. <           ce147_buf_set_saturation[1] = 0x03;
  3406. ---
  3407. >   case SATURATION_MINUS_1:
  3408. >       ce147_buf_set_saturation[1] = 0x02;
  3409. 2622,2623c2814,2815
  3410. <       case SATURATION_PLUS_1:
  3411. <           ce147_buf_set_saturation[1] = 0x04;
  3412. ---
  3413. >   case SATURATION_DEFAULT:
  3414. >       ce147_buf_set_saturation[1] = 0x03;
  3415. 2626,2627c2818,2819
  3416. <       case SATURATION_PLUS_2:
  3417. <           ce147_buf_set_saturation[1] = 0x05;
  3418. ---
  3419. >   case SATURATION_PLUS_1:
  3420. >       ce147_buf_set_saturation[1] = 0x04;
  3421. 2630,2631c2822,2824
  3422. <       default:
  3423. <           ce147_buf_set_saturation[1] = 0x03;
  3424. ---
  3425. >   case SATURATION_PLUS_2:
  3426. >       ce147_buf_set_saturation[1] = 0x05;
  3427. >       break;
  3428. 2632a2826,2827
  3429. >   default:
  3430. >       ce147_buf_set_saturation[1] = 0x03;
  3431. 2636,2638c2831,2835
  3432. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_saturation, ce147_len_set_saturation);
  3433. <   if(err < 0){
  3434. <       dev_err(&client->dev, "%s: failed: i2c_write for set_saturation\n", __func__);
  3435. ---
  3436. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  3437. >           ce147_buf_set_saturation, ce147_len_set_saturation);
  3438. >   if (err < 0) {
  3439. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  3440. >               "set_saturation\n", __func__);
  3441. 2641c2838
  3442. < #if 0 //remove batch 
  3443. ---
  3444. > #if 0 /* remove batch */
  3445. 2643,2645c2840,2844
  3446. <   if(err < 0){
  3447. <       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_saturation\n", __func__);
  3448. <       return -EIO;
  3449. ---
  3450. >   if (err < 0) {
  3451. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  3452. >               "reflection_status for set_saturation\n",
  3453. >               __func__);
  3454. >       return -EIO;
  3455. 2648c2847,2848
  3456. <   ce147_msg(&client->dev, "%s: done, saturation: 0x%02x\n", __func__, ce147_buf_set_saturation[1]);
  3457. ---
  3458. >   ce147_msg(&client->dev, "%s: done, saturation: 0x%02x\n",
  3459. >           __func__, ce147_buf_set_saturation[1]);
  3460. 2653c2853
  3461. < static int ce147_set_contrast(struct v4l2_subdev *sd, int contrast)
  3462. ---
  3463. > static int ce147_set_contrast(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  3464. 2660,2665d2859
  3465. <  
  3466. <   switch(contrast)
  3467. <   {
  3468. <       case CONTRAST_MINUS_2:
  3469. <           ce147_buf_set_contrast[1] = 0x01;
  3470. <       break;
  3471. 2667,2668c2861,2863
  3472. <       case CONTRAST_MINUS_1:
  3473. <           ce147_buf_set_contrast[1] = 0x02;
  3474. ---
  3475. >   switch (ctrl->value) {
  3476. >   case CONTRAST_MINUS_2:
  3477. >       ce147_buf_set_contrast[1] = 0x01;
  3478. 2671,2672c2866,2867
  3479. <       case CONTRAST_DEFAULT:
  3480. <           ce147_buf_set_contrast[1] = 0x03;
  3481. ---
  3482. >   case CONTRAST_MINUS_1:
  3483. >       ce147_buf_set_contrast[1] = 0x02;
  3484. 2675,2676c2870,2871
  3485. <       case CONTRAST_PLUS_1:
  3486. <           ce147_buf_set_contrast[1] = 0x04;
  3487. ---
  3488. >   case CONTRAST_DEFAULT:
  3489. >       ce147_buf_set_contrast[1] = 0x03;
  3490. 2679,2680c2874,2875
  3491. <       case CONTRAST_PLUS_2:
  3492. <           ce147_buf_set_contrast[1] = 0x05;
  3493. ---
  3494. >   case CONTRAST_PLUS_1:
  3495. >       ce147_buf_set_contrast[1] = 0x04;
  3496. 2683,2684c2878,2880
  3497. <       default:
  3498. <           ce147_buf_set_contrast[1] = 0x03;
  3499. ---
  3500. >   case CONTRAST_PLUS_2:
  3501. >       ce147_buf_set_contrast[1] = 0x05;
  3502. >       break;
  3503. 2685a2882,2883
  3504. >   default:
  3505. >       ce147_buf_set_contrast[1] = 0x03;
  3506. 2689,2691c2887,2891
  3507. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_contrast, ce147_len_set_contrast);
  3508. <   if(err < 0){
  3509. <       dev_err(&client->dev, "%s: failed: i2c_write for set_contrast\n", __func__);
  3510. ---
  3511. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  3512. >           ce147_buf_set_contrast, ce147_len_set_contrast);
  3513. >   if (err < 0) {
  3514. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  3515. >               "set_contrast\n", __func__);
  3516. 2694c2894
  3517. < #if 0 //remove batch 
  3518. ---
  3519. > #if 0 /* remove batch */
  3520. 2696,2698c2896,2900
  3521. <   if(err < 0){
  3522. <       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_contrast\n", __func__);
  3523. <       return -EIO;
  3524. ---
  3525. >   if (err < 0) {
  3526. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  3527. >               "reflection_status for set_contrast\n",
  3528. >               __func__);
  3529. >       return -EIO;
  3530. 2701c2903,2904
  3531. <   ce147_msg(&client->dev, "%s: done, contrast: 0x%02x\n", __func__, ce147_buf_set_contrast[1]);
  3532. ---
  3533. >   ce147_msg(&client->dev, "%s: done, contrast: 0x%02x\n",
  3534. >           __func__, ce147_buf_set_contrast[1]);
  3535. 2706c2909,2910
  3536. < static int ce147_set_sharpness(struct v4l2_subdev *sd, int sharpness)
  3537. ---
  3538. > static int ce147_set_sharpness(struct v4l2_subdev *sd,
  3539. >               struct v4l2_control *ctrl)
  3540. 2713,2718d2916
  3541. <  
  3542. <   switch(sharpness)
  3543. <   {
  3544. <       case SHARPNESS_MINUS_2:
  3545. <           ce147_buf_set_saturation[1] = 0x01;
  3546. <       break;
  3547. 2720,2721c2918,2920
  3548. <       case SHARPNESS_MINUS_1:
  3549. <           ce147_buf_set_saturation[1] = 0x02;
  3550. ---
  3551. >   switch (ctrl->value) {
  3552. >   case SHARPNESS_MINUS_2:
  3553. >       ce147_buf_set_saturation[1] = 0x01;
  3554. 2724,2725c2923,2924
  3555. <       case SHARPNESS_DEFAULT:
  3556. <           ce147_buf_set_saturation[1] = 0x03;
  3557. ---
  3558. >   case SHARPNESS_MINUS_1:
  3559. >       ce147_buf_set_saturation[1] = 0x02;
  3560. 2728,2729c2927,2928
  3561. <       case SHARPNESS_PLUS_1:
  3562. <           ce147_buf_set_saturation[1] = 0x04;
  3563. ---
  3564. >   case SHARPNESS_DEFAULT:
  3565. >       ce147_buf_set_saturation[1] = 0x03;
  3566. 2732,2733c2931,2932
  3567. <       case SHARPNESS_PLUS_2:
  3568. <           ce147_buf_set_saturation[1] = 0x05;
  3569. ---
  3570. >   case SHARPNESS_PLUS_1:
  3571. >       ce147_buf_set_saturation[1] = 0x04;
  3572. 2736,2737c2935,2937
  3573. <       default:
  3574. <           ce147_buf_set_saturation[1] = 0x03;
  3575. ---
  3576. >   case SHARPNESS_PLUS_2:
  3577. >       ce147_buf_set_saturation[1] = 0x05;
  3578. >       break;
  3579. 2738a2939,2940
  3580. >   default:
  3581. >       ce147_buf_set_saturation[1] = 0x03;
  3582. 2742,2744c2944,2948
  3583. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_saturation, ce147_len_set_saturation);
  3584. <   if(err < 0){
  3585. <       dev_err(&client->dev, "%s: failed: i2c_write for set_saturation\n", __func__);
  3586. ---
  3587. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  3588. >           ce147_buf_set_saturation, ce147_len_set_saturation);
  3589. >   if (err < 0) {
  3590. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  3591. >               "set_saturation\n", __func__);
  3592. 2747c2951
  3593. < #if 0 //remove batch 
  3594. ---
  3595. > #if 0 /* remove batch */
  3596. 2749,2751c2953,2957
  3597. <   if(err < 0){
  3598. <       dev_err(&client->dev, "%s: failed: ce147_get_batch_reflection_status for set_saturation\n", __func__);
  3599. <       return -EIO;
  3600. ---
  3601. >   if (err < 0) {
  3602. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  3603. >               "reflection_status for set_saturation\n",
  3604. >               __func__);
  3605. >       return -EIO;
  3606. 2754c2960,2961
  3607. <   ce147_msg(&client->dev, "%s: done, sharpness: 0x%02x\n", __func__, ce147_buf_set_saturation[1]);
  3608. ---
  3609. >   ce147_msg(&client->dev, "%s: done, sharpness: 0x%02x\n",
  3610. >           __func__, ce147_buf_set_saturation[1]);
  3611. 2759c2966
  3612. < static int ce147_set_wdr(struct v4l2_subdev *sd, int wdr)
  3613. ---
  3614. > static int ce147_set_wdr(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  3615. 2766,2770c2973,2976
  3616. <  
  3617. <   switch(wdr)
  3618. <   {
  3619. <       case WDR_ON:
  3620. <           ce147_buf_set_wdr[0] = 0x01;
  3621. ---
  3622. >
  3623. >   switch (ctrl->value) {
  3624. >   case WDR_ON:
  3625. >       ce147_buf_set_wdr[0] = 0x01;
  3626. 2772,2775d2977
  3627. <      
  3628. <       case WDR_OFF:          
  3629. <       default:
  3630. <           ce147_buf_set_wdr[0] = 0x00;
  3631. 2776a2979,2981
  3632. >   case WDR_OFF:
  3633. >   default:
  3634. >       ce147_buf_set_wdr[0] = 0x00;
  3635. 2780,2782c2985,2989
  3636. <   err = ce147_i2c_write_multi(client, CMD_SET_WDR, ce147_buf_set_wdr, ce147_len_set_wdr);
  3637. <   if(err < 0){
  3638. <       dev_err(&client->dev, "%s: failed: i2c_write for set_wdr\n", __func__);
  3639. ---
  3640. >   err = ce147_i2c_write_multi(client, CMD_SET_WDR,
  3641. >                   ce147_buf_set_wdr, ce147_len_set_wdr);
  3642. >   if (err < 0) {
  3643. >       dev_err(&client->dev, "%s: failed: i2c_write for set_wdr\n",
  3644. >               __func__);
  3645. 2786c2993,2994
  3646. <   ce147_msg(&client->dev, "%s: done, wdr: 0x%02x\n", __func__, ce147_buf_set_wdr[0]);
  3647. ---
  3648. >   ce147_msg(&client->dev, "%s: done, wdr: 0x%02x\n",
  3649. >           __func__, ce147_buf_set_wdr[0]);
  3650. 2791c2999,3000
  3651. < static int ce147_set_anti_shake(struct v4l2_subdev *sd, int anti_shake)
  3652. ---
  3653. > static int ce147_set_anti_shake(struct v4l2_subdev *sd,
  3654. >               struct v4l2_control *ctrl)
  3655. 2798,2803d3006
  3656. <  
  3657. <   switch(anti_shake)
  3658. <   {
  3659. <       case ANTI_SHAKE_STILL_ON:
  3660. <           ce147_buf_set_anti_shake[0] = 0x01;
  3661. <       break;
  3662. 2805,2806c3008,3010
  3663. <       case ANTI_SHAKE_MOVIE_ON:
  3664. <           ce147_buf_set_anti_shake[0] = 0x10;
  3665. ---
  3666. >   switch (ctrl->value) {
  3667. >   case ANTI_SHAKE_STILL_ON:
  3668. >       ce147_buf_set_anti_shake[0] = 0x01;
  3669. 2809,2811c3013,3015
  3670. <       case ANTI_SHAKE_OFF:
  3671. <       default:
  3672. <           ce147_buf_set_anti_shake[0] = 0x00;
  3673. ---
  3674. >   case ANTI_SHAKE_MOVIE_ON:
  3675. >       ce147_buf_set_anti_shake[0] = 0x10;
  3676. >       break;
  3677. 2812a3017,3019
  3678. >   case ANTI_SHAKE_OFF:
  3679. >   default:
  3680. >       ce147_buf_set_anti_shake[0] = 0x00;
  3681. 2816,2818c3023,3027
  3682. <   err = ce147_i2c_write_multi(client, CMD_SET_ANTI_SHAKE, ce147_buf_set_anti_shake, ce147_len_set_anti_shake);
  3683. <   if(err < 0){
  3684. <       dev_err(&client->dev, "%s: failed: i2c_write for anti_shake\n", __func__);
  3685. ---
  3686. >   err = ce147_i2c_write_multi(client, CMD_SET_ANTI_SHAKE,
  3687. >           ce147_buf_set_anti_shake, ce147_len_set_anti_shake);
  3688. >   if (err < 0) {
  3689. >       dev_err(&client->dev, "%s: failed: i2c_write for anti_shake\n",
  3690. >               __func__);
  3691. 2822c3031,3032
  3692. <   ce147_msg(&client->dev, "%s: done, AHS: 0x%02x\n", __func__, ce147_buf_set_anti_shake[0]);
  3693. ---
  3694. >   ce147_msg(&client->dev, "%s: done, AHS: 0x%02x\n",
  3695. >           __func__, ce147_buf_set_anti_shake[0]);
  3696. 2827c3037,3038
  3697. < static int ce147_set_continous_af(struct v4l2_subdev *sd, int af)
  3698. ---
  3699. > static int ce147_set_continous_af(struct v4l2_subdev *sd,
  3700. >                   struct v4l2_control *ctrl)
  3701. 2840,2841c3051
  3702. <   /* need to set face_detection with noline */
  3703. <   //
  3704. ---
  3705. >   /* need to set face_detection with noline */
  3706. 2843,2847c3053,3058
  3707. <   if(af)
  3708. <   {
  3709. <       err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE, ce147_buf_set_caf);
  3710. <       if(err < 0){
  3711. <           dev_err(&client->dev, "%s: failed: start_continous_af\n", __func__);
  3712. ---
  3713. >   if (ctrl->value) {
  3714. >       err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE,
  3715. >                       ce147_buf_set_caf);
  3716. >       if (err < 0) {
  3717. >           dev_err(&client->dev, "%s: failed: "
  3718. >                   "start_continous_af\n", __func__);
  3719. 2851,2854c3062,3068
  3720. <       //start af search
  3721. <       err = ce147_i2c_write_multi(client, CMD_START_AUTO_FOCUS_SEARCH, ce147_buf_start_af_search, ce147_len_start_af_search);
  3722. <       if(err < 0){
  3723. <           dev_err(&client->dev, "%s: failed: i2c_write for start_continous_af\n", __func__);
  3724. ---
  3725. >       /* start af search */
  3726. >       err = ce147_i2c_write_multi(client, CMD_START_AUTO_FOCUS_SEARCH,
  3727. >               ce147_buf_start_af_search,
  3728. >               ce147_len_start_af_search);
  3729. >       if (err < 0) {
  3730. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3731. >                   "start_continous_af\n", __func__);
  3732. 2857,2862c3071,3076
  3733. <   }
  3734. <   else
  3735. <   {
  3736. <       err = ce147_get_focus_mode(client, CMD_STOP_LENS_MOVEMENT, ce147_buf_stop_lens_movement);
  3737. <       if(err < 0){
  3738. <           dev_err(&client->dev, "%s: failed: stop_continous_af\n", __func__);
  3739. ---
  3740. >   } else {
  3741. >       err = ce147_get_focus_mode(client, CMD_STOP_LENS_MOVEMENT,
  3742. >               ce147_buf_stop_lens_movement);
  3743. >       if (err < 0) {
  3744. >           dev_err(&client->dev, "%s: failed: stop_continous_af\n",
  3745. >                   __func__);
  3746. 2866,2868c3080,3084
  3747. <       err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE, ce147_buf_set_af);
  3748. <       if(err < 0){
  3749. <           dev_err(&client->dev, "%s: failed: stop_continous_af\n", __func__);
  3750. ---
  3751. >       err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE,
  3752. >               ce147_buf_set_af);
  3753. >       if (err < 0) {
  3754. >           dev_err(&client->dev, "%s: failed: stop_continous_af\n",
  3755. >                   __func__);
  3756. 2879c3095,3096
  3757. < static int ce147_set_object_tracking(struct v4l2_subdev *sd, int object_tracking)
  3758. ---
  3759. > static int ce147_set_object_tracking(struct v4l2_subdev *sd,
  3760. >                   struct v4l2_control *ctrl)
  3761. 2885c3102
  3762. <  
  3763. ---
  3764. >
  3765. 2893c3110
  3766. <   unsigned char ce147_buf_stop_lens[1] = { 0x00 };   
  3767. ---
  3768. >   unsigned char ce147_buf_stop_lens[1] = { 0x00 };
  3769. 2899,2903c3116,3119
  3770. <   if(object_tracking = OT_START)
  3771. <   {          
  3772. <       ce147_buf_set_object_tracking[3] = (x & 0x00FF);   
  3773. <       ce147_buf_set_object_tracking[4] = ((x  & 0xFF00) >> 8);
  3774. <       ce147_buf_set_object_tracking[5] = (y  & 0x00FF);  
  3775. ---
  3776. >   if (OT_START) {
  3777. >       ce147_buf_set_object_tracking[3] = (x & 0x00FF);
  3778. >       ce147_buf_set_object_tracking[4] = ((x & 0xFF00) >> 8);
  3779. >       ce147_buf_set_object_tracking[5] = (y & 0x00FF);
  3780. 2905,2908c3121,3127
  3781. <  
  3782. <       err = ce147_i2c_write_multi(client, CMD_START_OT, ce147_buf_set_object_tracking, ce147_len_set_object_tracking);
  3783. <       if(err < 0){
  3784. <           dev_err(&client->dev, "%s: failed: i2c_write for object_tracking\n", __func__);
  3785. ---
  3786. >
  3787. >       err = ce147_i2c_write_multi(client, CMD_START_OT,
  3788. >                       ce147_buf_set_object_tracking,
  3789. >                       ce147_len_set_object_tracking);
  3790. >       if (err < 0) {
  3791. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3792. >                   "object_tracking\n", __func__);
  3793. 2912,2914c3131,3132
  3794. <       /* Read status whether AF Tracking is successful or fail */
  3795. <       for(count = 0; count < 300; count++)
  3796. <       {
  3797. ---
  3798. >       /* Read status whether AF Tracking is successful or fail */
  3799. >       for (count = 0; count < 300; count++) {
  3800. 2917,2919c3135,3142
  3801. <           err = ce147_i2c_read_multi(client, CMD_CHECK_OT, NULL, 0, ce147_buf_check_object_tracking, ce147_len_check_object_tracking);
  3802. <           if(err < 0){
  3803. <               dev_err(&client->dev, "%s: failed: i2c_read for object_tracking\n", __func__);
  3804. ---
  3805. >           err = ce147_i2c_read_multi(client, CMD_CHECK_OT,
  3806. >                   NULL, 0,
  3807. >                   ce147_buf_check_object_tracking,
  3808. >                   ce147_len_check_object_tracking);
  3809. >           if (err < 0) {
  3810. >               dev_err(&client->dev, "%s: failed: i2c_read "
  3811. >                       "for object_tracking\n",
  3812. >                           __func__);
  3813. 2922,2923c3145,3148
  3814. <           if(ce147_buf_check_object_tracking[0] == 0x02 || ce147_buf_check_object_tracking[0] == 0x03) break;
  3815. <       }  
  3816. ---
  3817. >           if (ce147_buf_check_object_tracking[0] == 0x02
  3818. >               || ce147_buf_check_object_tracking[0] == 0x03)
  3819. >               break;
  3820. >       }
  3821. 2925,2927c3150,3151
  3822. <       /* OT status: searching an object in progess */
  3823. <       if(ce147_buf_check_object_tracking[0] == 0x01)
  3824. <       {
  3825. ---
  3826. >       /* OT status: searching an object in progess */
  3827. >       if (ce147_buf_check_object_tracking[0] == 0x01) {
  3828. 2929,2936c3153,3159
  3829. <       }  
  3830. <      
  3831. <       /* OT status: an object is detected successfully */
  3832. <       else if(ce147_buf_check_object_tracking[0] == 0x02)
  3833. <       {
  3834. <           err = ce147_set_continous_af(sd, object_tracking);
  3835. <           if(err < 0){
  3836. <               dev_err(&client->dev, "%s: failed: ce147_start_continous_af for object_tracking\n", __func__);
  3837. ---
  3838. >       } else if (ce147_buf_check_object_tracking[0] == 0x02) {
  3839. >           /* OT status: an object is detected successfully */
  3840. >           err = ce147_set_continous_af(sd, ctrl);
  3841. >           if (err < 0) {
  3842. >               dev_err(&client->dev, "%s: failed: "
  3843. >                       "ce147_start_continous_af for "
  3844. >                       "object_tracking\n", __func__);
  3845. 2940,2944c3163,3164
  3846. <       }
  3847. <
  3848. <       /* OT status: an object detecting is failed */
  3849. <       else if(ce147_buf_check_object_tracking[0] == 0x03)
  3850. <       {
  3851. ---
  3852. >       } else if (ce147_buf_check_object_tracking[0] == 0x03) {
  3853. >           /* OT status: an object detecting is failed */
  3854. 2947,2952c3167,3173
  3855. <   }
  3856. <   else
  3857. <   {
  3858. <       err = ce147_get_focus_mode(client, CMD_STOP_LENS_MOVEMENT, ce147_buf_stop_lens);
  3859. <       if(err < 0){
  3860. <           dev_err(&client->dev, "%s: failed: ce147_start_continous_af for object_tracking\n", __func__);
  3861. ---
  3862. >   } else {
  3863. >       err = ce147_get_focus_mode(client, CMD_STOP_LENS_MOVEMENT,
  3864. >               ce147_buf_stop_lens);
  3865. >       if (err < 0) {
  3866. >           dev_err(&client->dev, "%s: failed: "
  3867. >                   "ce147_start_continous_af for "
  3868. >                   "object_tracking\n", __func__);
  3869. 2954c3175
  3870. <       }  
  3871. ---
  3872. >       }
  3873. 2956,2958c3177,3182
  3874. <       err = ce147_i2c_write_multi(client, CMD_START_OT, ce147_buf_set_object_tracking, ce147_len_set_object_tracking);
  3875. <       if(err < 0){
  3876. <           dev_err(&client->dev, "%s: failed: i2c_write for object_tracking\n", __func__);
  3877. ---
  3878. >       err = ce147_i2c_write_multi(client, CMD_START_OT,
  3879. >               ce147_buf_set_object_tracking,
  3880. >               ce147_len_set_object_tracking);
  3881. >       if (err < 0) {
  3882. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  3883. >                   "object_tracking\n", __func__);
  3884. 2962c3186
  3885. <   ce147_msg(&client->dev, "%s: done\n", __func__);   
  3886. ---
  3887. >   ce147_msg(&client->dev, "%s: done\n", __func__);
  3888. 2967c3191,3192
  3889. < static int ce147_get_object_tracking(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  3890. ---
  3891. > static int ce147_get_object_tracking(struct v4l2_subdev *sd,
  3892. >                   struct v4l2_control *ctrl)
  3893. 2978,2980c3203,3208
  3894. <   err = ce147_i2c_read_multi(client, CMD_CHECK_OT, NULL, 0, ce147_buf_check_object_tracking, ce147_len_check_object_tracking);
  3895. <   if(err < 0){
  3896. <       dev_err(&client->dev, "%s: failed: i2c_read for object_tracking\n", __func__);
  3897. ---
  3898. >   err = ce147_i2c_read_multi(client, CMD_CHECK_OT, NULL, 0,
  3899. >           ce147_buf_check_object_tracking,
  3900. >           ce147_len_check_object_tracking);
  3901. >   if (err < 0) {
  3902. >       dev_err(&client->dev, "%s: failed: i2c_read for "
  3903. >               "object_tracking\n", __func__);
  3904. 2985,2986c3213
  3905. <   if(ce147_buf_check_object_tracking[0] == 0x01)
  3906. <   {
  3907. ---
  3908. >   if (ce147_buf_check_object_tracking[0] == 0x01) {
  3909. 2988,2992c3215,3216
  3910. <   }  
  3911. <  
  3912. <   /* OT status: an object is detected successfully */
  3913. <   else if(ce147_buf_check_object_tracking[0] == 0x02)
  3914. <   {
  3915. ---
  3916. >   } else if (ce147_buf_check_object_tracking[0] == 0x02) {
  3917. >       /* OT status: an object is detected successfully */
  3918. 2994,2998c3218,3219
  3919. <   }
  3920. <
  3921. <   /* OT status: an object detecting is failed */
  3922. <   else if(ce147_buf_check_object_tracking[0] == 0x03)
  3923. <   {
  3924. ---
  3925. >   } else if (ce147_buf_check_object_tracking[0] == 0x03) {
  3926. >       /* OT status: an object detecting is failed */
  3927. 3000,3004c3221,3222
  3928. <   }
  3929. <  
  3930. <   /* OT status: detected object is missing  */
  3931. <   else if(ce147_buf_check_object_tracking[0] == 0x04)
  3932. <   {
  3933. ---
  3934. >   } else if (ce147_buf_check_object_tracking[0] == 0x04) {
  3935. >       /* OT status: detected object is missing  */
  3936. 3006,3008c3224,3226
  3937. <   }  
  3938. <  
  3939. <   ce147_msg(&client->dev, "%s: done\n", __func__);   
  3940. ---
  3941. >   }
  3942. >
  3943. >   ce147_msg(&client->dev, "%s: done\n", __func__);
  3944. 3013c3231,3232
  3945. < static int ce147_set_face_detection(struct v4l2_subdev *sd, int face_detection)
  3946. ---
  3947. > static int ce147_set_face_detection(struct v4l2_subdev *sd,
  3948. >                   struct v4l2_control *ctrl)
  3949. 3019,3026c3238,3244
  3950. <   unsigned int ce147_len_set_fd = 3;
  3951. <  
  3952. <   switch(face_detection)
  3953. <   {
  3954. <       case FACE_DETECTION_ON:
  3955. <           ce147_buf_set_fd[0] = 0x03;
  3956. <           ce147_buf_set_fd[1] = 0x01;
  3957. <           ce147_buf_set_fd[2] = 0x0A;
  3958. ---
  3959. >   unsigned int ce147_len_set_fd = 3;
  3960. >
  3961. >   switch (ctrl->value) {
  3962. >   case FACE_DETECTION_ON:
  3963. >       ce147_buf_set_fd[0] = 0x03;
  3964. >       ce147_buf_set_fd[1] = 0x01;
  3965. >       ce147_buf_set_fd[2] = 0x0A;
  3966. 3029,3032c3247,3250
  3967. <       case FACE_DETECTION_ON_BEAUTY:
  3968. <           ce147_buf_set_fd[0] = 0x01;
  3969. <           ce147_buf_set_fd[1] = 0x01;
  3970. <           ce147_buf_set_fd[2] = 0x0A;
  3971. ---
  3972. >   case FACE_DETECTION_ON_BEAUTY:
  3973. >       ce147_buf_set_fd[0] = 0x01;
  3974. >       ce147_buf_set_fd[1] = 0x01;
  3975. >       ce147_buf_set_fd[2] = 0x0A;
  3976. 3035,3038c3253,3256
  3977. <       case FACE_DETECTION_NOLINE:
  3978. <           ce147_buf_set_fd[0] = 0x03;
  3979. <           ce147_buf_set_fd[1] = 0x00;
  3980. <           ce147_buf_set_fd[2] = 0x0A;
  3981. ---
  3982. >   case FACE_DETECTION_NOLINE:
  3983. >       ce147_buf_set_fd[0] = 0x03;
  3984. >       ce147_buf_set_fd[1] = 0x00;
  3985. >       ce147_buf_set_fd[2] = 0x0A;
  3986. 3041,3045c3259,3263
  3987. <       case FACE_DETECTION_OFF:
  3988. <       default:
  3989. <           ce147_buf_set_fd[0] = 0x00;
  3990. <           ce147_buf_set_fd[1] = 0x00;
  3991. <           ce147_buf_set_fd[2] = 0x00;
  3992. ---
  3993. >   case FACE_DETECTION_OFF:
  3994. >   default:
  3995. >       ce147_buf_set_fd[0] = 0x00;
  3996. >       ce147_buf_set_fd[1] = 0x00;
  3997. >       ce147_buf_set_fd[2] = 0x00;
  3998. 3048,3051c3266,3271
  3999. <  
  4000. <   err = ce147_i2c_write_multi(client, CMD_SET_FACE_DETECTION, ce147_buf_set_fd, ce147_len_set_fd);
  4001. <   if(err < 0){
  4002. <       dev_err(&client->dev, "%s: failed: i2c_write for face_detection\n", __func__);
  4003. ---
  4004. >
  4005. >   err = ce147_i2c_write_multi(client, CMD_SET_FACE_DETECTION,
  4006. >                   ce147_buf_set_fd, ce147_len_set_fd);
  4007. >   if (err < 0) {
  4008. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4009. >               "face_detection\n", __func__);
  4010. 3060c3280,3281
  4011. < static int ce147_set_smart_auto(struct v4l2_subdev *sd, int smart_auto)
  4012. ---
  4013. > static int ce147_set_smart_auto(struct v4l2_subdev *sd,
  4014. >                   struct v4l2_control *ctrl)
  4015. 3067,3069c3288,3289
  4016. <  
  4017. <   if(smart_auto == SMART_AUTO_ON)
  4018. <   {
  4019. ---
  4020. >
  4021. >   if (ctrl->value == SMART_AUTO_ON) {
  4022. 3071,3073c3291,3296
  4023. <       err = ce147_i2c_write_multi(client, CMD_SET_SMART_AUTO, ce147_buf_set_smart_auto, ce147_len_set_smart_auto);
  4024. <       if(err < 0){
  4025. <           dev_err(&client->dev, "%s: failed: i2c_write for smart_auto\n", __func__);
  4026. ---
  4027. >       err = ce147_i2c_write_multi(client, CMD_SET_SMART_AUTO,
  4028. >               ce147_buf_set_smart_auto,
  4029. >               ce147_len_set_smart_auto);
  4030. >       if (err < 0) {
  4031. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  4032. >                   "smart_auto\n", __func__);
  4033. 3078,3079c3301,3303
  4034. <       if(err < 0){
  4035. <           dev_err(&client->dev, "%s: failed: CAF_START for smart_auto\n", __func__);
  4036. ---
  4037. >       if (err < 0) {
  4038. >           dev_err(&client->dev, "%s: failed: CAF_START for "
  4039. >                   "smart_auto\n", __func__);
  4040. 3083,3086c3307,3308
  4041. <   }
  4042. <   else
  4043. <   {
  4044. < #if 0
  4045. ---
  4046. >   } else {
  4047. > #if 0
  4048. 3088,3089c3310,3312
  4049. <       if(err < 0){
  4050. <           dev_err(&client->dev, "%s: failed: CAF_START for smart_auto\n", __func__);
  4051. ---
  4052. >       if (err < 0) {
  4053. >           dev_err(&client->dev, "%s: failed: CAF_START for "
  4054. >                   "smart_auto\n", __func__);
  4055. 3093c3316
  4056. <      
  4057. ---
  4058. >
  4059. 3095,3097c3318,3323
  4060. <       err = ce147_i2c_write_multi(client, CMD_SET_SMART_AUTO, ce147_buf_set_smart_auto, ce147_len_set_smart_auto);
  4061. <       if(err < 0){
  4062. <           dev_err(&client->dev, "%s: failed: i2c_write for smart_auto\n", __func__);
  4063. ---
  4064. >       err = ce147_i2c_write_multi(client, CMD_SET_SMART_AUTO,
  4065. >               ce147_buf_set_smart_auto,
  4066. >               ce147_len_set_smart_auto);
  4067. >       if (err < 0) {
  4068. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  4069. >                   "smart_auto\n", __func__);
  4070. 3107c3333,3334
  4071. < static int ce147_get_smart_auto_status(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4072. ---
  4073. > static int ce147_get_smart_auto_status(struct v4l2_subdev *sd,
  4074. >                   struct v4l2_control *ctrl)
  4075. 3111c3338
  4076. <   struct ce147_state *state = to_state(sd);  
  4077. ---
  4078. >   struct ce147_state *state = to_state(sd);
  4079. 3117,3119c3344,3348
  4080. <   err = ce147_i2c_read_multi(client, CMD_GET_SMART_AUTO_STATUS, NULL, 0, ce147_buf_smart_auto_status, 2);
  4081. <   if(err < 0){
  4082. <       dev_err(&client->dev, "%s: failed: i2c_read for auto_status\n", __func__);
  4083. ---
  4084. >   err = ce147_i2c_read_multi(client, CMD_GET_SMART_AUTO_STATUS, NULL, 0,
  4085. >                   ce147_buf_smart_auto_status, 2);
  4086. >   if (err < 0) {
  4087. >       dev_err(&client->dev, "%s: failed: i2c_read for auto_status\n",
  4088. >               __func__);
  4089. 3123,3124c3352,3353
  4090. <   if(ce147_buf_smart_auto_status[0] == 0x00 || ce147_buf_smart_auto_status[0] == 0x01)
  4091. <   {
  4092. ---
  4093. >   if (ce147_buf_smart_auto_status[0] == 0x00
  4094. >       || ce147_buf_smart_auto_status[0] == 0x01) {
  4095. 3126,3132c3355,3358
  4096. <   }
  4097. <   else
  4098. <   {
  4099. <       switch(ce147_buf_smart_auto_status[1])
  4100. <       {
  4101. <           case 0x00:
  4102. <               state->sa_status = SMART_AUTO_STATUS_LANDSCAPE;
  4103. ---
  4104. >   } else {
  4105. >       switch (ce147_buf_smart_auto_status[1]) {
  4106. >       case 0x00:
  4107. >           state->sa_status = SMART_AUTO_STATUS_LANDSCAPE;
  4108. 3134,3136c3360,3362
  4109. <      
  4110. <           case 0x01:
  4111. <               state->sa_status = SMART_AUTO_STATUS_PORTRAIT;
  4112. ---
  4113. >
  4114. >       case 0x01:
  4115. >           state->sa_status = SMART_AUTO_STATUS_PORTRAIT;
  4116. 3138,3140c3364,3366
  4117. <      
  4118. <           case 0x02:
  4119. <               state->sa_status = SMART_AUTO_STATUS_NIGHT;
  4120. ---
  4121. >
  4122. >       case 0x02:
  4123. >           state->sa_status = SMART_AUTO_STATUS_NIGHT;
  4124. 3142,3144c3368,3370
  4125. <      
  4126. <           case 0x03:
  4127. <               state->sa_status = SMART_AUTO_STATUS_PORTRAIT_NIGHT;
  4128. ---
  4129. >
  4130. >       case 0x03:
  4131. >           state->sa_status = SMART_AUTO_STATUS_PORTRAIT_NIGHT;
  4132. 3146,3152c3372,3374
  4133. <              
  4134. <           case 0x04:
  4135. <               state->sa_status = SMART_AUTO_STATUS_MACRO;
  4136. <           break;         
  4137. <          
  4138. <           case 0x05:
  4139. <               state->sa_status = SMART_AUTO_STATUS_PORTRAIT_BACKLIT;
  4140. ---
  4141. >
  4142. >       case 0x04:
  4143. >           state->sa_status = SMART_AUTO_STATUS_MACRO;
  4144. 3154,3156c3376,3382
  4145. <      
  4146. <           case 0x06:
  4147. <               state->sa_status = SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE;
  4148. ---
  4149. >
  4150. >       case 0x05:
  4151. >           state->sa_status = SMART_AUTO_STATUS_PORTRAIT_BACKLIT;
  4152. >           break;
  4153. >
  4154. >       case 0x06:
  4155. >           state->sa_status = SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE;
  4156. 3158,3162c3384,3388
  4157. <          
  4158. <           case 0x07:
  4159. <               state->sa_status = SMART_AUTO_STATUS_ANTISHAKE;
  4160. <           break; 
  4161. <       }  
  4162. ---
  4163. >
  4164. >       case 0x07:
  4165. >           state->sa_status = SMART_AUTO_STATUS_ANTISHAKE;
  4166. >           break;
  4167. >       }
  4168. 3165c3391,3392
  4169. <   ce147_msg(&client->dev, "%s: done(smartauto_status:%d)\n", __func__,state->sa_status);
  4170. ---
  4171. >   ce147_msg(&client->dev, "%s: done(smartauto_status:%d)\n",
  4172. >           __func__, state->sa_status);
  4173. 3170c3397,3398
  4174. < static int ce147_set_touch_auto_focus(struct v4l2_subdev *sd, int focus)
  4175. ---
  4176. > static int ce147_set_touch_auto_focus(struct v4l2_subdev *sd,
  4177. >                   struct v4l2_control *ctrl)
  4178. 3182c3410
  4179. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  4180. ---
  4181. > #if defined(CONFIG_ARIES_NTT) /* Modify   NTTS1 */
  4182. 3184,3185c3412,3414
  4183. <   if(err < 0){
  4184. <       dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, err %d\n", __func__, err);
  4185. ---
  4186. >   if (err < 0) {
  4187. >       dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, "
  4188. >               "err %d\n", __func__, err);
  4189. 3192,3194c3421,3422
  4190. <  
  4191. <   if(focus == TOUCH_AF_START)
  4192. <   {
  4193. ---
  4194. >
  4195. >   if (ctrl->value == TOUCH_AF_START) {
  4196. 3198c3426
  4197. <       ce147_buf_set_touch_af[3] = ((x - 0x32) & 0x00FF); 
  4198. ---
  4199. >       ce147_buf_set_touch_af[3] = ((x - 0x32) & 0x00FF);
  4200. 3200c3428
  4201. <       ce147_buf_set_touch_af[5] = ((y - 0x32) & 0x00FF); 
  4202. ---
  4203. >       ce147_buf_set_touch_af[5] = ((y - 0x32) & 0x00FF);
  4204. 3202c3430
  4205. <       ce147_buf_set_touch_af[7] = ((x + 0x32) & 0x00FF); 
  4206. ---
  4207. >       ce147_buf_set_touch_af[7] = ((x + 0x32) & 0x00FF);
  4208. 3204c3432
  4209. <       ce147_buf_set_touch_af[9] = ((y + 0x32) & 0x00FF); 
  4210. ---
  4211. >       ce147_buf_set_touch_af[9] = ((y + 0x32) & 0x00FF);
  4212. 3207,3210c3435,3440
  4213. <  
  4214. <   err = ce147_i2c_write_multi(client, CMD_SET_TOUCH_AUTO_FOCUS, ce147_buf_set_touch_af, ce147_len_set_touch_af);
  4215. <   if(err < 0){
  4216. <       dev_err(&client->dev, "%s: failed: i2c_write for touch_auto_focus\n", __func__);
  4217. ---
  4218. >
  4219. >   err = ce147_i2c_write_multi(client, CMD_SET_TOUCH_AUTO_FOCUS,
  4220. >           ce147_buf_set_touch_af, ce147_len_set_touch_af);
  4221. >   if (err < 0) {
  4222. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4223. >               "touch_auto_focus\n", __func__);
  4224. 3219c3449,3450
  4225. < static int ce147_set_focus_mode(struct v4l2_subdev *sd, int focus_mode)
  4226. ---
  4227. > static int ce147_set_focus_mode(struct v4l2_subdev *sd,
  4228. >                   struct v4l2_control *ctrl)
  4229. 3227,3234c3458,3461
  4230. <   switch(focus_mode)
  4231. <   {
  4232. <       case FOCUS_MODE_MACRO:
  4233. <       case FOCUS_MODE_MACRO_DEFAULT:
  4234. <           ce147_buf_set_focus_mode[0] = 0x01;
  4235. <       break;
  4236. <
  4237. <       case FOCUS_MODE_FACEDETECT:
  4238. ---
  4239. >   switch (ctrl->value) {
  4240. >   case FOCUS_MODE_MACRO:
  4241. >   case FOCUS_MODE_MACRO_DEFAULT:
  4242. >       ce147_buf_set_focus_mode[0] = 0x01;
  4243. 3237,3241c3464,3471
  4244. <       case FOCUS_MODE_AUTO:
  4245. <       case FOCUS_MODE_AUTO_DEFAULT:
  4246. <       case FOCUS_MODE_FACEDETECT_DEFAULT:
  4247. <       default:
  4248. <           ce147_buf_set_focus_mode[0] = 0x00;
  4249. ---
  4250. >   /* case FOCUS_MODE_FD:
  4251. >       break; */
  4252. >
  4253. >   case FOCUS_MODE_AUTO:
  4254. >   case FOCUS_MODE_AUTO_DEFAULT:
  4255. >   /* case FOCUS_MODE_FD_DEFAULT: */
  4256. >   default:
  4257. >       ce147_buf_set_focus_mode[0] = 0x00;
  4258. 3244,3257c3474,3476
  4259. <   state->cur_af_status = ce147_buf_set_focus_mode[0];
  4260. <
  4261. <   if(focus_mode != FOCUS_MODE_FACEDETECT)
  4262. <   {
  4263. <       if((state->pre_af_status != state->cur_af_status) \
  4264. <           || (focus_mode == FOCUS_MODE_MACRO_DEFAULT)||(focus_mode == FOCUS_MODE_AUTO_DEFAULT)|| (focus_mode == FOCUS_MODE_FACEDETECT_DEFAULT))
  4265. <       {
  4266. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  4267. <                   ce147_msg(&client->dev, "%s: unlock\n", __func__); 
  4268. <                   err = ce147_set_awb_lock(sd, 0);
  4269. <                   if(err < 0){
  4270. <                       dev_err(&client->dev, "%s: failed: ce147_set_awb_unlock, err %d\n", __func__, err);
  4271. <                       return -EIO;
  4272. <                   }
  4273. ---
  4274. > #if 0
  4275. >   if (state->hd_preview_on == 1)
  4276. >       ce147_buf_set_focus_mode[0] = 0x07;
  4277. 3259,3265c3478,3499
  4278. <           //printk("[5B] ce147_set_focus_mode: %d\n", ce147_buf_set_focus_mode[0]);
  4279. <           err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE, ce147_buf_set_focus_mode);
  4280. <           if(err < 0)
  4281. <           {
  4282. <               dev_err(&client->dev, "%s: failed: get_focus_mode\n", __func__);
  4283. <               return -EIO;
  4284. <           }
  4285. ---
  4286. >   /* if (ctrl->value != FOCUS_MODE_FD) { */
  4287. >   if ((state->pre_focus_mode != ce147_buf_set_focus_mode[0])
  4288. >       || (ctrl->value == FOCUS_MODE_MACRO_DEFAULT)
  4289. >       || (ctrl->value == FOCUS_MODE_AUTO_DEFAULT)) {
  4290. >       /* || (ctrl->value == FOCUS_MODE_FD_DEFAULT)) */
  4291. > #if defined(CONFIG_ARIES_NTT) /* Modify   NTTS1 */
  4292. >       ce147_msg(&client->dev, "%s: unlock\n", __func__);
  4293. >       err = ce147_set_awb_lock(sd, 0);
  4294. >       if (err < 0) {
  4295. >           dev_err(&client->dev, "%s: failed: ce147_set_awb_"
  4296. >                   "unlock, err %d\n", __func__, err);
  4297. >           return -EIO;
  4298. >       }
  4299. > #endif
  4300. >       /* pr_debug("[5B] ce147_set_focus_mode: %d\n",
  4301. >               ce147_buf_set_focus_mode[0]); */
  4302. >       err = ce147_get_focus_mode(client, CMD_SET_AUTO_FOCUS_MODE,
  4303. >                       ce147_buf_set_focus_mode);
  4304. >       if (err < 0) {
  4305. >           dev_err(&client->dev, "%s: failed: get_focus_mode\n",
  4306. >                   __func__);
  4307. >           return -EIO;
  4308. 3267,3268c3501,3504
  4309. <       state->pre_af_status = state->cur_af_status;
  4310. <   }      
  4311. ---
  4312. >   }
  4313. >   state->pre_focus_mode = ce147_buf_set_focus_mode[0];
  4314. >   /* } */
  4315. >
  4316. 3272c3508,3509
  4317. < static int ce147_set_vintage_mode(struct v4l2_subdev *sd, int vintage_mode)
  4318. ---
  4319. > static int ce147_set_vintage_mode(struct v4l2_subdev *sd,
  4320. >                   struct v4l2_control *ctrl)
  4321. 3277,3285c3514,3523
  4322. <   unsigned char ce147_buf_set_vintage_mode[4] = { 0x10, 0x01, 0x32, 0x00 };
  4323. <   unsigned int ce147_len_set_vintage_mode = 4;
  4324. <  
  4325. <   switch(vintage_mode)
  4326. <   {
  4327. <       case VINTAGE_MODE_OFF:
  4328. <           ce147_buf_set_vintage_mode[1] = 0x00;
  4329. <           ce147_buf_set_vintage_mode[2] = 0x00;
  4330. <           ce147_buf_set_vintage_mode[3] = 0x00;
  4331. ---
  4332. >   unsigned char ce147_buf_set_vintage_mode[4] = {
  4333. >       0x10, 0x01, 0x32, 0x00
  4334. >   };
  4335. >   unsigned int ce147_len_set_vintage_mode = 4;
  4336. >
  4337. >   switch (ctrl->value) {
  4338. >   case VINTAGE_MODE_OFF:
  4339. >       ce147_buf_set_vintage_mode[1] = 0x00;
  4340. >       ce147_buf_set_vintage_mode[2] = 0x00;
  4341. >       ce147_buf_set_vintage_mode[3] = 0x00;
  4342. 3288,3289c3526,3527
  4343. <       case VINTAGE_MODE_NORMAL:
  4344. <           ce147_buf_set_vintage_mode[3] = 0x00;
  4345. ---
  4346. >   case VINTAGE_MODE_NORMAL:
  4347. >       ce147_buf_set_vintage_mode[3] = 0x00;
  4348. 3292,3293c3530,3531
  4349. <       case VINTAGE_MODE_WARM:
  4350. <           ce147_buf_set_vintage_mode[3] = 0x02;
  4351. ---
  4352. >   case VINTAGE_MODE_WARM:
  4353. >       ce147_buf_set_vintage_mode[3] = 0x02;
  4354. 3296,3297c3534,3535
  4355. <       case VINTAGE_MODE_COOL:
  4356. <           ce147_buf_set_vintage_mode[3] = 0x01;
  4357. ---
  4358. >   case VINTAGE_MODE_COOL:
  4359. >       ce147_buf_set_vintage_mode[3] = 0x01;
  4360. 3299,3301c3537,3539
  4361. <      
  4362. <       case VINTAGE_MODE_BNW:
  4363. <           ce147_buf_set_vintage_mode[3] = 0x03;
  4364. ---
  4365. >
  4366. >   case VINTAGE_MODE_BNW:
  4367. >       ce147_buf_set_vintage_mode[3] = 0x03;
  4368. 3304,3307c3542,3545
  4369. <       default:
  4370. <           ce147_buf_set_vintage_mode[1] = 0x00;
  4371. <           ce147_buf_set_vintage_mode[2] = 0x00;
  4372. <           ce147_buf_set_vintage_mode[3] = 0x00;
  4373. ---
  4374. >   default:
  4375. >       ce147_buf_set_vintage_mode[1] = 0x00;
  4376. >       ce147_buf_set_vintage_mode[2] = 0x00;
  4377. >       ce147_buf_set_vintage_mode[3] = 0x00;
  4378. 3311,3313c3549,3554
  4379. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT_SHOT, ce147_buf_set_vintage_mode, ce147_len_set_vintage_mode);
  4380. <   if(err < 0){
  4381. <       dev_err(&client->dev, "%s: failed: i2c_write for vintage_mode\n", __func__);
  4382. ---
  4383. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT_SHOT,
  4384. >           ce147_buf_set_vintage_mode,
  4385. >           ce147_len_set_vintage_mode);
  4386. >   if (err < 0) {
  4387. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4388. >               "vintage_mode\n", __func__);
  4389. 3322c3563,3564
  4390. < static int ce147_set_face_beauty(struct v4l2_subdev *sd, int face_beauty)
  4391. ---
  4392. > static int ce147_set_face_beauty(struct v4l2_subdev *sd,
  4393. >                   struct v4l2_control *ctrl)
  4394. 3330,3335c3572,3576
  4395. <   switch(face_beauty)
  4396. <   {
  4397. <       case BEAUTY_SHOT_ON:
  4398. <           ce147_buf_set_face_beauty[1] = 0x01;
  4399. <           ce147_buf_set_face_beauty[2] = 0x32;
  4400. <           ce147_buf_set_face_beauty[3] = 0x01;
  4401. ---
  4402. >   switch (ctrl->value) {
  4403. >   case BEAUTY_SHOT_ON:
  4404. >       ce147_buf_set_face_beauty[1] = 0x01;
  4405. >       ce147_buf_set_face_beauty[2] = 0x32;
  4406. >       ce147_buf_set_face_beauty[3] = 0x01;
  4407. 3337,3339c3578,3580
  4408. <      
  4409. <       case BEAUTY_SHOT_OFF:
  4410. <       default:
  4411. ---
  4412. >
  4413. >   case BEAUTY_SHOT_OFF:
  4414. >   default:
  4415. 3343,3346c3584,3589
  4416. <   //Need to set face detection as 'face beauty on' mode.
  4417. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT_SHOT, ce147_buf_set_face_beauty, ce147_len_set_face_beauty);
  4418. <   if(err < 0){
  4419. <       dev_err(&client->dev, "%s: failed: i2c_write for set_face_beauty\n", __func__);
  4420. ---
  4421. >   /* Need to set face detection as 'face beauty on' mode. */
  4422. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT_SHOT,
  4423. >           ce147_buf_set_face_beauty, ce147_len_set_face_beauty);
  4424. >   if (err < 0) {
  4425. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4426. >               "set_face_beauty\n", __func__);
  4427. 3355,3360d3597
  4428. < #define CAMERA_WHITE_BALANCE_AUTO        0x00
  4429. < #define CAMERA_WHITE_BALANCE_SUNNY       0x00
  4430. < #define CAMERA_WHITE_BALANCE_CLOUDY      0x01
  4431. < #define CAMERA_WHITE_BALANCE_TUNGSTEN    0x02
  4432. < #define CAMERA_WHITE_BALANCE_FLUORESCENT 0x03
  4433. < #define CAMERA_WHITE_BALANCE_DEFAULT     CAMERA_WHITE_BALANCE_AUTO
  4434. 3362c3599,3600
  4435. < static int ce147_set_white_balance(struct v4l2_subdev *sd, int wb)
  4436. ---
  4437. > static int ce147_set_white_balance(struct v4l2_subdev *sd,
  4438. >                   struct v4l2_control *ctrl)
  4439. 3370c3608
  4440. <   unsigned int ce147_len_set_wb = 2;
  4441. ---
  4442. >   unsigned int ce147_len_set_wb = 2;
  4443. 3372,3376c3610,3612
  4444. <  
  4445. <   switch(wb)
  4446. <   {
  4447. <       case WHITE_BALANCE_AUTO:
  4448. <           ce147_buf_set_wb_auto[0] = CAMERA_WHITE_BALANCE_AUTO;
  4449. ---
  4450. >   switch (ctrl->value) {
  4451. >   case WHITE_BALANCE_AUTO:
  4452. >       ce147_buf_set_wb_auto[0] = 0x00;
  4453. 3379,3380c3615,3616
  4454. <       case WHITE_BALANCE_SUNNY:
  4455. <           ce147_buf_set_wb[1] = CAMERA_WHITE_BALANCE_SUNNY;
  4456. ---
  4457. >   case WHITE_BALANCE_SUNNY:
  4458. >       ce147_buf_set_wb[1] = 0x00;
  4459. 3383,3384c3619,3620
  4460. <       case WHITE_BALANCE_CLOUDY:
  4461. <           ce147_buf_set_wb[1] = CAMERA_WHITE_BALANCE_CLOUDY;
  4462. ---
  4463. >   case WHITE_BALANCE_CLOUDY:
  4464. >       ce147_buf_set_wb[1] = 0x01;
  4465. 3387,3388c3623,3624
  4466. <       case WHITE_BALANCE_TUNGSTEN:
  4467. <           ce147_buf_set_wb[1] = CAMERA_WHITE_BALANCE_TUNGSTEN;
  4468. ---
  4469. >   case WHITE_BALANCE_TUNGSTEN:
  4470. >       ce147_buf_set_wb[1] = 0x02;
  4471. 3391,3392c3627,3628
  4472. <       case WHITE_BALANCE_FLUORESCENT:
  4473. <           ce147_buf_set_wb[1] = CAMERA_WHITE_BALANCE_FLUORESCENT;
  4474. ---
  4475. >   case WHITE_BALANCE_FLUORESCENT:
  4476. >       ce147_buf_set_wb[1] = 0x03;
  4477. 3395,3397c3631,3634
  4478. <       default:
  4479. <            //pr_warn("%s: white balance mode %d not defined assuming default white balance", __func__, ctrl->value);
  4480. <       break;
  4481. ---
  4482. >   default:
  4483. >       dev_err(&client->dev, "%s: failed: to set_white_balance, "
  4484. >               "enum: %d\n", __func__, ctrl->value);
  4485. >       return -EINVAL;
  4486. 3400,3404c3637,3642
  4487. <   if(wb != WHITE_BALANCE_AUTO)
  4488. <   {
  4489. <       err = ce147_i2c_write_multi(client, CMD_SET_WB, ce147_buf_set_wb, ce147_len_set_wb);
  4490. <       if(err < 0){
  4491. <           dev_err(&client->dev, "%s: failed: i2c_write for white_balance\n", __func__);
  4492. ---
  4493. >   if (ctrl->value != WHITE_BALANCE_AUTO) {
  4494. >       err = ce147_i2c_write_multi(client, CMD_SET_WB,
  4495. >               ce147_buf_set_wb, ce147_len_set_wb);
  4496. >       if (err < 0) {
  4497. >           dev_err(&client->dev, "%s: failed: i2c_write for "
  4498. >                   "white_balance\n", __func__);
  4499. 3408,3410c3646,3650
  4500. <   err = ce147_i2c_write_multi(client, CMD_SET_WB_AUTO, ce147_buf_set_wb_auto, ce147_len_set_wb_auto);
  4501. <   if(err < 0){
  4502. <       dev_err(&client->dev, "%s: failed: i2c_write for white_balance\n", __func__);
  4503. ---
  4504. >   err = ce147_i2c_write_multi(client, CMD_SET_WB_AUTO,
  4505. >           ce147_buf_set_wb_auto, ce147_len_set_wb_auto);
  4506. >   if (err < 0) {
  4507. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4508. >               "white_balance\n", __func__);
  4509. 3413c3653,3661
  4510. <
  4511. ---
  4512. > #if 0 /* remove batch */
  4513. >   err = ce147_get_batch_reflection_status(sd);
  4514. >   if (err < 0) {
  4515. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  4516. >               "reflection_status for white_balance\n",
  4517. >                   __func__);
  4518. >       return -EIO;
  4519. >   }
  4520. > #endif
  4521. 3419c3667
  4522. < static int ce147_set_ev(struct v4l2_subdev *sd, int ev)
  4523. ---
  4524. > static int ce147_set_ev(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4525. 3426c3674
  4526. <   unsigned int ce147_len_set_ev = 2;
  4527. ---
  4528. >   unsigned int ce147_len_set_ev = 2;
  4529. 3429,3432c3677,3679
  4530. <   switch(ev)
  4531. <   {
  4532. <       case EV_MINUS_4:
  4533. <           ce147_buf_set_ev[1] = 0x02;
  4534. ---
  4535. >   switch (ctrl->value) {
  4536. >   case EV_MINUS_4:
  4537. >       ce147_buf_set_ev[1] = 0x02;
  4538. 3435,3436c3682,3683
  4539. <       case EV_MINUS_3:
  4540. <           ce147_buf_set_ev[1] = 0x03;
  4541. ---
  4542. >   case EV_MINUS_3:
  4543. >       ce147_buf_set_ev[1] = 0x03;
  4544. 3439,3440c3686,3687
  4545. <       case EV_MINUS_2:
  4546. <           ce147_buf_set_ev[1] = 0x04;
  4547. ---
  4548. >   case EV_MINUS_2:
  4549. >       ce147_buf_set_ev[1] = 0x04;
  4550. 3443,3444c3690,3691
  4551. <       case EV_MINUS_1:
  4552. <           ce147_buf_set_ev[1] = 0x05;
  4553. ---
  4554. >   case EV_MINUS_1:
  4555. >       ce147_buf_set_ev[1] = 0x05;
  4556. 3447,3448c3694,3695
  4557. <       case EV_DEFAULT:
  4558. <           ce147_buf_set_ev[1] = 0x06;
  4559. ---
  4560. >   case EV_DEFAULT:
  4561. >       ce147_buf_set_ev[1] = 0x06;
  4562. 3451,3452c3698,3699
  4563. <       case EV_PLUS_1:
  4564. <           ce147_buf_set_ev[1] = 0x07;
  4565. ---
  4566. >   case EV_PLUS_1:
  4567. >       ce147_buf_set_ev[1] = 0x07;
  4568. 3455,3460c3702,3703
  4569. <       case EV_PLUS_2:
  4570. <           ce147_buf_set_ev[1] = 0x08;
  4571. <       break;
  4572. <      
  4573. <       case EV_PLUS_3:
  4574. <           ce147_buf_set_ev[1] = 0x09;
  4575. ---
  4576. >   case EV_PLUS_2:
  4577. >       ce147_buf_set_ev[1] = 0x08;
  4578. 3463,3465c3706,3708
  4579. <       case EV_PLUS_4:
  4580. <           ce147_buf_set_ev[1] = 0x0A;
  4581. <       break;         
  4582. ---
  4583. >   case EV_PLUS_3:
  4584. >       ce147_buf_set_ev[1] = 0x09;
  4585. >       break;
  4586. 3467,3469c3710,3711
  4587. <       default:
  4588. <               ce147_buf_set_ev[1] = 0x06;
  4589. <                        // pr_warn("%s: ev mode %d not defined assuming default ev", __func__, ctrl->value);
  4590. ---
  4591. >   case EV_PLUS_4:
  4592. >       ce147_buf_set_ev[1] = 0x0A;
  4593. 3470a3713,3717
  4594. >
  4595. >   default:
  4596. >       dev_err(&client->dev, "%s: failed: to set_ev, enum: %d\n",
  4597. >               __func__, ctrl->value);
  4598. >       return -EINVAL;
  4599. 3473,3475c3720,3721
  4600. <   if(state->hd_preview_on) //This is for HD REC preview
  4601. <   {
  4602. <       ce147_buf_set_ev[1]+=ce147_ev_offset;
  4603. ---
  4604. >   if (state->hd_preview_on) { /* This is for HD REC preview */
  4605. >       ce147_buf_set_ev[1] += ce147_ev_offset;
  4606. 3476a3723,3724
  4607. >   /* pr_debug("ce147_set_ev: set_ev:, data: 0x%02x\n",
  4608. >          ce147_buf_set_ev[1]); */
  4609. 3478,3480c3726,3731
  4610. <   err = ce147_i2c_write_multi(client, CMD_SET_WB, ce147_buf_set_ev, ce147_len_set_ev);
  4611. <   if(err < 0){
  4612. <       dev_err(&client->dev, "%s: failed: i2c_write for set_ev, HD preview(%d)\n", __func__, state->hd_preview_on);
  4613. ---
  4614. >   err = ce147_i2c_write_multi(client, CMD_SET_WB,
  4615. >           ce147_buf_set_ev, ce147_len_set_ev);
  4616. >   if (err < 0) {
  4617. >       dev_err(&client->dev, "%s: failed: i2c_write for set_ev, "
  4618. >               "HD preview(%d)\n",
  4619. >                   __func__, state->hd_preview_on);
  4620. 3482a3734,3741
  4621. > #if 0 /* remove batch */
  4622. >   err = ce147_get_batch_reflection_status(sd);
  4623. >   if (err < 0) {
  4624. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  4625. >               "reflection_status for set_ev\n", __func__);
  4626. >       return -EIO;
  4627. >   }
  4628. > #endif
  4629. 3488,3495c3747
  4630. <
  4631. < #define CAMERA_METERING_MATRIX   0x02
  4632. < #define CAMERA_METERING_CENTER   0x00
  4633. < #define CAMERA_METERING_SPOT     0x01
  4634. < #define CAMERA_METERING_HD       0x03
  4635. < #define CAMERA_METERING_DEFAULT  CAMERA_METERING_MATRIX
  4636. <
  4637. < static int ce147_set_metering(struct v4l2_subdev *sd, int metering)
  4638. ---
  4639. > static int ce147_set_metering(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4640. 3497d3748
  4641. <
  4642. 3504,3509c3755,3772
  4643. <  
  4644. <  
  4645. <   /* when in HD mode we don't care about the other meterings*/
  4646. <   if(state->hd_preview_on)
  4647. <   {
  4648. <       ce147_buf_set_metering[1] = CAMERA_METERING_HD;
  4649. ---
  4650. >
  4651. >   switch (ctrl->value) {
  4652. >   case METERING_MATRIX:
  4653. >       ce147_buf_set_metering[1] = 0x02;
  4654. >       break;
  4655. >
  4656. >   case METERING_CENTER:
  4657. >       ce147_buf_set_metering[1] = 0x00;
  4658. >       break;
  4659. >
  4660. >   case METERING_SPOT:
  4661. >       ce147_buf_set_metering[1] = 0x01;
  4662. >       break;
  4663. >
  4664. >   default:
  4665. >       dev_err(&client->dev, "%s: failed: to set_photometry, "
  4666. >               "enum: %d\n", __func__, ctrl->value);
  4667. >       return -EINVAL;
  4668. 3511,3532d3773
  4669. <   else
  4670. <   {
  4671. <           switch(metering)
  4672. <           {
  4673. <               case METERING_MATRIX:
  4674. <                   ce147_buf_set_metering[1] = CAMERA_METERING_MATRIX;
  4675. <                       break;
  4676. <
  4677. <               case METERING_CENTER:
  4678. <                   ce147_buf_set_metering[1] = CAMERA_METERING_CENTER;
  4679. <                       break;
  4680. <
  4681. <               case METERING_SPOT:
  4682. <                   ce147_buf_set_metering[1] = CAMERA_METERING_SPOT;
  4683. <                       break;
  4684. <
  4685. <               default:
  4686. <                       //default we asume that we want matrix metering
  4687. <                       ce147_buf_set_metering[1] = CAMERA_METERING_DEFAULT;
  4688. <                   //pr_warn("%s: metering mode %d not defined assuming default metering", __func__, ctrl->value);
  4689. <                       break;
  4690. <            }
  4691. 3533a3775,3783
  4692. >   if (state->hd_preview_on)
  4693. >       ce147_buf_set_metering[1] = 0x03;
  4694. >
  4695. >   err = ce147_i2c_write_multi(client, CMD_SET_WB,
  4696. >           ce147_buf_set_metering, ce147_len_set_metering);
  4697. >   if (err < 0) {
  4698. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4699. >               "set_photometry\n", __func__);
  4700. >       return -EIO;
  4701. 3535,3538c3785,3790
  4702. <  
  4703. <   err = ce147_i2c_write_multi(client, CMD_SET_WB, ce147_buf_set_metering, ce147_len_set_metering);
  4704. <   if(err < 0){
  4705. <       dev_err(&client->dev, "%s: failed: i2c_write for set_photometry\n", __func__);
  4706. ---
  4707. > #if 0 /* remove batch */
  4708. >   err = ce147_get_batch_reflection_status(sd);
  4709. >   if (err < 0) {
  4710. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  4711. >               "reflection_status for set_photometry\n",
  4712. >                   __func__);
  4713. 3541c3793
  4714. <  
  4715. ---
  4716. > #endif
  4717. 3547c3799
  4718. < static int ce147_set_iso(struct v4l2_subdev *sd, int iso)
  4719. ---
  4720. > static int ce147_set_iso(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4721. 3555,3561c3807
  4722. <   ce147_msg(&client->dev, "%s: Enter : iso %d\n", __func__, iso);
  4723. <  
  4724. <   switch(iso)
  4725. <   {
  4726. <       case ISO_AUTO:
  4727. <           ce147_buf_set_iso[1] = 0x06;
  4728. <       break;
  4729. ---
  4730. >   ce147_msg(&client->dev, "%s: Enter : iso %d\n", __func__, ctrl->value);
  4731. 3563,3564c3809,3811
  4732. <       case ISO_50:
  4733. <           ce147_buf_set_iso[1] = 0x07;
  4734. ---
  4735. >   switch (ctrl->value) {
  4736. >   case ISO_AUTO:
  4737. >       ce147_buf_set_iso[1] = 0x06;
  4738. 3567,3568c3814,3815
  4739. <       case ISO_100:
  4740. <           ce147_buf_set_iso[1] = 0x08;
  4741. ---
  4742. >   case ISO_50:
  4743. >       ce147_buf_set_iso[1] = 0x07;
  4744. 3571,3572c3818,3819
  4745. <       case ISO_200:
  4746. <           ce147_buf_set_iso[1] = 0x09;
  4747. ---
  4748. >   case ISO_100:
  4749. >       ce147_buf_set_iso[1] = 0x08;
  4750. 3575,3576c3822,3823
  4751. <       case ISO_400:
  4752. <           ce147_buf_set_iso[1] = 0x0A;
  4753. ---
  4754. >   case ISO_200:
  4755. >       ce147_buf_set_iso[1] = 0x09;
  4756. 3579,3580c3826,3827
  4757. <       case ISO_800:
  4758. <           ce147_buf_set_iso[1] = 0x0B;
  4759. ---
  4760. >   case ISO_400:
  4761. >       ce147_buf_set_iso[1] = 0x0A;
  4762. 3583,3584c3830,3831
  4763. <       case ISO_1600:
  4764. <           ce147_buf_set_iso[1] = 0x0C;
  4765. ---
  4766. >   case ISO_800:
  4767. >       ce147_buf_set_iso[1] = 0x0B;
  4768. 3587,3589c3834,3835
  4769. <       /* This is additional setting for Sports' scene mode */
  4770. <       case ISO_SPORTS:
  4771. <           ce147_buf_set_iso[1] = 0x12;
  4772. ---
  4773. >   case ISO_1600:
  4774. >       ce147_buf_set_iso[1] = 0x0C;
  4775. 3591,3594c3837,3840
  4776. <      
  4777. <       /* This is additional setting for 'Night' scene mode */
  4778. <       case ISO_NIGHT:
  4779. <           ce147_buf_set_iso[1] = 0x17;
  4780. ---
  4781. >
  4782. >   /* This is additional setting for Sports' scene mode */
  4783. >   case ISO_SPORTS:
  4784. >       ce147_buf_set_iso[1] = 0x12;
  4785. 3597,3599c3843,3845
  4786. <       /* This is additional setting for video recording mode */
  4787. <       case ISO_MOVIE:
  4788. <           ce147_buf_set_iso[1] = 0x02;
  4789. ---
  4790. >   /* This is additional setting for 'Night' scene mode */
  4791. >   case ISO_NIGHT:
  4792. >       ce147_buf_set_iso[1] = 0x17;
  4793. 3602,3604c3848,3850
  4794. <       default:
  4795. <               ce147_buf_set_iso[1] = 0x06;
  4796. <           //pr_warn("%s: ISO mode %d not defined assuming default ISO", __func__, ctrl->value);
  4797. ---
  4798. >   /* This is additional setting for video recording mode */
  4799. >   case ISO_MOVIE:
  4800. >       ce147_buf_set_iso[1] = 0x02;
  4801. 3605a3852,3856
  4802. >
  4803. >   default:
  4804. >       dev_err(&client->dev, "%s: failed: to set_iso, enum: %d\n",
  4805. >               __func__, ctrl->value);
  4806. >       return -EINVAL;
  4807. 3608,3610c3859,3863
  4808. <   err = ce147_i2c_write_multi(client, CMD_SET_WB, ce147_buf_set_iso, ce147_len_set_iso);
  4809. <   if(err < 0){
  4810. <       dev_err(&client->dev, "%s: failed: i2c_write for set_iso\n", __func__);
  4811. ---
  4812. >   err = ce147_i2c_write_multi(client, CMD_SET_WB,
  4813. >           ce147_buf_set_iso, ce147_len_set_iso);
  4814. >   if (err < 0) {
  4815. >       dev_err(&client->dev, "%s: failed: i2c_write for set_iso\n",
  4816. >               __func__);
  4817. 3613,3614c3866,3875
  4818. <
  4819. <   ce147_msg(&client->dev, "%s: done, iso: 0x%02x\n", __func__, ce147_buf_set_iso[1]);
  4820. ---
  4821. > #if 0 /* remove batch */
  4822. >   err = ce147_get_batch_reflection_status(sd);
  4823. >   if (err < 0) {
  4824. >       dev_err(&client->dev, "%s: failed: ce147_get_batch_"
  4825. >               "reflection_status for set_iso\n", __func__);
  4826. >       return -EIO;
  4827. >   }
  4828. > #endif
  4829. >   ce147_msg(&client->dev, "%s: done, iso: 0x%02x\n",
  4830. >           __func__, ce147_buf_set_iso[1]);
  4831. 3619c3880
  4832. < static int ce147_set_gamma(struct v4l2_subdev *sd, int gamma)
  4833. ---
  4834. > static int ce147_set_gamma(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4835. 3629c3890
  4836. <   unsigned int ce147_len_set_uv = 2;
  4837. ---
  4838. >   unsigned int ce147_len_set_uv = 2;
  4839. 3631,3634c3892,3893
  4840. <   if(gamma == GAMMA_ON)
  4841. <   {
  4842. <       if(state->hd_preview_on)
  4843. <       {
  4844. ---
  4845. >   if (ctrl->value == GAMMA_ON) {
  4846. >       if (state->hd_preview_on) {
  4847. 3639,3643c3898,3903
  4848. <  
  4849. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_gamma, ce147_len_set_gamma);
  4850. <   if(err < 0)
  4851. <   {
  4852. <       dev_err(&client->dev, "%s: failed: i2c_write for ce147_set_gamma\n", __func__);
  4853. ---
  4854. >
  4855. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  4856. >           ce147_buf_set_gamma, ce147_len_set_gamma);
  4857. >   if (err < 0) {
  4858. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4859. >               "ce147_set_gamma\n", __func__);
  4860. 3647,3650c3907,3911
  4861. <   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT, ce147_buf_set_uv, ce147_len_set_uv);
  4862. <   if(err < 0)
  4863. <   {
  4864. <       dev_err(&client->dev, "%s: failed: i2c_write for ce147_set_gamma\n", __func__);
  4865. ---
  4866. >   err = ce147_i2c_write_multi(client, CMD_SET_EFFECT,
  4867. >           ce147_buf_set_uv, ce147_len_set_uv);
  4868. >   if (err < 0) {
  4869. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4870. >               "ce147_set_gamma\n", __func__);
  4871. 3653,3654c3914,3917
  4872. <  
  4873. <   ce147_msg(&client->dev, "%s: done, gamma: 0x%02x, uv: 0x%02x, hd: %d\n", __func__, ce147_buf_set_gamma[1], ce147_buf_set_uv[1], state->hd_preview_on);
  4874. ---
  4875. >
  4876. >   ce147_msg(&client->dev, "%s: done, gamma: 0x%02x, uv: 0x%02x, hd: %d\n",
  4877. >           __func__, ce147_buf_set_gamma[1], ce147_buf_set_uv[1],
  4878. >           state->hd_preview_on);
  4879. 3659c3922
  4880. < static int ce147_set_slow_ae(struct v4l2_subdev *sd, int ae)
  4881. ---
  4882. > static int ce147_set_slow_ae(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  4883. 3668,3671c3931,3932
  4884. <   if(ae == SLOW_AE_ON)
  4885. <   {
  4886. <       if(state->hd_preview_on)
  4887. <       {
  4888. ---
  4889. >   if (ctrl->value == SLOW_AE_ON)
  4890. >       if (state->hd_preview_on)
  4891. 3673,3674d3933
  4892. <       }
  4893. <   }
  4894. 3676,3679c3935,3939
  4895. <   err = ce147_i2c_write_multi(client, CMD_SET_WB, ce147_buf_set_slow_ae, ce147_len_set_slow_ae);
  4896. <   if(err < 0)
  4897. <   {
  4898. <       dev_err(&client->dev, "%s: failed: i2c_write for ce147_set_slow_ae\n", __func__);
  4899. ---
  4900. >   err = ce147_i2c_write_multi(client, CMD_SET_WB,
  4901. >           ce147_buf_set_slow_ae, ce147_len_set_slow_ae);
  4902. >   if (err < 0) {
  4903. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4904. >               "ce147_set_slow_ae\n", __func__);
  4905. 3682,3683c3942,3945
  4906. <  
  4907. <   ce147_msg(&client->dev, "%s: done, slow_ae: 0x%02x, hd: %d\n", __func__, ce147_buf_set_slow_ae[1], state->hd_preview_on);
  4908. ---
  4909. >
  4910. >   ce147_msg(&client->dev, "%s: done, slow_ae: 0x%02x, hd: %d\n",
  4911. >           __func__, ce147_buf_set_slow_ae[1],
  4912. >           state->hd_preview_on);
  4913. 3687,3688c3949,3951
  4914. <  
  4915. < static int ce147_set_face_lock(struct v4l2_subdev *sd, int face_lock)
  4916. ---
  4917. >
  4918. > static int ce147_set_face_lock(struct v4l2_subdev *sd,
  4919. >                   struct v4l2_control *ctrl)
  4920. 3695,3699c3958,3961
  4921. <  
  4922. <   switch(face_lock)
  4923. <   {
  4924. <       case FACE_LOCK_ON:
  4925. <           ce147_buf_set_fd_lock[0] = 0x01;
  4926. ---
  4927. >
  4928. >   switch (ctrl->value) {
  4929. >   case FACE_LOCK_ON:
  4930. >       ce147_buf_set_fd_lock[0] = 0x01;
  4931. 3702,3703c3964,3965
  4932. <       case FIRST_FACE_TRACKING:
  4933. <           ce147_buf_set_fd_lock[0] = 0x02;
  4934. ---
  4935. >   case FIRST_FACE_TRACKING:
  4936. >       ce147_buf_set_fd_lock[0] = 0x02;
  4937. 3706,3708c3968,3970
  4938. <       case FACE_LOCK_OFF:
  4939. <       default:
  4940. <           ce147_buf_set_fd_lock[0] = 0x00;
  4941. ---
  4942. >   case FACE_LOCK_OFF:
  4943. >   default:
  4944. >       ce147_buf_set_fd_lock[0] = 0x00;
  4945. 3711,3714c3973,3978
  4946. <  
  4947. <   err = ce147_i2c_write_multi(client, CMD_SET_FACE_LOCK, ce147_buf_set_fd_lock, ce147_len_set_fd_lock);
  4948. <   if(err < 0){
  4949. <       dev_err(&client->dev, "%s: failed: i2c_write for face_lock\n", __func__);
  4950. ---
  4951. >
  4952. >   err = ce147_i2c_write_multi(client, CMD_SET_FACE_LOCK,
  4953. >           ce147_buf_set_fd_lock, ce147_len_set_fd_lock);
  4954. >   if (err < 0) {
  4955. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4956. >               "face_lock\n", __func__);
  4957. 3723c3987,3988
  4958. < static int ce147_set_auto_focus(struct v4l2_subdev *sd, int auto_focus)
  4959. ---
  4960. > static int ce147_start_auto_focus(struct v4l2_subdev *sd,
  4961. >                   struct v4l2_control *ctrl)
  4962. 3727d3991
  4963. <
  4964. 3729c3993,3994
  4965. <   unsigned int ce147_len_set_af = 1;
  4966. ---
  4967. >   unsigned int ce147_len_set_af = 1;
  4968. >   struct ce147_state *state = to_state(sd);
  4969. 3731,3747c3996,4007
  4970. <   if (auto_focus)
  4971. <   {
  4972. <       //start af
  4973. <       err = ce147_i2c_write_multi(client, CMD_START_AUTO_FOCUS_SEARCH, ce147_buf_set_af, ce147_len_set_af);
  4974. <       if(err < 0){
  4975. <           dev_err(&client->dev, "%s: failed: i2c_write for auto_focus\n", __func__);
  4976. <           return -EIO;
  4977. <       }
  4978. <   }
  4979. <   else
  4980. <   {
  4981. <       //stop af
  4982. <       err = ce147_i2c_write_multi(client, CMD_STOP_LENS_MOVEMENT, ce147_buf_set_af, ce147_len_set_af);
  4983. <       if(err < 0){
  4984. <           dev_err(&client->dev, "%s: failed: i2c_write for auto_focus\n", __func__);
  4985. <           return -EIO;
  4986. <       }
  4987. ---
  4988. >   ce147_msg(&client->dev, "%s\n", __func__);
  4989. >
  4990. >   /* start af */
  4991. >   err = ce147_i2c_write_multi(client, CMD_START_AUTO_FOCUS_SEARCH,
  4992. >           ce147_buf_set_af, ce147_len_set_af);
  4993. >   state->af_status = AF_START;
  4994. >   INIT_COMPLETION(state->af_complete);
  4995. >
  4996. >   if (err < 0) {
  4997. >       dev_err(&client->dev, "%s: failed: i2c_write for "
  4998. >               "auto_focus\n", __func__);
  4999. >       return -EIO;
  5000. 3751c4011
  5001. <   }
  5002. ---
  5003. > }
  5004. 3753,3756c4013,4014
  5005. < static int ce147_get_auto_focus_status(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
  5006. <   {
  5007. <   int err;
  5008. <   unsigned char ce147_buf_get_af_status[1] = { 0x00 };
  5009. ---
  5010. > static int ce147_stop_auto_focus(struct v4l2_subdev *sd)
  5011. > {
  5012. 3757a4016,4034
  5013. >   struct ce147_state *state = to_state(sd);
  5014. >   int err;
  5015. >   unsigned char ce147_buf_set_af = 0x00;
  5016. >
  5017. >   ce147_msg(&client->dev, "%s\n", __func__);
  5018. >   /* stop af */
  5019. >   err = ce147_i2c_write_multi(client, CMD_STOP_LENS_MOVEMENT,
  5020. >           &ce147_buf_set_af, 1);
  5021. >   if (err < 0)
  5022. >       dev_err(&client->dev, "%s: failed: i2c_write for auto_focus\n",
  5023. >               __func__);
  5024. >
  5025. >   if (state->af_status != AF_START) {
  5026. >       /* we weren't in the middle auto focus operation, we're done */
  5027. >       dev_dbg(&client->dev,
  5028. >           "%s: auto focus not in progress, done\n", __func__);
  5029. >
  5030. >       return 0;
  5031. >   }
  5032. 3759c4036,4048
  5033. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  5034. ---
  5035. >   state->af_status = AF_CANCEL;
  5036. >
  5037. >   mutex_unlock(&state->ctrl_lock);
  5038. >   wait_for_completion(&state->af_complete);
  5039. >   mutex_lock(&state->ctrl_lock);
  5040. >
  5041. >   return err;
  5042. > }
  5043. >
  5044. > static int ce147_get_auto_focus_status(struct v4l2_subdev *sd,
  5045. >                   struct v4l2_control *ctrl)
  5046. > {
  5047. >   struct i2c_client *client = v4l2_get_subdevdata(sd);
  5048. 3761c4050,4092
  5049. < #endif
  5050. ---
  5051. >   unsigned char ce147_buf_get_af_status[1] = { 0x00 };
  5052. >   int count;
  5053. >   int err;
  5054. >
  5055. >   ce147_msg(&client->dev, "%s\n", __func__);
  5056. >
  5057. >   if (state->af_status == AF_NONE) {
  5058. >       dev_err(&client->dev,
  5059. >               "%s: auto focus never started, returning 0x2\n",
  5060. >               __func__);
  5061. >       pr_debug("%s: AUTO_FOCUS_CANCELLED\n", __func__);
  5062. >       ctrl->value = AUTO_FOCUS_CANCELLED;
  5063. >       return 0;
  5064. >   }
  5065. >
  5066. >   /* status check whether AF searching is successful or not */
  5067. >   for (count = 0; count < 600; count++) {
  5068. >       mutex_unlock(&state->ctrl_lock);
  5069. >       msleep(10);
  5070. >       mutex_lock(&state->ctrl_lock);
  5071. >
  5072. >       if (state->af_status == AF_CANCEL) {
  5073. >           dev_err(&client->dev,
  5074. >               "%s: AF is cancelled while doing\n", __func__);
  5075. >           ctrl->value = AUTO_FOCUS_CANCELLED;
  5076. >           goto out;
  5077. >       }
  5078. >
  5079. >       ce147_buf_get_af_status[0] = 0xFF;
  5080. >       err = ce147_i2c_read_multi(client,
  5081. >               CMD_CHECK_AUTO_FOCUS_SEARCH, NULL, 0,
  5082. >               ce147_buf_get_af_status, 1);
  5083. >       if (err < 0) {
  5084. >           dev_err(&client->dev, "%s: failed: i2c_read "
  5085. >                   "for auto_focus\n", __func__);
  5086. >           return -EIO;
  5087. >       }
  5088. >       if (ce147_buf_get_af_status[0] == 0x05)
  5089. >           continue;
  5090. >       if (ce147_buf_get_af_status[0] == 0x00
  5091. >               || ce147_buf_get_af_status[0] == 0x02
  5092. >               || ce147_buf_get_af_status[0] == 0x04)
  5093. >           break;
  5094. 3763,3779c4094,4103
  5095. <   ce147_buf_get_af_status[0] = 0xFF;
  5096. <   err = ce147_i2c_read_multi(client, CMD_CHECK_AUTO_FOCUS_SEARCH, NULL, 0, ce147_buf_get_af_status, 1);
  5097. <   if(err < 0){
  5098. <       dev_err(&client->dev, "%s: failed: i2c_read for auto_focus_status\n", __func__);
  5099. <       return -EIO;
  5100. <   }  
  5101. <   ctrl->value = ce147_buf_get_af_status[0];
  5102. <
  5103. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  5104. <         if((ctrl->value == 2)&& !state->disable_aeawb_lock)
  5105. <         {
  5106. <           err = ce147_set_awb_lock(sd, 1);
  5107. <           if(err < 0){
  5108. <               dev_err(&client->dev, "%s: failed: ce147_set_awb_lock, err %d\n", __func__, err);
  5109. <               return -EIO;
  5110. <           }            
  5111. <         }
  5112. ---
  5113. > #if defined(CONFIG_ARIES_NTT) /* Modify   NTTS1 */
  5114. >       if ((ctrl->value == 2) && !state->disable_aeawb_lock) {
  5115. >           err = ce147_set_awb_lock(sd, 1);
  5116. >           if (err < 0) {
  5117. >               dev_err(&client->dev, "%s: failed: "
  5118. >                       "ce147_set_awb_lock, err %d\n",
  5119. >                       __func__, err);
  5120. >               return -EIO;
  5121. >           }
  5122. >       }
  5123. 3780a4105,4120
  5124. >   }
  5125. >
  5126. >   ctrl->value = FOCUS_MODE_AUTO_DEFAULT;
  5127. >
  5128. >   if (ce147_buf_get_af_status[0] == 0x02) {
  5129. >       ctrl->value = AUTO_FOCUS_DONE;
  5130. >   } else {
  5131. >       ce147_set_focus_mode(sd, ctrl);
  5132. >       ctrl->value = AUTO_FOCUS_FAILED;
  5133. >       goto out;
  5134. >   }
  5135. >   ce147_msg(&client->dev, "%s: done\n", __func__);
  5136. >
  5137. > out:
  5138. >   state->af_status = AF_NONE;
  5139. >   complete(&state->af_complete);
  5140. 3782c4122
  5141. <   //printk("ce147_get_auto_focus_status is called");
  5142. ---
  5143. >   /* pr_debug("ce147_get_auto_focus_status is called"); */
  5144. 3795,3797c4135,4137
  5145. <   state->framesize_index = CE147_PREVIEW_VGA;
  5146. <   state->fps = 30; /* Default value */
  5147. <  
  5148. ---
  5149. >   /* state->framesize_index = CE147_PREVIEW_VGA; */
  5150. >   /*state->fps = 30;*/ /* Default value */
  5151. >
  5152. 3815,3818c4155,4159
  5153. <     if(err < 0){
  5154. <           dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n", __func__);
  5155. <           return -EIO;
  5156. <     }
  5157. ---
  5158. >   if (err < 0) {
  5159. >       dev_err(&client->dev, "%s: failed: ce147_power_en(on)\n",
  5160. >               __func__);
  5161. >       return -EIO;
  5162. >   }
  5163. 3821,3822c4162,4164
  5164. <   if(err < 0){
  5165. <       dev_err(&client->dev, "%s: Failed: Camera Initialization\n", __func__);
  5166. ---
  5167. >   if (err < 0) {
  5168. >       dev_err(&client->dev, "%s: Failed: Camera Initialization\n",
  5169. >               __func__);
  5170. 3825,3827c4167,4169
  5171. <  
  5172. <   //printk("ce147_get_fw_data: ce147_load_fw is ok\n");  
  5173. <  
  5174. ---
  5175. >
  5176. >   /* pr_debug("ce147_get_fw_data: ce147_load_fw is ok\n"); */
  5177. >
  5178. 3830c4172
  5179. <   //printk("ce147_get_fw_data: ce147_init_parameters is ok\n");
  5180. ---
  5181. >   /* pr_debug("ce147_get_fw_data: ce147_init_parameters is ok\n"); */
  5182. 3833,3834c4175,4177
  5183. <   if(err < 0){
  5184. <       dev_err(&client->dev, "%s: Failed: Reading firmware version\n",__func__);
  5185. ---
  5186. >   if (err < 0) {
  5187. >       dev_err(&client->dev, "%s: Failed: Reading firmware version\n",
  5188. >               __func__);
  5189. 3838c4181
  5190. <   //printk("ce147_get_fw_data: ce147_get_fw_version is ok\n");
  5191. ---
  5192. >   /* pr_debug("ce147_get_fw_data: ce147_get_fw_version is ok\n"); */
  5193. 3841,3842c4184,4186
  5194. <   if(err < 0){
  5195. <       dev_err(&client->dev, "%s: Failed: Reading dateinfo\n",__func__);
  5196. ---
  5197. >   if (err < 0) {
  5198. >       dev_err(&client->dev, "%s: Failed: Reading dateinfo\n",
  5199. >               __func__);
  5200. 3846c4190
  5201. <   //printk("ce147_get_fw_data: ce147_get_dateinfo is ok\n");
  5202. ---
  5203. >   /* pr_debug("ce147_get_fw_data: ce147_get_dateinfo is ok\n"); */
  5204. 3849,3850c4193,4195
  5205. <   if(err < 0){
  5206. <       dev_err(&client->dev, "%s: Failed: Reading sensor info\n",__func__);
  5207. ---
  5208. >   if (err < 0) {
  5209. >       dev_err(&client->dev, "%s: Failed: Reading sensor info\n",
  5210. >               __func__);
  5211. 3854c4199
  5212. <   //printk("ce147_get_fw_data: ce147_get_sensor_version is ok\n");
  5213. ---
  5214. >   /* pr_debug("ce147_get_fw_data: ce147_get_sensor_version is ok\n"); */
  5215. 3857,3858c4202,4204
  5216. <   if(err < 0){
  5217. <       dev_err(&client->dev, "%s: Failed: Reading maker info\n",__func__);
  5218. ---
  5219. >   if (err < 0) {
  5220. >       dev_err(&client->dev, "%s: Failed: Reading maker info\n",
  5221. >               __func__);
  5222. 3863,3864c4209,4211
  5223. <   if(err < 0){
  5224. <       dev_err(&client->dev, "%s: Failed: Reading af info\n",__func__);
  5225. ---
  5226. >   if (err < 0) {
  5227. >       dev_err(&client->dev, "%s: Failed: Reading af info\n",
  5228. >               __func__);
  5229. 3869,3870c4216,4218
  5230. <   if(err < 0){
  5231. <       dev_err(&client->dev, "%s: Failed: Reading camera gamma info\n",__func__);
  5232. ---
  5233. >   if (err < 0) {
  5234. >       dev_err(&client->dev, "%s: Failed: Reading camera gamma info\n",
  5235. >               __func__);
  5236. 3875,3878c4223,4227
  5237. <     if(err < 0){ 
  5238. <           dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n", __func__);
  5239. <           return -EIO;
  5240. <     }
  5241. ---
  5242. >   if (err < 0) {
  5243. >       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n",
  5244. >               __func__);
  5245. >       return -EIO;
  5246. >   }
  5247. 3880c4229
  5248. <   //printk("ce147_get_fw_data: ce147_power_en is ok\n");
  5249. ---
  5250. >   /* pr_debug("ce147_get_fw_data: ce147_power_en is ok\n"); */
  5251. 3882,3885c4231,4239
  5252. <   ce147_info(&client->dev, "FW  Version: %d.%d\n", state->fw.major, state->fw.minor);
  5253. <   ce147_info(&client->dev, "PRM Version: %d.%d\n", state->prm.major, state->prm.minor);
  5254. <   ce147_info(&client->dev, "Date(y.m.d): %d.%d.%d\n", state->dateinfo.year, state->dateinfo.month, state->dateinfo.date);
  5255. <   ce147_info(&client->dev, "Sensor version: %d\n", state->sensor_version);
  5256. ---
  5257. >   ce147_info(&client->dev, "FW  Version: %d.%d\n",
  5258. >           state->fw.major, state->fw.minor);
  5259. >   ce147_info(&client->dev, "PRM Version: %d.%d\n",
  5260. >           state->prm.major, state->prm.minor);
  5261. >   ce147_info(&client->dev, "Date(y.m.d): %d.%d.%d\n",
  5262. >           state->dateinfo.year, state->dateinfo.month,
  5263. >           state->dateinfo.date);
  5264. >   ce147_info(&client->dev, "Sensor version: %d\n",
  5265. >           state->sensor_version);
  5266. 3890c4244
  5267. < //s1_camera [ Defense process by ESD input ] _[
  5268. ---
  5269. > /* s1_camera [ Defense process by ESD input ] _[ */
  5270. 3896c4250
  5271. <   dev_err(&client->dev, "%s: Enter \n", __func__);
  5272. ---
  5273. >   dev_err(&client->dev, "%s: Enter\n", __func__);
  5274. 3899,3900c4253,4255
  5275. <   if(err < 0){
  5276. <       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n", __func__);
  5277. ---
  5278. >   if (err < 0) {
  5279. >       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n",
  5280. >               __func__);
  5281. 3902c4257
  5282. <       }
  5283. ---
  5284. >   }
  5285. 3907,3908c4262,4264
  5286. <   if(err < 0){
  5287. <       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n", __func__);
  5288. ---
  5289. >   if (err < 0) {
  5290. >       dev_err(&client->dev, "%s: failed: ce147_power_en(off)\n",
  5291. >               __func__);
  5292. 3910c4266
  5293. <       }
  5294. ---
  5295. >   }
  5296. 3912,3914c4268,4271
  5297. <   err = ce147_load_fw(sd);        //ce147_init(sd);
  5298. <   if(err < 0){
  5299. <       dev_err(&client->dev, "%s: Failed: Camera Initialization\n", __func__);
  5300. ---
  5301. >   err = ce147_load_fw(sd);        /* ce147_init(sd); */
  5302. >   if (err < 0) {
  5303. >       dev_err(&client->dev, "%s: Failed: Camera Initialization\n",
  5304. >               __func__);
  5305. 3920c4277
  5306. < // _]
  5307. ---
  5308. > /* _] */
  5309. 3934c4291
  5310. <       .type = V4L2_CTRL_TYPE_MENU,
  5311. ---
  5312. >       .type = V4L2_CTRL_TYPE_MENU,
  5313. 3938c4295
  5314. <       .step = 1,
  5315. ---
  5316. >       .step = 1,
  5317. 3974c4331,4332
  5318. <           memcpy(qc, &ce147_controls[i], sizeof(struct v4l2_queryctrl));
  5319. ---
  5320. >           memcpy(qc, &ce147_controls[i],
  5321. >                   sizeof(struct v4l2_queryctrl));
  5322. 3989c4347
  5323. <   return v4l2_ctrl_query_menu(qm, &qctrl, ce147_ctrl_get_menu(qm->id));
  5324. ---
  5325. >   return v4l2_ctrl_query_menu(qm, &qctrl, ce147_ctrl_get_menu(qm->id));
  5326. 3994c4352
  5327. <  * Configure expected MCLK from host and return EINVAL if not supported clock
  5328. ---
  5329. >  * Configure expected MCLK from   host and return EINVAL if not supportedclock
  5330. 3996,3997c4354,4355
  5331. <  *    freq : in Hz
  5332. <  *    flag : not supported for now
  5333. ---
  5334. >  *    freq : in Hz
  5335. >  *    flag : not supported for now
  5336. 4014,4015c4372,4374
  5337. < static int ce147_set_framesize_index(struct v4l2_subdev *sd, unsigned int index);
  5338. < /* Information received:
  5339. ---
  5340. > static int ce147_set_framesize_index(struct v4l2_subdev *sd,
  5341. >                   unsigned int index);
  5342. > /* Information received:
  5343. 4017c4376
  5344. <  * pixel_format -> to be handled in the upper layer
  5345. ---
  5346. >  * pixel_format -> to be handled in the   upper layer
  5347. 4027,4028c4386,4389
  5348. <   if(fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG && fmt->fmt.pix.colorspace != V4L2_COLORSPACE_JPEG){
  5349. <       dev_err(&client->dev, "%s: mismatch in pixelformat and colorspace\n", __func__);
  5350. ---
  5351. >   if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG
  5352. >           && fmt->fmt.pix.colorspace != V4L2_COLORSPACE_JPEG) {
  5353. >       dev_err(&client->dev, "%s: mismatch in pixelformat and "
  5354. >               "colorspace\n", __func__);
  5355. 4032,4041c4393,4394
  5356. <   if(fmt->fmt.pix.width == 800 && fmt->fmt.pix.height == 448) {
  5357. <       state->pix.width = 1280;
  5358. <       state->pix.height = 720;
  5359. <   }
  5360. <
  5361. <   else {
  5362. <       state->pix.width = fmt->fmt.pix.width;
  5363. <       state->pix.height = fmt->fmt.pix.height;
  5364. <   }
  5365. <  
  5366. ---
  5367. >   state->pix.width = fmt->fmt.pix.width;
  5368. >   state->pix.height = fmt->fmt.pix.height;
  5369. 4044c4397
  5370. <   if(fmt->fmt.pix.colorspace == V4L2_COLORSPACE_JPEG)
  5371. ---
  5372. >   if (fmt->fmt.pix.colorspace == V4L2_COLORSPACE_JPEG)
  5373. 4047c4400
  5374. <       state->oprmode = CE147_OPRMODE_VIDEO;
  5375. ---
  5376. >       state->oprmode = CE147_OPRMODE_VIDEO;
  5377. 4048a4402
  5378. >   framesize_index = ce147_get_framesize_index(sd);
  5379. 4050c4404,4405
  5380. <   framesize_index = ce147_get_framesize_index(sd);
  5381. ---
  5382. >   ce147_msg(&client->dev, "%s:framesize_index = %d\n",
  5383. >              __func__, framesize_index);
  5384. 4052,4053d4406
  5385. <   ce147_msg(&client->dev, "%s:framesize_index = %d\n", __func__, framesize_index);
  5386. <  
  5387. 4055,4056c4408,4410
  5388. <   if(err < 0){
  5389. <       dev_err(&client->dev, "%s: set_framesize_index failed\n", __func__);
  5390. ---
  5391. >   if (err < 0) {
  5392. >       dev_err(&client->dev, "%s: set_framesize_index failed\n",
  5393. >                 __func__);
  5394. 4060c4414
  5395. <   if(state->pix.pixelformat == V4L2_PIX_FMT_JPEG){
  5396. ---
  5397. >   if (state->pix.pixelformat == V4L2_PIX_FMT_JPEG)
  5398. 4062c4416
  5399. <   } else {
  5400. ---
  5401. >   else
  5402. 4064d4417
  5403. <   }
  5404. 4066,4069c4419,4420
  5405. <   if(state->oprmode == CE147_OPRMODE_VIDEO)
  5406. <   {
  5407. <       if(framesize_index == CE147_PREVIEW_720P)
  5408. <       {
  5409. ---
  5410. >   if (state->oprmode == CE147_OPRMODE_VIDEO) {
  5411. >       if (framesize_index == CE147_PREVIEW_720P)
  5412. 4071d4421
  5413. <       }
  5414. 4073d4422
  5415. <       {
  5416. 4075d4423
  5417. <       }
  5418. 4076a4425
  5419. >
  5420. 4080c4429
  5421. < static int ce147_enum_framesizes(struct v4l2_subdev *sd, \
  5422. ---
  5423. > static int ce147_enum_framesizes(struct   v4l2_subdev *sd,
  5424. 4084,4085c4433,4435
  5425. <   int num_entries = sizeof(ce147_framesize_list)/sizeof(struct ce147_enum_framesize);
  5426. <   struct ce147_enum_framesize *elem; 
  5427. ---
  5428. >   int num_entries = sizeof(ce147_framesize_list)
  5429. >               / sizeof(struct ce147_enum_framesize);
  5430. >   struct ce147_enum_framesize *elem;
  5431. 4089,4093c4439,4443
  5432. <   /* The camera interface should read this value, this is the resolution
  5433. <    * at which the sensor would provide framedata to the camera i/f
  5434. <    *
  5435. <    * In case of image capture, this returns the default camera resolution (VGA)
  5436. <    */
  5437. ---
  5438. >   /* The camera interface should read this value, this is the resolution
  5439. >    * at which the sensor would provide framedata to the camera i/f
  5440. >    * In case of image capture,
  5441. >    * this returns the default camera resolution (VGA)
  5442. >    */
  5443. 4096,4100c4446,4449
  5444. <   if(state->pix.pixelformat == V4L2_PIX_FMT_JPEG){
  5445. <       index = CE147_PREVIEW_VGA;
  5446. <   } else {
  5447. <       index = state->framesize_index;
  5448. <   }
  5449. ---
  5450. >   if (state->pix.pixelformat == V4L2_PIX_FMT_JPEG)
  5451. >       index = CE147_PREVIEW_VGA;
  5452. >   else
  5453. >       index = state->framesize_index;
  5454. 4102c4451
  5455. <   for(i = 0; i < num_entries; i++){
  5456. ---
  5457. >   for (i = 0; i < num_entries; i++) {
  5458. 4104,4106c4453,4457
  5459. <       if(elem->index == index){
  5460. <           fsize->discrete.width = ce147_framesize_list[index].width;
  5461. <           fsize->discrete.height = ce147_framesize_list[index].height;
  5462. ---
  5463. >       if (elem->index == index) {
  5464. >           fsize->discrete.width =
  5465. >               ce147_framesize_list[index].width;
  5466. >           fsize->discrete.height =
  5467. >               ce147_framesize_list[index].height;
  5468. 4114c4465
  5469. < static int ce147_enum_frameintervals(struct v4l2_subdev *sd,
  5470. ---
  5471. > static int ce147_enum_frameintervals(struct v4l2_subdev *sd,
  5472. 4126c4477
  5473. <   num_entries = sizeof(capture_fmts)/sizeof(struct v4l2_fmtdesc);
  5474. ---
  5475. >   num_entries = sizeof(capture_fmts) / sizeof(struct v4l2_fmtdesc);
  5476. 4128c4479
  5477. <   if(fmtdesc->index >= num_entries)
  5478. ---
  5479. >   if (fmtdesc->index >= num_entries)
  5480. 4131,4132c4482,4483
  5481. <         memset(fmtdesc, 0, sizeof(*fmtdesc));
  5482. <         memcpy(fmtdesc, &capture_fmts[fmtdesc->index], sizeof(*fmtdesc));
  5483. ---
  5484. >   memset(fmtdesc, 0, sizeof(*fmtdesc));
  5485. >   memcpy(fmtdesc, &capture_fmts[fmtdesc->index], sizeof(*fmtdesc));
  5486. 4142c4493
  5487. <   num_entries = sizeof(capture_fmts)/sizeof(struct v4l2_fmtdesc);
  5488. ---
  5489. >   num_entries = sizeof(capture_fmts) / sizeof(struct v4l2_fmtdesc);
  5490. 4144,4145c4495,4496
  5491. <   for(i = 0; i < num_entries; i++){
  5492. <       if(capture_fmts[i].pixelformat == fmt->fmt.pix.pixelformat)
  5493. ---
  5494. >   for (i = 0; i < num_entries; i++) {
  5495. >       if (capture_fmts[i].pixelformat == fmt->fmt.pix.pixelformat)
  5496. 4147c4498
  5497. <   }
  5498. ---
  5499. >   }
  5500. 4173,4175c4524,4528
  5501. <   if(param->parm.capture.timeperframe.numerator != state->strm.parm.capture.timeperframe.numerator ||
  5502. <           param->parm.capture.timeperframe.denominator != state->strm.parm.capture.timeperframe.denominator){
  5503. <      
  5504. ---
  5505. >   if (param->parm.capture.timeperframe.numerator
  5506. >           != state->strm.parm.capture.timeperframe.numerator
  5507. >       || param->parm.capture.timeperframe.denominator
  5508. >           != state->strm.parm.capture.timeperframe.denominator) {
  5509. >
  5510. 4179,4181c4532,4537
  5511. <       if(param->parm.capture.timeperframe.numerator && param->parm.capture.timeperframe.denominator)
  5512. <           fps = (int)(param->parm.capture.timeperframe.denominator/param->parm.capture.timeperframe.numerator);
  5513. <       else
  5514. ---
  5515. >       if (param->parm.capture.timeperframe.numerator
  5516. >               && param->parm.capture.timeperframe.denominator)
  5517. >           fps = (int)(param->parm.capture.timeperframe.denominator
  5518. >                   / param->parm.capture
  5519. >                   .timeperframe.numerator);
  5520. >       else
  5521. 4184,4185c4540,4543
  5522. <       if(fps <= 0 || fps > fps_max){
  5523. <           dev_err(&client->dev, "%s: Framerate %d not supported, setting it to %d fps.\n",__func__, fps, fps_max);
  5524. ---
  5525. >       if (fps <= 0 || fps > fps_max) {
  5526. >           dev_err(&client->dev, "%s: Framerate %d not supported, "
  5527. >                   "setting it to %d fps.\n",
  5528. >                   __func__, fps, fps_max);
  5529. 4189,4191c4547,4549
  5530. <       param->parm.capture.timeperframe.numerator = 1;
  5531. <       param->parm.capture.timeperframe.denominator = fps;
  5532. <  
  5533. ---
  5534. >       state->strm.parm.capture.timeperframe.numerator = 1;
  5535. >       state->strm.parm.capture.timeperframe.denominator = fps;
  5536. >
  5537. 4195,4197c4553,4556
  5538. <   /* Don't set the fps value, just update it in the state
  5539. <    * We will set the resolution and fps in the start operation (preview/capture) call */
  5540. <  
  5541. ---
  5542. >   /* Don't set the fps value, just update it in the state
  5543. >    * We will set the resolution and fps in the start operation
  5544. >    * (preview/capture) call */
  5545. >
  5546. 4201c4560
  5547. < /* This function is called from the g_ctrl api
  5548. ---
  5549. > /* This   function is called from the g_ctrl api
  5550. 4203c4562
  5551. <  * This function should be called only after the s_fmt call,
  5552. ---
  5553. >  * This   function should be called only after the s_fmt call,
  5554. 4206,4207c4565,4566
  5555. <  * It checks a list of available frame sizes and returns the
  5556. <  * most appropriate index of the frame size.
  5557. ---
  5558. >  * It checks a list of available frame sizes and returns the
  5559. >  * most   appropriate index of the frame size.
  5560. 4211c4570
  5561. <  * done to add additional layer of error checking.
  5562. ---
  5563. >  * done   to add additional layer of error checking.
  5564. 4214c4573
  5565. <  * Hene the first entry (searching from the beginning) where both the
  5566. ---
  5567. >  * Hene   the first entry (searching from the beginning) where both the
  5568. 4223c4582
  5569. <   int i = 0;
  5570. ---
  5571. >   int i = 0;
  5572. 4228c4587,4588
  5573. <   ce147_msg(&client->dev, "%s: Requested Res: %dx%d\n", __func__, state->pix.width, state->pix.height);
  5574. ---
  5575. >   ce147_msg(&client->dev, "%s: Requested Res: %dx%d\n",
  5576. >           __func__, state->pix.width, state->pix.height);
  5577. 4231,4233c4591,4593
  5578. <   for(i = 0; i < (sizeof(ce147_framesize_list)/sizeof(struct ce147_enum_framesize)); i++)
  5579. <   {
  5580. <       frmsize = &ce147_framesize_list[i];
  5581. ---
  5582. >   for (i = 0; i < (sizeof(ce147_framesize_list)
  5583. >               / sizeof(struct ce147_enum_framesize)); i++) {
  5584. >       frmsize = &ce147_framesize_list[i];
  5585. 4235c4595
  5586. <       if(frmsize->mode != state->oprmode)
  5587. ---
  5588. >       if (frmsize->mode != state->oprmode)
  5589. 4238,4245c4598,4612
  5590. <       if(state->oprmode == CE147_OPRMODE_IMAGE)
  5591. <       {
  5592. <           /* In case of image capture mode, if the given image resolution is not supported,
  5593. <            * return the next higher image resolution. */
  5594. <           //printk("frmsize->width(%d) state->pix.width(%d) frmsize->height(%d) state->pix.height(%d)\n", frmsize->width, state->pix.width, frmsize->height, state->pix.height);
  5595. <           if(frmsize->width == state->pix.width && frmsize->height == state->pix.height)
  5596. <           {
  5597. <               //printk("frmsize->index(%d) \n", frmsize->index);
  5598. ---
  5599. >       if (state->oprmode == CE147_OPRMODE_IMAGE) {
  5600. >           /* In case of image capture mode,
  5601. >            * if the given image resolution is not supported,
  5602. >            * return the next higher image resolution. */
  5603. >           /* pr_debug("frmsize->width(%d) state->pix.width(%d) "
  5604. >                   "frmsize->height(%d) "
  5605. >                   "state->pix.height(%d)\n",
  5606. >                       frmsize->width,
  5607. >                       state->pix.width,
  5608. >                       frmsize->height,
  5609. >                       state->pix.height); */
  5610. >           if (frmsize->width == state->pix.width
  5611. >               && frmsize->height == state->pix.height) {
  5612. >               /* pr_debug("frmsize->index(%d)\n",
  5613. >                       frmsize->index); */
  5614. 4248,4257c4615,4630
  5615. <       }
  5616. <       else
  5617. <       {
  5618. <           /* In case of video mode, if the given video resolution is not matching, use
  5619. <            * the default rate (currently CE147_PREVIEW_VGA).
  5620. <            */      
  5621. <           //printk("frmsize->width(%d) state->pix.width(%d) frmsize->height(%d) state->pix.height(%d)\n", frmsize->width, state->pix.width, frmsize->height, state->pix.height);
  5622. <           if(frmsize->width == state->pix.width && frmsize->height == state->pix.height)
  5623. <           {
  5624. <               //printk("frmsize->index(%d) \n", frmsize->index);
  5625. ---
  5626. >       } else {
  5627. >           /* In case of video mode,
  5628. >            * if the given video resolution is not matching, use
  5629. >            * the default rate (currently CE147_PREVIEW_VGA).
  5630. >            */
  5631. >           /* pr_debug("frmsize->width(%d) state->pix.width(%d) "
  5632. >                   "frmsize->height(%d) "
  5633. >                   "state->pix.height(%d)\n",
  5634. >                       frmsize->width,
  5635. >                       state->pix.width,
  5636. >                       frmsize->height,
  5637. >                       state->pix.height); */
  5638. >           if (frmsize->width == state->pix.width
  5639. >               && frmsize->height == state->pix.height) {
  5640. >               /* pr_debug("frmsize->index(%d)\n",
  5641. >                          frmsize->index); */
  5642. 4258a4632
  5643. >           }
  5644. 4260,4261c4634
  5645. <   }
  5646. <   }
  5647. ---
  5648. >   }
  5649. 4263c4636,4637
  5650. <   return (state->oprmode == CE147_OPRMODE_IMAGE) ? CE147_CAPTURE_3MP : CE147_PREVIEW_VGA;
  5651. ---
  5652. >   return (state->oprmode == CE147_OPRMODE_IMAGE)
  5653. >           ? CE147_CAPTURE_3MP : CE147_PREVIEW_VGA;
  5654. 4267c4641
  5655. < /* This function is called from the s_ctrl api
  5656. ---
  5657. > /* This   function is called from the s_ctrl api
  5658. 4278,4281c4652,4656
  5659. <   for(i = 0; i < (sizeof(ce147_framesize_list)/sizeof(struct ce147_enum_framesize)); i++)
  5660. <   {
  5661. <       if(ce147_framesize_list[i].index == index && ce147_framesize_list[i].mode == state->oprmode){
  5662. <           state->framesize_index = ce147_framesize_list[i].index;
  5663. ---
  5664. >   for (i = 0; i < (sizeof(ce147_framesize_list)
  5665. >               / sizeof(struct ce147_enum_framesize)); i++) {
  5666. >       if (ce147_framesize_list[i].index == index
  5667. >           && ce147_framesize_list[i].mode == state->oprmode) {
  5668. >           state->framesize_index = ce147_framesize_list[i].index;
  5669. 4284c4659,4661
  5670. <           ce147_info(&client->dev, "%s: Camera Res: %dx%d\n", __func__, state->pix.width, state->pix.height);
  5671. ---
  5672. >           ce147_info(&client->dev, "%s: Camera Res: %dx%d\n",
  5673. >                      __func__, state->pix.width,
  5674. >                      state->pix.height);
  5675. 4286,4288c4663,4665
  5676. <       }
  5677. <   }
  5678. <  
  5679. ---
  5680. >       }
  5681. >   }
  5682. >
  5683. 4298c4675,4676
  5684. <   int offset = 134217728;
  5685. ---
  5686. >
  5687. >   mutex_lock(&state->ctrl_lock);
  5688. 4303d4680
  5689. <       LOGV("%s: V4L2_CID_EXPOSURE %d \n", __func__,ctrl->value);
  5690. 4309d4685
  5691. <       LOGV("%s: V4L2_CID_AUTO_WHITE_BALANCE %d \n", __func__,ctrl->value);
  5692. 4315d4690
  5693. <       LOGV("%s: V4L2_CID_WHITE_BALANCE_PRESET %d \n", __func__,ctrl->value);
  5694. 4321d4695
  5695. <       LOGV("%s: V4L2_CID_COLORFX %d \n", __func__,ctrl->value);
  5696. 4327d4700
  5697. <       LOGV("%s: V4L2_CID_CONTRAST %d \n", __func__,ctrl->value);
  5698. 4333d4705
  5699. <       LOGV("%s: V4L2_CID_SATURATION %d \n", __func__,ctrl->value);
  5700. 4338d4709
  5701. <       LOGV("%s: V4L2_CID_SHARPNESS %d \n", __func__,ctrl->value);
  5702. 4345d4715
  5703. <       LOGV("%s: V4L2_CID_CAM_JPEG_MAIN_SIZE %d \n", __func__,ctrl->value);
  5704. 4348c4718
  5705. <  
  5706. ---
  5707. >
  5708. 4351d4720
  5709. <       LOGV("%s: V4L2_CID_CAM_JPEG_MAIN_OFFSET %d \n", __func__,ctrl->value);
  5710. 4357d4725
  5711. <       LOGV("%s: V4L2_CID_CAM_JPEG_THUMB_SIZE %d \n", __func__,ctrl->value);
  5712. 4360c4728
  5713. <  
  5714. ---
  5715. >
  5716. 4363d4730
  5717. <       LOGV("%s: V4L2_CID_CAM_JPEG_THUMB_OFFSET %d \n", __func__,ctrl->value);
  5718. 4367c4734
  5719. <   case V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET:    
  5720. ---
  5721. >   case V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET:
  5722. 4369d4735
  5723. <       LOGV("%s: V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET %d \n", __func__,ctrl->value);
  5724. 4371,4373c4737,4739
  5725. <       break;
  5726. <  
  5727. <   case V4L2_CID_CAM_JPEG_MEMSIZE:    
  5728. ---
  5729. >       break;
  5730. >
  5731. >   case V4L2_CID_CAM_JPEG_MEMSIZE:
  5732. 4375d4740
  5733. <       LOGV("%s: V4L2_CID_CAM_JPEG_MEMSIZE %d \n", __func__,ctrl->value);
  5734. 4379c4744
  5735. <   //need to be modified
  5736. ---
  5737. >   /* need to be modified */
  5738. 4382d4746
  5739. <       LOGV("%s: V4L2_CID_CAM_JPEG_QUALITY %d \n", __func__,ctrl->value);
  5740. 4388d4751
  5741. <       LOGV("%s: V4L2_CID_CAMERA_OBJ_TRACKING_STATUS %d \n", __func__,ctrl->value);
  5742. 4394d4756
  5743. <       LOGV("%s: V4L2_CID_CAMERA_SMART_AUTO_STATUS %d \n", __func__,ctrl->value);
  5744. 4400d4761
  5745. <       LOGV("%s: V4L2_CID_CAMERA_AUTO_FOCUS_RESULT %d \n", __func__,ctrl->value);
  5746. 4405d4765
  5747. <       LOGV("%s: V4L2_CID_CAM_DATE_INFO_YEAR %d \n", __func__,ctrl->value);
  5748. 4407c4767
  5749. <       break;
  5750. ---
  5751. >       break;
  5752. 4410d4769
  5753. <       LOGV("%s: V4L2_CID_CAM_DATE_INFO_MONTH %d \n", __func__,ctrl->value);
  5754. 4413c4772
  5755. <       break;
  5756. ---
  5757. >       break;
  5758. 4416d4774
  5759. <       LOGV("%s: V4L2_CID_CAM_DATE_INFO_DATE %d \n", __func__,ctrl->value);
  5760. 4419c4777
  5761. <       break;
  5762. ---
  5763. >       break;
  5764. 4422d4779
  5765. <       LOGV("%s: V4L2_CID_CAM_SENSOR_VER %d \n", __func__,ctrl->value);
  5766. 4425c4782
  5767. <       break;
  5768. ---
  5769. >       break;
  5770. 4428d4784
  5771. <       LOGV("%s: V4L2_CID_CAM_FW_MINOR_VER %d \n", __func__,ctrl->value);
  5772. 4431c4787
  5773. <       break;
  5774. ---
  5775. >       break;
  5776. 4434d4789
  5777. <       LOGV("%s: V4L2_CID_CAM_FW_MAJOR_VER %d \n", __func__,ctrl->value);
  5778. 4437c4792
  5779. <       break;
  5780. ---
  5781. >       break;
  5782. 4440d4794
  5783. <       LOGV("%s: V4L2_CID_CAM_PRM_MINOR_VER %d \n", __func__,ctrl->value);
  5784. 4443c4797
  5785. <       break;
  5786. ---
  5787. >       break;
  5788. 4446d4799
  5789. <       LOGV("%s: V4L2_CID_CAM_PRM_MAJOR_VER %d \n", __func__,ctrl->value);
  5790. 4449c4802
  5791. <       break;
  5792. ---
  5793. >       break;
  5794. 4452d4804
  5795. <       LOGV("%s: V4L2_CID_CAM_SENSOR_MAKER %d \n", __func__,ctrl->value);
  5796. 4455c4807
  5797. <       break;
  5798. ---
  5799. >       break;
  5800. 4458d4809
  5801. <       LOGV("%s: V4L2_CID_CAM_SENSOR_OPTICAL %d \n", __func__,ctrl->value);
  5802. 4461c4812
  5803. <       break;     
  5804. ---
  5805. >       break;
  5806. 4464d4814
  5807. <       LOGV("%s: V4L2_CID_CAM_AF_VER_LOW %d \n", __func__,ctrl->value);
  5808. 4467c4817
  5809. <       break;
  5810. ---
  5811. >       break;
  5812. 4470d4819
  5813. <       LOGV("%s: V4L2_CID_CAM_AF_VER_HIGH %d \n", __func__,ctrl->value);
  5814. 4473c4822
  5815. <       break;  
  5816. ---
  5817. >       break;
  5818. 4476d4824
  5819. <       LOGV("%s: V4L2_CID_CAM_GAMMA_RG_LOW %d \n", __func__,ctrl->value);
  5820. 4479c4827
  5821. <       break;
  5822. ---
  5823. >       break;
  5824. 4482d4829
  5825. <       LOGV("%s: V4L2_CID_CAM_GAMMA_RG_HIGH %d \n", __func__,ctrl->value);
  5826. 4485c4832
  5827. <       break;     
  5828. ---
  5829. >       break;
  5830. 4488d4834
  5831. <       LOGV("%s: V4L2_CID_CAM_GAMMA_BG_LOW %d \n", __func__,ctrl->value);
  5832. 4491c4837
  5833. <       break;
  5834. ---
  5835. >       break;
  5836. 4494d4839
  5837. <       LOGV("%s: V4L2_CID_CAM_GAMMA_BG_HIGH %d \n", __func__,ctrl->value);
  5838. 4497,4498c4842,4843
  5839. <       break;  
  5840. <  
  5841. ---
  5842. >       break;
  5843. >
  5844. 4500d4844
  5845. <       LOGV("%s: V4L2_CID_CAM_GET_DUMP_SIZE %d \n", __func__,ctrl->value);
  5846. 4503,4504c4847,4848
  5847. <       break;     
  5848. <  
  5849. ---
  5850. >       break;
  5851. >
  5852. 4506d4849
  5853. <       LOGV("%s: V4L2_CID_MAIN_SW_DATE_INFO_YEAR %d \n", __func__,ctrl->value);
  5854. 4509c4852
  5855. <       break;
  5856. ---
  5857. >       break;
  5858. 4512d4854
  5859. <       LOGV("%s: V4L2_CID_MAIN_SW_DATE_INFO_MONTH %d \n", __func__,ctrl->value);
  5860. 4515c4857
  5861. <       break;
  5862. ---
  5863. >       break;
  5864. 4518d4859
  5865. <       LOGV("%s: V4L2_CID_MAIN_SW_DATE_INFO_DATE %d \n", __func__,ctrl->value);
  5866. 4521c4862
  5867. <       break;
  5868. ---
  5869. >       break;
  5870. 4524d4864
  5871. <       LOGV("%s: V4L2_CID_MAIN_SW_FW_MINOR_VER %d \n", __func__,ctrl->value);
  5872. 4527c4867
  5873. <       break;
  5874. ---
  5875. >       break;
  5876. 4530d4869
  5877. <       LOGV("%s: V4L2_CID_MAIN_SW_FW_MAJOR_VER %d \n", __func__,ctrl->value);
  5878. 4533c4872
  5879. <       break;
  5880. ---
  5881. >       break;
  5882. 4536d4874
  5883. <       LOGV("%s: V4L2_CID_MAIN_SW_PRM_MINOR_VER %d \n", __func__,ctrl->value);
  5884. 4539c4877
  5885. <       break;
  5886. ---
  5887. >       break;
  5888. 4542d4879
  5889. <       LOGV("%s: V4L2_CID_MAIN_SW_PRM_MAJOR_VER %d \n", __func__,ctrl->value);
  5890. 4545,4567d4881
  5891. <       break;
  5892. <      
  5893. <   case V4L2_CID_ESD_INT:
  5894. <       LOGV("%s: V4L2_CID_ESD_INT %d \n", __func__,ctrl->value);
  5895. <           pr_warn("%s don't bother with V4L2_CID_ESD_INT shit I am a stupid CE147 cam!",__func__);
  5896. <           err = 0;
  5897. <           break;
  5898. <   case V4L2_CID_CAMERA_GET_SHT_TIME:
  5899. <       //FIXME get real shutterspeed
  5900. <       ctrl->value = 100;
  5901. <       LOGV("%s: V4L2_CID_CAMERA_GET_SHT_TIME %d \n", __func__,ctrl->value);
  5902. <       err = 0;
  5903. <       break;
  5904. <   case V4L2_CID_CAMERA_GET_ISO:
  5905. <       //FIXME get real ISO
  5906. <       ctrl->value = ISO_100; //ISO 100 as workaround
  5907. <       LOGV("%s: V4L2_CID_CAMERA_GET_ISO %d \n", __func__,ctrl->value);
  5908. <       err = 0;
  5909. <       break;  
  5910. <   case V4L2_CID_CAMERA_GET_FLASH_ONOFF:
  5911. <       ctrl->value = 0; //we have no flash
  5912. <       err = 0;
  5913. <       LOGV("%s: V4L2_CID_CAMERA_GET_FLASH_ONOFF %d \n", __func__,ctrl->value);
  5914. 4570d4883
  5915. <
  5916. 4572c4885
  5917. <       pr_err("%s: no such ctrl id(%d)\n", __func__, (ctrl->id - offset));
  5918. ---
  5919. >       dev_err(&client->dev, "%s: no such ctrl\n", __func__);
  5920. 4575c4888,4890
  5921. <  
  5922. ---
  5923. >
  5924. >   mutex_unlock(&state->ctrl_lock);
  5925. >
  5926. 4584a4900,4902
  5927. >   int value = ctrl->value;
  5928. >
  5929. >   mutex_lock(&state->ctrl_lock);
  5930. 4587d4904
  5931. <      
  5932. 4589,4590c4906
  5933. <       LOGV("%s: V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK %d \n", __func__,ctrl->value);
  5934. <       err = ce147_set_ae_awb(sd, ctrl->value);
  5935. ---
  5936. >       err = ce147_set_ae_awb(sd, ctrl);
  5937. 4592c4908
  5938. <      
  5939. ---
  5940. >
  5941. 4594,4595c4910
  5942. <       LOGV("%s: V4L2_CID_CAMERA_FLASH_MODE %d \n", __func__,ctrl->value);
  5943. <       err = ce147_set_flash(sd, ctrl->value);
  5944. ---
  5945. >       err = ce147_set_flash(sd, ctrl);
  5946. 4599,4602c4914
  5947. <       LOGV("%s: V4L2_CID_CAMERA_BRIGHTNESS %d \n", __func__,ctrl->value);
  5948. <
  5949. <       if(state->runmode != CE147_RUNMODE_RUNNING)
  5950. <       {
  5951. ---
  5952. >       if (state->runmode != CE147_RUNMODE_RUNNING) {
  5953. 4605,4609c4917,4918
  5954. <       }
  5955. <       else
  5956. <       {
  5957. <           err = ce147_set_ev(sd, ctrl->value);
  5958. <       }
  5959. ---
  5960. >       } else
  5961. >           err = ce147_set_ev(sd, ctrl);
  5962. 4613,4618c4922,4923
  5963. <       LOGV("%s: V4L2_CID_CAMERA_WHITE_BALANCE %d \n", __func__,ctrl->value);
  5964. <      
  5965. <       if(state->runmode != CE147_RUNMODE_RUNNING)
  5966. <       {
  5967. <          
  5968. <           state->wb= ctrl->value;
  5969. ---
  5970. >       if (state->runmode != CE147_RUNMODE_RUNNING) {
  5971. >           state->wb = ctrl->value;
  5972. 4620,4625c4925,4926
  5973. <       }
  5974. <       else
  5975. <       {
  5976. <           LOGV("%s: V4L2_CID_CAMERA_WHITE_BALANCE %d is CE147_RUNMODE_RUNNING\n", __func__,ctrl->value);
  5977. <           err = ce147_set_white_balance(sd, ctrl->value);    
  5978. <       }
  5979. ---
  5980. >       } else
  5981. >           err = ce147_set_white_balance(sd, ctrl);
  5982. 4629,4633c4930,4931
  5983. <       LOGV("%s: V4L2_CID_CAMERA_EFFECT %d \n", __func__,ctrl->value);
  5984. <      
  5985. <       if(state->runmode != CE147_RUNMODE_RUNNING)
  5986. <       {
  5987. <           state->effect= ctrl->value;
  5988. ---
  5989. >       if (state->runmode != CE147_RUNMODE_RUNNING) {
  5990. >           state->effect = ctrl->value;
  5991. 4635,4641c4933,4935
  5992. <       }
  5993. <       else
  5994. <       {
  5995. <           LOGV("%s: V4L2_CID_CAMERA_EFFECT %d is CE147_RUNMODE_RUNNING\n", __func__,ctrl->value);
  5996. <           err = ce147_set_effect(sd, ctrl->value);       
  5997. <       }
  5998. <       break;     
  5999. ---
  6000. >       } else
  6001. >           err = ce147_set_effect(sd, ctrl);
  6002. >       break;
  6003. 4644,4647c4938
  6004. <       LOGV("%s: V4L2_CID_CAMERA_ISO %d \n", __func__,ctrl->value);
  6005. <      
  6006. <       if(state->runmode != CE147_RUNMODE_RUNNING)
  6007. <       {
  6008. ---
  6009. >       if (state->runmode != CE147_RUNMODE_RUNNING) {
  6010. 4650,4655c4941,4942
  6011. <       }
  6012. <       else
  6013. <       {
  6014. <           LOGV("%s: V4L2_CID_CAMERA_ISO %d is CE147_RUNMODE_RUNNING\n", __func__,ctrl->value);
  6015. <           err = ce147_set_iso(sd, ctrl->value);      
  6016. <       }
  6017. ---
  6018. >       } else
  6019. >           err = ce147_set_iso(sd, ctrl);
  6020. 4659,4663c4946,4947
  6021. <       LOGV("%s: V4L2_CID_CAMERA_METERING %d \n", __func__,ctrl->value);
  6022. <      
  6023. <       if(state->runmode != CE147_RUNMODE_RUNNING)
  6024. <       {
  6025. <           state->metering = ctrl->value;
  6026. ---
  6027. >       if (state->runmode != CE147_RUNMODE_RUNNING) {
  6028. >           state->metering = ctrl->value;
  6029. 4665,4669c4949,4950
  6030. <       }
  6031. <       else
  6032. <       {
  6033. <           err = ce147_set_metering(sd, ctrl->value);
  6034. <       }
  6035. ---
  6036. >       } else
  6037. >           err = ce147_set_metering(sd, ctrl);
  6038. 4673,4674c4954
  6039. <       LOGV("%s: V4L2_CID_CAMERA_CONTRAST %d \n", __func__,ctrl->value);
  6040. <       err = ce147_set_contrast(sd, ctrl->value);
  6041. ---
  6042. >       err = ce147_set_contrast(sd, ctrl);
  6043. 4678,4679c4958
  6044. <       LOGV("%s: V4L2_CID_CAMERA_SATURATION %d \n", __func__,ctrl->value);
  6045. <       err = ce147_set_saturation(sd, ctrl->value);
  6046. ---
  6047. >       err = ce147_set_saturation(sd, ctrl);
  6048. 4683,4684c4962
  6049. <       LOGV("%s: V4L2_CID_CAMERA_SHARPNESS %d \n", __func__,ctrl->value);
  6050. <       err = ce147_set_sharpness(sd, ctrl->value);
  6051. ---
  6052. >       err = ce147_set_sharpness(sd, ctrl);
  6053. 4688,4689c4966
  6054. <       LOGV("%s: V4L2_CID_CAMERA_WDR %d \n", __func__,ctrl->value);
  6055. <       err = ce147_set_wdr(sd, ctrl->value);
  6056. ---
  6057. >       err = ce147_set_wdr(sd, ctrl);
  6058. 4693,4694c4970
  6059. <       LOGV("%s: V4L2_CID_CAMERA_ANTI_SHAKE %d \n", __func__,ctrl->value);
  6060. <       err = ce147_set_anti_shake(sd, ctrl->value);
  6061. ---
  6062. >       err = ce147_set_anti_shake(sd, ctrl);
  6063. 4698,4699c4974
  6064. <       LOGV("%s: V4L2_CID_CAMERA_FACE_DETECTION %d \n", __func__,ctrl->value);
  6065. <       err = ce147_set_face_detection(sd, ctrl->value);
  6066. ---
  6067. >       err = ce147_set_face_detection(sd, ctrl);
  6068. 4703,4704c4978
  6069. <       LOGV("%s: V4L2_CID_CAMERA_SMART_AUTO %d \n", __func__,ctrl->value);
  6070. <       err = ce147_set_smart_auto(sd, ctrl->value);
  6071. ---
  6072. >       err = ce147_set_smart_auto(sd, ctrl);
  6073. 4708,4709c4982
  6074. <       LOGV("%s: V4L2_CID_CAMERA_FOCUS_MODE %d \n", __func__,ctrl->value);
  6075. <       err = ce147_set_focus_mode(sd, ctrl->value);
  6076. ---
  6077. >       err = ce147_set_focus_mode(sd, ctrl);
  6078. 4711c4984
  6079. <      
  6080. ---
  6081. >
  6082. 4713,4714c4986
  6083. <       LOGV("%s: V4L2_CID_CAMERA_VINTAGE_MODE %d \n", __func__,ctrl->value);
  6084. <       err = ce147_set_vintage_mode(sd, ctrl->value);
  6085. ---
  6086. >       err = ce147_set_vintage_mode(sd, ctrl);
  6087. 4716c4988
  6088. <      
  6089. ---
  6090. >
  6091. 4718,4719c4990
  6092. <       LOGV("%s: V4L2_CID_CAMERA_BEAUTY_SHOT %d \n", __func__,ctrl->value);
  6093. <       err = ce147_set_face_beauty(sd, ctrl->value);
  6094. ---
  6095. >       err = ce147_set_face_beauty(sd, ctrl);
  6096. 4723,4725c4994,4995
  6097. <       LOGV("%s: V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK %d \n", __func__,ctrl->value);
  6098. <       err = ce147_set_face_lock(sd, ctrl->value);
  6099. <       break;     
  6100. ---
  6101. >       err = ce147_set_face_lock(sd, ctrl);
  6102. >       break;
  6103. 4727c4997
  6104. <   //need to be modified
  6105. ---
  6106. >   /* need to be modified */
  6107. 4729,4730c4999
  6108. <       LOGV("%s: V4L2_CID_CAM_JPEG_QUALITY %d \n", __func__,ctrl->value);
  6109. <       if(ctrl->value < 0 || ctrl->value > 100){
  6110. ---
  6111. >       if (ctrl->value < 0 || ctrl->value > 100)
  6112. 4732c5001
  6113. <       } else {
  6114. ---
  6115. >       else {
  6116. 4739d5007
  6117. <       LOGV("%s: V4L2_CID_CAMERA_ZOOM %d \n", __func__,ctrl->value);
  6118. 4744,4745c5012
  6119. <       LOGV("%s: V4L2_CID_CAMERA_TOUCH_AF_START_STOP %d \n", __func__,ctrl->value);
  6120. <       err = ce147_set_touch_auto_focus(sd, ctrl->value);
  6121. ---
  6122. >       err = ce147_set_touch_auto_focus(sd, ctrl);
  6123. 4747c5014
  6124. <      
  6125. ---
  6126. >
  6127. 4749,4751c5016,5017
  6128. <       LOGV("%s: V4L2_CID_CAMERA_CAF_START_STOP %d \n", __func__,ctrl->value);
  6129. <       err = ce147_set_continous_af(sd, ctrl->value);
  6130. <       break; 
  6131. ---
  6132. >       err = ce147_set_continous_af(sd, ctrl);
  6133. >       break;
  6134. 4754d5019
  6135. <       LOGV("%s: V4L2_CID_CAMERA_OBJECT_POSITION_X %d \n", __func__,ctrl->value);
  6136. 4760d5024
  6137. <       LOGV("%s: V4L2_CID_CAMERA_OBJECT_POSITION_Y %d \n", __func__,ctrl->value);
  6138. 4766,4767c5030
  6139. <       LOGV("%s: V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP %d \n", __func__,ctrl->value);
  6140. <       err = ce147_set_object_tracking(sd, ctrl->value);
  6141. ---
  6142. >       err = ce147_set_object_tracking(sd, ctrl);
  6143. 4771,4773c5034,5044
  6144. <       LOGV("%s: V4L2_CID_CAMERA_SET_AUTO_FOCUS %d \n", __func__,ctrl->value);
  6145. <       err = ce147_set_auto_focus(sd, ctrl->value);
  6146. <       break;     
  6147. ---
  6148. >       if (value == AUTO_FOCUS_ON)
  6149. >           err = ce147_start_auto_focus(sd, ctrl);
  6150. >       else if (value == AUTO_FOCUS_OFF)
  6151. >           err = ce147_stop_auto_focus(sd);
  6152. >       else {
  6153. >           err = -EINVAL;
  6154. >           dev_err(&client->dev,
  6155. >                   "%s: bad focus value requestion %d\n",
  6156. >                   __func__, value);
  6157. >       }
  6158. >       break;
  6159. 4776d5046
  6160. <       LOGV("%s: V4L2_CID_CAMERA_FRAME_RATE %d \n", __func__,ctrl->value);
  6161. 4778c5048
  6162. <       err = 0;       
  6163. ---
  6164. >       err = 0;
  6165. 4780c5050
  6166. <      
  6167. ---
  6168. >
  6169. 4782,4784c5052,5053
  6170. <       LOGV("%s: V4L2_CID_CAMERA_ANTI_BANDING %d \n", __func__,ctrl->value);
  6171. <       state->anti_banding= ctrl->value;
  6172. <       err = 0;       
  6173. ---
  6174. >       state->anti_banding = ctrl->value;
  6175. >       err = 0;
  6176. 4788d5056
  6177. <       LOGV("%s: V4L2_CID_CAMERA_SET_GAMMA %d \n", __func__,ctrl->value);
  6178. 4792c5060
  6179. <  
  6180. ---
  6181. >
  6182. 4794d5061
  6183. <       LOGV("%s: V4L2_CID_CAMERA_SET_SLOW_AE %d \n", __func__,ctrl->value);
  6184. 4800c5067
  6185. <       LOGV("%s: V4L2_CID_CAMERA_CAPTURE %d \n", __func__,ctrl->value);
  6186. ---
  6187. >       err = ce147_set_capture_start(sd, ctrl);
  6188. 4803d5069
  6189. <
  6190. 4805,4807c5071
  6191. <       LOGV("%s: V4L2_CID_CAM_CAPTURE %d \n", __func__);
  6192. <       err = ce147_set_capture_config(sd);
  6193. <       err = ce147_set_capture_start(sd);
  6194. ---
  6195. >       err = ce147_set_capture_config(sd, ctrl);
  6196. 4809,4811c5073,5076
  6197. <  
  6198. <   /* Used to start / stop preview operation.
  6199. <    * This call can be modified to START/STOP operation, which can be used in image capture also */
  6200. ---
  6201. >
  6202. >   /* Used to start / stop preview operation.
  6203. >   * This call can be modified to START/STOP operation,
  6204. >   * which can be used in image capture also */
  6205. 4813,4814c5078
  6206. <       LOGV("%s: V4L2_CID_CAM_PREVIEW_ONOFF %d \n", __func__,ctrl->value);
  6207. <       if(ctrl->value)
  6208. ---
  6209. >       if (ctrl->value)
  6210. 4821d5084
  6211. <       LOGV("%s: V4L2_CID_CAM_UPDATE_FW %d \n", __func__,ctrl->value);
  6212. 4826d5088
  6213. <       LOGV("%s: V4L2_CID_CAM_SET_FW_ADDR %d \n", __func__,ctrl->value);
  6214. 4832d5093
  6215. <       LOGV("%s: V4L2_CID_CAM_SET_FW_SIZE %d \n", __func__,ctrl->value);
  6216. 4837c5098
  6217. < #if defined(CONFIG_ARIES_NTT) // Modify NTTS1
  6218. ---
  6219. > #if defined(CONFIG_ARIES_NTT) /* Modify   NTTS1 */
  6220. 4845d5105
  6221. <       LOGV("%s: V4L2_CID_CAM_FW_VER %d \n", __func__,ctrl->value);
  6222. 4850d5109
  6223. <       LOGV("%s: V4L2_CID_CAM_DUMP_FW %d \n", __func__,ctrl->value);
  6224. 4853c5112
  6225. <      
  6226. ---
  6227. >
  6228. 4855d5113
  6229. <       LOGV("%s: V4L2_CID_CAMERA_BATCH_REFLECTION %d \n", __func__,ctrl->value);
  6230. 4860d5117
  6231. <       LOGV("%s: V4L2_CID_CAMERA_EXIF_ORIENTATION %d \n", __func__,ctrl->value);
  6232. 4864,4865c5121,5122
  6233. <      
  6234. <   //s1_camera [ Defense process by ESD input ] _[
  6235. ---
  6236. >
  6237. >   /* s1_camera [ Defense process by ESD input ] _[ */
  6238. 4867c5124,5125
  6239. <       dev_err(&client->dev, "%s: V4L2_CID_CAMERA_RESET \n", __func__);
  6240. ---
  6241. >       dev_err(&client->dev, "%s: V4L2_CID_CAMERA_RESET\n", __func__);
  6242. >       pr_debug("======ESD\n");
  6243. 4870c5128
  6244. <   // _]
  6245. ---
  6246. >   /* _] */
  6247. 4873,4874c5131
  6248. <       LOGV("%s: V4L2_CID_CAMERA_CHECK_DATALINE %d \n", __func__,ctrl->value);
  6249. <       state->check_dataline = ctrl->value;
  6250. ---
  6251. >       state->check_dataline = ctrl->value;
  6252. 4876c5133
  6253. <       break; 
  6254. ---
  6255. >       break;
  6256. 4879d5135
  6257. <       LOGV("%s: V4L2_CID_CAMERA_CHECK_DATALINE_STOP %d \n", __func__,ctrl->value);
  6258. 4882c5138
  6259. <      
  6260. ---
  6261. >
  6262. 4884d5139
  6263. <       LOGV("%s: V4L2_CID_CAMERA_THUMBNAIL_NULL %d \n", __func__,ctrl->value);
  6264. 4888,4893c5143
  6265. <      
  6266. <   case V4L2_CID_CAMERA_RETURN_FOCUS:
  6267. <           pr_warn("%s don't bother with V4L2_CID_CAMERA_RETURN_FOCUS shit I am a stupid CE147 cam!",__func__);
  6268. <           err = 0;
  6269. <           break;
  6270. <      
  6271. ---
  6272. >
  6273. 4895c5145
  6274. <       pr_err("%s: no such control ... I know nothing about %d! What do you want from me sucker? \n", __func__, ctrl->id);
  6275. ---
  6276. >       dev_err(&client->dev, "%s: no such control\n", __func__);
  6277. 4900c5150,5155
  6278. <       dev_err(&client->dev, "%s: vidioc_s_ctrl failed %d, s_ctrl: id(%d), value(%d)\n", __func__, err, (ctrl->id - offset), ctrl->value);
  6279. ---
  6280. >       dev_err(&client->dev, "%s: vidioc_s_ctrl failed %d, "
  6281. >               "s_ctrl: id(%d), value(%d)\n",
  6282. >                   __func__, err, (ctrl->id - offset),
  6283. >                   ctrl->value);
  6284. >
  6285. >   mutex_unlock(&state->ctrl_lock);
  6286. 4904c5159,5160
  6287. < static int ce147_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls)
  6288. ---
  6289. > static int ce147_s_ext_ctrls(struct v4l2_subdev *sd,
  6290. >               struct v4l2_ext_controls *ctrls)
  6291. 4910c5166
  6292. <   for (i = 0; i < ctrls->count; i++, ctrl++)  {
  6293. ---
  6294. >   for (i = 0; i < ctrls->count; i++, ctrl++) {
  6295. 4913c5169
  6296. <       if (ret)    {
  6297. ---
  6298. >       if (ret) {
  6299. 4922c5178,5179
  6300. < static int ce147_s_ext_ctrl(struct v4l2_subdev *sd, struct v4l2_ext_control *ctrl)
  6301. ---
  6302. > static int ce147_s_ext_ctrl(struct v4l2_subdev *sd,
  6303. >               struct v4l2_ext_control *ctrl)
  6304. 4929,4931c5186
  6305. <   struct gps_info_common * tempGPSType = NULL;
  6306. <  
  6307. <
  6308. ---
  6309. >   struct gps_info_common *tempGPSType = NULL;
  6310. 4939,4944c5194,5202
  6311. <       state->gpsInfo.ce147_gps_buf[0] = tempGPSType ->direction;
  6312. <       state->gpsInfo.ce147_gps_buf[1] = tempGPSType ->dgree;
  6313. <       state->gpsInfo.ce147_gps_buf[2] = tempGPSType ->minute;
  6314. <       state->gpsInfo.ce147_gps_buf[3] = tempGPSType ->second;
  6315. <      
  6316. <       if((tempGPSType ->direction == 0)&&(tempGPSType ->dgree == 0)&&(tempGPSType ->minute == 0)&&(tempGPSType ->second == 0))
  6317. ---
  6318. >       state->gpsInfo.ce147_gps_buf[0] = tempGPSType->direction;
  6319. >       state->gpsInfo.ce147_gps_buf[1] = tempGPSType->dgree;
  6320. >       state->gpsInfo.ce147_gps_buf[2] = tempGPSType->minute;
  6321. >       state->gpsInfo.ce147_gps_buf[3] = tempGPSType->second;
  6322. >
  6323. >       if ((tempGPSType->direction == 0)
  6324. >               && (tempGPSType->dgree == 0)
  6325. >               && (tempGPSType->minute == 0)
  6326. >               && (tempGPSType->second == 0))
  6327. 4946c5204
  6328. <       else
  6329. ---
  6330. >       else
  6331. 4948c5206
  6332. <       //dev_err(&client->dev,"gps_info_latiude NS: %d, dgree: %d, minute: %d, second: %d \n",state->gpsInfo.ce147_gps_buf[0], state->gpsInfo.ce147_gps_buf[1], state->gpsInfo.ce147_gps_buf[2], state->gpsInfo.ce147_gps_buf[3]);
  6333. ---
  6334. >
  6335. 4954,4959c5212,5220
  6336. <       state->gpsInfo.ce147_gps_buf[4] = tempGPSType ->direction;
  6337. <       state->gpsInfo.ce147_gps_buf[5] = tempGPSType ->dgree;
  6338. <       state->gpsInfo.ce147_gps_buf[6] = tempGPSType ->minute;
  6339. <       state->gpsInfo.ce147_gps_buf[7] = tempGPSType ->second;
  6340. <      
  6341. <       if((tempGPSType ->direction == 0)&&(tempGPSType ->dgree == 0)&&(tempGPSType ->minute == 0)&&(tempGPSType ->second == 0))
  6342. ---
  6343. >       state->gpsInfo.ce147_gps_buf[4] = tempGPSType->direction;
  6344. >       state->gpsInfo.ce147_gps_buf[5] = tempGPSType->dgree;
  6345. >       state->gpsInfo.ce147_gps_buf[6] = tempGPSType->minute;
  6346. >       state->gpsInfo.ce147_gps_buf[7] = tempGPSType->second;
  6347. >
  6348. >       if ((tempGPSType->direction == 0)
  6349. >               && (tempGPSType->dgree == 0)
  6350. >               && (tempGPSType->minute == 0)
  6351. >               && (tempGPSType->second == 0))
  6352. 4961c5222
  6353. <       else
  6354. ---
  6355. >       else
  6356. 4963c5224
  6357. <       //dev_err(&client->dev,"gps_info_longitude EW: %d, dgree: %d, minute: %d, second: %d \n", state->gpsInfo.ce147_gps_buf[4], state->gpsInfo.ce147_gps_buf[5], state->gpsInfo.ce147_gps_buf[6], state->gpsInfo.ce147_gps_buf[7]);
  6358. ---
  6359. >
  6360. 4969,4972c5230,5235
  6361. <       state->gpsInfo.ce147_altitude_buf[0] = tempGPSType ->direction;
  6362. <       state->gpsInfo.ce147_altitude_buf[1] = (tempGPSType ->dgree)&0x00ff; //lower byte
  6363. <       state->gpsInfo.ce147_altitude_buf[2] = ((tempGPSType ->dgree)&0xff00)>>8; //upper byte
  6364. <       state->gpsInfo.ce147_altitude_buf[3] = tempGPSType ->minute;//float
  6365. ---
  6366. >       state->gpsInfo.ce147_altitude_buf[0] = tempGPSType->direction;
  6367. >       state->gpsInfo.ce147_altitude_buf[1] = (tempGPSType->dgree)
  6368. >                               & 0x00ff;
  6369. >       state->gpsInfo.ce147_altitude_buf[2] = ((tempGPSType->dgree)
  6370. >                               & 0xff00) >> 8;
  6371. >       state->gpsInfo.ce147_altitude_buf[3] = tempGPSType->minute;
  6372. 4974d5236
  6373. <       //dev_err(&client->dev,"gps_info_altitude PLUS_MINUS: %d, dgree_lower: %d, degree_lower: %d, minute: %d \n", state->gpsInfo.ce147_altitude_buf[0], state->gpsInfo.ce147_altitude_buf[1], state->gpsInfo.ce147_altitude_buf[2], state->gpsInfo.ce147_altitude_buf[3]);
  6374. 4979,4980c5241,5243
  6375. <       //state->gpsInfo.gps_timeStamp =(struct tm *)ctrl->reserved2[1];
  6376. <       temp = *((unsigned long *)ctrl->reserved2[1]);
  6377. ---
  6378. >       /* state->gpsInfo.gps_timeStamp =
  6379. >           (struct tm*)ctrl->reserved2[1]; */
  6380. >       temp = *((unsigned long *)ctrl->reserved2[1]);
  6381. 4984c5247
  6382. <      
  6383. ---
  6384. >
  6385. 4986c5249
  6386. <       state->exifTimeInfo =(struct tm *)ctrl->reserved2[1];
  6387. ---
  6388. >       state->exifTimeInfo = (struct tm *)ctrl->reserved2[1];
  6389. 4989c5252
  6390. <      
  6391. ---
  6392. >
  6393. 4997c5260
  6394. <   if(condition)
  6395. ---
  6396. >   if (condition)
  6397. 4999c5262
  6398. <  
  6399. ---
  6400. >
  6401. 5001c5264,5265
  6402. <       dev_err(&client->dev, "%s: vidioc_s_ext_ctrl failed %d\n", __func__, err);
  6403. ---
  6404. >       dev_err(&client->dev, "%s: vidioc_s_ext_ctrl failed %d\n",
  6405. >               __func__, err);
  6406. 5005a5270,5293
  6407. > #ifdef FACTORY_CHECK
  6408. > ssize_t camtype_show(struct device *dev, struct device_attribute *attr, char *buf)
  6409. > {
  6410. >   printk("%s \n", __func__);
  6411. >   char * sensorname = "NG";
  6412. >   sensorname = "SONY_IMX072ES_CE147";
  6413. >   return sprintf(buf,"%s\n", sensorname);
  6414. > }
  6415. >
  6416. >
  6417. > ssize_t camtype_store(struct device *dev,
  6418. >         struct device_attribute *attr, const char *buf, size_t size)
  6419. > {
  6420. >   printk(KERN_NOTICE "%s:%s\n", __func__, buf);
  6421. >
  6422. >   return size;
  6423. > }
  6424. >
  6425. > static DEVICE_ATTR(camtype,0644, camtype_show, camtype_store);
  6426. >
  6427. > extern struct class *sec_class;
  6428. > struct device *sec_cam_dev = NULL;
  6429. > #endif
  6430. >
  6431. 5011,5013c5299
  6432. <   //camera was just turned on, we wait for it
  6433. <   msleep(200);
  6434. <         //ce147_power_en(1, sd);
  6435. ---
  6436. >
  6437. 5015,5016c5301,5303
  6438. <   if(err < 0){
  6439. <       dev_err(&client->dev, "%s: Failed: Camera Initialization\n", __func__);
  6440. ---
  6441. >   if (err < 0) {
  6442. >       dev_err(&client->dev, "%s: Failed: Camera Initialization\n",
  6443. >               __func__);
  6444. 5019c5306
  6445. <  
  6446. ---
  6447. >
  6448. 5023,5024c5310,5312
  6449. <   if(err < 0){
  6450. <       dev_err(&client->dev, "%s: Failed: Reading firmware version\n",__func__);
  6451. ---
  6452. >   if (err < 0) {
  6453. >       dev_err(&client->dev, "%s: Failed: Reading firmware version\n",
  6454. >               __func__);
  6455. 5029,5030c5317,5319
  6456. <   if(err < 0){
  6457. <       dev_err(&client->dev, "%s: Failed: Reading dateinfo\n",__func__);
  6458. ---
  6459. >   if (err < 0) {
  6460. >       dev_err(&client->dev, "%s: Failed: Reading dateinfo\n",
  6461. >               __func__);
  6462. 5035,5036c5324,5326
  6463. <   if(err < 0){
  6464. <       dev_err(&client->dev, "%s: Failed: Reading sensor info\n",__func__);
  6465. ---
  6466. >   if (err < 0) {
  6467. >       dev_err(&client->dev, "%s: Failed: Reading sensor info\n",
  6468. >               __func__);
  6469. 5039,5040c5329,5334
  6470. <   printk(KERN_DEBUG "fw M:%d m:%d |prm M:%d m:%d \n", MAIN_SW_FW[0], MAIN_SW_FW[1], MAIN_SW_FW[2], MAIN_SW_FW[3]);
  6471. <   printk(KERN_DEBUG "y. m. d = %d.%d.%d \n", MAIN_SW_DATE_INFO[0], MAIN_SW_DATE_INFO[1], MAIN_SW_DATE_INFO[2]);
  6472. ---
  6473. >   pr_debug("fw M:%d m:%d |prm M:%d m:%d\n",
  6474. >           MAIN_SW_FW[0], MAIN_SW_FW[1],
  6475. >           MAIN_SW_FW[2], MAIN_SW_FW[3]);
  6476. >   pr_debug("y. m. d = %d.%d.%d\n",
  6477. >           MAIN_SW_DATE_INFO[0], MAIN_SW_DATE_INFO[1],
  6478. >           MAIN_SW_DATE_INFO[2]);
  6479. 5043,5044c5337,5339
  6480. <   if(err < 0){
  6481. <       dev_err(&client->dev, "%s: Failed: Reading Main SW Version\n",__func__);
  6482. ---
  6483. >   if (err < 0) {
  6484. >       /*dev_err(&client->dev, "%s: Failed: Reading Main   SW Version\n",
  6485. >               __func__);*/
  6486. 5047,5048d5341
  6487. <  
  6488. <         //ce147_power_en(0, sd);
  6489. 5050,5053c5343,5347
  6490. <   printk(KERN_DEBUG "FW  Version: %d.%d\n", state->fw.major, state->fw.minor);
  6491. <   printk(KERN_DEBUG "PRM Version: %d.%d\n", state->prm.major, state->prm.minor);
  6492. <   printk(KERN_DEBUG "Date(y.m.d): %d.%d.%d\n", state->dateinfo.year, state->dateinfo.month, state->dateinfo.date);   
  6493. <   printk(KERN_DEBUG "Sensor version: %d\n", state->sensor_version);  
  6494. ---
  6495. >   pr_debug("FW  Version: %d.%d\n", state->fw.major, state->fw.minor);
  6496. >   pr_debug("PRM Version: %d.%d\n", state->prm.major, state->prm.minor);
  6497. >   pr_debug("Date(y.m.d): %d.%d.%d\n", state->dateinfo.year,
  6498. >           state->dateinfo.month, state->dateinfo.date);
  6499. >   pr_debug("Sensor version: %d\n", state->sensor_version);
  6500. 5060,5061c5354,5356
  6501. <  * With camera device, we need to re-initialize every single opening time therefor,
  6502. <  * it is not necessary to be initialized on probe time. except for version checking
  6503. ---
  6504. >  * With camera device, we need to re-initialize every single opening time
  6505. >  * therefor, it is not necessary to be initialized on probe time.
  6506. >  * except for version checking
  6507. 5070c5365
  6508. <   pdata = client->dev.platform_data;
  6509. ---
  6510. >   pdata = client->dev.platform_data;
  6511. 5103,5109c5398,5404
  6512. <   .init = ce147_init, /* initializing API */
  6513. <   .s_config = ce147_s_config, /* Fetch platform data */
  6514. <   .queryctrl = ce147_queryctrl,
  6515. <   .querymenu = ce147_querymenu,
  6516. <   .g_ctrl = ce147_g_ctrl,
  6517. <   .s_ctrl = ce147_s_ctrl,
  6518. <   .s_ext_ctrls = ce147_s_ext_ctrls,
  6519. ---
  6520. >   .init       = ce147_init,       /* initializing API */
  6521. >   .s_config   = ce147_s_config,   /* Fetch platform data */
  6522. >   .queryctrl  = ce147_queryctrl,
  6523. >   .querymenu  = ce147_querymenu,
  6524. >   .g_ctrl     = ce147_g_ctrl,
  6525. >   .s_ctrl     = ce147_s_ctrl,
  6526. >   .s_ext_ctrls    = ce147_s_ext_ctrls,
  6527. 5113,5121c5408,5416
  6528. <   .s_crystal_freq = ce147_s_crystal_freq,
  6529. <   .g_fmt = ce147_g_fmt,
  6530. <   .s_fmt = ce147_s_fmt,
  6531. <   .enum_framesizes = ce147_enum_framesizes,
  6532. <   .enum_frameintervals = ce147_enum_frameintervals,
  6533. <   .enum_fmt = ce147_enum_fmt,
  6534. <   .try_fmt = ce147_try_fmt,
  6535. <   .g_parm = ce147_g_parm,
  6536. <   .s_parm = ce147_s_parm,
  6537. ---
  6538. >   .s_crystal_freq     = ce147_s_crystal_freq,
  6539. >   .g_fmt          = ce147_g_fmt,
  6540. >   .s_fmt          = ce147_s_fmt,
  6541. >   .enum_framesizes    = ce147_enum_framesizes,
  6542. >   .enum_frameintervals    = ce147_enum_frameintervals,
  6543. >   .enum_fmt       = ce147_enum_fmt,
  6544. >   .try_fmt        = ce147_try_fmt,
  6545. >   .g_parm         = ce147_g_parm,
  6546. >   .s_parm         = ce147_s_parm,
  6547. 5125,5126c5420,5421
  6548. <   .core = &ce147_core_ops,
  6549. <   .video = &ce147_video_ops,
  6550. ---
  6551. >   .core   = &ce147_core_ops,
  6552. >   .video  = &ce147_video_ops,
  6553. 5132c5427
  6554. <  * In probe routine, we just register subdev device
  6555. ---
  6556. >  * In probe routine, we   just register subdev device
  6557. 5143a5439,5441
  6558. >   mutex_init(&state->ctrl_lock);
  6559. >   init_completion(&state->af_complete);
  6560. >
  6561. 5145,5146c5443,5444
  6562. <   state->pre_af_status = -1;
  6563. <   state->cur_af_status = -2;
  6564. ---
  6565. >   state->pre_focus_mode = -1;
  6566. >   state->af_status = -2;
  6567. 5153a5452,5470
  6568. > #ifdef FACTORY_CHECK
  6569. >   {
  6570. >       static bool  camtype_init = false;
  6571. >       if (sec_cam_dev == NULL)
  6572. >       {
  6573. >           sec_cam_dev = device_create(sec_class, NULL, 0, NULL, "sec_cam");
  6574. >           if (IS_ERR(sec_cam_dev))
  6575. >               pr_err("Failed to create device(sec_lcd_dev)!\n");
  6576. >       }
  6577. >  
  6578. >       if (sec_cam_dev != NULL && camtype_init == false)
  6579. >       {
  6580. >           camtype_init = true;
  6581. >           if (device_create_file(sec_cam_dev, &dev_attr_camtype) < 0)
  6582. >               pr_err("Failed to create device file(%s)!\n", dev_attr_camtype.attr.name);
  6583. >       }
  6584. >   }
  6585. > #endif
  6586. >
  6587. 5161a5479
  6588. >   struct ce147_state *state = to_state(sd);
  6589. 5165a5484
  6590. >   mutex_destroy(&state->ctrl_lock);
  6591. 5180,5182c5499,5501
  6592. <   .name = CE147_DRIVER_NAME,
  6593. <   .probe = ce147_probe,
  6594. <   .remove = ce147_remove,
  6595. ---
  6596. >   .name   = CE147_DRIVER_NAME,
  6597. >   .probe  = ce147_probe,
  6598. >   .remove = ce147_remove,
  6599. techmik@michaels-laptop:~$
RAW Paste Data
Top