summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-04-25 21:48:51 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-04-25 21:48:50 -0700
commit677003c73ff9bae4c15e02584b15f1b23ed2cc33 (patch)
tree3197f03f9dc36ffe8f2eb613bcf6522986f198c5
parent0941c5793c7ae7313c0c4a1d55be60eef091fdc1 (diff)
parent42e3170f60794fe884cac3a4d87982d679330739 (diff)
Merge "input: laser: disable laser sensor when camera crash"
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0-cci.h3
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0.h1
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0_module-cci.c18
-rw-r--r--drivers/input/misc/vl53L0/stmvl53l0_module.c9
4 files changed, 27 insertions, 4 deletions
diff --git a/drivers/input/misc/vl53L0/stmvl53l0-cci.h b/drivers/input/misc/vl53L0/stmvl53l0-cci.h
index 51477701cb1d..b99ffe783e59 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0-cci.h
+++ b/drivers/input/misc/vl53L0/stmvl53l0-cci.h
@@ -51,11 +51,12 @@ struct cci_data {
struct msm_camera_gpio_conf *gconf;
struct msm_pinctrl_info pinctrl_info;
uint8_t cam_pinctrl_status;
-
};
+
int stmvl53l0_init_cci(void);
void stmvl53l0_exit_cci(void *);
int stmvl53l0_power_down_cci(void *);
int stmvl53l0_power_up_cci(void *, unsigned int *);
+int stmvl53l0_cci_power_status(void *);
#endif /* CAMERA_CCI */
#endif /* STMVL53L0_CCI_H */
diff --git a/drivers/input/misc/vl53L0/stmvl53l0.h b/drivers/input/misc/vl53L0/stmvl53l0.h
index b15d78cc6825..b6ef547e86e7 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0.h
+++ b/drivers/input/misc/vl53L0/stmvl53l0.h
@@ -208,6 +208,7 @@ struct stmvl53l0_module_fn_t {
void (*deinit)(void *);
int (*power_up)(void *, unsigned int *);
int (*power_down)(void *);
+ int (*query_power_status)(void *);
};
diff --git a/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c b/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
index 79fba00ea086..fecafe8db949 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
+++ b/drivers/input/misc/vl53L0/stmvl53l0_module-cci.c
@@ -187,8 +187,15 @@ static const struct v4l2_subdev_internal_ops msm_tof_internal_ops = {
static long msm_tof_subdev_ioctl(struct v4l2_subdev *sd,
unsigned int cmd, void *arg)
{
- vl53l0_dbgmsg("Subdev_ioctl not handled\n");
- return 0;
+ struct cci_data *cci_object = NULL;
+ int32_t rc = 0;
+
+ cci_object = v4l2_get_subdevdata(sd);
+ if (cmd == MSM_SD_SHUTDOWN)
+ cci_object->power_up = 0;
+
+ vl53l0_dbgmsg("cmd = %d power_up = %d", cmd, cci_object->power_up);
+ return rc;
}
static int32_t msm_tof_power(struct v4l2_subdev *sd, int on)
@@ -493,6 +500,13 @@ int stmvl53l0_power_down_cci(void *cci_object)
return ret;
}
+int stmvl53l0_cci_power_status(void *cci_object)
+{
+ struct cci_data *data = (struct cci_data *)cci_object;
+
+ return data->power_up;
+}
+
int stmvl53l0_init_cci(void)
{
int ret = 0;
diff --git a/drivers/input/misc/vl53L0/stmvl53l0_module.c b/drivers/input/misc/vl53L0/stmvl53l0_module.c
index 6881aba9fc64..c46be43a03e5 100644
--- a/drivers/input/misc/vl53L0/stmvl53l0_module.c
+++ b/drivers/input/misc/vl53L0/stmvl53l0_module.c
@@ -39,7 +39,6 @@
#include "vl53l010_api.h"
#define USE_INT
-
/* #define DEBUG_TIME_LOG */
#ifdef DEBUG_TIME_LOG
struct timeval start_tv, stop_tv;
@@ -55,6 +54,7 @@ static struct stmvl53l0_module_fn_t stmvl53l0_module_func_tbl = {
.deinit = stmvl53l0_exit_cci,
.power_up = stmvl53l0_power_up_cci,
.power_down = stmvl53l0_power_down_cci,
+ .query_power_status = stmvl53l0_cci_power_status,
};
#else
static struct stmvl53l0_module_fn_t stmvl53l0_module_func_tbl = {
@@ -62,6 +62,7 @@ static struct stmvl53l0_module_fn_t stmvl53l0_module_func_tbl = {
.deinit = stmvl53l0_exit_i2c,
.power_up = stmvl53l0_power_up_i2c,
.power_down = stmvl53l0_power_down_i2c,
+ .stmv53l0_cci_power_status = NULL;
};
#endif
struct stmvl53l0_module_fn_t *pmodule_func_tbl;
@@ -956,6 +957,12 @@ static void stmvl53l0_work_handler(struct work_struct *work)
mutex_lock(&data->work_mutex);
/* vl53l0_dbgmsg("Enter\n"); */
+ if (pmodule_func_tbl->query_power_status(data->client_object) == 0) {
+ if (data->enable_ps_sensor == 1) {
+ stmvl53l0_stop(data);
+ data->enable_ps_sensor = 0;
+ }
+ }
if (vl53l0_dev->enable_ps_sensor == 1) {
#ifdef DEBUG_TIME_LOG