dev: pmic: pm8x41: add support to configure pmic gpio params

Add support to configure the output source select for pmic gpio.
Define the values for the configuration for the source select.

Change-Id: Icb0980771f033afa125022cc399943295ba09c6c
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 2c79ee4..2e0a270 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017, 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
@@ -64,6 +64,9 @@
 #define PON_PSHOLD_SHUTDOWN     0x4
 #define PON_PSHOLD_HARD_RESET   0x7
 
+#define PM_GPIO_NO_INVERT       0x00
+#define PM_GPIO_INVERT          0x01
+
 enum PM8X41_VERSIONS
 {
 	PM8X41_VERSION_V1 = 0,
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index 26fbd5e..6484a10 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017, 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
@@ -58,6 +58,7 @@
 #define GPIO_MODE_CTL                         0x40
 #define GPIO_DIG_VIN_CTL                      0x41
 #define GPIO_DIG_PULL_CTL                     0x42
+#define GPIO_DIG_OUT_SRC_CTL                  0x44
 #define GPIO_DIG_OUT_CTL                      0x45
 #define GPIO_EN_CTL                           0x46
 
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 4a4da3a..51a0f96 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017, 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
@@ -186,6 +186,10 @@
 		REG_WRITE(gpio_base + GPIO_DIG_OUT_CTL, val);
 	}
 
+	/* Output source sel and output invert */
+	val = config->inv_int_pol << 7;
+	REG_WRITE(gpio_base + GPIO_DIG_OUT_SRC_CTL, val);
+
 	/* Enable the GPIO */
 	val  = REG_READ(gpio_base + GPIO_EN_CTL);
 	val |= BIT(PERPH_EN_BIT);