}
ret = ztm620_motor_reg_write(pMotorData,
- MOTOR_REG_MODE_00, MODE_00_I2C);
+ MOTOR_REG_MODE_00, pMotorPdata->motor_start_data);
if (ret < 0) {
pr_err("[VIB] %s MODE_00 write fail %d\n",
__func__, ret);
}
}
else if (pMotorData->running) {
- err = ztm620_motor_reg_write(pMotorData, MOTOR_REG_MODE_00, MODE_00_STOP);
+ err = ztm620_motor_reg_write(pMotorData, MOTOR_REG_MODE_00, pMotorPdata->motor_stop_data);
if (err < 0) {
pr_err("[VIB] %s MODE_00 write fail %d\n", __func__, err);
goto out;
}
err = ztm620_motor_reg_write(pMotorData,
- MOTOR_REG_MODE_00, MODE_00_STOP);
+ MOTOR_REG_MODE_00, pMotorData->msPlatData.motor_stop_data);
if (err < 0) {
pr_err("[VIB] %s MODE_00 write fail %d", __func__, err);
goto out_err;
__func__, err);
return -ENODEV;
}
- if (!strcmp(motor_type, "LRA"))
+ if (!strcmp(motor_type, "LRA")) {
pdata->motor_type = ACTUATOR_LRA;
- else if (!strcmp(motor_type, "ERM"))
+ pdata->motor_start_data = MODE_00_I2C_LRA;
+ pdata->motor_stop_data = MODE_00_STOP_LRA;
+ }
+ else if (!strcmp(motor_type, "ERM")) {
pdata->motor_type = ACTUATOR_ERM;
+ pdata->motor_start_data = MODE_00_I2C_ERM;
+ pdata->motor_stop_data = MODE_00_STOP_ERM;
+ }
else {
dev_err(&client->dev, "[VIB] %s Wrong motor type: %s\n",
__func__, motor_type);
#define MOTOR_REG_MODE_00_MASK 0x17
#define MODE_00_PWM 0x14
-#define MODE_00_I2C 0x15
-#define MODE_00_STOP 0x16
+#define MODE_00_I2C_LRA 0x15
+#define MODE_00_STOP_LRA 0x16
+#define MODE_00_I2C_ERM 0x05
+#define MODE_00_STOP_ERM 0x00
#define MOTOR_REG_MODE_01_MASK 0x1B
#define MODE_01_SHIFT_DRV_MODE 0x04
int freq_weak;
int strength_strong;
int strength_weak;
+ int motor_start_data;
+ int motor_stop_data;
};
struct ztm620_motor_data {