Skip to contentSkip to conversation

pm8921 core and subdevices

PATCH In review Abhijeet Dharmapurikar 4 participants 13 messages Apr 5, 2011 – Apr 26, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v5 cover pm8921 core and subdevices

This patch series adds support for pmic 8921 chip and its subdevices. The pmic 8921 chip is used as a power management ic for 8960 based boards. It communicates over the ssbi bus, ssbi bus can be found here

https://patchwork.kernel.org/patch/601771/

The patch set contains support for interrupt, gpio and mpp (multi purpose pin) subdevices.

Note that gpio and mpp subdevices need the interrupt subdevice to be operational, this is becuase the reading the the value of gpio/mpp lines happens by doing a transaction over registers managed by the interrupt subdev. The code invokes a call on interrupt subdevice, rather than writing to those registers directly, avoiding race conditions.

Updates from V4
Few things have changed in kernel proper since I last sent this series -The interrupt macro names have changed (more structured)- had to update the irq patch to use the new macro names
- mfd_cell does not have platfrom_data anymore - use mfd data instead.
- Had a mutex_destroy in the mpp code, I had updated mpp driver to use spinlocks but that mutex_destroy was still hanging there. Removed the mutex_destroy.
- since mpp code has been moved to gpio, updated the CONFIG name to reflect it is a gpio instead of a subdevice for mfd IOW use CONFIG_GPIO_PM8XXX_MPP instead of CONFIG_MFD_PM8XXX_MPP

Abhijeet Dharmapurikar (5):
mfd: pm8921: Add PMIC 8921 core driver
mfd: pm8xxx: Add irq support
gpio: pm8xxx-gpio: Add pm8xxx gpio driver
MAINTAINERS: Add patterns for pmic 8921 files to MSM subsystem
msm: board-8960: Add support for pm8921

David Collins (1):
mfd: pm8xxx-mpp: Add pm8xxx MPP driver

 MAINTAINERS                                |    2 +
 arch/arm/mach-msm/board-msm8960.c          |   40 +++-
 arch/arm/mach-msm/include/mach/irqs-8960.h |    9 +-
 drivers/gpio/Kconfig                       |   17 +
 drivers/gpio/Makefile                      |    2 +
 drivers/gpio/pm8xxx-gpio.c                 |  455 ++++++++++++++++++++++++++++
 drivers/gpio/pm8xxx-mpp.c                  |  325 ++++++++++++++++++++
 drivers/mfd/Kconfig                        |   28 ++
 drivers/mfd/Makefile                       |    2 +
 drivers/mfd/pm8921-core.c                  |  277 +++++++++++++++++
 drivers/mfd/pm8xxx-irq.c                   |  371 +++++++++++++++++++++++
 include/linux/mfd/pm8xxx/core.h            |   81 +++++
 include/linux/mfd/pm8xxx/gpio.h            |  136 +++++++++
 include/linux/mfd/pm8xxx/irq.h             |   59 ++++
 include/linux/mfd/pm8xxx/mpp.h             |  233 ++++++++++++++
 include/linux/mfd/pm8xxx/pm8921.h          |   49 +++
 16 files changed, 2077 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpio/pm8xxx-gpio.c
 create mode 100644 drivers/gpio/pm8xxx-mpp.c
 create mode 100644 drivers/mfd/pm8921-core.c
 create mode 100644 drivers/mfd/pm8xxx-irq.c
 create mode 100644 include/linux/mfd/pm8xxx/core.h
 create mode 100644 include/linux/mfd/pm8xxx/gpio.h
 create mode 100644 include/linux/mfd/pm8xxx/irq.h
 create mode 100644 include/linux/mfd/pm8xxx/mpp.h
 create mode 100644 include/linux/mfd/pm8xxx/pm8921.h

Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

#1 lore raw

PATCH v5 1/6 mfd: pm8921: Add PMIC 8921 core driver

Add support for the Qualcomm PM8921 PMIC chip. The core driver will communicate with the PMIC chip via the MSM SSBI bus.

---
 drivers/mfd/Kconfig               |   18 ++++
 drivers/mfd/Makefile              |    1 +
 drivers/mfd/pm8921-core.c         |  158 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/pm8xxx/core.h   |   71 +++++++++++++++++
 include/linux/mfd/pm8xxx/pm8921.h |   27 ++++++
 5 files changed, 275 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/pm8921-core.c
 create mode 100644 include/linux/mfd/pm8xxx/core.h
 create mode 100644 include/linux/mfd/pm8xxx/pm8921.h
drivers/mfd/Kconfig +18 -0
index e2fea58..f9febb9 100644
@@ -671,6 +671,24 @@ config MFD_OMAP_USB_HOST
 	  This MFD driver does the required setup functionalities for
 	  OMAP USB Host drivers.
 
+config MFD_PM8XXX
+	tristate
+
+config MFD_PM8921_CORE
+	tristate "Qualcomm PM8921 PMIC chip"
+	depends on MSM_SSBI
+	select MFD_CORE
+	select MFD_PM8XXX
+	help
+	  If you say yes to this option, support will be included for the
+	  built-in PM8921 PMIC chip.
+
+	  This is required if your board has a PM8921 and uses its features,
+	  such as: MPPs, GPIOs, regulators, interrupts, and PWM.
+
+	  Say M here if you want to include support for PM8921 chip as a module.
+	  This will build a module called "pm8921-core".
+
 endif # MFD_SUPPORT
 
 menu "Multimedia Capabilities Port drivers"
drivers/mfd/Makefile +1 -0
index 419caa9..e1b446c 100644
@@ -88,3 +88,4 @@ obj-$(CONFIG_MFD_VX855)		+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)	+= wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)	+= cs5535-mfd.o
 obj-$(CONFIG_MFD_OMAP_USB_HOST)	+= omap-usb-host.o
+obj-$(CONFIG_MFD_PM8921_CORE) 	+= pm8921-core.o
drivers/mfd/pm8921-core.c new file +158 -0

158 lines not on this page · raw message

include/linux/mfd/pm8xxx/core.h new file +71 -0

71 lines not on this page · raw message

include/linux/mfd/pm8xxx/pm8921.h new file +27 -0
new file mode 100644
index 0000000..33fbe9c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+/*
+ * Qualcomm PMIC 8921 driver header file
+ *
+ */
+
+#ifndef __MFD_PM8921_H
+#define __MFD_PM8921_H
+
+#include <linux/device.h>
+
+struct pm8921_platform_data {
+	int					irq_base;
+};
+
+#endif
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw

PATCH v5 2/6 mfd: pm8xxx: Add irq support

In reply to Abhijeet Dharmapurikar

Add support for the irq controller in Qualcomm 8xxx pmic. The 8xxx interrupt controller provides control for gpio and mpp configured as interrupts in addition to other subdevice interrupts. The interrupt controller also provides a way to read the real time status of an interrupt. This real time status is the only way one can get the input values of gpio and mpp lines.

---
 drivers/mfd/Kconfig               |   10 +
 drivers/mfd/Makefile              |    1 +
 drivers/mfd/pm8921-core.c         |   54 ++++++
 drivers/mfd/pm8xxx-irq.c          |  371 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/pm8xxx/core.h   |   10 +
 include/linux/mfd/pm8xxx/irq.h    |   59 ++++++
 include/linux/mfd/pm8xxx/pm8921.h |    4 +
 7 files changed, 509 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/pm8xxx-irq.c
 create mode 100644 include/linux/mfd/pm8xxx/irq.h
drivers/mfd/Kconfig +10 -0
index f9febb9..38320e2 100644
@@ -689,6 +689,16 @@ config MFD_PM8921_CORE
 	  Say M here if you want to include support for PM8921 chip as a module.
 	  This will build a module called "pm8921-core".
 
+config MFD_PM8XXX_IRQ
+	bool "Support for Qualcomm PM8xxx IRQ features"
+	depends on MFD_PM8XXX
+	default y if MFD_PM8XXX
+	help
+	  This is the IRQ driver for Qualcomm PM 8xxx PMIC chips.
+
+	  This is required to use certain other PM 8xxx features, such as GPIO
+	  and MPP.
+
 endif # MFD_SUPPORT
 
 menu "Multimedia Capabilities Port drivers"
drivers/mfd/Makefile +1 -0
index e1b446c..f4afcc8 100644
@@ -89,3 +89,4 @@ obj-$(CONFIG_MFD_WL1273_CORE)	+= wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)	+= cs5535-mfd.o
 obj-$(CONFIG_MFD_OMAP_USB_HOST)	+= omap-usb-host.o
 obj-$(CONFIG_MFD_PM8921_CORE) 	+= pm8921-core.o
+obj-$(CONFIG_MFD_PM8XXX_IRQ) 	+= pm8xxx-irq.o
drivers/mfd/pm8921-core.c +54 -0

110 lines not on this page · raw message

drivers/mfd/pm8xxx-irq.c new file +371 -0

371 lines not on this page · raw message

include/linux/mfd/pm8xxx/core.h +10 -0
index 36ccb33..bd2f4f6 100644
@@ -27,6 +27,7 @@ struct pm8xxx_drvdata {
 									int n);
 	int	(*pmic_write_buf) (const struct device *dev, u16 addr, u8 *buf,
 									int n);
+	int	(*pmic_read_irq_stat) (const struct device *dev, int irq);
 	void	*pm_chip_data;
 };
 
@@ -68,4 +69,13 @@ static inline int pm8xxx_write_buf(const struct device *dev, u16 addr, u8 *buf,
 	return dd->pmic_write_buf(dev, addr, buf, n);
 }
 
+static inline int pm8xxx_read_irq_stat(const struct device *dev, int irq)
+{
+	struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
+
+	if (!dd)
+		return -EINVAL;
+	return dd->pmic_read_irq_stat(dev, irq);
+}
+
 #endif
include/linux/mfd/pm8xxx/irq.h new file +59 -0

59 lines not on this page · raw message

include/linux/mfd/pm8xxx/pm8921.h +4 -0
index 33fbe9c..d5517fd 100644
@@ -19,9 +19,13 @@
 #define __MFD_PM8921_H
 
 #include <linux/device.h>
+#include <linux/mfd/pm8xxx/irq.h>
+
+#define PM8921_NR_IRQS		256
 
 struct pm8921_platform_data {
 	int					irq_base;
+	struct pm8xxx_irq_platform_data		*irq_pdata;
 };
 
 #endif
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw

PATCH v5 3/6 gpio: pm8xxx-gpio: Add pm8xxx gpio driver

In reply to Abhijeet Dharmapurikar

Add support for GPIO on Qualcomm PM8xxx PMIC chips.

---
 drivers/gpio/Kconfig              |    9 +
 drivers/gpio/Makefile             |    1 +
 drivers/gpio/pm8xxx-gpio.c        |  455 +++++++++++++++++++++++++++++++++++++
 drivers/mfd/pm8921-core.c         |   35 +++
 include/linux/mfd/pm8xxx/gpio.h   |  136 +++++++++++
 include/linux/mfd/pm8xxx/pm8921.h |   11 +
 6 files changed, 647 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/pm8xxx-gpio.c
 create mode 100644 include/linux/mfd/pm8xxx/gpio.h
drivers/gpio/Kconfig +9 -0
index d3b2953..2035f90 100644
@@ -419,4 +419,13 @@ config AB8500_GPIO
 	depends on AB8500_CORE && BROKEN
 	help
 	  Select this to enable the AB8500 IC GPIO driver
+
+config GPIO_PM8XXX
+	tristate "Qualcomm PM8xxx GPIO support"
+	depends on MFD_PM8XXX
+	default y if MFD_PM8XXX
+	help
+	  This option enables support for on-chip GPIO found on Qualcomm PM8xxx
+	  PMICs.
+
 endif
drivers/gpio/Makefile +1 -0
index becef59..337aa34 100644
@@ -43,3 +43,4 @@ obj-$(CONFIG_GPIO_SX150X)	+= sx150x.o
 obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
+obj-$(CONFIG_GPIO_PM8XXX)	+= pm8xxx-gpio.o
drivers/gpio/pm8xxx-gpio.c new file +455 -0

455 lines not on this page · raw message

drivers/mfd/pm8921-core.c +35 -0
index e873b15..0f1691f 100644
@@ -80,6 +80,22 @@ static struct pm8xxx_drvdata pm8921_drvdata = {
 	.pmic_read_irq_stat	= pm8921_read_irq_stat,
 };
 
+static const struct resource gpio_cell_resources[] __devinitconst = {
+	[0] = {
+		.start = PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, 0),
+		.end   = PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, 0)
+			+ PM8921_NR_GPIOS - 1,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static struct mfd_cell gpio_cell __devinitdata = {
+	.name		= PM8XXX_GPIO_DEV_NAME,
+	.id		= -1,
+	.resources	= gpio_cell_resources,
+	.num_resources	= ARRAY_SIZE(gpio_cell_resources),
+};
+
 static int __devinit pm8921_add_subdevices(const struct pm8921_platform_data
 					   *pdata,
 					   struct pm8921 *pmic,
@@ -101,6 +117,25 @@ static int __devinit pm8921_add_subdevices(const struct pm8921_platform_data
 		}
 		pmic->irq_chip = irq_chip;
 	}
+
+	if (pdata->gpio_pdata) {
+		pdata->gpio_pdata->gpio_cdata.ngpios = PM8921_NR_GPIOS;
+		pdata->gpio_pdata->gpio_cdata.rev = rev;
+		gpio_cell.mfd_data = pdata->gpio_pdata;
+		ret = mfd_add_devices(pmic->dev, 0, &gpio_cell, 1,
+					NULL, irq_base);
+		if (ret) {
+			pr_err("Failed to add  gpio subdevice ret=%d\n", ret);
+			goto bail;
+		}
+	}
+
+	return 0;
+bail:
+	if (pmic->irq_chip) {
+		pm8xxx_irq_exit(pmic->irq_chip);
+		pmic->irq_chip = NULL;
+	}
 	return ret;
 }
 
include/linux/mfd/pm8xxx/gpio.h new file +136 -0

136 lines not on this page · raw message

include/linux/mfd/pm8xxx/pm8921.h +11 -0
index d5517fd..def8c31 100644
@@ -20,12 +20,23 @@
 
 #include <linux/device.h>
 #include <linux/mfd/pm8xxx/irq.h>
+#include <linux/mfd/pm8xxx/gpio.h>
 
 #define PM8921_NR_IRQS		256
 
+#define PM8921_NR_GPIOS		44
+
+#define PM8921_GPIO_BLOCK_START	24
+#define PM8921_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
+
+/* GPIOs [1,N] */
+#define PM8921_GPIO_IRQ(base, gpio)	((base) + \
+		PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, (gpio)-1))
+
 struct pm8921_platform_data {
 	int					irq_base;
 	struct pm8xxx_irq_platform_data		*irq_pdata;
+	struct pm8xxx_gpio_platform_data	*gpio_pdata;
 };
 
 #endif
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw

PATCH v5 4/6 mfd: pm8xxx-mpp: Add pm8xxx MPP driver

In reply to Abhijeet Dharmapurikar

From: David Collins <[email protected]>

Add support for multi-purpose pins (MPPs) on Qualcomm PM8xxx PMIC chips.

PM8xxx MPPs can be configured as digital or analog inputs or outputs, current sinks, or buffers.

Note that mpp pins appear as gpio lines to the kernel. However they are implemented separately from the pmic's gpio driver as mpps have different configuration attributes and have different register controls than the pmic's gpio controller. Basically they are different set of pins.

---
 drivers/gpio/Kconfig              |    8 +
 drivers/gpio/Makefile             |    1 +
 drivers/gpio/pm8xxx-mpp.c         |  325 +++++++++++++++++++++++++++++++++++++
 drivers/mfd/pm8921-core.c         |   30 ++++
 include/linux/mfd/pm8xxx/mpp.h    |  233 ++++++++++++++++++++++++++
 include/linux/mfd/pm8xxx/pm8921.h |    9 +-
 6 files changed, 605 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/pm8xxx-mpp.c
 create mode 100644 include/linux/mfd/pm8xxx/mpp.h
drivers/gpio/Kconfig +8 -0
index 2035f90..e6efaca 100644
@@ -428,4 +428,12 @@ config GPIO_PM8XXX
 	  This option enables support for on-chip GPIO found on Qualcomm PM8xxx
 	  PMICs.
 
+config GPIO_PM8XXX_MPP
+	tristate "Support for Qualcomm PM8xxx MPP features"
+	depends on MFD_PM8XXX
+	default y if MFD_PM8XXX
+	help
+	  This is the multi-purpose pin (MPP) driver for Qualcomm PM 8xxx PMIC
+	  chips.
+
 endif
drivers/gpio/Makefile +1 -0
index 337aa34..50ee44d 100644
@@ -44,3 +44,4 @@ obj-$(CONFIG_GPIO_VX855)	+= vx855_gpio.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= ml_ioh_gpio.o
 obj-$(CONFIG_AB8500_GPIO)       += ab8500-gpio.o
 obj-$(CONFIG_GPIO_PM8XXX)	+= pm8xxx-gpio.o
+obj-$(CONFIG_GPIO_PM8XXX_MPP) 	+= pm8xxx-mpp.o
drivers/gpio/pm8xxx-mpp.c new file +325 -0

325 lines not on this page · raw message

drivers/mfd/pm8921-core.c +30 -0
index 0f1691f..2fbd42d 100644
@@ -25,6 +25,8 @@
 #define REG_HWREV		0x002  /* PMIC4 revision */
 #define REG_HWREV_2		0x0E8  /* PMIC4 revision 2 */
 
+#define REG_MPP_BASE		0x050
+
 struct pm8921 {
 	struct device			*dev;
 	struct pm_irq_chip		*irq_chip;
@@ -96,6 +98,22 @@ static struct mfd_cell gpio_cell __devinitdata = {
 	.num_resources	= ARRAY_SIZE(gpio_cell_resources),
 };
 
+static const struct resource mpp_cell_resources[] __devinitconst = {
+	{
+		.start	= PM8921_IRQ_BLOCK_BIT(PM8921_MPP_BLOCK_START, 0),
+		.end	= PM8921_IRQ_BLOCK_BIT(PM8921_MPP_BLOCK_START, 0)
+			  + PM8921_NR_MPPS - 1,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct mfd_cell mpp_cell __devinitdata = {
+	.name		= PM8XXX_MPP_DEV_NAME,
+	.id		= -1,
+	.resources	= mpp_cell_resources,
+	.num_resources	= ARRAY_SIZE(mpp_cell_resources),
+};
+
 static int __devinit pm8921_add_subdevices(const struct pm8921_platform_data
 					   *pdata,
 					   struct pm8921 *pmic,
@@ -130,6 +148,18 @@ static int __devinit pm8921_add_subdevices(const struct pm8921_platform_data
 		}
 	}
 
+	if (pdata->mpp_pdata) {
+		pdata->mpp_pdata->core_data.nmpps = PM8921_NR_MPPS;
+		pdata->mpp_pdata->core_data.base_addr = REG_MPP_BASE;
+		mpp_cell.mfd_data = pdata->mpp_pdata;
+		ret = mfd_add_devices(pmic->dev, 0, &mpp_cell, 1, NULL,
+					irq_base);
+		if (ret) {
+			pr_err("Failed to add mpp subdevice ret=%d\n", ret);
+			goto bail;
+		}
+	}
+
 	return 0;
 bail:
 	if (pmic->irq_chip) {
include/linux/mfd/pm8xxx/mpp.h new file +233 -0

233 lines not on this page · raw message

include/linux/mfd/pm8xxx/pm8921.h +8 -1
index def8c31..19cffb2 100644
@@ -21,22 +21,29 @@
 #include <linux/device.h>
 #include <linux/mfd/pm8xxx/irq.h>
 #include <linux/mfd/pm8xxx/gpio.h>
+#include <linux/mfd/pm8xxx/mpp.h>
 
 #define PM8921_NR_IRQS		256
 
 #define PM8921_NR_GPIOS		44
 
+#define PM8921_NR_MPPS		12
+
 #define PM8921_GPIO_BLOCK_START	24
+#define PM8921_MPP_BLOCK_START	16
 #define PM8921_IRQ_BLOCK_BIT(block, bit) ((block) * 8 + (bit))
 
-/* GPIOs [1,N] */
+/* GPIOs and MPPs [1,N] */
 #define PM8921_GPIO_IRQ(base, gpio)	((base) + \
 		PM8921_IRQ_BLOCK_BIT(PM8921_GPIO_BLOCK_START, (gpio)-1))
+#define PM8921_MPP_IRQ(base, mpp)	((base) + \
+		PM8921_IRQ_BLOCK_BIT(PM8921_MPP_BLOCK_START, (mpp)-1))
 
 struct pm8921_platform_data {
 	int					irq_base;
 	struct pm8xxx_irq_platform_data		*irq_pdata;
 	struct pm8xxx_gpio_platform_data	*gpio_pdata;
+	struct pm8xxx_mpp_platform_data		*mpp_pdata;
 };
 
 #endif
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw

PATCH v5 5/6 MAINTAINERS: Add patterns for pmic 8921 files to MSM subsystem

In reply to Abhijeet Dharmapurikar
---
 MAINTAINERS |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
MAINTAINERS +2 -0
index 6b4b9cd..b9db68b 100644
@@ -916,6 +916,8 @@ F:	drivers/mmc/host/msm_sdcc.h
 F:	drivers/tty/serial/msm_serial.h
 F:	drivers/tty/serial/msm_serial.c
 F:	drivers/platform/msm/
+F:	drivers/*/pm8???-*
+F:	include/linux/mfd/pm8xxx/
 T:	git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
 S:	Maintained
 
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Acked-by on v5 5/6
#6 lore raw

Re: [PM8921 MFD V5 5/6] MAINTAINERS: Add patterns for pmic 8921 files to MSM subsystem

Quoted 10 lines · Abhijeet Dharmapurikar
---
 MAINTAINERS |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
MAINTAINERS +0 -0
index 6b4b9cd..b9db68b 100644

MAINTAINERS F: drivers/mmc/host/msm_sdcc.h · line 922

Quoted 7 lines
MAINTAINERS +2 -0
@@ -916,6 +916,8 @@ F:	drivers/mmc/host/msm_sdcc.h
 F:	drivers/tty/serial/msm_serial.h
 F:	drivers/tty/serial/msm_serial.c
 F:	drivers/platform/msm/
+F:	drivers/*/pm8???-*
+F:	include/linux/mfd/pm8xxx/
 T:	git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
 S:	Maintained
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw

PATCH v5 6/6 msm: board-8960: Add support for pm8921

In reply to Abhijeet Dharmapurikar

Add device structure declarations to the msm8960 board file for PMIC 8921 chip and its subdevices.

---
 arch/arm/mach-msm/board-msm8960.c          |   40 +++++++++++++++++++++++++---
 arch/arm/mach-msm/include/mach/irqs-8960.h |    9 +++---
 2 files changed, 40 insertions(+), 9 deletions(-)
arch/arm/mach-msm/board-msm8960.c +36 -4
index 8d2384a..e7e8613 100644
@@ -15,12 +15,14 @@
  * 02110-1301, USA.
  *
  */
+
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/clkdev.h>
 #include <linux/msm_ssbi.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -28,9 +30,18 @@
 
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
+#include <mach/irqs.h>
 
 #include "devices.h"
 
+/* Macros assume PMIC GPIOs and MPPs start at 1 */
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_GPIO_BASE)
+#define PM8921_MPP_BASE			(PM8921_GPIO_BASE + PM8921_NR_GPIOS)
+#define PM8921_MPP_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_MPP_BASE)
+#define PM8921_IRQ_BASE			(NR_MSM_IRQS + NR_GPIO_IRQS)
+#define PM8921_MPP_IRQ_BASE		(PM8921_IRQ_BASE + NR_GPIO_IRQS)
+
 static void __init msm8960_map_io(void)
 {
 	msm_map_msm8960_io();
@@ -71,15 +82,36 @@ static struct platform_device *rumi3_devices[] __initdata = {
 	&msm8960_device_uart_gsbi5,
 };
 
+static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
+	.irq_base		= PM8921_IRQ_BASE,
+	.devirq			= MSM_GPIO_TO_INT(104),
+	.irq_trigger_flag	= IRQF_TRIGGER_LOW,
+};
+
+static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
+	.gpio_base	= PM8921_GPIO_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
+	.mpp_base	= PM8921_MPP_PM_TO_SYS(1),
+};
+
+static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&msm8960_device_dmov,
 	&msm8960_device_ssbi_pm8921,
 };
 
-static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata = {
-	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
-	.slave	= {
-		.name		= "pm8921-core",
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __initdata = {
+	.controller_type	= MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave			= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data,
 	},
 };
 
arch/arm/mach-msm/include/mach/irqs-8960.h +4 -5
index 81ab2a6..0a5b9c5 100644
@@ -267,11 +267,10 @@
 #define PM8921_SEC_IRQ_104			(GIC_SPI_START + 225)
 #define PM8018_SEC_IRQ_107			(GIC_SPI_START + 226)
 
-/* For now, use the maximum number of interrupts until a pending GIC issue
- * is sorted out */
-#define NR_MSM_IRQS 1020
-#define NR_BOARD_IRQS 0
-#define NR_GPIO_IRQS 0
+#define NR_MSM_IRQS 256
+#define NR_GPIO_IRQS 150
+#define NR_PM8921_IRQS 256
+#define NR_BOARD_IRQS (NR_PM8921_IRQS)
 
 #endif
 
Signature · 4 lines
1.7.1

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#8 lore raw
In reply to Abhijeet Dharmapurikar

Hi Abhijeet,

Quoted 6 lines · Abhijeet Dharmapurikar

This patch series adds support for pmic 8921 chip and its subdevices. The pmic 8921 chip is used as a power management ic for 8960 based boards. It communicates over the ssbi bus, ssbi bus can be found here

https://patchwork.kernel.org/patch/601771/

Quoted 8 lines

The patch set contains support for interrupt, gpio and mpp (multi purpose pin) subdevices.

Note that gpio and mpp subdevices need the interrupt subdevice to be operational, this is becuase the reading the the value of gpio/mpp lines happens by doing a transaction over registers managed by the interrupt subdev. The code invokes a call on interrupt subdevice, rather than writing to those registers directly, avoiding race conditions.

I have applied patch #1 and #2 to my for-next branch. For 3 and4, I'll wait for Grant's ACK. As for #5, I'd like to get an ACK from the current MSM maintainers.
Finally, patch #6 will be applied last.

Quoted 5 lines

Updates from V4
Few things have changed in kernel proper since I last sent this series -The interrupt macro names have changed (more structured)- had to update the irq patch to use the new macro names
- mfd_cell does not have platfrom_data anymore - use mfd data instead.

I'm currently moving that away from the mfd_cell structure, in my for-next branch. mfd_cell now has a platform_data pointer back, and you should use mfd_get_cell() if you really need to reach the mfd_cell pointer (which you apparently don't).
Could you please generate patchs 3 and 4 against this branch ?

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#9 lore raw

Hi Samuel,

Quoted 6 lines · Samuel Ortiz
Quoted 1 line

- mfd_cell does not have platfrom_data anymore - use mfd data instead.

I'm currently moving that away from the mfd_cell structure, in my for-next branch. mfd_cell now has a platform_data pointer back, and you should use mfd_get_cell() if you really need to reach the mfd_cell pointer (which you apparently don't).
Could you please generate patchs 3 and 4 against this branch ?

I just saw commit

5828fdb (mfd: Use mfd cell platform_data for mc13xxx cells platform bits)

in next. It has a Cc: for me, but I didn't got it by mail.

Did you send a mail and it didn't reach me? Or maybe you just forgot to send the mail out?

Anyhow, Acked-by: Uwe Kleine-K?nig <[email protected]> for 5828fdb, but I wonder if it's worth to add a new member to struct platform_device for that to work.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#10 lore raw

Hi Uwe,

Quoted 9 lines · Uwe Kleine-K?nig

Hi Samuel,

Quoted 6 lines · Samuel Ortiz
Quoted 1 line

- mfd_cell does not have platfrom_data anymore - use mfd data instead.

I'm currently moving that away from the mfd_cell structure, in my for-next branch. mfd_cell now has a platform_data pointer back, and you should use mfd_get_cell() if you really need to reach the mfd_cell pointer (which you apparently don't).
Could you please generate patchs 3 and 4 against this branch ?

Quoted 8 lines

I just saw commit

5828fdb (mfd: Use mfd cell platform_data for mc13xxx cells platform bits)

in next. It has a Cc: for me, but I didn't got it by mail.

Did you send a mail and it didn't reach me? Or maybe you just forgot to send the mail out?

I haven't sent the patchset to lkml yet.

Quoted 2 lines

Anyhow, Acked-by: Uwe Kleine-K?nig <[email protected]> for 5828fdb,

Thanks a lot.

Quoted 2 lines

but I wonder if it's worth to add a new member to struct platform_device for that to work.

This has been discussed at length already, and it's probably the best solution for now to clearly separate mfd cell access from the platform data bits.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#11 lore raw
In reply to Samuel Ortiz
Quoted 3 lines · Samuel Ortiz

I have applied patch #1 and #2 to my for-next branch. For 3 and4, I'll wait for Grant's ACK. As for #5, I'd like to get an ACK from the current MSM maintainers.

I've replied to that patch with an Ack.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#12 lore raw

Hi David,

Quoted 7 lines · David Brown
Quoted 3 lines · Samuel Ortiz

I have applied patch #1 and #2 to my for-next branch. For 3 and4, I'll wait for Grant's ACK. As for #5, I'd like to get an ACK from the current MSM maintainers.

I've replied to that patch with an Ack.

Thanks a lot. I applied the patch now.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/