Commit 6967cca8 authored by Heiko Stübner's avatar Heiko Stübner Committed by Haojian Zhuang

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: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarPaul Parsons <lost.distance@yahoo.com>
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@gmail.com>
parent 192cfd58
...@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y ...@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y
CONFIG_HTC_EGPIO=y CONFIG_HTC_EGPIO=y
CONFIG_HTC_PASIC3=y CONFIG_HTC_PASIC3=y
CONFIG_REGULATOR=y CONFIG_REGULATOR=y
CONFIG_REGULATOR_BQ24022=y CONFIG_REGULATOR_GPIO=y
CONFIG_FB=y CONFIG_FB=y
CONFIG_FB_PXA=y CONFIG_FB_PXA=y
CONFIG_FB_PXA_OVERLAY=y CONFIG_FB_PXA_OVERLAY=y
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm_backlight.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/machine.h>
#include <linux/regulator/max1586.h> #include <linux/regulator/max1586.h>
#include <linux/spi/ads7846.h> #include <linux/spi/ads7846.h>
...@@ -682,14 +683,34 @@ static struct regulator_init_data bq24022_init_data = { ...@@ -682,14 +683,34 @@ static struct regulator_init_data bq24022_init_data = {
.consumer_supplies = bq24022_consumers, .consumer_supplies = bq24022_consumers,
}; };
static struct bq24022_mach_info bq24022_info = { static struct gpio bq24022_gpios[] = {
.gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
.gpio_iset2 = GPIO96_HX4700_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, .init_data = &bq24022_init_data,
}; };
static struct platform_device bq24022 = { static struct platform_device bq24022 = {
.name = "bq24022", .name = "gpio-regulator",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &bq24022_info, .platform_data = &bq24022_info,
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm_backlight.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/machine.h>
#include <linux/usb/gpio_vbus.h> #include <linux/usb/gpio_vbus.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
...@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = { ...@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = {
.consumer_supplies = bq24022_consumers, .consumer_supplies = bq24022_consumers,
}; };
static struct bq24022_mach_info bq24022_info = { static struct gpio bq24022_gpios[] = {
.gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
.gpio_iset2 = EGPIO_MAGICIAN_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, .init_data = &bq24022_init_data,
}; };
static struct platform_device bq24022 = { static struct platform_device bq24022 = {
.name = "bq24022", .name = "gpio-regulator",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &bq24022_info, .platform_data = &bq24022_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment