• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sdio_func_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sdio_func_id函数的典型用法代码示例。如果您正苦于以下问题:C++ sdio_func_id函数的具体用法?C++ sdio_func_id怎么用?C++ sdio_func_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sdio_func_id函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mwifiex_sdio_suspend

/*
 * SDIO suspend.
 *
 * Kernel needs to suspend all functions separately. Therefore all
 * registered functions must have drivers with suspend and resume
 * methods. Failing that the kernel simply removes the whole card.
 *
 * If already not suspended, this function allocates and sends a host
 * sleep activate request to the firmware and turns off the traffic.
 */
static int mwifiex_sdio_suspend(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct sdio_mmc_card *card;
	struct mwifiex_adapter *adapter;
	mmc_pm_flag_t pm_flag = 0;
	int hs_actived = 0;
	int i;
	int ret = 0;

	if (func) {
		pm_flag = sdio_get_host_pm_caps(func);
		pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
		       sdio_func_id(func), pm_flag);
		if (!(pm_flag & MMC_PM_KEEP_POWER)) {
			pr_err("%s: cannot remain alive while host is"
				" suspended\n", sdio_func_id(func));
			return -ENOSYS;
		}

		card = sdio_get_drvdata(func);
		if (!card || !card->adapter) {
			pr_err("suspend: invalid card or adapter\n");
			return 0;
		}
	} else {
		pr_err("suspend: sdio_func is not specified\n");
		return 0;
	}

	adapter = card->adapter;

	/* Enable the Host Sleep */
	hs_actived = mwifiex_enable_hs(adapter);
	if (hs_actived) {
		pr_debug("cmd: suspend with MMC_PM_KEEP_POWER\n");
		ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
	}

	/* Indicate device suspended */
	adapter->is_suspended = true;

	for (i = 0; i < adapter->priv_num; i++)
		netif_carrier_off(adapter->priv[i]->netdev);

	return ret;
}
开发者ID:JamesTPan,项目名称:compat-wireless-3.2.5-1-ranc,代码行数:57,代码来源:sdio.c


示例2: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_card *card)
{
	int i, ret, count;
	unsigned char pending;
	unsigned char reg;
#if 0
#endif

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IENx, 0, &reg);
	if (ret) {
		printk(KERN_ERR "%s: error %d reading SDIO_CCCR_IENx\n",
				mmc_card_id(card), ret);
		return ret;
	}

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		printk(KERN_DEBUG "%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		return ret;
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
		        struct sdio_func *func = card->sdio_func[i - 1];
			if (!(reg & 0x1)) {
				pr_err("%s: Master interrupt is disabled but still "
					"we have pending interrupt, bug in h/w??\n", __func__);
				return -EINVAL;
			}

			if (!func) {
				printk(KERN_WARNING "%s: pending IRQ for "
					"non-existent function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
				if ((reg & (1 << func->num))) {
					func->irq_handler(func);
					count++;
				} else {
					pr_err("%s: Interrupt ocurred even when IEx "
						"bit is not set, bug in h/w??\n", mmc_card_id(card));
					ret = -EINVAL;
				}
			} else {
				printk(KERN_WARNING "%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}

	if (count)
		return count;

	return ret;
}
开发者ID:phenomx4,项目名称:android_kernel_lge_m3s-3.0,代码行数:59,代码来源:sdio_irq.c


示例3: sdio_enable_func

/**
 *	sdio_enable_func - enables a SDIO function for usage
 *	@func: SDIO function to enable
 *
 *	Powers up and activates a SDIO function so that register
 *	access is possible.
 */
int sdio_enable_func(struct sdio_func *func)
{
	int ret;
	unsigned char reg;
	unsigned long timeout;

	BUG_ON(!func);
	BUG_ON(!func->card);

	pr_debug("SDIO: Enabling device %s...\n", sdio_func_id(func));

	ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IOEx, 0, &reg);
	if (ret)
		goto err;

	reg |= 1 << func->num;

	ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IOEx, reg, NULL);
	if (ret)
		goto err;

	/*
	 * FIXME: This should timeout based on information in the CIS,
	 * but we don't have card to parse that yet.
	 */
	timeout = jiffies + HZ;

	while (1) {
		ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
		if (ret)
			goto err;
		if (reg & (1 << func->num))
			break;
		ret = -ETIME;
		if (time_after(jiffies, timeout))
			goto err;
	}

	pr_debug("SDIO: Enabled device %s\n", sdio_func_id(func));

	return 0;

err:
	pr_debug("SDIO: Failed to enable device %s\n", sdio_func_id(func));
	return ret;
}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:53,代码来源:sdio_io.c


示例4: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_host *host)
{
	struct mmc_card *card = host->card;
	int i, ret, count;
	unsigned char pending;
	struct sdio_func *func;

	if ((!host->sdio_irq_pending) && (host->caps & MMC_CAP_SDIO_IRQ))
		return 0;

	/*
	 * Optimization, if there is only 1 function interrupt registered
	 * and we know an IRQ was signaled then call irq handler directly.
	 * Otherwise do the full probe.
	 */
	func = card->sdio_single_irq;
	if (func && host->sdio_irq_pending) {
		func->irq_handler(func);
		if (func->func_status == func_suspended)
			host->break_suspend = 1;
		return 1;
	}

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		return ret;
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
			func = card->sdio_func[i - 1];
			if (!func) {
				pr_warning("%s: pending IRQ for "
					"non-existent function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
				if (func->func_status == func_suspended)
					host->break_suspend = 1;
				func->irq_handler(func);
				count++;
			} else {
				pr_warning("%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}

	if (count)
		return count;

	return ret;
}
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:57,代码来源:sdio_irq.c


示例5: mwifiex_sdio_suspend

/*
 * SDIO suspend.
 *
 * Kernel needs to suspend all functions separately. Therefore all
 * registered functions must have drivers with suspend and resume
 * methods. Failing that the kernel simply removes the whole card.
 *
 * If already not suspended, this function allocates and sends a host
 * sleep activate request to the firmware and turns off the traffic.
 */
static int mwifiex_sdio_suspend(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct sdio_mmc_card *card;
	struct mwifiex_adapter *adapter;
	mmc_pm_flag_t pm_flag = 0;
	int ret = 0;

	if (func) {
		pm_flag = sdio_get_host_pm_caps(func);
		pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
			 sdio_func_id(func), pm_flag);
		if (!(pm_flag & MMC_PM_KEEP_POWER)) {
			pr_err("%s: cannot remain alive while host is"
				" suspended\n", sdio_func_id(func));
			return -ENOSYS;
		}

		card = sdio_get_drvdata(func);
		if (!card || !card->adapter) {
			pr_err("suspend: invalid card or adapter\n");
			return 0;
		}
	} else {
		pr_err("suspend: sdio_func is not specified\n");
		return 0;
	}

	adapter = card->adapter;

	/* Enable the Host Sleep */
	if (!mwifiex_enable_hs(adapter)) {
		dev_err(adapter->dev, "cmd: failed to suspend\n");
		return -EFAULT;
	}

	dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n");
	ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);

	/* Indicate device suspended */
	adapter->is_suspended = true;

	return ret;
}
开发者ID:174high,项目名称:dell-driver,代码行数:54,代码来源:sdio.c


示例6: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_card *card)
{
	int i, ret, count;
	unsigned char pending;
	struct sdio_func *func;

	/*
	 * Optimization, if there is only 1 function interrupt registered
	 * call irq handler directly
	 */
	func = card->sdio_single_irq;
	if (func) {
		func->irq_handler(func);
		return 1;
	}

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		return ret;
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
			func = card->sdio_func[i - 1];
			if (!func) {
				pr_warning("%s: pending IRQ for "
					"non-existent function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
				func->irq_handler(func);
				count++;
			} else {
				pr_warning("%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}

	if (count)
		return count;

	return ret;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:48,代码来源:sdio_irq.c


示例7: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_card *card)
{
	int i, ret, count;
	unsigned char pending;

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		printk(KERN_DEBUG "%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		sdio_debug = 1;
		return ret;
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
			struct sdio_func *func = card->sdio_func[i - 1];
			if (!func) {
				printk(KERN_WARNING "%s: pending IRQ for "
					"non-existant function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
				if (sdio_debug) {
					printk(KERN_DEBUG "%s: pending irq for func%d\n",
				       mmc_card_id(card), i);
				}
				func->irq_handler(func);
				count++;
			} else {
				printk(KERN_WARNING "%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}
	if (sdio_debug) {
		printk(KERN_DEBUG "%s: pending irq 0x%x\n",
	       mmc_card_id(card), pending);
		sdio_debug = 0;
	}

	if (count)
		return count;

	return ret;
}
开发者ID:AmeriCanAndroid,项目名称:kernel-android-msm-2.6.35,代码行数:47,代码来源:sdio_irq.c


示例8: woal_sdio_resume

/**  @brief This function handles client driver resume
 *  
 *  @param dev	   A pointer to device structure
 *  @return 	   MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
int
woal_sdio_resume(struct device *dev)
{
    struct sdio_func *func = dev_to_sdio_func(dev);
    mmc_pm_flag_t pm_flags = 0;
    moal_handle *handle = NULL;
    struct sdio_mmc_card *cardp;
    int i;

    ENTER();

    if (func) {
        pm_flags = sdio_get_host_pm_caps(func);
        PRINTM(MCMND, "%s: resume: PM flags = 0x%x\n", sdio_func_id(func),
               pm_flags);
        cardp = sdio_get_drvdata(func);
        if (!cardp || !cardp->handle) {
            PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
            LEAVE();
            return MLAN_STATUS_SUCCESS;
        }
    } else {
        PRINTM(MERROR, "sdio_func is not specified\n");
        LEAVE();
        return MLAN_STATUS_SUCCESS;
    }
    handle = cardp->handle;

    if (handle->is_suspended == MFALSE) {
        PRINTM(MWARN, "Device already resumed\n");
        LEAVE();
        return MLAN_STATUS_SUCCESS;
    }

    handle->is_suspended = MFALSE;
    for (i = 0; i < handle->priv_num; i++)
        netif_carrier_on(handle->priv[i]->netdev);

    /* Disable Host Sleep */
    woal_hs_cfg_cancel(woal_get_priv(handle, MLAN_BSS_TYPE_ANY), MOAL_NO_WAIT);

    LEAVE();
    return MLAN_STATUS_SUCCESS;

}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:50,代码来源:moal_sdio_mmc.c


示例9: sdio_release_irq

/**
 *	sdio_release_irq - release the IRQ for a SDIO function
 *	@func: SDIO function
 *
 *	Disable and release the IRQ for the given SDIO function.
 */
int sdio_release_irq(struct sdio_func *func)
{
	int ret;
	unsigned char reg;

	BUG_ON(!func);
	BUG_ON(!func->card);

	pr_debug("SDIO: Disabling IRQ for %s...\n", sdio_func_id(func));


#ifndef CONFIG_HUAWEI_WIFI_SDCC
	if (func->irq_handler) {
		func->irq_handler = NULL;
		sdio_card_irq_put(func->card);
	}

#endif

	ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IENx, 0, &reg);
	if (ret)
		return ret;

	reg &= ~(1 << func->num);

	/* Disable master interrupt with the last function interrupt */
	if (!(reg & 0xFE))
		reg = 0;

	ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, reg, NULL);
	if (ret)
		return ret;


#ifdef CONFIG_HUAWEI_WIFI_SDCC

	if (func->irq_handler) {
		func->irq_handler = NULL;
		sdio_card_irq_put(func->card);
	}
#endif

	return 0;
}
开发者ID:AntonioPT,项目名称:u8150-kernel-pulse-port,代码行数:50,代码来源:sdio_irq.c


示例10: woal_sdio_resume

/**  @brief This function handles client driver resume
 *
 *  @param dev      A pointer to device structure
 *  @return         MLAN_STATUS_SUCCESS
 */
int
woal_sdio_resume(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);
	mmc_pm_flag_t pm_flags = 0;
	moal_handle *handle = NULL;
	struct sdio_mmc_card *cardp;
	int i;

	ENTER();
	PRINTM(MCMND, "<--- Enter woal_sdio_resume --->\n");
	wifi_enable_hostwake_irq(MFALSE);
	pm_flags = sdio_get_host_pm_caps(func);
	PRINTM(MCMND, "%s: resume: PM flags = 0x%x\n", sdio_func_id(func),
	       pm_flags);
	cardp = sdio_get_drvdata(func);
	if (!cardp || !cardp->handle) {
		PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
		LEAVE();
		return MLAN_STATUS_SUCCESS;
	}
	handle = cardp->handle;

	if (handle->is_suspended == MFALSE) {
		PRINTM(MWARN, "Device already resumed\n");
		LEAVE();
		return MLAN_STATUS_SUCCESS;
	}
	handle->is_suspended = MFALSE;
	if (woal_check_driver_status(handle)) {
		PRINTM(MERROR, "Resuem, device is in hang state\n");
		LEAVE();
		return MLAN_STATUS_SUCCESS;
	}
	for (i = 0; i < handle->priv_num; i++)
		netif_device_attach(handle->priv[i]->netdev);

	/* Disable Host Sleep */
	woal_cancel_hs(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MOAL_NO_WAIT);
	PRINTM(MCMND, "<--- Leave woal_sdio_resume --->\n");
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
开发者ID:acorn-marvell,项目名称:brillo_pxa_kernel,代码行数:48,代码来源:moal_sdio_mmc.c


示例11: bt_sdio_resume

/**  @brief This function handles client driver resume
 *  
 *  @param dev	   A pointer to device structure
 *  @return 	   BT_STATUS_SUCCESS
 */
int
bt_sdio_resume(struct device *dev)
{
    struct sdio_func *func = dev_to_sdio_func(dev);
    mmc_pm_flag_t pm_flags = 0;
    bt_private *priv = NULL;
    struct sdio_mmc_card *cardp;
    struct hci_dev *hcidev;

    ENTER();
    if (func) {
        pm_flags = sdio_get_host_pm_caps(func);
        PRINTM(CMD, "BT: %s: resume: PM flags = 0x%x\n", sdio_func_id(func),
               pm_flags);
        cardp = sdio_get_drvdata(func);
        if (!cardp || !cardp->priv) {
            PRINTM(ERROR, "BT: Card or priv structure is not valid\n");
            LEAVE();
            return BT_STATUS_SUCCESS;
        }
    } else {
        PRINTM(ERROR, "BT: sdio_func is not specified\n");
        LEAVE();
        return BT_STATUS_SUCCESS;
    }
    priv = cardp->priv;
    priv->adapter->is_suspended = FALSE;
    hcidev = priv->bt_dev.hcidev;
    PRINTM(CMD, "BT %s: SDIO resume\n", hcidev->name);
    hci_resume_dev(hcidev);
    sbi_wakeup_firmware(priv);
    priv->adapter->hs_state = HS_DEACTIVATED;
    PRINTM(CMD, "BT:%s: HS DEACTIVATED in Resume!\n", hcidev->name);
    LEAVE();
    return BT_STATUS_SUCCESS;
}
开发者ID:12019,项目名称:miniature-octo-tribble,代码行数:41,代码来源:bt_sdiommc.c


示例12: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_host *host)
{
	struct mmc_card *card = host->card;
	int i, ret, count;
	unsigned char pending;
	struct sdio_func *func;

	/*
	 * Optimization, if there is only 1 function interrupt registered
	 * and we know an IRQ was signaled then call irq handler directly.
	 * Otherwise do the full probe.
	 */
	func = card->sdio_single_irq;
	if (func && host->sdio_irq_pending) {
		func->irq_handler(func);
		return 1;
	}

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		return ret;
	}

	if (pending && mmc_card_broken_irq_polling(card) &&
	    !(host->caps & MMC_CAP_SDIO_IRQ)) {
		unsigned char dummy;

		/* A fake interrupt could be created when we poll SDIO_CCCR_INTx
		 * register with a Marvell SD8797 card. A dummy CMD52 read to
		 * function 0 register 0xff can avoid this.
		 */
		mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy);
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
			func = card->sdio_func[i - 1];
			if (!func) {
				pr_warning("%s: pending IRQ for "
					"non-existent function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
				func->irq_handler(func);
				count++;
			} else {
				pr_warning("%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}

	if (count)
		return count;

	return ret;
}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:61,代码来源:sdio_irq.c


示例13: sdio_irq_thread


//.........这里部分代码省略.........
					    "ksdioirqd/%s", mmc_hostname(host));
			if (IS_ERR(host->sdio_irq_thread)) {
				int err = PTR_ERR(host->sdio_irq_thread);
				host->sdio_irqs--;
				return err;
			}
		} else {
			mmc_host_clk_hold(host);
			host->ops->enable_sdio_irq(host, 1);
			mmc_host_clk_release(host);
		}
	}

	return 0;
}

static int sdio_card_irq_put(struct mmc_card *card)
{
	struct mmc_host *host = card->host;

	WARN_ON(!host->claimed);
	BUG_ON(host->sdio_irqs < 1);

	if (!--host->sdio_irqs) {
		if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
			atomic_set(&host->sdio_irq_thread_abort, 1);
			kthread_stop(host->sdio_irq_thread);
		} else {
			mmc_host_clk_hold(host);
			host->ops->enable_sdio_irq(host, 0);
			mmc_host_clk_release(host);
		}
	}

	return 0;
}

/* If there is only 1 function registered set sdio_single_irq */
static void sdio_single_irq_set(struct mmc_card *card)
{
	struct sdio_func *func;
	int i;

	card->sdio_single_irq = NULL;
	if ((card->host->caps & MMC_CAP_SDIO_IRQ) &&
	    card->host->sdio_irqs == 1)
		for (i = 0; i < card->sdio_funcs; i++) {
		       func = card->sdio_func[i];
		       if (func && func->irq_handler) {
			       card->sdio_single_irq = func;
			       break;
		       }
	       }
}

/**
 *	sdio_claim_irq - claim the IRQ for a SDIO function
 *	@func: SDIO function
 *	@handler: IRQ handler callback
 *
 *	Claim and activate the IRQ for the given SDIO function. The provided
 *	handler will be called when that IRQ is asserted.  The host is always
 *	claimed already when the handler is called so the handler must not
 *	call sdio_claim_host() nor sdio_release_host().
 */
int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler)
{
	int ret;
	unsigned char reg;

	BUG_ON(!func);
	BUG_ON(!func->card);

	pr_debug("SDIO: Enabling IRQ for %s...\n", sdio_func_id(func));

	if (func->irq_handler) {
		pr_debug("SDIO: IRQ for %s already in use.\n", sdio_func_id(func));
		return -EBUSY;
	}

	ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IENx, 0, &reg);
	if (ret)
		return ret;

	reg |= 1 << func->num;

	reg |= 1; /* Master interrupt enable */

	ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, reg, NULL);
	if (ret)
		return ret;

	func->irq_handler = handler;
	ret = sdio_card_irq_get(func->card);
	if (ret)
		func->irq_handler = NULL;
	sdio_single_irq_set(func->card);

	return ret;
}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:101,代码来源:sdio_irq.c


示例14: woal_sdio_suspend

/**  @brief This function handles client driver suspend
 *
 *  @param dev      A pointer to device structure
 *  @return         MLAN_STATUS_SUCCESS or error code
 */
int
woal_sdio_suspend(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);
	mmc_pm_flag_t pm_flags = 0;
	moal_handle *handle = NULL;
	struct sdio_mmc_card *cardp;
	int i, retry_num = 8;
	int ret = MLAN_STATUS_SUCCESS;
	int hs_actived = 0;
	mlan_ds_ps_info pm_info;

	ENTER();
	PRINTM(MCMND, "<--- Enter woal_sdio_suspend --->\n");
	pm_flags = sdio_get_host_pm_caps(func);
	PRINTM(MCMND, "%s: suspend: PM flags = 0x%x\n", sdio_func_id(func),
	       pm_flags);
	if (!(pm_flags & MMC_PM_KEEP_POWER)) {
		PRINTM(MERROR,
		       "%s: cannot remain alive while host is suspended\n",
		       sdio_func_id(func));
		LEAVE();
		return -ENOSYS;
	}
	cardp = sdio_get_drvdata(func);
	if (!cardp || !cardp->handle) {
		PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
		LEAVE();
		return MLAN_STATUS_SUCCESS;
	}

	handle = cardp->handle;
	if (handle->is_suspended == MTRUE) {
		PRINTM(MWARN, "Device already suspended\n");
		LEAVE();
		return MLAN_STATUS_SUCCESS;
	}
	if (handle->fw_dump) {
		PRINTM(MMSG, "suspend not allowed while FW dump!");
		ret = -EBUSY;
		goto done;
	}
	handle->suspend_fail = MFALSE;
	memset(&pm_info, 0, sizeof(pm_info));
	for (i = 0; i < retry_num; i++) {
		if (MLAN_STATUS_SUCCESS ==
		    woal_get_pm_info(woal_get_priv(handle, MLAN_BSS_ROLE_ANY),
				     &pm_info)) {
			if (pm_info.is_suspend_allowed == MTRUE)
				break;
			else
				PRINTM(MMSG,
				       "Suspend not allowed and retry again\n");
		}
		woal_sched_timeout(100);
	}
	if (pm_info.is_suspend_allowed == MFALSE) {
		PRINTM(MMSG, "Suspend not allowed\n");
		ret = -EBUSY;
		goto done;
	}

	for (i = 0; i < handle->priv_num; i++)
		netif_device_detach(handle->priv[i]->netdev);

	if (pm_keep_power) {
		/* Enable the Host Sleep */
#ifdef MMC_PM_FUNC_SUSPENDED
		handle->suspend_notify_req = MTRUE;
#endif
		hs_actived =
			woal_enable_hs(woal_get_priv
				       (handle, MLAN_BSS_ROLE_ANY));
#ifdef MMC_PM_FUNC_SUSPENDED
		handle->suspend_notify_req = MFALSE;
#endif
		if (hs_actived) {
#ifdef MMC_PM_SKIP_RESUME_PROBE
			PRINTM(MCMND,
			       "suspend with MMC_PM_KEEP_POWER and MMC_PM_SKIP_RESUME_PROBE\n");
			ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER |
						     MMC_PM_SKIP_RESUME_PROBE);
#else
			PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER\n");
			ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
#endif
		} else {
			PRINTM(MMSG, "HS not actived, suspend fail!");
			handle->suspend_fail = MTRUE;
			for (i = 0; i < handle->priv_num; i++)
				netif_device_attach(handle->priv[i]->netdev);
			ret = -EBUSY;
			goto done;
		}
	}
//.........这里部分代码省略.........
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:101,代码来源:moal_sdio_mmc.c


示例15: smssdio_probe

static int smssdio_probe(struct sdio_func *func,
                         const struct sdio_device_id *id)
{
    int ret;

    int board_id;
    struct smssdio_device *smsdev;
    struct smsdevice_params_t params;

    board_id = id->driver_data;

    smsdev = kzalloc(sizeof(struct smssdio_device), GFP_KERNEL);
    if (!smsdev)
        return -ENOMEM;

    smsdev->func = func;

    memset(&params, 0, sizeof(struct smsdevice_params_t));

    params.device = &func->dev;
    params.buffer_size = 0x5000;	/* ?? */
    params.num_buffers = 22;	/* ?? */
    params.context = smsdev;

    snprintf(params.devpath, sizeof(params.devpath),
             "sdio\\%s", sdio_func_id(func));

    params.sendrequest_handler = smssdio_sendrequest;

    params.device_type = sms_get_board(board_id)->type;

    if (params.device_type != SMS_STELLAR)
        params.flags |= SMS_DEVICE_FAMILY2;
    else {
        /*
         * FIXME: Stellar needs special handling...
         */
        ret = -ENODEV;
        goto free;
    }

    ret = smscore_register_device(&params, &smsdev->coredev);
    if (ret < 0)
        goto free;

    smscore_set_board_id(smsdev->coredev, board_id);

    sdio_claim_host(func);

    ret = sdio_enable_func(func);
    if (ret)
        goto release;

    ret = sdio_set_block_size(func, 128);
    if (ret)
        goto disable;

    ret = sdio_claim_irq(func, smssdio_interrupt);
    if (ret)
        goto disable;

    sdio_set_drvdata(func, smsdev);

    sdio_release_host(func);

    ret = smscore_start_device(smsdev->coredev);
    if (ret < 0)
        goto reclaim;

    return 0;

reclaim:
    sdio_claim_host(func);
    sdio_release_irq(func);
disable:
    sdio_disable_func(func);
release:
    sdio_release_host(func);
    smscore_unregister_device(smsdev->coredev);
free:
    kfree(smsdev);

    return ret;
}
开发者ID:Herysutrisno,项目名称:mpc5200,代码行数:84,代码来源:smssdio.c


示例16: sdio_irq_thread


//.........这里部分代码省略.........
{
    struct mmc_host *host = card->host;

    WARN_ON(!host->claimed);

    if (!host->sdio_irqs++) {
        atomic_set(&host->sdio_irq_thread_abort, 0);
        host->sdio_irq_thread =
            kthread_run(sdio_irq_thread, host, "ksdioirqd/%s",
                        mmc_hostname(host));
        if (IS_ERR(host->sdio_irq_thread)) {
            int err = PTR_ERR(host->sdio_irq_thread);
            host->sdio_irqs--;
            return err;
        }
        if (host->caps & MMC_CAP_SDIO_IRQ) {
            mmc_host_clk_hold(host);
            host->ops->enable_sdio_irq(host, 1);
            mmc_host_clk_release(host);
        }
    }

    return 0;
}

static int sdio_card_irq_put(struct mmc_card *card)
{
    struct mmc_host *host = card->host;

    WARN_ON(!host->claimed);
    BUG_ON(host->sdio_irqs < 1);

    if (host->sdio_irqs == 1) {
        if (host->caps & MMC_CAP_SDIO_IRQ) {
            mmc_host_clk_hold(host);
            host->ops->enable_sdio_irq(host, 0);
            mmc_host_clk_release(host);
        }
    }

    if (!--host->sdio_irqs) {
        atomic_set(&host->sdio_irq_thread_abort, 1);
        kthread_stop(host->sdio_irq_thread);
    }

    return 0;
}

static void sdio_single_irq_set(struct mmc_card *card)
{
    struct sdio_func *func;
    int i;

    card->sdio_single_irq = NULL;
    if ((card->host->caps & MMC_CAP_SDIO_IRQ) &&
            card->host->sdio_irqs == 1)
        for (i = 0; i < card->sdio_funcs; i++) {
            func = card->sdio_func[i];
            if (func && func->irq_handler) {
                card->sdio_single_irq = func;
                break;
            }
        }
}

int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler)
{
    int ret;
    unsigned char reg;

    BUG_ON(!func);
    BUG_ON(!func->card);

    pr_debug("SDIO: Enabling IRQ for %s...\n", sdio_func_id(func));

    if (func->irq_handler) {
        pr_debug("SDIO: IRQ for %s already in use.\n", sdio_func_id(func));
        return -EBUSY;
    }

    ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IENx, 0, &reg);
    if (ret)
        return ret;

    reg |= 1 << func->num;

    reg |= 1;

    ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, reg, NULL);
    if (ret)
        return ret;

    func->irq_handler = handler;
    ret = sdio_card_irq_get(func->card);
    if (ret)
        func->irq_handler = NULL;
    sdio_single_irq_set(func->card);

    return ret;
}
开发者ID:ivanmeler,项目名称:android_kernel_htc_g3u,代码行数:101,代码来源:sdio_irq.c


示例17: bt_sdio_suspend

/**  @brief This function handles client driver suspend
 *  
 *  @param dev	   A pointer to device structure
 *  @return 	   BT_STATUS_SUCCESS or other error no.
 */
int
bt_sdio_suspend(struct device *dev)
{
    struct sdio_func *func = dev_to_sdio_func(dev);
    mmc_pm_flag_t pm_flags = 0;
    bt_private *priv = NULL;
    struct sdio_mmc_card *cardp;
    struct hci_dev *hcidev;

    ENTER();

    if (func) {
        pm_flags = sdio_get_host_pm_caps(func);
        PRINTM(CMD, "BT: %s: suspend: PM flags = 0x%x\n", sdio_func_id(func),
               pm_flags);
        if (!(pm_flags & MMC_PM_KEEP_POWER)) {
            PRINTM(ERROR,
                   "BT: %s: cannot remain alive while host is suspended\n",
                   sdio_func_id(func));
            return -ENOSYS;
        }
        cardp = sdio_get_drvdata(func);
        if (!cardp || !cardp->priv) {
            PRINTM(ERROR, "BT: Card or priv structure is not valid\n");
            LEAVE();
            return BT_STATUS_SUCCESS;
        }
    } else {
        PRINTM(ERROR, "BT: sdio_func is not specified\n");
        LEAVE();
        return BT_STATUS_SUCCESS;
    }
    priv = cardp->priv;

    if ((pm_keep_power) && (priv->adapter->hs_state != HS_ACTIVATED)) {
        if (BT_STATUS_SUCCESS != bt_enable_hs(priv)) {
            PRINTM(CMD, "BT: HS not actived, suspend fail!\n");
            LEAVE();
            return -EBUSY;
        }
    }
    hcidev = priv->bt_dev.hcidev;
    PRINTM(CMD, "BT %s: SDIO suspend\n", hcidev->name);
    hci_suspend_dev(hcidev);
    skb_queue_purge(&priv->adapter->tx_queue);

    priv->adapter->is_suspended = TRUE;
    LEAVE();
    /* We will keep the power when hs enabled successfully */
    if ((pm_keep_power) && (priv->adapter->hs_state == HS_ACTIVATED)) {
#ifdef MMC_PM_SKIP_RESUME_PROBE
        PRINTM(CMD, "BT: suspend with MMC_PM_KEEP_POWER and "
               "MMC_PM_SKIP_RESUME_PROBE\n");
        return sdio_set_host_pm_flags(func,
                                      MMC_PM_KEEP_POWER |
                                      MMC_PM_SKIP_RESUME_PROBE);
#else
        PRINTM(CMD, "BT: suspend with MMC_PM_KEEP_POWER\n");
        return sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
#endif
    } else {
        PRINTM(CMD, "BT: suspend without MMC_PM_KEEP_POWER\n");
        return BT_STATUS_SUCCESS;
    }
}
开发者ID:12019,项目名称:miniature-octo-tribble,代码行数:70,代码来源:bt_sdiommc.c


示例18: process_sdio_pending_irqs

static int process_sdio_pending_irqs(struct mmc_card *card)
{
	int i, ret, count;
	unsigned char pending;
	struct sdio_func *func;
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [START]
	unsigned char reg;
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [END]

	/*
	 * Optimization, if there is only 1 function interrupt registered
	 * call irq handler directly
	 */
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [START]
#if 0
	func = card->sdio_single_irq;
	if (func) {
		func->irq_handler(func);
		return 1;
	}
#endif

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IENx, 0, &reg);
	if (ret) {
		printk(KERN_ERR "%s: error %d reading SDIO_CCCR_IENx\n",
				mmc_card_id(card), ret);
		return ret;
	}
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [END]

	ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
	if (ret) {
		printk(KERN_DEBUG "%s: error %d reading SDIO_CCCR_INTx\n",
		       mmc_card_id(card), ret);
		return ret;
	}

	count = 0;
	for (i = 1; i <= 7; i++) {
		if (pending & (1 << i)) {
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [START]
			if (!(reg & 0x1)) {
				pr_err("%s: Master interrupt is disabled but still "
					"we have pending interrupt, bug in h/w??\n", __func__);
				return -EINVAL;
			}
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [END]

			func = card->sdio_func[i - 1];
			if (!func) {
				printk(KERN_WARNING "%s: pending IRQ for "
					"non-existent function\n",
					mmc_card_id(card));
				ret = -EINVAL;
			} else if (func->irq_handler) {
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [START]
				if ((reg & (1 << func->num))) {
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [END]
				func->irq_handler(func);
				count++;
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [START]
				} else {
					pr_err("%s: Interrupt ocurred even when IEx "
						"bit is not set, bug in h/w??\n", mmc_card_id(card));
					ret = -EINVAL;
				}
// 20120317 [email protected][wo0gi] QCT patch : SDIO kernel crash [END]
			} else {
				printk(KERN_WARNING "%s: pending IRQ with no handler\n",
				       sdio_func_id(func));
				ret = -EINVAL;
			}
		}
	}

	if (count)
		return count;

	return ret;
}
开发者ID:CSRedRat,项目名称:CM-LG-L5_Kernel,代码行数:80,代码来源:sdio_irq.c


示例19: bt_sdio_suspend

/** @brief This function handles client driver suspend
 *
 *  @param dev	   A pointer to device structure
 *  @return        BT_STATUS_SUCCESS or other error no.
 */
int
bt_sdio_suspend(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);
	mmc_pm_flag_t pm_flags = 0;
	bt_private *priv = NULL;
	struct sdio_mmc_card *cardp;
	struct m_dev *m_dev = NULL;

	ENTER();

	pm_flags = sdio_get_host_pm_caps(func);
	PRINTM(CMD, "BT: %s: suspend: PM flags = 0x%x\n", sdio_func_id(func),
	       pm_flags);
	if (!(pm_flags & MMC_PM_KEEP_POWER)) {
		PRINTM(ERROR,
		       "BT: %s: cannot remain alive while host is suspended\n",
		       sdio_func_id(func));
		return -ENOSYS;
	}
	cardp = sdio_get_drvdata(func);
	if (!cardp || !cardp->priv) {
		PRINTM(ERROR, "BT: Card or priv structure is not valid\n");
		LEAVE();
		return BT_STATUS_SUCCESS;
	}

	priv = cardp->priv;

	if ((mbt_pm_keep_power) && (priv->adapter->hs_state != HS_ACTIVATED)) {
		/* disable FM event mask */
		if ((priv->bt_dev.m_dev[FM_SEQ].dev_type == FM_TYPE) &&
		    test_bit(HCI_RUNNING, &(priv->bt_dev.m_dev[FM_SEQ].flags)))
			fm_set_intr_mask(priv, FM_DISABLE_INTR_MASK);
		if (BT_STATUS_SUCCESS != bt_enable_hs(priv)) {
			PRINTM(CMD, "BT: HS not actived, suspend fail!\n");
			if (BT_STATUS_SUCCESS != bt_enable_hs(priv)) {
				PRINTM(CMD,
				       "BT: HS not actived the second time, force to suspend!\n");
			}
		}
	}
	m_dev = &(priv->bt_dev.m_dev[BT_SEQ]);
	PRINTM(CMD, "BT %s: SDIO suspend\n", m_dev->name);
	mbt_hci_suspend_dev(m_dev);
	skb_queue_purge(&priv->adapter->tx_queue);

	priv->adapter->is_suspended = TRUE;

	LEAVE();
	/* We will keep the power when hs enabled successfully */
	if ((mbt_pm_keep_power) && (priv->adapter->hs_state == HS_ACTIVATED)) {
#ifdef MMC_PM_SKIP_RESUME_PROBE
		PRINTM(CMD, "BT: suspend with MMC_PM_KEEP_POWER and "
		       "MMC_PM_SKIP_RESUME_PROBE\n");
		return sdio_set_host_pm_flags(func,
					      MMC_PM_KEEP_POWER |
					      MMC_PM_SKIP_RESUME_PROBE);
#else
		PRINTM(CMD, "BT: suspend with MMC_PM_KEEP_POWER\n");
		return sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
#endif
	} else {
		PRINTM(CMD, "BT: suspend without MMC_PM_KEEP_POWER\n");
		return BT_STATUS_SUCCESS;
	}
}
开发者ID:acorn-marvell,项目名称:brillo_pxa_kernel,代码行数:72,代码来源:bt_sdiommc.c



注:本文中的sdio_func_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sdio_memcpy_toio函数代码示例发布时间:2022-05-30
下一篇:
C++ sdio_enable_func函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap