mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
optimize aw963xx driver-set_enable
1.each channel enables calibration only once 2.optimize set_enable function Change-Id: Id61e6e192c84aaa7e23c234456ff65e34e085153 Signed-off-by: tin_bingtai.zou_tmp <tinno60@motorola.com> Reviewed-on: https://gerrit.mot.com/2629574 Reviewed-by: <yangyi31@motorola.com> Reviewed-by: Yuchang Guo <guoyc1@lenovo.com> SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Reviewed-by: Minghui Wei <weimh1@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
1757a8c181
commit
9885e3822c
1 changed files with 14 additions and 8 deletions
|
|
@ -1180,6 +1180,7 @@ static int capsensor_set_enable(struct sensors_classdev *sensors_cdev, unsigned
|
|||
struct aw963xx *aw963xx = g_aw963xx;
|
||||
struct aw_sar *p_sar = NULL;
|
||||
uint8_t set_mode = 0;
|
||||
static uint8_t sar_cali_flag = false;
|
||||
|
||||
pr_info("%s enter\n",__func__);
|
||||
|
||||
|
|
@ -1199,17 +1200,22 @@ static int capsensor_set_enable(struct sensors_classdev *sensors_cdev, unsigned
|
|||
|
||||
if (strcmp(sensors_cdev->name, p_sar->channels_arr[i].name) == 0) {
|
||||
if (enable == 0x01) {
|
||||
AWLOGD(p_sar->dev, "enable cap sensor : %s", sensors_cdev->name);
|
||||
aw_sar_i2c_write_bits(p_sar->i2c, REG_SCANCTRL1, ~0xfff, 0xfff);
|
||||
set_mode = AW963XX_ACTIVE_MODE;
|
||||
aw_sar_mode_set(p_sar, set_mode);
|
||||
|
||||
pr_info("enable cap sensor[%d] : %s", i, sensors_cdev->name);
|
||||
if (sar_cali_flag == false) {
|
||||
aw_sar_i2c_write_bits(p_sar->i2c, REG_SCANCTRL1, ~0xfff, 0xfff);
|
||||
set_mode = AW963XX_ACTIVE_MODE;
|
||||
aw_sar_mode_set(p_sar, set_mode);
|
||||
sar_cali_flag = true;
|
||||
}
|
||||
input_report_abs(p_sar->channels_arr[i].input, ABS_DISTANCE, 0);
|
||||
input_sync(p_sar->channels_arr[i].input);
|
||||
} else if (enable == 0) {
|
||||
set_mode = AW963XX_SLEEP_MODE;
|
||||
aw_sar_mode_set(p_sar, set_mode);
|
||||
|
||||
pr_info("disable cap sensor[%d] : %s", i, sensors_cdev->name);
|
||||
if (sar_cali_flag == true) {
|
||||
set_mode = AW963XX_SLEEP_MODE;
|
||||
aw_sar_mode_set(p_sar, set_mode);
|
||||
sar_cali_flag = false;
|
||||
}
|
||||
input_report_abs(p_sar->channels_arr[i].input, ABS_DISTANCE, -1);
|
||||
input_sync(p_sar->channels_arr[i].input);
|
||||
p_sar->channels_arr[i].last_channel_info = -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue