summaryrefslogtreecommitdiff
path: root/drivers/mmc/card/sdio_card.c
blob: fb0ebed465b34f4cbc0b4b4daf16ebb235500e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <linux/mmc/sd.h>
#include <linux/mmc/mmc.h>
#include <linux/pm_runtime.h>

#ifdef CONFIG_PM_RUNTIME

#define DRV_NAME "sprd-sdio-card"

static int sprd_sdio_card_probe(struct mmc_card *card) {
    struct mmc_host *host = card->host;
    if (mmc_card_sdio(card)) {
        if(host->caps & MMC_CAP_POWER_OFF_CARD) {
            pm_runtime_no_callbacks(&card->dev); // avoid default sdio bus runtime calling
            return 0;
        }
    }
    return -EINVAL;
}

static void sprd_sdio_card_remove(struct mmc_card *card) {
}

static struct mmc_driver sprd_sdio_card_driver = {
    .drv.name  = DRV_NAME,
    .probe         = sprd_sdio_card_probe,
    .remove      = sprd_sdio_card_remove,
};

static int __init sprd_sdio_card_init(void) {
    return mmc_register_driver(&sprd_sdio_card_driver);
}

static void __exit sprd_sdio_card_exit(void) {
    mmc_unregister_driver(&sprd_sdio_card_driver);
}

subsys_initcall(sprd_sdio_card_init);
module_exit(sprd_sdio_card_exit);

#endif