Skip to content

Commit

Permalink
Merge tag 'asoc-fix-v5.16-rc1' of https://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.16

A relatively large collection of fixes that came in since the merge
window, though a lot of this is just a collection of new machine quirks
for x86 platforms.
  • Loading branch information
tiwai committed Nov 18, 2021
2 parents 05ec716 + 424fe7e commit 547a4a6
Show file tree
Hide file tree
Showing 29 changed files with 519 additions and 75 deletions.
14 changes: 7 additions & 7 deletions sound/soc/codecs/cs35l41.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ static const struct snd_soc_dapm_widget cs35l41_dapm_widgets[] = {
SND_SOC_DAPM_AIF_OUT("ASPTX3", NULL, 0, CS35L41_SP_ENABLES, 2, 0),
SND_SOC_DAPM_AIF_OUT("ASPTX4", NULL, 0, CS35L41_SP_ENABLES, 3, 0),

SND_SOC_DAPM_SIGGEN("VSENSE"),
SND_SOC_DAPM_SIGGEN("ISENSE"),
SND_SOC_DAPM_SIGGEN("VP"),
SND_SOC_DAPM_SIGGEN("VBST"),
SND_SOC_DAPM_SIGGEN("TEMP"),

SND_SOC_DAPM_ADC("VMON ADC", NULL, CS35L41_PWR_CTRL2, 12, 0),
SND_SOC_DAPM_ADC("IMON ADC", NULL, CS35L41_PWR_CTRL2, 13, 0),
SND_SOC_DAPM_ADC("VPMON ADC", NULL, CS35L41_PWR_CTRL2, 8, 0),
Expand All @@ -623,12 +629,6 @@ static const struct snd_soc_dapm_widget cs35l41_dapm_widgets[] = {
cs35l41_main_amp_event,
SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_PMU),

SND_SOC_DAPM_INPUT("VP"),
SND_SOC_DAPM_INPUT("VBST"),
SND_SOC_DAPM_INPUT("ISENSE"),
SND_SOC_DAPM_INPUT("VSENSE"),
SND_SOC_DAPM_INPUT("TEMP"),

SND_SOC_DAPM_MUX("ASP TX1 Source", SND_SOC_NOPM, 0, 0, &asp_tx1_mux),
SND_SOC_DAPM_MUX("ASP TX2 Source", SND_SOC_NOPM, 0, 0, &asp_tx2_mux),
SND_SOC_DAPM_MUX("ASP TX3 Source", SND_SOC_NOPM, 0, 0, &asp_tx3_mux),
Expand Down Expand Up @@ -674,8 +674,8 @@ static const struct snd_soc_dapm_route cs35l41_audio_map[] = {
{"VMON ADC", NULL, "VSENSE"},
{"IMON ADC", NULL, "ISENSE"},
{"VPMON ADC", NULL, "VP"},
{"TEMPMON ADC", NULL, "TEMP"},
{"VBSTMON ADC", NULL, "VBST"},
{"TEMPMON ADC", NULL, "TEMP"},

{"ASPRX1", NULL, "AMP Playback"},
{"ASPRX2", NULL, "AMP Playback"},
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/lpass-rx-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ static int rx_macro_config_classh(struct snd_soc_component *component,
snd_soc_component_update_bits(component,
CDC_RX_CLSH_DECAY_CTRL,
CDC_RX_CLSH_DECAY_RATE_MASK, 0x0);
snd_soc_component_update_bits(component,
snd_soc_component_write_field(component,
CDC_RX_RX1_RX_PATH_CFG0,
CDC_RX_RXn_CLSH_EN_MASK, 0x1);
break;
Expand Down
55 changes: 49 additions & 6 deletions sound/soc/codecs/rt1011.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,13 +1311,54 @@ static int rt1011_r0_load_info(struct snd_kcontrol *kcontrol,
.put = rt1011_r0_load_mode_put \
}

static const char * const rt1011_i2s_ref_texts[] = {
"Left Channel", "Right Channel"
static const char * const rt1011_i2s_ref[] = {
"None", "Left Channel", "Right Channel"
};

static SOC_ENUM_SINGLE_DECL(rt1011_i2s_ref_enum,
RT1011_TDM1_SET_1, 7,
rt1011_i2s_ref_texts);
static SOC_ENUM_SINGLE_DECL(rt1011_i2s_ref_enum, 0, 0,
rt1011_i2s_ref);

static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct rt1011_priv *rt1011 =
snd_soc_component_get_drvdata(component);

rt1011->i2s_ref = ucontrol->value.enumerated.item[0];
switch (rt1011->i2s_ref) {
case RT1011_I2S_REF_LEFT_CH:
regmap_write(rt1011->regmap, RT1011_TDM_TOTAL_SET, 0x0240);
regmap_write(rt1011->regmap, RT1011_TDM1_SET_2, 0x8);
regmap_write(rt1011->regmap, RT1011_TDM1_SET_1, 0x1022);
regmap_write(rt1011->regmap, RT1011_ADCDAT_OUT_SOURCE, 0x4);
break;
case RT1011_I2S_REF_RIGHT_CH:
regmap_write(rt1011->regmap, RT1011_TDM_TOTAL_SET, 0x0240);
regmap_write(rt1011->regmap, RT1011_TDM1_SET_2, 0x8);
regmap_write(rt1011->regmap, RT1011_TDM1_SET_1, 0x10a2);
regmap_write(rt1011->regmap, RT1011_ADCDAT_OUT_SOURCE, 0x4);
break;
default:
dev_info(component->dev, "I2S Reference: Do nothing\n");
}

return 0;
}

static int rt1011_i2s_ref_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct rt1011_priv *rt1011 =
snd_soc_component_get_drvdata(component);

ucontrol->value.enumerated.item[0] = rt1011->i2s_ref;

return 0;
}

static const struct snd_kcontrol_new rt1011_snd_controls[] = {
/* I2S Data In Selection */
Expand Down Expand Up @@ -1358,7 +1399,8 @@ static const struct snd_kcontrol_new rt1011_snd_controls[] = {
SOC_SINGLE("R0 Temperature", RT1011_STP_INITIAL_RESISTANCE_TEMP,
2, 255, 0),
/* I2S Reference */
SOC_ENUM("I2S Reference", rt1011_i2s_ref_enum),
SOC_ENUM_EXT("I2S Reference", rt1011_i2s_ref_enum,
rt1011_i2s_ref_get, rt1011_i2s_ref_put),
};

static int rt1011_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
Expand Down Expand Up @@ -2017,6 +2059,7 @@ static int rt1011_probe(struct snd_soc_component *component)

schedule_work(&rt1011->cali_work);

rt1011->i2s_ref = 0;
rt1011->bq_drc_params = devm_kcalloc(component->dev,
RT1011_ADVMODE_NUM, sizeof(struct rt1011_bq_drc_params *),
GFP_KERNEL);
Expand Down
7 changes: 7 additions & 0 deletions sound/soc/codecs/rt1011.h
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ enum {
RT1011_AIFS
};

enum {
RT1011_I2S_REF_NONE,
RT1011_I2S_REF_LEFT_CH,
RT1011_I2S_REF_RIGHT_CH,
};

/* BiQual & DRC related settings */
#define RT1011_BQ_DRC_NUM 128
struct rt1011_bq_drc_params {
Expand Down Expand Up @@ -692,6 +698,7 @@ struct rt1011_priv {
unsigned int r0_reg, cali_done;
unsigned int r0_calib, temperature_calib;
int recv_spk_mode;
int i2s_ref;
};

#endif /* end of _RT1011_H_ */
1 change: 1 addition & 0 deletions sound/soc/codecs/rt5682-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
}

mutex_init(&rt5682->calibrate_mutex);
mutex_init(&rt5682->jdet_mutex);
rt5682_calibrate(rt5682);

rt5682_apply_patch_list(rt5682, &i2c->dev);
Expand Down
38 changes: 29 additions & 9 deletions sound/soc/codecs/rt5682.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ static const struct reg_sequence patch_list[] = {
{RT5682_SAR_IL_CMD_6, 0x0110},
{RT5682_CHARGE_PUMP_1, 0x0210},
{RT5682_HP_LOGIC_CTRL_2, 0x0007},
{RT5682_SAR_IL_CMD_2, 0xac00},
{RT5682_CBJ_CTRL_7, 0x0104},
};

void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev)
Expand Down Expand Up @@ -940,6 +942,10 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
snd_soc_component_update_bits(component,
RT5682_HP_CHARGE_PUMP_1,
RT5682_OSW_L_MASK | RT5682_OSW_R_MASK, 0);
rt5682_enable_push_button_irq(component, false);
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW);
usleep_range(55000, 60000);
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH);

Expand Down Expand Up @@ -1092,6 +1098,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
while (!rt5682->component->card->instantiated)
usleep_range(10000, 15000);

mutex_lock(&rt5682->jdet_mutex);
mutex_lock(&rt5682->calibrate_mutex);

val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
Expand Down Expand Up @@ -1165,6 +1172,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
}

mutex_unlock(&rt5682->calibrate_mutex);
mutex_unlock(&rt5682->jdet_mutex);
}
EXPORT_SYMBOL_GPL(rt5682_jack_detect_handler);

Expand Down Expand Up @@ -1514,6 +1522,7 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
{
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
Expand All @@ -1525,12 +1534,17 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
RT5682_DEPOP_1, 0x60, 0x60);
snd_soc_component_update_bits(component,
RT5682_DAC_ADC_DIG_VOL1, 0x00c0, 0x0080);

mutex_lock(&rt5682->jdet_mutex);

snd_soc_component_update_bits(component, RT5682_HP_CTRL_2,
RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN,
RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN);
usleep_range(5000, 10000);
snd_soc_component_update_bits(component, RT5682_CHARGE_PUMP_1,
RT5682_CP_SW_SIZE_MASK, RT5682_CP_SW_SIZE_L);

mutex_unlock(&rt5682->jdet_mutex);
break;

case SND_SOC_DAPM_POST_PMD:
Expand Down Expand Up @@ -2942,10 +2956,7 @@ static int rt5682_suspend(struct snd_soc_component *component)

cancel_delayed_work_sync(&rt5682->jack_detect_work);
cancel_delayed_work_sync(&rt5682->jd_check_work);
if (rt5682->hs_jack && rt5682->jack_type == SND_JACK_HEADSET) {
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
RT5682_MB1_PATH_MASK | RT5682_MB2_PATH_MASK,
RT5682_CTRL_MB1_REG | RT5682_CTRL_MB2_REG);
if (rt5682->hs_jack && (rt5682->jack_type & SND_JACK_HEADSET) == SND_JACK_HEADSET) {
val = snd_soc_component_read(component,
RT5682_CBJ_CTRL_2) & RT5682_JACK_TYPE_MASK;

Expand All @@ -2967,10 +2978,17 @@ static int rt5682_suspend(struct snd_soc_component *component)
/* enter SAR ADC power saving mode */
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK |
RT5682_SAR_BUTDET_RST_MASK | RT5682_SAR_SEL_MB1_MB2_MASK, 0);
RT5682_SAR_SEL_MB1_MB2_MASK, 0);
usleep_range(5000, 6000);
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
RT5682_MB1_PATH_MASK | RT5682_MB2_PATH_MASK,
RT5682_CTRL_MB1_REG | RT5682_CTRL_MB2_REG);
usleep_range(10000, 12000);
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK | RT5682_SAR_BUTDET_RST_MASK,
RT5682_SAR_BUTT_DET_EN | RT5682_SAR_BUTDET_POW_SAV | RT5682_SAR_BUTDET_RST_NORMAL);
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK,
RT5682_SAR_BUTT_DET_EN | RT5682_SAR_BUTDET_POW_SAV);
snd_soc_component_update_bits(component, RT5682_HP_CHARGE_PUMP_1,
RT5682_OSW_L_MASK | RT5682_OSW_R_MASK, 0);
}

regcache_cache_only(rt5682->regmap, true);
Expand All @@ -2988,19 +3006,21 @@ static int rt5682_resume(struct snd_soc_component *component)
regcache_cache_only(rt5682->regmap, false);
regcache_sync(rt5682->regmap);

if (rt5682->hs_jack && rt5682->jack_type == SND_JACK_HEADSET) {
if (rt5682->hs_jack && (rt5682->jack_type & SND_JACK_HEADSET) == SND_JACK_HEADSET) {
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
RT5682_SAR_BUTDET_MODE_MASK | RT5682_SAR_SEL_MB1_MB2_MASK,
RT5682_SAR_BUTDET_POW_NORM | RT5682_SAR_SEL_MB1_MB2_AUTO);
usleep_range(5000, 6000);
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
RT5682_MB1_PATH_MASK | RT5682_MB2_PATH_MASK,
RT5682_CTRL_MB1_FSM | RT5682_CTRL_MB2_FSM);
snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
RT5682_PWR_CBJ, RT5682_PWR_CBJ);
}

rt5682->jack_type = 0;
mod_delayed_work(system_power_efficient_wq,
&rt5682->jack_detect_work, msecs_to_jiffies(250));
&rt5682->jack_detect_work, msecs_to_jiffies(0));

return 0;
}
Expand Down
1 change: 1 addition & 0 deletions sound/soc/codecs/rt5682.h
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,7 @@ struct rt5682_priv {

int jack_type;
int irq_work_delay_time;
struct mutex jdet_mutex;
};

extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];
Expand Down
Loading

0 comments on commit 547a4a6

Please sign in to comment.