Beispiel #1
1
static int capella_cm3602_disable(struct capella_cm3602_data *data)
{
	int rc = -EIO;
	int irq = data->pdata->irq;

	IPS("%s\n", __func__);
	if (!data->enabled) {
		DPS("%s: already disabled\n", __func__);
	return 0;
}
	disable_irq(irq);
	rc = irq_set_irq_wake(irq, 0);
	if (rc < 0)
		EPS("%s: failed to set irq %d as a non-wake interrupt\n",
			__func__, irq);

	rc = gpio_direction_output(data->pdata->p_en, 1);

	if (rc < 0)
		return rc;
	data->pdata->power(PS_PWR_ON, 0);
	data->enabled = 0;

	input_event(data->input_dev, EV_SYN, SYN_CONFIG, 0);
	return rc;
}
Beispiel #2
0
static int __devinit msm_gpio_probe(struct platform_device *dev)
{
	int i, j = 0;
	int grp_irq;

	for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
		if (i - FIRST_GPIO_IRQ >=
			msm_gpio_chips[j].chip.base +
			msm_gpio_chips[j].chip.ngpio)
			j++;
		irq_set_chip_data(i, &msm_gpio_chips[j]);
		irq_set_chip_and_handler(i, &msm_gpio_irq_chip,
					 handle_edge_irq);
		set_irq_flags(i, IRQF_VALID);
	}

	for (i = 0; i < dev->num_resources; i++) {
		grp_irq = platform_get_irq(dev, i);
		if (grp_irq < 0)
			return -ENXIO;

		irq_set_chained_handler(grp_irq, msm_gpio_irq_handler);
		irq_set_irq_wake(grp_irq, (i + 1));
	}

	for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
		spin_lock_init(&msm_gpio_chips[i].lock);
		__raw_writel(0, msm_gpio_chips[i].regs.int_en);
		gpiochip_add(&msm_gpio_chips[i].chip);
	}

	mb();
	return 0;
}
Beispiel #3
0
static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
{
	int rc = 0;
	struct platform_device *pdev;
	static int first_setup = 1;

	pdev = container_of(dv, struct platform_device, dev);

	rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
	if (rc)
		goto out;

	rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);

	/* if first called related to sdcc1,
	 *  irq should be registered as wakeup source
	 * [email protected], 2010-02-19
	 */
	if (vdd && first_setup) {
		struct mmc_platform_data *pdata = pdev->dev.platform_data;
		if (pdev->id == 1) {
			first_setup = 0;
			irq_set_irq_wake(pdata->status_irq, 1);
		}
	}
out:
	return rc;
}
static int bcm_bt_lpm_init(struct platform_device *pdev)
{
	int irq;
	int ret;

	hrtimer_init(&bt_lpm.enter_lpm_timer, CLOCK_MONOTONIC,
			HRTIMER_MODE_REL);
	bt_lpm.enter_lpm_delay = ktime_set(1, 0);  /* 1 sec */
	bt_lpm.enter_lpm_timer.function = enter_lpm;

	bt_lpm.host_wake = 0;
	bt_is_running = 0;

	irq = IRQ_BT_HOST_WAKE;
	ret = request_irq(irq, host_wake_isr, IRQF_TRIGGER_HIGH,
		"bt host_wake", NULL);
	if (ret) {
		pr_err("[BT] Request_host wake irq failed.\n");
		return ret;
	}

	ret = irq_set_irq_wake(irq, 1);
	if (ret) {
		pr_err("[BT] Set_irq_wake failed.\n");
		return ret;
	}

	snprintf(bt_lpm.wake_lock_name, sizeof(bt_lpm.wake_lock_name),
			"BTLowPower");
	wake_lock_init(&bt_lpm.wake_lock, WAKE_LOCK_SUSPEND,
			 bt_lpm.wake_lock_name);
	return 0;
}
Beispiel #5
0
static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
{
	struct s3c_sdhci_platdata *pdata = sc->pdata;
	struct device *dev = &sc->pdev->dev;

	if (sc->ext_cd_gpio > 0) {
		sc->ext_cd_irq = gpio_to_irq(pdata->ext_cd_gpio);
		if (sc->ext_cd_irq &&
		    request_threaded_irq(sc->ext_cd_irq, NULL,
					 sdhci_s3c_gpio_card_detect_thread,
					 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
					 dev_name(dev), sc) == 0) {
			int status = gpio_get_value(sc->ext_cd_gpio);
			if (pdata->ext_cd_gpio_invert)
				status = !status;

			if (status)
				mmc_host_sd_set_present(sc->host->mmc);
			else
				mmc_host_sd_clear_present(sc->host->mmc);

			/* T-Flash EINT for CD SHOULD be wakeup source */
			irq_set_irq_wake(sc->ext_cd_irq, 1);

			sdhci_s3c_notify_change(sc->pdev, status);
		} else {
			dev_warn(dev, "cannot request irq for card detect\n");
			sc->ext_cd_irq = 0;
		}
	}
}
Beispiel #6
0
static int bcm_bt_lpm_probe(struct platform_device *pdev)
{
	int irq;
	int ret;
	struct bcm_bt_lpm_platform_data *pdata = pdev->dev.platform_data;

	if (bt_lpm.request_clock_off_locked != NULL) {
		printk(KERN_ERR "Cannot register two bcm_bt_lpm drivers\n");
		return -EINVAL;
	}

	bt_lpm.gpio_wake = pdata->gpio_wake;
	bt_lpm.gpio_host_wake = pdata->gpio_host_wake;
	bt_lpm.request_clock_off_locked = pdata->request_clock_off_locked;
	bt_lpm.request_clock_on_locked = pdata->request_clock_on_locked;

	hrtimer_init(&bt_lpm.enter_lpm_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	bt_lpm.enter_lpm_delay = ktime_set(1, 0);  /* 1 sec */
	bt_lpm.enter_lpm_timer.function = enter_lpm;

	gpio_set_value(bt_lpm.gpio_wake, 0);
	bt_lpm.host_wake = 0;

	irq = gpio_to_irq(bt_lpm.gpio_host_wake);
	ret = request_irq(irq, host_wake_isr, IRQF_TRIGGER_HIGH,
			"bt host_wake", NULL);
	if (ret)
		return ret;
	ret = irq_set_irq_wake(irq, 1);
	if (ret)
		return ret;

	return 0;
}
Beispiel #7
0
static int capella_cm3602_enable(struct capella_cm3602_data *data)
{
	int rc;
	int irq = data->pdata->irq;

	IPS("%s\n", __func__);
	if (data->enabled) {
		DPS("%s: already enabled\n", __func__);
	return 0;
}

	/* dummy report */
	input_report_abs(data->input_dev, ABS_DISTANCE, -1);
	input_sync(data->input_dev);

	data->pdata->power(PS_PWR_ON, 1);

	rc = gpio_direction_output(data->pdata->p_en, 0);

	msleep(220);

	data->enabled = !rc;
	if (!rc)
		capella_cm3602_report(data);

	enable_irq(irq);
	rc = irq_set_irq_wake(irq, 1);
	if (rc < 0)
		EPS("%s: failed to set irq %d as a wake interrupt\n",
			__func__, irq);

	return rc;
}
Beispiel #8
0
static int felica_rfs_init(void)
{
    int rc;

#ifdef FEATURE_DEBUG_LOW
    FELICA_DEBUG_MSG("[FELICA_RFS] felica_rfs_init - start \n");
#endif

    /* register the device file */
    rc = misc_register(&felica_rfs_device);
    if (rc < 0)
    {
        FELICA_DEBUG_MSG("[FELICA_RFS] FAIL!! can not register felica_rfs \n");
        return rc;
    }
#ifdef FELICA_LED_SUPPORT
    FELICA_DEBUG_MSG("[FELICA_RFS] FELICA LED NEW SUPPORT !!\n");
    rc= request_irq(gpio_to_irq(GPIO_FELICA_RFS), felica_rfs_detect_interrupt, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING|IRQF_NO_SUSPEND , FELICA_RFS_NAME, NULL);
    if (rc)
    {
        FELICA_DEBUG_MSG("[FELICA_RFS] FAIL!! can not request_irq \n");
        return rc;
    }
    irq_set_irq_wake(gpio_to_irq(GPIO_FELICA_RFS),1);

    init_felica_rfs_wake_lock();
#else
    FELICA_DEBUG_MSG("[FELICA_RFS] FELICA LED NOT SUPPORT !! \n");
#endif
#ifdef FEATURE_DEBUG_LOW
    FELICA_DEBUG_MSG("[FELICA_RFS] felica_rfs_init - end \n");
#endif

    return 0;
}
Beispiel #9
0
static void msm_shutdown(struct uart_port *port)
{
	struct msm_port *msm_port = UART_TO_MSM(port);

	if (msm_port->uim)
		msm_write(port,
			UART_SIM_CFG_SIM_CLK_STOP_HIGH,
			UART_SIM_CFG);

	msm_port->imr = 0;
	msm_write(port, 0, UART_IMR); /* disable interrupts */

	free_irq(port->irq, port);

#ifdef CONFIG_SERIAL_MSM_RX_WAKEUP
	if (use_low_power_wakeup(msm_port)) {
		irq_set_irq_wake(msm_port->wakeup.irq, 0);
		free_irq(msm_port->wakeup.irq, msm_port);
	}
#endif
#ifndef CONFIG_PM_RUNTIME
	msm_deinit_clock(port);
#endif
	pm_runtime_put_sync(port->dev);
}
static __always_inline void max14688_disable_irq (struct max14688 *me,
    u8 irq_bits)
{
    int rc;

    if (unlikely(me->irq < 0)) {
	    return;
    }

    if (unlikely((me->irq_unmask & irq_bits) == 0)) {
	    /* already masked */
	    return;
    }

    /* clear enabled flag */
    me->irq_unmask &= ~irq_bits;

    if (unlikely(!me->irq_unmask)) {
        if (likely(device_may_wakeup(me->dev))) {
            disable_irq_wake(me->irq);
        }
        disable_irq(me->irq);
        irq_set_irq_wake(me->irq, 0);
    }

    rc = max14688_write(me, MASK, me->irq_unmask & IRQ_ALL);
    if (unlikely(rc)) {
	    log_err("MASK write error [%d]n", rc);
    }
}
static int __init msm_mpm_init(void)
{
	unsigned int irq = msm_mpm_dev_data.mpm_ipc_irq;
	int rc;

	rc = request_irq(irq, msm_mpm_irq,
			IRQF_TRIGGER_RISING, "mpm_drv", msm_mpm_irq);

	if (rc) {
		pr_err("%s: failed to request irq %u: %d\n",
			__func__, irq, rc);
		goto init_bail;
	}

	rc = irq_set_irq_wake(irq, 1);
	if (rc) {
		pr_err("%s: failed to set wakeup irq %u: %d\n",
			__func__, irq, rc);
		goto init_free_bail;
	}

	return 0;

init_free_bail:
	free_irq(irq, msm_mpm_irq);

init_bail:
	return rc;
}
Beispiel #12
0
static void remove_headset(void)
{
#ifdef FEATURE_AUD_HOOK_BTN	
	unsigned long irq_flags;
#endif

    H2W_DBG("");
    hi->ignore_btn = 1;  /* FIH-SW2-MM-AY-TAP_Tapioca-00746_00 */
    pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_OFF); /* FIH-SW2-MM-AY-TAP-ControlHSED_BIAS1-01 */
	switch_set_state(&hi->sdev, NO_DEVICE);
		
  	input_sync(hi->hs_input);
#ifdef FEATURE_AUD_HOOK_BTN

	mHeadphone = false;

	if (bn_irq_enable) {
		
		local_irq_save(irq_flags);
		
		disable_irq(hi->irq_btn);

		local_irq_restore(irq_flags);
		
		bn_irq_enable=0;

		irq_set_irq_wake(hi->irq_btn, 0);
	}
	
	if (atomic_read(&hi->btn_state))
		button_released();
#endif
}
static int felica_rws_init(void)
{
  int rc = 0;

  #ifdef FEATURE_DEBUG_LOW
  FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_init - start \n");
  #endif

  /* register the device file */
  rc = misc_register(&felica_rws_device);
  if (rc)
  {
    FELICA_DEBUG_MSG("[FELICA_RWS] FAIL!! can not register felica_int \n");
    return rc;
  }

  rc= request_irq(gpio_to_irq(GPIO_FELICA_INT), felica_int_low_isr, IRQF_TRIGGER_FALLING|IRQF_NO_SUSPEND, FELICA_RWS_NAME, NULL);

  if (rc)
  {
    FELICA_DEBUG_MSG("[FELICA_RWS] FAIL!! can not request_irq \n");
    return rc;
  }

  irq_set_irq_wake(gpio_to_irq(GPIO_FELICA_INT),1);

  #ifdef FEATURE_DEBUG_LOW
  FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_init - end \n");
  #endif

  return 0;
}
static void remove_headset(void)
{
	unsigned long irq_flags;

	pr_info("remove_headset\n");

	gpio_set_value(MSM_GPIO_EAR_MICBIAS_EN, 0);

	mutex_lock(&hi->mutex_lock);
	switch_set_state(&hi->sdev, switch_get_state(&hi->sdev)
	& ~(BIT_HEADSET | BIT_HEADSET_NO_MIC));
	mutex_unlock(&hi->mutex_lock);

	if (hi->btn_11pin_35mm_flag) {
		irq_set_irq_wake(hi->irq_btn, 0);
		local_irq_save(irq_flags);
		disable_irq(hi->irq_btn);
		local_irq_restore(irq_flags);
		hi->btn_11pin_35mm_flag = 0;
		if (atomic_read(&hi->btn_state))
			headset_button_event(0);
	}
	hi->debounce_time = ktime_set(0, 200000000);  /* 100 ms */
	hrtimer_cancel(&hi->btn_timer);
	hrtimer_cancel(&hi->irq_delay_timer);
	hi->btn_irq_available = 0;
#ifdef CONFIG_MACH_RAY
	if (sec_jack_pm_qos) {
		pm_qos_update_request(&jack_qos_req, PM_QOS_DEFAULT_VALUE);
		sec_jack_pm_qos = 0;
	}
#endif
}
Beispiel #15
0
/**********************************************************
**  Function: Jack detection-in gpio configuration function
**  Parameter: none
**  Return value: if sucess, then returns 0
**
************************************************************/
static int jack_config_gpio()
{
	int ret;

	printk("HEADSET: Config Jack-in detection gpio\n");
	hs_micbias_power(ON);
	tegra_gpio_enable(JACK_GPIO);
	ret = gpio_request(JACK_GPIO, "h2w_detect");
	ret = gpio_direction_input(JACK_GPIO);

	hs_data->irq = gpio_to_irq(JACK_GPIO);
	ret = request_irq(hs_data->irq, detect_irq_handler,
			  IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING, "h2w_detect", NULL);

	ret = irq_set_irq_wake(hs_data->irq, 1);
	msleep(1);
	if (gpio_get_value(JACK_GPIO) == 0){
		insert_headset();
	}else {
		hs_micbias_power(OFF);
		headset_alive = false;
		remove_headset();
	}

	return 0;
}
Beispiel #16
0
#ifdef CONFIG_PM

static int apds9130_suspend(struct i2c_client *client, pm_message_t mesg)
{
#if 1
#else
	struct apds9130_data *data = i2c_get_clientdata(client);

	if(data->sw_mode == PROX_STAT_SHUTDOWN)
		return 0;

	apds9130_set_enable(client, 0);
	apds9130_set_command(client, 2);

	__cancel_delayed_work(&data->dwork);
	flush_delayed_work(&data->dwork);
	flush_workqueue(apds9130_workqueue);

	data->sw_mode = PROX_STAT_SHUTDOWN;
	disable_irq(client->irq);
/*	err = pdata->power(0);
	if(err < 0) {
		printk(KERN_INFO "%s, Proximity Power Off Fail in susped\n",__func__);
		return err;
	}
*/
	irq_set_irq_wake(client->irq, 0);
	if(NULL != apds9130_workqueue){
		destroy_workqueue(apds9130_workqueue);
		printk(KERN_INFO "%s, Destroy workqueue\n",__func__);
		apds9130_workqueue = NULL;
	}
#endif
Beispiel #17
0
static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
{
	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
	struct gpio_rcar_priv *p = gpiochip_get_data(gc);
	int error;

	if (p->irq_parent) {
		error = irq_set_irq_wake(p->irq_parent, on);
		if (error) {
			dev_dbg(&p->pdev->dev,
				"irq %u doesn't support irq_set_wake\n",
				p->irq_parent);
			p->irq_parent = 0;
		}
	}

	if (!p->clk)
		return 0;

	if (on)
		clk_enable(p->clk);
	else
		clk_disable(p->clk);

	return 0;
}
Beispiel #18
0
static int cw1200_sdio_pm(struct hwbus_priv *self, bool suspend)
{
	int ret = 0;

	if (self->pdata->irq)
		ret = irq_set_irq_wake(self->pdata->irq, suspend);
	return ret;
}
Beispiel #19
0
int arizona_set_irq_wake(struct arizona *arizona, int irq, int on)
{
	int val = 0;

	if (on) {
		val = 0xffff;
		irq_set_irq_wake(arizona->irq, 1);
	} else {
		irq_set_irq_wake(arizona->irq, 0);
	}

	switch (irq) {
	case ARIZONA_IRQ_MICD_CLAMP_RISE:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_MICD_CLAMP_RISE,
					  val & ARIZONA_WKUP_MICD_CLAMP_RISE);
	case ARIZONA_IRQ_MICD_CLAMP_FALL:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_MICD_CLAMP_FALL,
					  val & ARIZONA_WKUP_MICD_CLAMP_FALL);
	case ARIZONA_IRQ_GP5_FALL:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_GP5_RISE,
					  val & ARIZONA_WKUP_GP5_RISE);
	case ARIZONA_IRQ_GP5_RISE:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_GP5_FALL,
					  val & ARIZONA_WKUP_GP5_FALL);
	case ARIZONA_IRQ_JD_RISE:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_JD1_RISE,
					  val & ARIZONA_WKUP_JD1_RISE);
	case ARIZONA_IRQ_JD_FALL:
		return regmap_update_bits(arizona->regmap,
					  ARIZONA_WAKE_CONTROL,
					  val & ARIZONA_WKUP_JD1_FALL,
					  val & ARIZONA_WKUP_JD1_FALL);
	default:
		return -ENXIO;
	}
}
Beispiel #20
0
int arizona_set_irq_wake(struct arizona *arizona, int irq, int on)
{
	irq = arizona_map_irq(arizona, irq);
	if (irq < 0)
		return irq;

	return irq_set_irq_wake(irq, on);
}
static int Remote_Interrupt_Enable(int en) {
	int ret =0;
       struct pm8xxx_mpp_config_data sky_handset_digital_adc = {
       			.type	= PM8XXX_MPP_TYPE_D_INPUT,
				.level	= PM8058_MPP_DIG_LEVEL_S3,
				.control = PM8XXX_MPP_DIN_TO_INT,
	};
	   
	if(en) {
		ret=gpio_get_value_cansleep(hspd->ear_det);	
		if(ret!=hspd->ear_det_active) {
			printk("EARJACK_DET %d\n",ret);
			return -1;
		}
		
		if(hspd->curr_state == MSM_HEADSET  && hspd->remote_is_int==0) {
#if AT1_BDVER_GE(AT1_WS22) 
			ret = pm8xxx_mpp_config(PM8058_MPP_PM_TO_SYS(XOADC_MPP_3), &sky_handset_digital_adc);
			if (ret < 0)
				printk("%s: pm8058_mpp_config_DIG ret=%d\n",__func__, ret);
/*
			ret = pm8058_mpp_config_digital_in(PM8058_MPP_SYS_TO_PM(hspd->remote_det),
							PM8058_MPP_DIG_LEVEL_S3,
							PM_MPP_DIN_TO_INT);
*/
#else
			gpio_tlmm_config(GPIO_CFG(hspd->remote_det, 0, GPIO_CFG_INPUT,GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
#endif
			enable_irq(gpio_to_irq(hspd->remote_det));
			irq_set_irq_wake(gpio_to_irq(hspd->remote_det),1);
			hspd->remote_is_int = 1;
		}
	} else {
		if(hspd->remote_is_int==1) {
			irq_set_irq_wake(gpio_to_irq(hspd->remote_det),0);
			disable_irq(gpio_to_irq(hspd->remote_det));
			hspd->remote_is_int = 0;
#if AT1_BDVER_E(AT1_WS21) 
			gpio_tlmm_config(GPIO_CFG(hspd->remote_det, 0, GPIO_CFG_INPUT,GPIO_CFG_PULL_UP, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
#endif
		}
	}

	return 0;
}
Beispiel #22
0
static long pn544_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
	struct pn544_dev *pn544_dev = filp->private_data;

	switch (cmd) {
	case PN544_SET_PWR:
		if (arg == 2) {
			/* power on with firmware download (requires hw reset)
			 */
			printk("%s power on with firmware\n", __func__);
			gpio_set_value(pn544_dev->ven_gpio, 1);
			gpio_set_value(pn544_dev->firm_gpio, 1);
			msleep(10);
			gpio_set_value(pn544_dev->ven_gpio, 0);
			msleep(50);
			gpio_set_value(pn544_dev->ven_gpio, 1);
			msleep(10);
		} else if (arg == 1) {
			/* power on */
			//pmu_enable();
			printk("%s power on\n", __func__);
			gpio_set_value(pn544_dev->firm_gpio, 0);
			gpio_set_value(pn544_dev->ven_gpio, 1);
			irq_set_irq_wake(pn544_dev->client->irq, 1);
			msleep(10);
		} else  if (arg == 0) {
			/* power off */
			//pmu_disable();
			printk("%s power off\n", __func__);
			gpio_set_value(pn544_dev->firm_gpio, 0);
			gpio_set_value(pn544_dev->ven_gpio, 0);
			irq_set_irq_wake(pn544_dev->client->irq, 0);
			msleep(10);
		} else {
			printk("%s bad arg %lu\n", __func__, arg);
			return -EINVAL;
		}
		break;
	default:
		printk("%s bad ioctl %u\n", __func__, cmd);
		return -EINVAL;
	}

	return 0;
}
Beispiel #23
0
static int max8997_resume(struct device *dev)
{
	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
	struct max8997_dev *max8997 = i2c_get_clientdata(i2c);

	if (device_may_wakeup(dev))
		irq_set_irq_wake(max8997->irq, 0);
	return max8997_irq_resume(max8997);
}
Beispiel #24
0
static int max77693_suspend(struct device *dev)
{
	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);

	if (device_may_wakeup(dev))
		irq_set_irq_wake(max77693->irq, 1);
	return 0;
}
Beispiel #25
0
/*
 *  cpu irq handler
 */
void __init nxp_cpu_irq_init(void)
{
	pr_debug("%s:%d\n", __func__, __LINE__);

	__gic_init(GIC_DIST_BASE, (void __iomem *)GIC_CPUI_BASE);
	gpio_init(GPIO_INT_BASE , IRQ_GPIO_START, GPIO_INT_MASK, 0);	/* 64 ~ 223 (A,B,C,D,E) */
	alive_init(ALIVE_INT_BASE, IRQ_ALIVE_START, ALIVE_INT_MASK, 0); /* 224 ~ 231 */

#ifdef CONFIG_FIQ
	init_FIQ();
#endif

	/* wake up source from idle */
	irq_set_irq_wake(IRQ_PHY_CLKPWR_ALIVEIRQ + GIC_PHY_OFFSET, 1);
#if PM_RTC_WAKE
	irq_set_irq_wake(IRQ_PHY_CLKPWR_RTCIRQ + GIC_PHY_OFFSET, 1);
#endif
}
Beispiel #26
0
static int max8998_suspend(struct device *dev)
{
	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);

	if (max8998->wakeup)
		irq_set_irq_wake(max8998->irq, 1);
	return 0;
}
Beispiel #27
0
static int max8998_suspend(struct device *dev)
{
	struct i2c_client *i2c = to_i2c_client(dev);
	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);

	if (device_may_wakeup(dev))
		irq_set_irq_wake(max8998->irq, 1);
	return 0;
}
Beispiel #28
0
static void stm32_ipcc_set_irq_wake(struct device *dev, bool enable)
{
	struct stm32_ipcc *ipcc = dev_get_drvdata(dev);
	unsigned int i;

	if (device_may_wakeup(dev))
		for (i = 0; i < IPCC_IRQ_NUM; i++)
			irq_set_irq_wake(ipcc->irqs[i], enable);
}
Beispiel #29
0
int __init x3proto_gpio_setup(void)
{
	int ilsel;
	int ret, i;

	ilsel = ilsel_enable(ILSEL_KEY);
	if (unlikely(ilsel < 0))
		return ilsel;

	ret = gpiochip_add(&x3proto_gpio_chip);
	if (unlikely(ret))
		goto err_gpio;

	for (i = 0; i < NR_BASEBOARD_GPIOS; i++) {
		unsigned long flags;
		int irq = create_irq();

		if (unlikely(irq < 0)) {
			ret = -EINVAL;
			goto err_irq;
		}

		spin_lock_irqsave(&x3proto_gpio_lock, flags);
		x3proto_gpio_irq_map[i] = irq;
		irq_set_chip_and_handler_name(irq, &dummy_irq_chip,
					      handle_simple_irq, "gpio");
		spin_unlock_irqrestore(&x3proto_gpio_lock, flags);
	}

	pr_info("registering '%s' support, handling GPIOs %u -> %u, "
		"bound to IRQ %u\n",
		x3proto_gpio_chip.label, x3proto_gpio_chip.base,
		x3proto_gpio_chip.base + x3proto_gpio_chip.ngpio,
		ilsel);

	irq_set_chained_handler(ilsel, x3proto_gpio_irq_handler);
	irq_set_irq_wake(ilsel, 1);

	return 0;

err_irq:
	for (; i >= 0; --i)
		if (x3proto_gpio_irq_map[i])
			destroy_irq(x3proto_gpio_irq_map[i]);

	ret = gpiochip_remove(&x3proto_gpio_chip);
	if (unlikely(ret))
		pr_err("Failed deregistering GPIO\n");

err_gpio:
	synchronize_irq(ilsel);

	ilsel_disable(ILSEL_KEY);

	return ret;
}
Beispiel #30
0
int __init msm_rpm_init(struct msm_rpm_platform_data *data)
{
	unsigned int irq;
	int rc;

	if (cpu_is_apq8064())
		return 0;

	msm_rpm_platform = data;

	fw_major = msm_rpm_read(MSM_RPM_PAGE_STATUS,
					MSM_RPM_STATUS_ID_VERSION_MAJOR);
	fw_minor = msm_rpm_read(MSM_RPM_PAGE_STATUS,
					MSM_RPM_STATUS_ID_VERSION_MINOR);
	fw_build = msm_rpm_read(MSM_RPM_PAGE_STATUS,
					MSM_RPM_STATUS_ID_VERSION_BUILD);
	pr_info("%s: RPM firmware %u.%u.%u\n", __func__,
			fw_major, fw_minor, fw_build);

	if (fw_major != RPM_MAJOR_VER) {
		pr_err("%s: RPM version %u.%u.%u incompatible with "
				"this driver version %u.%u.%u\n", __func__,
				fw_major, fw_minor, fw_build,
				RPM_MAJOR_VER, RPM_MINOR_VER, RPM_BUILD_VER);
		return -EFAULT;
	}

	msm_rpm_write(MSM_RPM_PAGE_CTRL, MSM_RPM_CTRL_VERSION_MAJOR,
			RPM_MAJOR_VER);
	msm_rpm_write(MSM_RPM_PAGE_CTRL, MSM_RPM_CTRL_VERSION_MINOR,
			RPM_MINOR_VER);
	msm_rpm_write(MSM_RPM_PAGE_CTRL, MSM_RPM_CTRL_VERSION_BUILD,
			RPM_BUILD_VER);

	irq = msm_rpm_platform->irq_ack;

	rc = request_irq(irq, msm_rpm_ack_interrupt,
			IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
			"rpm_drv", msm_rpm_ack_interrupt);
	if (rc) {
		pr_err("%s: failed to request irq %d: %d\n",
			__func__, irq, rc);
		return rc;
	}

	rc = irq_set_irq_wake(irq, 1);
	if (rc) {
		pr_err("%s: failed to set wakeup irq %u: %d\n",
			__func__, irq, rc);
		return rc;
	}

	msm_rpm_populate_map();

	return platform_driver_register(&msm_rpm_platform_driver);
}