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

« back to all changes in this revision

Viewing changes to drivers/net/wireless/iwlwifi/iwl-power.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
2
 *
3
 
 * Copyright(c) 2007 - 2010 Intel Corporation. All rights reserved.
 
3
 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved.
4
4
 *
5
5
 * Portions of this file are derived from the ipw3945 project, as well
6
6
 * as portions of the ieee80211 subsystem header files.
188
188
                        table = range_0;
189
189
        }
190
190
 
191
 
        BUG_ON(lvl < 0 || lvl >= IWL_POWER_NUM);
192
 
 
193
 
        *cmd = table[lvl].cmd;
 
191
        if (WARN_ON(lvl < 0 || lvl >= IWL_POWER_NUM))
 
192
                memset(cmd, 0, sizeof(*cmd));
 
193
        else
 
194
                *cmd = table[lvl].cmd;
194
195
 
195
196
        if (period == 0) {
196
197
                skip = 0;
226
227
        else
227
228
                cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA;
228
229
 
229
 
        if (priv->cfg->bt_params &&
230
 
            priv->cfg->bt_params->advanced_bt_coexist) {
 
230
        if (iwl_advanced_bt_coexist(priv)) {
231
231
                if (!priv->cfg->bt_params->bt_sco_disable)
232
232
                        cmd->flags |= IWL_POWER_BT_SCO_ENA;
233
233
                else
313
313
        else
314
314
                cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA;
315
315
 
316
 
        if (priv->cfg->bt_params &&
317
 
            priv->cfg->bt_params->advanced_bt_coexist) {
 
316
        if (iwl_advanced_bt_coexist(priv)) {
318
317
                if (!priv->cfg->bt_params->bt_sco_disable)
319
318
                        cmd->flags |= IWL_POWER_BT_SCO_ENA;
320
319
                else
356
355
 
357
356
        dtimper = priv->hw->conf.ps_dtim_period ?: 1;
358
357
 
359
 
        if (priv->cfg->base_params->broken_powersave)
360
 
                iwl_power_sleep_cam_cmd(priv, cmd);
361
 
        else if (priv->cfg->base_params->supports_idle &&
362
 
                 priv->hw->conf.flags & IEEE80211_CONF_IDLE)
 
358
        if (priv->hw->conf.flags & IEEE80211_CONF_IDLE)
363
359
                iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20);
364
 
        else if (priv->cfg->ops->lib->tt_ops.lower_power_detection &&
365
 
                 priv->cfg->ops->lib->tt_ops.tt_power_mode &&
366
 
                 priv->cfg->ops->lib->tt_ops.lower_power_detection(priv)) {
 
360
        else if (iwl_tt_is_low_power_state(priv)) {
367
361
                /* in thermal throttling low power state */
368
362
                iwl_static_sleep_cmd(priv, cmd,
369
 
                    priv->cfg->ops->lib->tt_ops.tt_power_mode(priv), dtimper);
 
363
                    iwl_tt_current_power_mode(priv), dtimper);
370
364
        } else if (!enabled)
371
365
                iwl_power_sleep_cam_cmd(priv, cmd);
372
366
        else if (priv->power_data.debug_sleep_level_override >= 0)
428
422
 
429
423
        return ret;
430
424
}
431
 
EXPORT_SYMBOL(iwl_power_set_mode);
432
425
 
433
426
int iwl_power_update_mode(struct iwl_priv *priv, bool force)
434
427
{
437
430
        iwl_power_build_cmd(priv, &cmd);
438
431
        return iwl_power_set_mode(priv, &cmd, force);
439
432
}
440
 
EXPORT_SYMBOL(iwl_power_update_mode);
441
433
 
442
434
/* initialize to default */
443
435
void iwl_power_initialize(struct iwl_priv *priv)
451
443
        memset(&priv->power_data.sleep_cmd, 0,
452
444
                sizeof(priv->power_data.sleep_cmd));
453
445
}
454
 
EXPORT_SYMBOL(iwl_power_initialize);