Skip to content

Bug fix: initial max volume level & default mode value. #2224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions sound/soc/bcm/allo-piano-dac-plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd,
rate = 192000;

if (lowpass > 14)
glb_ptr->set_lowpass = lowpass = 3;
glb_ptr->set_lowpass = lowpass = 0;

if (mode > 3)
glb_ptr->set_mode = mode = 0;
Expand Down Expand Up @@ -262,6 +262,7 @@ static int snd_allo_piano_dual_mode_put(struct snd_kcontrol *kcontrol,
glb_ptr->set_mode = 0;
} else {
glb_ptr->dual_mode = 0;
return 0;
}
}

Expand Down Expand Up @@ -441,6 +442,14 @@ static int pcm512x_set_reg_sub(struct snd_kcontrol *kcontrol,
return ret;
}

if (digital_gain_0db_limit) {
ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume",
207);
if (ret < 0)
dev_warn(card->dev, "Failed to set volume limit: %d\n",
ret);
}

ret = snd_soc_write(rtd->codec_dais[1]->codec,
PCM512x_DIGITAL_VOLUME_3, (~right_val));
if (ret < 0)
Expand Down Expand Up @@ -541,6 +550,14 @@ static int pcm512x_set_reg_master(struct snd_kcontrol *kcontrol,

rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);

if (digital_gain_0db_limit) {
ret = snd_soc_limit_volume(card, "Master Playback Volume",
207);
if (ret < 0)
dev_warn(card->dev, "Failed to set volume limit: %d\n",
ret);
}

if (glb_ptr->dual_mode != 1) {
ret = snd_soc_write(rtd->codec_dais[1]->codec,
PCM512x_DIGITAL_VOLUME_2, (~left_val));
Expand Down Expand Up @@ -693,6 +710,8 @@ static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd)

memset(glb_ptr, 0x00, sizeof(glb_ptr));
card->drvdata = glb_ptr;
glb_ptr->dual_mode = 2;
glb_ptr->set_mode = 0;

mutex_init(&glb_ptr->lock);

Expand Down Expand Up @@ -815,18 +834,6 @@ static int snd_allo_piano_dac_hw_params(
}
}

if (digital_gain_0db_limit) {
ret = snd_soc_limit_volume(card,
"Subwoofer Playback Volume", 207);
if (ret < 0)
dev_warn(card->dev, "Failed to set volume limit: %d\n",
ret);
ret = snd_soc_limit_volume(card, "Master Playback Volume", 207);
if (ret < 0)
dev_warn(card->dev, "Failed to set volume limit: %d\n",
ret);
}

ret = snd_allo_piano_dsp_program(rtd, glb_ptr->set_mode, rate,
glb_ptr->set_lowpass);
if (ret < 0)
Expand Down