Ejemplo n.º 1
0
void msm_adsp_put(struct msm_adsp_module *module)
{
    unsigned long flags;

    mutex_lock(&module->lock);
    if (module->ops) {
        MM_INFO("closing module %s\n", module->name);

        /* lock to ensure a dsp event cannot be delivered
         * during or after removal of the ops and driver_data
         */
        spin_lock_irqsave(&adsp_cmd_lock, flags);
        module->ops = NULL;
        module->driver_data = NULL;
        spin_unlock_irqrestore(&adsp_cmd_lock, flags);

        if (module->state != ADSP_STATE_DISABLED) {
            MM_INFO("disabling module %s\n", module->name);
            msm_adsp_disable_locked(module);
        }

        if (module->rpc_client)
            msm_rpc_close(module->rpc_client);
        module->rpc_client = 0;
    } else {
        MM_INFO("module %s is already closed\n", module->name);
    }
    mutex_unlock(&module->lock);
}
Ejemplo n.º 2
0
void msm_adsp_put(struct msm_adsp_module *module)
{
	unsigned long flags;

	mutex_lock(&module->lock);
	if (--module->open_count == 0 && module->clk)
		clk_disable(module->clk);
	if (module->ops) {
		pr_info("adsp: closing module %s\n", module->name);

		/* lock to ensure a dsp event cannot be delivered
		 * during or after removal of the ops and driver_data
		 */
		spin_lock_irqsave(&adsp_cmd_lock, flags);
		module->ops = NULL;
		module->driver_data = NULL;
		spin_unlock_irqrestore(&adsp_cmd_lock, flags);

		if (module->state != ADSP_STATE_DISABLED) {
			pr_info("adsp: disabling module %s\n", module->name);
			msm_adsp_disable_locked(module);
		}

		msm_rpc_close(module->rpc_client);
		module->rpc_client = 0;
		if (--adsp_open_count == 0) {
			disable_irq(INT_ADSP);
			allow_suspend();
			pr_info("adsp: disable interrupt\n");
		}
	} else {
		pr_info("adsp: module %s is already closed\n", module->name);
	}
	mutex_unlock(&module->lock);
}