Diff
Modified: trunk/arch/blackfin/mach-bf537/boards/stamp.c (8872 => 8873)
--- trunk/arch/blackfin/mach-bf537/boards/stamp.c 2010-06-02 04:30:23 UTC (rev 8872)
+++ trunk/arch/blackfin/mach-bf537/boards/stamp.c 2010-06-02 05:00:21 UTC (rev 8873)
@@ -35,12 +35,13 @@
#include <asm/reboot.h>
#include <asm/portmux.h>
#include <asm/dpmc.h>
-#ifdef CONFIG_REGULATOR_ADP_SWITCH
-#include <linux/regulator/adp_switch.h>
+#ifdef CONFIG_REGULATOR_FIXED_VOLTAGE
+#include <linux/regulator/fixed.h>
#endif
#ifdef CONFIG_REGULATOR_AD5398
#include <linux/regulator/ad5398.h>
#endif
+#include <linux/regulator/machine.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/userspace-consumer.h>
@@ -2589,50 +2590,38 @@
};
#endif
-#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
-#define REGULATOR_ADP122 "adp122"
-#define REGULATOR_ADP150 "adp150"
+#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
+#define REGULATOR_ADP122 "adp122"
+#define REGULATOR_ADP122_UV 2500000
static struct regulator_consumer_supply adp122_consumers = {
.supply = REGULATOR_ADP122,
};
-static struct regulator_consumer_supply adp150_consumers = {
- .supply = REGULATOR_ADP150,
-};
-
-static struct regulator_init_data adp_switch_regulator_data[] = {
- {
- .constraints = {
- .name = REGULATOR_ADP122,
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- .min_uA = 0,
- .max_uA = 300000,
- },
- .num_consumer_supplies = 1, /* only 1 */
- .consumer_supplies = &adp122_consumers,
- .driver_data = (void *)GPIO_PF2, /* gpio port only */
+static struct regulator_init_data adp_switch_regulator_data = {
+ .constraints = {
+ .name = REGULATOR_ADP122,
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ .min_uV = REGULATOR_ADP122_UV,
+ .max_uV = REGULATOR_ADP122_UV,
+ .min_uA = 0,
+ .max_uA = 300000,
},
- {
- .constraints = {
- .name = REGULATOR_ADP150,
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- .min_uA = 0,
- .max_uA = 150000,
- },
- .num_consumer_supplies = 1, /* only 1 */
- .consumer_supplies = &adp150_consumers,
- .driver_data = (void *)GPIO_PF3, /* gpio port only */
- },
+ .num_consumer_supplies = 1, /* only 1 */
+ .consumer_supplies = &adp122_consumers,
};
-static struct adp_switch_platform_data adp_switch_pdata = {
- .regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
- .regulator_data = adp_switch_regulator_data,
+static struct fixed_voltage_config adp_switch_pdata = {
+ .supply_name = REGULATOR_ADP122,
+ .microvolts = REGULATOR_ADP122_UV,
+ .gpio = GPIO_PF2,
+ .enable_high = 1,
+ .enabled_at_boot = 0,
+ .init_data = &adp_switch_regulator_data,
};
static struct platform_device adp_switch_device = {
- .name = "adp_switch",
+ .name = "reg-fixed-voltage",
.id = 0,
.dev = {
.platform_data = &adp_switch_pdata,
@@ -2658,24 +2647,6 @@
.platform_data = &adp122_userspace_comsumer_data,
},
};
-
-static struct regulator_bulk_data adp150_bulk_data = {
- .supply = REGULATOR_ADP150,
-};
-
-static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
- .name = REGULATOR_ADP150,
- .num_supplies = 1,
- .supplies = &adp150_bulk_data,
-};
-
-static struct platform_device adp150_userspace_consumer_device = {
- .name = "reg-userspace-consumer",
- .id = 1,
- .dev = {
- .platform_data = &adp150_userspace_comsumer_data,
- },
-};
#endif
#endif
@@ -2828,12 +2799,11 @@
#endif
#endif
-#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
+#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
&adp_switch_device,
#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
&adp122_userspace_consumer_device,
- &adp150_userspace_consumer_device,
#endif
#endif
Modified: trunk/drivers/regulator/Kconfig (8872 => 8873)
--- trunk/drivers/regulator/Kconfig 2010-06-02 04:30:23 UTC (rev 8872)
+++ trunk/drivers/regulator/Kconfig 2010-06-02 05:00:21 UTC (rev 8873)
@@ -207,11 +207,5 @@
help
This driver supports AD5398 and AD5821 current regulator chips.
-config REGULATOR_ADP_SWITCH
- tristate "Ananlog Devices Switch only power regulators"
- help
- This driver supports ADP series siwtch only power regulator chips.
- ADP122, ADP123, ADP124, ADP125, ADP150, ADP5022, etc.
-
endif
Modified: trunk/drivers/regulator/Makefile (8872 => 8873)
--- trunk/drivers/regulator/Makefile 2010-06-02 04:30:23 UTC (rev 8872)
+++ trunk/drivers/regulator/Makefile 2010-06-02 05:00:21 UTC (rev 8873)
@@ -9,7 +9,6 @@
obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
-obj-$(CONFIG_REGULATOR_ADP_SWITCH) += adp_switch.o
obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
Deleted: trunk/drivers/regulator/adp_switch.c (8872 => 8873)
--- trunk/drivers/regulator/adp_switch.c 2010-06-02 04:30:23 UTC (rev 8872)
+++ trunk/drivers/regulator/adp_switch.c 2010-06-02 05:00:21 UTC (rev 8873)
@@ -1,172 +0,0 @@
-/*
- * adp_switch.c -- Voltage regulation for switch only power devices
- * AD122, AD123, AD124, AD125, AD150, AD5022, etc
- *
- * Copyright 2010 Analog Devices Inc.
- *
- * Enter bugs at http://blackfin.uclinux.org/
- *
- * Licensed under the GPL-2 or later.
- */
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/gpio.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/driver.h>
-#include <linux/regulator/adp_switch.h>
-
-struct adp_switch_chip_info {
- unsigned short gpio_port;
- unsigned short enabled;
- struct regulator_dev *rdev;
- struct regulator_desc rdesc;
-};
-
-static int adp_switch_is_enabled(struct regulator_dev *rdev)
-{
- struct adp_switch_chip_info *chip = rdev_get_drvdata(rdev);
-
- return chip->enabled;
-}
-
-static int adp_switch_enable(struct regulator_dev *rdev)
-{
- struct adp_switch_chip_info *chip = rdev_get_drvdata(rdev);
-
- gpio_set_value(chip->gpio_port, 1);
-
- return 0;
-}
-
-static int adp_switch_disable(struct regulator_dev *rdev)
-{
- struct adp_switch_chip_info *chip = rdev_get_drvdata(rdev);
-
- gpio_set_value(chip->gpio_port, 0);
-
- return 0;
-}
-
-static struct regulator_ops adp_switch_ops = {
- .enable = adp_switch_enable,
- .disable = adp_switch_disable,
- .is_enabled = adp_switch_is_enabled,
- .set_suspend_enable = adp_switch_enable,
- .set_suspend_disable = adp_switch_disable,
-};
-
-static int __devinit adp_switch_probe(struct platform_device *pdev)
-{
- struct regulator_dev *rdev;
- struct adp_switch_platform_data *pdata = pdev->dev.platform_data;
- struct adp_switch_chip_info *chip;
- int i, ret = 0;
-
- dev_dbg(&pdev->dev, "%s enter\n", __func__);
-
- if (!pdata || !pdata->regulator_num)
- return -EINVAL;
-
- chip = kzalloc(sizeof(struct adp_switch_chip_info) *
- pdata->regulator_num, GFP_KERNEL);
- if (!chip)
- return -ENOMEM;
-
- for (i = 0; i < pdata->regulator_num; i++) {
- /*
- * The GPIO port of the specific regulator is in driver_data field
- * of struct regulator_init_data defined in its platform board file.
- */
- chip[i].gpio_port =
- (unsigned short)(unsigned int)pdata->regulator_data[i].driver_data;
- chip[i].rdesc.name = pdata->regulator_data[i].consumer_supplies->supply;
- chip[i].rdesc.id = i,
- chip[i].rdesc.ops = &adp_switch_ops,
- chip[i].rdesc.type = REGULATOR_CURRENT,
- chip[i].rdesc.owner = THIS_MODULE,
-
- ret = gpio_request(chip[i].gpio_port, "adp_switch");
- if (ret) {
- dev_err(&pdev->dev,
- "Fail to request adp switch peripherals\n");
- goto err;
- }
-
- rdev = regulator_register(&chip[i].rdesc, &pdev->dev,
- &pdata->regulator_data[i], &chip[i]);
- if (IS_ERR(rdev)) {
- ret = PTR_ERR(rdev);
- dev_err(&pdev->dev, "failed to register %s\n",
- chip[i].rdesc.name);
- gpio_free(chip[i].gpio_port);
- goto err;
- }
-
- gpio_direction_output(chip[i].gpio_port, 0);
- chip[i].rdev = rdev;
- }
-
- dev_set_drvdata(&pdev->dev, chip);
- dev_info(&pdev->dev, "regulator driver loaded\n");
- return 0;
-
-err:
- while (--i >= 0) {
- regulator_unregister(chip[i].rdev);
- gpio_free(chip[i].gpio_port);
- }
- kfree(chip);
- return ret;
-}
-
-static int __devexit adp_switch_remove(struct platform_device *pdev)
-{
- struct adp_switch_chip_info *chip = platform_get_drvdata(pdev);
- struct adp_switch_platform_data *pdata = pdev->dev.platform_data;
- int i;
-
- dev_dbg(&pdev->dev, "%s enter\n", __func__);
- dev_set_drvdata(&pdev->dev, NULL);
-
-
- if (chip) {
- for (i = 0; i < pdata->regulator_num; i++) {
- regulator_unregister(chip[i].rdev);
- gpio_free(chip[i].gpio_port);
- }
- kfree(chip);
- }
-
- return 0;
-}
-
-static struct platform_driver adp_switch_driver = {
- .probe = adp_switch_probe,
- .remove = __devexit_p(adp_switch_remove),
- .driver = {
- .name = "adp_switch",
- },
-};
-
-static int __init adp_switch_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&adp_switch_driver);
- if (ret)
- pr_err("failed to register adp switch driver:%d\n", ret);
-
- return ret;
-}
-module_init(adp_switch_init);
-
-static void __exit adp_switch_exit(void)
-{
- platform_driver_unregister(&adp_switch_driver);
-}
-module_exit(adp_switch_exit);
-
-MODULE_DESCRIPTION("Switch only power regulator driver");
-MODULE_AUTHOR("Sonic Zhang");
-MODULE_LICENSE("GPL");
Deleted: trunk/include/linux/regulator/adp_switch.h (8872 => 8873)
--- trunk/include/linux/regulator/adp_switch.h 2010-06-02 04:30:23 UTC (rev 8872)
+++ trunk/include/linux/regulator/adp_switch.h 2010-06-02 05:00:21 UTC (rev 8873)
@@ -1,26 +0,0 @@
-/*
- * adp_switch.h -- Voltage regulation for switch only power devices.
- * AD122, AD123, AD124, AD125, AD150, AD5022, etc.
- *
- * Copyright 2010 Analog Devices Inc.
- *
- * Enter bugs at http://blackfin.uclinux.org/
- *
- * Licensed under the GPL-2 or later.
- */
-#ifndef REGULATOR_ADP_SWITCH
-#define REGULATOR_ADP_SWITCH
-
-#include <linux/regulator/machine.h>
-
-/**
- * adp_switch_platform_data - platform data for power swtich
- * @regulator_num: number of regulators
- * @regulator_data: regulator init data
- */
-struct adp_switch_platform_data {
- unsigned short regulator_num;
- struct regulator_init_data *regulator_data;
-};
-
-#endif