Skip to contentSkip to conversation

Remove bq24022 driver superseeded by gpio-regulator

PATCH In review Heiko Stübner 4 participants 6 messages Mar 2, 2012 – Mar 6, 2012

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

cover Remove bq24022 driver superseeded by gpio-regulator

The bq24022 regulator is simply a more specialised variant of the now present gpio-regulator. Therefore it probably shouldn't stay around.

This series converts the two users of bq24022 pxa/hx4700 and pxa/magician to use the gpio-regulator instead, and after this removes the then unused bq24022 driver.

The series was compile-tested only, but the gpio-regulator itself is sucessfully used on my platform for the dcdc3 of a tps650240 (voltage regulator with one gpio) and for a bq24075 (current regulator with two gpios). So I'm quite sure it should work correctly but would welcome testers :-) .

Heiko Stuebner (2):
pxa: magician/hx4700: Convert to gpio-regulator from bq24022
regulator: Remove bq24022 regulator driver

 arch/arm/configs/magician_defconfig |    2 +-
 arch/arm/mach-pxa/hx4700.c          |   33 ++++++--
 arch/arm/mach-pxa/magician.c        |   33 ++++++--
 drivers/regulator/Kconfig           |    8 --
 drivers/regulator/Makefile          |    1 -
 drivers/regulator/bq24022.c         |  162 -----------------------------------
 include/linux/regulator/bq24022.h   |   24 -----
 7 files changed, 55 insertions(+), 208 deletions(-)
 delete mode 100644 drivers/regulator/bq24022.c
 delete mode 100644 include/linux/regulator/bq24022.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 pxa: magician/hx4700: Convert to gpio-regulator from bq24022

The bq24022 on these machines is a very simple regulator using gpios. One provides the on/off functionality and a second one is used to change the current between 100 and 500 mA.

This functionality can also be provided by the more generic gpio-regulator.

Therefore convert both machines which makes it possible to remove the bq24022 driver later on.

---
 arch/arm/configs/magician_defconfig |    2 +-
 arch/arm/mach-pxa/hx4700.c          |   33 +++++++++++++++++++++++++++------
 arch/arm/mach-pxa/magician.c        |   33 +++++++++++++++++++++++++++------
 3 files changed, 55 insertions(+), 13 deletions(-)
arch/arm/configs/magician_defconfig +1 -1
index 443675d..a691ef4 100644
@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y
 CONFIG_HTC_EGPIO=y
 CONFIG_HTC_PASIC3=y
 CONFIG_REGULATOR=y
-CONFIG_REGULATOR_BQ24022=y
+CONFIG_REGULATOR_GPIO=y
 CONFIG_FB=y
 CONFIG_FB_PXA=y
 CONFIG_FB_PXA_OVERLAY=y
arch/arm/mach-pxa/hx4700.c +27 -6
index f2c23ea..7571f0d 100644
@@ -28,7 +28,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/pda_power.h>
 #include <linux/pwm_backlight.h>
-#include <linux/regulator/bq24022.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max1586.h>
 #include <linux/spi/ads7846.h>
@@ -698,14 +699,34 @@ static struct regulator_init_data bq24022_init_data = {
 	.consumer_supplies      = bq24022_consumers,
 };
 
-static struct bq24022_mach_info bq24022_info = {
-	.gpio_nce   = GPIO72_HX4700_BQ24022_nCHARGE_EN,
-	.gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2,
-	.init_data  = &bq24022_init_data,
+static struct gpio bq24022_gpios[] = {
+	{ GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
+};
+
+static struct gpio_regulator_state bq24022_states[] = {
+	{ .value = 100000, .gpios = (0 << 0) },
+	{ .value = 500000, .gpios = (1 << 0) },
+};
+
+static struct gpio_regulator_config bq24022_info = {
+	.supply_name = "bq24022",
+
+	.enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN,
+	.enable_high = 0,
+	.enabled_at_boot = 0,
+
+	.gpios = bq24022_gpios,
+	.nr_gpios = ARRAY_SIZE(bq24022_gpios),
+
+	.states = bq24022_states,
+	.nr_states = ARRAY_SIZE(bq24022_states),
+
+	.type = REGULATOR_CURRENT,
+	.init_data = &bq24022_init_data,
 };
 
 static struct platform_device bq24022 = {
-	.name = "bq24022",
+	.name = "gpio-regulator",
 	.id   = -1,
 	.dev  = {
 		.platform_data = &bq24022_info,
arch/arm/mach-pxa/magician.c +27 -6
index 3d6baf9..5e26f3e 100644
@@ -25,7 +25,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/pda_power.h>
 #include <linux/pwm_backlight.h>
-#include <linux/regulator/bq24022.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = {
 	.consumer_supplies      = bq24022_consumers,
 };
 
-static struct bq24022_mach_info bq24022_info = {
-	.gpio_nce   = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
-	.gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2,
-	.init_data  = &bq24022_init_data,
+static struct gpio bq24022_gpios[] = {
+	{ EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
+};
+
+static struct gpio_regulator_state bq24022_states[] = {
+	{ .value = 100000, .gpios = (0 << 0) },
+	{ .value = 500000, .gpios = (1 << 0) },
+};
+
+static struct gpio_regulator_config bq24022_info = {
+	.supply_name = "bq24022",
+
+	.enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+	.enable_high = 0,
+	.enabled_at_boot = 0,
+
+	.gpios = bq24022_gpios,
+	.nr_gpios = ARRAY_SIZE(bq24022_gpios),
+
+	.states = bq24022_states,
+	.nr_states = ARRAY_SIZE(bq24022_states),
+
+	.type = REGULATOR_CURRENT,
+	.init_data = &bq24022_init_data,
 };
 
 static struct platform_device bq24022 = {
-	.name = "bq24022",
+	.name = "gpio-regulator",
 	.id   = -1,
 	.dev  = {
 		.platform_data = &bq24022_info,
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/2 regulator: Remove bq24022 regulator driver

In reply to Heiko Stübner

The bq24022 driver is just a specialised form of a gpio-regulator.

As all former users of it now use the gpio-regulator directly, there is no need to keep it around.

---
 drivers/regulator/Kconfig         |    8 --
 drivers/regulator/Makefile        |    1 -
 drivers/regulator/bq24022.c       |  162 -------------------------------------
 include/linux/regulator/bq24022.h |   24 ------
 4 files changed, 0 insertions(+), 195 deletions(-)
 delete mode 100644 drivers/regulator/bq24022.c
 delete mode 100644 include/linux/regulator/bq24022.h
drivers/regulator/Kconfig +0 -8
index c733df5..25cfe1c 100644
@@ -250,14 +250,6 @@ config REGULATOR_DB8500_PRCMU
 	  This driver supports the voltage domain regulators controlled by the
 	  DB8500 PRCMU
 
-config REGULATOR_BQ24022
-	tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
-	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.
-
 config REGULATOR_TPS6105X
 	tristate "TI TPS6105X Power regulators"
 	depends on TPS6105X
drivers/regulator/Makefile +0 -1
index cf0934b..1339198 100644
@@ -15,7 +15,6 @@ obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 obj-$(CONFIG_REGULATOR_AB8500)	+= ab8500.o
 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
-obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
drivers/regulator/bq24022.c deleted +0 -162

162 lines not on this page · raw message

include/linux/regulator/bq24022.h deleted +0 -24
deleted file mode 100644
index a6d0140..0000000
@@ -1,24 +0,0 @@
-/*
- * 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.
- *
- */
-
-struct regulator_init_data;
-
-/**
- * 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;
-	struct regulator_init_data *init_data;
-};
Signature · 1 line
1.7.5.4
Tested-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022

In reply to Heiko Stübner

Thanks Heiko.

The hx4700 patch works for me on linux-3.3-rc5.
I'm not able to test the magician patch.

Quoted 176 lines · Heiko St?bner

From: Heiko St?bner <[email protected]>
Subject: [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022
To: "Mark Brown" <[email protected]>, "Liam Girdwood" <[email protected]>, "Philipp Zabel" <[email protected]>, "Eric Miao" <[email protected]>, "Haojian Zhuang" <[email protected]>, "Russell King - ARM Linux" <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org, "LKML" <[email protected]>
Date: Friday, 2 March, 2012, 12:56
The bq24022 on these machines is a
very simple regulator using gpios.
One provides the on/off functionality and a second one is
used to
change the current between 100 and 500 mA.

This functionality can also be provided by the more generic gpio-regulator.

Therefore convert both machines which makes it possible to remove the
bq24022 driver later on.

---
arch/arm/configs/magician_defconfig |? ? 2 +-
arch/arm/mach-pxa/hx4700.c? ? ? ?
? |???33
+++++++++++++++++++++++++++------
arch/arm/mach-pxa/magician.c? ? ? ?
|???33 +++++++++++++++++++++++++++------

 3 files changed, 55 insertions(+), 13 deletions(-)
arch/arm/configs/magician_defconfig +1 -1
index 443675d..a691ef4 100644
@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y
 CONFIG_HTC_EGPIO=y
 CONFIG_HTC_PASIC3=y
 CONFIG_REGULATOR=y
-CONFIG_REGULATOR_BQ24022=y
+CONFIG_REGULATOR_GPIO=y
 CONFIG_FB=y
 CONFIG_FB_PXA=y
 CONFIG_FB_PXA_OVERLAY=y
arch/arm/mach-pxa/hx4700.c +9 -5
index f2c23ea..7571f0d 100644
@@ -28,7 +28,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/pda_power.h>
 #include <linux/pwm_backlight.h>
-#include <linux/regulator/bq24022.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max1586.h>
 #include <linux/spi/ads7846.h>
@@ -698,14 +699,34 @@ static struct regulator_init_data
 bq24022_init_data = {
 ??? .consumer_supplies? ? ? =
 bq24022_consumers,
 };
 
-static struct bq24022_mach_info bq24022_info = {
-??? .gpio_nce???=
 GPIO72_HX4700_BQ24022_nCHARGE_EN,
-??? .gpio_iset2 =
 GPIO96_HX4700_BQ24022_ISET2,
-??? .init_data? =
 &bq24022_init_data,
+static struct gpio bq24022_gpios[] = {
+??? { GPIO96_HX4700_BQ24022_ISET2,
 GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
+};
+
+static struct gpio_regulator_state bq24022_states[] = {
+??? { .value = 100000, .gpios = (0 <<
 0) },
+??? { .value = 500000, .gpios = (1 <<

0) },

arch/arm/mach-pxa/hx4700.c +6 -0
+};
+
+static struct gpio_regulator_config bq24022_info = {
+??? .supply_name = "bq24022",
+
+??? .enable_gpio =

GPIO72_HX4700_BQ24022_nCHARGE_EN,
+??? .enable_high = 0,
+??? .enabled_at_boot = 0,

arch/arm/mach-pxa/hx4700.c +6 -0
+
+??? .gpios = bq24022_gpios,
+??? .nr_gpios = ARRAY_SIZE(bq24022_gpios),
+
+??? .states = bq24022_states,
+??? .nr_states =

ARRAY_SIZE(bq24022_states),
+
+??? .type = REGULATOR_CURRENT,
+??? .init_data = &bq24022_init_data,
};

static struct platform_device bq24022 = {
-??? .name = "bq24022",
+??? .name = "gpio-regulator",
??? .id???= -1,
??? .dev? = {
??? ??? .platform_data =
&bq24022_info,

arch/arm/mach-pxa/magician.c +9 -5
index 3d6baf9..5e26f3e 100644
@@ -25,7 +25,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/pda_power.h>
 #include <linux/pwm_backlight.h>
-#include <linux/regulator/bq24022.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -596,14 +597,34 @@ static struct regulator_init_data
 bq24022_init_data = {
 ??? .consumer_supplies? ? ? =
 bq24022_consumers,
 };
 
-static struct bq24022_mach_info bq24022_info = {
-??? .gpio_nce???=
 GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
-??? .gpio_iset2 =
 EGPIO_MAGICIAN_BQ24022_ISET2,
-??? .init_data? =
 &bq24022_init_data,
+static struct gpio bq24022_gpios[] = {
+??? { EGPIO_MAGICIAN_BQ24022_ISET2,
 GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
+};
+
+static struct gpio_regulator_state bq24022_states[] = {
+??? { .value = 100000, .gpios = (0 <<
 0) },
+??? { .value = 500000, .gpios = (1 <<

0) },

arch/arm/mach-pxa/magician.c +6 -0
+};
+
+static struct gpio_regulator_config bq24022_info = {
+??? .supply_name = "bq24022",
+
+??? .enable_gpio =

GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+??? .enable_high = 0,
+??? .enabled_at_boot = 0,

arch/arm/mach-pxa/magician.c +6 -0
+
+??? .gpios = bq24022_gpios,
+??? .nr_gpios = ARRAY_SIZE(bq24022_gpios),
+
+??? .states = bq24022_states,
+??? .nr_states =

ARRAY_SIZE(bq24022_states),
+
+??? .type = REGULATOR_CURRENT,
+??? .init_data = &bq24022_init_data,
};

static struct platform_device bq24022 = {
-??? .name = "bq24022",
+??? .name = "gpio-regulator",
??? .id???= -1,
??? .dev? = {
??? ??? .platform_data =
&bq24022_info,

Signature · 1 line
1.7.5.4
maintainer
#5 lore raw
In reply to Heiko Stübner
Quoted 24 lines · Heiko St?bner

The bq24022 regulator is simply a more specialised variant of the now present gpio-regulator. Therefore it probably shouldn't stay around.

This series converts the two users of bq24022 pxa/hx4700 and pxa/magician to use the gpio-regulator instead, and after this removes the then unused bq24022 driver.

The series was compile-tested only, but the gpio-regulator itself is sucessfully used on my platform for the dcdc3 of a tps650240 (voltage regulator with one gpio) and for a bq24075 (current regulator with two gpios). So I'm quite sure it should work correctly but would welcome testers :-) .

Heiko Stuebner (2):
?pxa: magician/hx4700: Convert to gpio-regulator from bq24022 ?regulator: Remove bq24022 regulator driver

?arch/arm/configs/magician_defconfig | ? ?2 +-
?arch/arm/mach-pxa/hx4700.c ? ? ? ? ?| ? 33 ++++++--
?arch/arm/mach-pxa/magician.c ? ? ? ?| ? 33 ++++++--
?drivers/regulator/Kconfig ? ? ? ? ? | ? ?8 --
?drivers/regulator/Makefile ? ? ? ? ?| ? ?1 -
?drivers/regulator/bq24022.c ? ? ? ? | ?162 -----------------------------------
?include/linux/regulator/bq24022.h ? | ? 24 -----
Quoted 5 lines

?7 files changed, 55 insertions(+), 208 deletions(-) ?delete mode 100644 drivers/regulator/bq24022.c ?delete mode 100644 include/linux/regulator/bq24022.h

--

Hi Mark,

I'm planning to merge this patch into arch-pxa tree since some changes on hx4700.c and magician.c. Is it ok fot you?

Best Regards
Haojian

Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] regulator: Remove bq24022 regulator driver

In reply to Heiko Stübner
Quoted 4 lines · Heiko St?bner

The bq24022 driver is just a specialised form of a gpio-regulator.

As all former users of it now use the gpio-regulator directly, there is no need to keep it around.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120306/46fc976f/attachment.sig>