sm8450-common: udfps: Move HBM requests to fod press status listener

Change-Id: If00769fdd766f62c6e35d0f2c19496197ea218af
This commit is contained in:
Arian 2024-03-14 13:43:07 +01:00
parent 44edf478c1
commit abee51ea08

View file

@ -90,8 +90,17 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
continue;
}
bool pressed = readBool(fd);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS,
readBool(fd) ? PARAM_FOD_PRESSED : PARAM_FOD_RELEASED);
pressed ? PARAM_FOD_PRESSED : PARAM_FOD_RELEASED);
// Request HBM
disp_local_hbm_req req;
req.base.flag = 0;
req.base.disp_id = MI_DISP_PRIMARY;
req.local_hbm_value = pressed ? LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT
: LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP;
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req);
}
}).detach();
}
@ -166,14 +175,6 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, THP_FOD_DOWNUP_CTL, pressed ? 1 : 0};
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
// Request HBM
disp_local_hbm_req req;
req.base.flag = 0;
req.base.disp_id = MI_DISP_PRIMARY;
req.local_hbm_value = pressed ? LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT
: LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP;
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req);
}
};