本文整理汇总了C++中pm_relax函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_relax函数的具体用法?C++ pm_relax怎么用?C++ pm_relax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_relax函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
/* */
int ret = 0;
/* */
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
//
atomic_sub_return(1, &pvdev->opened);
if (atomic_read(&pvdev->opened) == 0) {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
/* */
ret = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if(ret < 0){
pr_err("%s:%d camera_v4l2_close_1 failed\n", __func__, __LINE__);
}
/* */
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
pm_relax(&pvdev->vdev->dev);
atomic_set(&pvdev->stream_cnt, 0);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
/* */
ret = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if(ret < 0){
pr_err("%s:%d camera_v4l2_close_2 failed\n", __func__, __LINE__);
}
/* */
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
开发者ID:TheRealTruth,项目名称:LGLS995_Gflex_Kikat_ZV9_Kernel,代码行数:60,代码来源:camera.c
示例2: bcmsdh_dev_relax
void bcmsdh_dev_relax(bcmsdh_info_t *bcmsdh)
{
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
pm_relax(bcmsdh_osinfo->dev);
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */
}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:7,代码来源:bcmsdh_linux.c
示例3: ssusb_set_mailbox
/*
* switch to host: -> MTU3_VBUS_OFF --> MTU3_ID_GROUND
* switch to device: -> MTU3_ID_FLOAT --> MTU3_VBUS_VALID
*/
static void ssusb_set_mailbox(struct otg_switch_mtk *otg_sx,
enum mtu3_vbus_id_state status)
{
struct ssusb_mtk *ssusb =
container_of(otg_sx, struct ssusb_mtk, otg_switch);
struct mtu3 *mtu = ssusb->u3d;
dev_dbg(ssusb->dev, "mailbox state(%d)\n", status);
switch (status) {
case MTU3_ID_GROUND:
switch_port_to_host(ssusb);
ssusb_set_vbus(otg_sx, 1);
ssusb->is_host = true;
break;
case MTU3_ID_FLOAT:
ssusb->is_host = false;
ssusb_set_vbus(otg_sx, 0);
switch_port_to_device(ssusb);
break;
case MTU3_VBUS_OFF:
mtu3_stop(mtu);
pm_relax(ssusb->dev);
break;
case MTU3_VBUS_VALID:
/* avoid suspend when works as device */
pm_stay_awake(ssusb->dev);
mtu3_start(mtu);
break;
default:
dev_err(ssusb->dev, "invalid state\n");
}
}
开发者ID:asmalldev,项目名称:linux,代码行数:37,代码来源:mtu3_dr.c
示例4: wcd9xxx_spmi_unlock_sleep
void wcd9xxx_spmi_unlock_sleep()
{
mutex_lock(&map.pm_lock);
if (--map.wlock_holders == 0) {
pr_debug("%s: releasing wake lock pm_state %d -> %d\n",
__func__, map.pm_state, WCD9XXX_PM_SLEEPABLE);
/*
* if wcd9xxx_spmi_lock_sleep failed, pm_state would be still
* WCD9XXX_PM_ASLEEP, don't overwrite
*/
if (likely(map.pm_state == WCD9XXX_PM_AWAKE))
map.pm_state = WCD9XXX_PM_SLEEPABLE;
pm_qos_update_request(&map.pm_qos_req,
PM_QOS_DEFAULT_VALUE);
#ifdef VENDOR_EDIT
//[email protected], 2015/03/19, Add for Qcom patch,
//Headset sometime not detected when phone is sleep
pm_relax(&map.spmi[0]->dev);
#endif /* VENDOR_EDIT */
}
mutex_unlock(&map.pm_lock);
pr_debug("%s: wake lock counter %d\n", __func__,
map.wlock_holders);
pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
wake_up_all(&map.pm_wq);
}
开发者ID:NamelessRom,项目名称:android_kernel_oppo_r7,代码行数:26,代码来源:msm8916-wcd-irq.c
示例5: titsc_irq
static irqreturn_t titsc_irq(int irq, void *dev)
{
struct titsc *ts_dev = dev;
struct input_dev *input_dev = ts_dev->input;
unsigned int fsm, status, irqclr = 0;
unsigned int x = 0, y = 0;
unsigned int z1, z2, z;
status = titsc_readl(ts_dev, REG_RAWIRQSTATUS);
if (status & IRQENB_HW_PEN) {
ts_dev->pen_down = true;
irqclr |= IRQENB_HW_PEN;
pm_stay_awake(ts_dev->mfd_tscadc->dev);
}
if (status & IRQENB_PENUP) {
fsm = titsc_readl(ts_dev, REG_ADCFSM);
if (fsm == ADCFSM_STEPID) {
ts_dev->pen_down = false;
input_report_key(input_dev, BTN_TOUCH, 0);
input_report_abs(input_dev, ABS_PRESSURE, 0);
input_sync(input_dev);
pm_relax(ts_dev->mfd_tscadc->dev);
} else {
ts_dev->pen_down = true;
}
irqclr |= IRQENB_PENUP;
}
if (status & IRQENB_EOS)
irqclr |= IRQENB_EOS;
/*
* ADC and touchscreen share the IRQ line.
* FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
*/
if (status & IRQENB_FIFO0THRES) {
titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2);
if (ts_dev->pen_down && z1 != 0 && z2 != 0) {
/*
* Calculate pressure using formula
* Resistance(touch) = x plate resistance *
* x postion/4096 * ((z2 / z1) - 1)
*/
z = z1 - z2;
z *= x;
z *= ts_dev->x_plate_resistance;
z /= z2;
z = (z + 2047) >> 12;
if (z <= MAX_12BIT) {
input_report_abs(input_dev, ABS_X, x);
input_report_abs(input_dev, ABS_Y, y);
input_report_abs(input_dev, ABS_PRESSURE, z);
input_report_key(input_dev, BTN_TOUCH, 1);
input_sync(input_dev);
}
}
开发者ID:Lyude,项目名称:linux,代码行数:60,代码来源:ti_am335x_tsc.c
示例6: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
BUG_ON(!pvdev);
atomic_sub_return(1, &pvdev->opened);
if (atomic_read(&pvdev->opened) == 0) {
if(1 == cam_wakelock_init && !wake_lock_active(&cam_wakelock))
{
hw_camera_log_info("%s: start camera wake_lock_timeout!\n",__func__);
//wake lock 500ms for camera exit
wake_lock_timeout(&cam_wakelock, HZ/2);
}
else
{
hw_camera_log_info("%s: do not need wake_lock now, cam_wakelock_init = %d\n",
__func__, cam_wakelock_init);
}
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
pm_relax(&pvdev->vdev->dev);
atomic_set(&pvdev->stream_cnt, 0);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
开发者ID:TheNameIsNigel,项目名称:android_kernel_carbon_msm8928,代码行数:59,代码来源:camera.c
示例7: gpio_keys_gpio_work_func
static void gpio_keys_gpio_work_func(struct work_struct *work)
{
struct gpio_button_data *bdata =
container_of(work, struct gpio_button_data, work.work);
gpio_keys_gpio_report_event(bdata);
if (bdata->button->wakeup)
pm_relax(bdata->input->dev.parent);
}
开发者ID:Flipkart,项目名称:linux,代码行数:10,代码来源:gpio_keys.c
示例8: mv_otg_disable
static void mv_otg_disable(struct mv_otg *mvotg)
{
if (mvotg->clock_gating)
mv_otg_disable_internal(mvotg);
pm_qos_update_request(&mvotg->qos_idle,
PM_QOS_CPUIDLE_BLOCK_DEFAULT_VALUE);
pm_relax(&mvotg->pdev->dev);
}
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:10,代码来源:phy-mv-usb.c
示例9: camera_v4l2_close
static int camera_v4l2_close(struct file *filep)
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
struct camera_v4l2_private *sp = fh_to_private(filep->private_data);
unsigned int opn_idx, mask;
BUG_ON(!pvdev);
opn_idx = atomic_read(&pvdev->opened);
pr_debug("%s: close stream_id=%d\n", __func__, sp->stream_id);
mask = (1 << sp->stream_id);
opn_idx &= ~mask;
atomic_set(&pvdev->opened, opn_idx);
if (atomic_read(&pvdev->opened) == 0) {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
camera_pack_event(filep, MSM_CAMERA_DEL_SESSION, 0, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, -1);
msm_delete_command_ack_q(pvdev->vdev->num, 0);
/* This should take care of both normal close
* and application crashes */
msm_destroy_session(pvdev->vdev->num);
/* Enable power collapse latency */
msm_pm_qos_update_request(CAMERA_ENABLE_PC_LATENCY);
pm_relax(&pvdev->vdev->dev);
} else {
camera_pack_event(filep, MSM_CAMERA_SET_PARM,
MSM_CAMERA_PRIV_DEL_STREAM, -1, &event);
/* Donot wait, imaging server may have crashed */
msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
msm_delete_command_ack_q(pvdev->vdev->num,
sp->stream_id);
msm_delete_stream(pvdev->vdev->num, sp->stream_id);
}
camera_v4l2_vb2_q_release(filep);
camera_v4l2_fh_release(filep);
return rc;
}
开发者ID:LEPT-Development,项目名称:Android_kernel_lge_C50,代码行数:54,代码来源:camera.c
示例10: qpnp_iadc_vadc_sync_read
int32_t qpnp_iadc_vadc_sync_read(
enum qpnp_iadc_channels i_channel, struct qpnp_iadc_result *i_result,
enum qpnp_vadc_channels v_channel, struct qpnp_vadc_result *v_result)
{
struct qpnp_iadc_drv *iadc = qpnp_iadc;
int rc = 0;
if (!iadc || !iadc->iadc_initialized)
return -EPROBE_DEFER;
mutex_lock(&iadc->iadc_vadc_lock);
if (iadc->iadc_poll_eoc) {
pr_debug("acquiring iadc eoc wakelock\n");
pm_stay_awake(iadc->dev);
}
rc = qpnp_check_pmic_temp();
if (rc) {
pr_err("PMIC die temp check failed\n");
goto fail;
}
iadc->iadc_mode_sel = true;
rc = qpnp_vadc_iadc_sync_request(v_channel);
if (rc) {
pr_err("Configuring VADC failed\n");
goto fail;
}
rc = qpnp_iadc_read(i_channel, i_result);
if (rc)
pr_err("Configuring IADC failed\n");
/* Intentional fall through to release VADC */
rc = qpnp_vadc_iadc_sync_complete_request(v_channel,
v_result);
if (rc)
pr_err("Releasing VADC failed\n");
fail:
iadc->iadc_mode_sel = false;
if (iadc->iadc_poll_eoc) {
pr_debug("releasing iadc eoc wakelock\n");
pm_relax(iadc->dev);
}
mutex_unlock(&iadc->iadc_vadc_lock);
return rc;
}
开发者ID:GAXUSXX,项目名称:GaXusKernel,代码行数:52,代码来源:qpnp-adc-current.c
示例11: smb349_pm_relax
static void smb349_pm_relax(struct smb349_dual_charger *chip, int reason)
{
int reasons;
mutex_lock(&chip->pm_lock);
reasons = chip->wake_reasons & (~reason);
if (reasons == 0 && chip->wake_reasons != 0) {
dev_dbg(chip->dev, "relaxing: 0x%02x (bit %d)\n",
reasons, reason);
pm_relax(chip->dev);
}
chip->wake_reasons = reasons;
mutex_unlock(&chip->pm_lock);
}
开发者ID:Menpiko,项目名称:SnaPKernel-N6P,代码行数:14,代码来源:smb349-dual-charger.c
示例12: wake_timer_irq
static irqreturn_t wake_timer_irq(int irq, void *dev_id)
{
struct wake_timer *tm = dev_id;
int stat = 0;
if(irq == tm->irq[0]) {
/*clear interrupt*/
readl(tm->mmio + EOI);
pm_wakeup_event(&tm->pdev->dev, 0);
pm_relax(&tm->pdev->dev);
#ifdef CONFIG_PM_WAKEUP_DEVICE_AUTO_TEST_SUSPEND
input_report_key(tm->input_dev, KEY_POWER, 1);
input_sync(tm->input_dev);
input_report_key(tm->input_dev, KEY_POWER, 0);
input_sync(tm->input_dev);
#endif
#ifdef MANU_UNLOCK
wake_lock(&tm->wake_lock);
#else
wake_lock_timeout(&tm->wake_lock, tm->wake_ms/1000*HZ);
#endif
} else if(irq == tm->irq[1]) {
/*clear interrupt*/
readl(tm->mmio + EOI + OFFSET);
if(tm->stat == STAT_ON) {
stat = pm_runtime_put(&tm->pdev->dev);
} else {
stat = pm_runtime_get(&tm->pdev->dev);
}
if(stat)
dev_err(&tm->pdev->dev, "pm runtime ret %d", stat);
#ifdef MANU_UNLOCK
wake_unlock(&tm->wake_lock);
#endif
}
/*dev_info(&tm->pdev->dev, "irq %d", irq);*/
return IRQ_HANDLED;
}
开发者ID:alessandroste,项目名称:testBSP,代码行数:42,代码来源:wake_timer.c
示例13: wcd9xxx_spmi_unlock_sleep
void wcd9xxx_spmi_unlock_sleep()
{
mutex_lock(&map.pm_lock);
if (--map.wlock_holders == 0) {
pr_debug("%s: releasing wake lock pm_state %d -> %d\n",
__func__, map.pm_state, WCD9XXX_PM_SLEEPABLE);
/*
* if wcd9xxx_spmi_lock_sleep failed, pm_state would be still
* WCD9XXX_PM_ASLEEP, don't overwrite
*/
if (likely(map.pm_state == WCD9XXX_PM_AWAKE))
map.pm_state = WCD9XXX_PM_SLEEPABLE;
pm_qos_update_request(&map.pm_qos_req,
PM_QOS_DEFAULT_VALUE);
pm_relax(&map.spmi[0]->dev);
}
mutex_unlock(&map.pm_lock);
pr_debug("%s: wake lock counter %d\n", __func__,
map.wlock_holders);
pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
wake_up_all(&map.pm_wq);
}
开发者ID:jumoog,项目名称:R5-5.1-kernel-source,代码行数:22,代码来源:msm8916-wcd-irq.c
示例14: imx_imx_snvs_check_for_events
static void imx_imx_snvs_check_for_events(struct timer_list *t)
{
struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
struct input_dev *input = pdata->input;
u32 state;
regmap_read(pdata->snvs, SNVS_HPSR_REG, &state);
state = state & SNVS_HPSR_BTN ? 1 : 0;
/* only report new event if status changed */
if (state ^ pdata->keystate) {
pdata->keystate = state;
input_event(input, EV_KEY, pdata->keycode, state);
input_sync(input);
pm_relax(pdata->input->dev.parent);
}
/* repeat check if pressed long */
if (state) {
mod_timer(&pdata->check_timer,
jiffies + msecs_to_jiffies(REPEAT_INTERVAL));
}
}
开发者ID:lfd,项目名称:PreemptRT,代码行数:23,代码来源:snvs_pwrkey.c
示例15: bu21150_ioctl_set_scan_mode
static long bu21150_ioctl_set_scan_mode(unsigned long arg)
{
struct bu21150_data *ts = spi_get_drvdata(g_client_bu21150);
void __user *argp = (void __user *)arg;
if (copy_from_user(&ts->scan_mode, argp,
sizeof(u16))) {
pr_err("%s: Failed to copy_from_user().\n", __func__);
return -EFAULT;
}
mutex_lock(&ts->mutex_wake);
if (ts->stay_awake && ts->wake_up &&
ts->scan_mode != AFE_SCAN_GESTURE_SELF_CAP) {
pm_relax(&ts->client->dev);
ts->stay_awake = false;
}
mutex_unlock(&ts->mutex_wake);
return 0;
}
开发者ID:silversderek,项目名称:msm8909_kernel_lenovo,代码行数:23,代码来源:bu21150.c
示例16: qpnp_iadc_vadc_sync_read
int32_t qpnp_iadc_vadc_sync_read(struct qpnp_iadc_chip *iadc,
enum qpnp_iadc_channels i_channel, struct qpnp_iadc_result *i_result,
enum qpnp_vadc_channels v_channel, struct qpnp_vadc_result *v_result)
{
int rc = 0, mode_sel = 0, num = 0, rsense_n_ohms = 0, sign = 0;
uint16_t raw_data;
int32_t rsense_u_ohms = 0;
int64_t result_current;
if (qpnp_iadc_is_valid(iadc) < 0)
return -EPROBE_DEFER;
mutex_lock(&iadc->adc->adc_lock);
if (iadc->iadc_poll_eoc) {
pr_debug("acquiring iadc eoc wakelock\n");
pm_stay_awake(iadc->dev);
}
iadc->iadc_mode_sel = true;
rc = qpnp_vadc_iadc_sync_request(iadc->vadc_dev, v_channel);
if (rc) {
pr_err("Configuring VADC failed\n");
goto fail;
}
rc = qpnp_iadc_configure(iadc, i_channel, &raw_data, mode_sel);
if (rc < 0) {
pr_err("qpnp adc result read failed with %d\n", rc);
goto fail_release_vadc;
}
rc = qpnp_iadc_get_rsense(iadc, &rsense_n_ohms);
pr_debug("current raw:0%x and rsense:%d\n",
raw_data, rsense_n_ohms);
rsense_u_ohms = rsense_n_ohms/1000;
num = raw_data - iadc->adc->calib.offset_raw;
if (num < 0) {
sign = 1;
num = -num;
}
i_result->result_uv = (num * QPNP_ADC_GAIN_NV)/
(iadc->adc->calib.gain_raw - iadc->adc->calib.offset_raw);
result_current = i_result->result_uv;
result_current *= QPNP_IADC_NANO_VOLTS_FACTOR;
/* Intentional fall through. Process the result w/o comp */
do_div(result_current, rsense_u_ohms);
if (sign) {
i_result->result_uv = -i_result->result_uv;
result_current = -result_current;
}
result_current *= -1;
rc = qpnp_iadc_comp_result(iadc, &result_current);
if (rc < 0)
pr_err("Error during compensating the IADC\n");
rc = 0;
result_current *= -1;
i_result->result_ua = (int32_t) result_current;
fail_release_vadc:
rc = qpnp_vadc_iadc_sync_complete_request(iadc->vadc_dev, v_channel,
v_result);
if (rc)
pr_err("Releasing VADC failed\n");
fail:
iadc->iadc_mode_sel = false;
if (iadc->iadc_poll_eoc) {
pr_debug("releasing iadc eoc wakelock\n");
pm_relax(iadc->dev);
}
mutex_unlock(&iadc->adc->adc_lock);
return rc;
}
开发者ID:AndroPlus-org,项目名称:sony_sources-H2_2014,代码行数:79,代码来源:qpnp-adc-current.c
示例17: qpnp_iadc_read
int32_t qpnp_iadc_read(struct qpnp_iadc_chip *iadc,
enum qpnp_iadc_channels channel,
struct qpnp_iadc_result *result)
{
int32_t rc, rsense_n_ohms, sign = 0, num, mode_sel = 0;
int32_t rsense_u_ohms = 0;
int64_t result_current;
uint16_t raw_data;
if (qpnp_iadc_is_valid(iadc) < 0)
return -EPROBE_DEFER;
if ((iadc->adc->calib.gain_raw - iadc->adc->calib.offset_raw) == 0) {
pr_err("raw offset errors! run iadc calibration again\n");
return -EINVAL;
}
rc = qpnp_check_pmic_temp(iadc);
if (rc) {
pr_err("Error checking pmic therm temp\n");
return rc;
}
mutex_lock(&iadc->adc->adc_lock);
if (iadc->iadc_poll_eoc) {
pr_debug("acquiring iadc eoc wakelock\n");
pm_stay_awake(iadc->dev);
}
rc = qpnp_iadc_configure(iadc, channel, &raw_data, mode_sel);
if (rc < 0) {
pr_err("qpnp adc result read failed with %d\n", rc);
goto fail;
}
rc = qpnp_iadc_get_rsense(iadc, &rsense_n_ohms);
pr_debug("current raw:0%x and rsense:%d\n",
raw_data, rsense_n_ohms);
rsense_u_ohms = rsense_n_ohms/1000;
num = raw_data - iadc->adc->calib.offset_raw;
if (num < 0) {
sign = 1;
num = -num;
}
result->result_uv = (num * QPNP_ADC_GAIN_NV)/
(iadc->adc->calib.gain_raw - iadc->adc->calib.offset_raw);
result_current = result->result_uv;
result_current *= QPNP_IADC_NANO_VOLTS_FACTOR;
/* Intentional fall through. Process the result w/o comp */
do_div(result_current, rsense_u_ohms);
if (sign) {
result->result_uv = -result->result_uv;
result_current = -result_current;
}
result_current *= -1;
rc = qpnp_iadc_comp_result(iadc, &result_current);
if (rc < 0)
pr_err("Error during compensating the IADC\n");
rc = 0;
result_current *= -1;
result->result_ua = (int32_t) result_current;
fail:
if (iadc->iadc_poll_eoc) {
pr_debug("releasing iadc eoc wakelock\n");
pm_relax(iadc->dev);
}
mutex_unlock(&iadc->adc->adc_lock);
return rc;
}
开发者ID:AndroPlus-org,项目名称:sony_sources-H2_2014,代码行数:74,代码来源:qpnp-adc-current.c
示例18: imx_keypad_check_for_events
/*
* imx_keypad_check_for_events is the timer handler.
*/
static void imx_keypad_check_for_events(unsigned long data)
{
struct imx_keypad *keypad = (struct imx_keypad *) data;
unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS];
unsigned short reg_val;
bool state_changed, is_zero_matrix;
int i;
memset(matrix_volatile_state, 0, sizeof(matrix_volatile_state));
imx_keypad_scan_matrix(keypad, matrix_volatile_state);
state_changed = false;
for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
if ((keypad->cols_en_mask & (1 << i)) == 0)
continue;
if (keypad->matrix_unstable_state[i] ^ matrix_volatile_state[i]) {
state_changed = true;
break;
}
}
/*
* If the matrix state is changed from the previous scan
* (Re)Begin the debouncing process, saving the new state in
* keypad->matrix_unstable_state.
* else
* Increase the count of number of scans with a stable state.
*/
if (state_changed) {
memcpy(keypad->matrix_unstable_state, matrix_volatile_state,
sizeof(matrix_volatile_state));
keypad->stable_count = 0;
} else
keypad->stable_count++;
/*
* If the matrix is not as stable as we want reschedule scan
* in the near future.
*/
if (keypad->stable_count < IMX_KEYPAD_SCANS_FOR_STABILITY) {
mod_timer(&keypad->check_matrix_timer,
jiffies + msecs_to_jiffies(10));
return;
}
/*
* If the matrix state is stable, fire the events and save the new
* stable state. Note, if the matrix is kept stable for longer
* (keypad->stable_count > IMX_KEYPAD_SCANS_FOR_STABILITY) all
* events have already been generated.
*/
if (keypad->stable_count == IMX_KEYPAD_SCANS_FOR_STABILITY) {
imx_keypad_fire_events(keypad, matrix_volatile_state);
memcpy(keypad->matrix_stable_state, matrix_volatile_state,
sizeof(matrix_volatile_state));
}
is_zero_matrix = true;
for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
if (matrix_volatile_state[i] != 0) {
is_zero_matrix = false;
break;
}
}
if (is_zero_matrix) {
/*
* All keys have been released. Enable only the KDI
* interrupt for future key presses (clear the KDI
* status bit and its sync chain before that).
*/
reg_val = readw(keypad->mmio_base + KPSR);
reg_val |= KBD_STAT_KPKD | KBD_STAT_KDSC;
writew(reg_val, keypad->mmio_base + KPSR);
reg_val = readw(keypad->mmio_base + KPSR);
reg_val |= KBD_STAT_KDIE;
reg_val &= ~KBD_STAT_KRIE;
writew(reg_val, keypad->mmio_base + KPSR);
pm_relax(keypad->input_dev->dev.parent);
} else {
/*
* Some keys are still pressed. Schedule a rescan in
* attempt to detect multiple key presses and enable
* the KRI interrupt to react quickly to key release
* event.
*/
mod_timer(&keypad->check_matrix_timer,
jiffies + msecs_to_jiffies(60));
reg_val = readw(keypad->mmio_base + KPSR);
reg_val |= KBD_STAT_KPKR | KBD_STAT_KRSS;
writew(reg_val, keypad->mmio_base + KPSR);
//.........这里部分代码省略.........
开发者ID:Trimblejena,项目名称:HurricaneBSP-linux-fslc-imx-3.14-1.1.x,代码行数:101,代码来源:imx_keypad.c
示例19: camera_v4l2_open
static int camera_v4l2_open(struct file *filep)
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
BUG_ON(!pvdev);
rc = camera_v4l2_fh_open(filep);
if (rc < 0) {
pr_err("%s : camera_v4l2_fh_open failed Line %d rc %d\n",
__func__, __LINE__, rc);
goto fh_open_fail;
}
/* every stream has a vb2 queue */
rc = camera_v4l2_vb2_q_init(filep);
if (rc < 0) {
pr_err("%s : vb2 queue init fails Line %d rc %d\n",
__func__, __LINE__, rc);
goto vb2_q_fail;
}
if (!atomic_read(&pvdev->opened)) {
pm_stay_awake(&pvdev->vdev->dev);
/* create a new session when first opened */
rc = msm_create_session(pvdev->vdev->num, pvdev->vdev);
if (rc < 0) {
pr_err("%s : session creation failed Line %d rc %d\n",
__func__, __LINE__, rc);
goto session_fail;
}
rc = msm_create_command_ack_q(pvdev->vdev->num, 0);
if (rc < 0) {
pr_err("%s : creation of command_ack queue failed\n",
__func__);
pr_err("%s : Line %d rc %d\n", __func__, __LINE__, rc);
goto command_ack_q_fail;
}
camera_pack_event(filep, MSM_CAMERA_NEW_SESSION, 0, -1, &event);
rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if (rc < 0) {
pr_err("%s : posting of NEW_SESSION event failed\n",
__func__);
pr_err("%s : Line %d rc %d\n", __func__, __LINE__, rc);
goto post_fail;
}
rc = camera_check_event_status(&event);
if (rc < 0) {
pr_err("%s : checking event status fails Line %d rc %d\n",
__func__, __LINE__, rc);
goto post_fail;
}
} else {
rc = msm_create_command_ack_q(pvdev->vdev->num,
atomic_read(&pvdev->stream_cnt));
if (rc < 0) {
pr_err("%s : creation of command_ack queue failed Line %d rc %d\n",
__func__, __LINE__, rc);
goto session_fail;
}
}
atomic_add(1, &pvdev->opened);
atomic_add(1, &pvdev->stream_cnt);
return rc;
post_fail:
msm_delete_command_ack_q(pvdev->vdev->num, 0);
command_ack_q_fail:
msm_destroy_session(pvdev->vdev->num);
session_fail:
pm_relax(&pvdev->vdev->dev);
camera_v4l2_vb2_q_release(filep);
vb2_q_fail:
camera_v4l2_fh_release(filep);
fh_open_fail:
return rc;
}
开发者ID:TheNameIsNigel,项目名称:android_kernel_carbon_msm8928,代码行数:80,代码来源:camera.c
示例20: qpnp_iadc_calibrate_for_trim
//.........这里部分代码省略.........
return -EPROBE_DEFER;
mutex_lock(&iadc->adc->adc_lock);
if (iadc->iadc_poll_eoc) {
pr_debug("acquiring iadc eoc wakelock\n");
pm_stay_awake(iadc->dev);
}
/* Exported symbol may be called from outside this driver.
* Ensure this driver is ready (probed) before supporting
* calibration.
*/
rc = qpnp_iadc_is_ready();
if (rc < 0)
goto fail;
rc = qpnp_iadc_configure(GAIN_CALIBRATION_17P857MV,
&raw_data, mode_sel);
if (rc < 0) {
pr_err("qpnp adc result read failed with %d\n", rc);
goto fail;
}
iadc->adc->calib.gain_raw = raw_data;
if (iadc->external_rsense) {
/* external offset calculation */
rc = qpnp_iadc_configure(OFFSET_CALIBRATION_CSP_CSN,
&raw_data, mode_sel);
if (rc < 0) {
pr_err("qpnp adc result read failed with %d\n", rc);
goto fail;
}
} else {
/* internal offset calculation */
rc = qpnp_iadc_configure(OFFSET_CALIBRATION_CSP2_CSN2,
&raw_data, mode_sel);
if (rc < 0) {
pr_err("qpnp adc result read failed with %d\n", rc);
goto fail;
}
}
iadc->adc->calib.offset_raw = raw_data;
if (rc < 0) {
pr_err("qpnp adc offset/gain calculation failed\n");
goto fail;
}
pr_debug("raw gain:0x%x, raw offset:0x%x\n",
iadc->adc->calib.gain_raw, iadc->adc->calib.offset_raw);
rc = qpnp_convert_raw_offset_voltage();
if (rc < 0) {
pr_err("qpnp raw_voltage conversion failed\n");
goto fail;
}
rslt_msb = (raw_data & QPNP_RAW_CODE_16_BIT_MSB_MASK) >>
QPNP_BIT_SHIFT_8;
rslt_lsb = raw_data & QPNP_RAW_CODE_16_BIT_LSB_MASK;
pr_debug("trim values:lsb:0x%x and msb:0x%x\n", rslt_lsb, rslt_msb);
rc = qpnp_iadc_write_reg(QPNP_IADC_SEC_ACCESS,
QPNP_IADC_SEC_ACCESS_DATA);
if (rc < 0) {
pr_err("qpnp iadc configure error for sec access\n");
goto fail;
}
rc = qpnp_iadc_write_reg(QPNP_IADC_MSB_OFFSET,
rslt_msb);
if (rc < 0) {
pr_err("qpnp iadc configure error for MSB write\n");
goto fail;
}
rc = qpnp_iadc_write_reg(QPNP_IADC_SEC_ACCESS,
QPNP_IADC_SEC_ACCESS_DATA);
if (rc < 0) {
pr_err("qpnp iadc configure error for sec access\n");
goto fail;
}
rc = qpnp_iadc_write_reg(QPNP_IADC_LSB_OFFSET,
rslt_lsb);
if (rc < 0) {
pr_err("qpnp iadc configure error for LSB write\n");
goto fail;
}
fail:
if (iadc->iadc_poll_eoc) {
pr_debug("releasing iadc eoc wakelock\n");
pm_relax(iadc->dev);
}
mutex_unlock(&iadc->adc->adc_lock);
return rc;
}
开发者ID:YuechengLi,项目名称:Kernel-Honami-14.1.N.0.52,代码行数:101,代码来源:qpnp-adc-current.c
注:本文中的pm_relax函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论