~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap2/omap_pmic.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Registration hooks for PMICs used with OMAP
 
3
 *
 
4
 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 
5
 *      Nishanth Menon
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 2 as
 
9
 * published by the Free Software Foundation.
 
10
 */
 
11
 
 
12
#include <linux/init.h>
 
13
#include <linux/kernel.h>
 
14
 
 
15
#include "voltage.h"
 
16
 
 
17
#include "pm.h"
 
18
 
 
19
/**
 
20
 * omap_init_all_pmic() - trigger point for all PMIC initializers
 
21
 */
 
22
void __init omap_init_all_pmic(void)
 
23
{
 
24
        omap_twl_init();
 
25
        omap_tps6236x_init();
 
26
}
 
27
 
 
28
/**
 
29
 * omap_pmic_register_data() - Register the PMIC information to OMAP mapping
 
30
 * @omap_pmic__maps:    array ending with a empty element representing the maps
 
31
 */
 
32
int __init omap_pmic_register_data(struct omap_pmic_map *omap_pmic_maps)
 
33
{
 
34
        struct voltagedomain *voltdm;
 
35
        struct omap_pmic_map *map;
 
36
        int r;
 
37
 
 
38
        if (!omap_pmic_maps)
 
39
                return 0;
 
40
 
 
41
        map = omap_pmic_maps;
 
42
 
 
43
        while(map->name) {
 
44
 
 
45
                if (!omap_are_we_running_on(map->omap_revs))
 
46
                        goto next;
 
47
 
 
48
                voltdm = voltdm_lookup(map->name);
 
49
                if (IS_ERR_OR_NULL(voltdm)) {
 
50
                        pr_err("%s: unable to find map %s\n",__func__,
 
51
                                map->name);
 
52
                        goto next;
 
53
                }
 
54
                if (IS_ERR_OR_NULL(map->pmic_data)) {
 
55
                        pr_warning("%s: domain[%s] has no pmic data\n",__func__,
 
56
                                map->name);
 
57
                        goto next;
 
58
                }
 
59
 
 
60
                r = omap_voltage_register_pmic(voltdm, map->pmic_data);
 
61
                if (r) {
 
62
                        pr_warning("%s: domain[%s] register returned %d\n",
 
63
                                        __func__, map->name, r);
 
64
                        goto next;
 
65
                }
 
66
                if (map->special_action) {
 
67
                        r = map->special_action(voltdm);
 
68
                        WARN(r, "%s: domain[%s] action returned %d\n", __func__,
 
69
                                map->name, r);
 
70
                }
 
71
next:
 
72
                map++;
 
73
        }
 
74
 
 
75
        return 0;
 
76
}