Merge "target: msm8952: Turn on the vibrator for qm215"
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 014834a..3f0a83d 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -250,4 +250,6 @@
int pm_pwm_config(unsigned int duty_us, unsigned int period_us);
uint32_t spmi_reg_read(uint32_t slave_id, uint16_t addr, uint8_t *data, uint8_t priority);
uint32_t spmi_reg_write(uint32_t slave_id, uint16_t addr, uint8_t *data, uint8_t priority);
+void pm8x41_vib_turn_on(void);
+void pm8x41_vib_turn_off(void);
#endif
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 4e0b85a..6575f95 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -36,6 +36,9 @@
#include <rpm-ipc.h>
#include <regulator.h>
#include <platform/timer.h>
+#include <pm_vib.h>
+
+#define QPNP_VIB_EN BIT(7)
/* Enable LN BB CLK */
static uint32_t ln_bb_clk[][8] = {
@@ -841,3 +844,27 @@
return batt_is_broken;
}
+
+void pm8x41_vib_turn_on(void)
+{
+ uint8_t val;
+
+ val = pm8x41_reg_read(QPNP_VIB_VTG_CTL);
+ val &= ~QPNP_VIB_VTG_SET_MASK;
+ val |= (QPNP_VIB_DEFAULT_VTG_LVL & QPNP_VIB_VTG_SET_MASK);
+ pm8x41_reg_write(QPNP_VIB_VTG_CTL, val);
+
+ val = pm8x41_reg_read(QPNP_VIB_EN_CTL);
+ val |= QPNP_VIB_EN;
+ pm8x41_reg_write(QPNP_VIB_EN_CTL, val);
+}
+
+/* Turn off vibrator */
+void pm8x41_vib_turn_off(void)
+{
+ uint8_t val;
+
+ val = pm8x41_reg_read(QPNP_VIB_EN_CTL);
+ val &= ~QPNP_VIB_EN;
+ pm8x41_reg_write(QPNP_VIB_EN_CTL, val);
+}
diff --git a/dev/pmic/pm8x41/pm8x41_vib.c b/dev/pmic/pm8x41/pm8x41_vib.c
index 3246b9f..23f2246 100644
--- a/dev/pmic/pm8x41/pm8x41_vib.c
+++ b/dev/pmic/pm8x41/pm8x41_vib.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -30,29 +30,14 @@
#include <pm8x41_hw.h>
#include <pm_vib.h>
-#define QPNP_VIB_EN BIT(7)
-
/* Turn on vibrator */
void pm_vib_turn_on(void)
{
- uint8_t val;
-
- val = pm8x41_reg_read(QPNP_VIB_VTG_CTL);
- val &= ~QPNP_VIB_VTG_SET_MASK;
- val |= (QPNP_VIB_DEFAULT_VTG_LVL & QPNP_VIB_VTG_SET_MASK);
- pm8x41_reg_write(QPNP_VIB_VTG_CTL, val);
-
- val = pm8x41_reg_read(QPNP_VIB_EN_CTL);
- val |= QPNP_VIB_EN;
- pm8x41_reg_write(QPNP_VIB_EN_CTL, val);
+ pm8x41_vib_turn_on();
}
/* Turn off vibrator */
void pm_vib_turn_off(void)
{
- uint8_t val;
-
- val = pm8x41_reg_read(QPNP_VIB_EN_CTL);
- val &= ~QPNP_VIB_EN;
- pm8x41_reg_write(QPNP_VIB_EN_CTL, val);
+ pm8x41_vib_turn_off();
}
diff --git a/dev/vib/vibrator.c b/dev/vib/vibrator.c
index 8c7a031..4100c5e 100644
--- a/dev/vib/vibrator.c
+++ b/dev/vib/vibrator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2016, 2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -31,6 +31,10 @@
#include <kernel/thread.h>
#include <pm_vib.h>
#include <vibrator.h>
+#include <pm8x41.h>
+#include <platform.h>
+#include <smem.h>
+#include <target.h>
#define CHECK_VIB_TIMER_FREQUENCY 50
@@ -49,13 +53,23 @@
/* Function to turn on vibrator */
void vib_turn_on()
{
- pm_vib_turn_on();
+ uint32_t pmic = target_get_pmic();
+
+ if (pmic == PMIC_IS_PM8916)
+ pm8x41_vib_turn_on();
+ else
+ pm_vib_turn_on();
}
/* Function to turn off vibrator */
void vib_turn_off()
{
- pm_vib_turn_off();
+ uint32_t pmic = target_get_pmic();
+
+ if (pmic == PMIC_IS_PM8916)
+ pm8x41_vib_turn_off();
+ else
+ pm_vib_turn_off();
}
#if !USE_VIB_THREAD
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 7c94d06..87f5d3b 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -323,7 +323,7 @@
#if PON_VIB_SUPPORT
/* turn on vibrator to indicate that phone is booting up to end user */
- if(target_is_pmi_enabled())
+ if(target_is_pmi_enabled() || platform_is_qm215())
vib_timed_turn_on(VIBRATE_TIME);
#endif