| /* |
| * Registration hooks for PMICs used with OMAP |
| * |
| * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
| * Nishanth Menon |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 as |
| * published by the Free Software Foundation. |
| */ |
| |
| #include <linux/init.h> |
| #include <linux/kernel.h> |
| |
| #include "voltage.h" |
| |
| #include "pm.h" |
| |
| /** |
| * omap_init_all_pmic() - trigger point for all PMIC initializers |
| */ |
| void __init omap_init_all_pmic(void) |
| { |
| omap_twl_init(); |
| omap_tps6236x_init(); |
| } |
| |
| /** |
| * omap_pmic_register_data() - Register the PMIC information to OMAP mapping |
| * @omap_pmic__maps: array ending with a empty element representing the maps |
| */ |
| int __init omap_pmic_register_data(struct omap_pmic_map *omap_pmic_maps) |
| { |
| struct voltagedomain *voltdm; |
| struct omap_pmic_map *map; |
| int r; |
| |
| if (!omap_pmic_maps) |
| return 0; |
| |
| map = omap_pmic_maps; |
| |
| while(map->name) { |
| |
| if (!omap_are_we_running_on(map->omap_revs)) |
| goto next; |
| |
| voltdm = voltdm_lookup(map->name); |
| if (IS_ERR_OR_NULL(voltdm)) { |
| pr_err("%s: unable to find map %s\n",__func__, |
| map->name); |
| goto next; |
| } |
| if (IS_ERR_OR_NULL(map->pmic_data)) { |
| pr_warning("%s: domain[%s] has no pmic data\n",__func__, |
| map->name); |
| goto next; |
| } |
| |
| r = omap_voltage_register_pmic(voltdm, map->pmic_data); |
| if (r) { |
| pr_warning("%s: domain[%s] register returned %d\n", |
| __func__, map->name, r); |
| goto next; |
| } |
| if (map->special_action) { |
| r = map->special_action(voltdm); |
| WARN(r, "%s: domain[%s] action returned %d\n", __func__, |
| map->name, r); |
| } |
| next: |
| map++; |
| } |
| |
| return 0; |
| } |