linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator
@ 2012-03-02 12:55 Heiko Stübner
  2012-03-02 12:56 ` [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022 Heiko Stübner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Heiko Stübner @ 2012-03-02 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

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

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022
  2012-03-02 12:55 [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Heiko Stübner
@ 2012-03-02 12:56 ` Heiko Stübner
  2012-03-03  1:46   ` Paul Parsons
  2012-03-02 12:57 ` [PATCH 2/2] regulator: Remove bq24022 regulator driver Heiko Stübner
  2012-03-06  6:04 ` [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Haojian Zhuang
  2 siblings, 1 reply; 6+ messages in thread
From: Heiko Stübner @ 2012-03-02 12:56 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 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(-)

diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index 443675d..a691ef4 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -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
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index f2c23ea..7571f0d 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -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,
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 3d6baf9..5e26f3e 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -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,
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] regulator: Remove bq24022 regulator driver
  2012-03-02 12:55 [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Heiko Stübner
  2012-03-02 12:56 ` [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022 Heiko Stübner
@ 2012-03-02 12:57 ` Heiko Stübner
  2012-03-06 12:14   ` Mark Brown
  2012-03-06  6:04 ` [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Haojian Zhuang
  2 siblings, 1 reply; 6+ messages in thread
From: Heiko Stübner @ 2012-03-02 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 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

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index c733df5..25cfe1c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -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
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index cf0934b..1339198 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -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
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
deleted file mode 100644
index 9fab6d1..0000000
--- a/drivers/regulator/bq24022.c
+++ /dev/null
@@ -1,162 +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.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/err.h>
-#include <linux/module.h>
-#include <linux/gpio.h>
-#include <linux/regulator/bq24022.h>
-#include <linux/regulator/driver.h>
-
-
-static int bq24022_set_current_limit(struct regulator_dev *rdev,
-					int min_uA, int max_uA)
-{
-	struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
-
-	dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n",
-		max_uA >= 500000 ? "500" : "100");
-
-	/* REVISIT: maybe return error if min_uA != 0 ? */
-	gpio_set_value(pdata->gpio_iset2, max_uA >= 500000);
-	return 0;
-}
-
-static int bq24022_get_current_limit(struct regulator_dev *rdev)
-{
-	struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
-
-	return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000;
-}
-
-static int bq24022_enable(struct regulator_dev *rdev)
-{
-	struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
-
-	dev_dbg(rdev_get_dev(rdev), "enabling charger\n");
-
-	gpio_set_value(pdata->gpio_nce, 0);
-	return 0;
-}
-
-static int bq24022_disable(struct regulator_dev *rdev)
-{
-	struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
-
-	dev_dbg(rdev_get_dev(rdev), "disabling charger\n");
-
-	gpio_set_value(pdata->gpio_nce, 1);
-	return 0;
-}
-
-static int bq24022_is_enabled(struct regulator_dev *rdev)
-{
-	struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
-
-	return !gpio_get_value(pdata->gpio_nce);
-}
-
-static struct regulator_ops bq24022_ops = {
-	.set_current_limit = bq24022_set_current_limit,
-	.get_current_limit = bq24022_get_current_limit,
-	.enable            = bq24022_enable,
-	.disable           = bq24022_disable,
-	.is_enabled        = bq24022_is_enabled,
-};
-
-static struct regulator_desc bq24022_desc = {
-	.name  = "bq24022",
-	.ops   = &bq24022_ops,
-	.type  = REGULATOR_CURRENT,
-	.owner = THIS_MODULE,
-};
-
-static int __init bq24022_probe(struct platform_device *pdev)
-{
-	struct bq24022_mach_info *pdata = pdev->dev.platform_data;
-	struct regulator_dev *bq24022;
-	int ret;
-
-	if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2)
-		return -EINVAL;
-
-	ret = gpio_request(pdata->gpio_nce, "ncharge_en");
-	if (ret) {
-		dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n",
-			pdata->gpio_nce);
-		goto err_ce;
-	}
-	ret = gpio_request(pdata->gpio_iset2, "charge_mode");
-	if (ret) {
-		dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n",
-			pdata->gpio_iset2);
-		goto err_iset2;
-	}
-	ret = gpio_direction_output(pdata->gpio_iset2, 0);
-	ret = gpio_direction_output(pdata->gpio_nce, 1);
-
-	bq24022 = regulator_register(&bq24022_desc, &pdev->dev,
-				     pdata->init_data, pdata, NULL);
-	if (IS_ERR(bq24022)) {
-		dev_dbg(&pdev->dev, "couldn't register regulator\n");
-		ret = PTR_ERR(bq24022);
-		goto err_reg;
-	}
-	platform_set_drvdata(pdev, bq24022);
-	dev_dbg(&pdev->dev, "registered regulator\n");
-
-	return 0;
-err_reg:
-	gpio_free(pdata->gpio_iset2);
-err_iset2:
-	gpio_free(pdata->gpio_nce);
-err_ce:
-	return ret;
-}
-
-static int __devexit bq24022_remove(struct platform_device *pdev)
-{
-	struct bq24022_mach_info *pdata = pdev->dev.platform_data;
-	struct regulator_dev *bq24022 = platform_get_drvdata(pdev);
-
-	regulator_unregister(bq24022);
-	gpio_free(pdata->gpio_iset2);
-	gpio_free(pdata->gpio_nce);
-
-	return 0;
-}
-
-static struct platform_driver bq24022_driver = {
-	.driver = {
-		.name = "bq24022",
-	},
-	.remove = __devexit_p(bq24022_remove),
-};
-
-static int __init bq24022_init(void)
-{
-	return platform_driver_probe(&bq24022_driver, bq24022_probe);
-}
-
-static void __exit bq24022_exit(void)
-{
-	platform_driver_unregister(&bq24022_driver);
-}
-
-module_init(bq24022_init);
-module_exit(bq24022_exit);
-
-MODULE_AUTHOR("Philipp Zabel");
-MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver");
-MODULE_LICENSE("GPL");
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
deleted file mode 100644
index a6d0140..0000000
--- a/include/linux/regulator/bq24022.h
+++ /dev/null
@@ -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;
-};
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022
  2012-03-02 12:56 ` [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022 Heiko Stübner
@ 2012-03-03  1:46   ` Paul Parsons
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Parsons @ 2012-03-03  1:46 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks Heiko.

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

Tested-by: Paul Parsons <lost.distance@yahoo.com>

--- On Fri, 2/3/12, Heiko St?bner <heiko@sntech.de> wrote:

> From: Heiko St?bner <heiko@sntech.de>
> Subject: [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022
> To: "Mark Brown" <broonie@opensource.wolfsonmicro.com>, "Liam Girdwood" <lrg@ti.com>, "Philipp Zabel" <philipp.zabel@gmail.com>, "Eric Miao" <eric.y.miao@gmail.com>, "Haojian Zhuang" <haojian.zhuang@marvell.com>, "Russell King - ARM Linux" <linux@arm.linux.org.uk>
> Cc: linux-arm-kernel at lists.infradead.org, "LKML" <linux-kernel@vger.kernel.org>
> 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.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  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(-)
> 
> diff --git a/arch/arm/configs/magician_defconfig
> b/arch/arm/configs/magician_defconfig
> index 443675d..a691ef4 100644
> --- a/arch/arm/configs/magician_defconfig
> +++ b/arch/arm/configs/magician_defconfig
> @@ -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
> diff --git a/arch/arm/mach-pxa/hx4700.c
> b/arch/arm/mach-pxa/hx4700.c
> index f2c23ea..7571f0d 100644
> --- a/arch/arm/mach-pxa/hx4700.c
> +++ b/arch/arm/mach-pxa/hx4700.c
> @@ -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,
> diff --git a/arch/arm/mach-pxa/magician.c
> b/arch/arm/mach-pxa/magician.c
> index 3d6baf9..5e26f3e 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -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,
> -- 
> 1.7.5.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator
  2012-03-02 12:55 [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Heiko Stübner
  2012-03-02 12:56 ` [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022 Heiko Stübner
  2012-03-02 12:57 ` [PATCH 2/2] regulator: Remove bq24022 regulator driver Heiko Stübner
@ 2012-03-06  6:04 ` Haojian Zhuang
  2 siblings, 0 replies; 6+ messages in thread
From: Haojian Zhuang @ 2012-03-06  6:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 2, 2012 at 8:55 PM, Heiko St?bner <heiko@sntech.de> wrote:
> 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
>
> --
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] regulator: Remove bq24022 regulator driver
  2012-03-02 12:57 ` [PATCH 2/2] regulator: Remove bq24022 regulator driver Heiko Stübner
@ 2012-03-06 12:14   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-03-06 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 02, 2012 at 01:57:44PM +0100, Heiko St?bner wrote:
> 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.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-------------- 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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-06 12:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 12:55 [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Heiko Stübner
2012-03-02 12:56 ` [PATCH 1/2] pxa: magician/hx4700: Convert to gpio-regulator from bq24022 Heiko Stübner
2012-03-03  1:46   ` Paul Parsons
2012-03-02 12:57 ` [PATCH 2/2] regulator: Remove bq24022 regulator driver Heiko Stübner
2012-03-06 12:14   ` Mark Brown
2012-03-06  6:04 ` [PATCH 0/2] Remove bq24022 driver superseeded by gpio-regulator Haojian Zhuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).