Skip to contentSkip to conversation

regulator: TI bq24022 Li-Ion Charger driver

PATCH Applied Philipp Zabel 3 participants 3 messages Jul 11, 2008 – Jul 13, 2008 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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
#2 lore raw
In reply to Philipp Zabel
Quoted 2 lines · On Fri, 11 Jul 2008 17:28:06 +0200 Philipp Zabel <[email protected]>…

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

Incremental diffs are so much better. It allowed us to see what you changed. Two things:

a) re-broke the kerneldoc comments

b) this:

drivers/regulator/bq24022.c renamed from drivers/regulator/bq24022.c~regulator-ti-bq24022-li-ion-charger-driver-update +3 -3
@@ -145,12 +145,12 @@ static struct platform_driver bq24022_dr
 	.remove = __devexit_p(bq24022_remove),
 };
 
-static int __init bq24022_init()
+static int __init bq24022_init(void)
 {
-	platform_driver_probe(&bq24022_driver, bq24022_probe);
+	return platform_driver_probe(&bq24022_driver, bq24022_probe);
 }
 
-static void __exit bq24022_exit()
+static void __exit bq24022_exit(void)
 {
 	platform_driver_unregister(&bq24022_driver);
 }