Merge branch 'topic/arizona' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-w-codec
This commit is contained in:
commit
60d66c9a24
|
@ -735,7 +735,25 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
|
|||
struct snd_kcontrol *kcontrol,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
||||
struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
switch (w->shift) {
|
||||
case ARIZONA_OUT1L_ENA_SHIFT:
|
||||
case ARIZONA_OUT1R_ENA_SHIFT:
|
||||
case ARIZONA_OUT2L_ENA_SHIFT:
|
||||
case ARIZONA_OUT2R_ENA_SHIFT:
|
||||
case ARIZONA_OUT3L_ENA_SHIFT:
|
||||
case ARIZONA_OUT3R_ENA_SHIFT:
|
||||
priv->out_up_pending++;
|
||||
priv->out_up_delay += 17;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
switch (w->shift) {
|
||||
case ARIZONA_OUT1L_ENA_SHIFT:
|
||||
|
@ -744,13 +762,50 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
|
|||
case ARIZONA_OUT2R_ENA_SHIFT:
|
||||
case ARIZONA_OUT3L_ENA_SHIFT:
|
||||
case ARIZONA_OUT3R_ENA_SHIFT:
|
||||
msleep(17);
|
||||
priv->out_up_pending--;
|
||||
if (!priv->out_up_pending) {
|
||||
msleep(priv->out_up_delay);
|
||||
priv->out_up_delay = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
switch (w->shift) {
|
||||
case ARIZONA_OUT1L_ENA_SHIFT:
|
||||
case ARIZONA_OUT1R_ENA_SHIFT:
|
||||
case ARIZONA_OUT2L_ENA_SHIFT:
|
||||
case ARIZONA_OUT2R_ENA_SHIFT:
|
||||
case ARIZONA_OUT3L_ENA_SHIFT:
|
||||
case ARIZONA_OUT3R_ENA_SHIFT:
|
||||
priv->out_down_pending++;
|
||||
priv->out_down_delay++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
switch (w->shift) {
|
||||
case ARIZONA_OUT1L_ENA_SHIFT:
|
||||
case ARIZONA_OUT1R_ENA_SHIFT:
|
||||
case ARIZONA_OUT2L_ENA_SHIFT:
|
||||
case ARIZONA_OUT2R_ENA_SHIFT:
|
||||
case ARIZONA_OUT3L_ENA_SHIFT:
|
||||
case ARIZONA_OUT3R_ENA_SHIFT:
|
||||
priv->out_down_pending--;
|
||||
if (!priv->out_down_pending) {
|
||||
msleep(priv->out_down_delay);
|
||||
priv->out_down_delay = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -774,6 +829,9 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w,
|
|||
case SND_SOC_DAPM_PRE_PMD:
|
||||
val = 0;
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
return arizona_out_ev(w, kcontrol, event);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,11 @@ struct arizona_priv {
|
|||
int num_inputs;
|
||||
unsigned int in_pending;
|
||||
|
||||
unsigned int out_up_pending;
|
||||
unsigned int out_up_delay;
|
||||
unsigned int out_down_pending;
|
||||
unsigned int out_down_delay;
|
||||
|
||||
unsigned int spk_ena:2;
|
||||
unsigned int spk_ena_pending:1;
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <linux/mfd/arizona/core.h>
|
||||
#include <linux/mfd/arizona/registers.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "arizona.h"
|
||||
#include "wm5102.h"
|
||||
|
@ -617,11 +618,10 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
|
|||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
|
||||
uint16_t data;
|
||||
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
data = cpu_to_be16(arizona->dac_comp_coeff);
|
||||
memcpy(ucontrol->value.bytes.data, &data, sizeof(data));
|
||||
put_unaligned_be16(arizona->dac_comp_coeff,
|
||||
ucontrol->value.bytes.data);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
return 0;
|
||||
|
@ -1272,19 +1272,24 @@ SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
|
|||
|
||||
SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
|
|
|
@ -905,22 +905,28 @@ SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
|
|||
|
||||
SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
|
|
|
@ -610,13 +610,16 @@ SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
|
|||
|
||||
SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
|
||||
ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
|
||||
SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
|
||||
ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
|
||||
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
|
||||
|
|
Loading…
Reference in New Issue