Bladeren bron

Merge "soc: soundwire: Add support for GPIO interrupt path"

Linux Build Service Account 6 jaren geleden
bovenliggende
commit
af1fbf5fa2

+ 4 - 4
asoc/codecs/bolero/bolero-cdc.c

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/of_platform.h>
@@ -615,6 +615,9 @@ static int bolero_ssr_enable(struct device *dev, void *data)
 			BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, 0x0);
 
 	regcache_cache_only(priv->regmap, false);
+	mutex_lock(&priv->clk_lock);
+	priv->dev_up = true;
+	mutex_unlock(&priv->clk_lock);
 	/* call ssr event for supported macros */
 	for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
 		if (!priv->macro_params[macro_idx].event_handler)
@@ -623,9 +626,6 @@ static int bolero_ssr_enable(struct device *dev, void *data)
 			priv->component,
 			BOLERO_MACRO_EVT_SSR_UP, 0x0);
 	}
-	mutex_lock(&priv->clk_lock);
-	priv->dev_up = true;
-	mutex_unlock(&priv->clk_lock);
 	bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_UP);
 	return 0;
 }

+ 7 - 1
asoc/codecs/bolero/rx-macro.c

@@ -344,6 +344,7 @@ struct rx_macro_priv {
 	u16 prim_int_users[INTERP_MAX];
 	int rx_mclk_users;
 	int swr_clk_users;
+	bool dapm_mclk_enable;
 	bool reset_swr;
 	int clsh_users;
 	int rx_mclk_cnt;
@@ -1152,9 +1153,14 @@ static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w,
 			rx_priv->swr_ctrl_data[0].rx_swr_pdev,
 			SWR_CLK_FREQ, &mclk_freq);
 		ret = rx_macro_mclk_enable(rx_priv, 1, true);
+		if (ret)
+			rx_priv->dapm_mclk_enable = false;
+		else
+			rx_priv->dapm_mclk_enable = true;
 		break;
 	case SND_SOC_DAPM_POST_PMD:
-		ret = rx_macro_mclk_enable(rx_priv, 0, true);
+		if (rx_priv->dapm_mclk_enable)
+			ret = rx_macro_mclk_enable(rx_priv, 0, true);
 		break;
 	default:
 		dev_err(rx_priv->dev,

+ 7 - 1
asoc/codecs/bolero/tx-macro.c

@@ -127,6 +127,7 @@ struct tx_macro_priv {
 	bool dec_active[NUM_DECIMATORS];
 	int tx_mclk_users;
 	int swr_clk_users;
+	bool dapm_mclk_enable;
 	bool reset_swr;
 	struct clk *tx_core_clk;
 	struct clk *tx_npl_clk;
@@ -260,9 +261,14 @@ static int tx_macro_mclk_event(struct snd_soc_dapm_widget *w,
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
 		ret = tx_macro_mclk_enable(tx_priv, 1);
+		if (ret)
+			tx_priv->dapm_mclk_enable = false;
+		else
+			tx_priv->dapm_mclk_enable = true;
 		break;
 	case SND_SOC_DAPM_POST_PMD:
-		ret = tx_macro_mclk_enable(tx_priv, 0);
+		if (tx_priv->dapm_mclk_enable)
+			ret = tx_macro_mclk_enable(tx_priv, 0);
 		break;
 	default:
 		dev_err(tx_priv->dev,

+ 7 - 1
asoc/codecs/bolero/wsa-macro.c

@@ -192,6 +192,7 @@ struct wsa_macro_priv {
 	u16 prim_int_users[WSA_MACRO_RX1 + 1];
 	u16 wsa_mclk_users;
 	u16 swr_clk_users;
+	bool dapm_mclk_enable;
 	bool reset_swr;
 	unsigned int vi_feed_value;
 	struct mutex mclk_lock;
@@ -870,9 +871,14 @@ static int wsa_macro_mclk_event(struct snd_soc_dapm_widget *w,
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
 		ret = wsa_macro_mclk_enable(wsa_priv, 1, true);
+		if (ret)
+			wsa_priv->dapm_mclk_enable = false;
+		else
+			wsa_priv->dapm_mclk_enable = true;
 		break;
 	case SND_SOC_DAPM_POST_PMD:
-		wsa_macro_mclk_enable(wsa_priv, 0, true);
+		if (wsa_priv->dapm_mclk_enable)
+			wsa_macro_mclk_enable(wsa_priv, 0, true);
 		break;
 	default:
 		dev_err(wsa_priv->dev,

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

@@ -14,6 +14,8 @@
 #include <linux/kthread.h>
 #include <linux/bitops.h>
 #include <linux/clk.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.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 ret = 0;
+	int irq, dir_apps_irq;
 
 	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,
 					   swrm_wakeup_interrupt,
 					   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,