sm8450-common: udfps: Simplify display request ioctl struct

Change-Id: I99db6477dd6c14aab5e60bce841b48b68cd36b1d
This commit is contained in:
Arian
2025-01-07 17:54:35 +01:00
parent bfb4f71ed5
commit 8f09755ba4

View File

@@ -68,6 +68,11 @@ static disp_event_resp* parseDispEvent(int fd) {
return response; return response;
} }
struct disp_base displayBasePrimary = {
.flag = 0,
.disp_id = MI_DISP_PRIMARY,
};
} // anonymous namespace } // anonymous namespace
class XiaomiSm8450UdfpsHander : public UdfpsHandler { class XiaomiSm8450UdfpsHander : public UdfpsHandler {
@@ -145,11 +150,11 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest); ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest);
// Request HBM // Request HBM
disp_local_hbm_req req; struct disp_local_hbm_req displayLhbmRequest = {
req.base.flag = 0; .base = displayBasePrimary,
req.base.disp_id = MI_DISP_PRIMARY; .local_hbm_value = LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT,
req.local_hbm_value = LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT; };
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req); ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &displayLhbmRequest);
} }
void onFingerUp() { void onFingerUp() {
@@ -160,11 +165,11 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_RELEASED); mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_RELEASED);
// Disable HBM // Disable HBM
disp_local_hbm_req req; struct disp_local_hbm_req displayLhbmRequest = {
req.base.flag = 0; .base = displayBasePrimary,
req.base.disp_id = MI_DISP_PRIMARY; .local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP,
req.local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP; };
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req); ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &displayLhbmRequest);
// Update fod_finger_state node in case hwmodule polls it // Update fod_finger_state node in case hwmodule polls it
struct touch_mode_request touchRequest = { struct touch_mode_request touchRequest = {
@@ -181,9 +186,7 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
} }
} }
void cancel() { void cancel() { LOG(DEBUG) << __func__; }
LOG(DEBUG) << __func__;
}
private: private:
fingerprint_device_t* mDevice; fingerprint_device_t* mDevice;