~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * OMAP powerdomain control
3
3
 *
4
4
 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5
 
 * Copyright (C) 2007-2009 Nokia Corporation
 
5
 * Copyright (C) 2007-2011 Nokia Corporation
6
6
 *
7
7
 * Written by Paul Walmsley
8
8
 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
19
19
#include <linux/list.h>
20
20
#include <linux/errno.h>
21
21
#include <linux/string.h>
 
22
#include <trace/events/power.h>
 
23
 
22
24
#include "cm2xxx_3xxx.h"
23
25
#include "prcm44xx.h"
24
26
#include "cm44xx.h"
25
27
#include "prm2xxx_3xxx.h"
26
28
#include "prm44xx.h"
27
29
 
 
30
#include <asm/cpu.h>
28
31
#include <plat/cpu.h>
29
32
#include "powerdomain.h"
30
33
#include "clockdomain.h"
32
35
 
33
36
#include "pm.h"
34
37
 
 
38
#define PWRDM_TRACE_STATES_FLAG (1<<31)
 
39
 
35
40
enum {
36
41
        PWRDM_STATE_NOW = 0,
37
42
        PWRDM_STATE_PREV,
130
135
static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
131
136
{
132
137
 
133
 
        int prev;
134
 
        int state;
 
138
        int prev, state, trace_state = 0;
135
139
 
136
140
        if (pwrdm == NULL)
137
141
                return -EINVAL;
148
152
                        pwrdm->state_counter[prev]++;
149
153
                if (prev == PWRDM_POWER_RET)
150
154
                        _update_logic_membank_counters(pwrdm);
 
155
                /*
 
156
                 * If the power domain did not hit the desired state,
 
157
                 * generate a trace event with both the desired and hit states
 
158
                 */
 
159
                if (state != prev) {
 
160
                        trace_state = (PWRDM_TRACE_STATES_FLAG |
 
161
                                       ((state & OMAP_POWERSTATE_MASK) << 8) |
 
162
                                       ((prev & OMAP_POWERSTATE_MASK) << 0));
 
163
                        trace_power_domain_target(pwrdm->name, trace_state,
 
164
                                                  smp_processor_id());
 
165
                }
151
166
                break;
152
167
        default:
153
168
                return -EINVAL;
181
196
/**
182
197
 * pwrdm_init - set up the powerdomain layer
183
198
 * @pwrdm_list: array of struct powerdomain pointers to register
184
 
 * @custom_funcs: func pointers for arch specfic implementations
 
199
 * @custom_funcs: func pointers for arch specific implementations
185
200
 *
186
201
 * Loop through the array of powerdomains @pwrdm_list, registering all
187
202
 * that are available on the current CPU. If pwrdm_list is supplied
406
421
        pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
407
422
                 pwrdm->name, pwrst);
408
423
 
409
 
        if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
 
424
        if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
 
425
                /* Trace the pwrdm desired target state */
 
426
                trace_power_domain_target(pwrdm->name, pwrst,
 
427
                                          smp_processor_id());
 
428
                /* Program the pwrdm desired target state */
410
429
                ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
 
430
        }
411
431
 
412
432
        return ret;
413
433
}
938
958
 
939
959
        return count;
940
960
}
 
961
 
 
962
/**
 
963
 * pwrdm_can_ever_lose_context - can this powerdomain ever lose context?
 
964
 * @pwrdm: struct powerdomain *
 
965
 *
 
966
 * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain
 
967
 * can lose either memory or logic context or if @pwrdm is invalid, or
 
968
 * returns 0 otherwise.  This function is not concerned with how the
 
969
 * powerdomain registers are programmed (i.e., to go off or not); it's
 
970
 * concerned with whether it's ever possible for this powerdomain to
 
971
 * go off while some other part of the chip is active.  This function
 
972
 * assumes that every powerdomain can go to either ON or INACTIVE.
 
973
 */
 
974
bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
 
975
{
 
976
        int i;
 
977
 
 
978
        if (IS_ERR_OR_NULL(pwrdm)) {
 
979
                pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
 
980
                         __func__);
 
981
                return 1;
 
982
        }
 
983
 
 
984
        if (pwrdm->pwrsts & PWRSTS_OFF)
 
985
                return 1;
 
986
 
 
987
        if (pwrdm->pwrsts & PWRSTS_RET) {
 
988
                if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
 
989
                        return 1;
 
990
 
 
991
                for (i = 0; i < pwrdm->banks; i++)
 
992
                        if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
 
993
                                return 1;
 
994
        }
 
995
 
 
996
        for (i = 0; i < pwrdm->banks; i++)
 
997
                if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
 
998
                        return 1;
 
999
 
 
1000
        return 0;
 
1001
}