Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357607
b: refs/heads/master
c: 504decc
h: refs/heads/master
i:
  357605: 3ae574e
  357603: b1bd11a
  357599: 155f087
v: v3
  • Loading branch information
Wei WANG authored and Samuel Ortiz committed Feb 13, 2013
1 parent e0838b6 commit 6d8fb2d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eebbe2541684da99bf0b179d5182dc8025f5f5b6
refs/heads/master: 504decc0a063e6a09a1e5b203ca68bc21dfffde9
31 changes: 19 additions & 12 deletions trunk/drivers/mfd/rtsx_pcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,33 +752,40 @@ static void rtsx_pci_card_detect(struct work_struct *work)
struct delayed_work *dwork;
struct rtsx_pcr *pcr;
unsigned long flags;
unsigned int card_detect = 0;
unsigned int card_detect = 0, card_inserted, card_removed;
u32 irq_status;

dwork = to_delayed_work(work);
pcr = container_of(dwork, struct rtsx_pcr, carddet_work);

dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__);

mutex_lock(&pcr->pcr_mutex);
spin_lock_irqsave(&pcr->lock, flags);

irq_status = rtsx_pci_readl(pcr, RTSX_BIPR);
dev_dbg(&(pcr->pci->dev), "irq_status: 0x%08x\n", irq_status);

if (pcr->card_inserted || pcr->card_removed) {
irq_status &= CARD_EXIST;
card_inserted = pcr->card_inserted & irq_status;
card_removed = pcr->card_removed;
pcr->card_inserted = 0;
pcr->card_removed = 0;

spin_unlock_irqrestore(&pcr->lock, flags);

if (card_inserted || card_removed) {
dev_dbg(&(pcr->pci->dev),
"card_inserted: 0x%x, card_removed: 0x%x\n",
pcr->card_inserted, pcr->card_removed);
card_inserted, card_removed);

if (pcr->ops->cd_deglitch)
pcr->card_inserted = pcr->ops->cd_deglitch(pcr);
card_inserted = pcr->ops->cd_deglitch(pcr);

card_detect = pcr->card_inserted | pcr->card_removed;
pcr->card_inserted = 0;
pcr->card_removed = 0;
card_detect = card_inserted | card_removed;
}

spin_unlock_irqrestore(&pcr->lock, flags);
mutex_unlock(&pcr->pcr_mutex);

if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event)
pcr->slots[RTSX_SD_CARD].card_event(
Expand Down Expand Up @@ -830,10 +837,6 @@ static irqreturn_t rtsx_pci_isr(int irq, void *dev_id)
}
}

if (pcr->card_inserted || pcr->card_removed)
schedule_delayed_work(&pcr->carddet_work,
msecs_to_jiffies(200));

if (int_reg & (NEED_COMPLETE_INT | DELINK_INT)) {
if (int_reg & (TRANS_FAIL_INT | DELINK_INT)) {
pcr->trans_result = TRANS_RESULT_FAIL;
Expand All @@ -846,6 +849,10 @@ static irqreturn_t rtsx_pci_isr(int irq, void *dev_id)
}
}

if (pcr->card_inserted || pcr->card_removed)
schedule_delayed_work(&pcr->carddet_work,
msecs_to_jiffies(200));

spin_unlock(&pcr->lock);
return IRQ_HANDLED;
}
Expand Down

0 comments on commit 6d8fb2d

Please sign in to comment.