/* Disable/enable dormant mode at runtime */
static int dormant_enable_set(void *data, u64 val)
{
	if (val) {
		dormant_enable = 1;
		pi_mgr_qos_request_update(&arm_qos, PI_MGR_QOS_DEFAULT_VALUE);
	} else {
		pi_mgr_qos_request_update(&arm_qos,
					  NON_DORMANT_MAX_EXIT_LATENCY);
		dormant_enable = 0;
	}

	return 0;
}
示例#2
0
static void hw_timer_expire(void* data)
{
        unsigned int host_wake;
        unsigned int bt_wake;
	unsigned long flags;
	unsigned int ret;

	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);
	bt_wake = gpio_get_value(priv->pdata->bt_wake_gpio);
	spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags);

	pr_debug("%s BLUETOOTH: hostwake =%d; btwake=%d \n",
					__func__, host_wake, bt_wake);

	if(host_wake==BCMBT_LPM_HOST_WAKE_DEASSERT) {
		pi_mgr_qos_request_update(&priv->plpm->host_wake_qos_node,
					PI_MGR_QOS_DEFAULT_VALUE);
		del_timer(&priv->plpm->hw_timer);
		if (wake_lock_active(&priv->plpm->host_wake_lock))
		  wake_unlock(&priv->plpm->host_wake_lock);
	} else {
		ret = timer_pending(&priv->plpm->hw_timer);
		if (!ret) {
			mod_timer(&priv->plpm->hw_timer,
				jiffies + msecs_to_jiffies(TIMER_PERIOD));
		}
	}
}
示例#3
0
void fsa9480_force_sleep(void)
{
    struct fsa9480_usbsw *usbsw = chip;
    struct i2c_client *client = usbsw->client;
    u8 value = 0;

    //wake_unlock(&JIGConnect_idle_wake);
    wake_unlock(&JIGConnect_suspend_wake);
#ifdef CONFIG_KONA_PI_MGR
    pi_mgr_qos_request_update(&qos_node, PI_MGR_QOS_DEFAULT_VALUE);
#endif
    if(muic_type==muicTypeFSA880)
    {
        fsa9480_read_reg(client, FSA9480_REG_MANSW2, &value);
        fsa9480_write_reg(client, FSA9480_REG_MANSW2, 0x00);

        fsa9480_read_reg(client, FSA9480_REG_CTRL, &value);
        fsa9480_write_reg(client, FSA9480_REG_CTRL, 0x00);
    }
    else
    {
        fsa9480_read_reg(client, FSA9480_REG_CTRL, &value);
        value &= ~MANUAL_SWITCH;
        fsa9480_write_reg(client, FSA9480_REG_CTRL, value);

        fsa9480_read_reg(client, FSA9480_REG_MANSW2, &value);
        value &= ~MANSW2_JIG;
        fsa9480_write_reg(client, FSA9480_REG_MANSW2, value);
    }
}
static int isp_release(struct inode *inode, struct file *filp)
{
	struct isp_t *dev = (struct isp_t *) filp->private_data;

	free_irq(IRQ_ISP, dev);

	pi_mgr_qos_request_update(&isp_qos_node, PI_MGR_QOS_DEFAULT_VALUE);
#ifndef CONFIG_ARCH_JAVA
	scu_standby(1);
#endif
	disable_isp_clock();
	if (pi_mgr_dfs_request_update(&isp_dfs_node, PI_MGR_DFS_MIN_VALUE)) {
		printk(KERN_ERR "%s: failed to update dfs request for isp\n",
		       __func__);
	}

	pi_mgr_dfs_request_remove(&isp_dfs_node);
	isp_dfs_node.name = NULL;

	pi_mgr_qos_request_remove(&isp_qos_node);
	isp_qos_node.name = NULL;

	mutex_lock(&brcm_global_isp_lock);
	brcm_global_isp_in_use--;
	mutex_unlock(&brcm_global_isp_lock);

	kfree(dev);

	return 0;
}
示例#5
0
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) {
		/* 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);
		spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags);
	} else {
		mod_timer(&priv->plpm->hw_timer,
			jiffies + msecs_to_jiffies(TIMER_PERIOD));
		spin_unlock_irqrestore(&priv->plpm->bcmbt_lpm_lock, flags);
	}
	pr_debug("%s BLUETOOTH:Exiting.\n", __func__);
	return IRQ_HANDLED;
}
示例#6
0
static int isp_open(struct inode *inode, struct file *filp)
{
	int ret = 0;

	struct isp_t *dev = kmalloc(sizeof(struct isp_t), GFP_KERNEL);
	if (!dev)
		return -ENOMEM;

	filp->private_data = dev;
	spin_lock_init(&dev->lock);
	dev->isp_status.status = 0;

	init_completion(&dev->irq_sem);

	ret =
	    pi_mgr_dfs_add_request(&isp_dfs_node, "isp", PI_MGR_PI_ID_MM,
				   PI_MGR_DFS_MIN_VALUE);

	if (ret) {
		printk(KERN_ERR "%s: failed to register PI DFS request\n",
		       __func__);
		goto err;
	}

	ret = pi_mgr_qos_add_request(&isp_qos_node, "isp",
					PI_MGR_PI_ID_ARM_CORE,
					PI_MGR_QOS_DEFAULT_VALUE);
	if (ret) {
		printk(KERN_ERR "%s: failed to register PI QOS request\n",
				__func__);
		ret = -EIO;
		goto qos_request_fail;
	}

	enable_isp_clock();
	pi_mgr_qos_request_update(&isp_qos_node, 0);
	scu_standby(0);

	ret =
	    request_irq(IRQ_ISP, isp_isr, IRQF_DISABLED | IRQF_SHARED,
			ISP_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed ret = %d\n", ret);
		goto err;
	}
	/* Ensure that only one CORE handles interrupt for the MM block. */
	irq_set_affinity(IRQ_ISP, cpumask_of(0));
	disable_irq(IRQ_ISP);
	return 0;


qos_request_fail:
	pi_mgr_dfs_request_remove(&isp_dfs_node);
err:
	kfree(dev);
	return ret;
}
示例#7
0
static void cpu_keepawake_inc(void)
{
	mutex_lock(&vce_state.armctl_sem);
	if (vce_state.arm_keepawake_count == 0) {
		pi_mgr_qos_request_update(&vce_state.cpu_qos_node, 0);
		scu_standby(0);
		mb();
	}
	vce_state.arm_keepawake_count += 1;
	mutex_unlock(&vce_state.armctl_sem);
}
示例#8
0
static void cpu_keepawake_dec(void)
{
	mutex_lock(&vce_state.armctl_sem);
	vce_state.arm_keepawake_count -= 1;
	if (vce_state.arm_keepawake_count == 0) {
		pi_mgr_qos_request_update(&vce_state.cpu_qos_node,
					  PI_MGR_QOS_DEFAULT_VALUE);
		scu_standby(1);
	}
	mutex_unlock(&vce_state.armctl_sem);
}
示例#9
0
static int unicam_open(struct inode *inode, struct file *filp)
{
	int ret = 0;
	struct unicam *dev = kzalloc(sizeof(struct unicam), GFP_KERNEL);

	if (!dev)
		return -ENOMEM;

	filp->private_data = dev;

	init_completion(&dev->irq_sem);
	dev->irq_pending = 0;
	dev->irq_start = 0;

	if (pi_mgr_dfs_request_update(&unicam_dfs_node, PI_OPP_TURBO)) {
		dev_err(unicam_info.dev, "%s:failed to update dfs request for unicam\n",
		       __func__);
		return -EIO;
	}

	pi_mgr_qos_request_update(&unicam_qos_node, 0);
	scu_standby(0);

	enable_unicam_clock();
	reset_unicam();
	unicam_init_camera_intf();

	ret =
	    request_irq(IRQ_UNICAM, unicam_isr, IRQF_DISABLED | IRQF_SHARED,
			UNICAM_DEV_NAME, dev);
	if (ret) {
		dev_err(unicam_info.dev, "%s: request_irq failed ret = %d\n",
			__func__, ret);
		goto err;
	}

	if (unicam_info.reg) {
		ret = regulator_enable(unicam_info.reg);
		if (ret < 0) {
			dev_err(unicam_info.dev,
				"%s: cannot enable regulator: %d\n",
				__func__, ret);
			goto err;
		}
	}

	return 0;

err:
	kfree(dev);

	return ret;
}
int __init rhea_pm_debug_init(void)
{
	int ret;

    INIT_DELAYED_WORK(&uartb_wq, uartb_wq_handler);
#ifdef CONFIG_UART_FORCE_RETENTION_TST
	if (pwr_mgr_register_event_handler(UBRX_EVENT,
			uartb_pwr_mgr_event_cb, NULL))
		return -ENOMEM;
#endif
	/* create root clock dir /clock */
    dent_rhea_pm_root_dir = debugfs_create_dir("rhea_pm", 0);
    if(!dent_rhea_pm_root_dir)
	return -ENOMEM;
	if (!debugfs_create_u32("log_mask", S_IRUGO | S_IWUSR,
		dent_rhea_pm_root_dir, (int *)&log_mask))
		return -ENOMEM;
	if (!debugfs_create_file("en_self_refresh", S_IRUGO | S_IWUSR,
		dent_rhea_pm_root_dir, NULL, &pm_en_self_refresh_fops))
		return -ENOMEM;
	if (!debugfs_create_u32("force_retention", S_IRUGO | S_IWUSR,
			dent_rhea_pm_root_dir, (int*)&force_retention))
		return -ENOMEM;

	/* A9 QOS interface is used to disable dormant C-states
	 * at runtime. To disable dormant set PM_QOS_CPU_DMA_LATENCY
	 * to the latency of the highest non-dormant state.
	 */
	ret = pi_mgr_qos_add_request(&arm_qos, "pm",
				     PI_MGR_PI_ID_ARM_CORE,
				     PI_MGR_QOS_DEFAULT_VALUE);
	if (ret < 0)
		return ret;

	/* If dormant is not enabled out of boot, prevent cpuidle
	 * from entering into dormant C-states.
	 */
	if (dormant_enable == 0)
		pi_mgr_qos_request_update(&arm_qos,
					  NON_DORMANT_MAX_EXIT_LATENCY);

	/* Interface to enable disable dormant mode at runtime */
	if (!debugfs_create_file("dormant_enable", S_IRUGO | S_IWUSR,
				 dent_rhea_pm_root_dir, NULL,
				 &dormant_enable_fops))
		return -ENOMEM;

	return 0;
}
示例#11
0
static void bcmbt_lpm_clean_host_wake(struct bcmbt_lpm_entry_struct *priv)
{
	if (priv->pdata->host_wake_gpio == -1)
		return;

	free_irq(priv->plpm->host_irq, priv_g);
	/* delete timer */
	del_timer(&priv->plpm->hw_timer);
	gpio_free((unsigned)priv->pdata->host_wake_gpio);
	pi_mgr_qos_request_update(&priv->plpm->host_wake_qos_node,
				    PI_MGR_QOS_DEFAULT_VALUE);
#ifdef CONFIG_HAS_WAKELOCK
        wake_lock_destroy(&priv->plpm->host_wake_lock);
#endif
	pr_debug("%s BLUETOOTH:Exiting.\n", __func__);
}
示例#12
0
void bcmbt_lpm_start(void)
{
	int rc;

	if (priv_g != NULL) {
		pr_debug("%s: BLUETOOTH: data pointer is valid\n", __func__);

		rc = gpio_to_irq(priv_g->pdata->host_wake_gpio);
		if (rc < 0) {
			pr_err
		   ("%s: failed to configure BT Host Mgmt err=%d\n",
		     __func__, rc);
		   goto exit_lock_host_wake;
		}
		priv_g->plpm->host_irq = rc;
		pr_debug("%s: BLUETOOTH: request_irq host_irq=%d\n",
			__func__, priv_g->plpm->host_irq);

		init_timer(&priv_g->plpm->hw_timer);
		priv_g->plpm->hw_timer.function = hw_timer_expire;
		priv_g->plpm->hw_timer_st = IDLE;
		priv_g->plpm->hw_timer.data = priv_g;

		rc = request_irq(
			priv_g->plpm->host_irq, bcmbt_lpm_host_wake_isr,
			 (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
			  IRQF_NO_SUSPEND), "bt_host_wake", priv_g);
		 if (rc) {
			pr_err
		("%s: failed to configure BT Host Mgmt:request_irq err=%d\n",
			     __func__, rc);
		}
		pi_mgr_qos_request_update(&priv_g->plpm->bt_wake_qos_node,
				   0);
	} else {
		pr_err("%s: BLUETOOTH:data pointer null, NOT initialized\n",
			__func__);
		return;
	}
	pr_debug("%s BLUETOOTH:Exiting.\n", __func__);
	return;

exit_lock_host_wake:
	gpio_free((unsigned)priv_g->pdata->host_wake_gpio);
	return;
}
static int h264_release(struct inode *inode, struct file *filp)
{
	struct h264_t *dev = (struct h264_t *) filp->private_data;

	/*
	   Restore the default QOS value.
	   Restore the minimum value for DVFS
	   Removes the request for DFS and QOS
	   Disables the clock.
	 */
#ifdef H264_CLK_MGMT
#ifdef H264_QOS_MGMT
	pi_mgr_qos_request_update(&h264_qos_node, PI_MGR_QOS_DEFAULT_VALUE);
	scu_standby(1);
#endif


	disable_h264_clock();
	if (pi_mgr_dfs_request_update(&h264_dfs_node, PI_MGR_DFS_MIN_VALUE)) {
		printk(KERN_ERR "%s: failed to update dfs request for h264\n",
		       __func__);
	}

	pi_mgr_dfs_request_remove(&h264_dfs_node);
	h264_dfs_node.name = NULL;

#ifdef H264_QOS_MGMT
	pi_mgr_qos_request_remove(&h264_qos_node);
	h264_qos_node.name = NULL;
#endif

#endif

#ifdef ENABLE_H264_INT
	free_irq(H264_AOB_IRQ, dev);
	free_irq(H264_CME_IRQ, dev);
	free_irq(H264_MCIN_CBC_IRQ, dev);
#endif

	kfree(dev);
	mutex_unlock(&h264_mutex);
	return 0;
}
示例#14
0
static ssize_t fsa9480_set_syssleep(struct device *dev,
                                   struct device_attribute *attr,
                                   const char *buf, size_t count)
{
	struct fsa9480_usbsw *usbsw = chip;
	struct i2c_client *client = usbsw->client;
	u8 value = 0;

	if (!strncmp(buf, "1", 1))
	{
		//wake_unlock(&JIGConnect_idle_wake);
		wake_unlock(&JIGConnect_suspend_wake);
#ifdef CONFIG_KONA_PI_MGR
		pi_mgr_qos_request_update(&qos_node, PI_MGR_QOS_DEFAULT_VALUE);
#endif
		if(muic_type==muicTypeFSA880)
		{
			fsa9480_read_reg(client, FSA9480_REG_MANSW2, &value);
			fsa9480_write_reg(client, FSA9480_REG_MANSW2, 0x00);

			fsa9480_read_reg(client, FSA9480_REG_CTRL, &value);
			fsa9480_write_reg(client, FSA9480_REG_CTRL, 0x00);
		}
		else
		{
			fsa9480_read_reg(client, FSA9480_REG_CTRL, &value);
			value &= ~MANUAL_SWITCH;
			fsa9480_write_reg(client, FSA9480_REG_CTRL, value);
		
			fsa9480_read_reg(client, FSA9480_REG_MANSW2, &value);
			value &= ~MANSW2_JIG;
			fsa9480_write_reg(client, FSA9480_REG_MANSW2, value);
		}
		//isManual=1;
	}
	else
	{
		fsa9480_read_reg(client, FSA9480_REG_CTRL, &value);
		value |= MANUAL_SWITCH;
		fsa9480_write_reg(client, FSA9480_REG_CTRL, value);
	}
	return count;
}
示例#15
0
static void bcmbt_lpm_clean_bt_wake(struct bcmbt_lpm_entry_struct *priv,
			 bool b_tty)
{
	if (priv->pdata->bt_wake_gpio < 0)
		return;

	pi_mgr_qos_request_update(&priv->plpm->bt_wake_qos_node,
				    PI_MGR_QOS_DEFAULT_VALUE);

	gpio_free((unsigned)priv->pdata->bt_wake_gpio);

	if (b_tty)
		bcmbt_tty_cleanup();

#ifdef CONFIG_HAS_WAKELOCK
	wake_lock_destroy(&priv->plpm->bt_wake_lock);
#endif
	pr_debug("%s BLUETOOTH:Exiting.\n", __func__);
}
示例#16
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);
}
示例#17
0
static int isp2_release(struct inode *inode, struct file *filp)
{
    struct isp2_t *dev = (struct isp2_t *) filp->private_data;

    pi_mgr_qos_request_update(&isp2_qos_node, PI_MGR_QOS_DEFAULT_VALUE);
    disable_isp2_clock();
    if (pi_mgr_dfs_request_update(&isp2_dfs_node, PI_MGR_DFS_MIN_VALUE)) {
        printk(KERN_ERR "%s: failed to update dfs request for isp2\n",
               __func__);
    }

    pi_mgr_dfs_request_remove(&isp2_dfs_node);
    isp2_dfs_node.name = NULL;

    pi_mgr_qos_request_remove(&isp2_qos_node);
    isp2_qos_node.name = NULL;

    free_irq(IRQ_ISP2, dev);
    kfree(dev);

    return 0;
}
示例#18
0
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;
}
示例#19
0
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;
}
示例#20
0
static int unicam_release(struct inode *inode, struct file *filp)
{
	struct unicam *dev = filp->private_data;

	disable_irq(IRQ_UNICAM);
	free_irq(IRQ_UNICAM, dev);

	if (unicam_info.reg) {
		if (regulator_disable(unicam_info.reg) < 0)
			dev_err(unicam_info.dev, "%s: cannot disable regulator\n",
				__func__);
	}

	reset_unicam();
	disable_unicam_clock();
	pi_mgr_qos_request_update(&unicam_qos_node, PI_MGR_QOS_DEFAULT_VALUE);
	if (pi_mgr_dfs_request_update(&unicam_dfs_node, PI_MGR_DFS_MIN_VALUE))
		dev_err(unicam_info.dev, "%s: failed to update dfs request for unicam\n",
		       __func__);
	scu_standby(1);
	kfree(dev);

	return 0;
}
static int h264_open(struct inode *inode, struct file *filp)
{
	int ret = 0;
	struct h264_t *dev = kmalloc(sizeof(struct h264_t), GFP_KERNEL);
	if (!dev) {
		printk("\n Returning from no memory");
		return -ENOMEM;
	}
	mutex_lock(&h264_mutex);
	filp->private_data = dev;
	spin_lock_init(&dev->lock);

	dev->dev_status.cbc_intr = 0x00;
	dev->dev_status.mcin_intr = 0x00;

	init_completion(&dev->irq_sem);

	/*
	   Add a request for DFS.
	   Add a request for QOS (with default value)
	   Enable the clock for H.264 block.
	 */

#ifdef H264_CLK_MGMT
	ret =
	    pi_mgr_dfs_add_request(&h264_dfs_node, "h264", PI_MGR_PI_ID_MM,
				   PI_MGR_DFS_MIN_VALUE);

	if (ret) {
		printk(KERN_ERR "%s: failed to register PI DFS request\n",
		       __func__);
		goto err;
	}

#ifdef H264_QOS_MGMT
	ret =
	    pi_mgr_qos_add_request(&h264_qos_node, "h264",
				   PI_MGR_PI_ID_ARM_CORE,
				   PI_MGR_QOS_DEFAULT_VALUE);
	if (ret) {
		printk(KERN_ERR "%s: failed to register PI QOS request\n",
		       __func__);
		ret = -EIO;
		goto qos_request_fail;
	}
#endif

	enable_h264_clock();
	/* Access to root reset manager register block. */
	writel(0xa5a501, IOMEM(HW_IO_PHYS_TO_VIRT(0x35001f00)));
	usleep_range(10, 20);
	/* Enable multimedia power domain. */
	/* Test 0x3d should be sufficient for MM. */
	writel(0xfd, IOMEM(HW_IO_PHYS_TO_VIRT(0x35001f08)));
	usleep_range(10, 20);
	/* Enable H264 Slave interface control register. */
	writel(0x00, IOMEM(HW_IO_PHYS_TO_VIRT(0x3C00F004)));
	usleep_range(10, 20);
	/* Enable H264 Master interface control register. */
	writel(0x00, IOMEM(HW_IO_PHYS_TO_VIRT(0x3C00F008)));
	usleep_range(10, 20);
#ifdef H264_QOS_MGMT
	ret = pi_mgr_qos_request_update(&h264_qos_node, 0);
	if (ret) {
		printk(KERN_ERR "%s: failed to register PI QOS request\n",
		       __func__);
		ret = -EIO;
	}
	scu_standby(0);
#endif

#endif
	usleep_range(50, 100); /* buffer to ensure everything above are done. */
#ifdef ENABLE_H264_INT
	/* Register for the interrupts */
	ret =
	    request_irq(H264_AOB_IRQ, h264_isr, IRQF_DISABLED | IRQF_SHARED |
			IRQF_NO_SUSPEND, H264_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed for AOB ret = %d\n", ret);
		goto err;
	}
	/* Ensure that only one CORE handles interrupt for the MM block. */
	irq_set_affinity(H264_AOB_IRQ, cpumask_of(0));

	ret =
	    request_irq(H264_CME_IRQ, h264_isr, IRQF_DISABLED | IRQF_SHARED |
			IRQF_NO_SUSPEND, H264_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed for CME ret = %d\n", ret);
		goto err;
	}
	/* Ensure that only one CORE handles interrupt for the MM block. */
	irq_set_affinity(H264_CME_IRQ, cpumask_of(0));

	ret =
	    request_irq(H264_MCIN_CBC_IRQ, h264_isr, IRQF_DISABLED | IRQF_SHARED
			| IRQF_NO_SUSPEND, H264_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed for MCIN_CBC ret = %d\n", ret);
		goto err;
	}
	/* Ensure that only one CORE handles interrupt for the MM block. */
	irq_set_affinity(H264_MCIN_CBC_IRQ, cpumask_of(0));
	disable_irq(H264_AOB_IRQ);
	disable_irq(H264_CME_IRQ);
	disable_irq(H264_MCIN_CBC_IRQ);
#endif
	return 0;

#ifdef H264_QOS_MGMT
qos_request_fail:
	pi_mgr_dfs_request_remove(&h264_dfs_node);
#endif
err:
	kfree(dev);
	printk(KERN_ERR "\nError in the h264_open\n");
	mutex_unlock(&h264_mutex);
	return ret;
}
示例#22
0
 //extern void mv_usb_connect_change(int status); // khMa
static void fsa9480_detect_dev(struct fsa9480_usbsw *usbsw, u8 intr)
{
       u8 val1, val2;// , ctrl,temp;
       //struct fsa9480_platform_data *pdata = usbsw->pdata;
       struct i2c_client *client = usbsw->client;
	   printk("[FSA9480] fsa9480_detect_dev !!!!!\n");

#if 0 // Not for TI
       /*reset except CP USB and AV dock*/
	   if ((usbsw->mansw != AUDIO) && (usbsw->mansw != AUDIO_9485)
	   	   && (usbsw->mansw != VAUDIO) && (usbsw->mansw != VAUDIO_9485))
       	{
		  /*reset UIC when mansw is not set*/
		  printk("[FSA9480] %s: reset UIC mansw is 0x%x\n",__func__,usbsw->mansw);
          fsa9480_write_reg(client, FSA9480_REG_CTRL, 0x1E);
		  usbsw->mansw = AUTO;
       	} 
#endif

       fsa9480_read_reg(client, FSA9480_REG_DEV_T1, &val1);
       fsa9480_read_reg(client, FSA9480_REG_DEV_T2, &val2);
       printk("intr: 0x%x, dev1: 0x%x, dev2: 0x%x\n",intr, val1, val2);

#if 0//Not for TI	   
       fsa9480_read_reg(client, FSA9480_REG_CTRL, &ctrl);

       dev_info(&client->dev, "intr: 0x%x, dev1: 0x%x, dev2: 0x%x, ctrl: 0x%x\n",
                       intr, val1, val2,ctrl);
#endif

	if((intr==0x01) &&(val1==0x00) && (val2==0x00) && (isProbe == 0))
	{
		printk("[FSA9480] (intr==0x01) &&(val1==0x00) && (val2==0x00) !!!!!\n");
		fsa9480_read_adc_value();
		if(muic_type==muicTypeTI6111)
		{
			msleep(50);

			fsa9480_read_reg(client, FSA9480_REG_DEV_T1, &val1);
			fsa9480_read_reg(client, FSA9480_REG_DEV_T2, &val2);

			//TI_SWreset(usbsw);
			//return;
		}
	}
	else if(intr==0x03)
	{
		printk("[FSA9480] error read INT register !!!!!\n");
		intr = (1 << 1); // change to DETACH
	}

	/* Attached */
	if (intr & (1 << 0)) 
	{
		if (val1 & FSA9480_DEV_T1_USB_MASK ) {
			printk("[FSA9480] FSA9480_USB ATTACHED*****\n");

#if defined (VBUS_DETECT) /* Enable clock to AP USB block */
			pxa_vbus_handler(VBUS_HIGH);
#endif			
#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_USB_ATTACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_USB_ATTACHED);
			}
#endif
	                send_usb_attach_event();
		}

		if (val1 & FSA9480_DEV_T1_UART_MASK || val2 & FSA9480_DEV_T2_UART_MASK) {
			//if (pdata->uart_cb)
			//        pdata->uart_cb(FSA9480_ATTACHED);				   
		}

		if (val1 & FSA9480_DEV_T1_CHARGER_MASK || val1==DEV_VBUS || val2 & DEV_JIG_USB_OFF) {
			printk("[FSA9480] Charger ATTACHED*****\n");
#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_TA_ATTACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_TA_ATTACHED);
			}
#endif
		}

		if (val2 & FSA9480_DEV_T2_JIG_MASK) {
			printk("[FSA9480] JIG ATTACHED*****\n"); 			   
			//wake_lock(&JIGConnect_idle_wake);
			wake_lock(&JIGConnect_suspend_wake);
#ifdef CONFIG_KONA_PI_MGR
			pi_mgr_qos_request_update(&qos_node, 0);
#endif

#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_JIG_ATTACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_JIG_ATTACHED);
			}
#endif
		}
	} 
	else if (intr & (1 << 1)) 
	{    /* DETACH */
		if(usbsw->dev1 & FSA9480_DEV_T1_USB_MASK) {
				printk("[FSA9480] FSA9480_USB Detached*****\n");
#if defined (VBUS_DETECT) /* Disable clock to AP USB block */
			pxa_vbus_handler(VBUS_LOW);
#endif			
#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_USB_DETACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_USB_DETACHED);
			}
#endif
			send_usb_detach_event();
		}

		if (usbsw->dev1 & FSA9480_DEV_T1_UART_MASK ||
                       usbsw->dev2 & FSA9480_DEV_T2_UART_MASK) {
			//if (pdata->uart_cb)
			//     pdata->uart_cb(FSA9480_DETACHED);
		}

		if (usbsw->dev1 & FSA9480_DEV_T1_CHARGER_MASK || usbsw->dev1==DEV_VBUS || usbsw->dev2 & DEV_JIG_USB_OFF) {
			printk("[FSA9480] Charger Detached*****\n");
#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_TA_DETACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_TA_DETACHED);
			}
#endif
		}

		if (usbsw->dev2 & FSA9480_DEV_T2_JIG_MASK) {      
			printk("[FSA9480] JIG Detached*****\n");			   	
			//wake_unlock(&JIGConnect_idle_wake);
			wake_unlock(&JIGConnect_suspend_wake);
#ifdef CONFIG_KONA_PI_MGR
			pi_mgr_qos_request_update(&qos_node, PI_MGR_QOS_DEFAULT_VALUE);
#endif

#if defined(CONFIG_SPA)
			if(spa_external_event)
			{
				spa_external_event(SPA_CATEGORY_DEVICE, SPA_DEVICE_EVENT_JIG_DETACHED);
			}
#elif defined(CONFIG_BATTERY_D2083)
			if(spa_external_event)
			{
				spa_external_event(D2083_CATEGORY_DEVICE, D2083_EVENT_JIG_DETACHED);
			}
#endif
			if(muic_type==muicTypeTI6111)
			{
				/*SW RESET for TI USB:To fix no USB recog problem after jig attach&detach*/
				//TI_SWreset(usbsw);
			}
		}
	}

	if( intr ){
		usbsw->dev1 = val1;
		usbsw->dev2 = val2;

		chip->dev1 = val1;
		chip->dev2 = val2;
	}
#if 0 // Not for TI
	fsa9480_read_reg(client, FSA9480_REG_CTRL, &ctrl);
	ctrl &= ~INT_MASK;
	fsa9480_write_reg(client, FSA9480_REG_CTRL, ctrl);

	fsa9480_read_reg(client, FSA9480_REG_MANSW1, &temp); //khMa	   
#endif
}