asoc: codec: Add 2Vpk support in WCD939X driver
Add support for HPH 2Vpk output mode in the WCD939X driver. Change-Id: I44a84cde84f0feee6d7d1255e097a5ffb616f78e Signed-off-by: Sam Rainey <quic_rainey@quicinc.com>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Gerrit - the friendly Code Review server

vecāks
a116a9c2f0
revīzija
837696b627
@@ -100,6 +100,7 @@ struct wcd939x_priv {
|
||||
bool ldoh;
|
||||
bool bcs_dis;
|
||||
bool dapm_bias_off;
|
||||
bool in_2Vpk_mode;
|
||||
struct irq_domain *virq;
|
||||
struct wcd_irq_info irq_info;
|
||||
u32 rx_clk_cnt;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <asoc/wcdcal-hwdep.h>
|
||||
#include <asoc/msm-cdc-pinctrl.h>
|
||||
#include <asoc/msm-cdc-supply.h>
|
||||
#include <asoc/wcd-mbhc-v2-api.h>
|
||||
#include <bindings/audio-codec-port-types.h>
|
||||
#include <linux/qti-regmap-debugfs.h>
|
||||
#include "wcd939x-registers.h"
|
||||
@@ -43,6 +44,8 @@
|
||||
#define ADC_MODE_VAL_ULP1 0x09
|
||||
#define ADC_MODE_VAL_ULP2 0x0B
|
||||
|
||||
#define HPH_IMPEDANCE_2VPK_MODE_OHMS 300
|
||||
|
||||
#define NUM_ATTEMPTS 5
|
||||
#define COMP_MAX_COEFF 25
|
||||
#define HPH_MODE_MAX 4
|
||||
@@ -1127,6 +1130,28 @@ static int wcd939x_rx_mux(struct snd_soc_dapm_widget *w,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void wcd939x_config_2Vpk_mode(struct snd_soc_component *component,
|
||||
struct wcd939x_priv *wcd939x)
|
||||
{
|
||||
uint32_t zl = 0, zr = 0;
|
||||
int rc = wcd_mbhc_get_impedance(&wcd939x->mbhc->wcd_mbhc, &zl, &zr);
|
||||
|
||||
if (rc) {
|
||||
dev_err_ratelimited(component->dev, "%s: Unable to get impedance for 2Vpk mode", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(PA_GAIN_CTL_L, RX_SUPPLY_LEVEL, 0x01));
|
||||
|
||||
if (zl < HPH_IMPEDANCE_2VPK_MODE_OHMS)
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(PA_GAIN_CTL_L, EN_HPHPA_2VPK, 0x00));
|
||||
else
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(PA_GAIN_CTL_L, EN_HPHPA_2VPK, 0x01));
|
||||
}
|
||||
|
||||
static int wcd939x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol,
|
||||
int event)
|
||||
@@ -1142,6 +1167,9 @@ static int wcd939x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
|
||||
if (!wcd939x->hph_pcm_enabled)
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(RDAC_CLK_CTL1, OPAMP_CHOP_CLK_EN, 0x00));
|
||||
if (wcd939x->in_2Vpk_mode)
|
||||
wcd939x_config_2Vpk_mode(component, wcd939x);
|
||||
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(CDC_HPH_GAIN_CTL, HPHL_RX_EN, 0x01));
|
||||
break;
|
||||
@@ -1196,6 +1224,9 @@ static int wcd939x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
|
||||
if (!wcd939x->hph_pcm_enabled)
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(RDAC_CLK_CTL1, OPAMP_CHOP_CLK_EN, 0x00));
|
||||
if (wcd939x->in_2Vpk_mode)
|
||||
wcd939x_config_2Vpk_mode(component, wcd939x);
|
||||
|
||||
snd_soc_component_update_bits(component,
|
||||
REG_FIELD_VALUE(CDC_HPH_GAIN_CTL, HPHR_RX_EN, 0x01));
|
||||
break;
|
||||
@@ -4351,6 +4382,10 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
|
||||
/*Harmonium contains only one variant i.e wcd9395*/
|
||||
wcd939x->variant = WCD9395;
|
||||
|
||||
/* Check device tree to see if 2Vpk flag is enabled, this value should not be changed */
|
||||
wcd939x->in_2Vpk_mode = of_find_property(wcd939x->dev->of_node,
|
||||
"qcom,hph-2p15v-mode", NULL) != NULL;
|
||||
|
||||
wcd939x->fw_data = devm_kzalloc(component->dev,
|
||||
sizeof(*(wcd939x->fw_data)),
|
||||
GFP_KERNEL);
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user