Samsung SPH-L720 (Sprint) source updates
/drivers/media/video/msm/sensors/jc_v4l2.c
blob:331994d8a3a8bfc2dfd2ffc13a0c1c9b3fbd7ff5 -> blob:901f1668bd327700144f1ce993e1fb82758820bc
--- drivers/media/video/msm/sensors/jc_v4l2.c
+++ drivers/media/video/msm/sensors/jc_v4l2.c
@@ -31,6 +31,7 @@
#include <asm/mach-types.h>
#include <mach/vreg.h>
#include <linux/io.h>
+#include <linux/ctype.h>
#include "msm_sensor_common.h"
#include "msm.h"
@@ -143,6 +144,8 @@ struct jc_ctrl_t {
bool need_restart_caf;
bool is_isp_null;
bool isp_null_read_sensor_fw;
+ bool samsung_app;
+ bool factory_bin;
};
static struct jc_ctrl_t *jc_ctrl;
@@ -2366,7 +2369,6 @@ static int jc_set_ev(int mode)
static int jc_set_hjr(int mode)
{
int32_t rc = 0;
- u32 isp_mode;
cam_info("Entered, hjr %d\n", mode);
@@ -2375,37 +2377,16 @@ static int jc_set_hjr(int mode)
return rc;
}
- jc_readb(JC_CATEGORY_SYS, JC_SYS_MODE, &isp_mode);
-
- if (isp_mode == JC_MONITOR_MODE) {
- cam_info("monitor mode\n");
-
- jc_set_mode(JC_PARMSET_MODE);
-
- if (mode == 0) {
- cam_info("HJR Off\n");
- jc_writeb(JC_CATEGORY_CAPCTRL,
- 0x0B, 0x00);
- } else if (mode == 1) {
- cam_info("HJR On\n");
- jc_writeb(JC_CATEGORY_CAPCTRL,
- 0x0B, 0x01);
- }
-
- jc_set_mode(JC_MONITOR_MODE);
- } else {
- cam_info("parameter mode\n");
-
- if (mode == 0) {
- cam_info("HJR Off\n");
- jc_writeb(JC_CATEGORY_CAPCTRL,
- 0x0B, 0x00);
- } else if (mode == 1) {
- cam_info("HJR On\n");
- jc_writeb(JC_CATEGORY_CAPCTRL,
- 0x0B, 0x01);
- }
+ if (mode == 0) {
+ cam_info("HJR Off\n");
+ jc_writeb(JC_CATEGORY_CAPCTRL,
+ 0x0B, 0x00);
+ } else if (mode == 1) {
+ cam_info("HJR On\n");
+ jc_writeb(JC_CATEGORY_CAPCTRL,
+ 0x0B, 0x01);
}
+
return rc;
}
@@ -2908,6 +2889,14 @@ void sensor_native_control(void __user *
jc_set_ocr_focus_mode(ctrl_info.value_1);
break;
+ case EXT_CAM_SET_FACTORY_BIN:
+ cam_info(" factory binary: %d", ctrl_info.value_1);
+ if (ctrl_info.value_1 == 1)
+ jc_ctrl->factory_bin = true;
+ else
+ jc_ctrl->factory_bin = false;
+ break;
+
default:
break;
}
@@ -3091,7 +3080,6 @@ static int jc_sensor_power_up(struct msm
#endif
if (version_checked == false && jc_ctrl->fw_update == true) {
- jc_ctrl->fw_update = false;
isp_ret = jc_get_isp_version();
jc_isp_boot();
jc_get_sensor_version();
@@ -3102,6 +3090,16 @@ static int jc_sensor_power_up(struct msm
return -ENOSYS;
}
+ cam_info("isp_ret: %d, samsung app: %d, factory bin: %d\n",
+ isp_ret, jc_ctrl->samsung_app, jc_ctrl->factory_bin);
+
+ if (isp_ret == 0 && jc_ctrl->samsung_app == false && jc_ctrl->factory_bin == false) {
+ cam_err("3rd party app. skip ISP FW update\n");
+ goto start;
+ }
+
+ jc_ctrl->fw_update = false;
+
if (firmware_update_sdcard == true) {
cam_info("FW in sd card is higher priority than others!\n");
@@ -3128,7 +3126,7 @@ static int jc_sensor_power_up(struct msm
return -ENOSYS;
}
result_sensor_phone = jc_check_sensor_phone();
-
+
if (result_sensor_phone > 0) {
cam_info("Sensor > Phone, update from sensor\n");
jc_ctrl->isp_null_read_sensor_fw = true;
@@ -3188,6 +3186,7 @@ static int jc_sensor_power_up(struct msm
}
}
+start:
cam_info("nv12 output setting\n");
err = jc_writeb(JC_CATEGORY_CAPCTRL,
0x0, 0x0f);
@@ -3504,9 +3503,34 @@ static ssize_t jc_camera_check_fw_show(s
return sprintf(buf, "%s %s %s\n", sysfs_isp_fw_str, sysfs_phone_fw_str, sysfs_sensor_fw_str);
}
+static ssize_t jc_camera_check_app_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%d\n", jc_ctrl->samsung_app);
+}
+
+static ssize_t jc_camera_check_app_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t size)
+{
+ unsigned long value = simple_strtoul(buf, NULL, 0);
+
+ CAM_DEBUG(" received value: %d\n", (int)value);
+
+ if (value == 0) {
+ jc_ctrl->samsung_app = false;
+ } else {
+ CAM_DEBUG(" samsung app");
+ jc_ctrl->samsung_app = true;
+ }
+
+ return size;
+}
+
static DEVICE_ATTR(rear_camtype, S_IRUGO, jc_camera_type_show, NULL);
static DEVICE_ATTR(rear_camfw, S_IRUGO, jc_camera_fw_show, NULL);
static DEVICE_ATTR(rear_checkfw, S_IRUGO, jc_camera_check_fw_show, NULL);
+static DEVICE_ATTR(rear_checkApp, S_IRUGO|S_IWUGO,
+ jc_camera_check_app_show, jc_camera_check_app_store);
int32_t jc_init_vreg_port(struct msm_sensor_ctrl_t *s_ctrl)
{
@@ -3655,6 +3679,8 @@ static int jc_i2c_probe(struct i2c_clien
s_ctrl->sensor_v4l2_subdev.devnode->num;
jc_ctrl->fw_update = true;
+ jc_ctrl->samsung_app = false;
+ jc_ctrl->factory_bin = false;
jc_ctrl->system_rev = s_ctrl->sensordata->sensor_platform_info->sys_rev();
/* to solve sleep current issue */
@@ -3724,7 +3750,13 @@ static int __init jc_init(void)
if (device_create_file
(cam_dev_rear, &dev_attr_rear_checkfw) < 0) {
cam_err("failed to create device file, %s\n",
- dev_attr_rear_camfw.attr.name);
+ dev_attr_rear_checkfw.attr.name);
+ }
+
+ if (device_create_file
+ (cam_dev_rear, &dev_attr_rear_checkApp) < 0) {
+ cam_err("failed to create device file, %s\n",
+ dev_attr_rear_checkApp.attr.name);
}
return i2c_add_driver(&jc_i2c_driver);