rhode: long time vibration notice camera

Long time vibration notice camera:
1.Power on the vcm when the motor vibration time exceeds 70ms[1/2];

Change-Id: I9c66c4c6af606857630db9449e496a13c3c56899
Signed-off-by: bchhq23 <bchhq23@motorola.com>
Reviewed-on: https://gerrit.mot.com/2176409
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Deng <dengwei1@motorola.com>
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
bchhq23 2022-01-21 15:59:24 +08:00 • committed by huaqin79
commit 4b1d6b44fd
3 changed files with 28 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 := ldo_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
ldo_vibrator_mmi-y += moto_ldo_vibrator.o
obj-m += ldo_vibrator_mmi.o

View file

@ -21,6 +21,11 @@
#define MOTO_VIB_PLAY_MS 5000
#define MOTO_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;
@ -38,9 +43,24 @@ static inline int moto_vib_ldo_enable(struct vib_ldo_chip *chip, bool enable)
{
int ret;
#ifdef CONFIG_VIBRATOR_NOISE_CAMERA
static int mot_actuator_started = 0;
#endif
if (chip->vib_enabled == enable)
return 0;
#ifdef CONFIG_VIBRATOR_NOISE_CAMERA
if ((chip->vib_play_ms > 70) && (enable)) {
mot_actuator_on_vibrate_start();
mot_actuator_started = 1;
}
if(!(enable) && (mot_actuator_started == 1 )) {
mot_actuator_on_vibrate_stop();
mot_actuator_started = 0;
}
#endif
pr_debug("moto_vib_ldo_enable enable = %d\n", enable);
if (enable) {