aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2010-02-10 04:09:05 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:52 -0500
commitf8e6dbffa7a6cb3da3bcaf1fde3039896e1ac764 (patch)
treef5ddf55dbf055afe11c45f0825dd920b10bba213 /arch
parentf5f9531c7e588ee62e3aeddb14613ea80e7c2ca2 (diff)
Blackfin: bf537-stamp: add example ADP122/ADP150 power regulator resources
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 4a09ce90ca4b..5f189518697a 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -35,6 +35,9 @@
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_ADP_SWITCH
39#include <linux/regulator/adp_switch.h>
40#endif
38#ifdef CONFIG_REGULATOR_AD5398 41#ifdef CONFIG_REGULATOR_AD5398
39#include <linux/regulator/ad5398.h> 42#include <linux/regulator/ad5398.h>
40#endif 43#endif
@@ -2008,6 +2011,93 @@ static struct platform_device bfin_ac97 = {
2008}; 2011};
2009#endif 2012#endif
2010 2013
2014#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2015#define REGULATOR_ADP122 "adp122"
2016#define REGULATOR_ADP150 "adp150"
2017
2018static struct regulator_consumer_supply adp122_consumers = {
2019 .supply = REGULATOR_ADP122,
2020};
2021
2022static struct regulator_consumer_supply adp150_consumers = {
2023 .supply = REGULATOR_ADP150,
2024};
2025
2026static struct regulator_init_data adp_switch_regulator_data[] = {
2027 {
2028 .constraints = {
2029 .name = REGULATOR_ADP122,
2030 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
2031 },
2032 .num_consumer_supplies = 1, /* only 1 */
2033 .consumer_supplies = &adp122_consumers,
2034 .driver_data = (void *)GPIO_PF2, /* gpio port only */
2035 },
2036 {
2037 .constraints = {
2038 .name = REGULATOR_ADP150,
2039 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
2040 },
2041 .num_consumer_supplies = 1, /* only 1 */
2042 .consumer_supplies = &adp150_consumers,
2043 .driver_data = (void *)GPIO_PF3, /* gpio port only */
2044 },
2045};
2046
2047static struct adp_switch_platform_data adp_switch_pdata = {
2048 .regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
2049 .regulator_data = adp_switch_regulator_data,
2050};
2051
2052static struct platform_device adp_switch_device = {
2053 .name = "adp_switch",
2054 .id = 0,
2055 .dev = {
2056 .platform_data = &adp_switch_pdata,
2057 },
2058};
2059
2060#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2061 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2062static struct regulator_bulk_data adp122_bulk_data = {
2063 .supply = REGULATOR_ADP122,
2064};
2065
2066static struct regulator_userspace_consumer_data adp122_userspace_comsumer_data = {
2067 .name = REGULATOR_ADP122,
2068 .num_supplies = 1,
2069 .supplies = &adp122_bulk_data,
2070};
2071
2072static struct platform_device adp122_userspace_consumer_device = {
2073 .name = "reg-userspace-consumer",
2074 .id = 0,
2075 .dev = {
2076 .platform_data = &adp122_userspace_comsumer_data,
2077 },
2078};
2079
2080static struct regulator_bulk_data adp150_bulk_data = {
2081 .supply = REGULATOR_ADP150,
2082};
2083
2084static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
2085 .name = REGULATOR_ADP150,
2086 .num_supplies = 1,
2087 .supplies = &adp150_bulk_data,
2088};
2089
2090static struct platform_device adp150_userspace_consumer_device = {
2091 .name = "reg-userspace-consumer",
2092 .id = 1,
2093 .dev = {
2094 .platform_data = &adp150_userspace_comsumer_data,
2095 },
2096};
2097#endif
2098#endif
2099
2100
2011static struct platform_device *stamp_devices[] __initdata = { 2101static struct platform_device *stamp_devices[] __initdata = {
2012 2102
2013 &bfin_dpmc, 2103 &bfin_dpmc,
@@ -2138,6 +2228,15 @@ static struct platform_device *stamp_devices[] __initdata = {
2138 &ad5398_userspace_consumer_device, 2228 &ad5398_userspace_consumer_device,
2139#endif 2229#endif
2140#endif 2230#endif
2231
2232#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2233 &adp_switch_device,
2234#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2235 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2236 &adp122_userspace_consumer_device,
2237 &adp150_userspace_consumer_device,
2238#endif
2239#endif
2141}; 2240};
2142 2241
2143static int __init stamp_init(void) 2242static int __init stamp_init(void)