本文整理汇总了C++中dev_to_sdio_func函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_to_sdio_func函数的具体用法?C++ dev_to_sdio_func怎么用?C++ dev_to_sdio_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dev_to_sdio_func函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ath6kl_hifdev_suspend
static int ath6kl_hifdev_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
int status = 0;
struct hif_device *device;
device = ath6kl_get_hifdev(func);
if (device && device->claimedContext &&
osdrvCallbacks.deviceSuspendHandler) {
/* set true first for PowerStateChangeNotify(..) */
device->is_suspend = true;
status = osdrvCallbacks.
deviceSuspendHandler(device->claimedContext);
if (status)
device->is_suspend = false;
}
CleanupHIFScatterResources(device);
switch (status) {
case 0:
return 0;
case A_EBUSY:
/* Hack for kernel in order to support deep sleep and wow */
return -EBUSY;
default:
return -1;
}
}
示例2: wl1271_suspend
static int wl1271_suspend(struct device *dev)
{
/* Tell MMC/SDIO core it's OK to power down the card
* (if it isn't already), but not to remove it completely */
struct sdio_func *func = dev_to_sdio_func(dev);
struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
struct wl1271 *wl = platform_get_drvdata(glue->core);
mmc_pm_flag_t sdio_flags;
int ret = 0;
dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n",
wl->wow_enabled);
/* check whether sdio should keep power */
if (wl->wow_enabled) {
sdio_flags = sdio_get_host_pm_caps(func);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
dev_err(dev, "can't keep power while host "
"is suspended\n");
ret = -EINVAL;
goto out;
}
/* keep power while host suspended */
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
dev_err(dev, "error while trying to keep power\n");
goto out;
}
}
out:
return ret;
}
示例3: wl12xx_sdio_power_on
static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
{
int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
ret = pm_runtime_get_sync(&card->dev);
if (ret < 0) {
pm_runtime_put_noidle(&card->dev);
dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
__func__, ret);
return ret;
}
sdio_claim_host(func);
/*
* To guarantee that the SDIO card is power cycled, as required to make
* the FW programming to succeed, let's do a brute force HW reset.
*/
mmc_hw_reset(card->host);
sdio_enable_func(func);
sdio_release_host(func);
return 0;
}
示例4: brcmf_sdio_suspend
static int brcmf_sdio_suspend(struct device *dev)
{
mmc_pm_flag_t sdio_flags;
struct brcmf_sdio_dev *sdiodev;
struct sdio_func *func = dev_to_sdio_func(dev);
int ret = 0;
brcmf_dbg(TRACE, "\n");
sdiodev = dev_get_drvdata(&func->card->dev);
atomic_set(&sdiodev->suspend, true);
sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
brcmf_dbg(ERROR, "Host can't keep power while suspended\n");
return -EINVAL;
}
ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER);
if (ret) {
brcmf_dbg(ERROR, "Failed to set pm_flags\n");
return ret;
}
brcmf_sdio_wdtmr_enable(sdiodev, false);
return ret;
}
示例5: 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 m_dev *m_dev = NULL;
ENTER();
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;
}
priv = cardp->priv;
priv->adapter->is_suspended = FALSE;
m_dev = &(priv->bt_dev.m_dev[BT_SEQ]);
PRINTM(CMD, "BT %s: SDIO resume\n", m_dev->name);
mbt_hci_resume_dev(m_dev);
sbi_wakeup_firmware(priv);
/* enable 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_DEFAULT_INTR_MASK);
priv->adapter->hs_state = HS_DEACTIVATED;
PRINTM(CMD, "BT:%s: HS DEACTIVATED in Resume!\n", m_dev->name);
LEAVE();
return BT_STATUS_SUCCESS;
}
示例6: mwifiex_sdio_resume
/*
* SDIO resume.
*
* 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 resumed, this function turns on the traffic and
* sends a host sleep cancel request to the firmware.
*/
static int mwifiex_sdio_resume(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;
if (func) {
pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_err("resume: invalid card or adapter\n");
return 0;
}
} else {
pr_err("resume: sdio_func is not specified\n");
return 0;
}
adapter = card->adapter;
if (!adapter->is_suspended) {
dev_warn(adapter->dev, "device already resumed\n");
return 0;
}
adapter->is_suspended = false;
/* Disable Host Sleep */
mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
MWIFIEX_ASYNC_CMD);
return 0;
}
示例7: rtw_sdio_resume
static int rtw_sdio_resume(struct device *dev)
{
struct sdio_func *func =dev_to_sdio_func(dev);
struct dvobj_priv *psdpriv = sdio_get_drvdata(func);
_adapter *padapter = psdpriv->padapter;
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
int ret = 0;
if(pwrpriv->bInternalAutoSuspend ){
ret = rtw_resume_process(padapter);
} else {
#ifdef CONFIG_RESUME_IN_WORKQUEUE
rtw_resume_in_workqueue(pwrpriv);
#elif defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
if(rtw_is_earlysuspend_registered(pwrpriv)) {
//jeff: bypass resume here, do in late_resume
pwrpriv->do_late_resume = _TRUE;
} else {
ret = rtw_resume_process(padapter);
}
#else // Normal resume process
ret = rtw_resume_process(padapter);
#endif //CONFIG_RESUME_IN_WORKQUEUE
}
return ret;
}
示例8: wl12xx_sdio_power_on
static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
{
int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
ret = pm_runtime_get_sync(&card->dev);
if (ret) {
/*
* Runtime PM might be temporarily disabled, or the device
* might have a positive reference counter. Make sure it is
* really powered on.
*/
ret = mmc_power_restore_host(card->host);
if (ret < 0) {
pm_runtime_put_sync(&card->dev);
goto out;
}
}
sdio_claim_host(func);
sdio_enable_func(func);
sdio_release_host(func);
out:
return ret;
}
示例9: woal_sdio_shutdown
/** @brief This function handles client driver shutdown
*
* @param dev A pointer to device structure
* @return N/A
*/
void
woal_sdio_shutdown(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
moal_handle *handle = NULL;
struct sdio_mmc_card *cardp;
mlan_ds_hs_cfg hscfg;
int timeout = 0;
int i;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_shutdown --->\n");
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->handle) {
PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
LEAVE();
return;
}
handle = cardp->handle;
for (i = 0; i < handle->priv_num; i++)
netif_device_detach(handle->priv[i]->netdev);
if (shutdown_hs) {
memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg));
hscfg.is_invoke_hostcmd = MFALSE;
hscfg.conditions = SHUTDOWN_HOST_SLEEP_DEF_COND;
hscfg.gap = SHUTDOWN_HOST_SLEEP_DEF_GAP;
hscfg.gpio = SHUTDOWN_HOST_SLEEP_DEF_GPIO;
if (woal_set_get_hs_params
(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET,
MOAL_IOCTL_WAIT, &hscfg) == MLAN_STATUS_FAILURE) {
PRINTM(MERROR,
"Fail to set HS parameter in shutdown: 0x%x 0x%x 0x%x\n",
hscfg.conditions, hscfg.gap, hscfg.gpio);
goto done;
}
/* Enable Host Sleep */
handle->hs_activate_wait_q_woken = MFALSE;
memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg));
hscfg.is_invoke_hostcmd = MTRUE;
if (woal_set_get_hs_params
(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET,
MOAL_NO_WAIT, &hscfg) == MLAN_STATUS_FAILURE) {
PRINTM(MERROR,
"Request HS enable failed in shutdown\n");
goto done;
}
timeout =
wait_event_interruptible_timeout
(handle->hs_activate_wait_q,
handle->hs_activate_wait_q_woken, HS_ACTIVE_TIMEOUT);
if (handle->hs_activated == MTRUE)
PRINTM(MMSG, "HS actived in shutdown\n");
else
PRINTM(MMSG, "Fail to enable HS in shutdown\n");
}
done:
PRINTM(MCMND, "<--- Leave woal_sdio_shutdown --->\n");
LEAVE();
return;
}
示例10: hifDeviceResume
static int hifDeviceResume(struct device *dev)
{
HIF_DEVICE *device;
A_STATUS status = A_OK;
struct sdio_func *func = dev_to_sdio_func(dev);
device = getHifDevice(func);
status = HIFDoDeviceResume(device);
return A_SUCCESS(status) ? 0 : status;
}
示例11: wl1271_sdio_set_block_size
static void wl1271_sdio_set_block_size(struct device *child,
unsigned int blksz)
{
struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
struct sdio_func *func = dev_to_sdio_func(glue->dev);
sdio_claim_host(func);
sdio_set_block_size(func, blksz);
sdio_release_host(func);
}
示例12: brcmf_sdio_resume
static int brcmf_sdio_resume(struct device *dev)
{
struct brcmf_sdio_dev *sdiodev;
struct sdio_func *func = dev_to_sdio_func(dev);
sdiodev = dev_get_drvdata(&func->card->dev);
brcmf_sdio_wdtmr_enable(sdiodev, true);
atomic_set(&sdiodev->suspend, false);
return 0;
}
示例13: bcmsdh_sdmmc_suspend
static int bcmsdh_sdmmc_suspend(struct device *pdev)
{
struct sdio_func *func = dev_to_sdio_func(pdev);
mmc_pm_flag_t sdio_flags;
int ret = 0;
if (func->num != 2)
return 0;
sd_trace(("%s Enter\n", __FUNCTION__));
if (dhd_os_check_wakelock(bcmsdh_get_drvdata()))
return -EBUSY;
sdio_flags = sdio_get_host_pm_caps(func);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
sd_err(("%s: can't keep power while host is suspended\n", __FUNCTION__));
return -EINVAL;
}
/* keep power while host suspended */
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
sd_err(("%s: error while trying to keep power\n", __FUNCTION__));
return ret;
}
#if defined(OOB_INTR_ONLY)
bcmsdh_oob_intr_set(0);
#endif /* defined(OOB_INTR_ONLY) */
sdio_flags = sdio_get_host_pm_caps(func);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
sd_err(("can't keep power while host "
"is suspended\n", __FUNCTION__));
ret = -EINVAL;
goto out;
}
/* keep power while host suspended */
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
sd_err(("error while trying to keep power\n", __FUNCTION__));
goto out;
}
dhd_mmc_suspend = TRUE;
smp_mb();
out:
return ret;
}
示例14: woal_sdio_suspend
/** @brief This function handles client driver suspend
*
* @param dev A pointer to device structure
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
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;
int ret = MLAN_STATUS_SUCCESS;
int hs_actived = 0;
ENTER();
if (func) {
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;
}
} else {
PRINTM(MERROR, "sdio_func is not specified\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle = cardp->handle;
if (pm_keep_power) {
/* Enable the Host Sleep */
hs_actived = woal_enable_hs(woal_get_priv(handle, MLAN_BSS_TYPE_ANY));
if (hs_actived) {
PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER\n");
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
}
}
/* Indicate device suspended */
handle->is_suspended = MTRUE;
for (i = 0; i < handle->priv_num; i++)
netif_carrier_off(handle->priv[i]->netdev);
LEAVE();
return ret;
}
示例15: wl1271_suspend
static int wl1271_suspend(struct device *dev)
{
/* Tell MMC/SDIO core it's OK to power down the card
* (if it isn't already), but not to remove it completely */
struct sdio_func *func = dev_to_sdio_func(dev);
struct wl1271 *wl = sdio_get_drvdata(func);
mmc_pm_flag_t sdio_flags;
unsigned long flags;
bool abort;
int ret = 0;
/*
* if there is a pending irq work, we should abort the suspension.
* (irq might come between mac80211 suspension and our suspension)
* TODO: maybe remove it, since system will wake up anyway?
*/
spin_lock_irqsave(&wl->wl_lock, flags);
abort = !!test_bit(WL1271_FLAG_PENDING_WORK, &wl->flags);
spin_unlock_irqrestore(&wl->wl_lock, flags);
if (abort) {
wl1271_info("pending irq work - aborting suspend");
return -EBUSY;
}
/*
* we need to look into wl to tell which suspend method to use.
* we will have full power, ps mode, elp, and power off
*/
wl1271_info("%s: wow_enabled: %d", __func__, wl->wow_enabled);
if (wl->wow_enabled) {
sdio_flags = sdio_get_host_pm_caps(func);
wl1271_info("suspend PM flags = 0x%x", sdio_flags);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
wl1271_error("can't keep power while host "
"is suspended");
goto power_off;
}
/* keep power while host suspended */
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
wl1271_error("error while trying to keep power");
goto power_off;
}
/* release host */
sdio_release_host(func);
}
power_off:
return 0;
}