dev: pmic: Move the old-gen vibrator to the common pm8x41 file

QM215 uses the msm8952 platform configuration. The PMIC supported
on QM215 is PM8916 which uses the old-gen vibrator. To support
both the vibrators (PM8916 and PMI8950/37) add logic which
detects the PMIC type and calls into the right vibrator function.

Change-Id: I75999c0d7e16e831947e537fc54d538be376fd99
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
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