static int ss300_dump_reset(struct modem_ctl *mc) { struct io_device *iod = mc->iod; struct link_device *ld = get_current_link(iod); unsigned int gpio_cp_reset = mc->gpio_cp_reset; unsigned long flags; mif_disable_irq(&mc->irq_cp_active); mif_info("%s: %s: +++\n", mc->name, FUNC); print_mc_state(mc); spin_lock_irqsave(&mc->lock, flags); iod->modem_state_changed(iod, STATE_CRASH_EXIT); if (mc->wake_lock && !wake_lock_active(mc->wake_lock)) { wake_lock(mc->wake_lock); mif_err("%s->wake_lock locked\n", mc->name); } if (ld->ready) ld->ready(ld); spin_unlock_irqrestore(&mc->lock, flags); gpio_set_value(gpio_cp_reset, 0); print_mc_state(mc); udelay(200); if (ld->reset) ld->reset(ld); gpio_set_value(gpio_cp_reset, 1); print_mc_state(mc); msleep(300); gpio_set_value(mc->gpio_ap_status, 1); mif_info("%s: %s: ---\n", mc->name, FUNC); return 0; }
void mt_usb_disconnect(void) { printk("[MUSB] USB is ready for disconnect\n"); if (!mtk_musb || !mtk_musb->is_ready || mtk_musb->is_host || !mtk_musb->power) return; musb_stop(mtk_musb); if (wake_lock_active(&mtk_musb->usb_lock)) wake_unlock(&mtk_musb->usb_lock); if (cable_mode != CABLE_MODE_NORMAL) { musb_sync_with_bat(mtk_musb,USB_SUSPEND); mtk_musb->power = false; return; } printk("[MUSB] USB disconnect\n"); }
static bool bln_start_blinking_ex(bool start, unsigned int timeout_ms) { DEBUG_LOG("start: %d, bln_enabled: %d, bln_on: %d", start, bln_enabled, bln_on); if (start) { ktime_t delay; if (!bln_enabled || !bln_on) return false; bln_blink_on = true; delay = ktime_add(alarm_get_elapsed_realtime(), ktime_set(timeout_ms/1000, 0)); alarm_start_range(&bln_blink_alarm, delay, delay); return true; } else { bln_blink_on = false; alarm_try_to_cancel(&bln_blink_alarm); cancel_delayed_work(&bln_blink_work); if (wake_lock_active(&bln_blink_wakelock)) wake_unlock(&bln_blink_wakelock); return false; } }
static int cmc221_dump_reset(struct modem_ctl *mc) { mif_err("%s\n", mc->name); if (!wake_lock_active(&mc->mc_wake_lock)) wake_lock(&mc->mc_wake_lock); set_sromc_access(true); gpio_set_value(mc->gpio_host_active, 0); gpio_set_value(mc->gpio_cp_reset, 0); udelay(200); gpio_set_value(mc->gpio_cp_reset, 1); msleep(300); return 0; }
static void hw_timer_expire(void* data) { unsigned int host_wake; unsigned long flags; struct bcmbt_lpm_entry_struct *priv = (struct bcmbt_lpm_entry_struct *)data; spin_lock_irqsave(&priv->plpm->bcmbt_lpm_lock, flags); host_wake = gpio_get_value(priv->pdata->host_wake_gpio); if(host_wake==BCMBT_LPM_HOST_WAKE_DEASSERT) { pi_mgr_qos_request_update(&priv->plpm->host_wake_qos_node, PI_MGR_QOS_DEFAULT_VALUE); if (wake_lock_active(&priv->plpm->host_wake_lock)) wake_unlock(&priv->plpm->host_wake_lock); } /* else do nothing if host_wake == BCMBT_LPM_HOST_WAKE_ASSERT */ priv->plpm->hw_timer_st = IDLE; spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags); }
static int bq24192_step_down_detect_disable(struct bq24192_chip *chip) { int ret; chip->adc_param.state_request = ADC_TM_HIGH_LOW_THR_DISABLE; chip->adc_param.threshold_notification = bq24192_vbat_notification; chip->adc_param.channel = VBAT_SNS; ret = qpnp_adc_tm_channel_measure(&chip->adc_param); if (ret) pr_err("request ADC error %d\n", ret); cancel_delayed_work_sync(&chip->vbat_work); if (wake_lock_active(&chip->chg_wake_lock)) { pr_debug("releasing wakelock\n"); wake_unlock(&chip->chg_wake_lock); } return ret; }
static void cmd_crash_exit_handler(struct dpram_link_device *dpld) { struct link_device *ld = &dpld->ld; ld->mode = LINK_MODE_ULOAD; if (!wake_lock_active(&dpld->wlock)) wake_lock(&dpld->wlock); mif_info("%s: Recv 0xC9 (CRASH_EXIT)\n", ld->name); dpram_wake_up(dpld); complete_all(&dpld->crash_start_complete); if (dpld->ext_op && dpld->ext_op->log_disp) dpld->ext_op->log_disp(dpld); dpram_trigger_crash(dpld); }
static void cmd_crash_exit_handler(struct dpram_link_device *dpld) { struct link_device *ld = &dpld->ld; ld->mode = LINK_MODE_ULOAD; if (!wake_lock_active(&dpld->wlock)) wake_lock(&dpld->wlock); mif_err("%s: Recv 0xC9 (CRASH_EXIT)\n", ld->name); dpram_wake_up(dpld); del_timer(&dpld->crash_ack_timer); if (dpld->ext_op && dpld->ext_op->crash_log) dpld->ext_op->crash_log(dpld); handle_cp_crash(dpld); }
static int ss222_dump_reset(struct modem_ctl *mc) { unsigned int gpio_cp_reset = mc->gpio_cp_reset; mif_err("+++\n"); if (!wake_lock_active(&mc->mc_wake_lock)) wake_lock(&mc->mc_wake_lock); gpio_set_value(gpio_cp_reset, 0); udelay(200); gpio_set_value(gpio_cp_reset, 1); #if 0 c2c_reload(); #endif msleep(300); mif_err("---\n"); return 0; }
static int ss222_on(struct modem_ctl *mc) { struct link_device *ld = get_current_link(mc->iod); int cp_on = gpio_get_value(mc->gpio_cp_on); int cp_off = gpio_get_value(mc->gpio_cp_off); int cp_reset = gpio_get_value(mc->gpio_cp_reset); int cp_active = gpio_get_value(mc->gpio_phone_active); int cp_status = gpio_get_value(mc->gpio_cp_status); mif_err("+++\n"); mif_err("cp_on:%d cp_reset:%d ps_hold:%d cp_active:%d cp_status:%d\n", cp_on, cp_reset, cp_off, cp_active, cp_status); gpio_set_value(mc->gpio_pda_active, 1); if (!wake_lock_active(&mc->mc_wake_lock)) wake_lock(&mc->mc_wake_lock); mc->phone_state = STATE_OFFLINE; ld->mode = LINK_MODE_OFFLINE; /* Make PS_HOLD_OFF floating (Hi-Z) for CP ON */ make_gpio_floating(mc->gpio_cp_off, true); gpio_set_value(mc->gpio_cp_on, 0); msleep(100); gpio_set_value(mc->gpio_cp_reset, 0); msleep(500); gpio_set_value(mc->gpio_cp_on, 1); msleep(100); gpio_set_value(mc->gpio_cp_reset, 1); #if 0 c2c_reload(); #endif msleep(300); mif_err("---\n"); return 0; }
int twl4030_cable_type_detection(void) { int dtct = 0; enum usb_xceiv_events stat = USB_EVENT_NONE; int status; if(g_twl_usb == NULL) return stat; /* * Why sleep here instead of waiting for ACCISR1 interrupt? * * Upon cable plugging the VBUS and GND signals are the first to * contact the connector pins, leaving D+/D- floating for a while so * that the charger D+/D- short cannot be detected. This leaves us * with the only option to wait a while after VBUS RISE IRQ, praying * that cable will be fully inserted by then. */ status = twl4030_readb(g_twl_usb, TWL4030_MODULE_PM_MASTER, STS_HW_CONDITIONS); if (status < 0) dev_err(g_twl_usb->dev, "USB link status err %d\n", status); else if (status & (BIT(7) | BIT(2))) { if (status & BIT(2)) stat = USB_EVENT_ID; else { /* Read charger detection status */ dtct = twl4030_readb(g_twl_usb, TWL4030_MODULE_MAIN_CHARGE, TPS65921_USB_DTCT_CTRL); if ((dtct & TPS65921_USB_DET_STS_MASK) != TPS65921_USB_DET_STS_500MA) stat = USB_EVENT_VBUS; else stat = USB_EVENT_CHARGER; printk("[twl4030-usb]USB_DTCT_CTRL=0x%02x, status=0x%02x\n", dtct, status); } } else stat = USB_EVENT_NONE; if(!wake_lock_active(&usb_lock)) wake_lock(&usb_lock); return stat; }
static int coffee_open (struct inode *inode, struct file *file) { struct coffee_platform_data *pdata; int ret=0; #if 0 struct miscdevice *misc; misc = file->private_data; if (misc) pdata = dev_get_drvdata(misc->this_device); #endif pdata = container_of(file->private_data, struct coffee_platform_data, miscdev); if (!pdata) { pr_err("%s cannot get pdata.\n", __func__); return -ENXIO; } pr_info("%s speed=%lu\n", __func__, pdata->speed); #ifdef FEATURE_ESE_WAKELOCK if (wake_lock_active(&pdata->ese_lock)) { pr_err("%s Already opened\n", __func__); } else wake_lock(&pdata->ese_lock); #endif ret = coffee_regulator_onoff(pdata, POWER_ON); if (ret < 0) pr_info("%s good to turn on regulator\n", __func__); #ifdef CONFIG_ESE_SECURE ret = coffee_clk_prepare(pdata); if (ret < 0) pr_info("%s good to prepare clk.\n", __func__); #endif pr_info("%s... [%d]\n", __func__, ret); return ret; }
static ssize_t key_lock_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; ret = sscanf(buf, "%d", &is_key_lock); printk("KEY_LOCK: %s: is_key_lock %d\n", __func__, is_key_lock); if (is_key_lock == 1) { if (wake_lock_active(&keylock_wake_lock)) dev_warn(dev, "already locked wakelock\n"); else wake_lock(&keylock_wake_lock); } else if (is_key_lock == 0) { wake_unlock(&keylock_wake_lock); } return count; }
static int p61_disable_clk(struct p61_dev *p61_device) { int ret_val = 0; struct spi_device *spidev = NULL; struct s3c64xx_spi_driver_data *sdd = NULL; if (!p61_device->enabled_clk) { pr_err("%s - clock was not enabled!\n", __func__); return ret_val; } spin_lock_irq(&p61_device->ese_spi_lock); spidev = spi_dev_get(p61_device->spi); spin_unlock_irq(&p61_device->ese_spi_lock); if (spidev == NULL) { pr_err("%s - Failed to get spi dev!\n", __func__); return -1; } sdd = spi_master_get_devdata(spidev->master); if (!sdd) { pr_err("%s - Failed to get spi dev.\n", __func__); return -1; } p61_device->enabled_clk = false; pm_runtime_put(&sdd->pdev->dev); /* Disable clock */ spi_dev_put(spidev); //CS disable gpio_set_value(p61_device->cspin, 1); if (wake_lock_active(&p61_device->ese_lock)) { pr_info("%s: [NFC-ESE] wake unlock.\n", __func__); wake_unlock(&p61_device->ese_lock); } return ret_val; }
static int dpram_init_ipc(struct dpram_link_device *dpld) { struct link_device *ld = &dpld->ld; int i; if (ld->mode == LINK_MODE_IPC && get_magic(dpld) == DPRAM_MAGIC_CODE && get_access(dpld) == 1) mif_info("%s: IPC already initialized\n", ld->name); /* Clear pointers in every circular queue */ for (i = 0; i < dpld->max_ipc_dev; i++) { set_tx_head(dpld, i, 0); set_tx_tail(dpld, i, 0); set_rx_head(dpld, i, 0); set_rx_tail(dpld, i, 0); } for (i = 0; i < dpld->max_ipc_dev; i++) { spin_lock_init(&dpld->tx_lock[i]); atomic_set(&dpld->res_required[i], 0); } atomic_set(&dpld->accessing, 0); /* Enable IPC */ set_magic(dpld, DPRAM_MAGIC_CODE); set_access(dpld, 1); if (get_magic(dpld) != DPRAM_MAGIC_CODE || get_access(dpld) != 1) return -EACCES; ld->mode = LINK_MODE_IPC; if (wake_lock_active(&dpld->wlock)) wake_unlock(&dpld->wlock); return 0; }
static void wacom_i2c_early_suspend(struct early_suspend *h) { struct wacom_i2c *wac_i2c = container_of(h, struct wacom_i2c, early_suspend); disable_irq(wac_i2c->client->irq); #ifdef WACOM_PDCT_WORK_AROUND disable_irq(wac_i2c->irq_pdct); #endif /* release pen, if it is pressed */ #ifdef WACOM_PDCT_WORK_AROUND if (wac_i2c->pen_pdct == PDCT_DETECT_PEN) #else if (wac_i2c->pen_pressed || wac_i2c->side_pressed || wac_i2c->pen_prox) #endif forced_release(wac_i2c); if (!wake_lock_active(&wac_i2c->wakelock)) wac_i2c->wac_pdata->early_suspend_platform_hw(); printk(KERN_DEBUG "[E-PEN] %s.\n", __func__); }
static void wacom_power_on(struct wacom_i2c *wac_i2c) { bool en = true; printk(KERN_DEBUG"epen: %s\n", __func__); #ifdef BATTERY_SAVING_MODE if (wac_i2c->battery_saving_mode && wac_i2c->pen_insert) en = false; #endif if (wake_lock_active(&wac_i2c->wakelock)) { en = false; printk(KERN_DEBUG"epen:wake_lock active\n"); } if (en) { wac_i2c->wac_pdata->resume_platform_hw(); cancel_delayed_work_sync(&wac_i2c->resume_work); schedule_delayed_work(&wac_i2c->resume_work, HZ / 5); } }
int bcmbt_lpm_deassert_bt_wake(void) { if (priv_g == NULL) pr_err("%s BLUETOOTH: structure corrupted" \ " or not init - cannot assert bt_wake\n", __func__); if (unlikely((priv_g->pdata->bt_wake_gpio == -1))) return -EFAULT; gpio_set_value(priv_g->pdata->bt_wake_gpio, BCMBT_LPM_BT_WAKE_DEASSERT); pr_debug("BLUETOOTH:DEASSERT BT_WAKE\n"); pi_mgr_qos_request_update(&priv_g->plpm->bt_wake_qos_node, PI_MGR_QOS_DEFAULT_VALUE); #ifdef CONFIG_HAS_WAKELOCK if (priv_g != NULL) { if (wake_lock_active(&priv_g->plpm->bt_wake_lock)) wake_unlock(&priv_g->plpm->bt_wake_lock); } #endif pr_debug("%s BLUETOOTH:Exiting\n", __func__); return 0; }
/* Rx timer callback function */ static void schedule_timer(unsigned long arg) { struct hci_dev *hdev = (struct hci_dev *) arg; struct hci_smd_data *hsmd = &hs; BT_DBG("%s Schedule Rx timer", hdev->name); if (is_rx_q_empty(arg) && wake_lock_active(&hs.wake_lock_rx)) { BT_DBG("%s RX queue empty", hdev->name); /* * Since the queue is empty, its ideal * to release the wake lock on Rx */ wake_unlock(&hs.wake_lock_rx); } else{ BT_DBG("%s RX queue not empty", hdev->name); /* * Restart the timer to monitor whether the Rx queue is * empty for releasing the Rx wake lock */ mod_timer(&hsmd->rx_q_timer, jiffies + msecs_to_jiffies(RX_Q_MONITOR)); } }
int bcmbt_lpm_assert_bt_wake(void) { int rc; if (priv_g == NULL) pr_err("%s BLUETOOTH: structure corrupted or not init" \ " - cannot assert bt_wake\n", __func__); if (unlikely((priv_g->pdata->bt_wake_gpio == -1))) return -EFAULT; #ifdef CONFIG_HAS_WAKELOCK if (priv_g != NULL) { if (!wake_lock_active(&priv_g->plpm->bt_wake_lock)) wake_lock(&priv_g->plpm->bt_wake_lock); } #endif rc = pi_mgr_qos_request_update(&priv_g->plpm->bt_wake_qos_node, 0); gpio_set_value(priv_g->pdata->bt_wake_gpio, BCMBT_LPM_BT_WAKE_ASSERT); pr_debug("%s BLUETOOTH:ASSERT BT_WAKE\n", __func__); return 0; }
static int p61_set_clk(struct p61_dev *p61_device) { int ret_val = 0; struct spi_device *spidev = NULL; struct s3c64xx_spi_driver_data *sdd = NULL; spin_lock_irq(&p61_device->ese_spi_lock); spidev = spi_dev_get(p61_device->spi); spin_unlock_irq(&p61_device->ese_spi_lock); if (spidev == NULL) { pr_err("%s - Failed to get spi dev\n", __func__); return -1; } spidev->max_speed_hz = P61_SPI_CLOCK; sdd = spi_master_get_devdata(spidev->master); if (!sdd) { pr_err("%s - Failed to get spi dev.\n", __func__); return -1; } pm_runtime_get_sync(&sdd->pdev->dev); /* Enable clk */ /* set spi clock rate */ clk_set_rate(sdd->src_clk, spidev->max_speed_hz * 2); p61_device->enabled_clk = true; spi_dev_put(spidev); //CS enable gpio_set_value(p61_device->cspin, 0); usleep_range(50, 70); if (!wake_lock_active(&p61_device->ese_lock)) { pr_info("%s: [NFC-ESE] wake lock.\n", __func__); wake_lock(&p61_device->ese_lock); } return ret_val; }
static void shswic_register_recheck_handler_91411(struct work_struct *poWork) { struct delayed_work* pkt_p; int state; if(wake_lock_active(&shswic_delayed_work_wake_lock_91411)) { wake_unlock(&shswic_delayed_work_wake_lock_91411); } state = shswic_register_recheck_signal_pkt_state_91411; shswic_register_recheck_signal_pkt_state_91411 = SHSWIC_RECHECK_NON_91411; pkt_p = (struct delayed_work*)poWork; switch(state) { case SHSWIC_RECHECK_SECOND_91411: SHSWIC_DEBUG_LOG_L("SHSWIC_REG_RECHECK_SIG"); shswic_register_recheck_sig_handler_91411(); break; case SHSWIC_RECHECK_HEADSET_91411: SHSWIC_DEBUG_LOG_L("SHSWIC_REG_RECHECK_HEADSET_SIG"); shswic_register_recheck_headset_sig_handler_91411(); break; case SHSWIC_RECHECK_CANCEL_91411: SHSWIC_DEBUG_LOG_L("SHSWIC_RECHECK_CANCEL_91411"); shswic_send_register_recheck_signal_91411(shswic_register_recheck_signal_pkt_waiting_sig_91411); break; default: break; } }
void mem_handle_cp_crash(struct mem_link_device *mld, enum modem_state state) { struct link_device *ld = &mld->link_dev; struct modem_ctl *mc = ld->mc; int i; /* Disable normal IPC */ set_magic(mld, MEM_CRASH_MAGIC); set_access(mld, 0); if (!wake_lock_active(&mld->dump_wlock)) wake_lock(&mld->dump_wlock); stop_net_ifaces(ld); /* Purge the skb_txq in every IPC device (IPC_FMT, IPC_RAW, etc.) */ for (i = 0; i < MAX_SIPC5_DEV; i++) skb_queue_purge(mld->dev[i]->skb_txq); if (cp_online(mc)) set_modem_state(mld, state); mld->forced_cp_crash = false; }
static int ss300_dump_reset(struct modem_ctl *mc) { struct link_device *ld = get_current_link(mc->iod); unsigned int gpio_cp_reset = mc->gpio_cp_reset; unsigned long flags; spin_lock_irqsave(&ld->lock, flags); mif_err("+++\n"); if (mc->wake_lock && !wake_lock_active(mc->wake_lock)) { wake_lock(mc->wake_lock); mif_err("%s->wake_lock locked\n", mc->name); } if (ld->ready) ld->ready(ld); spin_unlock_irqrestore(&ld->lock, flags); mif_disable_irq(&mc->irq_cp_active); gpio_set_value(gpio_cp_reset, 0); udelay(200); if (ld->reset) ld->reset(ld); gpio_set_value(gpio_cp_reset, 1); msleep(300); gpio_set_value(mc->gpio_ap_status, 1); mif_err("---\n"); return 0; }
static ssize_t keypad_test_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; ret = sscanf(buf, "%d", &test_mode); printk("GKPD: %s: test_mode %d\n", __func__, test_mode); if (test_mode == 1) { if (wake_lock_active(&gkpd_wake_lock)) dev_warn(dev, "already locked wakelock\n"); else wake_lock(&gkpd_wake_lock); memset(gkpd_value, 0, sizeof(gkpd_value)); gkpd_last_index = 0; } else if (test_mode == 0) { wake_unlock(&gkpd_wake_lock); } return count; }
static int p3_disable_clk(struct p3_dev *p3_device) { int ret_val = 0; //unsigned short clock = 0; struct spi_device *spidev = NULL; struct s3c64xx_spi_driver_data *sdd = NULL; if (!p3_device->enabled_clk) { P3_ERR_MSG("%s - clock was not enabled!\n", __func__); return ret_val; } spin_lock_irq(&p3_device->ese_spi_lock); spidev = spi_dev_get(p3_device->spi); spin_unlock_irq(&p3_device->ese_spi_lock); if (spidev == NULL) { P3_ERR_MSG("%s - Failed to get spi dev!\n", __func__); return -1; } sdd = spi_master_get_devdata(spidev->master); if (!sdd){ P3_ERR_MSG("%s - Failed to get spi dev.\n", __func__); return -EFAULT; } p3_device->enabled_clk = false; pm_runtime_put_sync(&sdd->pdev->dev); /* Disable clock */ spi_dev_put(spidev); #ifdef FEATURE_ESE_WAKELOCK if (wake_lock_active(&p3_device->ese_lock)) wake_unlock(&p3_device->ese_lock); #endif return ret_val; }
static irqreturn_t bcmbt_lpm_host_wake_isr(int irq, void *dev) { unsigned int host_wake; unsigned long flags; struct bcmbt_lpm_entry_struct *priv = (struct bcmbt_lpm_entry_struct *)dev; if (priv == NULL) { pr_err("%s BLUETOOTH: Error data pointer is null\n", __func__); return IRQ_HANDLED; } spin_lock_irqsave(&priv->plpm->bcmbt_lpm_lock, flags); host_wake = gpio_get_value(priv->pdata->host_wake_gpio); if (BCMBT_LPM_HOST_WAKE_ASSERT == host_wake) { if (priv->plpm->hw_timer_st == IDLE) { /* wake up peripheral clock */ if (!wake_lock_active(&priv->plpm->host_wake_lock)) wake_lock(&priv->plpm->host_wake_lock); pi_mgr_qos_request_update( &priv->plpm->host_wake_qos_node, 0); } /* else do nothing if state == ACTIVE */ spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags); } else { if (priv->plpm->hw_timer_st == IDLE) { mod_timer(&priv->plpm->hw_timer, jiffies + msecs_to_jiffies(TIMER_PERIOD)); priv->plpm->hw_timer_st = ACTIVE; } /* else do nothing if state == ACTIVE */ spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags); } pr_debug("%s BLUETOOTH:Exiting.\n", __func__); return IRQ_HANDLED; }
void sta_enabled_rx_data(mac_struct_t *mac, UWORD8 *msg) { wlan_rx_t *wlan_rx = (wlan_rx_t *)msg; UWORD8 priority_rx = wlan_rx->priority_val; UWORD8 *msa = wlan_rx->msa; sta_entry_t *se = (sta_entry_t *)wlan_rx->sa_entry; msdu_desc_t *frame_desc = 0; msdu_indicate_t msdu = {{0},}; msdu_proc_state_t msdu_state = {0}; MSDU_PROC_STATUS_T status = PROC_ERROR; BOOL_T sta_ps_check_done = BFALSE; UWORD32 phy_rate = 0; phy_rate = get_rx_dscr_data_rate(wlan_rx->base_dscr); #if 0 if(IS_RATE_MCS(phy_rate) == BFALSE) { g_ap_last_rate_integer = phy_rate; g_ap_last_rate_decimal = 0; } else #endif { int j=0; for( j = 0; j < sizeof(rate_table_chenq)/sizeof(rate_table_t); j++ ) { if(rate_table_chenq[j].rate_index == phy_rate) { g_ap_last_rate_integer = rate_table_chenq[j].rate; if(rate_table_chenq[j].point5) { g_ap_last_rate_decimal = 1; } else { g_ap_last_rate_decimal = 0; } break; } } if( j >= sizeof(rate_table_chenq)/sizeof(rate_table_t) ) { g_ap_last_rate_integer = 0; g_ap_last_rate_decimal = 0; } } //printk("chenq: rx rate is: index %02x,%d.%d Mb/s\n",phy_rate, g_ap_last_rate_integer,(g_ap_last_rate_decimal ==0) ? 0 : 5); TROUT_FUNC_ENTER; #ifdef TROUT_WIFI_NPI //UWORD32 data_rate = 0; //UWORD8 user_rate = 0; UWORD32 rx_len = 0; //UWORD32 phy_rate = 0; print_log_debug_level_1("\n[DL1][INFO][Rx] {MAC API for WLAN Rx Data}"); rx_len = get_rx_dscr_frame_len(wlan_rx->base_dscr); //printk("rx len is: %u\n", rx_len); phy_rate = get_rx_dscr_data_rate(wlan_rx->base_dscr); // printk("phy rate is: 0x%x\n", phy_rate); g_ap_last_rate = get_rx_rate(phy_rate); printk("npi: rx rate is: %u Mb/s\n", g_ap_last_rate); #endif #ifdef WAKE_LOW_POWER_POLICY #if 1 if(!wlan_rx->is_grp_addr) g_low_power_flow_ctrl.rx_pkt_num += wlan_rx->num_dscr; #endif #endif // 20120709 caisf mod, merged ittiam mac v1.2 code #if 0 if(NULL_FRAME == wlan_rx->sub_type) { return; } #else /* No NULL frames should be sent to the host */ if((NULL_FRAME == wlan_rx->sub_type) || (QOS_NULL_FRAME == wlan_rx->sub_type)) { /* Handle any power save related functionality for NULL frame */ /* reception */ psm_handle_rx_packet_sta(msa, priority_rx); TROUT_FUNC_EXIT; return; } #endif /* make sure we set all filed 0 by zhao */ memset((void *)&msdu, 0, sizeof(msdu_indicate_t)); memset((void *)&msdu_state, 0, sizeof(msdu_proc_state_t)); /* Update the MSDU priority value */ msdu.priority = priority_rx; /* Create the MSDU descriptors for the received frame */ do { /* Create the MSDU descriptor */ status = update_msdu_info(wlan_rx, &msdu, &msdu_state); if(PROC_ERROR == status) break; /* Get the frame descriptor pointer */ frame_desc = &(msdu.frame_desc); /* Before forwarding the packet across to the HOST interface security */ /* checks needs to performed on the states of the transmitting station */ if(sta_check_sec_tx_sta_state(se, frame_desc, (CIPHER_T)(wlan_rx->ct)) != BTRUE) { TROUT_FUNC_EXIT; return; } /* Check for SNAP header at the beginning of the data and set the */ /* data pointer and length accordingly. */ if(BTRUE == is_snap_header_present(frame_desc)) { /* If the message is a unicast packet, search for the STA entry */ if(is_group(msdu.da) == BFALSE) { /* If the received packet is a security handshake packet */ /* process it in the security layer */ if(is_sec_handshake_pkt_sta(se, frame_desc->buffer_addr, frame_desc->data_offset, frame_desc->data_len, (CIPHER_T)(wlan_rx->ct)) == BTRUE) { continue; } #ifdef WIFI_SLEEP_POLICY if(check_11i_frame(frame_desc->buffer_addr + frame_desc->data_offset) || check_wapi_frame(frame_desc->buffer_addr + frame_desc->data_offset)) { #if 0 if(wake_lock_active(&handshake_frame_lock)) { pr_info("%s-%d: release wake_lock %s\n", __func__, __LINE__, handshake_frame_lock.name); wake_unlock(&handshake_frame_lock); } wake_lock_timeout(&handshake_frame_lock,msecs_to_jiffies(2000)); /*Keep 2s awake when HK, by caisf 20131004*/ pr_info("%s-%d: acquire wake_lock %s\n", __func__, __LINE__, handshake_frame_lock.name); #else if(wake_lock_active(&handshake_frame_lock)) { stop_hs_wake_timer(); /*Keep 2s awake when HK, by caisf 20131004*/ start_hs_wake_timer(); pr_info("%s-%d: refresh timer wake_lock %s\n", __func__, __LINE__, handshake_frame_lock.name); } else { wake_lock(&handshake_frame_lock); /*Keep 2s awake when HK, by caisf 20131004*/ start_hs_wake_timer(); pr_info("%s-%d: acquire wake_lock %s\n", __func__, __LINE__, handshake_frame_lock.name); } #endif } #endif } /* Adjust the frame to account for the SNAP header */ adjust_for_snap_header(frame_desc); } /* Reset the link loss count if a valid frame is received */ g_link_loss_count = 0; //printk("rx_data: link_lost = %d\n", g_link_loss_count); update_connection_cnt(se); /* Handle packet reception for power save */ if(sta_ps_check_done == BFALSE) { sta_ps_check_done = BTRUE; psm_handle_rx_packet_sta(msa, priority_rx); } //chenq add for wapi 2012-09-29 #ifdef MAC_WAPI_SUPP if( wlan_rx->wapi_mode == 1 ) { msdu.frame_desc.wapi_mode = 1; } else { msdu.frame_desc.wapi_mode = 0; } #endif //chenq add for auto set tx rx power 2013-07-29 #ifdef TROUT2_WIFI_IC /* Update the RSSI information */ if(msdu_state.curr_dscr == 0) { update_rssi(wlan_rx->base_dscr); } else { update_rssi(msdu_state.curr_dscr); } uptate_rssi4_auto_set_tx_rx_power(); #ifdef AUTORATE_PING //ping.jiang add for calculating statistics 2013-10-31 ar_rssi_value_add(); #endif /* AUTORATE_PING */ #endif //chenq add end rssi_value_add(); // for set_aci /* Call MSDU Indicate API with the MSDU to be sent to the host */ msdu_indicate_sta(&msdu); } while(PROC_MORE_MSDU == status); /* Handle packet reception for power save */ if(sta_ps_check_done == BFALSE) { sta_ps_check_done = BTRUE; psm_handle_rx_packet_sta(msa, priority_rx); } TROUT_FUNC_EXIT; }
static void gpio_keys_report_event(struct gpio_button_data *bdata) { struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; #ifdef CONFIG_MACH_GC1 struct gpio_keys_drvdata *ddata = input_get_drvdata(input); struct gpio_button_data *tmp_bdata; static bool overlapped; static unsigned int hotkey; unsigned int index_hotkey = 0; bool zoomkey = false; #ifdef CONFIG_FAST_BOOT /*Fake pwr off control*/ if (fake_shut_down || fake_pressed) { if (button->code == KEY_POWER) { if (!!state) { printk(KERN_DEBUG"[Keys] start fake check\n"); fake_pressed = true; if (!wake_lock_active(&fake_lock)) wake_lock(&fake_lock); mod_timer(&fake_timer, jiffies + msecs_to_jiffies(500)); } else { printk(KERN_DEBUG"[Keys] end fake checkPwr 0\n"); fake_pressed = false; if (wake_lock_active(&fake_lock)) wake_unlock(&fake_lock); } } bdata->wakeup = false; return ; } #endif if (system_rev < 6 && system_rev >= 2) { if (overlapped) { if (hotkey == button->code && !state) { bdata->key_state = !!state; bdata->wakeup = false; overlapped = false; #ifdef CONFIG_SAMSUNG_PRODUCT_SHIP printk(KERN_DEBUG"[KEYS] Ignored\n"); #else printk(KERN_DEBUG"[KEYS] Ignore %d %d\n", hotkey, state); #endif return; } } gpio_keys_check_zoom_exception(button->code, &zoomkey, &hotkey, &index_hotkey); } else if (system_rev >= 6) { /*exclusive check for zoom dial*/ unsigned int zoom_type = 0; unsigned int current_zoom_state = 0; bool pass_cur_event = false; if (is_zoom_key(button->code, &zoom_type)) { current_zoom_state = check_zoom_state(ddata); if (zoom_type == ZOOM_IN && current_zoom_state == ZOOM_OUT) pass_cur_event = true; else if (zoom_type == ZOOM_OUT && current_zoom_state == ZOOM_IN) pass_cur_event = true; if (pass_cur_event) { #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) printk(KERN_DEBUG "[keys] Pass zoom" "current %d, code %d\n", current_zoom_state, button->code); #endif return ; } } } #endif if (type == EV_ABS) { if (state) { input_event(input, type, button->code, button->value); input_sync(input); } } else { if (bdata->wakeup && !state) { input_event(input, type, button->code, !state); input_sync(input); if (button->code == KEY_POWER) printk(KERN_DEBUG"[keys] f PWR %d\n", !state); } bdata->key_state = !!state; bdata->wakeup = false; #ifdef CONFIG_MACH_GC1 if (system_rev < 6 && system_rev >= 2 && zoomkey && state) { tmp_bdata = &ddata->data[index_hotkey]; if (tmp_bdata->key_state) { #ifdef CONFIG_SAMSUNG_PRODUCT_SHIP printk(KERN_DEBUG"[KEYS] overlapped\n"); #else printk(KERN_DEBUG"[KEYS] overlapped. Forced release c %d h %d\n", tmp_bdata->button->code, hotkey); #endif input_event(input, type, hotkey, 0); input_sync(input); overlapped = true; } } if (system_rev >= 6) { /* forced release*/ if (button->code == KEY_CAMERA_ZOOMIN && !state) { tmp_bdata = &ddata->data[5]; if (tmp_bdata->key_state) { input_event(input, type, 0x221, !!state); input_sync(input); printk(KERN_DEBUG"[KEYS] forced 0x221 key release\n"); } } if (button->code == KEY_CAMERA_ZOOMOUT && !state) { tmp_bdata = &ddata->data[6]; if (tmp_bdata->key_state) { input_event(input, type, 0x222, !!state); input_sync(input); printk(KERN_DEBUG"[KEYS] forced 0x222 key release\n"); } } /*forced press*/ if (button->code == 0x221 && state) { tmp_bdata = &ddata->data[3]; if (!tmp_bdata->key_state) { input_event(input, type, KEY_CAMERA_ZOOMIN, !!state); input_sync(input); printk(KERN_DEBUG"[KEYS] forced 0x215 key press\n"); } } if (button->code == 0x222 && state) { tmp_bdata = &ddata->data[4]; if (!tmp_bdata->key_state) { input_event(input, type, KEY_CAMERA_ZOOMOUT, !!state); input_sync(input); printk(KERN_DEBUG"[KEYS] forced 0x216 key press\n"); } } } #endif input_event(input, type, button->code, !!state); input_sync(input); if (button->code == KEY_POWER) printk(KERN_DEBUG"[keys]PWR %d\n", !!state); } }
static void bq24192_irq_worker(struct work_struct *work) { struct bq24192_chip *chip = container_of(work, struct bq24192_chip, irq_work); union power_supply_propval ret = {0,}; bool ext_pwr; bool wlc_pwr = 0; bool chg_done = false; u8 temp; int rc; unsigned long flags; wake_lock(&chip->irq_wake_lock); msleep(100 * chip->irq_scheduled_time_status); rc = bq24192_read_reg(chip->client, SYSTEM_STATUS_REG, &temp); /* Open up for next possible interrupt handler beyond read reg * asap, lest we miss an interrupt */ spin_lock_irqsave(&chip->irq_work_lock, flags); chip->irq_scheduled_time_status = 0; spin_unlock_irqrestore(&chip->irq_work_lock, flags); if (rc) { pr_err("failed to read SYSTEM_STATUS_REG rc=%d\n", rc); goto irq_worker_exit; } ext_pwr = !!(temp & PG_STAT_MASK); chg_done = (temp & CHARGING_MASK) == 0x30 ? true : false; if (chg_done) { if (chip->batt_health != POWER_SUPPLY_HEALTH_OVERHEAT && bq24192_get_soc_from_batt_psy(chip) < 100) { wake_lock(&chip->extra_chg_lock); bq24192_enable_chg_term(chip, false); bq24192_trigger_recharge(chip); schedule_delayed_work(&chip->extra_chg_work, msecs_to_jiffies(EXTRA_CHG_TIME_MS)); } else { if (chip->batt_health != POWER_SUPPLY_HEALTH_OVERHEAT) bq24192_set_rechg_voltage(chip, VRECHG_300MV); power_supply_changed(&chip->ac_psy); pr_info("charge done!!\n"); } } if (chip->wlc_psy) { chip->wlc_psy->get_property(chip->wlc_psy, POWER_SUPPLY_PROP_PRESENT, &ret); wlc_pwr = ret.intval; } if ((chip->ext_pwr ^ ext_pwr) || (chip->wlc_pwr ^ wlc_pwr)) { pr_info("power source changed! ext_pwr = %d wlc_pwr = %d\n", ext_pwr, wlc_pwr); if (wake_lock_active(&chip->icl_wake_lock)) wake_unlock(&chip->icl_wake_lock); if (wake_lock_active(&chip->extra_chg_lock)) wake_unlock(&chip->extra_chg_lock); cancel_delayed_work_sync(&chip->input_limit_work); cancel_delayed_work_sync(&chip->therm_work); cancel_delayed_work_sync(&chip->extra_chg_work); bq24192_enable_chg_term(chip, true); bq24192_step_down_detect_disable(chip); chip->saved_ibat_ma = 0; chip->set_chg_current_ma = chip->chg_current_ma; chip->max_input_i_ma = INPUT_CURRENT_LIMIT_MAX_MA; if (chip->wlc_psy) { if (wlc_pwr && ext_pwr) { chip->wlc_pwr = true; power_supply_set_online(chip->wlc_psy, true); } else if (chip->wlc_pwr && !(ext_pwr && wlc_pwr)) { chip->wlc_pwr = false; power_supply_set_online(chip->wlc_psy, false); } } if (!wlc_pwr) { pr_info("notify vbus to usb otg ext_pwr = %d\n", ext_pwr); power_supply_set_present(chip->usb_psy, ext_pwr); } chip->ext_pwr = ext_pwr; } irq_worker_exit: wake_lock_timeout(&chip->irq_wake_lock, 2*HZ); }