Loading drivers/mfd/wcd9xxx-slimslave.c +14 −1 Original line number Diff line number Diff line Loading @@ -10,10 +10,13 @@ * GNU General Public License for more details. */ #include <linux/slab.h> #include <linux/delay.h> #include <linux/mutex.h> #include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h> #include <linux/mfd/wcd9xxx/wcd9xxx_registers.h> #define SLIM_RETRY_MAX 3 struct wcd9xxx_slim_sch { u16 rx_port_ch_reg_base; u16 port_tx_cfg_reg_base; Loading Loading @@ -426,6 +429,7 @@ int wcd9xxx_close_slim_sch_rx(struct wcd9xxx *wcd9xxx, int ch_cnt = 0 ; int ret = 0; struct wcd9xxx_ch *rx; u32 retry = 0; list_for_each_entry(rx, wcd9xxx_ch_list, list) sph[ch_cnt++] = rx->sph; Loading @@ -435,7 +439,16 @@ int wcd9xxx_close_slim_sch_rx(struct wcd9xxx *wcd9xxx, /* slim_control_ch (REMOVE) */ pr_debug("%s before slim_control_ch grph %d\n", __func__, grph); ret = slim_control_ch(wcd9xxx->slim, grph, SLIM_CH_REMOVE, true); do { ret = slim_control_ch(wcd9xxx->slim, grph, SLIM_CH_REMOVE, true); if (ret < 0) { retry++; pr_err("%s: failed ret[%d] retry_cnt:%d\n", __func__, ret, retry); usleep_range(5000, 5100); } } while (ret < 0 && (retry < SLIM_RETRY_MAX)); if (ret < 0) { pr_err("%s: slim_control_ch failed ret[%d]\n", __func__, ret); goto err; Loading sound/soc/codecs/wcd-mbhc-v2.c +123 −21 Original line number Diff line number Diff line Loading @@ -9,6 +9,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2015 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> Loading Loading @@ -44,18 +49,22 @@ #define SPECIAL_HS_DETECT_TIME_MS (2 * 1000) #define MBHC_BUTTON_PRESS_THRESHOLD_MIN 250 #define GND_MIC_SWAP_THRESHOLD 4 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 100 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 150 #define HS_VREF_MIN_VAL 1400 #define FW_READ_ATTEMPTS 15 #define FW_READ_TIMEOUT 4000000 #define FAKE_REM_RETRY_ATTEMPTS 3 #define MAX_IMPED 60000 #define FAKE_REM_RETRY_ATTEMPTS 10 #define WCD_MBHC_BTN_PRESS_COMPL_TIMEOUT_MS 50 #define ANC_DETECT_RETRY_CNT 7 #define WCD_MBHC_SPL_HS_CNT 1 static bool skip_impdet_retry; static bool lineout_detected; static int det_extn_cable_en; static int is_anc_mic_insert = -1; module_param(det_extn_cable_en, int, S_IRUGO | S_IWUSR | S_IWGRP); MODULE_PARM_DESC(det_extn_cable_en, "enable/disable extn cable detect"); Loading @@ -67,6 +76,32 @@ enum wcd_mbhc_cs_mb_en_flag { WCD_MBHC_EN_NONE, }; int wcd_mbhc_jack_is_anc_mic_insert(void) { return is_anc_mic_insert; } static void wcd_mbhc_jack_anc_insert_update(u32/*enum snd_jack_type*/ hs_type) { switch(hs_type) { case SND_JACK_HEADPHONE: is_anc_mic_insert = 0; break; case SND_JACK_HEADSET: is_anc_mic_insert = 1; break; case SND_JACK_ANC_HEADPHONE: is_anc_mic_insert = 2; break; case SND_JACK_STEREO_MICROPHONE: is_anc_mic_insert = 3; break; default : is_anc_mic_insert = -1; break; } pr_debug("wcd_mbhc_jack_anc_insert_update is_anc_mic_insert:%d", is_anc_mic_insert); } static void wcd_mbhc_jack_report(struct wcd_mbhc *mbhc, struct snd_soc_jack *jack, int status, int mask) { Loading Loading @@ -608,6 +643,7 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, { struct snd_soc_codec *codec = mbhc->codec; bool is_pa_on = false; bool skip_report = false; WCD_MBHC_RSC_ASSERT_LOCKED(mbhc); Loading Loading @@ -648,6 +684,9 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, } mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->extn_cable_inserted = false; lineout_detected = false; if (!skip_impdet_retry) mbhc->zl = mbhc->zr = 0; pr_debug("%s: Reporting removal %d(%x)\n", __func__, jack_type, mbhc->hph_status); Loading Loading @@ -687,6 +726,8 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->micbias_enable = false; } mbhc->hph_type = WCD_MBHC_HPH_NONE; lineout_detected = false; if (!skip_impdet_retry) mbhc->zl = mbhc->zr = 0; pr_debug("%s: Reporting removal (%x)\n", __func__, mbhc->hph_status); Loading Loading @@ -728,6 +769,8 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->jiffies_atreport = jiffies; } else if (jack_type == SND_JACK_LINEOUT) { mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH; skip_report = true; pr_debug("%s: extension cable detected\n", __func__); } else if (jack_type == SND_JACK_ANC_HEADPHONE) mbhc->current_plug = MBHC_PLUG_TYPE_ANC_HEADPHONE; Loading @@ -738,16 +781,42 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->mbhc_cb->compute_impedance && (mbhc->mbhc_cfg->linein_th != 0) && (!is_pa_on)) { if (!skip_impdet_retry) { mbhc->mbhc_cb->compute_impedance(mbhc, &mbhc->zl, &mbhc->zr); if ((mbhc->zl > mbhc->mbhc_cfg->linein_th && mbhc->zl < MAX_IMPED) && (mbhc->zr > mbhc->mbhc_cfg->linein_th && mbhc->zr < MAX_IMPED) && (jack_type == SND_JACK_HEADPHONE)) { pr_debug("%s: impedance L:%d R:%d\n", __func__, mbhc->zl, mbhc->zr); } else { pr_debug("%s: skip impedance detection\n", __func__); } if (jack_type == SND_JACK_HEADPHONE) skip_impdet_retry = true; else skip_impdet_retry = false; if (mbhc->zl > mbhc->mbhc_cfg->linein_th && jack_type == SND_JACK_ANC_HEADPHONE) { if(!wcd_mbhc_is_hph_pa_on(mbhc)) { jack_type = SND_JACK_STEREO_MICROPHONE; mbhc->current_plug = MBHC_PLUG_TYPE_STEREO_MICROPHONE; mbhc->hph_status &= ~SND_JACK_HEADPHONE; pr_debug("%s: Stereo microphone detected\n", __func__); } else { pr_debug("%s: Skip Stereo microphone reporting\n", __func__); } } else if (mbhc->zl > mbhc->mbhc_cfg->linein_th && mbhc->zr > mbhc->mbhc_cfg->linein_th && jack_type == SND_JACK_HEADPHONE) { jack_type = SND_JACK_LINEOUT; mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH; if (mbhc->hph_status) { lineout_detected = true; if (mbhc->hph_status && mbhc->hph_status != SND_JACK_LINEOUT) { mbhc->hph_status &= ~(SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_UNSUPPORTED); Loading @@ -763,11 +832,16 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->hph_status |= jack_type; if (!skip_report) { pr_debug("%s: Reporting insertion %d(%x)\n", __func__, jack_type, mbhc->hph_status); wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack, (mbhc->hph_status | SND_JACK_MECHANICAL), (mbhc->hph_status | SND_JACK_MECHANICAL), WCD_MBHC_JACK_MASK); } else { pr_debug("%s: Skip reporting insertion\n", __func__); } wcd_mbhc_clr_and_turnon_hph_padac(mbhc); } pr_debug("%s: leave hph_status %x\n", __func__, mbhc->hph_status); Loading Loading @@ -930,6 +1004,7 @@ static void wcd_mbhc_find_plug_and_report(struct wcd_mbhc *mbhc, mbhc->current_plug, plug_type); } exit: wcd_mbhc_jack_anc_insert_update(mbhc->hph_status);//hph_status is updated with latest info pr_debug("%s: leave\n", __func__); } Loading Loading @@ -1089,6 +1164,7 @@ static void wcd_mbhc_update_fsm_source(struct wcd_mbhc *mbhc, break; case MBHC_PLUG_TYPE_HEADSET: case MBHC_PLUG_TYPE_ANC_HEADPHONE: case MBHC_PLUG_TYPE_STEREO_MICROPHONE: if (!mbhc->is_hs_recording && !micbias2) WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 3); break; Loading Loading @@ -1211,6 +1287,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch); codec = mbhc->codec; /* Wait for debounce time 200ms for extension cable */ if (mbhc->extn_cable_inserted) msleep(200); /* * Enable micbias/pullup for detection in correct work. * This work will get scheduled from detect_plug_type which Loading Loading @@ -1422,7 +1502,9 @@ correct_plug_type: if (((mbhc->current_plug != MBHC_PLUG_TYPE_HEADSET) && (mbhc->current_plug != MBHC_PLUG_TYPE_ANC_HEADPHONE)) && MBHC_PLUG_TYPE_ANC_HEADPHONE) && (mbhc->current_plug != MBHC_PLUG_TYPE_STEREO_MICROPHONE)) && !wcd_swch_level_remove(mbhc) && !mbhc->btn_press_intr) { pr_debug("%s: cable is %sheadset\n", Loading @@ -1439,6 +1521,9 @@ correct_plug_type: if (!wrk_complete && mbhc->btn_press_intr) { pr_debug("%s: Can be slow insertion of headphone\n", __func__); wcd_cancel_btn_work(mbhc); if (lineout_detected) plug_type = MBHC_PLUG_TYPE_HIGH_HPH; else plug_type = MBHC_PLUG_TYPE_HEADPHONE; } /* Loading @@ -1446,14 +1531,15 @@ correct_plug_type: * detect_plug-type or in above while loop, no need to report again */ if (!wrk_complete && ((plug_type == MBHC_PLUG_TYPE_HEADSET) || (plug_type == MBHC_PLUG_TYPE_ANC_HEADPHONE))) { (plug_type == MBHC_PLUG_TYPE_ANC_HEADPHONE) || (plug_type == MBHC_PLUG_TYPE_STEREO_MICROPHONE))) { pr_debug("%s: plug_type:0x%x already reported\n", __func__, mbhc->current_plug); goto enable_supply; } if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH && (!det_extn_cable_en)) { (!det_extn_cable_en) && (!lineout_detected)) { if (wcd_is_special_headset(mbhc)) { pr_debug("%s: Special headset found %d\n", __func__, plug_type); Loading Loading @@ -1532,6 +1618,8 @@ exit: if (mbhc->mbhc_cb->hph_pull_down_ctrl) mbhc->mbhc_cb->hph_pull_down_ctrl(codec, true); skip_impdet_retry = false; mbhc->mbhc_cb->lock_sleep(mbhc, false); pr_debug("%s: leave\n", __func__); } Loading Loading @@ -1588,6 +1676,10 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) /* Set the detection type appropriately */ WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MECH_DETECTION_TYPE, !detection_type); if (!detection_type) { //reset headset type at hs removing wcd_mbhc_jack_anc_insert_update(-1); } pr_debug("%s: mbhc->current_plug: %d detection_type: %d\n", __func__, mbhc->current_plug, detection_type); Loading Loading @@ -1685,6 +1777,15 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_SCHMT_ISRC, 0); wcd_mbhc_report_plug(mbhc, 0, SND_JACK_ANC_HEADPHONE); } else if (mbhc->current_plug == MBHC_PLUG_TYPE_STEREO_MICROPHONE) { wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_REM, false); wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_INS, false); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_DETECTION_TYPE, 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_SCHMT_ISRC, 0); wcd_mbhc_report_plug(mbhc, 0, SND_JACK_STEREO_MICROPHONE); } } else if (!detection_type) { /* Disable external voltage source to micbias if present */ Loading @@ -1694,7 +1795,6 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 0); } mbhc->in_swch_irq_handler = false; WCD_MBHC_RSC_UNLOCK(mbhc); pr_debug("%s: leave\n", __func__); Loading Loading @@ -1825,6 +1925,7 @@ determine_plug: hphl_trigerred = 0; mic_trigerred = 0; mbhc->is_extn_cable = true; mbhc->extn_cable_inserted = true; mbhc->btn_press_intr = false; mbhc->is_btn_press = false; wcd_mbhc_detect_plug_type(mbhc); Loading Loading @@ -2831,6 +2932,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, mbhc->btn_press_intr = false; mbhc->is_hs_recording = false; mbhc->is_extn_cable = false; mbhc->extn_cable_inserted = false; mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->wcd_mbhc_regs = wcd_mbhc_regs; Loading sound/soc/codecs/wcd-mbhc-v2.h +8 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2015 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #ifndef __WCD_MBHC_V2_H__ #define __WCD_MBHC_V2_H__ Loading @@ -22,7 +27,7 @@ #define WCD_MBHC_DEF_BUTTONS 8 #define WCD_MBHC_KEYCODE_NUM 8 #define WCD_MBHC_USLEEP_RANGE_MARGIN_US 100 #define WCD_MBHC_THR_HS_MICB_MV 2700 #define WCD_MBHC_THR_HS_MICB_MV 2750 /* z value defined in Ohms */ #define WCD_MONO_HS_MIN_THR 2 #define WCD_MBHC_STRINGIFY(s) __stringify(s) Loading Loading @@ -82,6 +87,7 @@ enum wcd_mbhc_plug_type { MBHC_PLUG_TYPE_HIGH_HPH, MBHC_PLUG_TYPE_GND_MIC_SWAP, MBHC_PLUG_TYPE_ANC_HEADPHONE, MBHC_PLUG_TYPE_STEREO_MICROPHONE, }; enum pa_dac_ack_flags { Loading Loading @@ -423,6 +429,7 @@ struct wcd_mbhc { bool btn_press_intr; bool is_hs_recording; bool is_extn_cable; bool extn_cable_inserted; bool skip_imped_detection; bool is_btn_already_regd; Loading sound/soc/codecs/wcd9335.c +39 −14 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2016 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #include <linux/module.h> #include <linux/init.h> #include <linux/firmware.h> Loading Loading @@ -869,8 +874,8 @@ static const struct tasha_reg_mask_val tasha_spkr_default[] = { {WCD9335_CDC_COMPANDER8_CTL3, 0x80, 0x80}, {WCD9335_CDC_COMPANDER7_CTL7, 0x01, 0x01}, {WCD9335_CDC_COMPANDER8_CTL7, 0x01, 0x01}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x50}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x50}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x58}, }; static const struct tasha_reg_mask_val tasha_spkr_mode1[] = { Loading Loading @@ -1857,7 +1862,7 @@ static inline void tasha_mbhc_get_result_params(struct wcd9xxx *wcd9xxx, if ((c1 < 2) && x1) usleep_range(5000, 5050); if (!c1 || !x1) { if (!c1) { dev_dbg(wcd9xxx->dev, "%s: Impedance detect ramp error, c1=%d, x1=0x%x\n", __func__, c1, x1); Loading Loading @@ -5241,6 +5246,22 @@ static int tasha_codec_config_ear_spkr_gain(struct snd_soc_codec *codec, return 0; } static void tasha_codec_set_offset_val(int *offset_val, int gain_offset, int mult) { switch (gain_offset) { case RX_GAIN_OFFSET_M0P5_DB: *offset_val = 1 * mult; break; case RX_GAIN_OFFSET_M1P5_DB: *offset_val = 2 * mult; break; default: pr_err("Improper gain offset\n"); break; } } static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { Loading Loading @@ -5288,7 +5309,7 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL || Loading @@ -5303,7 +5324,8 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x01); offset_val = -2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, -1); } val = snd_soc_read(codec, gain_reg); val += offset_val; Loading @@ -5311,7 +5333,7 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, tasha_codec_config_ear_spkr_gain(codec, event, gain_reg); break; case SND_SOC_DAPM_POST_PMD: if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL || Loading @@ -5326,7 +5348,8 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x00); offset_val = 2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, 1); val = snd_soc_read(codec, gain_reg); val += offset_val; snd_soc_write(codec, gain_reg, val); Loading Loading @@ -5516,7 +5539,7 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMU: tasha_config_compander(codec, w->shift, event); /* apply gain after int clk is enabled */ if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL || Loading @@ -5531,7 +5554,8 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x01); offset_val = -2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, -1); } val = snd_soc_read(codec, gain_reg); val += offset_val; Loading @@ -5541,7 +5565,7 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMD: tasha_config_compander(codec, w->shift, event); tasha_codec_enable_prim_interpolator(codec, reg, event); if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL || Loading @@ -5556,7 +5580,8 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x00); offset_val = 2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, 1); val = snd_soc_read(codec, gain_reg); val += offset_val; snd_soc_write(codec, gain_reg, val); Loading Loading @@ -12533,8 +12558,8 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_common_val[] = { {WCD9335_CDC_CLSH_K2_MSB, 0x0F, 0x00}, {WCD9335_CDC_CLSH_K2_LSB, 0xFF, 0x60}, {WCD9335_CPE_SS_DMIC_CFG, 0x80, 0x00}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x70, 0x50}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x70, 0x50}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_RX7_RX_PATH_CFG1, 0x08, 0x08}, {WCD9335_CDC_RX8_RX_PATH_CFG1, 0x08, 0x08}, {WCD9335_ANA_LO_1_2, 0x3C, 0X3C}, Loading Loading @@ -13614,7 +13639,7 @@ static int tasha_codec_probe(struct snd_soc_codec *codec) for (i = 0; i < COMPANDER_MAX; i++) tasha->comp_enabled[i] = 0; tasha->spkr_gain_offset = RX_GAIN_OFFSET_0_DB; tasha->spkr_gain_offset = RX_GAIN_OFFSET_M0P5_DB; tasha->intf_type = wcd9xxx_get_intf_type(); tasha_update_reg_reset_values(codec); pr_debug("%s: MCLK Rate = %x\n", __func__, control->mclk_rate); Loading sound/soc/codecs/wcd9335.h +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ enum { */ enum { RX_GAIN_OFFSET_M1P5_DB, RX_GAIN_OFFSET_M0P5_DB, RX_GAIN_OFFSET_0_DB, }; Loading Loading
drivers/mfd/wcd9xxx-slimslave.c +14 −1 Original line number Diff line number Diff line Loading @@ -10,10 +10,13 @@ * GNU General Public License for more details. */ #include <linux/slab.h> #include <linux/delay.h> #include <linux/mutex.h> #include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h> #include <linux/mfd/wcd9xxx/wcd9xxx_registers.h> #define SLIM_RETRY_MAX 3 struct wcd9xxx_slim_sch { u16 rx_port_ch_reg_base; u16 port_tx_cfg_reg_base; Loading Loading @@ -426,6 +429,7 @@ int wcd9xxx_close_slim_sch_rx(struct wcd9xxx *wcd9xxx, int ch_cnt = 0 ; int ret = 0; struct wcd9xxx_ch *rx; u32 retry = 0; list_for_each_entry(rx, wcd9xxx_ch_list, list) sph[ch_cnt++] = rx->sph; Loading @@ -435,7 +439,16 @@ int wcd9xxx_close_slim_sch_rx(struct wcd9xxx *wcd9xxx, /* slim_control_ch (REMOVE) */ pr_debug("%s before slim_control_ch grph %d\n", __func__, grph); ret = slim_control_ch(wcd9xxx->slim, grph, SLIM_CH_REMOVE, true); do { ret = slim_control_ch(wcd9xxx->slim, grph, SLIM_CH_REMOVE, true); if (ret < 0) { retry++; pr_err("%s: failed ret[%d] retry_cnt:%d\n", __func__, ret, retry); usleep_range(5000, 5100); } } while (ret < 0 && (retry < SLIM_RETRY_MAX)); if (ret < 0) { pr_err("%s: slim_control_ch failed ret[%d]\n", __func__, ret); goto err; Loading
sound/soc/codecs/wcd-mbhc-v2.c +123 −21 Original line number Diff line number Diff line Loading @@ -9,6 +9,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2015 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> Loading Loading @@ -44,18 +49,22 @@ #define SPECIAL_HS_DETECT_TIME_MS (2 * 1000) #define MBHC_BUTTON_PRESS_THRESHOLD_MIN 250 #define GND_MIC_SWAP_THRESHOLD 4 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 100 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 150 #define HS_VREF_MIN_VAL 1400 #define FW_READ_ATTEMPTS 15 #define FW_READ_TIMEOUT 4000000 #define FAKE_REM_RETRY_ATTEMPTS 3 #define MAX_IMPED 60000 #define FAKE_REM_RETRY_ATTEMPTS 10 #define WCD_MBHC_BTN_PRESS_COMPL_TIMEOUT_MS 50 #define ANC_DETECT_RETRY_CNT 7 #define WCD_MBHC_SPL_HS_CNT 1 static bool skip_impdet_retry; static bool lineout_detected; static int det_extn_cable_en; static int is_anc_mic_insert = -1; module_param(det_extn_cable_en, int, S_IRUGO | S_IWUSR | S_IWGRP); MODULE_PARM_DESC(det_extn_cable_en, "enable/disable extn cable detect"); Loading @@ -67,6 +76,32 @@ enum wcd_mbhc_cs_mb_en_flag { WCD_MBHC_EN_NONE, }; int wcd_mbhc_jack_is_anc_mic_insert(void) { return is_anc_mic_insert; } static void wcd_mbhc_jack_anc_insert_update(u32/*enum snd_jack_type*/ hs_type) { switch(hs_type) { case SND_JACK_HEADPHONE: is_anc_mic_insert = 0; break; case SND_JACK_HEADSET: is_anc_mic_insert = 1; break; case SND_JACK_ANC_HEADPHONE: is_anc_mic_insert = 2; break; case SND_JACK_STEREO_MICROPHONE: is_anc_mic_insert = 3; break; default : is_anc_mic_insert = -1; break; } pr_debug("wcd_mbhc_jack_anc_insert_update is_anc_mic_insert:%d", is_anc_mic_insert); } static void wcd_mbhc_jack_report(struct wcd_mbhc *mbhc, struct snd_soc_jack *jack, int status, int mask) { Loading Loading @@ -608,6 +643,7 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, { struct snd_soc_codec *codec = mbhc->codec; bool is_pa_on = false; bool skip_report = false; WCD_MBHC_RSC_ASSERT_LOCKED(mbhc); Loading Loading @@ -648,6 +684,9 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, } mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->extn_cable_inserted = false; lineout_detected = false; if (!skip_impdet_retry) mbhc->zl = mbhc->zr = 0; pr_debug("%s: Reporting removal %d(%x)\n", __func__, jack_type, mbhc->hph_status); Loading Loading @@ -687,6 +726,8 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->micbias_enable = false; } mbhc->hph_type = WCD_MBHC_HPH_NONE; lineout_detected = false; if (!skip_impdet_retry) mbhc->zl = mbhc->zr = 0; pr_debug("%s: Reporting removal (%x)\n", __func__, mbhc->hph_status); Loading Loading @@ -728,6 +769,8 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->jiffies_atreport = jiffies; } else if (jack_type == SND_JACK_LINEOUT) { mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH; skip_report = true; pr_debug("%s: extension cable detected\n", __func__); } else if (jack_type == SND_JACK_ANC_HEADPHONE) mbhc->current_plug = MBHC_PLUG_TYPE_ANC_HEADPHONE; Loading @@ -738,16 +781,42 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->mbhc_cb->compute_impedance && (mbhc->mbhc_cfg->linein_th != 0) && (!is_pa_on)) { if (!skip_impdet_retry) { mbhc->mbhc_cb->compute_impedance(mbhc, &mbhc->zl, &mbhc->zr); if ((mbhc->zl > mbhc->mbhc_cfg->linein_th && mbhc->zl < MAX_IMPED) && (mbhc->zr > mbhc->mbhc_cfg->linein_th && mbhc->zr < MAX_IMPED) && (jack_type == SND_JACK_HEADPHONE)) { pr_debug("%s: impedance L:%d R:%d\n", __func__, mbhc->zl, mbhc->zr); } else { pr_debug("%s: skip impedance detection\n", __func__); } if (jack_type == SND_JACK_HEADPHONE) skip_impdet_retry = true; else skip_impdet_retry = false; if (mbhc->zl > mbhc->mbhc_cfg->linein_th && jack_type == SND_JACK_ANC_HEADPHONE) { if(!wcd_mbhc_is_hph_pa_on(mbhc)) { jack_type = SND_JACK_STEREO_MICROPHONE; mbhc->current_plug = MBHC_PLUG_TYPE_STEREO_MICROPHONE; mbhc->hph_status &= ~SND_JACK_HEADPHONE; pr_debug("%s: Stereo microphone detected\n", __func__); } else { pr_debug("%s: Skip Stereo microphone reporting\n", __func__); } } else if (mbhc->zl > mbhc->mbhc_cfg->linein_th && mbhc->zr > mbhc->mbhc_cfg->linein_th && jack_type == SND_JACK_HEADPHONE) { jack_type = SND_JACK_LINEOUT; mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH; if (mbhc->hph_status) { lineout_detected = true; if (mbhc->hph_status && mbhc->hph_status != SND_JACK_LINEOUT) { mbhc->hph_status &= ~(SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_UNSUPPORTED); Loading @@ -763,11 +832,16 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->hph_status |= jack_type; if (!skip_report) { pr_debug("%s: Reporting insertion %d(%x)\n", __func__, jack_type, mbhc->hph_status); wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack, (mbhc->hph_status | SND_JACK_MECHANICAL), (mbhc->hph_status | SND_JACK_MECHANICAL), WCD_MBHC_JACK_MASK); } else { pr_debug("%s: Skip reporting insertion\n", __func__); } wcd_mbhc_clr_and_turnon_hph_padac(mbhc); } pr_debug("%s: leave hph_status %x\n", __func__, mbhc->hph_status); Loading Loading @@ -930,6 +1004,7 @@ static void wcd_mbhc_find_plug_and_report(struct wcd_mbhc *mbhc, mbhc->current_plug, plug_type); } exit: wcd_mbhc_jack_anc_insert_update(mbhc->hph_status);//hph_status is updated with latest info pr_debug("%s: leave\n", __func__); } Loading Loading @@ -1089,6 +1164,7 @@ static void wcd_mbhc_update_fsm_source(struct wcd_mbhc *mbhc, break; case MBHC_PLUG_TYPE_HEADSET: case MBHC_PLUG_TYPE_ANC_HEADPHONE: case MBHC_PLUG_TYPE_STEREO_MICROPHONE: if (!mbhc->is_hs_recording && !micbias2) WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 3); break; Loading Loading @@ -1211,6 +1287,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch); codec = mbhc->codec; /* Wait for debounce time 200ms for extension cable */ if (mbhc->extn_cable_inserted) msleep(200); /* * Enable micbias/pullup for detection in correct work. * This work will get scheduled from detect_plug_type which Loading Loading @@ -1422,7 +1502,9 @@ correct_plug_type: if (((mbhc->current_plug != MBHC_PLUG_TYPE_HEADSET) && (mbhc->current_plug != MBHC_PLUG_TYPE_ANC_HEADPHONE)) && MBHC_PLUG_TYPE_ANC_HEADPHONE) && (mbhc->current_plug != MBHC_PLUG_TYPE_STEREO_MICROPHONE)) && !wcd_swch_level_remove(mbhc) && !mbhc->btn_press_intr) { pr_debug("%s: cable is %sheadset\n", Loading @@ -1439,6 +1521,9 @@ correct_plug_type: if (!wrk_complete && mbhc->btn_press_intr) { pr_debug("%s: Can be slow insertion of headphone\n", __func__); wcd_cancel_btn_work(mbhc); if (lineout_detected) plug_type = MBHC_PLUG_TYPE_HIGH_HPH; else plug_type = MBHC_PLUG_TYPE_HEADPHONE; } /* Loading @@ -1446,14 +1531,15 @@ correct_plug_type: * detect_plug-type or in above while loop, no need to report again */ if (!wrk_complete && ((plug_type == MBHC_PLUG_TYPE_HEADSET) || (plug_type == MBHC_PLUG_TYPE_ANC_HEADPHONE))) { (plug_type == MBHC_PLUG_TYPE_ANC_HEADPHONE) || (plug_type == MBHC_PLUG_TYPE_STEREO_MICROPHONE))) { pr_debug("%s: plug_type:0x%x already reported\n", __func__, mbhc->current_plug); goto enable_supply; } if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH && (!det_extn_cable_en)) { (!det_extn_cable_en) && (!lineout_detected)) { if (wcd_is_special_headset(mbhc)) { pr_debug("%s: Special headset found %d\n", __func__, plug_type); Loading Loading @@ -1532,6 +1618,8 @@ exit: if (mbhc->mbhc_cb->hph_pull_down_ctrl) mbhc->mbhc_cb->hph_pull_down_ctrl(codec, true); skip_impdet_retry = false; mbhc->mbhc_cb->lock_sleep(mbhc, false); pr_debug("%s: leave\n", __func__); } Loading Loading @@ -1588,6 +1676,10 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) /* Set the detection type appropriately */ WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MECH_DETECTION_TYPE, !detection_type); if (!detection_type) { //reset headset type at hs removing wcd_mbhc_jack_anc_insert_update(-1); } pr_debug("%s: mbhc->current_plug: %d detection_type: %d\n", __func__, mbhc->current_plug, detection_type); Loading Loading @@ -1685,6 +1777,15 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_SCHMT_ISRC, 0); wcd_mbhc_report_plug(mbhc, 0, SND_JACK_ANC_HEADPHONE); } else if (mbhc->current_plug == MBHC_PLUG_TYPE_STEREO_MICROPHONE) { wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_REM, false); wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_INS, false); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_DETECTION_TYPE, 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ELECT_SCHMT_ISRC, 0); wcd_mbhc_report_plug(mbhc, 0, SND_JACK_STEREO_MICROPHONE); } } else if (!detection_type) { /* Disable external voltage source to micbias if present */ Loading @@ -1694,7 +1795,6 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 0); } mbhc->in_swch_irq_handler = false; WCD_MBHC_RSC_UNLOCK(mbhc); pr_debug("%s: leave\n", __func__); Loading Loading @@ -1825,6 +1925,7 @@ determine_plug: hphl_trigerred = 0; mic_trigerred = 0; mbhc->is_extn_cable = true; mbhc->extn_cable_inserted = true; mbhc->btn_press_intr = false; mbhc->is_btn_press = false; wcd_mbhc_detect_plug_type(mbhc); Loading Loading @@ -2831,6 +2932,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, mbhc->btn_press_intr = false; mbhc->is_hs_recording = false; mbhc->is_extn_cable = false; mbhc->extn_cable_inserted = false; mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->wcd_mbhc_regs = wcd_mbhc_regs; Loading
sound/soc/codecs/wcd-mbhc-v2.h +8 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2015 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #ifndef __WCD_MBHC_V2_H__ #define __WCD_MBHC_V2_H__ Loading @@ -22,7 +27,7 @@ #define WCD_MBHC_DEF_BUTTONS 8 #define WCD_MBHC_KEYCODE_NUM 8 #define WCD_MBHC_USLEEP_RANGE_MARGIN_US 100 #define WCD_MBHC_THR_HS_MICB_MV 2700 #define WCD_MBHC_THR_HS_MICB_MV 2750 /* z value defined in Ohms */ #define WCD_MONO_HS_MIN_THR 2 #define WCD_MBHC_STRINGIFY(s) __stringify(s) Loading Loading @@ -82,6 +87,7 @@ enum wcd_mbhc_plug_type { MBHC_PLUG_TYPE_HIGH_HPH, MBHC_PLUG_TYPE_GND_MIC_SWAP, MBHC_PLUG_TYPE_ANC_HEADPHONE, MBHC_PLUG_TYPE_STEREO_MICROPHONE, }; enum pa_dac_ack_flags { Loading Loading @@ -423,6 +429,7 @@ struct wcd_mbhc { bool btn_press_intr; bool is_hs_recording; bool is_extn_cable; bool extn_cable_inserted; bool skip_imped_detection; bool is_btn_already_regd; Loading
sound/soc/codecs/wcd9335.c +39 −14 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * NOTE: This file has been modified by Sony Mobile Communications Inc. * Modifications are Copyright (c) 2016 Sony Mobile Communications Inc, * and licensed under the license of the file. */ #include <linux/module.h> #include <linux/init.h> #include <linux/firmware.h> Loading Loading @@ -869,8 +874,8 @@ static const struct tasha_reg_mask_val tasha_spkr_default[] = { {WCD9335_CDC_COMPANDER8_CTL3, 0x80, 0x80}, {WCD9335_CDC_COMPANDER7_CTL7, 0x01, 0x01}, {WCD9335_CDC_COMPANDER8_CTL7, 0x01, 0x01}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x50}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x50}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x58}, }; static const struct tasha_reg_mask_val tasha_spkr_mode1[] = { Loading Loading @@ -1857,7 +1862,7 @@ static inline void tasha_mbhc_get_result_params(struct wcd9xxx *wcd9xxx, if ((c1 < 2) && x1) usleep_range(5000, 5050); if (!c1 || !x1) { if (!c1) { dev_dbg(wcd9xxx->dev, "%s: Impedance detect ramp error, c1=%d, x1=0x%x\n", __func__, c1, x1); Loading Loading @@ -5241,6 +5246,22 @@ static int tasha_codec_config_ear_spkr_gain(struct snd_soc_codec *codec, return 0; } static void tasha_codec_set_offset_val(int *offset_val, int gain_offset, int mult) { switch (gain_offset) { case RX_GAIN_OFFSET_M0P5_DB: *offset_val = 1 * mult; break; case RX_GAIN_OFFSET_M1P5_DB: *offset_val = 2 * mult; break; default: pr_err("Improper gain offset\n"); break; } } static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { Loading Loading @@ -5288,7 +5309,7 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL || Loading @@ -5303,7 +5324,8 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x01); offset_val = -2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, -1); } val = snd_soc_read(codec, gain_reg); val += offset_val; Loading @@ -5311,7 +5333,7 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, tasha_codec_config_ear_spkr_gain(codec, event, gain_reg); break; case SND_SOC_DAPM_POST_PMD: if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_MIX_CTL || Loading @@ -5326,7 +5348,8 @@ static int tasha_codec_enable_mix_path(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x00); offset_val = 2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, 1); val = snd_soc_read(codec, gain_reg); val += offset_val; snd_soc_write(codec, gain_reg, val); Loading Loading @@ -5516,7 +5539,7 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMU: tasha_config_compander(codec, w->shift, event); /* apply gain after int clk is enabled */ if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL || Loading @@ -5531,7 +5554,8 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x01); offset_val = -2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, -1); } val = snd_soc_read(codec, gain_reg); val += offset_val; Loading @@ -5541,7 +5565,7 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMD: tasha_config_compander(codec, w->shift, event); tasha_codec_enable_prim_interpolator(codec, reg, event); if ((tasha->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) && if ((tasha->spkr_gain_offset != RX_GAIN_OFFSET_0_DB) && (tasha->comp_enabled[COMPANDER_7] || tasha->comp_enabled[COMPANDER_8]) && (gain_reg == WCD9335_CDC_RX7_RX_VOL_CTL || Loading @@ -5556,7 +5580,8 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WCD9335_CDC_RX8_RX_PATH_MIX_SEC0, 0x01, 0x00); offset_val = 2; tasha_codec_set_offset_val(&offset_val, tasha->spkr_gain_offset, 1); val = snd_soc_read(codec, gain_reg); val += offset_val; snd_soc_write(codec, gain_reg, val); Loading Loading @@ -12533,8 +12558,8 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_common_val[] = { {WCD9335_CDC_CLSH_K2_MSB, 0x0F, 0x00}, {WCD9335_CDC_CLSH_K2_LSB, 0xFF, 0x60}, {WCD9335_CPE_SS_DMIC_CFG, 0x80, 0x00}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x70, 0x50}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x70, 0x50}, {WCD9335_CDC_BOOST0_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_BOOST1_BOOST_CTL, 0x7C, 0x58}, {WCD9335_CDC_RX7_RX_PATH_CFG1, 0x08, 0x08}, {WCD9335_CDC_RX8_RX_PATH_CFG1, 0x08, 0x08}, {WCD9335_ANA_LO_1_2, 0x3C, 0X3C}, Loading Loading @@ -13614,7 +13639,7 @@ static int tasha_codec_probe(struct snd_soc_codec *codec) for (i = 0; i < COMPANDER_MAX; i++) tasha->comp_enabled[i] = 0; tasha->spkr_gain_offset = RX_GAIN_OFFSET_0_DB; tasha->spkr_gain_offset = RX_GAIN_OFFSET_M0P5_DB; tasha->intf_type = wcd9xxx_get_intf_type(); tasha_update_reg_reset_values(codec); pr_debug("%s: MCLK Rate = %x\n", __func__, control->mclk_rate); Loading
sound/soc/codecs/wcd9335.h +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ enum { */ enum { RX_GAIN_OFFSET_M1P5_DB, RX_GAIN_OFFSET_M0P5_DB, RX_GAIN_OFFSET_0_DB, }; Loading