Skip to contentSkip to conversation

Add extcon support for AXP288 PMIC

PATCH In review Ramakrishna Pallala 2 participants 5 messages Apr 1, 2015

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

cover Add extcon support for AXP288 PMIC

This patch series adds the support for axp288 extcon driver and also adds the cell info for extcon device in axp20x mfd driver.

Ramakrishna Pallala (2):
mfd/axp20x: add support for extcon cell
extcon-axp288: Add axp288 extcon driver support

 drivers/extcon/Kconfig         |    7 +
 drivers/extcon/Makefile        |    1 +
 drivers/extcon/extcon-axp288.c |  479 ++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c           |   28 +++
 include/linux/mfd/axp20x.h     |    5 +
 5 files changed, 520 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 mfd/axp20x: add support for extcon cell

This patch adds the mfd cell info for axp288 extcon device.

---
 drivers/mfd/axp20x.c       |   28 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |    5 +++++
 2 files changed, 33 insertions(+)
drivers/mfd/axp20x.c +28 -0
index 0acbe52..30af1a3 100644
@@ -290,6 +290,29 @@ static struct resource axp288_adc_resources[] = {
 	},
 };
 
+static struct resource axp288_extcon_resources[] = {
+	{
+		.start = AXP288_IRQ_VBUS_FALL,
+		.end   = AXP288_IRQ_VBUS_FALL,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_VBUS_RISE,
+		.end   = AXP288_IRQ_VBUS_RISE,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_MV_CHNG,
+		.end   = AXP288_IRQ_MV_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_BC_USB_CHNG,
+		.end   = AXP288_IRQ_BC_USB_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp288_charger_resources[] = {
 	{
 		.start = AXP288_IRQ_OV,
@@ -345,6 +368,11 @@ static struct mfd_cell axp288_cells[] = {
 		.resources = axp288_adc_resources,
 	},
 	{
+		.name = "extcon-axp288",
+		.num_resources = ARRAY_SIZE(axp288_extcon_resources),
+		.resources = axp288_extcon_resources,
+	},
+	{
 		.name = "axp288_charger",
 		.num_resources = ARRAY_SIZE(axp288_charger_resources),
 		.resources = axp288_charger_resources,
include/linux/mfd/axp20x.h +5 -0
index dfabd6d..4ed8071 100644
@@ -275,4 +275,9 @@ struct axp20x_fg_pdata {
 	int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
 };
 
+struct axp288_extcon_pdata {
+	/* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
+	struct gpio_desc *gpio_mux_cntl;
+};
+
 #endif /* __LINUX_MFD_AXP20X_H */
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] mfd/axp20x: add support for extcon cell

Quoted 43 lines · Ramakrishna Pallala

This patch adds the mfd cell info for axp288 extcon device.

---
 drivers/mfd/axp20x.c       |   28 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |    5 +++++
 2 files changed, 33 insertions(+)
drivers/mfd/axp20x.c +23 -0
index 0acbe52..30af1a3 100644
@@ -290,6 +290,29 @@ static struct resource axp288_adc_resources[] = {
 	},
 };
 
+static struct resource axp288_extcon_resources[] = {
+	{
+		.start = AXP288_IRQ_VBUS_FALL,
+		.end   = AXP288_IRQ_VBUS_FALL,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_VBUS_RISE,
+		.end   = AXP288_IRQ_VBUS_RISE,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_MV_CHNG,
+		.end   = AXP288_IRQ_MV_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_BC_USB_CHNG,
+		.end   = AXP288_IRQ_BC_USB_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp288_charger_resources[] = {
 	{
 		.start = AXP288_IRQ_OV,

drivers/mfd/axp20x.c static struct mfd_cell axp288_cells[] = { · line 371

Quoted 4 lines
drivers/mfd/axp20x.c +1 -0
@@ -345,6 +368,11 @@ static struct mfd_cell axp288_cells[] = {
 		.resources = axp288_adc_resources,
 	},
 	{
+		.name = "extcon-axp288",

This naming convention is not consistent with the others in the container.

Quoted 12 lines
drivers/mfd/axp20x.c +4 -0
+		.num_resources = ARRAY_SIZE(axp288_extcon_resources),
+		.resources = axp288_extcon_resources,
+	},
+	{
 		.name = "axp288_charger",
 		.num_resources = ARRAY_SIZE(axp288_charger_resources),
 		.resources = axp288_charger_resources,
include/linux/mfd/axp20x.h +0 -0
index dfabd6d..4ed8071 100644

include/linux/mfd/axp20x.h struct axp20x_fg_pdata { · line 281

Quoted 7 lines
include/linux/mfd/axp20x.h +4 -0
@@ -275,4 +275,9 @@ struct axp20x_fg_pdata {
 	int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
 };
 
+struct axp288_extcon_pdata {
+	/* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
+	struct gpio_desc *gpio_mux_cntl;
+};

Is this going to be added to? Seems like overkill to have a struct with only one attribute.

Quoted 1 line
include/linux/mfd/axp20x.h +0 -0
 #endif /* __LINUX_MFD_AXP20X_H */
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

RE: [PATCH 1/2] mfd/axp20x: add support for extcon cell

Quoted 43 lines · Ramakrishna Pallala
Quoted 42 lines

This patch adds the mfd cell info for axp288 extcon device.

---
 drivers/mfd/axp20x.c       |   28 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |    5 +++++
 2 files changed, 33 insertions(+)
drivers/mfd/axp20x.c index renamed from drivers/mfd/axp20x.c +0 -0

0acbe52..30af1a3 100644

drivers/mfd/axp20x.c +23 -0
@@ -290,6 +290,29 @@ static struct resource axp288_adc_resources[] = {
 	},
 };
 
+static struct resource axp288_extcon_resources[] = {
+	{
+		.start = AXP288_IRQ_VBUS_FALL,
+		.end   = AXP288_IRQ_VBUS_FALL,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_VBUS_RISE,
+		.end   = AXP288_IRQ_VBUS_RISE,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_MV_CHNG,
+		.end   = AXP288_IRQ_MV_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = AXP288_IRQ_BC_USB_CHNG,
+		.end   = AXP288_IRQ_BC_USB_CHNG,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
 static struct resource axp288_charger_resources[] = {
 	{
Quoted 8 lines

drivers/mfd/axp20x.c static struct mfd_cell axp288_cells[] = { · line 371

Quoted 6 lines
drivers/mfd/axp20x.c +1 -0
 		.start = AXP288_IRQ_OV,
@@ -345,6 +368,11 @@ static struct mfd_cell axp288_cells[] = {
 		.resources = axp288_adc_resources,
 	},
 	{
+		.name = "extcon-axp288",

This naming convention is not consistent with the others in the container.

Ok agreed. I will fix it.

Quoted 15 lines
Quoted 15 lines
drivers/mfd/axp20x.c +4 -0
+		.num_resources = ARRAY_SIZE(axp288_extcon_resources),
+		.resources = axp288_extcon_resources,
+	},
+	{
 		.name = "axp288_charger",
 		.num_resources = ARRAY_SIZE(axp288_charger_resources),
 		.resources = axp288_charger_resources, diff --git

a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index dfabd6d..4ed8071 100644

include/linux/mfd/axp20x.h +0 -0
@@ -275,4 +275,9 @@ struct axp20x_fg_pdata {
 	int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
 };
 
Quoted 7 lines

include/linux/mfd/axp20x.h struct axp20x_fg_pdata { · line 281

Quoted 4 lines
include/linux/mfd/axp20x.h +4 -0
+struct axp288_extcon_pdata {
+	/* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
+	struct gpio_desc *gpio_mux_cntl;
+};

Is this going to be added to? Seems like overkill to have a struct with only one attribute.

Yes, I will be adding to this struct in future.

Thanks,
Ram ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#4 lore raw

PATCH 2/2 extcon-axp288: Add axp288 extcon driver support

In reply to Ramakrishna Pallala

This patch adds the extcon support for AXP288 PMIC which has the BC1.2 charger detection capability. Additionally it also adds the USB mux switching support b/w SOC and PMIC based on GPIO control.

---
 drivers/extcon/Kconfig         |    7 +
 drivers/extcon/Makefile        |    1 +
 drivers/extcon/extcon-axp288.c |  479 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 487 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c
drivers/extcon/Kconfig +7 -0
index 6a1f7de..b8627f7 100644
@@ -93,4 +93,11 @@ config EXTCON_SM5502
 	  Silicon Mitus SM5502. The SM5502 is a USB port accessory
 	  detector and switch.
 
+config EXTCON_AXP288
+	tristate "AXP288 EXTCON support"
+	depends on MFD_AXP20X && USB_PHY
+	help
+	  Say Y here to enable support for USB peripheral detection
+	  and USB MUX switching by AXP288 PMIC.
+
 endif # MULTISTATE_SWITCH
drivers/extcon/Makefile +1 -0
index 0370b42..832ad79 100644
@@ -12,3 +12,4 @@ obj-$(CONFIG_EXTCON_MAX8997)	+= extcon-max8997.o
 obj-$(CONFIG_EXTCON_PALMAS)	+= extcon-palmas.o
 obj-$(CONFIG_EXTCON_RT8973A)	+= extcon-rt8973a.o
 obj-$(CONFIG_EXTCON_SM5502)	+= extcon-sm5502.o
+obj-$(CONFIG_EXTCON_AXP288)	+= extcon-axp288.o
drivers/extcon/extcon-axp288.c new file +479 -0

479 lines not on this page · raw message

Signature · 1 line
1.7.9.5