[PATCH 3/3] mfd: Enable Debounce logic for SD hotplug detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enable debounce logic in TWL6030 so that erroneous
disconnect/connect interrupts will be suppressed.

This will fix issue where SD card is either plugged
or unplugged very slowly.

Change-Id: Icc3afa4c66b3bc7920f27ff9c9a3f32e67d5833c
Signed-off-by: Viswanath Puttagunta <vishp@xxxxxx>
---
 drivers/mfd/twl6030-irq.c |    8 ++++++++
 include/linux/i2c/twl.h   |    5 +++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index b76902f..05bb6e1 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -317,6 +317,14 @@ int twl6030_mmc_card_detect_config(void)
 									ret);
 		return ret;
 	}
+	ret = twl_i2c_write_u8(TWL6030_MODULE_ID0,
+				(MMC_MINS_DEB_MASK | MMC_MEXT_DEB_MASK),
+				TWL6030_MMCDEBOUNCING);
+	if (ret < 0) {
+		pr_err("twl6030: Failed to write MMC_MEXT_DEB_MASK %d\n",
+								ret);
+		return ret;
+	}
 
 	return twl6030_irq_base + MMCDETECT_INTR_OFFSET;
 }
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1f90de0..672dcfb 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -147,6 +147,11 @@
 #define SW_FC				(0x1 << 2)
 #define STS_MMC			0x1
 
+#define TWL6030_MMCDEBOUNCING		0xED
+#define MMC_DEB_BYPASS			(0x1 << 7)
+#define MMC_MINS_DEB_MASK		(0xF << 3)
+#define MMC_MEXT_DEB_MASK		(0x7 << 0)
+
 #define TWL6030_CFG_INPUT_PUPD3	0xF2
 #define MMC_PU				(0x1 << 3)
 #define MMC_PD				(0x1 << 2)
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux