Bläddra i källkod

asoc: update curr_micbias2 val with mb->micb2_mv

Curr_micbias2 val should be same with mb->micba2_mv.
for some customers, their micbias is not 1800mv,
so we should set the curr_micbias as mb->micb2_mv which
was the actual micbias val the customer use.
remove the dev_up check from micbias, since with this check,
Headset may be detected as a incorrect type.

Change-Id: Ia5a1fd434a09617a57096531c69956479c69f079
Signed-off-by: Yuhui Zhao <[email protected]>
Yuhui Zhao 8 månader sedan
förälder
incheckning
0d15edc0e2
2 ändrade filer med 5 tillägg och 17 borttagningar
  1. 0 1
      asoc/codecs/wcd9378/internal.h
  2. 5 16
      asoc/codecs/wcd9378/wcd9378.c

+ 0 - 1
asoc/codecs/wcd9378/internal.h

@@ -138,7 +138,6 @@ struct wcd9378_priv {
 	struct snd_info_entry *version_entry;
 	struct snd_info_entry *variant_entry;
 	int flyback_cur_det_disable;
-	bool dev_up;
 	u8 tx_master_ch_map[WCD9378_MAX_SLAVE_CH_TYPES];
 	bool usbc_hs_status;
 	/* wcd to swr dmic notification */

+ 5 - 16
asoc/codecs/wcd9378/wcd9378.c

@@ -1975,7 +1975,6 @@ static int wcd9378_hph_sequencer_enable(struct snd_soc_dapm_widget *w,
 		snd_soc_component_update_bits(component, WCD9378_PDE47_REQ_PS,
 				WCD9378_PDE47_REQ_PS_PDE47_REQ_PS_MASK, 0x00);
 
-		/*TBD: SET SDCA GAIN, NEED CHECK THE LOGIC*/
 		wcd9378_hph_set_channel_volume(component);
 
 		if ((!wcd9378->comp1_enable) || (!wcd9378->comp2_enable))
@@ -2258,14 +2257,14 @@ int wcd9378_micbias_control(struct snd_soc_component *component,
 			snd_soc_component_update_bits(component, WCD9378_MB_PULLUP_EN,
 						pull_up_mask, pull_up_en);
 			snd_soc_component_update_bits(component,
-						micb_usage, micb_mask, 0x03);
+						micb_usage, micb_mask, micb_usage_val);
 
 			if (micb_num == MIC_BIAS_2) {
 				snd_soc_component_update_bits(component,
 						WCD9378_IT31_MICB,
 						WCD9378_IT31_MICB_IT31_MICB_MASK,
-						0x03);
-				wcd9378->curr_micbias2 = 1800;
+						micb_usage_val);
+				wcd9378->curr_micbias2 = mb->micb2_mv;
 			}
 		}
 		break;
@@ -2287,12 +2286,6 @@ int wcd9378_micbias_control(struct snd_soc_component *component,
 		}
 		break;
 	case MICB_ENABLE:
-		if (!wcd9378->dev_up) {
-			dev_dbg(component->dev, "%s: enable req %d wcd device down\n",
-				__func__, req);
-			ret = -ENODEV;
-			goto done;
-		}
 		wcd9378->micb_ref[micb_index]++;
 		if (wcd9378->micb_ref[micb_index] == 1) {
 			dev_dbg(component->dev, "%s: enable micbias, micb_usage:0x%0x, val:0x%0x\n",
@@ -2305,7 +2298,7 @@ int wcd9378_micbias_control(struct snd_soc_component *component,
 						WCD9378_IT31_MICB,
 						WCD9378_IT31_MICB_IT31_MICB_MASK,
 						micb_usage_val);
-				wcd9378->curr_micbias2 = 1800;
+				wcd9378->curr_micbias2 = mb->micb2_mv;
 			}
 			if (post_on_event)
 				blocking_notifier_call_chain(
@@ -2327,7 +2320,7 @@ int wcd9378_micbias_control(struct snd_soc_component *component,
 						pull_up_mask, pull_up_en);
 
 			if (micb_num == MIC_BIAS_2)
-				wcd9378->curr_micbias2 = 1800;
+				wcd9378->curr_micbias2 = mb->micb2_mv;
 		} else if ((wcd9378->micb_ref[micb_index] == 0) &&
 			 (wcd9378->pullup_ref[micb_index] == 0)) {
 			if (pre_off_event && wcd9378->mbhc)
@@ -2366,7 +2359,6 @@ int wcd9378_micbias_control(struct snd_soc_component *component,
 		__func__, micb_num, wcd9378->micb_ref[micb_index],
 		wcd9378->pullup_ref[micb_index]);
 
-done:
 	mutex_unlock(&wcd9378->micb_lock);
 	return ret;
 }
@@ -2468,7 +2460,6 @@ static int wcd9378_event_notify(struct notifier_block *block,
 					0x80, 0x00);
 		break;
 	case BOLERO_SLV_EVT_SSR_DOWN:
-		wcd9378->dev_up = false;
 		if (wcd9378->notify_swr_dmic)
 			blocking_notifier_call_chain(&wcd9378->notifier,
 						WCD9378_EVT_SSR_DOWN,
@@ -2506,7 +2497,6 @@ static int wcd9378_event_notify(struct notifier_block *block,
 			wcd9378_mbhc_hs_detect(component, mbhc->mbhc_cfg);
 		}
 		wcd9378->mbhc->wcd_mbhc.deinit_in_progress = false;
-		wcd9378->dev_up = true;
 		if (wcd9378->notify_swr_dmic)
 			blocking_notifier_call_chain(&wcd9378->notifier,
 						WCD9378_EVT_SSR_UP,
@@ -4383,7 +4373,6 @@ static int wcd9378_bind(struct device *dev)
 				__func__);
 		goto err_irq;
 	}
-	wcd9378->dev_up = true;
 
 	return ret;
 err_irq: