mfd: pmic8901: Add pm8xxx-misc mfd device

Misc driver supports global functions such as
pm8xxx_reset_power_off, pm8xxx_hard_reset_config.

Change-Id: Ic20482e693002ae97c31cc476bc52ad3f99891f7
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
diff --git a/drivers/mfd/pmic8901.c b/drivers/mfd/pmic8901.c
index 9e8786e..08aff1f 100644
--- a/drivers/mfd/pmic8901.c
+++ b/drivers/mfd/pmic8901.c
@@ -191,6 +191,11 @@
 	.pmic_get_revision	= pm8901_get_revision,
 };
 
+static struct mfd_cell misc_cell = {
+	.name		= PM8XXX_MISC_DEV_NAME,
+	.id		= 1,
+};
+
 static struct mfd_cell debugfs_cell = {
 	.name		= "pm8xxx-debug",
 	.id		= 1,
@@ -315,6 +320,17 @@
 		goto bail;
 	}
 
+	if (pdata->misc_pdata) {
+		misc_cell.platform_data = pdata->misc_pdata;
+		misc_cell.pdata_size = sizeof(struct pm8xxx_misc_platform_data);
+		rc = mfd_add_devices(pmic->dev, 0, &misc_cell, 1, NULL,
+				      irq_base);
+		if (rc) {
+			pr_err("Failed to add  misc subdevice ret=%d\n", rc);
+			goto bail;
+		}
+	}
+
 	return rc;
 
 bail:
diff --git a/include/linux/mfd/pmic8901.h b/include/linux/mfd/pmic8901.h
index 932f8da..a1206a9 100644
--- a/include/linux/mfd/pmic8901.h
+++ b/include/linux/mfd/pmic8901.h
@@ -23,6 +23,7 @@
 #include <linux/mfd/pm8xxx/mpp.h>
 #include <linux/mfd/pm8xxx/tm.h>
 #include <linux/regulator/pmic8901-regulator.h>
+#include <linux/mfd/pm8xxx/misc.h>
 
 #define PM8901_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
 
@@ -40,10 +41,11 @@
 struct pm8901_chip;
 
 struct pm8901_platform_data {
-	struct pm8xxx_irq_platform_data *irq_pdata;
-	struct pm8xxx_mpp_platform_data *mpp_pdata;
-	struct pm8901_vreg_pdata	*regulator_pdatas;
-	int				num_regulators;
+	struct pm8xxx_irq_platform_data		*irq_pdata;
+	struct pm8xxx_mpp_platform_data		*mpp_pdata;
+	struct pm8xxx_misc_platform_data	*misc_pdata;
+	struct pm8901_vreg_pdata		*regulator_pdatas;
+	int					num_regulators;
 };
 
 #ifdef CONFIG_PMIC8901