dlkm: vibrator: Support camera actuator noise reduction

details:
To eliminate the resonance noise during system vibrator vibrating, set actuator to
DAC n position,then the resonance noise can be obviously improved.

Change-Id: I0428a965e2f1500f301ac32f6e0cd3dc43743c5b
Signed-off-by: kankan17 <kankan17@motorola.com>
Reviewed-on: https://gerrit.mot.com/2189510
Reviewed-by: <chenlj26@motorola.com>
Reviewed-by: Zhuoran Xu <xuzr3@motorola.com>
Reviewed-by: PengFei Qiao <qiaopf1@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Reviewed-by: Zhichao Chen <chenzc2@motorola.com>
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Submit-Approved: Jira Key
This commit is contained in:
kankan17 2022-02-12 13:31:56 +08:00 • committed by kankan3
commit 28a640a784
3 changed files with 23 additions and 0 deletions

View file

@ -1,6 +1,10 @@
DLKM_DIR := motorola/kernel/modules
LOCAL_PATH := $(call my-dir)
ifeq ($(VIBRATOR_NOISE_CAMERA), true)
KBUILD_OPTIONS += CONFIG_VIBRATOR_NOISE_CAMERA=y
endif
include $(CLEAR_VARS)
LOCAL_MODULE := regulator_vibrator_mmi.ko
LOCAL_MODULE_TAGS := optional

View file

@ -2,6 +2,10 @@
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include
ifneq ($(filter m y,$(CONFIG_VIBRATOR_NOISE_CAMERA)),)
EXTRA_CFLAGS += -DCONFIG_VIBRATOR_NOISE_CAMERA
endif
regulator_vibrator_mmi-y += moto_regulator_vibrator.o
obj-m += regulator_vibrator_mmi.o

View file

@ -26,6 +26,11 @@
#define EXT_VIB_PLAY_MS 5000
#define EXT_VIB_MAX_PLAY_MS 15000
#ifdef CONFIG_VIBRATOR_NOISE_CAMERA
extern int mot_actuator_on_vibrate_start(void);
extern int mot_actuator_on_vibrate_stop(void);
#endif
struct vib_ldo_chip {
struct led_classdev cdev;
struct mutex lock;
@ -65,6 +70,9 @@ static void ext_vib_work(struct work_struct *work)
if (chip->dis_short_long) {
pr_warn("vib in dis short and long, play ms=%lld, dis_longms=%d\n",chip->vib_play_ms, chip->dis_long_ms);
if (chip->vib_play_ms > chip->dis_long_ms) {
#ifdef CONFIG_VIBRATOR_NOISE_CAMERA
mot_actuator_on_vibrate_start();
#endif
ret = gpio_direction_output(chip->vcc_2v6_Pin, chip->state);
}
else {
@ -88,6 +96,13 @@ static void ext_vib_work(struct work_struct *work)
}
else {
if (chip->pwr_by_gpio) {
#ifdef CONFIG_VIBRATOR_NOISE_CAMERA
if (chip->dis_short_long) {
if (chip->vib_play_ms > chip->dis_long_ms) {
mot_actuator_on_vibrate_stop();
}
}
#endif
gpio_direction_output(chip->vcc_2v6_Pin, chip->state);
gpio_direction_output(chip->vcc_3v0_Pin, chip->state);
}