本文整理汇总了C++中schedule_delayed_work函数的典型用法代码示例。如果您正苦于以下问题:C++ schedule_delayed_work函数的具体用法?C++ schedule_delayed_work怎么用?C++ schedule_delayed_work使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule_delayed_work函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: omapbmi_slot_probe
static int omapbmi_slot_probe(struct platform_device *pdev)
{
struct bmi_slot *slot;
struct resource *irq_pres, *irq_stat;
struct omap_bmi_platform_data* slot_pdata;
int ret;
printk(KERN_INFO "Buglabs 2.0 BUG Slots Driver...\n");
irq_pres = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_pres) {
dev_err(&pdev->dev, "No presence irq resource...\n");
return -ENODEV;
}
irq_stat = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
if (!irq_stat) {
dev_err(&pdev->dev, "No status irq resource...\n");
return -ENODEV;
}
slot = kzalloc(sizeof(struct bmi_slot), GFP_KERNEL);
if (!slot) {
ret = -ENOMEM;
goto err_release;
}
//Request slot enable gpios
ret = gpio_request(IOEXP_START + 15, "slot0 buf");
ret = gpio_request(IOEXP_START + 16, "slot0 en");
ret = gpio_request(IOEXP_START + 22, "slot1 buf");
ret = gpio_request(IOEXP_START + 17, "slot1 en");
ret = gpio_request(IOEXP_START + 6, "slot2 buf");
ret = gpio_request(IOEXP_START + 18, "slot2 en");
ret = gpio_request(IOEXP_START + 7, "slot3 buf");
ret = gpio_request(IOEXP_START + 19, "slot3 en");
ret = gpio_request(irq_stat->start, "BMI SINT");
if (ret) {
printk(KERN_ERR "slots_bug: GPIO %d request failed...\n",irq_stat->start);
goto err_release;
}
ret = gpio_request(irq_pres->start, "BMI PINT");
if (ret) {
gpio_free(irq_stat->start);
printk(KERN_ERR "slots_bug: GPIO %d request failed...\n",irq_pres->start);
goto err_release;
}
ret = gpio_direction_input(irq_pres->start);
gpio_set_debounce(irq_pres->start, 7936);
slot_pdata = pdev->dev.platform_data;
omapbmi_slot_gpio_req(slot_pdata->gpios);
slot->slot_data = (void*)slot_pdata->gpios;
slot->present_irq = gpio_to_irq(irq_pres->start);
slot->status_irq = gpio_to_irq(irq_stat->start);
slot->owner = THIS_MODULE;
slot->name = "omap_bug_slot";
slot->slotdev.parent = &pdev->dev;
slot->actions = &bl_actions;
slot->spi_bus_num = 1;
slot->spi_cs = slot_pdata->spi_cs;
slot->adap = i2c_get_adapter(slot_pdata->i2c_bus_no);
if (!slot->adap) {
printk(KERN_ERR "slots_bug: i2c adapter NULL...\n");
goto gpio_release;
}
ret = bmi_add_slot(slot);
if (ret) {
printk(KERN_ERR "slots_bug: Trouble instantiating slot...%d\n", ret);
goto gpio_release;
}
// disable_irq_nosync(slot->present_irq);
schedule_delayed_work(&slot->work, msecs_to_jiffies(1000));
return 0;
gpio_release:
gpio_free(irq_stat->start);
gpio_free(irq_pres->start);
err_release:
kfree(slot->slot_data);
kfree(slot);
return ret;
}
示例2: my3126_interrupt_enable
static int my3126_interrupt_enable(struct cphy *cphy)
{
schedule_delayed_work(&cphy->phy_update, HZ/30);
t1_tpi_read(cphy->adapter, A_ELMER0_GPO, &cphy->elmer_gpo);
return 0;
}
示例3: DECLARE_DVFS_WORK_FUNC
DECLARE_DVFS_WORK_FUNC(SET, PEN)
{
struct input_booster *data = (struct input_booster *)booster_data;
struct booster_dvfs *dvfs = data->dvfses[BOOSTER_DEVICE_PEN];
if (!dvfs || !dvfs->initialized) {
dev_err(data->dev, "%s: Dvfs is not initialized\n", __func__);
return;
}
mutex_lock(&dvfs->lock);
if (!dvfs->level) {
dev_err(data->dev, "%s : Skip to set booster due to level 0\n", __func__);
goto out;
}
switch (booster_mode) {
case BOOSTER_MODE_ON:
cancel_delayed_work(&dvfs->dvfs_off_work);
cancel_delayed_work(&dvfs->dvfs_chg_work);
switch (dvfs->level) {
case BOOSTER_LEVEL1:
case BOOSTER_LEVEL2:
set_qos(&dvfs->cpu_qos, PM_QOS_CPU_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL1].cpu_freq);
set_qos(&dvfs->mif_qos, PM_QOS_BUS_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL1].mif_freq);
set_qos(&dvfs->int_qos, PM_QOS_DEVICE_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL1].int_freq);
break;
case BOOSTER_LEVEL3:
set_qos(&dvfs->cpu_qos, PM_QOS_CPU_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL3].cpu_freq);
set_qos(&dvfs->mif_qos, PM_QOS_BUS_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL3].mif_freq);
set_qos(&dvfs->int_qos, PM_QOS_DEVICE_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL3].int_freq);
break;
case BOOSTER_LEVEL9:
set_qos(&dvfs->cpu_qos, PM_QOS_CPU_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL9].cpu_freq);
set_qos(&dvfs->mif_qos, PM_QOS_BUS_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL9].mif_freq);
set_qos(&dvfs->int_qos, PM_QOS_DEVICE_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL9].int_freq);
break;
default:
dev_err(data->dev, "%s : Undefined type passed[%d]\n", __func__, dvfs->level);
break;
}
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS ON [level %d]\n", __func__, dvfs->level);
if (dvfs->level == BOOSTER_LEVEL9)
schedule_delayed_work(&dvfs->dvfs_chg_work,
msecs_to_jiffies(BOOSTER_DEBUG_HEAD_TIME));
else
schedule_delayed_work(&dvfs->dvfs_chg_work,
msecs_to_jiffies(dvfs->times[dvfs->level].head_time));
dvfs->lock_status = true;
break;
case BOOSTER_MODE_OFF:
if (dvfs->lock_status)
schedule_delayed_work(&dvfs->dvfs_off_work,
msecs_to_jiffies(dvfs->times[dvfs->level].tail_time));
break;
case BOOSTER_MODE_FORCE_OFF:
if (dvfs->lock_status) {
cancel_delayed_work(&dvfs->dvfs_chg_work);
cancel_delayed_work(&dvfs->dvfs_off_work);
schedule_work(&dvfs->dvfs_off_work.work);
}
break;
default:
break;
}
out:
mutex_unlock(&dvfs->lock);
return;
}
示例4: micveth_clientpoll
static void
micveth_clientpoll(struct work_struct *work)
{
micveth_info_t *veth_info;
uint32_t transRingHi;
uint32_t transRingLo;
uint32_t scratch14 = 0;
uint32_t scratch15 = 0;
int bd;
static int enter = 0;
if (enter == 0)
{
printk("micveth is polling\n");
enter = 1;
}
mutex_lock(&micveth.lv_state_mutex);
if (micveth.lv_pollstate == CLIENT_POLL_STOPPING) {
micveth.lv_pollstate = CLIENT_POLL_STOPPED;
mutex_unlock(&micveth.lv_state_mutex);
wake_up(&micveth.lv_wq);
return;
}
// Check for state changes for each board in the system
for (bd = 0; bd < micveth.lv_num_clients; bd++) {
veth_info = &micveth.lv_info[bd];
// Do not poll boards that have not had the interface started.
if (veth_info->vi_state == VETH_STATE_INITIALIZED) {
break;
}
#ifdef NO_SRATCHREGREAD_AFTER_CONNECT
if(veth_info->vi_state != VETH_STATE_LINKUP) {
#endif
scratch14 = readl(veth_info->vi_scratch14);
scratch15 = readl(veth_info->vi_scratch15);
#ifdef NO_SRATCHREGREAD_AFTER_CONNECT
}
#endif
if (veth_info->vi_state == VETH_STATE_LINKUP) {
if (scratch14 == MICVETH_LINK_DOWN_MAGIC) {
veth_info->vi_state = VETH_STATE_LINKDOWN;
}
} else if (veth_info->vi_state == VETH_STATE_LINKDOWN) {
if (scratch14 == MICVETH_LINK_UP_MAGIC) {
// Write the transfer ring address.
transRingHi = (uint32_t)(veth_info->vi_ring.phys >> 32);
transRingLo = (uint32_t)(veth_info->vi_ring.phys & 0xffffffff);
writel(transRingLo, veth_info->vi_scratch14);
writel(transRingHi, veth_info->vi_scratch15);
veth_info->vi_state = VETH_STATE_LINKUP;
printk("MIC virtual ethernet up for board %d\n", bd);
#ifdef MIC_IS_EMULATION
printk("Card wrote Magic: It must be UP!\n");
#endif
if (mic_vnet_mode == VNET_MODE_POLL) {
schedule_delayed_work(&veth_info->vi_poll,
msecs_to_jiffies(MICVETH_POLL_TIMER_DELAY));
}
micveth.lv_num_links_remaining--;
}
#ifdef MIC_IS_EMULATION
else if (scratch14) {
printk("---> 0x%x \n", scratch14);
writel(0x0, veth_info->vi_scratch14);
}
#endif
}
示例5: mdm_modem_ioctl
long mdm_modem_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
int status, ret = 0;
if (_IOC_TYPE(cmd) != CHARM_CODE) {
pr_err("%s: invalid ioctl code\n", __func__);
return -EINVAL;
}
pr_debug("%s: Entering ioctl cmd = %d\n", __func__, _IOC_NR(cmd));
switch (cmd) {
case WAKE_CHARM:
pr_info("%s: Powering on mdm\n", __func__);
mdm_drv->ops->power_on_mdm_cb(mdm_drv);
break;
case CHECK_FOR_BOOT:
if (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 0)
put_user(1, (unsigned long __user *) arg);
else
put_user(0, (unsigned long __user *) arg);
break;
case NORMAL_BOOT_DONE:
pr_debug("%s: check if mdm is booted up\n", __func__);
get_user(status, (unsigned long __user *) arg);
if (status) {
pr_debug("%s: normal boot failed\n", __func__);
mdm_drv->mdm_boot_status = -EIO;
} else {
pr_info("%s: normal boot done\n", __func__);
mdm_drv->mdm_boot_status = 0;
}
mdm_drv->mdm_ready = 1;
if (mdm_drv->ops->normal_boot_done_cb != NULL)
mdm_drv->ops->normal_boot_done_cb(mdm_drv);
if (!first_boot)
complete(&mdm_boot);
else
first_boot = 0;
/* If successful, start a timer to check that the mdm2ap_status
* gpio goes high.
*/
if (!status && gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 0)
schedule_delayed_work(&mdm2ap_status_check_work,
msecs_to_jiffies(MDM2AP_STATUS_TIMEOUT_MS));
break;
case RAM_DUMP_DONE:
pr_debug("%s: mdm done collecting RAM dumps\n", __func__);
get_user(status, (unsigned long __user *) arg);
if (status)
mdm_drv->mdm_ram_dump_status = -EIO;
else {
pr_info("%s: ramdump collection completed\n", __func__);
mdm_drv->mdm_ram_dump_status = 0;
}
complete(&mdm_ram_dumps);
break;
case WAIT_FOR_RESTART:
pr_debug("%s: wait for mdm to need images reloaded\n",
__func__);
ret = wait_for_completion_interruptible(&mdm_needs_reload);
if (!ret)
put_user(mdm_drv->boot_type,
(unsigned long __user *) arg);
INIT_COMPLETION(mdm_needs_reload);
break;
case GET_DLOAD_STATUS:
pr_debug("getting status of mdm2ap_errfatal_gpio\n");
if (gpio_get_value(mdm_drv->mdm2ap_errfatal_gpio) == 1 &&
!mdm_drv->mdm_ready)
put_user(1, (unsigned long __user *) arg);
else
put_user(0, (unsigned long __user *) arg);
break;
case IMAGE_UPGRADE:
pr_debug("%s Image upgrade ioctl recieved\n", __func__);
if (mdm_drv->pdata->image_upgrade_supported &&
mdm_drv->ops->image_upgrade_cb) {
get_user(status, (unsigned long __user *) arg);
mdm_drv->ops->image_upgrade_cb(mdm_drv, status);
} else
pr_debug("%s Image upgrade not supported\n", __func__);
break;
case SHUTDOWN_CHARM:
if (!mdm_drv->pdata->send_shdn)
break;
mdm_drv->mdm_ready = 0;
if (mdm_debug_mask & MDM_DEBUG_MASK_SHDN_LOG)
pr_info("Sending shutdown request to mdm\n");
ret = sysmon_send_shutdown(SYSMON_SS_EXT_MODEM);
if (ret)
pr_err("%s: Graceful shutdown of the external modem failed, ret = %d\n",
__func__, ret);
break;
default:
pr_err("%s: invalid ioctl cmd = %d\n", __func__, _IOC_NR(cmd));
ret = -EINVAL;
//.........这里部分代码省略.........
示例6: musb_port_reset
void musb_port_reset(struct musb *musb, bool do_reset)
{
u8 power;
void __iomem *mbase = musb->mregs;
if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) {
musb_dbg(musb, "HNP: Returning from HNP; no hub reset from b_idle");
musb->port1_status &= ~USB_PORT_STAT_RESET;
return;
}
if (!is_host_active(musb))
return;
/* NOTE: caller guarantees it will turn off the reset when
* the appropriate amount of time has passed
*/
power = musb_readb(mbase, MUSB_POWER);
if (do_reset) {
/*
* If RESUME is set, we must make sure it stays minimum 20 ms.
* Then we must clear RESUME and wait a bit to let musb start
* generating SOFs. If we don't do this, OPT HS A 6.8 tests
* fail with "Error! Did not receive an SOF before suspend
* detected".
*/
if (power & MUSB_POWER_RESUME) {
long remain = (unsigned long) musb->rh_timer - jiffies;
if (musb->rh_timer > 0 && remain > 0) {
/* take into account the minimum delay after resume */
schedule_delayed_work(
&musb->deassert_reset_work, remain);
return;
}
musb_writeb(mbase, MUSB_POWER,
power & ~MUSB_POWER_RESUME);
/* Give the core 1 ms to clear MUSB_POWER_RESUME */
schedule_delayed_work(&musb->deassert_reset_work,
msecs_to_jiffies(1));
return;
}
power &= 0xf0;
musb_writeb(mbase, MUSB_POWER,
power | MUSB_POWER_RESET);
musb->port1_status |= USB_PORT_STAT_RESET;
musb->port1_status &= ~USB_PORT_STAT_ENABLE;
schedule_delayed_work(&musb->deassert_reset_work,
msecs_to_jiffies(50));
} else {
musb_dbg(musb, "root port reset stopped");
musb_platform_pre_root_reset_end(musb);
musb_writeb(mbase, MUSB_POWER,
power & ~MUSB_POWER_RESET);
musb_platform_post_root_reset_end(musb);
power = musb_readb(mbase, MUSB_POWER);
if (power & MUSB_POWER_HSMODE) {
musb_dbg(musb, "high-speed device connected");
musb->port1_status |= USB_PORT_STAT_HIGH_SPEED;
}
musb->port1_status &= ~USB_PORT_STAT_RESET;
musb->port1_status |= USB_PORT_STAT_ENABLE
| (USB_PORT_STAT_C_RESET << 16)
| (USB_PORT_STAT_C_ENABLE << 16);
usb_hcd_poll_rh_status(musb->hcd);
musb->vbuserr_retry = VBUSERR_RETRY_COUNT;
}
}
示例7: tsensor_late_init
void tsensor_late_init(void)
{
int i = 0,ret=0;
efuse_trim_init();
for(i=0; i<gstTempPrtInfo.num; i++)
{
printk(KERN_INFO "sensor%d type : %d.\n",i,gstTempPrtInfo.sensor_config[i].sensor_type);
printk(KERN_INFO "sensor%d sel : %d.\n",i,gstTempPrtInfo.sensor_config[i].sel);
printk(KERN_INFO "sensor%d lag_value : %d.\n",i,gstTempPrtInfo.sensor_config[i].lag_value);
gstTempPrtInfo.sensor_config[i].lag_cfg_value= (gstTempPrtInfo.sensor_config[i].lag_value*255/200);
printk(KERN_INFO "sensor%d thres_value : %d.\n",i,gstTempPrtInfo.sensor_config[i].thres_value);
printk(KERN_INFO "sensor%d reset_value : %d.\n",i,gstTempPrtInfo.sensor_config[i].reset_value);
printk(KERN_INFO "sensor%d alarm_cnt : %d.\n",i,gstTempPrtInfo.sensor_config[i].alarm_cnt);
printk(KERN_INFO "sensor%d recover_cnt : %d.\n",i,gstTempPrtInfo.sensor_config[i].recover_cnt);
switch(gstTempPrtInfo.sensor_config[i].sensor_type)
{
case TSENSOR_TYPE_ACPU_CLUSTER0:
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
((gstTempPrtInfo.sensor_config[i].thres_value + 60 + efuse_trim_data.remote_acpu_c0)*255/200);
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
(gstTempPrtInfo.sensor_config[i].thres_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].thres_cfg_value;
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
((gstTempPrtInfo.sensor_config[i].reset_value + 60 + efuse_trim_data.remote_acpu_c0)*255/200);
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
(gstTempPrtInfo.sensor_config[i].reset_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].reset_cfg_value;
break;
case TSENSOR_TYPE_ACPU_CLUSTER1:
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
((gstTempPrtInfo.sensor_config[i].thres_value + 60 + efuse_trim_data.remote_acpu_c1)*255/200);
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
(gstTempPrtInfo.sensor_config[i].thres_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].thres_cfg_value;
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
((gstTempPrtInfo.sensor_config[i].reset_value + 60 + efuse_trim_data.remote_acpu_c1)*255/200);
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
(gstTempPrtInfo.sensor_config[i].reset_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].reset_cfg_value;
break;
case TSENSOR_TYPE_GPU:
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
((gstTempPrtInfo.sensor_config[i].thres_value + 60 + efuse_trim_data.remote_gpu)*255/200);
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
(gstTempPrtInfo.sensor_config[i].thres_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].thres_cfg_value;
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
((gstTempPrtInfo.sensor_config[i].reset_value + 60 + efuse_trim_data.remote_gpu)*255/200);
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
(gstTempPrtInfo.sensor_config[i].reset_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].reset_cfg_value;
break;
case TSENSOR_TYPE_LOCAL:
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
((gstTempPrtInfo.sensor_config[i].thres_value + 60 + efuse_trim_data.local)*255/200);
gstTempPrtInfo.sensor_config[i].thres_cfg_value = \
(gstTempPrtInfo.sensor_config[i].thres_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].thres_cfg_value;
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
((gstTempPrtInfo.sensor_config[i].reset_value + 60 + efuse_trim_data.local)*255/200);
gstTempPrtInfo.sensor_config[i].reset_cfg_value = \
(gstTempPrtInfo.sensor_config[i].reset_cfg_value>254)?254:gstTempPrtInfo.sensor_config[i].reset_cfg_value;
break;
default:
break;
}
gstTempPrtInfo.sensor_config[i].thres_cfg_value |= 0x0FFFFFF00;
gstTempPrtInfo.sensor_config[i].temp_t0 = gstTempPrtInfo.sensor_config[i].thres_value;
}
ret = request_irq(IRQ_TSENSOR0,tsensor_irq, IRQF_DISABLED,"Tsensor-irq",(void*)&gstTempPrtInfo);
if (ret) {
pr_err("%s,%d request_irq failed!\n", __func__, __LINE__);
return;
}
/*hw init*/
tsensor_config_set(tsensor_get_index_by_type(TSENSOR_TYPE_LOCAL));
/*Tsensor0温度检测中断清除寄存器。clr irq*/
TSENSOR_REG_WRITE(SOC_PERI_SCTRL_SC_TEMP0_INT_CLR_ADDR(0),
SOC_PERI_SCTRL_SC_TEMP0_INT_CLR_temp0_int_clr_START,
SOC_PERI_SCTRL_SC_TEMP0_INT_CLR_temp0_int_clr_END,
0x01);
/*Tsensor0温度检测中断屏蔽寄存器。enable irq*/
TSENSOR_REG_WRITE(SOC_PERI_SCTRL_SC_TEMP0_INT_EN_ADDR(0),
SOC_PERI_SCTRL_SC_TEMP0_INT_EN_temp0_int_en_START,
SOC_PERI_SCTRL_SC_TEMP0_INT_EN_temp0_int_en_END,
0x01);
gstTempPrtInfo.init_flag = TSENSOR_INIT_OK;
pr_info("Tsensor late init ok.\n");
/* HKADC BUSINESS -s */
INIT_DELAYED_WORK(&tsensor_debug_work,
hw_tsensor_debug_work);
schedule_delayed_work(&tsensor_debug_work,
msecs_to_jiffies(60*1000));// 60s
/* HKADC BUSINESS -e */
//.........这里部分代码省略.........
示例8: lge_hsd_probe
//.........这里部分代码省略.........
//LGE_START, MYUNGWON.KIM, When Sleep IRQ Doesn't work
ret = request_threaded_irq(hi->irq_key, NULL, button_irq_handler,
IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING|IRQF_NO_SUSPEND, pdev->name, hi);
//LGE_END, MYUNGWON.KIM
if (ret) {
HSD_ERR("failed to request button irq");
goto error_06;
}
disable_irq(hi->irq_key);
ret = irq_set_irq_wake(hi->irq_key, 1);
if (ret < 0) {
HSD_ERR("Failed to set irq_key interrupt wake\n");
goto error_07;
}
/* initialize switch device */
hi->sdev.name = pdata->switch_name;
hi->sdev.print_state = lge_hsd_print_state;
hi->sdev.print_name = lge_hsd_print_name;
ret = switch_dev_register(&hi->sdev);
if (ret < 0) {
HSD_ERR("Failed to register switch device\n");
goto error_07;
}
/* initialize input device */
hi->input = input_allocate_device();
if (!hi->input) {
HSD_ERR("Failed to allocate input device\n");
ret = -ENOMEM;
goto error_08;
}
hi->input->name = pdata->keypad_name;
hi->input->id.vendor = 0x0001;
hi->input->id.product = 1;
hi->input->id.version = 1;
/*input_set_capability(hi->input, EV_SW, SW_HEADPHONE_INSERT);*/
set_bit(EV_SYN, hi->input->evbit);
set_bit(EV_KEY, hi->input->evbit);
set_bit(EV_SW, hi->input->evbit);
set_bit(hi->key_code, hi->input->keybit);
set_bit(SW_HEADPHONE_INSERT, hi->input->swbit);
set_bit(SW_MICROPHONE_INSERT, hi->input->swbit);
ret = input_register_device(hi->input);
if (ret) {
HSD_ERR("Failed to register input device\n");
goto error_09;
}
#ifdef CONFIG_LGE_AUDIO_FSA8008_MODIFY
if (gpio_get_value_cansleep(hi->gpio_detect) == EARJACK_INSERTED) {
queue_delayed_work(local_fsa8008_workqueue, &(hi->work_for_insert), 0); /* to detect in initialization with eacjack insertion */
}
#else
if (!gpio_get_value_cansleep(hi->gpio_detect))
#ifdef CONFIG_FSA8008_USE_LOCAL_WORK_QUEUE
queue_delayed_work(local_fsa8008_workqueue, &(hi->work), 0); /* to detect in initialization with eacjack insertion */
#else
schedule_delayed_work(&(hi->work), 0); /* to detect in initialization with eacjack insertion */
#endif
#endif
#ifdef AT_TEST_GPKD
err = device_create_file(&pdev->dev, &dev_attr_hookkeylog);
#endif
return ret;
error_09:
input_free_device(hi->input);
error_08:
switch_dev_unregister(&hi->sdev);
error_07:
free_irq(hi->irq_key, 0);
error_06:
free_irq(hi->irq_detect, 0);
error_05:
gpio_free(hi->gpio_mic_en);
error_04:
gpio_free(hi->gpio_key);
error_03:
gpio_free(hi->gpio_jpole);
error_02:
gpio_free(hi->gpio_detect);
error_01:
mutex_destroy(&hi->mutex_lock);
kfree(hi);
return ret;
}
示例9: hw_tsensor_debug_work
static void hw_tsensor_debug_work(void)
{
hkadc_tsensor_debug_show();
schedule_delayed_work(&tsensor_debug_work,
msecs_to_jiffies(60*1000));// 60s
}
示例10: tsensor_monitor_work_fn
/*****************************************************************************
函 数 名 : tsensor_temp_check
功能描述 : tsensor温度检测保护函数
输入参数 : 无
输出参数 : 无
返 回 值 : 无
调用函数 :
被调函数 :
修改历史 :
1.日 期 : 2013年5月6日
作 者 : 刘龙 00217270
修改内容 : 新生成函数 修改历史 :
1.日 期 : 2014年5月26日
作 者 : 王欢 w00251051
修改内容 : V8R1修改
*****************************************************************************/
void tsensor_monitor_work_fn(struct work_struct *work)
{
int tempvalue = 0;
int ret = TSENSOR_ERR;
unsigned int index = 0;
index = tsensor_get_index_by_type(TSENSOR_TYPE_LOCAL);
ret = tsensor_temp_read_by_index(index, &tempvalue);
if(TSENSOR_OK != ret)
{
pr_err("%s,%d tsensor_temp_read_by_index err\n", __func__, __LINE__);
schedule_delayed_work(&tsensor_gov->tsensor_monitor_work,0);
return;
}
pr_err("%s,%d temp_t0:%d tempvalue: %d\n", __func__, __LINE__,
gstTempPrtInfo.sensor_config[index].temp_t0,tempvalue);
if(tempvalue >= gstTempPrtInfo.sensor_config[index].thres_value)
{
gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_LOCAL);
tsensor_gov->warning_count++;
if(gstTempPrtInfo.temp_offset_benchmark<=(tempvalue-gstTempPrtInfo.sensor_config[index].temp_t0))
{
acpufreq_limit_level_regulator(&gstTempPrtInfo,FREQ_DOWN);
gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue;
pr_err("acpufreq regulator FREQ_DOWN.\n");
}
}
else if (tempvalue >= (gstTempPrtInfo.sensor_config[index].thres_value -
gstTempPrtInfo.sensor_config[index].lag_value))
{
if(gstTempPrtInfo.temp_offset_benchmark<=(gstTempPrtInfo.sensor_config[index].temp_t0 - tempvalue))
{
acpufreq_limit_level_regulator(&gstTempPrtInfo,FREQ_UP);
gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_LOCAL);
gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue;
pr_err("acpufreq regulator FREQ_UP.\n");
}
}
else
{
pwrctrl_acpu_freq_limit_max(gstTempPrtInfo.acpu_freq_limit_table[0], LOCK_FREQ_OFF);
gstTempPrtInfo.cur_acpu_freq_index = 0;
gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue;
gstTempPrtInfo.temp_prt_vote &= ~(BIT(TSENSOR_TYPE_LOCAL));
pr_err("acpu acpufreq_limit OFF.\n");
}
index = tsensor_get_index_by_type(TSENSOR_TYPE_GPU);
if(tempvalue>= gstTempPrtInfo.sensor_config[index].thres_value)
{
unsigned int cur_gpu_freq_index = gstTempPrtInfo.cur_gpu_freq_index;
cur_gpu_freq_index++;
if(cur_gpu_freq_index < gstTempPrtInfo.gpu_freq_limit_num)
{
gstTempPrtInfo.cur_gpu_freq_index = cur_gpu_freq_index;
}
pmqos_gpu_dfs_limit_max(LOCK_FREQ_ON,gstTempPrtInfo.gpu_freq_limit_table[gstTempPrtInfo.cur_gpu_freq_index]);
gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_GPU);
pr_err("gpufreq limit ON: %dM.\n", gstTempPrtInfo.gpu_freq_limit_table[gstTempPrtInfo.cur_gpu_freq_index]);
}
else if (tempvalue < gstTempPrtInfo.sensor_config[index].thres_value - gstTempPrtInfo.sensor_config[index].lag_value)
{
pmqos_gpu_dfs_limit_max(LOCK_FREQ_OFF, gstTempPrtInfo.gpu_freq_limit_table[0]);
gstTempPrtInfo.cur_gpu_freq_index = 0;
gstTempPrtInfo.temp_prt_vote &= ~(BIT(TSENSOR_TYPE_GPU));
pr_err("gpufreq limit OFF .\n");
}
if(gstTempPrtInfo.temp_prt_vote)
{
schedule_delayed_work(&tsensor_gov->tsensor_monitor_work,msecs_to_jiffies(tsensor_gov->average_period));
}
else
{
/*Tsensor0温度检测中断屏蔽寄存器。*/
TSENSOR_REG_WRITE(SOC_PERI_SCTRL_SC_TEMP0_INT_EN_ADDR(0),
SOC_PERI_SCTRL_SC_TEMP0_INT_EN_temp0_int_en_START,
//.........这里部分代码省略.........
示例11: flip_cover_work
//.........这里部分代码省略.........
#if defined (CONFIG_SEC_MILLET_PROJECT) || defined (CONFIG_SEC_T8_PROJECT)
static irqreturn_t flip_cover_detect(int irq, void *dev_id)
{
struct gpio_keys_drvdata *ddata = dev_id;
#define HALL_COMPARISONS 6
int comp_val[HALL_COMPARISONS]={0};
int i;
comp_val[0] = gpio_get_value(ddata->gpio_flip_cover);
if(comp_val[0]) {
wake_lock_timeout(&ddata->flip_wake_lock, HZ * 5 / 100); /* 50ms */
} else {
wake_unlock(&ddata->flip_wake_lock);
}
pr_info("[keys] %s flip_status : %d (%s)\n",
__func__, comp_val[0], comp_val[0]?"on":"off");
for(i=1;i<HALL_COMPARISONS;i++){
mdelay(6);
comp_val[i] = gpio_get_value(ddata->gpio_flip_cover);
if(comp_val[i]!=comp_val[0]){
pr_err("%s : Value is not same!\n", __func__);
goto out;
}
}
ddata->flip_cover = comp_val[0];
pr_info("[keys] hall ic reported value: %d (%s)\n",
ddata->flip_cover, ddata->flip_cover?"on":"off");
input_report_switch(ddata->input,
SW_FLIP, ddata->flip_cover);
input_sync(ddata->input);
out:
return IRQ_HANDLED;
}
#else
static irqreturn_t flip_cover_detect(int irq, void *dev_id)
{
bool flip_status;
struct gpio_keys_drvdata *ddata = dev_id;
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
bool debounce_status;
#endif
#ifdef CONFIG_SENSORS_HALL_DEBOUNCE
int DTIME_IRQ, DTIME_WAKE;
/* Set Debounce time for HALL IC IRQ(wake_lock / IRQ recheck)
* ON : 140ms / 70ms
* OFF : 50ms / 10ms
*/
DTIME_IRQ = ddata->debounce_set ? (HZ*7/100) : (HZ*1/100);
DTIME_WAKE = ddata->debounce_set ? (HZ*14/100) : (HZ*5/100);
#endif
if (ddata->flip_code == SW_LID)
flip_status = !gpio_get_value(ddata->gpio_flip_cover);
else
flip_status = gpio_get_value(ddata->gpio_flip_cover);
cancel_delayed_work_sync(&ddata->flip_cover_dwork);
#ifdef CONFIG_SENSORS_HALL_DEBOUNCE
printk(KERN_DEBUG "[keys] %s flip_satatus : %d, IRQt : %d, WAKEt : %d\n",
__func__, flip_status, DTIME_IRQ, DTIME_WAKE);
if(flip_status) {
wake_lock_timeout(&ddata->flip_wake_lock, HZ * DTIME_WAKE);
schedule_delayed_work(&ddata->flip_cover_dwork, DTIME_IRQ);
} else {
wake_unlock(&ddata->flip_wake_lock);
wake_lock_timeout(&ddata->flip_wake_lock, HZ * DTIME_WAKE);
schedule_delayed_work(&ddata->flip_cover_dwork, DTIME_IRQ);
}
#else /* CONFIG_SENSORS_HALL_DEBOUNCE */
printk(KERN_DEBUG "[keys] %s flip_satatus : %d\n",
__func__, flip_status);
if(flip_status) {
wake_lock_timeout(&ddata->flip_wake_lock, HZ * 5 / 100); /* 50ms */
schedule_delayed_work(&ddata->flip_cover_dwork, HZ * 1 / 100); /* 10ms */
} else {
#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL
if (ddata->gsm_area) {
mdelay(7);
debounce_status = gpio_get_value(ddata->gpio_flip_cover);
if (debounce_status != flip_status) {
printk(KERN_DEBUG "[keys] %s filp ignore IRQ\n",
__func__);
return IRQ_HANDLED;
}
}
#endif /* CONFIG_SENSORS_HALL_IRQ_CTRL */
wake_unlock(&ddata->flip_wake_lock);
schedule_delayed_work(&ddata->flip_cover_dwork, 0);
}
#endif /* CONFIG_SENSORS_HALL_DEBOUNCE */
return IRQ_HANDLED;
}
示例12: musb_port_suspend
int musb_port_suspend(struct musb *musb, bool do_suspend)
{
struct usb_otg *otg = musb->xceiv->otg;
u8 power;
void __iomem *mbase = musb->mregs;
if (!is_host_active(musb))
return 0;
/* NOTE: this doesn't necessarily put PHY into low power mode,
* turning off its clock; that's a function of PHY integration and
* MUSB_POWER_ENSUSPEND. PHY may need a clock (sigh) to detect
* SE0 changing to connect (J) or wakeup (K) states.
*/
power = musb_readb(mbase, MUSB_POWER);
if (do_suspend) {
int retries = 10000;
if (power & MUSB_POWER_RESUME)
return -EBUSY;
if (!(power & MUSB_POWER_SUSPENDM)) {
power |= MUSB_POWER_SUSPENDM;
musb_writeb(mbase, MUSB_POWER, power);
/* Needed for OPT A tests */
power = musb_readb(mbase, MUSB_POWER);
while (power & MUSB_POWER_SUSPENDM) {
power = musb_readb(mbase, MUSB_POWER);
if (retries-- < 1)
break;
}
}
musb_dbg(musb, "Root port suspended, power %02x", power);
musb->port1_status |= USB_PORT_STAT_SUSPEND;
switch (musb->xceiv->otg->state) {
case OTG_STATE_A_HOST:
musb->xceiv->otg->state = OTG_STATE_A_SUSPEND;
musb->is_active = otg->host->b_hnp_enable;
if (musb->is_active)
mod_timer(&musb->otg_timer, jiffies
+ msecs_to_jiffies(
OTG_TIME_A_AIDL_BDIS));
musb_platform_try_idle(musb, 0);
break;
case OTG_STATE_B_HOST:
musb->xceiv->otg->state = OTG_STATE_B_WAIT_ACON;
musb->is_active = otg->host->b_hnp_enable;
musb_platform_try_idle(musb, 0);
break;
default:
musb_dbg(musb, "bogus rh suspend? %s",
usb_otg_state_string(musb->xceiv->otg->state));
}
} else if (power & MUSB_POWER_SUSPENDM) {
power &= ~MUSB_POWER_SUSPENDM;
power |= MUSB_POWER_RESUME;
musb_writeb(mbase, MUSB_POWER, power);
musb_dbg(musb, "Root port resuming, power %02x", power);
musb->port1_status |= MUSB_PORT_STAT_RESUME;
schedule_delayed_work(&musb->finish_resume_work,
msecs_to_jiffies(USB_RESUME_TIMEOUT));
}
return 0;
}
示例13: check_keyboard_dock
static int check_keyboard_dock(struct sec_keyboard_callbacks *cb, bool val)
{
struct sec_keyboard_drvdata *data =
container_of(cb, struct sec_keyboard_drvdata, callbacks);
int try_cnt = 0;
int max_cnt = 14;
if (NULL == data->serio)
return 0;
if (!val)
data->dockconnected = false;
else {
cancel_delayed_work_sync(&data->power_dwork);
/* wakeup by keyboard dock */
if (data->pre_connected) {
if (UNKOWN_KEYLAYOUT != data->pre_kl) {
data->kl = data->pre_kl;
data->acc_power(3, true);
printk(KERN_DEBUG "[Keyboard] kl : %d\n",
data->pre_kl);
return 1;
}
} else
data->pre_kl = UNKOWN_KEYLAYOUT;
data->pre_connected = true;
/* to prevent the over current issue */
data->acc_power(0, false);
if (data->check_uart_path)
data->check_uart_path(true);
msleep(200);
data->acc_power(3, true);
/* try to get handshake data */
for (try_cnt = 0; try_cnt < max_cnt; try_cnt++) {
msleep(50);
if (data->kl != UNKOWN_KEYLAYOUT) {
data->dockconnected = true;
break;
}
if (gpio_get_value(data->acc_int_gpio)) {
printk(KERN_DEBUG "[Keyboard] acc is disconnected.\n");
break;
}
}
}
if (data->dockconnected)
return 1;
else {
if (data->pre_connected) {
data->dockconnected = false;
schedule_delayed_work(&data->power_dwork, HZ/2);
data->kl = UNKOWN_KEYLAYOUT;
release_all_keys(data);
}
return 0;
}
}
示例14: DECLARE_DVFS_DELAYED_WORK_FUNC
/* Touch */
DECLARE_DVFS_DELAYED_WORK_FUNC(CHG, TOUCH)
{
struct booster_dvfs *dvfs =
container_of(work, struct booster_dvfs, dvfs_chg_work.work);
struct input_booster *data = dev_get_drvdata(dvfs->parent_dev);
mutex_lock(&dvfs->lock);
if (!dvfs->times[dvfs->level].phase_time)
dvfs->phase_excuted = false;
switch (dvfs->level) {
case BOOSTER_LEVEL0:
case BOOSTER_LEVEL1:
case BOOSTER_LEVEL3:
remove_qos(&dvfs->cpu_qos);
remove_qos(&dvfs->kfc_qos);
remove_qos(&dvfs->mif_qos);
remove_qos(&dvfs->int_qos);
SET_HMP(data, BOOSTER_DEVICE_TOUCH, false);
dvfs->lock_status = false;
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS OFF\n", __func__);
break;
case BOOSTER_LEVEL2:
set_qos(&dvfs->kfc_qos, PM_QOS_KFC_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL2].kfc_freq);
set_qos(&dvfs->int_qos, PM_QOS_DEVICE_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL2].int_freq);
set_qos(&dvfs->mif_qos, PM_QOS_BUS_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL2].mif_freq);
remove_qos(&dvfs->cpu_qos);
SET_HMP(data, BOOSTER_DEVICE_TOUCH, false);
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS CHANGED [level %d]\n", __func__, dvfs->level);
break;
case BOOSTER_LEVEL4:
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS CHANGED [level %d]\n", __func__, dvfs->level);
break;
case BOOSTER_LEVEL5:
if (dvfs->phase_excuted) {
remove_qos(&dvfs->cpu_qos);
remove_qos(&dvfs->kfc_qos);
remove_qos(&dvfs->mif_qos);
remove_qos(&dvfs->int_qos);
SET_HMP(data, BOOSTER_DEVICE_TOUCH, false);
dvfs->lock_status = false;
dvfs->phase_excuted = false;
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS OFF\n", __func__);
} else {
set_qos(&dvfs->cpu_qos, PM_QOS_CPU_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL5].cpu_freq);
schedule_delayed_work(&dvfs->dvfs_chg_work,
msecs_to_jiffies(dvfs->times[BOOSTER_LEVEL5].head_time - dvfs->times[BOOSTER_LEVEL5].phase_time));
dvfs->phase_excuted = true;
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS CHANGED [level %d, start time[%d]]\n",
__func__, dvfs->level, dvfs->times[BOOSTER_LEVEL5].head_time - dvfs->times[BOOSTER_LEVEL5].phase_time);
}
break;
case BOOSTER_LEVEL9:
SET_HMP(data, BOOSTER_DEVICE_TOUCH, dvfs->freqs[BOOSTER_LEVEL9_CHG].hmp_boost);
set_qos(&dvfs->kfc_qos, PM_QOS_KFC_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL9_CHG].kfc_freq);
set_qos(&dvfs->int_qos, PM_QOS_DEVICE_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL9_CHG].int_freq);
set_qos(&dvfs->cpu_qos, PM_QOS_CPU_FREQ_MIN, dvfs->freqs[BOOSTER_LEVEL9_CHG].cpu_freq);
set_qos(&dvfs->mif_qos, PM_QOS_BUS_THROUGHPUT, dvfs->freqs[BOOSTER_LEVEL9_CHG].mif_freq);
DVFS_DEV_DBG(DBG_DVFS, data->dev, "%s : DVFS CHANGED [level %d]\n", __func__, dvfs->level);
break;
default:
dev_err(data->dev, "%s : Undefined type passed[%d]\n", __func__, dvfs->level);
break;
}
if (!dvfs->lock_status)
dvfs->phase_excuted = false;
mutex_unlock(&dvfs->lock);
}
示例15: sec_keyboard_process_data
static void sec_keyboard_process_data(struct work_struct *work)
{
struct sec_keyboard_drvdata *data = container_of(work,
struct sec_keyboard_drvdata, handledata_dwork.work);
bool press;
unsigned int keycode;
unsigned char scan_code = data->scan_code;
/* keyboard driver need the contry code*/
if (data->kl == UNKOWN_KEYLAYOUT) {
switch (scan_code) {
case US_KEYBOARD:
data->kl = US_KEYLAYOUT;
data->keycode[49] = KEY_BACKSLASH;
/* for the wakeup state*/
data->pre_kl = data->kl;
printk(KERN_DEBUG "[Keyboard] US keyboard is attacted.\n");
break;
case UK_KEYBOARD:
data->kl = UK_KEYLAYOUT;
data->keycode[49] = KEY_NUMERIC_POUND;
/* for the wakeup state*/
data->pre_kl = data->kl;
printk(KERN_DEBUG "[Keyboard] UK keyboard is attacted.\n");
break;
default:
printk(KERN_DEBUG "[Keyboard] Unkown layout : %x\n",
scan_code);
break;
}
} else {
switch (scan_code) {
case 0x0:
release_all_keys(data);
break;
case 0xca: /* Caps lock on */
case 0xcb: /* Caps lock off */
case 0xeb: /* US keyboard */
case 0xec: /* UK keyboard */
break; /* Ignore */
case 0x45:
case 0x48:
data->remap_key = scan_code;
data->pressed[scan_code] = true;
schedule_delayed_work(&data->remap_dwork, HZ/3);
break;
case 0xc5:
case 0xc8:
keycode = (scan_code & 0x7f);
data->pressed[keycode] = false;
if (0 == data->remap_key) {
input_report_key(data->input_dev,
data->keycode[keycode], 0);
input_sync(data->input_dev);
} else {
cancel_delayed_work_sync(&data->remap_dwork);
if (0x48 == keycode)
keycode = KEY_NEXTSONG;
else
keycode = KEY_PREVIOUSSONG;
input_report_key(data->input_dev,
keycode, 1);
input_report_key(data->input_dev,
keycode, 0);
input_sync(data->input_dev);
}
break;
default:
keycode = (scan_code & 0x7f);
press = ((scan_code & 0x80) != 0x80);
if (keycode >= KEYBOARD_MIN
|| keycode <= KEYBOARD_MAX) {
data->pressed[keycode] = press;
input_report_key(data->input_dev,
data->keycode[keycode], press);
input_sync(data->input_dev);
}
break;
}
}
}