* Update tree from https://github.com/kamikaonashi/android_device_xiaomi_sm8350-common * Add HBM and DC Dimming support * Add High touch polling support * Add V4A support * Add ZRAM control support * Nuke XiaomiDolby Revert "sm8350-common: dolby: Add profiles overlay for moto dolby" This reverts commita1e4e28e15. Revert "sm8350-common: dolby: Update dax-default from moto" This reverts commitbffcbea950. Revert "sm8350-common: Switch dolby soundfx to libswdap" This reverts commit3dd36f1308. Revert "sm8350-common: audio: Add dolby to audio effects" This reverts commitf4593b53a5. Revert "sm8350-common: audio: Apply NLSound 4.0 optimization for dolby" This reverts commit5bed45484c. Revert "sm8350-common: audio: Forcefully disable volume leveler" This reverts commita521c14614. Revert "sm8350-common: Build XiaomiDolby" This reverts commit0cf702da8d. Revert "sm8350-common: Import Dolby audio blobs and sepolicy" This reverts commit73b8f5a29a. Co-authored-by: Joey Huab <joey@evolution-x.org>
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
/*
|
|
* Copyright (C) 2021 The LineageOS Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <aidl/android/hardware/power/BnPower.h>
|
|
#include <android-base/file.h>
|
|
#include <android-base/logging.h>
|
|
#include <sys/ioctl.h>
|
|
|
|
// defines from drivers/input/touchscreen/xiaomi/xiaomi_touch.h
|
|
#define SET_CUR_VALUE 0
|
|
#define Touch_Doubletap_Mode 14
|
|
|
|
#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
|
|
#define TOUCH_ID 0
|
|
#define TOUCH_MAGIC 0x5400
|
|
#define TOUCH_IOC_SETMODE TOUCH_MAGIC + SET_CUR_VALUE
|
|
|
|
namespace aidl {
|
|
namespace google {
|
|
namespace hardware {
|
|
namespace power {
|
|
namespace impl {
|
|
namespace pixel {
|
|
|
|
using ::aidl::android::hardware::power::Mode;
|
|
|
|
bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) {
|
|
switch (type) {
|
|
case Mode::DOUBLE_TAP_TO_WAKE:
|
|
*_aidl_return = true;
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool setDeviceSpecificMode(Mode type, bool enabled) {
|
|
switch (type) {
|
|
case Mode::DOUBLE_TAP_TO_WAKE: {
|
|
int fd = open(TOUCH_DEV_PATH, O_RDWR);
|
|
int arg[3] = {TOUCH_ID, Touch_Doubletap_Mode, enabled ? 1 : 0};
|
|
ioctl(fd, TOUCH_IOC_SETMODE, &arg);
|
|
close(fd);
|
|
return true;
|
|
}
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} // namespace impl
|
|
} // namespace power
|
|
} // namespace hardware
|
|
} // namespace google
|
|
} // namespace aidl
|
|
} // namespace pixel
|