diff options
| author | Heiko Stübner <heiko@sntech.de> | 2012-03-02 07:56:38 -0500 |
|---|---|---|
| committer | Haojian Zhuang <haojian.zhuang@gmail.com> | 2012-03-06 01:01:15 -0500 |
| commit | 6967cca8b431a181d3a02eee81f0c9f8b5e9e75a (patch) | |
| tree | d8a6842c0b7766261ac48b1645f4b1d43f26f73b | |
| parent | 192cfd58774b4d17b2fe8bdc77d89c2ef4e0591d (diff) | |
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.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
| -rw-r--r-- | arch/arm/configs/magician_defconfig | 2 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/hx4700.c | 33 | ||||
| -rw-r--r-- | 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 443675d317e6..a691ef4c6008 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
| @@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y | |||
| 101 | CONFIG_HTC_EGPIO=y | 101 | CONFIG_HTC_EGPIO=y |
| 102 | CONFIG_HTC_PASIC3=y | 102 | CONFIG_HTC_PASIC3=y |
| 103 | CONFIG_REGULATOR=y | 103 | CONFIG_REGULATOR=y |
| 104 | CONFIG_REGULATOR_BQ24022=y | 104 | CONFIG_REGULATOR_GPIO=y |
| 105 | CONFIG_FB=y | 105 | CONFIG_FB=y |
| 106 | CONFIG_FB_PXA=y | 106 | CONFIG_FB_PXA=y |
| 107 | CONFIG_FB_PXA_OVERLAY=y | 107 | CONFIG_FB_PXA_OVERLAY=y |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 208eef1c0485..8a1ef2734d58 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
| @@ -28,7 +28,8 @@ | |||
| 28 | #include <linux/mtd/physmap.h> | 28 | #include <linux/mtd/physmap.h> |
| 29 | #include <linux/pda_power.h> | 29 | #include <linux/pda_power.h> |
| 30 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
| 31 | #include <linux/regulator/bq24022.h> | 31 | #include <linux/regulator/driver.h> |
| 32 | #include <linux/regulator/gpio-regulator.h> | ||
| 32 | #include <linux/regulator/machine.h> | 33 | #include <linux/regulator/machine.h> |
| 33 | #include <linux/regulator/max1586.h> | 34 | #include <linux/regulator/max1586.h> |
| 34 | #include <linux/spi/ads7846.h> | 35 | #include <linux/spi/ads7846.h> |
| @@ -682,14 +683,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
| 682 | .consumer_supplies = bq24022_consumers, | 683 | .consumer_supplies = bq24022_consumers, |
| 683 | }; | 684 | }; |
| 684 | 685 | ||
| 685 | static struct bq24022_mach_info bq24022_info = { | 686 | static struct gpio bq24022_gpios[] = { |
| 686 | .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, | 687 | { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
| 687 | .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, | 688 | }; |
| 688 | .init_data = &bq24022_init_data, | 689 | |
| 690 | static struct gpio_regulator_state bq24022_states[] = { | ||
| 691 | { .value = 100000, .gpios = (0 << 0) }, | ||
| 692 | { .value = 500000, .gpios = (1 << 0) }, | ||
| 693 | }; | ||
| 694 | |||
| 695 | static struct gpio_regulator_config bq24022_info = { | ||
| 696 | .supply_name = "bq24022", | ||
| 697 | |||
| 698 | .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN, | ||
| 699 | .enable_high = 0, | ||
| 700 | .enabled_at_boot = 0, | ||
| 701 | |||
| 702 | .gpios = bq24022_gpios, | ||
| 703 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
| 704 | |||
| 705 | .states = bq24022_states, | ||
| 706 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
| 707 | |||
| 708 | .type = REGULATOR_CURRENT, | ||
| 709 | .init_data = &bq24022_init_data, | ||
| 689 | }; | 710 | }; |
| 690 | 711 | ||
| 691 | static struct platform_device bq24022 = { | 712 | static struct platform_device bq24022 = { |
| 692 | .name = "bq24022", | 713 | .name = "gpio-regulator", |
| 693 | .id = -1, | 714 | .id = -1, |
| 694 | .dev = { | 715 | .dev = { |
| 695 | .platform_data = &bq24022_info, | 716 | .platform_data = &bq24022_info, |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 3d6baf91396c..5e26f3e93fdd 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
| @@ -25,7 +25,8 @@ | |||
| 25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
| 26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
| 27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
| 28 | #include <linux/regulator/bq24022.h> | 28 | #include <linux/regulator/driver.h> |
| 29 | #include <linux/regulator/gpio-regulator.h> | ||
| 29 | #include <linux/regulator/machine.h> | 30 | #include <linux/regulator/machine.h> |
| 30 | #include <linux/usb/gpio_vbus.h> | 31 | #include <linux/usb/gpio_vbus.h> |
| 31 | #include <linux/i2c/pxa-i2c.h> | 32 | #include <linux/i2c/pxa-i2c.h> |
| @@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
| 596 | .consumer_supplies = bq24022_consumers, | 597 | .consumer_supplies = bq24022_consumers, |
| 597 | }; | 598 | }; |
| 598 | 599 | ||
| 599 | static struct bq24022_mach_info bq24022_info = { | 600 | static struct gpio bq24022_gpios[] = { |
| 600 | .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | 601 | { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
| 601 | .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, | 602 | }; |
| 602 | .init_data = &bq24022_init_data, | 603 | |
| 604 | static struct gpio_regulator_state bq24022_states[] = { | ||
| 605 | { .value = 100000, .gpios = (0 << 0) }, | ||
| 606 | { .value = 500000, .gpios = (1 << 0) }, | ||
| 607 | }; | ||
| 608 | |||
| 609 | static struct gpio_regulator_config bq24022_info = { | ||
| 610 | .supply_name = "bq24022", | ||
| 611 | |||
| 612 | .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | ||
| 613 | .enable_high = 0, | ||
| 614 | .enabled_at_boot = 0, | ||
| 615 | |||
| 616 | .gpios = bq24022_gpios, | ||
| 617 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
| 618 | |||
| 619 | .states = bq24022_states, | ||
| 620 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
| 621 | |||
| 622 | .type = REGULATOR_CURRENT, | ||
| 623 | .init_data = &bq24022_init_data, | ||
| 603 | }; | 624 | }; |
| 604 | 625 | ||
| 605 | static struct platform_device bq24022 = { | 626 | static struct platform_device bq24022 = { |
| 606 | .name = "bq24022", | 627 | .name = "gpio-regulator", |
| 607 | .id = -1, | 628 | .id = -1, |
| 608 | .dev = { | 629 | .dev = { |
| 609 | .platform_data = &bq24022_info, | 630 | .platform_data = &bq24022_info, |
