Skip to contentSkip to conversation

power_supply: Add driver for TWL4030/TPS65950 BCI charger

PATCH Applied Grazvydas Ignotas 3 participants 11 messages Sep 27, 2010 – Sep 30, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 power_supply: Add driver for TWL4030/TPS65950 BCI charger

TWL4030/TPS65950 is a multi-function device with integrated charger, which allows charging from AC or USB. This driver enables the charger and provides several monitoring functions.

Tested on OMAP3 Pandora board.

---
changes since v3 [1]:
- register power supply before enabling interrupts
- use platform_driver_probe
- get rid of ifdefs

[1] http://marc.info/?l=linux-kernel&m=128552976908093&w=2

 drivers/power/Kconfig           |    6 +
 drivers/power/Makefile          |    1 +
 drivers/power/twl4030_charger.c |  565 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 572 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/twl4030_charger.c
drivers/power/Kconfig +6 -0
index 4d9a637..11eec62 100644
@@ -180,4 +180,10 @@ config CHARGER_ISP1704
 	  Say Y to enable support for USB Charger Detection with
 	  ISP1707/ISP1704 USB transceivers.
 
+config CHARGER_TWL4030
+	tristate "OMAP TWL4030 BCI charger driver"
+	depends on TWL4030_CORE
+	help
+	  Say Y here to enable support for TWL4030 Battery Charge Interface.
+
 endif # POWER_SUPPLY
drivers/power/Makefile +1 -0
index 2799a84..695e54f 100644
@@ -39,3 +39,4 @@ obj-$(CONFIG_CHARGER_PCF50633)	+= pcf50633-charger.o
 obj-$(CONFIG_BATTERY_JZ4740)	+= jz4740-battery.o
 obj-$(CONFIG_BATTERY_INTEL_MID)	+= intel_mid_battery.o
 obj-$(CONFIG_CHARGER_ISP1704)	+= isp1704_charger.o
+obj-$(CONFIG_CHARGER_TWL4030)	+= twl4030_charger.o
drivers/power/twl4030_charger.c new file +565 -0

565 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

Hi,

drivers/power/twl4030_charger.c line 270

Quoted 10 lines · Grazvydas Ignotas
drivers/power/twl4030_charger.c new file +10 -0
+static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
+                              void *priv)
+{
+       struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);
+
+       dev_dbg(bci->dev, "OTG notify %lu\n", val);
+
+       switch (val) {
+       case USB_EVENT_VBUS:
+       case USB_EVENT_CHARGER:

you should have removed CHARGER from here :-)

Signature · 1 line
balbi
#2 lore raw
Quoted 4 lines · Felipe Balbi

Hi,

Quoted 1 line · Grazvydas Ignotas
Quoted 14 lines

drivers/power/twl4030_charger.c line 270

Quoted 12 lines

+static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
+                              void *priv)
+{
+       struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);

drivers/power/twl4030_charger.c new file +6 -0
+
+       dev_dbg(bci->dev, "OTG notify %lu\n", val);
+
+       switch (val) {
+       case USB_EVENT_VBUS:
+       case USB_EVENT_CHARGER:

you should have removed CHARGER from here :-)

hm why? Don't recall you commenting on that, why can't I charge from charger? --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 20 lines · Grazvydas Ignotas
Quoted 4 lines · Felipe Balbi

Hi,

Quoted 1 line · Grazvydas Ignotas
Quoted 14 lines

drivers/power/twl4030_charger.c line 270

Quoted 12 lines

+static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
+                              void *priv)
+{
+       struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);

drivers/power/twl4030_charger.c new file +6 -0
+
+       dev_dbg(bci->dev, "OTG notify %lu\n", val);
+
+       switch (val) {
+       case USB_EVENT_VBUS:
+       case USB_EVENT_CHARGER:

you should have removed CHARGER from here :-)

Quoted 1 line

hm why? Don't recall you commenting on that, why can't I charge from charger?

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Signature · 1 line
balbi
#4 lore raw
Quoted 2 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

#5 lore raw
Quoted 6 lines · Grazvydas Ignotas
Quoted 2 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

it's part of the charger detection right ? and according to trm, it's on the BCI (actually BCC) role to take care of that :-)

Signature · 1 line
balbi
#6 lore raw
Quoted 11 lines · Felipe Balbi
Quoted 7 lines · Grazvydas Ignotas
Quoted 3 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

it's part of the charger detection right ? and according to trm, it's on the BCI (actually BCC) role to take care of that :-)

Hm you are probably talking about TWL5031, which has redesigned charger block that is named BCC. TWL4030 charger is different, called BCI and requires software charger detection from what I see in it's TRM.

#7 lore raw
Quoted 10 lines · Grazvydas Ignotas
Quoted 9 lines · Felipe Balbi
Quoted 7 lines · Grazvydas Ignotas
Quoted 3 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

Quoted 7 lines
Quoted 2 lines

it's part of the charger detection right ? and according to trm, it's on the BCI (actually BCC) role to take care of that :-)

Hm you are probably talking about TWL5031, which has redesigned charger block that is named BCC. TWL4030 charger is different, called BCI and requires software charger detection from what I see in it's TRM.

ok, might be that I got confused. Then it's ok the way it is. So we need other means to detect the charger :-p

Signature · 1 line
balbi
#8 lore raw
Quoted 14 lines · Felipe Balbi
Quoted 13 lines · Grazvydas Ignotas
Quoted 11 lines · Felipe Balbi
Quoted 7 lines · Grazvydas Ignotas
Quoted 3 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

it's part of the charger detection right ? and according to trm, it's on the BCI (actually BCC) role to take care of that :-)

Quoted 7 lines
Quoted 4 lines

Hm you are probably talking about TWL5031, which has redesigned charger block that is named BCC. TWL4030 charger is different, called BCI and requires software charger detection from what I see in it's TRM.

ok, might be that I got confused. Then it's ok the way it is. So we need other means to detect the charger :-p

May we consider this as a minor issue that can be improved later?

If so, I would like to apply it, but I'll wait a day or two for Reviewed-by or Acked-by tags to give the proper credits.

Thanks!

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
Acked-by
#9 lore raw
Quoted 20 lines · Anton Vorontsov
Quoted 19 lines · Felipe Balbi
Quoted 17 lines · Grazvydas Ignotas
Quoted 11 lines · Felipe Balbi
Quoted 7 lines · Grazvydas Ignotas
Quoted 3 lines

Charger event is SENT by charger driver when it verifies it's attached to a wall charger.

Isn't that a job for musb/gadget? Detecting D+/D- being shorted by charger or something like that? I don't think BCI is able to detect charger.

it's part of the charger detection right ? and according to trm, it's on the BCI (actually BCC) role to take care of that :-)

Hm you are probably talking about TWL5031, which has redesigned charger block that is named BCC. TWL4030 charger is different, called BCI and requires software charger detection from what I see in it's TRM.

Quoted 4 lines
Quoted 2 lines

ok, might be that I got confused. Then it's ok the way it is. So we need other means to detect the charger :-p

May we consider this as a minor issue that can be improved later?

Sure, it's fine.

Quoted 2 lines

If so, I would like to apply it, but I'll wait a day or two for Reviewed-by or Acked-by tags to give the proper credits.

Here you go.

Signature · 1 line
balbi
#10 lore raw

On Tue, Sep 28, 2010 at 04:33:45PM +0300, Felipe Balbi wrote:
[...]

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Hm you are probably talking about TWL5031, which has redesigned charger block that is named BCC. TWL4030 charger is different, called BCI and requires software charger detection from what I see in it's TRM.

ok, might be that I got confused. Then it's ok the way it is. So we need other means to detect the charger :-p

May we consider this as a minor issue that can be improved later?

Quoted 8 lines

Sure, it's fine.

Quoted 2 lines

If so, I would like to apply it, but I'll wait a day or two for Reviewed-by or Acked-by tags to give the proper credits.

Here you go.

Applied, thanks everyone!

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2