コード例 #1
0
static void tegra_sdhci_status_notify_cb(int card_present, void *dev_id)
{
	struct sdhci_host *sdhci = (struct sdhci_host *)dev_id;
	pr_debug("%s: card_present %d\n",
		mmc_hostname(sdhci->mmc), card_present);
	sdhci_card_detect_callback(sdhci);
}
コード例 #2
0
ファイル: sdhci-tegra.c プロジェクト: marcero/hannspad-kernel
void sdhci_tegra_card_detect(unsigned long data)
{
        struct mmc_host *mmc = (struct mmc_host *)data;
        struct sdhci_host *sdhost = mmc_priv(mmc);
        struct tegra_sdhci *host = sdhci_priv(sdhost);

        if(host->gpio_cd != -1) {
                int cur_status = (gpio_get_value(host->gpio_cd)==host->gpio_polarity_cd);

                if(cur_status != host->card_present) { /* Card is attached, but card_present indicates un-plug */
                        printk("mchi : original status : %s, but now : %s =============\n", 
                               host->card_present?"plug-in":"un-plug", 
                               cur_status?"plug-in":"un-plug");
                        host->card_present = (gpio_get_value(host->gpio_cd)==host->gpio_polarity_cd);
                        
                        if(host->gpio_en!=-1)
                        {
                                gpio_set_value(host->gpio_en,host->card_present?host->gpio_polarity_en:!host->gpio_polarity_en);
                        }
                        smp_wmb();

                        sdhci_card_detect_callback(sdhost);
                }

                /* Ok, enable the interrupt */
                atomic_set(&detect_lock, 0);
        }

        printk("\n");
}
コード例 #3
0
static irqreturn_t carddetect_irq(int irq, void *data)
{
	struct sdhci_host *sdhost = (struct sdhci_host *)data;

	sdhci_card_detect_callback(sdhost);
	return IRQ_HANDLED;
};
コード例 #4
0
ファイル: sdhci-tegra.c プロジェクト: marcero/hannspad-kernel
static irqreturn_t card_detect_isr(int irq, void *dev_id)
{
	struct sdhci_host *sdhost = dev_id;
	struct tegra_sdhci *host = sdhci_priv(sdhost);

#ifdef MMC_PATCH_1
	if(atomic_add_return(1, &detect_lock) != 1) {
                return IRQ_HANDLED;   /* indicates the last attach/detach does not finish */
        }
#endif
        
	host->card_present =
		(gpio_get_value(host->gpio_cd)==host->gpio_polarity_cd);
        if(host->gpio_en!=-1)
        {
                gpio_set_value(host->gpio_en,host->card_present?host->gpio_polarity_en:!host->gpio_polarity_en);
        }
	smp_wmb();
	sdhci_card_detect_callback(sdhost);
	return IRQ_HANDLED;
}