diff --git a/drivers/slimbus/slim-msm-ctrl.c b/drivers/slimbus/slim-msm-ctrl.c index 8f7185a5157c..9565bc654abf 100644 --- a/drivers/slimbus/slim-msm-ctrl.c +++ b/drivers/slimbus/slim-msm-ctrl.c @@ -92,8 +92,8 @@ enum mgr_intr { enum frm_cfg { FRM_ACTIVE = 1, - CLK_GEAR = 7, - ROOT_FREQ = 11, + CLK_GEAR = 9, + ROOT_FREQ = 19, REF_CLK_GEAR = 15, INTR_WAKE = 19, }; diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index ef52145f593e..fefe34248c54 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. + *Copyright (C) 2018, Laster K. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -50,7 +51,8 @@ #define WCD9335_RATES_MASK (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ - SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000) + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\ + SNDRV_PCM_RATE_384000) /* Fractional Rates */ #define WCD9335_FRAC_RATES_MASK (SNDRV_PCM_RATE_44100) @@ -164,7 +166,17 @@ enum tasha_sido_voltage { static enum codec_variant codec_ver; -static int dig_core_collapse_enable = 1; +static int huwifi_mode = 1; +module_param(huwifi_mode, int, + S_IRUGO | S_IWUSR | S_IWGRP); +MODULE_PARM_DESC(huwifi_mode, "enable/disable l UHQA Mode"); + +static int low_distort_amp = 1; +module_param(low_distort_amp, int, + S_IRUGO | S_IWUSR | S_IWGRP); +MODULE_PARM_DESC(low_distort_amp, "enable/disable l Class AB Mode"); + +static int dig_core_collapse_enable = 0; module_param(dig_core_collapse_enable, int, S_IRUGO | S_IWUSR | S_IWGRP); MODULE_PARM_DESC(dig_core_collapse_enable, "enable/disable power gating"); @@ -442,6 +454,7 @@ static struct interp_sample_rate int_mix_sample_rate_val[] = { {48000, 0x4}, /* 48K */ {96000, 0x5}, /* 96K */ {192000, 0x6}, /* 192K */ + {384000, 0x7}, /* 384K */ }; static const struct wcd9xxx_ch tasha_rx_chs[TASHA_RX_MAX] = { @@ -3840,9 +3853,13 @@ static void tasha_codec_hph_post_pa_config(struct tasha_priv *tasha, case CLS_H_HIFI: scale_val = 0x3; break; + case CLS_H_LOHIFI: - scale_val = 0x1; - break; + if (!huwifi_mode) + scale_val = 0x1; + else + scale_val = 031; + break; } if (tasha->anc_func) { /* Clear Tx FE HOLD if both PAs are enabled */ @@ -4456,10 +4473,16 @@ static void tasha_codec_hph_mode_config(struct snd_soc_codec *codec, switch (mode) { case CLS_H_LP: - tasha_codec_hph_lp_config(codec, event); + if (!huwifi_mode) + tasha_codec_hph_lp_config(codec, event); + else + tasha_codec_hph_hifi_config(codec, event); break; case CLS_H_LOHIFI: - tasha_codec_hph_lohifi_config(codec, event); + if (!huwifi_mode) + tasha_codec_hph_lohifi_config(codec, event); + else + tasha_codec_hph_hifi_config(codec, event); break; case CLS_H_HIFI: tasha_codec_hph_hifi_config(codec, event); @@ -4498,12 +4521,19 @@ static int tasha_codec_hphr_dac_event(struct snd_soc_dapm_widget *w, __func__, hph_mode); return -EINVAL; } - wcd_clsh_fsm(codec, &tasha->clsh_d, - WCD_CLSH_EVENT_PRE_DAC, - WCD_CLSH_STATE_HPHR, - ((hph_mode == CLS_H_LOHIFI) ? - CLS_H_HIFI : hph_mode)); - + if (!low_distort_amp) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_HPHR, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_HPHR, + CLS_AB); + } tasha_codec_hph_mode_config(codec, event, hph_mode); if (tasha->anc_func) @@ -4534,12 +4564,19 @@ static int tasha_codec_hphr_dac_event(struct snd_soc_dapm_widget *w, if (!(wcd_clsh_get_clsh_state(&tasha->clsh_d) & WCD_CLSH_STATE_HPHL)) tasha_codec_hph_mode_config(codec, event, hph_mode); - - wcd_clsh_fsm(codec, &tasha->clsh_d, - WCD_CLSH_EVENT_POST_PA, - WCD_CLSH_STATE_HPHR, - ((hph_mode == CLS_H_LOHIFI) ? - CLS_H_HIFI : hph_mode)); + if (!low_distort_amp) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_HPHL, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_HPHL, + CLS_AB); + } break; }; @@ -4578,11 +4615,20 @@ static int tasha_codec_hphl_dac_event(struct snd_soc_dapm_widget *w, __func__, hph_mode); return -EINVAL; } - wcd_clsh_fsm(codec, &tasha->clsh_d, - WCD_CLSH_EVENT_PRE_DAC, - WCD_CLSH_STATE_HPHL, - ((hph_mode == CLS_H_LOHIFI) ? - CLS_H_HIFI : hph_mode)); + + if (!low_distort_amp) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_HPHL, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_HPHL, + CLS_AB); + } tasha_codec_hph_mode_config(codec, event, hph_mode); @@ -4626,11 +4672,19 @@ static int tasha_codec_hphl_dac_event(struct snd_soc_dapm_widget *w, if (!(wcd_clsh_get_clsh_state(&tasha->clsh_d) & WCD_CLSH_STATE_HPHR)) tasha_codec_hph_mode_config(codec, event, hph_mode); - wcd_clsh_fsm(codec, &tasha->clsh_d, - WCD_CLSH_EVENT_POST_PA, - WCD_CLSH_STATE_HPHL, - ((hph_mode == CLS_H_LOHIFI) ? - CLS_H_HIFI : hph_mode)); + if (!low_distort_amp) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_HPHR, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_HPHR, + CLS_AB); + } if (test_bit(CLASSH_CONFIG, &tasha->status_mask)) { wcd_clsh_imped_config(codec, impedl, true); @@ -4638,8 +4692,6 @@ static int tasha_codec_hphl_dac_event(struct snd_soc_dapm_widget *w, } else dev_dbg(codec->dev, "%s: Failed to get mbhc impedance %d\n", __func__, ret); - - break; }; @@ -4791,6 +4843,7 @@ static int tasha_codec_ear_dac_event(struct snd_soc_dapm_widget *w, struct snd_soc_codec *codec = w->codec; struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec); int ret = 0; + int hph_mode = tasha->hph_mode; dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event); @@ -4798,11 +4851,44 @@ static int tasha_codec_ear_dac_event(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMU: if (tasha->anc_func) ret = tasha_codec_enable_anc(w, kcontrol, event); - - wcd_clsh_fsm(codec, &tasha->clsh_d, - WCD_CLSH_EVENT_PRE_DAC, - WCD_CLSH_STATE_EAR, - CLS_H_NORMAL); + if (!low_distort_amp) { + if (!huwifi_mode) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_EAR, + CLS_H_NORMAL); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_PRE_DAC, + WCD_CLSH_STATE_EAR, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + } + else { + if (!low_distort_amp) { + if (!huwifi_mode) { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_EAR, + CLS_H_NORMAL); + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_EAR, + ((hph_mode == CLS_H_LOHIFI) ? + CLS_H_HIFI : hph_mode)); + } + } + else { + wcd_clsh_fsm(codec, &tasha->clsh_d, + WCD_CLSH_EVENT_POST_PA, + WCD_CLSH_STATE_EAR, + CLS_AB); + } + } if (tasha->anc_func) snd_soc_update_bits(codec, WCD9335_CDC_RX0_RX_PATH_CFG0, 0x10, 0x10); @@ -11786,6 +11872,10 @@ static int tasha_hw_params(struct snd_pcm_substream *substream, tasha->dai[dai->id].bit_width = 24; i2s_bit_mode = 0x00; break; + case 32: + tasha->dai[dai->id].bit_width = 32; + i2s_bit_mode = 0x00; + break; default: return -EINVAL; } @@ -11813,6 +11903,9 @@ static int tasha_hw_params(struct snd_pcm_substream *substream, case 192000: rx_fs_rate = 5; break; + case 384000: + rx_fs_rate = 6; + break; default: dev_err(tasha->dev, "%s: Invalid RX sample rate: %d\n", @@ -11847,9 +11940,6 @@ static int tasha_hw_params(struct snd_pcm_substream *substream, case 192000: tx_fs_rate = 6; break; - case 384000: - tx_fs_rate = 7; - break; default: dev_err(tasha->dev, "%s: Invalid TX sample rate: %d\n", __func__, params_rate(params));