aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2010-02-08 21:47:09 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:51 -0500
commitf32792d045e1bbd86c0af0a28a46ae87af1ae100 (patch)
treee58274b8b6d658be068e651f2a7a30c5c694f3ac
parent2bc4affe9c374983220c1a5d5566ce67c95384fc (diff)
Blackfin: bf537-stamp: add example AD5398 power regulator resources
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 7a1d645bbfb..84562926029 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -35,6 +35,11 @@
35#include <asm/reboot.h> 35#include <asm/reboot.h>
36#include <asm/portmux.h> 36#include <asm/portmux.h>
37#include <asm/dpmc.h> 37#include <asm/dpmc.h>
38#ifdef CONFIG_REGULATOR_AD5398
39#include <linux/regulator/ad5398.h>
40#endif
41#include <linux/regulator/consumer.h>
42#include <linux/regulator/userspace-consumer.h>
38 43
39/* 44/*
40 * Name the Board for the /proc/cpuinfo 45 * Name the Board for the /proc/cpuinfo
@@ -1634,6 +1639,59 @@ static struct adp8870_backlight_platform_data adp8870_pdata = {
1634}; 1639};
1635#endif 1640#endif
1636 1641
1642#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1643static struct regulator_consumer_supply ad5398_consumer = {
1644 .supply = "current",
1645};
1646
1647static struct regulator_init_data ad5398_regulator_data = {
1648 .constraints = {
1649 .name = "current range",
1650 .max_uA = 120000,
1651 .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
1652 },
1653 .num_consumer_supplies = 1,
1654 .consumer_supplies = &ad5398_consumer,
1655};
1656
1657static struct ad5398_platform_data ad5398_i2c_platform_data = {
1658 .current_bits = 10,
1659 .current_offset = 4,
1660 .regulator_data = &ad5398_regulator_data,
1661};
1662
1663#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
1664 defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
1665static struct platform_device ad5398_virt_consumer_device = {
1666 .name = "reg-virt-consumer",
1667 .id = 0,
1668 .dev = {
1669 .platform_data = "current", /* Passed to driver */
1670 },
1671};
1672#endif
1673#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
1674 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
1675static struct regulator_bulk_data ad5398_bulk_data = {
1676 .supply = "current",
1677};
1678
1679static struct regulator_userspace_consumer_data ad5398_userspace_comsumer_data = {
1680 .name = "ad5398",
1681 .num_supplies = 1,
1682 .supplies = &ad5398_bulk_data,
1683};
1684
1685static struct platform_device ad5398_userspace_consumer_device = {
1686 .name = "reg-userspace-consumer",
1687 .id = 0,
1688 .dev = {
1689 .platform_data = &ad5398_userspace_comsumer_data,
1690 },
1691};
1692#endif
1693#endif
1694
1637static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 1695static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1638#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE) 1696#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
1639 { 1697 {
@@ -1743,6 +1801,12 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1743 I2C_BOARD_INFO("ssm2602", 0x1b), 1801 I2C_BOARD_INFO("ssm2602", 0x1b),
1744 }, 1802 },
1745#endif 1803#endif
1804#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1805 {
1806 I2C_BOARD_INFO("ad5398", 0xC),
1807 .platform_data = (void *)&ad5398_i2c_platform_data,
1808 },
1809#endif
1746}; 1810};
1747 1811
1748#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 1812#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
@@ -2047,6 +2111,16 @@ static struct platform_device *stamp_devices[] __initdata = {
2047#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 2111#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2048 &bfin_ac97, 2112 &bfin_ac97,
2049#endif 2113#endif
2114#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
2115#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
2116 defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
2117 &ad5398_virt_consumer_device,
2118#endif
2119#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2120 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2121 &ad5398_userspace_consumer_device,
2122#endif
2123#endif
2050}; 2124};
2051 2125
2052static int __init stamp_init(void) 2126static int __init stamp_init(void)