Skip to contentSkip to conversation

regulator: TI bq24022 Li-Ion Charger driver

PATCH Applied Philipp Zabel 3 participants 5 messages Jul 10, 2008 – Jul 12, 2008 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 regulator: TI bq24022 Li-Ion Charger driver

This adds a regulator driver for the TI bq24022 Single-Chip Li-Ion Charger with its nCE and ISET2 pins connected to GPIOs.

---
 drivers/regulator/Kconfig         |   10 ++
 drivers/regulator/Makefile        |    2 +
 drivers/regulator/bq24022.c       |  167 +++++++++++++++++++++++++++++++++++++
 include/linux/regulator/bq24022.h |   23 +++++
 4 files changed, 202 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/bq24022.c
 create mode 100644 include/linux/regulator/bq24022.h
drivers/regulator/Kconfig +10 -0
index 84f89ec..a656128 100644
@@ -46,4 +46,14 @@ config REGULATOR_VIRTUAL_CONSUMER
 
           If unsure, say no.
 
+config REGULATOR_BQ24022
+	tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
+	default n
+	select REGULATOR
+	help
+	  This driver controls a TI bq24022 Charger attached via
+	  GPIOs. The provided current regulator can enable/disable
+	  charging select between 100 mA and 500 mA charging current
+	  limit.
+
 endmenu
drivers/regulator/Makefile +2 -0
index 29528b7..ac2c64e 100644
@@ -7,4 +7,6 @@ obj-$(CONFIG_REGULATOR) += core.o
 obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
 
+obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
+
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
drivers/regulator/bq24022.c new file +167 -0

167 lines not on this page · raw message

include/linux/regulator/bq24022.h new file +23 -0
new file mode 100644
index 0000000..6824a81
@@ -0,0 +1,23 @@
+/*
+ * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
+ * 1-Cell Li-Ion Charger connected via GPIOs.
+ *
+ * Copyright (c) 2008 Philipp Zabel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+/**
+ *bq24022_mach_info - platform data for bq24022
+ *@gpio_nce: GPIO line connected to the nCE pin,
+ *           used to enable / disable charging.
+ *@gpio_iset2: GPIO line connected to the ISET2 pin,
+ *             used to limit charging current to 100 mA / 500 mA.
+ */
+struct bq24022_mach_info {
+	int gpio_nce;
+	int gpio_iset2;
+};
Signature · 1 line
1.5.6.2
#1 lore raw
Quoted 2 lines · Philipp Zabel

This adds a regulator driver for the TI bq24022 Single-Chip Li-Ion Charger with its nCE and ISET2 pins connected to GPIOs.

snip

drivers/regulator/bq24022.c line 148

Quoted 8 lines
drivers/regulator/bq24022.c new file +8 -0
+static struct platform_driver bq24022_driver = {
+	.driver = {
+		.name = "bq24022",
+	},
+	.remove = __devexit_p(bq24022_remove),
+};
+
+static int __init bq24022_init()

missing void

drivers/regulator/bq24022.c line 152

Quoted 4 lines
drivers/regulator/bq24022.c new file +4 -0
+{
+	platform_driver_probe(&bq24022_driver, bq24022_probe);
+}
+

missing return value.

Quoted 1 line

+static void __exit bq24022_exit()

missing void

drivers/regulator/bq24022.c line 156

Quoted 3 lines
drivers/regulator/bq24022.c new file +3 -0
+{
+	platform_driver_unregister(&bq24022_driver);
+}

Could you fix these and resubmit.

Thanks

Liam

#2 lore raw

Am Freitag, den 11.07.2008, 11:28 +0100 schrieb Liam Girdwood:

Quoted 26 lines · Philipp Zabel
Quoted 2 lines

This adds a regulator driver for the TI bq24022 Single-Chip Li-Ion Charger with its nCE and ISET2 pins connected to GPIOs.

snip

drivers/regulator/bq24022.c line 148

Quoted 8 lines
drivers/regulator/bq24022.c new file +8 -0
+static struct platform_driver bq24022_driver = {
+	.driver = {
+		.name = "bq24022",
+	},
+	.remove = __devexit_p(bq24022_remove),
+};
+
+static int __init bq24022_init()

missing void

drivers/regulator/bq24022.c line 152

Quoted 4 lines
drivers/regulator/bq24022.c new file +4 -0
+{
+	platform_driver_probe(&bq24022_driver, bq24022_probe);
+}
+

missing return value.

Quoted 1 line

+static void __exit bq24022_exit()

Quoted 7 lines

missing void

drivers/regulator/bq24022.c line 156

Quoted 3 lines
drivers/regulator/bq24022.c new file +3 -0
+{
+	platform_driver_unregister(&bq24022_driver);
+}

Could you fix these and resubmit.

Thanks, fixed version will follow in a second.

regards
Philipp

#3 lore raw
In reply to Philipp Zabel
Quoted 7 lines · On Thu, 10 Jul 2008 21:04:43 +0200 Philipp Zabel <[email protected]>…

+/**
+ *bq24022_mach_info - platform data for bq24022
+ *@gpio_nce: GPIO line connected to the nCE pin,
+ * used to enable / disable charging.
+ *@gpio_iset2: GPIO line connected to the ISET2 pin,
+ * used to limit charging current to 100 mA / 500 mA.
+ */

We normally have a space after the "*" in kerneldoc comments (some weird people use a tab and waste space).

I don't know whether the kerneldoc processors will correctly handle the above. I guess I'll fix it so we don't find out.

Also, I _think_ that kerneldoc will barf over the multi-line parameter descriptions. I'll join those lines.

include/linux/regulator/bq24022.h renamed from include/linux/regulator/bq24022.h~regulator-ti-bq24022-li-ion-charger-driver-fix +3 -5
@@ -11,11 +11,9 @@
  */
 
 /**
- *bq24022_mach_info - platform data for bq24022
- *@gpio_nce: GPIO line connected to the nCE pin,
- *           used to enable / disable charging.
- *@gpio_iset2: GPIO line connected to the ISET2 pin,
- *             used to limit charging current to 100 mA / 500 mA.
+ * bq24022_mach_info - platform data for bq24022
+ * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
+ * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
  */
 struct bq24022_mach_info {
 	int gpio_nce;

_

#4 lore raw
Quoted 36 lines · Andrew Morton
Quoted 7 lines · On Thu, 10 Jul 2008 21:04:43 +0200 Philipp Zabel <[email protected]>…

+/**
+ *bq24022_mach_info - platform data for bq24022
+ *@gpio_nce: GPIO line connected to the nCE pin,
+ * used to enable / disable charging.
+ *@gpio_iset2: GPIO line connected to the ISET2 pin,
+ * used to limit charging current to 100 mA / 500 mA.
+ */

We normally have a space after the "*" in kerneldoc comments (some weird people use a tab and waste space).

I don't know whether the kerneldoc processors will correctly handle the above. I guess I'll fix it so we don't find out.

Also, I _think_ that kerneldoc will barf over the multi-line parameter descriptions. I'll join those lines.

include/linux/regulator/bq24022.h renamed from include/linux/regulator/bq24022.h~regulator-ti-bq24022-li-ion-charger-driver-fix +3 -5
@@ -11,11 +11,9 @@
  */
 
 /**
- *bq24022_mach_info - platform data for bq24022
- *@gpio_nce: GPIO line connected to the nCE pin,
- *           used to enable / disable charging.
- *@gpio_iset2: GPIO line connected to the ISET2 pin,
- *             used to limit charging current to 100 mA / 500 mA.
+ * bq24022_mach_info - platform data for bq24022
+ * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
+ * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
  */
 struct bq24022_mach_info {
 	int gpio_nce;
Quoted 1 line

_

Applied (to regulator git).

Thanks

Liam