spmi: Rename qpnp library to be part of the spmi framework
It turns out that the only use cases for the qpnp library use
the existing spmi data structures. As such, there's really
no justification for having the library not be called 'spmi'.
There is nothing Qualcomm specific about this code.
Also cleanup some inconsistencies in the Kernel Doc comments
while we're here.
Change-Id: I1c73c88be740b6f5d38ba2de62de1737981b30fa
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/qpnp.h b/arch/arm/mach-msm/include/mach/qpnp.h
deleted file mode 100644
index 1d2e440..0000000
--- a/arch/arm/mach-msm/include/mach/qpnp.h
+++ /dev/null
@@ -1,19 +0,0 @@
- /* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/spmi.h>
-
-struct resource *qpnp_get_resource(struct spmi_device *dev,
- unsigned int node_idx, unsigned int type,
- unsigned int res_num);
-int qpnp_get_irq(struct spmi_device *dev, unsigned int node_idx,
- unsigned int res_num);
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 0dcf1a4..900f6f9 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -557,6 +557,7 @@
config GPIO_QPNP
depends on ARCH_MSMCOPPER
+ depends on SPMI
depends on OF_SPMI
depends on MSM_QPNP_INT
tristate "Qualcomm QPNP GPIO support"
diff --git a/drivers/gpio/qpnp-gpio.c b/drivers/gpio/qpnp-gpio.c
index 97859e5..ef2657e 100644
--- a/drivers/gpio/qpnp-gpio.c
+++ b/drivers/gpio/qpnp-gpio.c
@@ -27,8 +27,6 @@
#include <linux/qpnp/gpio.h>
#include <linux/export.h>
-#include <mach/qpnp.h>
-
#define Q_REG_ADDR(q_spec, reg_index) \
((q_spec)->offset + reg_index)
@@ -921,7 +919,7 @@
/* now scan through again and populate the lookup table */
for (i = 0; i < spmi->num_dev_node; i++) {
- res = qpnp_get_resource(spmi, i, IORESOURCE_MEM, 0);
+ res = spmi_get_resource(spmi, i, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&spmi->dev, "%s: node %s is missing has no"
" base address definition\n",
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 2bbc796..6b0916e 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -419,8 +419,8 @@
constraint checking while the real driver is being developed.
config REGULATOR_QPNP
+ depends on SPMI
depends on OF_SPMI
- depends on MSM_QPNP
tristate "Qualcomm QPNP regulator support"
help
This driver supports voltage regulators in Qualcomm PMIC chips which
diff --git a/drivers/regulator/qpnp-regulator.c b/drivers/regulator/qpnp-regulator.c
index 120d17e..322af43 100644
--- a/drivers/regulator/qpnp-regulator.c
+++ b/drivers/regulator/qpnp-regulator.c
@@ -29,8 +29,6 @@
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/qpnp-regulator.h>
-#include <mach/qpnp.h>
-
/* Debug Flag Definitions */
enum {
QPNP_VREG_DEBUG_REQUEST = BIT(0), /* Show requests */
@@ -1189,7 +1187,7 @@
pdata->init_data.constraints.input_uV
= pdata->init_data.constraints.max_uV;
- res = qpnp_get_resource(spmi, 0, IORESOURCE_MEM, 0);
+ res = spmi_get_resource(spmi, 0, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&spmi->dev, "%s: node is missing base address\n",
__func__);
diff --git a/drivers/spmi/Kconfig b/drivers/spmi/Kconfig
index 84fd462..7026ee8 100644
--- a/drivers/spmi/Kconfig
+++ b/drivers/spmi/Kconfig
@@ -19,18 +19,11 @@
This is required for communicating with Qualcomm PMICs and
other devices that have the SPMI interface.
-config MSM_QPNP
- depends on ARCH_MSMCOPPER
- depends on OF_SPMI
- bool "MSM QPNP"
- help
- Say 'y' here to include support for the Qualcomm QPNP
-
config MSM_QPNP_INT
depends on SPARSE_IRQ
depends on ARCH_MSMCOPPER
+ depends on SPMI
depends on OF_SPMI
- depends on MSM_QPNP
bool "MSM QPNP INT"
help
Say 'y' here to include support for the Qualcomm QPNP interrupt
diff --git a/drivers/spmi/Makefile b/drivers/spmi/Makefile
index d59a610..becd823 100644
--- a/drivers/spmi/Makefile
+++ b/drivers/spmi/Makefile
@@ -1,7 +1,6 @@
#
# Makefile for kernel SPMI framework.
#
-obj-$(CONFIG_SPMI) += spmi.o
+obj-$(CONFIG_SPMI) += spmi.o spmi-resources.o
obj-$(CONFIG_SPMI_MSM_PMIC_ARB) += spmi-pmic-arb.o
-obj-$(CONFIG_MSM_QPNP) += qpnp.o
obj-$(CONFIG_MSM_QPNP_INT) += qpnp-int.o
diff --git a/drivers/spmi/qpnp.c b/drivers/spmi/spmi-resources.c
similarity index 65%
rename from drivers/spmi/qpnp.c
rename to drivers/spmi/spmi-resources.c
index a164efb..b692f82 100644
--- a/drivers/spmi/qpnp.c
+++ b/drivers/spmi/spmi-resources.c
@@ -15,15 +15,19 @@
*/
#include <linux/export.h>
-#include <mach/qpnp.h>
+#include <linux/spmi.h>
/**
- * qpnp_get_resource - get a resource for a device
- * @dev: qpnp device
+ * spmi_get_resource - get a resource for a device
+ * @dev: spmi device
+ * @node_idx: dev_node index
* @type: resource type
- * @num: resource index
+ * @res_num: resource index
+ *
+ * Returns
+ * NULL on failure.
*/
-struct resource *qpnp_get_resource(struct spmi_device *dev,
+struct resource *spmi_get_resource(struct spmi_device *dev,
unsigned int node_idx, unsigned int type,
unsigned int res_num)
{
@@ -37,20 +41,24 @@
}
return NULL;
}
-EXPORT_SYMBOL_GPL(qpnp_get_resource);
+EXPORT_SYMBOL_GPL(spmi_get_resource);
/**
- * qpnp_get_irq - get an IRQ for a device
- * @dev: qpnp device
- * @num: IRQ number index
+ * spmi_get_irq - get an IRQ for a device
+ * @dev: spmi device
+ * @node_idx: dev_node index
+ * @res_num: IRQ number index
+ *
+ * Returns
+ * -ENXIO on failure.
*/
-int qpnp_get_irq(struct spmi_device *dev, unsigned int node_idx,
+int spmi_get_irq(struct spmi_device *dev, unsigned int node_idx,
unsigned int res_num)
{
- struct resource *r = qpnp_get_resource(dev, node_idx,
+ struct resource *r = spmi_get_resource(dev, node_idx,
IORESOURCE_IRQ, res_num);
return r ? r->start : -ENXIO;
}
-EXPORT_SYMBOL_GPL(qpnp_get_irq);
+EXPORT_SYMBOL_GPL(spmi_get_irq);
diff --git a/include/linux/qpnp/gpio.h b/include/linux/qpnp/gpio.h
index e7fb53e..3c523ab 100644
--- a/include/linux/qpnp/gpio.h
+++ b/include/linux/qpnp/gpio.h
@@ -10,8 +10,6 @@
* GNU General Public License for more details.
*/
-#include <mach/qpnp.h>
-
#define QPNP_GPIO_DIR_IN 0
#define QPNP_GPIO_DIR_OUT 1
#define QPNP_GPIO_DIR_BOTH 2
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
index 927978a..71e9810 100644
--- a/include/linux/spmi.h
+++ b/include/linux/spmi.h
@@ -417,4 +417,11 @@
* -ETIMEDOUT if the SPMI transaction times out.
*/
extern int spmi_command_shutdown(struct spmi_controller *ctrl, u8 sid);
+
+extern struct resource *spmi_get_resource(struct spmi_device *dev,
+ unsigned int node_idx, unsigned int type,
+ unsigned int res_num);
+
+extern int spmi_get_irq(struct spmi_device *dev, unsigned int node_idx,
+ unsigned int res_num);
#endif