Skip to contentSkip to conversation

axp20x minor fixes

PATCH Applied Jacob Pan 3 participants 10 messages Nov 11, 2014 – Nov 18, 2014

Subsystems (4)
lore
Share & tools
lore

Jacob Pan

author
#0 lore raw

cover axp20x minor fixes

A few fixes based on mfd/ib-mfd-iio-3.19.

Aaron Lu (1):
iio: adc: Add module device table for autoloading

Jacob Pan (2):
mfd/axp20x: avoid irq numbering collision
iio/axp288_adc: remove THIS_MODULE owner

 drivers/iio/adc/axp288_adc.c |  9 ++++++++-
 drivers/mfd/axp20x.c         | 18 +++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/3 iio: adc: Add module device table for autoloading

From: Aaron Lu <[email protected]>

Add the module device id table so that the driver can be automatically loaded once the platform device is created.

---
 drivers/iio/adc/axp288_adc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iio/adc/axp288_adc.c +8 -0
index 4800286..4a6cf43 100644
@@ -238,15 +238,23 @@ static int axp288_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct platform_device_id axp288_adc_id_table[] = {
+	{ .name = "axp288_adc" },
+	{},
+};
+
 static struct platform_driver axp288_adc_driver = {
 	.probe = axp288_adc_probe,
 	.remove = axp288_adc_remove,
+	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
 		.owner = THIS_MODULE,
 	},
 };
 
+MODULE_DEVICE_TABLE(platform, axp288_adc_id_table);
+
 module_platform_driver(axp288_adc_driver);
 
 MODULE_AUTHOR("Jacob Pan <[email protected]>");
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] iio: adc: Add module device table for autoloading

Quoted 7 lines · Jacob Pan

From: Aaron Lu <[email protected]>

Add the module device id table so that the driver can be automatically loaded once the platform device is created.

Quoted 33 lines
---
 drivers/iio/adc/axp288_adc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iio/adc/axp288_adc.c +8 -0
index 4800286..4a6cf43 100644
@@ -238,15 +238,23 @@ static int axp288_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct platform_device_id axp288_adc_id_table[] = {
+	{ .name = "axp288_adc" },
+	{},
+};
+
 static struct platform_driver axp288_adc_driver = {
 	.probe = axp288_adc_probe,
 	.remove = axp288_adc_remove,
+	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
 		.owner = THIS_MODULE,
 	},
 };
 
+MODULE_DEVICE_TABLE(platform, axp288_adc_id_table);
+
 module_platform_driver(axp288_adc_driver);
 
 MODULE_AUTHOR("Jacob Pan <[email protected]>");
Applied
#3 lore raw

Re: [PATCH 1/3] iio: adc: Add module device table for autoloading

In reply to Jacob Pan
Quoted 10 lines · Jacob Pan

From: Aaron Lu <[email protected]>

Add the module device id table so that the driver can be automatically loaded once the platform device is created.

---
 drivers/iio/adc/axp288_adc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied, thanks.

Quoted 28 lines
drivers/iio/adc/axp288_adc.c +8 -0
index 4800286..4a6cf43 100644
@@ -238,15 +238,23 @@ static int axp288_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct platform_device_id axp288_adc_id_table[] = {
+	{ .name = "axp288_adc" },
+	{},
+};
+
 static struct platform_driver axp288_adc_driver = {
 	.probe = axp288_adc_probe,
 	.remove = axp288_adc_remove,
+	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
 		.owner = THIS_MODULE,
 	},
 };
 
+MODULE_DEVICE_TABLE(platform, axp288_adc_id_table);
+
 module_platform_driver(axp288_adc_driver);
 
 MODULE_AUTHOR("Jacob Pan <[email protected]>");
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#4 lore raw

PATCH 2/3 mfd/axp20x: avoid irq numbering collision

In reply to Jacob Pan

IRQ numbers in axp20x devices are defined with high-order bit first in each IRQ enable/status registers. On Intel platforms it is more common to number IRQs with least significant bit first. Therefore, sharing IRQ# between the two is very difficult. Since AXP288 is a customized PMIC for Intel platform and the amount of shared IRQs are very small, we use separate IRQ numbering. This also fixes collision and a duplicate in WBTO interrupt.

e.g. For the 16 interrupts controlled in IRQ enabled registers 1 & 2, on axp20x for ARM, the PMIC local IRQ numbers and register bits are mapped as:
IRQ#: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
---------------------------------------------------------

ARM:   7  6  5  4  3  2  1  0      7  6  5  4  3  2  1  0
Intel: 0  1  2  3  4  5  6  7      0  1  2  3  4  5  6  7
---
 drivers/mfd/axp20x.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/mfd/axp20x.c +9 -9
index daf3c8d..0a8fcd9 100644
@@ -183,21 +183,21 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
 
 /* some IRQs are compatible with axp20x models */
 static const struct regmap_irq axp288_regmap_irqs[] = {
-	INIT_REGMAP_IRQ(AXP20X, VBUS_REMOVAL,           0, 2),
-	INIT_REGMAP_IRQ(AXP20X, VBUS_PLUGIN,            0, 3),
-	INIT_REGMAP_IRQ(AXP20X, VBUS_OVER_V,            0, 4),
+	INIT_REGMAP_IRQ(AXP288, VBUS_FALL,              0, 2),
+	INIT_REGMAP_IRQ(AXP288, VBUS_RISE,              0, 3),
+	INIT_REGMAP_IRQ(AXP288, OV,                     0, 4),
 
-	INIT_REGMAP_IRQ(AXP20X, CHARG_DONE,             1, 2),
-	INIT_REGMAP_IRQ(AXP20X, CHARG,                  1, 3),
+	INIT_REGMAP_IRQ(AXP288, DONE,                   1, 2),
+	INIT_REGMAP_IRQ(AXP288, CHARGING,               1, 3),
 	INIT_REGMAP_IRQ(AXP288, SAFE_QUIT,              1, 4),
 	INIT_REGMAP_IRQ(AXP288, SAFE_ENTER,             1, 5),
-	INIT_REGMAP_IRQ(AXP20X, BATT_REMOVAL,           1, 6),
-	INIT_REGMAP_IRQ(AXP20X, BATT_PLUGIN,            1, 7),
+	INIT_REGMAP_IRQ(AXP288, ABSENT,                 1, 6),
+	INIT_REGMAP_IRQ(AXP288, APPEND,                 1, 7),
 
 	INIT_REGMAP_IRQ(AXP288, QWBTU,                  2, 0),
 	INIT_REGMAP_IRQ(AXP288, WBTU,                   2, 1),
 	INIT_REGMAP_IRQ(AXP288, QWBTO,                  2, 2),
-	INIT_REGMAP_IRQ(AXP288, WBTU,                   2, 3),
+	INIT_REGMAP_IRQ(AXP288, WBTO,                   2, 3),
 	INIT_REGMAP_IRQ(AXP288, QCBTU,                  2, 4),
 	INIT_REGMAP_IRQ(AXP288, CBTU,                   2, 5),
 	INIT_REGMAP_IRQ(AXP288, QCBTO,                  2, 6),
@@ -215,7 +215,7 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, POKS,                   4, 4),
 	INIT_REGMAP_IRQ(AXP288, POKN,                   4, 5),
 	INIT_REGMAP_IRQ(AXP288, POKP,                   4, 6),
-	INIT_REGMAP_IRQ(AXP20X, TIMER,                  4, 7),
+	INIT_REGMAP_IRQ(AXP288, TIMER,                  4, 7),
 
 	INIT_REGMAP_IRQ(AXP288, MV_CHNG,                5, 0),
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
Signature · 1 line
1.9.1
Applied
#5 lore raw

Re: [PATCH 2/3] mfd/axp20x: avoid irq numbering collision

Quoted 13 lines · Jacob Pan

IRQ numbers in axp20x devices are defined with high-order bit first in each IRQ enable/status registers. On Intel platforms it is more common to number IRQs with least significant bit first. Therefore, sharing IRQ# between the two is very difficult. Since AXP288 is a customized PMIC for Intel platform and the amount of shared IRQs are very small, we use separate IRQ numbering. This also fixes collision and a duplicate in WBTO interrupt.

e.g. For the 16 interrupts controlled in IRQ enabled registers 1 & 2, on axp20x for ARM, the PMIC local IRQ numbers and register bits are mapped as:
IRQ#: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
---------------------------------------------------------

Quoted 8 lines
ARM:   7  6  5  4  3  2  1  0      7  6  5  4  3  2  1  0
Intel: 0  1  2  3  4  5  6  7      0  1  2  3  4  5  6  7
---
 drivers/mfd/axp20x.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Applied, thanks.

Quoted 43 lines
drivers/mfd/axp20x.c +9 -9
index daf3c8d..0a8fcd9 100644
@@ -183,21 +183,21 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
 
 /* some IRQs are compatible with axp20x models */
 static const struct regmap_irq axp288_regmap_irqs[] = {
-	INIT_REGMAP_IRQ(AXP20X, VBUS_REMOVAL,           0, 2),
-	INIT_REGMAP_IRQ(AXP20X, VBUS_PLUGIN,            0, 3),
-	INIT_REGMAP_IRQ(AXP20X, VBUS_OVER_V,            0, 4),
+	INIT_REGMAP_IRQ(AXP288, VBUS_FALL,              0, 2),
+	INIT_REGMAP_IRQ(AXP288, VBUS_RISE,              0, 3),
+	INIT_REGMAP_IRQ(AXP288, OV,                     0, 4),
 
-	INIT_REGMAP_IRQ(AXP20X, CHARG_DONE,             1, 2),
-	INIT_REGMAP_IRQ(AXP20X, CHARG,                  1, 3),
+	INIT_REGMAP_IRQ(AXP288, DONE,                   1, 2),
+	INIT_REGMAP_IRQ(AXP288, CHARGING,               1, 3),
 	INIT_REGMAP_IRQ(AXP288, SAFE_QUIT,              1, 4),
 	INIT_REGMAP_IRQ(AXP288, SAFE_ENTER,             1, 5),
-	INIT_REGMAP_IRQ(AXP20X, BATT_REMOVAL,           1, 6),
-	INIT_REGMAP_IRQ(AXP20X, BATT_PLUGIN,            1, 7),
+	INIT_REGMAP_IRQ(AXP288, ABSENT,                 1, 6),
+	INIT_REGMAP_IRQ(AXP288, APPEND,                 1, 7),
 
 	INIT_REGMAP_IRQ(AXP288, QWBTU,                  2, 0),
 	INIT_REGMAP_IRQ(AXP288, WBTU,                   2, 1),
 	INIT_REGMAP_IRQ(AXP288, QWBTO,                  2, 2),
-	INIT_REGMAP_IRQ(AXP288, WBTU,                   2, 3),
+	INIT_REGMAP_IRQ(AXP288, WBTO,                   2, 3),
 	INIT_REGMAP_IRQ(AXP288, QCBTU,                  2, 4),
 	INIT_REGMAP_IRQ(AXP288, CBTU,                   2, 5),
 	INIT_REGMAP_IRQ(AXP288, QCBTO,                  2, 6),
@@ -215,7 +215,7 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, POKS,                   4, 4),
 	INIT_REGMAP_IRQ(AXP288, POKN,                   4, 5),
 	INIT_REGMAP_IRQ(AXP288, POKP,                   4, 6),
-	INIT_REGMAP_IRQ(AXP20X, TIMER,                  4, 7),
+	INIT_REGMAP_IRQ(AXP288, TIMER,                  4, 7),
 
 	INIT_REGMAP_IRQ(AXP288, MV_CHNG,                5, 0),
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#6 lore raw

PATCH 3/3 iio/axp288_adc: remove THIS_MODULE owner

In reply to Jacob Pan

This is no longer needed in that platform driver_register will do it.

---
 drivers/iio/adc/axp288_adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/axp288_adc.c +0 -1
index 4a6cf43..08bcfb0 100644
@@ -249,7 +249,6 @@ static struct platform_driver axp288_adc_driver = {
 	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
-		.owner = THIS_MODULE,
 	},
 };
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] iio/axp288_adc: remove THIS_MODULE owner

Quoted 3 lines · Jacob Pan

This is no longer needed in that platform driver_register will do it.

Quoted 17 lines
---
 drivers/iio/adc/axp288_adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/axp288_adc.c +0 -1
index 4a6cf43..08bcfb0 100644
@@ -249,7 +249,6 @@ static struct platform_driver axp288_adc_driver = {
 	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
-		.owner = THIS_MODULE,
 	},
 };
 
#8 lore raw

Re: [PATCH 3/3] iio/axp288_adc: remove THIS_MODULE owner

In reply to Jacob Pan
Quoted 6 lines · Jacob Pan

This is no longer needed in that platform driver_register will do it.

---
 drivers/iio/adc/axp288_adc.c | 1 -
 1 file changed, 1 deletion(-)

Applied thanks.

Quoted 12 lines
drivers/iio/adc/axp288_adc.c +0 -1
index 4a6cf43..08bcfb0 100644
@@ -249,7 +249,6 @@ static struct platform_driver axp288_adc_driver = {
 	.id_table = axp288_adc_id_table,
 	.driver = {
 		.name = "axp288_adc",
-		.owner = THIS_MODULE,
 	},
 };
 
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#9 lore raw

[GIT PULL] Immutable branch between MFD and IIO (second tag)

In reply to Jacob Pan

The following changes since commit bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9:

Linux 3.17 (2014-10-05 12:23:04 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-iio-v3.19-1

for you to fetch changes up to 8019f6962708985782b65bd97be88046a55e1e4d:

iio/axp288_adc: remove THIS_MODULE owner (2014-11-18 15:34:22 +0000)

----------------------------------------------------------------
Immutable branch between MFD and IIO due for v3.19.

This is the second tag, as more patches have been applied.

----------------------------------------------------------------
Aaron Lu (1):
iio: adc: Add module device table for autoloading

Jacob Pan (4):
mfd: axp20x: Extend axp20x to support axp288 pmic
iio: adc: Add support for axp288 adc mfd/axp20x: avoid irq numbering collision iio/axp288_adc: remove THIS_MODULE owner

 drivers/iio/adc/Kconfig      |   8 +
 drivers/iio/adc/Makefile     |   1 +
 drivers/iio/adc/axp288_adc.c | 261 +++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig          |   3 +-
 drivers/mfd/axp20x.c         | 361 ++++++++++++++++++++++++++++++++++++-------
 include/linux/mfd/axp20x.h   |  59 +++++++
 6 files changed, 637 insertions(+), 56 deletions(-)
 create mode 100644 drivers/iio/adc/axp288_adc.c
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog