Prechádzať zdrojové kódy

ASoC: wsa883x: Handle PA_ERR interrupt on WSA speaker

PA_ERR can happen during speaker path setup. Log the
error status in the interrupt handler and clear the error
status for next audio playback to resume properly on
the speaker.

Change-Id: I0490d4cdd6379ed779ce7f54ec8b56d5a7af0649
Signed-off-by: Phani Kumar Uppalapati<[email protected]>
Phani Kumar Uppalapati 3 rokov pred
rodič
commit
cace0a8255
1 zmenil súbory, kde vykonal 43 pridanie a 10 odobranie
  1. 43 10
      asoc/codecs/wsa883x/wsa883x.c

+ 43 - 10
asoc/codecs/wsa883x/wsa883x.c

@@ -521,8 +521,33 @@ static irqreturn_t wsa883x_uvlo_handle_irq(int irq, void *data)
 
 static irqreturn_t wsa883x_pa_on_err_handle_irq(int irq, void *data)
 {
+	u8 pa_fsm_sta = 0, pa_fsm_err = 0;
+	struct wsa883x_priv *wsa883x = data;
+	struct snd_soc_component *component = NULL;
+
+	if (!wsa883x)
+		return IRQ_NONE;
+
+	component = wsa883x->component;
+	if (!component)
+		return IRQ_NONE;
+
+	pa_fsm_sta = (snd_soc_component_read(component, WSA883X_PA_FSM_STA)
+			& 0x70);
+	if (pa_fsm_sta)
+		pa_fsm_err = snd_soc_component_read(component,
+					WSA883X_PA_FSM_ERR_COND);
+
 	pr_err_ratelimited("%s: interrupt for irq =%d triggered\n",
 			   __func__, irq);
+
+	snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x00);
+	snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x10);
+	snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x00);
+
 	return IRQ_HANDLED;
 }
 
@@ -1159,6 +1184,7 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
 						WSA883X_DRE_CTL_0,
 						0x07,
 						wsa883x->comp_offset);
+		wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);
 		wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
 		wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
 		wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
@@ -1187,6 +1213,12 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
 				0x0E, 0x00);
 		snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
 				0x01, 0x00);
+		snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x00);
+		snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x10);
+		snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
+				0x10, 0x00);
 		snd_soc_component_update_bits(component, WSA883X_PDM_WD_CTL,
 				0x01, 0x00);
 		wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD);
@@ -1195,6 +1227,7 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
 		wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
 		wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
 		wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
+		wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);
 		clear_bit(SPKR_STATUS, &wsa883x->status_mask);
 		clear_bit(SPKR_ADIE_LB, &wsa883x->status_mask);
 		break;
@@ -1723,53 +1756,53 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
 	}
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR,
-			"WSA SAF2WAR", wsa883x_saf2war_handle_irq, NULL);
+			"WSA SAF2WAR", wsa883x_saf2war_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF,
-			"WSA WAR2SAF", wsa883x_war2saf_handle_irq, NULL);
+			"WSA WAR2SAF", wsa883x_war2saf_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE,
-			"WSA OTP", wsa883x_otp_handle_irq, NULL);
+			"WSA OTP", wsa883x_otp_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP,
-			"WSA OCP", wsa883x_ocp_handle_irq, NULL);
+			"WSA OCP", wsa883x_ocp_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLIP,
-			"WSA CLIP", wsa883x_clip_handle_irq, NULL);
+			"WSA CLIP", wsa883x_clip_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLIP);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD,
-			"WSA PDM WD", wsa883x_pdm_wd_handle_irq, NULL);
+			"WSA PDM WD", wsa883x_pdm_wd_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD,
-			"WSA CLK WD", wsa883x_clk_wd_handle_irq, NULL);
+			"WSA CLK WD", wsa883x_clk_wd_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_INTR_PIN,
-			"WSA EXT INT", wsa883x_ext_int_handle_irq, NULL);
+			"WSA EXT INT", wsa883x_ext_int_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_INTR_PIN);
 
 	/* Under Voltage Lock out (UVLO) interrupt handle */
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO,
-			"WSA UVLO", wsa883x_uvlo_handle_irq, NULL);
+			"WSA UVLO", wsa883x_uvlo_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
 
 	wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR,
-			"WSA PA ERR", wsa883x_pa_on_err_handle_irq, NULL);
+			"WSA PA ERR", wsa883x_pa_on_err_handle_irq, wsa883x);
 
 	wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);