Prechádzať zdrojové kódy

ASoC: msm: set pinctrl if available on auto machine

Set pinctrl only if available for respective TDM
or MI2S interface on auto machine driver.

Change-Id: I2b9a43f4958a6ad9ed086a77a65cb6dc67cc36a3
Signed-off-by: Derek Chen <[email protected]>
Derek Chen 5 rokov pred
rodič
commit
bbce3836f1
2 zmenil súbory, kde vykonal 56 pridanie a 40 odobranie
  1. 28 20
      asoc/sa6155.c
  2. 28 20
      asoc/sa8155.c

+ 28 - 20
asoc/sa6155.c

@@ -4801,11 +4801,13 @@ static int sa6155_tdm_snd_startup(struct snd_pcm_substream *substream)
 		if (index == TDM_TERT || index == TDM_QUAT ||
 			index == TDM_QUIN) {
 			pinctrl_info = &pdata->pinctrl_info[index];
-			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-						      STATE_ACTIVE);
-			if (ret_pinctrl)
-				pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
-					__func__, ret_pinctrl);
+			if (pinctrl_info->pinctrl) {
+				ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+							      STATE_ACTIVE);
+				if (ret_pinctrl)
+					pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+						__func__, ret_pinctrl);
+			}
 		}
 	}
 	mutex_unlock(&intf_conf->lock);
@@ -4841,11 +4843,13 @@ static void sa6155_tdm_snd_shutdown(struct snd_pcm_substream *substream)
 		if (index == TDM_TERT || index == TDM_QUAT ||
 			index == TDM_QUIN) {
 			pinctrl_info = &pdata->pinctrl_info[index];
-			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-						      STATE_SLEEP);
-			if (ret_pinctrl)
-				pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
-					__func__, ret_pinctrl);
+			if (pinctrl_info->pinctrl) {
+				ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+							      STATE_SLEEP);
+				if (ret_pinctrl)
+					pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+						__func__, ret_pinctrl);
+			}
 		}
 	}
 	mutex_unlock(&intf_conf->lock);
@@ -4935,11 +4939,13 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
 		}
 
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_ACTIVE);
-		if (ret_pinctrl)
-			pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_ACTIVE);
+			if (ret_pinctrl)
+				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 clk_off:
 	if (ret < 0)
@@ -4979,11 +4985,13 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
 				__func__, index, ret);
 
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_SLEEP);
-		if (ret_pinctrl)
-			pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_SLEEP);
+			if (ret_pinctrl)
+				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 	mutex_unlock(&intf_conf->lock);
 }

+ 28 - 20
asoc/sa8155.c

@@ -4791,11 +4791,13 @@ static int sa8155_tdm_snd_startup(struct snd_pcm_substream *substream)
 	mutex_lock(&intf_conf->lock);
 	if (++intf_conf->ref_cnt == 1) {
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_ACTIVE);
-		if (ret_pinctrl)
-			pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_ACTIVE);
+			if (ret_pinctrl)
+				pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 	mutex_unlock(&intf_conf->lock);
 
@@ -4828,11 +4830,13 @@ static void sa8155_tdm_snd_shutdown(struct snd_pcm_substream *substream)
 	mutex_lock(&intf_conf->lock);
 	if (--intf_conf->ref_cnt == 0) {
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_SLEEP);
-		if (ret_pinctrl)
-			pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_SLEEP);
+			if (ret_pinctrl)
+				pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 	mutex_unlock(&intf_conf->lock);
 }
@@ -4921,11 +4925,13 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
 		}
 
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_ACTIVE);
-		if (ret_pinctrl)
-			pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_ACTIVE);
+			if (ret_pinctrl)
+				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 clk_off:
 	if (ret < 0)
@@ -4965,11 +4971,13 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
 				__func__, index, ret);
 
 		pinctrl_info = &pdata->pinctrl_info[index];
-		ret_pinctrl = msm_set_pinctrl(pinctrl_info,
-					      STATE_SLEEP);
-		if (ret_pinctrl)
-			pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
-				__func__, ret_pinctrl);
+		if (pinctrl_info->pinctrl) {
+			ret_pinctrl = msm_set_pinctrl(pinctrl_info,
+						      STATE_SLEEP);
+			if (ret_pinctrl)
+				pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
+					__func__, ret_pinctrl);
+		}
 	}
 	mutex_unlock(&intf_conf->lock);
 }