Переглянути джерело

soc: soundwire: Add support for GPIO interrupt path

In trinket target, interrupt for wakeup is provided via
chip TLMM. Add required support to handle wakeup
interrupt on SWR data line triggered over this TLMM line.

Change-Id: I7fb6d7009a6271d54d0f11f99930b0d039f57129
Signed-off-by: Laxminath Kasam <[email protected]>
Laxminath Kasam 6 роки тому
батько
коміт
a60239e354
1 змінених файлів з 21 додано та 8 видалено
  1. 21 8
      soc/swr-mstr-ctrl.c

+ 21 - 8
soc/swr-mstr-ctrl.c

@@ -14,6 +14,8 @@
 #include <linux/kthread.h>
 #include <linux/kthread.h>
 #include <linux/bitops.h>
 #include <linux/bitops.h>
 #include <linux/clk.h>
 #include <linux/clk.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of.h>
 #include <linux/debugfs.h>
 #include <linux/debugfs.h>
@@ -2168,17 +2170,28 @@ static int swrm_device_down(struct device *dev)
 int swrm_register_wake_irq(struct swr_mstr_ctrl *swrm)
 int swrm_register_wake_irq(struct swr_mstr_ctrl *swrm)
 {
 {
 	int ret = 0;
 	int ret = 0;
+	int irq, dir_apps_irq;
 
 
 	if (!swrm->ipc_wakeup) {
 	if (!swrm->ipc_wakeup) {
-		swrm->wake_irq = platform_get_irq_byname(swrm->pdev,
-					"swr_wake_irq");
-		if (swrm->wake_irq < 0) {
-			dev_err(swrm->dev,
-				"%s() error getting wake irq handle: %d\n",
-				__func__, swrm->wake_irq);
-			return -EINVAL;
+		irq = of_get_named_gpio(swrm->dev->of_node,
+					"qcom,swr-wakeup-irq", 0);
+		if (gpio_is_valid(irq)) {
+			swrm->wake_irq = gpio_to_irq(irq);
+			if (swrm->wake_irq < 0) {
+				dev_err(swrm->dev,
+					"Unable to configure irq\n");
+				return swrm->wake_irq;
+			}
+		} else {
+			dir_apps_irq = platform_get_irq_byname(swrm->pdev,
+							"swr_wake_irq");
+			if (dir_apps_irq < 0) {
+				dev_err(swrm->dev,
+					"TLMM connect gpio not found\n");
+				return -EINVAL;
+			}
+			swrm->wake_irq = dir_apps_irq;
 		}
 		}
-
 		ret = request_threaded_irq(swrm->wake_irq, NULL,
 		ret = request_threaded_irq(swrm->wake_irq, NULL,
 					   swrm_wakeup_interrupt,
 					   swrm_wakeup_interrupt,
 					   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
 					   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,