Skip to contentSkip to conversation

remove twl4030-pwrirq.c

PATCH In review David Brownell 1 participant 1 message Oct 10, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/6 remove twl4030-pwrirq.c

From: David Brownell <[email protected]>

Replace twl4030-pwrirq with the more capable generic TWL SIH support.

"More capable" includes standard support for IRQ trigger modes; so make the RTC and USB transceiver drivers use genirq for that.

---
 drivers/i2c/chips/Makefile         |    2 
 drivers/i2c/chips/twl4030-pwrirq.c |  191 -----------------------------------
 drivers/i2c/chips/twl4030-usb.c    |   23 ----
 drivers/mfd/twl4030-irq.c          |    7 +
 drivers/rtc/rtc-twl4030.c          |   19 ---
 5 files changed, 15 insertions(+), 227 deletions(-)
drivers/i2c/chips/Makefile +1 -1
@@ -24,7 +24,7 @@ obj-$(CONFIG_GPIOEXPANDER_OMAP)	+= gpio_
 obj-$(CONFIG_MENELAUS)		+= menelaus.o
 obj-$(CONFIG_SENSORS_TSL2550)	+= tsl2550.o
 obj-$(CONFIG_SENSORS_TSL2563)	+= tsl2563.o
-obj-$(CONFIG_TWL4030_CORE)	+= twl4030-pwrirq.o twl4030-power.o
+obj-$(CONFIG_TWL4030_CORE)	+= twl4030-power.o
 obj-$(CONFIG_TWL4030_USB)	+= twl4030-usb.o
 obj-$(CONFIG_TWL4030_POWEROFF)	+= twl4030-poweroff.o
 obj-$(CONFIG_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
drivers/i2c/chips/twl4030-pwrirq.c deleted +0 -191

191 lines not on this page · raw message

drivers/i2c/chips/twl4030-usb.c +5 -18
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -409,23 +410,9 @@ static void twl4030_i2c_access(struct tw
 	}
 }
 
-static void usb_irq_enable(struct twl4030_usb *twl, int rising, int falling)
+static void usb_irq_enable(struct twl4030_usb *twl, int trigger)
 {
-	u8 val;
-
-	/* FIXME use set_irq_type(...) when that (soon) works */
-
-	/* edge setup */
-	WARN_ON(twl4030_i2c_read_u8(TWL4030_MODULE_INT,
-				&val, REG_PWR_EDR1) < 0);
-
-	val &= ~(USB_PRES_RISING | USB_PRES_FALLING);
-	if (rising)
-		val = val | USB_PRES_RISING;
-	if (falling)
-		val = val | USB_PRES_FALLING;
-	WARN_ON(twl4030_i2c_write_u8_verify(twl, TWL4030_MODULE_INT,
-				val, REG_PWR_EDR1) < 0);
+	set_irq_type(twl->irq, trigger);
 
 	if (!twl->irq_enabled) {
 		enable_irq(twl->irq);
@@ -469,7 +456,7 @@ static void twl4030_phy_suspend(struct t
 
 	if (!controller_off)
 		/* enable rising edge interrupt to detect cable attach */
-		usb_irq_enable(twl, 1, 0);
+		usb_irq_enable(twl, IRQ_TYPE_EDGE_RISING);
 
 	twl4030_phy_power(twl, 0);
 	twl->asleep = 1;
@@ -481,7 +468,7 @@ static void twl4030_phy_resume(struct tw
 		return;
 
 	/* enable falling edge interrupt to detect cable detach */
-	usb_irq_enable(twl, 0, 1);
+	usb_irq_enable(twl, IRQ_TYPE_EDGE_FALLING);
 
 	twl4030_phy_power(twl, 1);
 	twl4030_i2c_access(twl, 1);
drivers/mfd/twl4030-irq.c +7 -0
@@ -704,6 +704,13 @@ int twl_init_irq(int irq_num, unsigned i
 	pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", "PIH",
 			irq_num, irq_base, twl4030_irq_next - 1);
 
+	/* ... and the PWR_INT module ... */
+	status = twl4030_sih_setup(TWL4030_MODULE_INT);
+	if (status < 0) {
+		pr_err("twl4030: sih_setup PWR INT --> %d\n", status);
+		goto fail;
+	}
+
 	/* install an irq handler to demultiplex the TWL4030 interrupt */
 	task = start_twl4030_irq_thread(irq_num);
 	if (!task) {
drivers/rtc/rtc-twl4030.c +2 -17
@@ -447,7 +447,8 @@ static int __devinit twl4030_rtc_probe(s
 		goto out1;
 
 	ret = request_irq(irq, twl4030_rtc_interrupt,
-				0, rtc->dev.bus_id, rtc);
+				IRQF_TRIGGER_RISING,
+				rtc->dev.bus_id, rtc);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "IRQ is not free.\n");
 		goto out1;
@@ -466,22 +467,6 @@ static int __devinit twl4030_rtc_probe(s
 			goto out2;
 	}
 
-	/* FIXME stop touching MODULE_INT registers; there's already
-	 * driver code responsible for them.
-	 */
-
-	/* use rising edge detection for RTC alarm */
-	ret = twl4030_i2c_read_u8(TWL4030_MODULE_INT,
-			&rd_reg, TWL4030_INT_PWR_EDR1);
-	if (ret < 0)
-		goto out2;
-
-	rd_reg |= BIT(3);
-	ret = twl4030_i2c_write_u8(TWL4030_MODULE_INT,
-			rd_reg, TWL4030_INT_PWR_EDR1);
-	if (ret < 0)
-		goto out2;
-
 	/* init cached IRQ enable bits */
 	ret = twl4030_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)