Skip to contentSkip to conversation

extcon-axp288: Add axp288 extcon driver support

PATCH In review Ramakrishna Pallala 3 participants 4 messages Apr 30, 2015

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

PATCH v9 1/1 extcon-axp288: Add axp288 extcon driver support

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 |  385 ++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h     |    5 +
 4 files changed, 398 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c
drivers/extcon/Kconfig +7 -0
index fdc0bf0..2305edc 100644
@@ -28,6 +28,13 @@ config EXTCON_ARIZONA
 	  with Wolfson Arizona devices. These are audio CODECs with
 	  advanced audio accessory detection support.
 
+config EXTCON_AXP288
+	tristate "X-Power 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 X-Power AXP288 PMIC.
+
 config EXTCON_GPIO
 	tristate "GPIO extcon support"
 	depends on GPIOLIB
drivers/extcon/Makefile +1 -0
index 9204114..ba787d0 100644
@@ -5,6 +5,7 @@
 obj-$(CONFIG_EXTCON)		+= extcon.o
 obj-$(CONFIG_EXTCON_ADC_JACK)	+= extcon-adc-jack.o
 obj-$(CONFIG_EXTCON_ARIZONA)	+= extcon-arizona.o
+obj-$(CONFIG_EXTCON_AXP288)	+= extcon-axp288.o
 obj-$(CONFIG_EXTCON_GPIO)	+= extcon-gpio.o
 obj-$(CONFIG_EXTCON_MAX14577)	+= extcon-max14577.o
 obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
drivers/extcon/extcon-axp288.c new file +385 -0

385 lines not on this page · raw message

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
maintainer
#1 lore raw

Hi Ram,

This patch has still one minor issue on below comment.
But I fix it and will apply it on extcon-next branch
after discussing how to apply this patch with Lee Jones (MFD maintainer).

Dear Lee,
Do you want to send pull request after I make the immutable branch for this patch? or apply this patch on extcon git without any pull request?

Thanks,
Chanwoo Choi

Quoted 15 lines · 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 |  385 ++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h     |    5 +
 4 files changed, 398 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c

[snip]

Quoted 9 lines
drivers/extcon/extcon-axp288.c new file +9 -0
+				vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
+						: EXTCON_GPIO_MUX_SEL_PMIC);
+
+		atomic_notifier_call_chain(&info->otg->notifier,
+			vbus_attach ? USB_EVENT_VBUS : USB_EVENT_NONE, NULL);
+	}
+
+	if (notify_charger)
+		extcon_set_cable_state(info->edev, cable, vbus_attach);

drivers/extcon/extcon-axp288.c line 243

Quoted 10 lines
drivers/extcon/extcon-axp288.c new file +10 -0
+
+	/* Clear the flags on disconnect event */
+	if (!vbus_attach)
+		notify_otg = notify_charger = false;
+
+	return 0;
+
+dev_det_ret:
+	if (ret < 0)
+		dev_err(info->dev, "BC Mod detection error\n");

You miss the fix about following comment.
"BC Mod detection error\n" -> "failed to detect BC Mod\n"

[snip]

#2 lore raw
Quoted 5 lines

Hi Ram,

This patch has still one minor issue on below comment.
But I fix it and will apply it on extcon-next branch after discussing how to apply this patch with Lee Jones (MFD maintainer).

Ok. Thanks.

Quoted 42 lines

Dear Lee,
Do you want to send pull request after I make the immutable branch for this patch? or apply this patch on extcon git without any pull request?

Thanks,
Chanwoo Choi

Quoted 10 lines · 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 |  385

++++++++++++++++++++++++++++++++++++++++

Quoted 4 lines
 include/linux/mfd/axp20x.h     |    5 +
 4 files changed, 398 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c

[snip]

Review

Quoted 2 lines
(quoted diff) +2 -0
+				vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
+						:

EXTCON_GPIO_MUX_SEL_PMIC);

drivers/extcon/extcon-axp288.c

Quoted 3 lines
drivers/extcon/extcon-axp288.c new file +3 -0
+
+		atomic_notifier_call_chain(&info->otg->notifier,
+			vbus_attach ? USB_EVENT_VBUS : USB_EVENT_NONE,

NULL);

Quoted 9 lines
drivers/extcon/extcon-axp288.c new file +9 -0
+	}
+
+	if (notify_charger)
+		extcon_set_cable_state(info->edev, cable, vbus_attach);
+
+	/* Clear the flags on disconnect event */
+	if (!vbus_attach)
+		notify_otg = notify_charger = false;
+
Quoted 8 lines

drivers/extcon/extcon-axp288.c line 243

Quoted 5 lines
drivers/extcon/extcon-axp288.c new file +5 -0
+	return 0;
+
+dev_det_ret:
+	if (ret < 0)
+		dev_err(info->dev, "BC Mod detection error\n");

You miss the fix about following comment.
"BC Mod detection error\n" -> "failed to detect BC Mod\n"

Thanks,
Ram

#3 lore raw
In reply to Chanwoo Choi
Quoted 9 lines · Chanwoo Choi

Hi Ram,

This patch has still one minor issue on below comment.
But I fix it and will apply it on extcon-next branch
after discussing how to apply this patch with Lee Jones (MFD maintainer).

Dear Lee,
Do you want to send pull request after I make the immutable branch for this patch? or apply this patch on extcon git without any pull request?

Let's try without the pull-request.

Quoted 44 lines · Ramakrishna Pallala
Quoted 15 lines

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 |  385 ++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h     |    5 +
 4 files changed, 398 insertions(+)
 create mode 100644 drivers/extcon/extcon-axp288.c

[snip]

Quoted 9 lines
drivers/extcon/extcon-axp288.c new file +9 -0
+				vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
+						: EXTCON_GPIO_MUX_SEL_PMIC);
+
+		atomic_notifier_call_chain(&info->otg->notifier,
+			vbus_attach ? USB_EVENT_VBUS : USB_EVENT_NONE, NULL);
+	}
+
+	if (notify_charger)
+		extcon_set_cable_state(info->edev, cable, vbus_attach);

drivers/extcon/extcon-axp288.c line 243

Quoted 10 lines
drivers/extcon/extcon-axp288.c new file +10 -0
+
+	/* Clear the flags on disconnect event */
+	if (!vbus_attach)
+		notify_otg = notify_charger = false;
+
+	return 0;
+
+dev_det_ret:
+	if (ret < 0)
+		dev_err(info->dev, "BC Mod detection error\n");

You miss the fix about following comment.
"BC Mod detection error\n" -> "failed to detect BC Mod\n"

[snip]

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog