diff options
-rw-r--r-- | arch/arm/mach-omap2/omap_pmic.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_tps6236x.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_twl.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.h | 15 |
4 files changed, 47 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap_pmic.c b/arch/arm/mach-omap2/omap_pmic.c index ddf1b9d..6febc36 100644 --- a/arch/arm/mach-omap2/omap_pmic.c +++ b/arch/arm/mach-omap2/omap_pmic.c @@ -11,6 +11,7 @@ #include <linux/init.h> #include <linux/kernel.h> +#include <linux/string.h> #include "voltage.h" @@ -73,3 +74,24 @@ next: return 0; } + +int __init omap_pmic_update(struct omap_pmic_map *tmp_map, char *name, + u16 old_chip_id, u16 new_chip_id) +{ + while (tmp_map->name != NULL) { + if (!strcmp(tmp_map->name, name) && + (tmp_map->omap_chip.oc & new_chip_id)) { + WARN("%s: this map already exists\n", __func__, name, + new_chip_id); + return -1; + } + if (!strcmp(tmp_map->name, name) && + (tmp_map->omap_chip.oc & old_chip_id)) + break; + tmp_map++; + } + if (tmp_map->name != NULL) { + tmp_map->omap_chip.oc = new_chip_id; + return 0; + } +} diff --git a/arch/arm/mach-omap2/omap_tps6236x.c b/arch/arm/mach-omap2/omap_tps6236x.c index 45ca1de5..a31fa11 100644 --- a/arch/arm/mach-omap2/omap_tps6236x.c +++ b/arch/arm/mach-omap2/omap_tps6236x.c @@ -380,3 +380,8 @@ int __init omap_tps6236x_board_setup(bool use_62361, int gpio_vsel0, out: return r; } + +int __init omap_tps6236x_update(char *name, u16 old_chip_id, u16 new_chip_id) +{ + return omap_pmic_update(omap_tps_map, name, old_chip_id, new_chip_id); +} diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index 0e30412..7225c3a 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c @@ -391,3 +391,8 @@ err: pr_err("%s: Error access to TWL4030 (%d)\n", __func__, ret); return ret; } + +int __init omap_twl_pmic_update(char *name, u16 old_chip_id, u16 new_chip_id) +{ + return omap_pmic_update(omap_twl_map, name, old_chip_id, new_chip_id); +} diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 451b1da..d82694e 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -157,14 +157,23 @@ static inline int omap_pmic_register_data(struct omap_pmic_map *map) #endif extern void omap_pmic_data_init(void); +extern int omap_pmic_update(struct omap_pmic_map *tmp_map, char *name, + u16 old_chip_id, u16 new_chip_id); + #ifdef CONFIG_TWL4030_CORE extern int omap_twl_init(void); extern int omap3_twl_set_sr_bit(bool enable); +extern int omap_twl_pmic_update(char *name, u16 old_chip_id, u16 new_chip_id); #else static inline int omap_twl_init(void) { return -EINVAL; } +static inline int omap_twl_pmic_update(char *name, u16 old_chip_id, + u16 new_chip_id) +{ + return -EINVAL; +} #endif #ifdef CONFIG_OMAP_TPS6236X @@ -172,6 +181,7 @@ extern int omap_tps6236x_board_setup(bool use_62361, int gpio_vsel0, int gpio_vsel1, int pull0, int pull1); extern int omap_tps6236x_init(void); +extern int omap_tps6236x_update(char *name, u16 old_chip_id, u16 new_chip_id); #else static inline int omap_tps6236x_board_setup(bool use_62361, int gpio_vsel0, int gpio_vsel1, int pull0, int pull1) @@ -182,6 +192,11 @@ static inline int omap_tps6236x_init(void) { return -EINVAL; } +static inline nt omap_tps6236x_update(char *name, u16 old_chip_id, + u16 new_chip_id) +{ + return -EINVAL; +} #endif #endif |