mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 19:53:59 +08:00
Merge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/ab8500', 'asoc/topic/ac97', 'asoc/topic/ad1836' and 'asoc/topic/ad193x' into asoc-next
This commit is contained in:
commit
cce67af3b8
@ -586,10 +586,17 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value);
|
||||
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec);
|
||||
struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
||||
#define snd_soc_alloc_ac97_codec(codec) \
|
||||
snd_soc_alloc_ac97_component(&codec->component)
|
||||
#define snd_soc_new_ac97_codec(codec, id, id_mask) \
|
||||
snd_soc_new_ac97_component(&codec->component, id, id_mask)
|
||||
#define snd_soc_free_ac97_codec(ac97) \
|
||||
snd_soc_free_ac97_component(ac97)
|
||||
|
||||
struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component);
|
||||
struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component,
|
||||
unsigned int id, unsigned int id_mask);
|
||||
void snd_soc_free_ac97_codec(struct snd_ac97 *ac97);
|
||||
void snd_soc_free_ac97_component(struct snd_ac97 *ac97);
|
||||
|
||||
int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
|
||||
int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
|
||||
|
@ -139,7 +139,7 @@ struct pm860x_priv {
|
||||
unsigned int pcmclk;
|
||||
unsigned int dir;
|
||||
unsigned int filter;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct i2c_client *i2c;
|
||||
struct regmap *regmap;
|
||||
struct pm860x_chip *chip;
|
||||
@ -272,15 +272,15 @@ static int snd_soc_get_volsw_2r_st(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
int val[2], val2[2], i;
|
||||
|
||||
val[0] = snd_soc_read(codec, reg) & 0x3f;
|
||||
val[1] = (snd_soc_read(codec, PM860X_SIDETONE_SHIFT) >> 4) & 0xf;
|
||||
val2[0] = snd_soc_read(codec, reg2) & 0x3f;
|
||||
val2[1] = (snd_soc_read(codec, PM860X_SIDETONE_SHIFT)) & 0xf;
|
||||
val[0] = snd_soc_component_read32(component, reg) & 0x3f;
|
||||
val[1] = (snd_soc_component_read32(component, PM860X_SIDETONE_SHIFT) >> 4) & 0xf;
|
||||
val2[0] = snd_soc_component_read32(component, reg2) & 0x3f;
|
||||
val2[1] = (snd_soc_component_read32(component, PM860X_SIDETONE_SHIFT)) & 0xf;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(st_table); i++) {
|
||||
if ((st_table[i].m == val[0]) && (st_table[i].n == val[1]))
|
||||
@ -296,7 +296,7 @@ static int snd_soc_put_volsw_2r_st(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
int err;
|
||||
@ -308,18 +308,18 @@ static int snd_soc_put_volsw_2r_st(struct snd_kcontrol *kcontrol,
|
||||
if (val >= ARRAY_SIZE(st_table) || val2 >= ARRAY_SIZE(st_table))
|
||||
return -EINVAL;
|
||||
|
||||
err = snd_soc_update_bits(codec, reg, 0x3f, st_table[val].m);
|
||||
err = snd_soc_component_update_bits(component, reg, 0x3f, st_table[val].m);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_soc_update_bits(codec, PM860X_SIDETONE_SHIFT, 0xf0,
|
||||
err = snd_soc_component_update_bits(component, PM860X_SIDETONE_SHIFT, 0xf0,
|
||||
st_table[val].n << 4);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_soc_update_bits(codec, reg2, 0x3f, st_table[val2].m);
|
||||
err = snd_soc_component_update_bits(component, reg2, 0x3f, st_table[val2].m);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_soc_update_bits(codec, PM860X_SIDETONE_SHIFT, 0x0f,
|
||||
err = snd_soc_component_update_bits(component, PM860X_SIDETONE_SHIFT, 0x0f,
|
||||
st_table[val2].n);
|
||||
return err;
|
||||
}
|
||||
@ -329,15 +329,15 @@ static int snd_soc_get_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
int max = mc->max, val, val2;
|
||||
unsigned int mask = (1 << fls(max)) - 1;
|
||||
|
||||
val = snd_soc_read(codec, reg) >> shift;
|
||||
val2 = snd_soc_read(codec, reg2) >> shift;
|
||||
val = snd_soc_component_read32(component, reg) >> shift;
|
||||
val2 = snd_soc_component_read32(component, reg2) >> shift;
|
||||
ucontrol->value.integer.value[0] = (max - val) & mask;
|
||||
ucontrol->value.integer.value[1] = (max - val2) & mask;
|
||||
|
||||
@ -349,7 +349,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
@ -365,11 +365,11 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
val = val << shift;
|
||||
val2 = val2 << shift;
|
||||
|
||||
err = snd_soc_update_bits(codec, reg, val_mask, val);
|
||||
err = snd_soc_component_update_bits(component, reg, val_mask, val);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_soc_update_bits(codec, reg2, val_mask, val2);
|
||||
err = snd_soc_component_update_bits(component, reg2, val_mask, val2);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
static int pm860x_rsync_event(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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
|
||||
/*
|
||||
* In order to avoid current on the load, mute power-on and power-off
|
||||
@ -390,8 +390,8 @@ static int pm860x_rsync_event(struct snd_soc_dapm_widget *w,
|
||||
* Unmute by DAC_MUTE. It should be unmuted when DAPM sequence is
|
||||
* finished.
|
||||
*/
|
||||
snd_soc_update_bits(codec, PM860X_DAC_OFFSET, DAC_MUTE, 0);
|
||||
snd_soc_update_bits(codec, PM860X_EAR_CTRL_2,
|
||||
snd_soc_component_update_bits(component, PM860X_DAC_OFFSET, DAC_MUTE, 0);
|
||||
snd_soc_component_update_bits(component, PM860X_EAR_CTRL_2,
|
||||
RSYNC_CHANGE, RSYNC_CHANGE);
|
||||
return 0;
|
||||
}
|
||||
@ -399,7 +399,7 @@ static int pm860x_rsync_event(struct snd_soc_dapm_widget *w,
|
||||
static int pm860x_dac_event(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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
unsigned int dac = 0;
|
||||
int data;
|
||||
|
||||
@ -412,28 +412,28 @@ static int pm860x_dac_event(struct snd_soc_dapm_widget *w,
|
||||
if (dac) {
|
||||
/* Auto mute in power-on sequence. */
|
||||
dac |= MODULATOR;
|
||||
snd_soc_update_bits(codec, PM860X_DAC_OFFSET,
|
||||
snd_soc_component_update_bits(component, PM860X_DAC_OFFSET,
|
||||
DAC_MUTE, DAC_MUTE);
|
||||
snd_soc_update_bits(codec, PM860X_EAR_CTRL_2,
|
||||
snd_soc_component_update_bits(component, PM860X_EAR_CTRL_2,
|
||||
RSYNC_CHANGE, RSYNC_CHANGE);
|
||||
/* update dac */
|
||||
snd_soc_update_bits(codec, PM860X_DAC_EN_2,
|
||||
snd_soc_component_update_bits(component, PM860X_DAC_EN_2,
|
||||
dac, dac);
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
if (dac) {
|
||||
/* Auto mute in power-off sequence. */
|
||||
snd_soc_update_bits(codec, PM860X_DAC_OFFSET,
|
||||
snd_soc_component_update_bits(component, PM860X_DAC_OFFSET,
|
||||
DAC_MUTE, DAC_MUTE);
|
||||
snd_soc_update_bits(codec, PM860X_EAR_CTRL_2,
|
||||
snd_soc_component_update_bits(component, PM860X_EAR_CTRL_2,
|
||||
RSYNC_CHANGE, RSYNC_CHANGE);
|
||||
/* update dac */
|
||||
data = snd_soc_read(codec, PM860X_DAC_EN_2);
|
||||
data = snd_soc_component_read32(component, PM860X_DAC_EN_2);
|
||||
data &= ~dac;
|
||||
if (!(data & (DAC_LEFT | DAC_RIGHT)))
|
||||
data &= ~MODULATOR;
|
||||
snd_soc_write(codec, PM860X_DAC_EN_2, data);
|
||||
snd_soc_component_write(component, PM860X_DAC_EN_2, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -922,13 +922,13 @@ static const struct snd_soc_dapm_route pm860x_dapm_routes[] = {
|
||||
*/
|
||||
static int pm860x_digital_mute(struct snd_soc_dai *codec_dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
int data = 0, mask = MUTE_LEFT | MUTE_RIGHT;
|
||||
|
||||
if (mute)
|
||||
data = mask;
|
||||
snd_soc_update_bits(codec, PM860X_DAC_OFFSET, mask, data);
|
||||
snd_soc_update_bits(codec, PM860X_EAR_CTRL_2,
|
||||
snd_soc_component_update_bits(component, PM860X_DAC_OFFSET, mask, data);
|
||||
snd_soc_component_update_bits(component, PM860X_EAR_CTRL_2,
|
||||
RSYNC_CHANGE, RSYNC_CHANGE);
|
||||
return 0;
|
||||
}
|
||||
@ -937,7 +937,7 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
unsigned char inf = 0, mask = 0;
|
||||
|
||||
/* bit size */
|
||||
@ -952,7 +952,7 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
mask |= PCM_INF2_18WL;
|
||||
snd_soc_update_bits(codec, PM860X_PCM_IFACE_2, mask, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_PCM_IFACE_2, mask, inf);
|
||||
|
||||
/* sample rate */
|
||||
switch (params_rate(params)) {
|
||||
@ -971,7 +971,7 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_soc_update_bits(codec, PM860X_PCM_RATE, 0x0f, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_PCM_RATE, 0x0f, inf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -979,8 +979,8 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
static int pm860x_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
unsigned char inf = 0, mask = 0;
|
||||
int ret = -EINVAL;
|
||||
|
||||
@ -1012,15 +1012,15 @@ static int pm860x_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
mask |= PCM_MODE_MASK;
|
||||
if (ret)
|
||||
return ret;
|
||||
snd_soc_update_bits(codec, PM860X_PCM_IFACE_2, mask, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_PCM_IFACE_2, mask, inf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pm860x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (dir == PM860X_CLK_DIR_OUT)
|
||||
pm860x->dir = PM860X_CLK_DIR_OUT;
|
||||
@ -1034,7 +1034,7 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
unsigned char inf;
|
||||
|
||||
/* bit size */
|
||||
@ -1048,7 +1048,7 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_soc_update_bits(codec, PM860X_I2S_IFACE_2, PCM_INF2_18WL, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_I2S_IFACE_2, PCM_INF2_18WL, inf);
|
||||
|
||||
/* sample rate */
|
||||
switch (params_rate(params)) {
|
||||
@ -1076,7 +1076,7 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_soc_update_bits(codec, PM860X_I2S_IFACE_4, 0xf, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_I2S_IFACE_4, 0xf, inf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1084,8 +1084,8 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
static int pm860x_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
unsigned char inf = 0, mask = 0;
|
||||
|
||||
mask |= PCM_INF2_BCLK | PCM_INF2_FS | PCM_INF2_MASTER;
|
||||
@ -1116,14 +1116,14 @@ static int pm860x_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
return -EINVAL;
|
||||
}
|
||||
mask |= PCM_MODE_MASK;
|
||||
snd_soc_update_bits(codec, PM860X_I2S_IFACE_2, mask, inf);
|
||||
snd_soc_component_update_bits(component, PM860X_I2S_IFACE_2, mask, inf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pm860x_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int pm860x_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
int data;
|
||||
|
||||
switch (level) {
|
||||
@ -1134,7 +1134,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
/* Enable Audio PLL & Audio section */
|
||||
data = AUDIO_PLL | AUDIO_SECTION_ON;
|
||||
pm860x_reg_write(pm860x->i2c, REG_MISC2, data);
|
||||
@ -1216,7 +1216,7 @@ static struct snd_soc_dai_driver pm860x_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static irqreturn_t pm860x_codec_handler(int irq, void *data)
|
||||
static irqreturn_t pm860x_component_handler(int irq, void *data)
|
||||
{
|
||||
struct pm860x_priv *pm860x = data;
|
||||
int status, shrt, report = 0, mic_report = 0;
|
||||
@ -1230,7 +1230,7 @@ static irqreturn_t pm860x_codec_handler(int irq, void *data)
|
||||
#ifndef CONFIG_SND_SOC_88PM860X_MODULE
|
||||
if (status & (HEADSET_STATUS | MIC_STATUS | SHORT_HS1 | SHORT_HS2 |
|
||||
SHORT_LO1 | SHORT_LO2))
|
||||
trace_snd_soc_jack_irq(dev_name(pm860x->codec->dev));
|
||||
trace_snd_soc_jack_irq(dev_name(pm860x->component->dev));
|
||||
#endif
|
||||
|
||||
if ((pm860x->det.hp_det & SND_JACK_HEADPHONE)
|
||||
@ -1256,17 +1256,17 @@ static irqreturn_t pm860x_codec_handler(int irq, void *data)
|
||||
snd_soc_jack_report(pm860x->det.mic_jack, SND_JACK_MICROPHONE,
|
||||
SND_JACK_MICROPHONE);
|
||||
|
||||
dev_dbg(pm860x->codec->dev, "headphone report:0x%x, mask:%x\n",
|
||||
dev_dbg(pm860x->component->dev, "headphone report:0x%x, mask:%x\n",
|
||||
report, mask);
|
||||
dev_dbg(pm860x->codec->dev, "microphone report:0x%x\n", mic_report);
|
||||
dev_dbg(pm860x->component->dev, "microphone report:0x%x\n", mic_report);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int pm860x_hs_jack_detect(struct snd_soc_codec *codec,
|
||||
int pm860x_hs_jack_detect(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack,
|
||||
int det, int hook, int hs_shrt, int lo_shrt)
|
||||
{
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
int data;
|
||||
|
||||
pm860x->det.hp_jack = jack;
|
||||
@ -1290,15 +1290,15 @@ int pm860x_hs_jack_detect(struct snd_soc_codec *codec,
|
||||
}
|
||||
|
||||
/* sync status */
|
||||
pm860x_codec_handler(0, pm860x);
|
||||
pm860x_component_handler(0, pm860x);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm860x_hs_jack_detect);
|
||||
|
||||
int pm860x_mic_jack_detect(struct snd_soc_codec *codec,
|
||||
int pm860x_mic_jack_detect(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack, int det)
|
||||
{
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
|
||||
pm860x->det.mic_jack = jack;
|
||||
pm860x->det.mic_det = det;
|
||||
@ -1308,25 +1308,25 @@ int pm860x_mic_jack_detect(struct snd_soc_codec *codec,
|
||||
MICDET_MASK, MICDET_MASK);
|
||||
|
||||
/* sync status */
|
||||
pm860x_codec_handler(0, pm860x);
|
||||
pm860x_component_handler(0, pm860x);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
|
||||
|
||||
static int pm860x_probe(struct snd_soc_codec *codec)
|
||||
static int pm860x_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
int i, ret;
|
||||
|
||||
pm860x->codec = codec;
|
||||
snd_soc_codec_init_regmap(codec, pm860x->regmap);
|
||||
pm860x->component = component;
|
||||
snd_soc_component_init_regmap(component, pm860x->regmap);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
ret = request_threaded_irq(pm860x->irq[i], NULL,
|
||||
pm860x_codec_handler, IRQF_ONESHOT,
|
||||
pm860x_component_handler, IRQF_ONESHOT,
|
||||
pm860x->name[i], pm860x);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to request IRQ!\n");
|
||||
dev_err(component->dev, "Failed to request IRQ!\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1339,29 +1339,29 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pm860x_remove(struct snd_soc_codec *codec)
|
||||
static void pm860x_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
|
||||
struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
|
||||
for (i = 3; i >= 0; i--)
|
||||
free_irq(pm860x->irq[i], pm860x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_pm860x = {
|
||||
.probe = pm860x_probe,
|
||||
.remove = pm860x_remove,
|
||||
.set_bias_level = pm860x_set_bias_level,
|
||||
|
||||
.component_driver = {
|
||||
.controls = pm860x_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(pm860x_snd_controls),
|
||||
.dapm_widgets = pm860x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets),
|
||||
.dapm_routes = pm860x_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_pm860x = {
|
||||
.probe = pm860x_probe,
|
||||
.remove = pm860x_remove,
|
||||
.set_bias_level = pm860x_set_bias_level,
|
||||
.controls = pm860x_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(pm860x_snd_controls),
|
||||
.dapm_widgets = pm860x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets),
|
||||
.dapm_routes = pm860x_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int pm860x_codec_probe(struct platform_device *pdev)
|
||||
@ -1393,10 +1393,11 @@ static int pm860x_codec_probe(struct platform_device *pdev)
|
||||
strncpy(pm860x->name[i], res->name, MAX_NAME_LEN);
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pm860x,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_pm860x,
|
||||
pm860x_dai, ARRAY_SIZE(pm860x_dai));
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to register codec\n");
|
||||
dev_err(&pdev->dev, "Failed to register component\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
@ -1404,7 +1405,6 @@ static int pm860x_codec_probe(struct platform_device *pdev)
|
||||
|
||||
static int pm860x_codec_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,9 @@
|
||||
#define PM860X_SHORT_LINEOUT (1 << 4)
|
||||
#define PM860X_DET_MASK 0x1F
|
||||
|
||||
extern int pm860x_hs_jack_detect(struct snd_soc_codec *, struct snd_soc_jack *,
|
||||
extern int pm860x_hs_jack_detect(struct snd_soc_component *, struct snd_soc_jack *,
|
||||
int, int, int, int);
|
||||
extern int pm860x_mic_jack_detect(struct snd_soc_codec *, struct snd_soc_jack *,
|
||||
extern int pm860x_mic_jack_detect(struct snd_soc_component *, struct snd_soc_jack *,
|
||||
int);
|
||||
|
||||
#endif /* __88PM860X_H */
|
||||
|
@ -1037,86 +1037,86 @@ static const struct snd_soc_dapm_route ab8500_dapm_routes_mic2_vamicx[] = {
|
||||
};
|
||||
|
||||
/* ANC FIR-coefficients configuration sequence */
|
||||
static void anc_fir(struct snd_soc_codec *codec,
|
||||
static void anc_fir(struct snd_soc_component *component,
|
||||
unsigned int bnk, unsigned int par, unsigned int val)
|
||||
{
|
||||
if (par == 0 && bnk == 0)
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCFIRUPDATE),
|
||||
BIT(AB8500_ANCCONF1_ANCFIRUPDATE));
|
||||
|
||||
snd_soc_write(codec, AB8500_ANCCONF5, val >> 8 & 0xff);
|
||||
snd_soc_write(codec, AB8500_ANCCONF6, val & 0xff);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF5, val >> 8 & 0xff);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF6, val & 0xff);
|
||||
|
||||
if (par == AB8500_ANC_FIR_COEFFS - 1 && bnk == 1)
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCFIRUPDATE), 0);
|
||||
}
|
||||
|
||||
/* ANC IIR-coefficients configuration sequence */
|
||||
static void anc_iir(struct snd_soc_codec *codec, unsigned int bnk,
|
||||
static void anc_iir(struct snd_soc_component *component, unsigned int bnk,
|
||||
unsigned int par, unsigned int val)
|
||||
{
|
||||
if (par == 0) {
|
||||
if (bnk == 0) {
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCIIRINIT),
|
||||
BIT(AB8500_ANCCONF1_ANCIIRINIT));
|
||||
usleep_range(AB8500_ANC_SM_DELAY, AB8500_ANC_SM_DELAY);
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCIIRINIT), 0);
|
||||
usleep_range(AB8500_ANC_SM_DELAY, AB8500_ANC_SM_DELAY);
|
||||
} else {
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCIIRUPDATE),
|
||||
BIT(AB8500_ANCCONF1_ANCIIRUPDATE));
|
||||
}
|
||||
} else if (par > 3) {
|
||||
snd_soc_write(codec, AB8500_ANCCONF7, 0);
|
||||
snd_soc_write(codec, AB8500_ANCCONF8, val >> 16 & 0xff);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF7, 0);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF8, val >> 16 & 0xff);
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AB8500_ANCCONF7, val >> 8 & 0xff);
|
||||
snd_soc_write(codec, AB8500_ANCCONF8, val & 0xff);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF7, val >> 8 & 0xff);
|
||||
snd_soc_component_write(component, AB8500_ANCCONF8, val & 0xff);
|
||||
|
||||
if (par == AB8500_ANC_IIR_COEFFS - 1 && bnk == 1)
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ANCIIRUPDATE), 0);
|
||||
}
|
||||
|
||||
/* ANC IIR-/FIR-coefficients configuration sequence */
|
||||
static void anc_configure(struct snd_soc_codec *codec,
|
||||
static void anc_configure(struct snd_soc_component *component,
|
||||
bool apply_fir, bool apply_iir)
|
||||
{
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
|
||||
unsigned int bnk, par, val;
|
||||
|
||||
dev_dbg(codec->dev, "%s: Enter.\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Enter.\n", __func__);
|
||||
|
||||
if (apply_fir)
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ENANC), 0);
|
||||
|
||||
snd_soc_update_bits(codec, AB8500_ANCCONF1,
|
||||
snd_soc_component_update_bits(component, AB8500_ANCCONF1,
|
||||
BIT(AB8500_ANCCONF1_ENANC), BIT(AB8500_ANCCONF1_ENANC));
|
||||
|
||||
if (apply_fir)
|
||||
for (bnk = 0; bnk < AB8500_NR_OF_ANC_COEFF_BANKS; bnk++)
|
||||
for (par = 0; par < AB8500_ANC_FIR_COEFFS; par++) {
|
||||
val = snd_soc_read(codec,
|
||||
val = snd_soc_component_read32(component,
|
||||
drvdata->anc_fir_values[par]);
|
||||
anc_fir(codec, bnk, par, val);
|
||||
anc_fir(component, bnk, par, val);
|
||||
}
|
||||
|
||||
if (apply_iir)
|
||||
for (bnk = 0; bnk < AB8500_NR_OF_ANC_COEFF_BANKS; bnk++)
|
||||
for (par = 0; par < AB8500_ANC_IIR_COEFFS; par++) {
|
||||
val = snd_soc_read(codec,
|
||||
val = snd_soc_component_read32(component,
|
||||
drvdata->anc_iir_values[par]);
|
||||
anc_iir(codec, bnk, par, val);
|
||||
anc_iir(component, bnk, par, val);
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "%s: Exit.\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Exit.\n", __func__);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1126,8 +1126,8 @@ static void anc_configure(struct snd_soc_codec *codec,
|
||||
static int sid_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
|
||||
|
||||
mutex_lock(&drvdata->ctrl_lock);
|
||||
ucontrol->value.enumerated.item[0] = drvdata->sid_status;
|
||||
@ -1140,15 +1140,15 @@ static int sid_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int sid_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
|
||||
unsigned int param, sidconf, val;
|
||||
int status = 1;
|
||||
|
||||
dev_dbg(codec->dev, "%s: Enter\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Enter\n", __func__);
|
||||
|
||||
if (ucontrol->value.enumerated.item[0] != SID_APPLY_FIR) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%s: ERROR: This control supports '%s' only!\n",
|
||||
__func__, enum_sid_state[SID_APPLY_FIR]);
|
||||
return -EIO;
|
||||
@ -1156,10 +1156,10 @@ static int sid_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
|
||||
mutex_lock(&drvdata->ctrl_lock);
|
||||
|
||||
sidconf = snd_soc_read(codec, AB8500_SIDFIRCONF);
|
||||
sidconf = snd_soc_component_read32(component, AB8500_SIDFIRCONF);
|
||||
if (((sidconf & BIT(AB8500_SIDFIRCONF_FIRSIDBUSY)) != 0)) {
|
||||
if ((sidconf & BIT(AB8500_SIDFIRCONF_ENFIRSIDS)) == 0) {
|
||||
dev_err(codec->dev, "%s: Sidetone busy while off!\n",
|
||||
dev_err(component->dev, "%s: Sidetone busy while off!\n",
|
||||
__func__);
|
||||
status = -EPERM;
|
||||
} else {
|
||||
@ -1168,18 +1168,18 @@ static int sid_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
goto out;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AB8500_SIDFIRADR, 0);
|
||||
snd_soc_component_write(component, AB8500_SIDFIRADR, 0);
|
||||
|
||||
for (param = 0; param < AB8500_SID_FIR_COEFFS; param++) {
|
||||
val = snd_soc_read(codec, drvdata->sid_fir_values[param]);
|
||||
snd_soc_write(codec, AB8500_SIDFIRCOEF1, val >> 8 & 0xff);
|
||||
snd_soc_write(codec, AB8500_SIDFIRCOEF2, val & 0xff);
|
||||
val = snd_soc_component_read32(component, drvdata->sid_fir_values[param]);
|
||||
snd_soc_component_write(component, AB8500_SIDFIRCOEF1, val >> 8 & 0xff);
|
||||
snd_soc_component_write(component, AB8500_SIDFIRCOEF2, val & 0xff);
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, AB8500_SIDFIRADR,
|
||||
snd_soc_component_update_bits(component, AB8500_SIDFIRADR,
|
||||
BIT(AB8500_SIDFIRADR_FIRSIDSET),
|
||||
BIT(AB8500_SIDFIRADR_FIRSIDSET));
|
||||
snd_soc_update_bits(codec, AB8500_SIDFIRADR,
|
||||
snd_soc_component_update_bits(component, AB8500_SIDFIRADR,
|
||||
BIT(AB8500_SIDFIRADR_FIRSIDSET), 0);
|
||||
|
||||
drvdata->sid_status = SID_FIR_CONFIGURED;
|
||||
@ -1187,7 +1187,7 @@ static int sid_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
out:
|
||||
mutex_unlock(&drvdata->ctrl_lock);
|
||||
|
||||
dev_dbg(codec->dev, "%s: Exit\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Exit\n", __func__);
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -1195,8 +1195,8 @@ out:
|
||||
static int anc_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
|
||||
|
||||
mutex_lock(&drvdata->ctrl_lock);
|
||||
ucontrol->value.enumerated.item[0] = drvdata->anc_status;
|
||||
@ -1208,10 +1208,10 @@ static int anc_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int anc_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct device *dev = codec->dev;
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev);
|
||||
struct device *dev = component->dev;
|
||||
bool apply_fir, apply_iir;
|
||||
unsigned int req;
|
||||
int status;
|
||||
@ -1244,7 +1244,7 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
}
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
anc_configure(codec, apply_fir, apply_iir);
|
||||
anc_configure(component, apply_fir, apply_iir);
|
||||
|
||||
if (apply_fir) {
|
||||
if (drvdata->anc_status == ANC_IIR_CONFIGURED)
|
||||
@ -1291,8 +1291,8 @@ static int filter_control_info(struct snd_kcontrol *kcontrol,
|
||||
static int filter_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct filter_control *fc =
|
||||
(struct filter_control *)kcontrol->private_value;
|
||||
unsigned int i;
|
||||
@ -1308,8 +1308,8 @@ static int filter_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int filter_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct filter_control *fc =
|
||||
(struct filter_control *)kcontrol->private_value;
|
||||
unsigned int i;
|
||||
@ -1926,11 +1926,11 @@ enum ab8500_filter {
|
||||
* Extended interface for codec-driver
|
||||
*/
|
||||
|
||||
static int ab8500_audio_init_audioblock(struct snd_soc_codec *codec)
|
||||
static int ab8500_audio_init_audioblock(struct snd_soc_component *component)
|
||||
{
|
||||
int status;
|
||||
|
||||
dev_dbg(codec->dev, "%s: Enter.\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Enter.\n", __func__);
|
||||
|
||||
/* Reset audio-registers and disable 32kHz-clock output 2 */
|
||||
status = ab8500_sysctrl_write(AB8500_STW4500CTRL3,
|
||||
@ -1943,26 +1943,26 @@ static int ab8500_audio_init_audioblock(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab8500_audio_setup_mics(struct snd_soc_codec *codec,
|
||||
static int ab8500_audio_setup_mics(struct snd_soc_component *component,
|
||||
struct amic_settings *amics)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
u8 value8;
|
||||
unsigned int value;
|
||||
int status;
|
||||
const struct snd_soc_dapm_route *route;
|
||||
|
||||
dev_dbg(codec->dev, "%s: Enter.\n", __func__);
|
||||
dev_dbg(component->dev, "%s: Enter.\n", __func__);
|
||||
|
||||
/* Set DMic-clocks to outputs */
|
||||
status = abx500_get_register_interruptible(codec->dev, AB8500_MISC,
|
||||
status = abx500_get_register_interruptible(component->dev, AB8500_MISC,
|
||||
AB8500_GPIO_DIR4_REG,
|
||||
&value8);
|
||||
if (status < 0)
|
||||
return status;
|
||||
value = value8 | GPIO27_DIR_OUTPUT | GPIO29_DIR_OUTPUT |
|
||||
GPIO31_DIR_OUTPUT;
|
||||
status = abx500_set_register_interruptible(codec->dev,
|
||||
status = abx500_set_register_interruptible(component->dev,
|
||||
AB8500_MISC,
|
||||
AB8500_GPIO_DIR4_REG,
|
||||
value);
|
||||
@ -1970,41 +1970,41 @@ static int ab8500_audio_setup_mics(struct snd_soc_codec *codec,
|
||||
return status;
|
||||
|
||||
/* Attach regulators to AMic DAPM-paths */
|
||||
dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Mic 1a regulator: %s\n", __func__,
|
||||
amic_micbias_str(amics->mic1a_micbias));
|
||||
route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias];
|
||||
status = snd_soc_dapm_add_routes(dapm, route, 1);
|
||||
dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Mic 1b regulator: %s\n", __func__,
|
||||
amic_micbias_str(amics->mic1b_micbias));
|
||||
route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias];
|
||||
status |= snd_soc_dapm_add_routes(dapm, route, 1);
|
||||
dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Mic 2 regulator: %s\n", __func__,
|
||||
amic_micbias_str(amics->mic2_micbias));
|
||||
route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias];
|
||||
status |= snd_soc_dapm_add_routes(dapm, route, 1);
|
||||
if (status < 0) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%s: Failed to add AMic-regulator DAPM-routes (%d).\n",
|
||||
__func__, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Set AMic-configuration */
|
||||
dev_dbg(codec->dev, "%s: Mic 1 mic-type: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Mic 1 mic-type: %s\n", __func__,
|
||||
amic_type_str(amics->mic1_type));
|
||||
snd_soc_update_bits(codec, AB8500_ANAGAIN1, AB8500_ANAGAINX_ENSEMICX,
|
||||
snd_soc_component_update_bits(component, AB8500_ANAGAIN1, AB8500_ANAGAINX_ENSEMICX,
|
||||
amics->mic1_type == AMIC_TYPE_DIFFERENTIAL ?
|
||||
0 : AB8500_ANAGAINX_ENSEMICX);
|
||||
dev_dbg(codec->dev, "%s: Mic 2 mic-type: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Mic 2 mic-type: %s\n", __func__,
|
||||
amic_type_str(amics->mic2_type));
|
||||
snd_soc_update_bits(codec, AB8500_ANAGAIN2, AB8500_ANAGAINX_ENSEMICX,
|
||||
snd_soc_component_update_bits(component, AB8500_ANAGAIN2, AB8500_ANAGAINX_ENSEMICX,
|
||||
amics->mic2_type == AMIC_TYPE_DIFFERENTIAL ?
|
||||
0 : AB8500_ANAGAINX_ENSEMICX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ab8500_audio_set_ear_cmv(struct snd_soc_codec *codec,
|
||||
static int ab8500_audio_set_ear_cmv(struct snd_soc_component *component,
|
||||
enum ear_cm_voltage ear_cmv)
|
||||
{
|
||||
char *cmv_str;
|
||||
@ -2023,14 +2023,14 @@ static int ab8500_audio_set_ear_cmv(struct snd_soc_codec *codec,
|
||||
cmv_str = "1.58V";
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%s: Unknown earpiece CM-voltage (%d)!\n",
|
||||
__func__, (int)ear_cmv);
|
||||
return -EINVAL;
|
||||
}
|
||||
dev_dbg(codec->dev, "%s: Earpiece CM-voltage: %s\n", __func__,
|
||||
dev_dbg(component->dev, "%s: Earpiece CM-voltage: %s\n", __func__,
|
||||
cmv_str);
|
||||
snd_soc_update_bits(codec, AB8500_ANACONF1, AB8500_ANACONF1_EARSELCM,
|
||||
snd_soc_component_update_bits(component, AB8500_ANACONF1, AB8500_ANACONF1_EARSELCM,
|
||||
ear_cmv);
|
||||
|
||||
return 0;
|
||||
@ -2040,7 +2040,7 @@ static int ab8500_audio_set_bit_delay(struct snd_soc_dai *dai,
|
||||
unsigned int delay)
|
||||
{
|
||||
unsigned int mask, val;
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
mask = BIT(AB8500_DIGIFCONF2_IF0DEL);
|
||||
val = 0;
|
||||
@ -2052,21 +2052,21 @@ static int ab8500_audio_set_bit_delay(struct snd_soc_dai *dai,
|
||||
val |= BIT(AB8500_DIGIFCONF2_IF0DEL);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Unsupported bit-delay (0x%x)!\n",
|
||||
__func__, delay);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(dai->codec->dev, "%s: IF0 Bit-delay: %d bits.\n",
|
||||
dev_dbg(dai->component->dev, "%s: IF0 Bit-delay: %d bits.\n",
|
||||
__func__, delay);
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF2, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF2, mask, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Gates clocking according format mask */
|
||||
static int ab8500_codec_set_dai_clock_gate(struct snd_soc_codec *codec,
|
||||
static int ab8500_codec_set_dai_clock_gate(struct snd_soc_component *component,
|
||||
unsigned int fmt)
|
||||
{
|
||||
unsigned int mask;
|
||||
@ -2079,22 +2079,22 @@ static int ab8500_codec_set_dai_clock_gate(struct snd_soc_codec *codec,
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_MASK) {
|
||||
case SND_SOC_DAIFMT_CONT: /* continuous clock */
|
||||
dev_dbg(codec->dev, "%s: IF0 Clock is continuous.\n",
|
||||
dev_dbg(component->dev, "%s: IF0 Clock is continuous.\n",
|
||||
__func__);
|
||||
val |= BIT(AB8500_DIGIFCONF1_ENFSBITCLK0);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_GATED: /* clock is gated */
|
||||
dev_dbg(codec->dev, "%s: IF0 Clock is gated.\n",
|
||||
dev_dbg(component->dev, "%s: IF0 Clock is gated.\n",
|
||||
__func__);
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%s: ERROR: Unsupported clock mask (0x%x)!\n",
|
||||
__func__, fmt & SND_SOC_DAIFMT_CLOCK_MASK);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF1, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF1, mask, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2103,10 +2103,10 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
{
|
||||
unsigned int mask;
|
||||
unsigned int val;
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
int status;
|
||||
|
||||
dev_dbg(codec->dev, "%s: Enter (fmt = 0x%x)\n", __func__, fmt);
|
||||
dev_dbg(component->dev, "%s: Enter (fmt = 0x%x)\n", __func__, fmt);
|
||||
|
||||
mask = BIT(AB8500_DIGIFCONF3_IF1DATOIF0AD) |
|
||||
BIT(AB8500_DIGIFCONF3_IF1CLKTOIF0CLK) |
|
||||
@ -2116,32 +2116,32 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & FRM master */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0 Master-mode: AB8500 master.\n", __func__);
|
||||
val |= BIT(AB8500_DIGIFCONF3_IF0MASTER);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS: /* codec clk & FRM slave */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0 Master-mode: AB8500 slave.\n", __func__);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFM: /* codec clk slave & FRM master */
|
||||
case SND_SOC_DAIFMT_CBM_CFS: /* codec clk master & frame slave */
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: The device is either a master or a slave.\n",
|
||||
__func__);
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Unsupporter master mask 0x%x\n",
|
||||
__func__, fmt & SND_SOC_DAIFMT_MASTER_MASK);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF3, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF3, mask, val);
|
||||
|
||||
/* Set clock gating */
|
||||
status = ab8500_codec_set_dai_clock_gate(codec, fmt);
|
||||
status = ab8500_codec_set_dai_clock_gate(component, fmt);
|
||||
if (status) {
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Failed to set clock gate (%d).\n",
|
||||
__func__, status);
|
||||
return status;
|
||||
@ -2157,27 +2157,27 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S: /* I2S mode */
|
||||
dev_dbg(dai->codec->dev, "%s: IF0 Protocol: I2S\n", __func__);
|
||||
dev_dbg(dai->component->dev, "%s: IF0 Protocol: I2S\n", __func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_IF0FORMAT1);
|
||||
ab8500_audio_set_bit_delay(dai, 0);
|
||||
break;
|
||||
|
||||
case SND_SOC_DAIFMT_DSP_A: /* L data MSB after FRM LRC */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0 Protocol: DSP A (TDM)\n", __func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_IF0FORMAT0);
|
||||
ab8500_audio_set_bit_delay(dai, 1);
|
||||
break;
|
||||
|
||||
case SND_SOC_DAIFMT_DSP_B: /* L data MSB during FRM LRC */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0 Protocol: DSP B (TDM)\n", __func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_IF0FORMAT0);
|
||||
ab8500_audio_set_bit_delay(dai, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Unsupported format (0x%x)!\n",
|
||||
__func__, fmt & SND_SOC_DAIFMT_FORMAT_MASK);
|
||||
return -EINVAL;
|
||||
@ -2185,37 +2185,37 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
|
||||
case SND_SOC_DAIFMT_NB_NF: /* normal bit clock + frame */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0: Normal bit clock, normal frame\n",
|
||||
__func__);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_NB_IF: /* normal BCLK + inv FRM */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0: Normal bit clock, inverted frame\n",
|
||||
__func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_FSYNC0P);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_IB_NF: /* invert BCLK + nor FRM */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0: Inverted bit clock, normal frame\n",
|
||||
__func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_BITCLK0P);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_IB_IF: /* invert BCLK + FRM */
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: IF0: Inverted bit clock, inverted frame\n",
|
||||
__func__);
|
||||
val |= BIT(AB8500_DIGIFCONF2_FSYNC0P);
|
||||
val |= BIT(AB8500_DIGIFCONF2_BITCLK0P);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Unsupported INV mask 0x%x\n",
|
||||
__func__, fmt & SND_SOC_DAIFMT_INV_MASK);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF2, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF2, mask, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2224,7 +2224,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
unsigned int tx_mask, unsigned int rx_mask,
|
||||
int slots, int slot_width)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
unsigned int val, mask, slot, slots_active;
|
||||
|
||||
mask = BIT(AB8500_DIGIFCONF2_IF0WL0) |
|
||||
@ -2245,17 +2245,17 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
BIT(AB8500_DIGIFCONF2_IF0WL0);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev, "%s: Unsupported slot-width 0x%x\n",
|
||||
dev_err(dai->component->dev, "%s: Unsupported slot-width 0x%x\n",
|
||||
__func__, slot_width);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(dai->codec->dev, "%s: IF0 slot-width: %d bits.\n",
|
||||
dev_dbg(dai->component->dev, "%s: IF0 slot-width: %d bits.\n",
|
||||
__func__, slot_width);
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF2, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF2, mask, val);
|
||||
|
||||
/* Setup TDM clocking according to slot count */
|
||||
dev_dbg(dai->codec->dev, "%s: Slots, total: %d\n", __func__, slots);
|
||||
dev_dbg(dai->component->dev, "%s: Slots, total: %d\n", __func__, slots);
|
||||
mask = BIT(AB8500_DIGIFCONF1_IF0BITCLKOS0) |
|
||||
BIT(AB8500_DIGIFCONF1_IF0BITCLKOS1);
|
||||
switch (slots) {
|
||||
@ -2273,12 +2273,12 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
BIT(AB8500_DIGIFCONF1_IF0BITCLKOS1);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: ERROR: Unsupported number of slots (%d)!\n",
|
||||
__func__, slots);
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_soc_update_bits(codec, AB8500_DIGIFCONF1, mask, val);
|
||||
snd_soc_component_update_bits(component, AB8500_DIGIFCONF1, mask, val);
|
||||
|
||||
/* Setup TDM DA according to active tx slots */
|
||||
|
||||
@ -2289,7 +2289,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
tx_mask = tx_mask << AB8500_DA_DATA0_OFFSET;
|
||||
slots_active = hweight32(tx_mask);
|
||||
|
||||
dev_dbg(dai->codec->dev, "%s: Slots, active, TX: %d\n", __func__,
|
||||
dev_dbg(dai->component->dev, "%s: Slots, active, TX: %d\n", __func__,
|
||||
slots_active);
|
||||
|
||||
switch (slots_active) {
|
||||
@ -2297,26 +2297,26 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
break;
|
||||
case 1:
|
||||
slot = ffs(tx_mask);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF1, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF3, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF2, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF4, mask, slot);
|
||||
break;
|
||||
case 2:
|
||||
slot = ffs(tx_mask);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF1, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF3, mask, slot);
|
||||
slot = fls(tx_mask);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
|
||||
snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF2, mask, slot);
|
||||
snd_soc_component_update_bits(component, AB8500_DASLOTCONF4, mask, slot);
|
||||
break;
|
||||
case 8:
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: In 8-channel mode DA-from-slot mapping is set manually.",
|
||||
__func__);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: Unsupported number of active TX-slots (%d)!\n",
|
||||
__func__, slots_active);
|
||||
return -EINVAL;
|
||||
@ -2330,7 +2330,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
rx_mask = rx_mask << AB8500_AD_DATA0_OFFSET;
|
||||
slots_active = hweight32(rx_mask);
|
||||
|
||||
dev_dbg(dai->codec->dev, "%s: Slots, active, RX: %d\n", __func__,
|
||||
dev_dbg(dai->component->dev, "%s: Slots, active, RX: %d\n", __func__,
|
||||
slots_active);
|
||||
|
||||
switch (slots_active) {
|
||||
@ -2338,29 +2338,29 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
|
||||
break;
|
||||
case 1:
|
||||
slot = ffs(rx_mask);
|
||||
snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot),
|
||||
snd_soc_component_update_bits(component, AB8500_ADSLOTSEL(slot),
|
||||
AB8500_MASK_SLOT(slot),
|
||||
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
|
||||
break;
|
||||
case 2:
|
||||
slot = ffs(rx_mask);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
AB8500_ADSLOTSEL(slot),
|
||||
AB8500_MASK_SLOT(slot),
|
||||
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
|
||||
slot = fls(rx_mask);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
AB8500_ADSLOTSEL(slot),
|
||||
AB8500_MASK_SLOT(slot),
|
||||
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT2, slot));
|
||||
break;
|
||||
case 8:
|
||||
dev_dbg(dai->codec->dev,
|
||||
dev_dbg(dai->component->dev,
|
||||
"%s: In 8-channel mode AD-to-slot mapping is set manually.",
|
||||
__func__);
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->codec->dev,
|
||||
dev_err(dai->component->dev,
|
||||
"%s: Unsupported number of active RX-slots (%d)!\n",
|
||||
__func__, slots_active);
|
||||
return -EINVAL;
|
||||
@ -2458,10 +2458,10 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np,
|
||||
}
|
||||
}
|
||||
|
||||
static int ab8500_codec_probe(struct snd_soc_codec *codec)
|
||||
static int ab8500_codec_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct device *dev = codec->dev;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
struct device *dev = component->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev);
|
||||
struct ab8500_codec_platform_data codec_pdata;
|
||||
@ -2472,19 +2472,19 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
|
||||
|
||||
ab8500_codec_of_probe(dev, np, &codec_pdata);
|
||||
|
||||
status = ab8500_audio_setup_mics(codec, &codec_pdata.amics);
|
||||
status = ab8500_audio_setup_mics(component, &codec_pdata.amics);
|
||||
if (status < 0) {
|
||||
pr_err("%s: Failed to setup mics (%d)!\n", __func__, status);
|
||||
return status;
|
||||
}
|
||||
status = ab8500_audio_set_ear_cmv(codec, codec_pdata.ear_cmv);
|
||||
status = ab8500_audio_set_ear_cmv(component, codec_pdata.ear_cmv);
|
||||
if (status < 0) {
|
||||
pr_err("%s: Failed to set earpiece CM-voltage (%d)!\n",
|
||||
__func__, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ab8500_audio_init_audioblock(codec);
|
||||
status = ab8500_audio_init_audioblock(component);
|
||||
if (status < 0) {
|
||||
dev_err(dev, "%s: failed to init audio-block (%d)!\n",
|
||||
__func__, status);
|
||||
@ -2492,13 +2492,13 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
/* Override HW-defaults */
|
||||
snd_soc_write(codec, AB8500_ANACONF5,
|
||||
snd_soc_component_write(component, AB8500_ANACONF5,
|
||||
BIT(AB8500_ANACONF5_HSAUTOEN));
|
||||
snd_soc_write(codec, AB8500_SHORTCIRCONF,
|
||||
snd_soc_component_write(component, AB8500_SHORTCIRCONF,
|
||||
BIT(AB8500_SHORTCIRCONF_HSZCDDIS));
|
||||
|
||||
/* Add filter controls */
|
||||
status = snd_soc_add_codec_controls(codec, ab8500_filter_controls,
|
||||
status = snd_soc_add_component_controls(component, ab8500_filter_controls,
|
||||
ARRAY_SIZE(ab8500_filter_controls));
|
||||
if (status < 0) {
|
||||
dev_err(dev,
|
||||
@ -2523,16 +2523,18 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
|
||||
return status;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver ab8500_codec_driver = {
|
||||
.probe = ab8500_codec_probe,
|
||||
.component_driver = {
|
||||
.controls = ab8500_ctrls,
|
||||
.num_controls = ARRAY_SIZE(ab8500_ctrls),
|
||||
.dapm_widgets = ab8500_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ab8500_dapm_widgets),
|
||||
.dapm_routes = ab8500_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ab8500_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver ab8500_component_driver = {
|
||||
.probe = ab8500_codec_probe,
|
||||
.controls = ab8500_ctrls,
|
||||
.num_controls = ARRAY_SIZE(ab8500_ctrls),
|
||||
.dapm_widgets = ab8500_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ab8500_dapm_widgets),
|
||||
.dapm_routes = ab8500_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ab8500_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int ab8500_codec_driver_probe(struct platform_device *pdev)
|
||||
@ -2561,7 +2563,8 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__);
|
||||
status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver,
|
||||
status = devm_snd_soc_register_component(&pdev->dev,
|
||||
&ab8500_component_driver,
|
||||
ab8500_codec_dai,
|
||||
ARRAY_SIZE(ab8500_codec_dai));
|
||||
if (status < 0)
|
||||
@ -2572,21 +2575,11 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ab8500_codec_driver_remove(struct platform_device *pdev)
|
||||
{
|
||||
dev_dbg(&pdev->dev, "%s Enter.\n", __func__);
|
||||
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver ab8500_codec_platform_driver = {
|
||||
.driver = {
|
||||
.name = "ab8500-codec",
|
||||
},
|
||||
.probe = ab8500_codec_driver_probe,
|
||||
.remove = ab8500_codec_driver_remove,
|
||||
};
|
||||
module_platform_driver(ab8500_codec_platform_driver);
|
||||
|
||||
|
@ -36,8 +36,8 @@ static const struct snd_soc_dapm_route ac97_routes[] = {
|
||||
static int ac97_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
|
||||
AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
|
||||
@ -65,7 +65,7 @@ static struct snd_soc_dai_driver ac97_dai = {
|
||||
.ops = &ac97_dai_ops,
|
||||
};
|
||||
|
||||
static int ac97_soc_probe(struct snd_soc_codec *codec)
|
||||
static int ac97_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97;
|
||||
struct snd_ac97_bus *ac97_bus;
|
||||
@ -73,7 +73,7 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
|
||||
int ret;
|
||||
|
||||
/* add codec as bus device for standard ac97 */
|
||||
ret = snd_ac97_bus(codec->component.card->snd_card, 0, soc_ac97_ops,
|
||||
ret = snd_ac97_bus(component->card->snd_card, 0, soc_ac97_ops,
|
||||
NULL, &ac97_bus);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -83,25 +83,25 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
snd_soc_codec_set_drvdata(codec, ac97);
|
||||
snd_soc_component_set_drvdata(component, ac97);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int ac97_soc_suspend(struct snd_soc_codec *codec)
|
||||
static int ac97_soc_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
snd_ac97_suspend(ac97);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ac97_soc_resume(struct snd_soc_codec *codec)
|
||||
static int ac97_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
snd_ac97_resume(ac97);
|
||||
|
||||
@ -112,28 +112,28 @@ static int ac97_soc_resume(struct snd_soc_codec *codec)
|
||||
#define ac97_soc_resume NULL
|
||||
#endif
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_ac97 = {
|
||||
.probe = ac97_soc_probe,
|
||||
.suspend = ac97_soc_suspend,
|
||||
.resume = ac97_soc_resume,
|
||||
|
||||
.component_driver = {
|
||||
.dapm_widgets = ac97_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ac97_widgets),
|
||||
.dapm_routes = ac97_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ac97_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_ac97 = {
|
||||
.probe = ac97_soc_probe,
|
||||
.suspend = ac97_soc_suspend,
|
||||
.resume = ac97_soc_resume,
|
||||
.dapm_widgets = ac97_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ac97_widgets),
|
||||
.dapm_routes = ac97_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ac97_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int ac97_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_ac97, &ac97_dai, 1);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_ac97, &ac97_dai, 1);
|
||||
}
|
||||
|
||||
static int ac97_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(dai->codec);
|
||||
struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(dai->component);
|
||||
int word_len = 0;
|
||||
|
||||
/* bit size */
|
||||
@ -228,17 +228,17 @@ static struct snd_soc_dai_driver ad183x_dais[] = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int ad1836_suspend(struct snd_soc_codec *codec)
|
||||
static int ad1836_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
|
||||
struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component);
|
||||
/* reset clock control mode */
|
||||
return regmap_update_bits(ad1836->regmap, AD1836_ADC_CTRL2,
|
||||
AD1836_ADC_SERFMT_MASK, 0);
|
||||
}
|
||||
|
||||
static int ad1836_resume(struct snd_soc_codec *codec)
|
||||
static int ad1836_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
|
||||
struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component);
|
||||
/* restore clock control mode */
|
||||
return regmap_update_bits(ad1836->regmap, AD1836_ADC_CTRL2,
|
||||
AD1836_ADC_SERFMT_MASK, AD1836_ADC_AUX);
|
||||
@ -248,10 +248,10 @@ static int ad1836_resume(struct snd_soc_codec *codec)
|
||||
#define ad1836_resume NULL
|
||||
#endif
|
||||
|
||||
static int ad1836_probe(struct snd_soc_codec *codec)
|
||||
static int ad1836_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
int num_dacs, num_adcs;
|
||||
int ret = 0;
|
||||
int i;
|
||||
@ -277,7 +277,7 @@ static int ad1836_probe(struct snd_soc_codec *codec)
|
||||
if (ad1836->type == AD1836) {
|
||||
/* left/right diff:PGA/MUX */
|
||||
regmap_write(ad1836->regmap, AD1836_ADC_CTRL3, 0x3A);
|
||||
ret = snd_soc_add_codec_controls(codec, ad1836_controls,
|
||||
ret = snd_soc_add_component_controls(component, ad1836_controls,
|
||||
ARRAY_SIZE(ad1836_controls));
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -285,11 +285,11 @@ static int ad1836_probe(struct snd_soc_codec *codec)
|
||||
regmap_write(ad1836->regmap, AD1836_ADC_CTRL3, 0x00);
|
||||
}
|
||||
|
||||
ret = snd_soc_add_codec_controls(codec, ad183x_dac_controls, num_dacs * 2);
|
||||
ret = snd_soc_add_component_controls(component, ad183x_dac_controls, num_dacs * 2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_add_codec_controls(codec, ad183x_adc_controls, num_adcs);
|
||||
ret = snd_soc_add_component_controls(component, ad183x_adc_controls, num_adcs);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -313,28 +313,29 @@ static int ad1836_probe(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
/* power down chip */
|
||||
static int ad1836_remove(struct snd_soc_codec *codec)
|
||||
static void ad1836_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
|
||||
struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component);
|
||||
/* reset clock control mode */
|
||||
return regmap_update_bits(ad1836->regmap, AD1836_ADC_CTRL2,
|
||||
regmap_update_bits(ad1836->regmap, AD1836_ADC_CTRL2,
|
||||
AD1836_ADC_SERFMT_MASK, 0);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_ad1836 = {
|
||||
.probe = ad1836_probe,
|
||||
.remove = ad1836_remove,
|
||||
.suspend = ad1836_suspend,
|
||||
.resume = ad1836_resume,
|
||||
|
||||
.component_driver = {
|
||||
.controls = ad183x_controls,
|
||||
.num_controls = ARRAY_SIZE(ad183x_controls),
|
||||
.dapm_widgets = ad183x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad183x_dapm_widgets),
|
||||
.dapm_routes = ad183x_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad183x_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_ad1836 = {
|
||||
.probe = ad1836_probe,
|
||||
.remove = ad1836_remove,
|
||||
.suspend = ad1836_suspend,
|
||||
.resume = ad1836_resume,
|
||||
.controls = ad183x_controls,
|
||||
.num_controls = ARRAY_SIZE(ad183x_controls),
|
||||
.dapm_widgets = ad183x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad183x_dapm_widgets),
|
||||
.dapm_routes = ad183x_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad183x_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct reg_default ad1836_reg_defaults[] = {
|
||||
@ -382,17 +383,11 @@ static int ad1836_spi_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, ad1836);
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_ad1836, &ad183x_dais[ad1836->type], 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ad1836_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id ad1836_ids[] = {
|
||||
{ "ad1835", AD1835 },
|
||||
{ "ad1836", AD1836 },
|
||||
@ -408,7 +403,6 @@ static struct spi_driver ad1836_spi_driver = {
|
||||
.name = "ad1836",
|
||||
},
|
||||
.probe = ad1836_spi_probe,
|
||||
.remove = ad1836_spi_remove,
|
||||
.id_table = ad1836_ids,
|
||||
};
|
||||
|
||||
|
@ -35,18 +35,11 @@ static int ad193x_i2c_probe(struct i2c_client *client,
|
||||
(enum ad193x_type)id->driver_data);
|
||||
}
|
||||
|
||||
static int ad193x_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver ad193x_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ad193x",
|
||||
},
|
||||
.probe = ad193x_i2c_probe,
|
||||
.remove = ad193x_i2c_remove,
|
||||
.id_table = ad193x_id,
|
||||
};
|
||||
module_i2c_driver(ad193x_i2c_driver);
|
||||
|
@ -29,12 +29,6 @@ static int ad193x_spi_probe(struct spi_device *spi)
|
||||
(enum ad193x_type)id->driver_data);
|
||||
}
|
||||
|
||||
static int ad193x_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id ad193x_spi_id[] = {
|
||||
{ "ad193x", AD193X },
|
||||
{ "ad1933", AD1933 },
|
||||
@ -51,7 +45,6 @@ static struct spi_driver ad193x_spi_driver = {
|
||||
.name = "ad193x",
|
||||
},
|
||||
.probe = ad193x_spi_probe,
|
||||
.remove = ad193x_spi_remove,
|
||||
.id_table = ad193x_spi_id,
|
||||
};
|
||||
module_spi_driver(ad193x_spi_driver);
|
||||
|
@ -130,7 +130,7 @@ static inline bool ad193x_has_adc(const struct ad193x_priv *ad193x)
|
||||
|
||||
static int ad193x_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec);
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(dai->component);
|
||||
|
||||
if (mute)
|
||||
regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2,
|
||||
@ -146,7 +146,7 @@ static int ad193x_mute(struct snd_soc_dai *dai, int mute)
|
||||
static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
unsigned int rx_mask, int slots, int width)
|
||||
{
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec);
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(dai->component);
|
||||
unsigned int channels;
|
||||
|
||||
switch (slots) {
|
||||
@ -179,7 +179,7 @@ static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec_dai->codec);
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(codec_dai->component);
|
||||
unsigned int adc_serfmt = 0;
|
||||
unsigned int adc_fmt = 0;
|
||||
unsigned int dac_fmt = 0;
|
||||
@ -257,8 +257,8 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
static int ad193x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
|
||||
switch (freq) {
|
||||
case 12288000:
|
||||
case 18432000:
|
||||
@ -275,8 +275,8 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
int word_len = 0, master_rate = 0;
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/* bit size */
|
||||
switch (params_width(params)) {
|
||||
@ -351,10 +351,10 @@ static struct snd_soc_dai_driver ad193x_dai = {
|
||||
.ops = &ad193x_dai_ops,
|
||||
};
|
||||
|
||||
static int ad193x_codec_probe(struct snd_soc_codec *codec)
|
||||
static int ad193x_component_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
int num, ret;
|
||||
|
||||
/* default setting for ad193x */
|
||||
@ -382,7 +382,7 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
|
||||
if (ad193x_has_adc(ad193x)) {
|
||||
/* add adc controls */
|
||||
num = ARRAY_SIZE(ad193x_adc_snd_controls);
|
||||
ret = snd_soc_add_codec_controls(codec,
|
||||
ret = snd_soc_add_component_controls(component,
|
||||
ad193x_adc_snd_controls,
|
||||
num);
|
||||
if (ret)
|
||||
@ -408,16 +408,18 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_ad193x = {
|
||||
.probe = ad193x_codec_probe,
|
||||
.component_driver = {
|
||||
.controls = ad193x_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(ad193x_snd_controls),
|
||||
.dapm_widgets = ad193x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad193x_dapm_widgets),
|
||||
.dapm_routes = audio_paths,
|
||||
.num_dapm_routes = ARRAY_SIZE(audio_paths),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_ad193x = {
|
||||
.probe = ad193x_component_probe,
|
||||
.controls = ad193x_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(ad193x_snd_controls),
|
||||
.dapm_widgets = ad193x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad193x_dapm_widgets),
|
||||
.dapm_routes = audio_paths,
|
||||
.num_dapm_routes = ARRAY_SIZE(audio_paths),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
const struct regmap_config ad193x_regmap_config = {
|
||||
@ -442,7 +444,7 @@ int ad193x_probe(struct device *dev, struct regmap *regmap,
|
||||
|
||||
dev_set_drvdata(dev, ad193x);
|
||||
|
||||
return snd_soc_register_codec(dev, &soc_codec_dev_ad193x,
|
||||
return devm_snd_soc_register_component(dev, &soc_component_dev_ad193x,
|
||||
&ad193x_dai, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ad193x_probe);
|
||||
|
@ -205,9 +205,9 @@ static struct snd_soc_dai_driver ad1980_dai = {
|
||||
#define AD1980_VENDOR_ID 0x41445300
|
||||
#define AD1980_VENDOR_MASK 0xffffff00
|
||||
|
||||
static int ad1980_reset(struct snd_soc_codec *codec, int try_warm)
|
||||
static int ad1980_reset(struct snd_soc_component *component, int try_warm)
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int retry_cnt = 0;
|
||||
int ret;
|
||||
|
||||
@ -223,16 +223,16 @@ static int ad1980_reset(struct snd_soc_codec *codec, int try_warm)
|
||||
* case the first nibble of data is eaten by the addr. (Tag is
|
||||
* always 16 bit)
|
||||
*/
|
||||
snd_soc_write(codec, AC97_AD_SERIAL_CFG, 0x9900);
|
||||
snd_soc_component_write(component, AC97_AD_SERIAL_CFG, 0x9900);
|
||||
|
||||
} while (retry_cnt++ < 10);
|
||||
|
||||
dev_err(codec->dev, "Failed to reset: AC97 link error\n");
|
||||
dev_err(component->dev, "Failed to reset: AC97 link error\n");
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int ad1980_soc_probe(struct snd_soc_codec *codec)
|
||||
static int ad1980_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97;
|
||||
struct regmap *regmap;
|
||||
@ -240,10 +240,10 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
|
||||
u16 vendor_id2;
|
||||
u16 ext_status;
|
||||
|
||||
ac97 = snd_soc_new_ac97_codec(codec, 0, 0);
|
||||
ac97 = snd_soc_new_ac97_component(component, 0, 0);
|
||||
if (IS_ERR(ac97)) {
|
||||
ret = PTR_ERR(ac97);
|
||||
dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret);
|
||||
dev_err(component->dev, "Failed to register AC97 component: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -253,72 +253,66 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
|
||||
goto err_free_ac97;
|
||||
}
|
||||
|
||||
snd_soc_codec_init_regmap(codec, regmap);
|
||||
snd_soc_codec_set_drvdata(codec, ac97);
|
||||
snd_soc_component_init_regmap(component, regmap);
|
||||
snd_soc_component_set_drvdata(component, ac97);
|
||||
|
||||
ret = ad1980_reset(codec, 0);
|
||||
ret = ad1980_reset(component, 0);
|
||||
if (ret < 0)
|
||||
goto reset_err;
|
||||
|
||||
vendor_id2 = snd_soc_read(codec, AC97_VENDOR_ID2);
|
||||
vendor_id2 = snd_soc_component_read32(component, AC97_VENDOR_ID2);
|
||||
if (vendor_id2 == 0x5374) {
|
||||
dev_warn(codec->dev,
|
||||
dev_warn(component->dev,
|
||||
"Found AD1981 - only 2/2 IN/OUT Channels supported\n");
|
||||
}
|
||||
|
||||
/* unmute captures and playbacks volume */
|
||||
snd_soc_write(codec, AC97_MASTER, 0x0000);
|
||||
snd_soc_write(codec, AC97_PCM, 0x0000);
|
||||
snd_soc_write(codec, AC97_REC_GAIN, 0x0000);
|
||||
snd_soc_write(codec, AC97_CENTER_LFE_MASTER, 0x0000);
|
||||
snd_soc_write(codec, AC97_SURROUND_MASTER, 0x0000);
|
||||
snd_soc_component_write(component, AC97_MASTER, 0x0000);
|
||||
snd_soc_component_write(component, AC97_PCM, 0x0000);
|
||||
snd_soc_component_write(component, AC97_REC_GAIN, 0x0000);
|
||||
snd_soc_component_write(component, AC97_CENTER_LFE_MASTER, 0x0000);
|
||||
snd_soc_component_write(component, AC97_SURROUND_MASTER, 0x0000);
|
||||
|
||||
/*power on LFE/CENTER/Surround DACs*/
|
||||
ext_status = snd_soc_read(codec, AC97_EXTENDED_STATUS);
|
||||
snd_soc_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800);
|
||||
ext_status = snd_soc_component_read32(component, AC97_EXTENDED_STATUS);
|
||||
snd_soc_component_write(component, AC97_EXTENDED_STATUS, ext_status&~0x3800);
|
||||
|
||||
return 0;
|
||||
|
||||
reset_err:
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_component_exit_regmap(component);
|
||||
err_free_ac97:
|
||||
snd_soc_free_ac97_codec(ac97);
|
||||
snd_soc_free_ac97_component(ac97);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ad1980_soc_remove(struct snd_soc_codec *codec)
|
||||
static void ad1980_soc_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_free_ac97_codec(ac97);
|
||||
return 0;
|
||||
snd_soc_component_exit_regmap(component);
|
||||
snd_soc_free_ac97_component(ac97);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_ad1980 = {
|
||||
.probe = ad1980_soc_probe,
|
||||
.remove = ad1980_soc_remove,
|
||||
|
||||
.component_driver = {
|
||||
.controls = ad1980_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(ad1980_snd_ac97_controls),
|
||||
.dapm_widgets = ad1980_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad1980_dapm_widgets),
|
||||
.dapm_routes = ad1980_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad1980_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_ad1980 = {
|
||||
.probe = ad1980_soc_probe,
|
||||
.remove = ad1980_soc_remove,
|
||||
.controls = ad1980_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(ad1980_snd_ac97_controls),
|
||||
.dapm_widgets = ad1980_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad1980_dapm_widgets),
|
||||
.dapm_routes = ad1980_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad1980_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int ad1980_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_ad1980, &ad1980_dai, 1);
|
||||
}
|
||||
|
||||
static int ad1980_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_ad1980, &ad1980_dai, 1);
|
||||
}
|
||||
|
||||
static struct platform_driver ad1980_codec_driver = {
|
||||
@ -327,7 +321,6 @@ static struct platform_driver ad1980_codec_driver = {
|
||||
},
|
||||
|
||||
.probe = ad1980_probe,
|
||||
.remove = ad1980_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(ad1980_codec_driver);
|
||||
|
@ -54,25 +54,21 @@ static struct snd_soc_dai_driver ad73311_dai = {
|
||||
.formats = SNDRV_PCM_FMTBIT_S16_LE, },
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_ad73311 = {
|
||||
.component_driver = {
|
||||
.dapm_widgets = ad73311_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad73311_dapm_widgets),
|
||||
.dapm_routes = ad73311_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad73311_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_ad73311 = {
|
||||
.dapm_widgets = ad73311_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ad73311_dapm_widgets),
|
||||
.dapm_routes = ad73311_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(ad73311_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int ad73311_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_ad73311, &ad73311_dai, 1);
|
||||
}
|
||||
|
||||
static int ad73311_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_ad73311, &ad73311_dai, 1);
|
||||
}
|
||||
|
||||
static struct platform_driver ad73311_codec_driver = {
|
||||
@ -81,7 +77,6 @@ static struct platform_driver ad73311_codec_driver = {
|
||||
},
|
||||
|
||||
.probe = ad73311_probe,
|
||||
.remove = ad73311_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(ad73311_codec_driver);
|
||||
|
@ -168,58 +168,58 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
|
||||
static int ac97_analog_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
unsigned short reg;
|
||||
|
||||
/* enable variable rate audio, disable SPDIF output */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x1);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x5, 0x1);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
reg = AC97_PCM_FRONT_DAC_RATE;
|
||||
else
|
||||
reg = AC97_PCM_LR_ADC_RATE;
|
||||
|
||||
return snd_soc_write(codec, reg, runtime->rate);
|
||||
return snd_soc_component_write(component, reg, runtime->rate);
|
||||
}
|
||||
|
||||
static int ac97_digital_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
unsigned short reg;
|
||||
|
||||
snd_soc_write(codec, AC97_SPDIF, 0x2002);
|
||||
snd_soc_component_write(component, AC97_SPDIF, 0x2002);
|
||||
|
||||
/* Enable VRA and SPDIF out */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x5);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x5, 0x5);
|
||||
|
||||
reg = AC97_PCM_FRONT_DAC_RATE;
|
||||
|
||||
return snd_soc_write(codec, reg, runtime->rate);
|
||||
return snd_soc_component_write(component, reg, runtime->rate);
|
||||
}
|
||||
|
||||
static int stac9766_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int stac9766_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON: /* full On */
|
||||
case SND_SOC_BIAS_PREPARE: /* partial On */
|
||||
case SND_SOC_BIAS_STANDBY: /* Off, with power */
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0x0000);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF: /* Off, without power */
|
||||
/* disable everything including AC link */
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0xffff);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int stac9766_codec_resume(struct snd_soc_codec *codec)
|
||||
static int stac9766_component_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
return snd_ac97_reset(ac97, true, STAC9766_VENDOR_ID,
|
||||
STAC9766_VENDOR_ID_MASK);
|
||||
@ -272,13 +272,13 @@ static struct snd_soc_dai_driver stac9766_dai[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static int stac9766_codec_probe(struct snd_soc_codec *codec)
|
||||
static int stac9766_component_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97;
|
||||
struct regmap *regmap;
|
||||
int ret;
|
||||
|
||||
ac97 = snd_soc_new_ac97_codec(codec, STAC9766_VENDOR_ID,
|
||||
ac97 = snd_soc_new_ac97_component(component, STAC9766_VENDOR_ID,
|
||||
STAC9766_VENDOR_ID_MASK);
|
||||
if (IS_ERR(ac97))
|
||||
return PTR_ERR(ac97);
|
||||
@ -289,46 +289,42 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec)
|
||||
goto err_free_ac97;
|
||||
}
|
||||
|
||||
snd_soc_codec_init_regmap(codec, regmap);
|
||||
snd_soc_codec_set_drvdata(codec, ac97);
|
||||
snd_soc_component_init_regmap(component, regmap);
|
||||
snd_soc_component_set_drvdata(component, ac97);
|
||||
|
||||
return 0;
|
||||
err_free_ac97:
|
||||
snd_soc_free_ac97_codec(ac97);
|
||||
snd_soc_free_ac97_component(ac97);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int stac9766_codec_remove(struct snd_soc_codec *codec)
|
||||
static void stac9766_component_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_free_ac97_codec(ac97);
|
||||
return 0;
|
||||
snd_soc_component_exit_regmap(component);
|
||||
snd_soc_free_ac97_component(ac97);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
|
||||
.component_driver = {
|
||||
.controls = stac9766_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(stac9766_snd_ac97_controls),
|
||||
},
|
||||
.set_bias_level = stac9766_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
.probe = stac9766_codec_probe,
|
||||
.remove = stac9766_codec_remove,
|
||||
.resume = stac9766_codec_resume,
|
||||
static const struct snd_soc_component_driver soc_component_dev_stac9766 = {
|
||||
.controls = stac9766_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(stac9766_snd_ac97_controls),
|
||||
.set_bias_level = stac9766_set_bias_level,
|
||||
.probe = stac9766_component_probe,
|
||||
.remove = stac9766_component_remove,
|
||||
.resume = stac9766_component_resume,
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
|
||||
};
|
||||
|
||||
static int stac9766_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_stac9766, stac9766_dai, ARRAY_SIZE(stac9766_dai));
|
||||
}
|
||||
|
||||
static int stac9766_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_stac9766, stac9766_dai, ARRAY_SIZE(stac9766_dai));
|
||||
}
|
||||
|
||||
static struct platform_driver stac9766_codec_driver = {
|
||||
@ -337,7 +333,6 @@ static struct platform_driver stac9766_codec_driver = {
|
||||
},
|
||||
|
||||
.probe = stac9766_probe,
|
||||
.remove = stac9766_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(stac9766_codec_driver);
|
||||
|
@ -235,17 +235,17 @@ static const struct snd_soc_dapm_route wm9705_audio_map[] = {
|
||||
static int ac97_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
int reg;
|
||||
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
reg = AC97_PCM_FRONT_DAC_RATE;
|
||||
else
|
||||
reg = AC97_PCM_LR_ADC_RATE;
|
||||
|
||||
return snd_soc_write(codec, reg, substream->runtime->rate);
|
||||
return snd_soc_component_write(component, reg, substream->runtime->rate);
|
||||
}
|
||||
|
||||
#define WM9705_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | \
|
||||
@ -289,18 +289,18 @@ static struct snd_soc_dai_driver wm9705_dai[] = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int wm9705_soc_suspend(struct snd_soc_codec *codec)
|
||||
static int wm9705_soc_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
regcache_cache_bypass(codec->component.regmap, true);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
|
||||
regcache_cache_bypass(codec->component.regmap, false);
|
||||
regcache_cache_bypass(component->regmap, true);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0xffff);
|
||||
regcache_cache_bypass(component->regmap, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9705_soc_resume(struct snd_soc_codec *codec)
|
||||
static int wm9705_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9705_priv *wm9705 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
ret = snd_ac97_reset(wm9705->ac97, true, WM9705_VENDOR_ID,
|
||||
@ -308,7 +308,7 @@ static int wm9705_soc_resume(struct snd_soc_codec *codec)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
regcache_sync(codec->component.regmap);
|
||||
snd_soc_component_cache_sync(component);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -317,9 +317,9 @@ static int wm9705_soc_resume(struct snd_soc_codec *codec)
|
||||
#define wm9705_soc_resume NULL
|
||||
#endif
|
||||
|
||||
static int wm9705_soc_probe(struct snd_soc_codec *codec)
|
||||
static int wm9705_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9705_priv *wm9705 = snd_soc_component_get_drvdata(component);
|
||||
struct regmap *regmap;
|
||||
|
||||
if (wm9705->mfd_pdata) {
|
||||
@ -327,54 +327,54 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec)
|
||||
regmap = wm9705->mfd_pdata->regmap;
|
||||
} else {
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
wm9705->ac97 = snd_soc_new_ac97_codec(codec, WM9705_VENDOR_ID,
|
||||
wm9705->ac97 = snd_soc_new_ac97_component(component, WM9705_VENDOR_ID,
|
||||
WM9705_VENDOR_ID_MASK);
|
||||
if (IS_ERR(wm9705->ac97)) {
|
||||
dev_err(codec->dev, "Failed to register AC97 codec\n");
|
||||
dev_err(component->dev, "Failed to register AC97 codec\n");
|
||||
return PTR_ERR(wm9705->ac97);
|
||||
}
|
||||
|
||||
regmap = regmap_init_ac97(wm9705->ac97, &wm9705_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
snd_soc_free_ac97_codec(wm9705->ac97);
|
||||
snd_soc_free_ac97_component(wm9705->ac97);
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
snd_soc_codec_set_drvdata(codec, wm9705->ac97);
|
||||
snd_soc_codec_init_regmap(codec, regmap);
|
||||
snd_soc_component_set_drvdata(component, wm9705->ac97);
|
||||
snd_soc_component_init_regmap(component, regmap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9705_soc_remove(struct snd_soc_codec *codec)
|
||||
static void wm9705_soc_remove(struct snd_soc_component *component)
|
||||
{
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9705_priv *wm9705 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!wm9705->mfd_pdata) {
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_free_ac97_codec(wm9705->ac97);
|
||||
snd_soc_component_exit_regmap(component);
|
||||
snd_soc_free_ac97_component(wm9705->ac97);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm9705 = {
|
||||
.probe = wm9705_soc_probe,
|
||||
.remove = wm9705_soc_remove,
|
||||
.suspend = wm9705_soc_suspend,
|
||||
.resume = wm9705_soc_resume,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm9705_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9705_snd_ac97_controls),
|
||||
.dapm_widgets = wm9705_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9705_dapm_widgets),
|
||||
.dapm_routes = wm9705_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9705_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm9705 = {
|
||||
.probe = wm9705_soc_probe,
|
||||
.remove = wm9705_soc_remove,
|
||||
.suspend = wm9705_soc_suspend,
|
||||
.resume = wm9705_soc_resume,
|
||||
.controls = wm9705_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9705_snd_ac97_controls),
|
||||
.dapm_widgets = wm9705_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9705_dapm_widgets),
|
||||
.dapm_routes = wm9705_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9705_audio_map),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int wm9705_probe(struct platform_device *pdev)
|
||||
@ -388,14 +388,8 @@ static int wm9705_probe(struct platform_device *pdev)
|
||||
wm9705->mfd_pdata = dev_get_platdata(&pdev->dev);
|
||||
platform_set_drvdata(pdev, wm9705);
|
||||
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai));
|
||||
}
|
||||
|
||||
static int wm9705_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai));
|
||||
}
|
||||
|
||||
static struct platform_driver wm9705_codec_driver = {
|
||||
@ -404,7 +398,6 @@ static struct platform_driver wm9705_codec_driver = {
|
||||
},
|
||||
|
||||
.probe = wm9705_probe,
|
||||
.remove = wm9705_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(wm9705_codec_driver);
|
||||
|
@ -220,8 +220,8 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
|
||||
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
|
||||
struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int val = ucontrol->value.integer.value[0];
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
@ -264,8 +264,8 @@ static int wm9712_hp_mixer_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
|
||||
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
|
||||
struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
unsigned int shift, mixer;
|
||||
@ -527,33 +527,33 @@ static const struct snd_soc_dapm_route wm9712_audio_map[] = {
|
||||
static int ac97_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
int reg;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
reg = AC97_PCM_FRONT_DAC_RATE;
|
||||
else
|
||||
reg = AC97_PCM_LR_ADC_RATE;
|
||||
|
||||
return snd_soc_write(codec, reg, runtime->rate);
|
||||
return snd_soc_component_write(component, reg, runtime->rate);
|
||||
}
|
||||
|
||||
static int ac97_aux_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
|
||||
snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
|
||||
|
||||
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
|
||||
return -ENODEV;
|
||||
|
||||
return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
|
||||
return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);
|
||||
}
|
||||
|
||||
#define WM9712_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
|
||||
@ -597,7 +597,7 @@ static struct snd_soc_dai_driver wm9712_dai[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static int wm9712_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm9712_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
@ -605,20 +605,20 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec,
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0x0000);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
/* disable everything including AC link */
|
||||
snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
|
||||
snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0xffff);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9712_soc_resume(struct snd_soc_codec *codec)
|
||||
static int wm9712_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
ret = snd_ac97_reset(wm9712->ac97, true, WM9712_VENDOR_ID,
|
||||
@ -626,17 +626,17 @@ static int wm9712_soc_resume(struct snd_soc_codec *codec)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
|
||||
if (ret == 0)
|
||||
regcache_sync(codec->component.regmap);
|
||||
snd_soc_component_cache_sync(component);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm9712_soc_probe(struct snd_soc_codec *codec)
|
||||
static int wm9712_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component);
|
||||
struct regmap *regmap;
|
||||
int ret;
|
||||
|
||||
@ -645,59 +645,59 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec)
|
||||
regmap = wm9712->mfd_pdata->regmap;
|
||||
} else {
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID,
|
||||
wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID,
|
||||
WM9712_VENDOR_ID_MASK);
|
||||
if (IS_ERR(wm9712->ac97)) {
|
||||
ret = PTR_ERR(wm9712->ac97);
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"Failed to register AC97 codec: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
snd_soc_free_ac97_codec(wm9712->ac97);
|
||||
snd_soc_free_ac97_component(wm9712->ac97);
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
snd_soc_codec_init_regmap(codec, regmap);
|
||||
snd_soc_component_init_regmap(component, regmap);
|
||||
|
||||
/* set alc mux to none */
|
||||
snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000);
|
||||
snd_soc_component_update_bits(component, AC97_VIDEO, 0x3000, 0x3000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9712_soc_remove(struct snd_soc_codec *codec)
|
||||
static void wm9712_soc_remove(struct snd_soc_component *component)
|
||||
{
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!wm9712->mfd_pdata) {
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_free_ac97_codec(wm9712->ac97);
|
||||
snd_soc_component_exit_regmap(component);
|
||||
snd_soc_free_ac97_component(wm9712->ac97);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm9712 = {
|
||||
.probe = wm9712_soc_probe,
|
||||
.remove = wm9712_soc_remove,
|
||||
.resume = wm9712_soc_resume,
|
||||
.set_bias_level = wm9712_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm9712_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9712_snd_ac97_controls),
|
||||
.dapm_widgets = wm9712_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9712_dapm_widgets),
|
||||
.dapm_routes = wm9712_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9712_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm9712 = {
|
||||
.probe = wm9712_soc_probe,
|
||||
.remove = wm9712_soc_remove,
|
||||
.resume = wm9712_soc_resume,
|
||||
.set_bias_level = wm9712_set_bias_level,
|
||||
.controls = wm9712_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9712_snd_ac97_controls),
|
||||
.dapm_widgets = wm9712_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9712_dapm_widgets),
|
||||
.dapm_routes = wm9712_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9712_audio_map),
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int wm9712_probe(struct platform_device *pdev)
|
||||
@ -713,26 +713,19 @@ static int wm9712_probe(struct platform_device *pdev)
|
||||
wm9712->mfd_pdata = dev_get_platdata(&pdev->dev);
|
||||
platform_set_drvdata(pdev, wm9712);
|
||||
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai));
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai));
|
||||
}
|
||||
|
||||
static int wm9712_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver wm9712_codec_driver = {
|
||||
static struct platform_driver wm9712_component_driver = {
|
||||
.driver = {
|
||||
.name = "wm9712-codec",
|
||||
.name = "wm9712-component",
|
||||
},
|
||||
|
||||
.probe = wm9712_probe,
|
||||
.remove = wm9712_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(wm9712_codec_driver);
|
||||
module_platform_driver(wm9712_component_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver");
|
||||
MODULE_AUTHOR("Liam Girdwood");
|
||||
|
@ -196,16 +196,16 @@ SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
|
||||
static int wm9713_voice_shutdown(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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
|
||||
if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD))
|
||||
return -EINVAL;
|
||||
|
||||
/* Gracefully shut down the voice interface. */
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0200);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, 0x0200);
|
||||
schedule_timeout_interruptible(msecs_to_jiffies(1));
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0f00);
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x1000, 0x1000);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, 0x0f00);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x1000, 0x1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -229,8 +229,8 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int val = ucontrol->value.integer.value[0];
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
@ -273,8 +273,8 @@ static int wm9713_hp_mixer_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
unsigned int mixer, shift;
|
||||
@ -753,7 +753,7 @@ struct _pll_div {
|
||||
* to allow rounding later */
|
||||
#define FIXED_PLL_SIZE ((1 << 22) * 10)
|
||||
|
||||
static void pll_factors(struct snd_soc_codec *codec,
|
||||
static void pll_factors(struct snd_soc_component *component,
|
||||
struct _pll_div *pll_div, unsigned int source)
|
||||
{
|
||||
u64 Kpart;
|
||||
@ -789,7 +789,7 @@ static void pll_factors(struct snd_soc_codec *codec,
|
||||
|
||||
Ndiv = target / source;
|
||||
if ((Ndiv < 5) || (Ndiv > 12))
|
||||
dev_warn(codec->dev,
|
||||
dev_warn(component->dev,
|
||||
"WM9713 PLL N value %u out of recommended range!\n",
|
||||
Ndiv);
|
||||
|
||||
@ -815,28 +815,28 @@ static void pll_factors(struct snd_soc_codec *codec,
|
||||
* Please note that changing the PLL input frequency may require
|
||||
* resynchronisation with the AC97 controller.
|
||||
*/
|
||||
static int wm9713_set_pll(struct snd_soc_codec *codec,
|
||||
static int wm9713_set_pll(struct snd_soc_component *component,
|
||||
int pll_id, unsigned int freq_in, unsigned int freq_out)
|
||||
{
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
u16 reg, reg2;
|
||||
struct _pll_div pll_div;
|
||||
|
||||
/* turn PLL off ? */
|
||||
if (freq_in == 0) {
|
||||
/* disable PLL power and select ext source */
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0080, 0x0080);
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x0200, 0x0200);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0080, 0x0080);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x0200, 0x0200);
|
||||
wm9713->pll_in = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pll_factors(codec, &pll_div, freq_in);
|
||||
pll_factors(component, &pll_div, freq_in);
|
||||
|
||||
if (pll_div.k == 0) {
|
||||
reg = (pll_div.n << 12) | (pll_div.lf << 11) |
|
||||
(pll_div.divsel << 9) | (pll_div.divctl << 8);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
} else {
|
||||
/* write the fractional k to the reg 0x46 pages */
|
||||
reg2 = (pll_div.n << 12) | (pll_div.lf << 11) | (1 << 10) |
|
||||
@ -844,31 +844,31 @@ static int wm9713_set_pll(struct snd_soc_codec *codec,
|
||||
|
||||
/* K [21:20] */
|
||||
reg = reg2 | (0x5 << 4) | (pll_div.k >> 20);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
|
||||
/* K [19:16] */
|
||||
reg = reg2 | (0x4 << 4) | ((pll_div.k >> 16) & 0xf);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
|
||||
/* K [15:12] */
|
||||
reg = reg2 | (0x3 << 4) | ((pll_div.k >> 12) & 0xf);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
|
||||
/* K [11:8] */
|
||||
reg = reg2 | (0x2 << 4) | ((pll_div.k >> 8) & 0xf);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
|
||||
/* K [7:4] */
|
||||
reg = reg2 | (0x1 << 4) | ((pll_div.k >> 4) & 0xf);
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
|
||||
reg = reg2 | (0x0 << 4) | (pll_div.k & 0xf); /* K [3:0] */
|
||||
snd_soc_write(codec, AC97_LINE1_LEVEL, reg);
|
||||
snd_soc_component_write(component, AC97_LINE1_LEVEL, reg);
|
||||
}
|
||||
|
||||
/* turn PLL on and select as source */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x0200, 0x0000);
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0080, 0x0000);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x0200, 0x0000);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0080, 0x0000);
|
||||
wm9713->pll_in = freq_in;
|
||||
|
||||
/* wait 10ms AC97 link frames for the link to stabilise */
|
||||
@ -879,8 +879,8 @@ static int wm9713_set_pll(struct snd_soc_codec *codec,
|
||||
static int wm9713_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
|
||||
int source, unsigned int freq_in, unsigned int freq_out)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
return wm9713_set_pll(codec, pll_id, freq_in, freq_out);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
return wm9713_set_pll(component, pll_id, freq_in, freq_out);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -890,10 +890,10 @@ static int wm9713_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
|
||||
static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai,
|
||||
int tristate)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
|
||||
if (tristate)
|
||||
snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER,
|
||||
snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER,
|
||||
0x6000, 0x0000);
|
||||
|
||||
return 0;
|
||||
@ -906,30 +906,30 @@ static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai,
|
||||
static int wm9713_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
|
||||
int div_id, int div)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
|
||||
switch (div_id) {
|
||||
case WM9713_PCMCLK_DIV:
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, div);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, div);
|
||||
break;
|
||||
case WM9713_CLKA_MULT:
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0002, div);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0002, div);
|
||||
break;
|
||||
case WM9713_CLKB_MULT:
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0004, div);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0004, div);
|
||||
break;
|
||||
case WM9713_HIFI_DIV:
|
||||
snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x7000, div);
|
||||
snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x7000, div);
|
||||
break;
|
||||
case WM9713_PCMBCLK_DIV:
|
||||
snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, 0x0e00, div);
|
||||
snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x0e00, div);
|
||||
break;
|
||||
case WM9713_PCMCLK_PLL_DIV:
|
||||
snd_soc_update_bits(codec, AC97_LINE1_LEVEL,
|
||||
snd_soc_component_update_bits(component, AC97_LINE1_LEVEL,
|
||||
0x007f, div | 0x60);
|
||||
break;
|
||||
case WM9713_HIFI_PLL_DIV:
|
||||
snd_soc_update_bits(codec, AC97_LINE1_LEVEL,
|
||||
snd_soc_component_update_bits(component, AC97_LINE1_LEVEL,
|
||||
0x007f, div | 0x70);
|
||||
break;
|
||||
default:
|
||||
@ -942,8 +942,8 @@ static int wm9713_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
|
||||
static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
u16 gpio = snd_soc_read(codec, AC97_GPIO_CFG) & 0xffc5;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u16 gpio = snd_soc_component_read32(component, AC97_GPIO_CFG) & 0xffc5;
|
||||
u16 reg = 0x8000;
|
||||
|
||||
/* clock masters */
|
||||
@ -996,8 +996,8 @@ static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
break;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AC97_GPIO_CFG, gpio);
|
||||
snd_soc_write(codec, AC97_CENTER_LFE_MASTER, reg);
|
||||
snd_soc_component_write(component, AC97_GPIO_CFG, gpio);
|
||||
snd_soc_component_write(component, AC97_CENTER_LFE_MASTER, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1005,22 +1005,22 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
/* enable PCM interface in master mode */
|
||||
switch (params_width(params)) {
|
||||
case 16:
|
||||
break;
|
||||
case 20:
|
||||
snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER,
|
||||
snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER,
|
||||
0x000c, 0x0004);
|
||||
break;
|
||||
case 24:
|
||||
snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER,
|
||||
snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER,
|
||||
0x000c, 0x0008);
|
||||
break;
|
||||
case 32:
|
||||
snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER,
|
||||
snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER,
|
||||
0x000c, 0x000c);
|
||||
break;
|
||||
}
|
||||
@ -1030,33 +1030,33 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
static int ac97_hifi_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
int reg;
|
||||
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
reg = AC97_PCM_FRONT_DAC_RATE;
|
||||
else
|
||||
reg = AC97_PCM_LR_ADC_RATE;
|
||||
|
||||
return snd_soc_write(codec, reg, runtime->rate);
|
||||
return snd_soc_component_write(component, reg, runtime->rate);
|
||||
}
|
||||
|
||||
static int ac97_aux_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
|
||||
snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
|
||||
snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
|
||||
|
||||
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
|
||||
return -ENODEV;
|
||||
|
||||
return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
|
||||
return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);
|
||||
}
|
||||
|
||||
#define WM9713_RATES (SNDRV_PCM_RATE_8000 | \
|
||||
@ -1142,48 +1142,48 @@ static struct snd_soc_dai_driver wm9713_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static int wm9713_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm9713_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
/* enable thermal shutdown */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0xe400, 0x0000);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0xe400, 0x0000);
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
/* enable master bias and vmid */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0xc400, 0x0000);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0xc400, 0x0000);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0x0000);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
/* disable everything including AC link */
|
||||
snd_soc_write(codec, AC97_EXTENDED_MID, 0xffff);
|
||||
snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
|
||||
snd_soc_component_write(component, AC97_EXTENDED_MID, 0xffff);
|
||||
snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0xffff);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9713_soc_suspend(struct snd_soc_codec *codec)
|
||||
static int wm9713_soc_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
/* Disable everything except touchpanel - that will be handled
|
||||
* by the touch driver and left disabled if touch is not in
|
||||
* use. */
|
||||
snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x7fff,
|
||||
snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x7fff,
|
||||
0x7fff);
|
||||
snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0x6f00);
|
||||
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
|
||||
snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0x6f00);
|
||||
snd_soc_component_write(component, AC97_POWERDOWN, 0xffff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9713_soc_resume(struct snd_soc_codec *codec)
|
||||
static int wm9713_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
ret = snd_ac97_reset(wm9713->ac97, true, WM9713_VENDOR_ID,
|
||||
@ -1191,24 +1191,24 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
|
||||
/* do we need to re-start the PLL ? */
|
||||
if (wm9713->pll_in)
|
||||
wm9713_set_pll(codec, 0, wm9713->pll_in, 0);
|
||||
wm9713_set_pll(component, 0, wm9713->pll_in, 0);
|
||||
|
||||
/* only synchronise the codec if warm reset failed */
|
||||
if (ret == 0) {
|
||||
regcache_mark_dirty(codec->component.regmap);
|
||||
snd_soc_cache_sync(codec);
|
||||
regcache_mark_dirty(component->regmap);
|
||||
snd_soc_component_cache_sync(component);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm9713_soc_probe(struct snd_soc_codec *codec)
|
||||
static int wm9713_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
struct regmap *regmap = NULL;
|
||||
|
||||
if (wm9713->mfd_pdata) {
|
||||
@ -1216,54 +1216,54 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
|
||||
regmap = wm9713->mfd_pdata->regmap;
|
||||
} else {
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID,
|
||||
wm9713->ac97 = snd_soc_new_ac97_component(component, WM9713_VENDOR_ID,
|
||||
WM9713_VENDOR_ID_MASK);
|
||||
if (IS_ERR(wm9713->ac97))
|
||||
return PTR_ERR(wm9713->ac97);
|
||||
regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
snd_soc_free_ac97_codec(wm9713->ac97);
|
||||
snd_soc_free_ac97_component(wm9713->ac97);
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
snd_soc_codec_init_regmap(codec, regmap);
|
||||
snd_soc_component_init_regmap(component, regmap);
|
||||
|
||||
/* unmute the adc - move to kcontrol */
|
||||
snd_soc_update_bits(codec, AC97_CD, 0x7fff, 0x0000);
|
||||
snd_soc_component_update_bits(component, AC97_CD, 0x7fff, 0x0000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm9713_soc_remove(struct snd_soc_codec *codec)
|
||||
static void wm9713_soc_remove(struct snd_soc_component *component)
|
||||
{
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!wm9713->mfd_pdata) {
|
||||
snd_soc_codec_exit_regmap(codec);
|
||||
snd_soc_free_ac97_codec(wm9713->ac97);
|
||||
snd_soc_component_exit_regmap(component);
|
||||
snd_soc_free_ac97_component(wm9713->ac97);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm9713 = {
|
||||
.probe = wm9713_soc_probe,
|
||||
.remove = wm9713_soc_remove,
|
||||
.suspend = wm9713_soc_suspend,
|
||||
.resume = wm9713_soc_resume,
|
||||
.set_bias_level = wm9713_set_bias_level,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm9713_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9713_snd_ac97_controls),
|
||||
.dapm_widgets = wm9713_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9713_dapm_widgets),
|
||||
.dapm_routes = wm9713_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9713_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm9713 = {
|
||||
.probe = wm9713_soc_probe,
|
||||
.remove = wm9713_soc_remove,
|
||||
.suspend = wm9713_soc_suspend,
|
||||
.resume = wm9713_soc_resume,
|
||||
.set_bias_level = wm9713_set_bias_level,
|
||||
.controls = wm9713_snd_ac97_controls,
|
||||
.num_controls = ARRAY_SIZE(wm9713_snd_ac97_controls),
|
||||
.dapm_widgets = wm9713_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm9713_dapm_widgets),
|
||||
.dapm_routes = wm9713_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm9713_audio_map),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int wm9713_probe(struct platform_device *pdev)
|
||||
@ -1279,14 +1279,8 @@ static int wm9713_probe(struct platform_device *pdev)
|
||||
wm9713->mfd_pdata = dev_get_platdata(&pdev->dev);
|
||||
platform_set_drvdata(pdev, wm9713);
|
||||
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai));
|
||||
}
|
||||
|
||||
static int wm9713_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai));
|
||||
}
|
||||
|
||||
static struct platform_driver wm9713_codec_driver = {
|
||||
@ -1295,7 +1289,6 @@ static struct platform_driver wm9713_codec_driver = {
|
||||
},
|
||||
|
||||
.probe = wm9713_probe,
|
||||
.remove = wm9713_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(wm9713_codec_driver);
|
||||
|
@ -58,20 +58,20 @@
|
||||
#define AC97_GPIO_PULL 0x58
|
||||
|
||||
/* Use GPIO8 for rear speaker amplifier */
|
||||
static int rear_amp_power(struct snd_soc_codec *codec, int power)
|
||||
static int rear_amp_power(struct snd_soc_component *component, int power)
|
||||
{
|
||||
unsigned short reg;
|
||||
|
||||
if (power) {
|
||||
reg = snd_soc_read(codec, AC97_GPIO_CFG);
|
||||
snd_soc_write(codec, AC97_GPIO_CFG, reg | 0x0100);
|
||||
reg = snd_soc_read(codec, AC97_GPIO_PULL);
|
||||
snd_soc_write(codec, AC97_GPIO_PULL, reg | (1<<15));
|
||||
reg = snd_soc_component_read32(component, AC97_GPIO_CFG);
|
||||
snd_soc_component_write(component, AC97_GPIO_CFG, reg | 0x0100);
|
||||
reg = snd_soc_component_read32(component, AC97_GPIO_PULL);
|
||||
snd_soc_component_write(component, AC97_GPIO_PULL, reg | (1<<15));
|
||||
} else {
|
||||
reg = snd_soc_read(codec, AC97_GPIO_CFG);
|
||||
snd_soc_write(codec, AC97_GPIO_CFG, reg & ~0x0100);
|
||||
reg = snd_soc_read(codec, AC97_GPIO_PULL);
|
||||
snd_soc_write(codec, AC97_GPIO_PULL, reg & ~(1<<15));
|
||||
reg = snd_soc_component_read32(component, AC97_GPIO_CFG);
|
||||
snd_soc_component_write(component, AC97_GPIO_CFG, reg & ~0x0100);
|
||||
reg = snd_soc_component_read32(component, AC97_GPIO_PULL);
|
||||
snd_soc_component_write(component, AC97_GPIO_PULL, reg & ~(1<<15));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -82,11 +82,11 @@ static int rear_amp_event(struct snd_soc_dapm_widget *widget,
|
||||
{
|
||||
struct snd_soc_card *card = widget->dapm->card;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
|
||||
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
|
||||
codec = rtd->codec;
|
||||
return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event));
|
||||
component = rtd->codec_dai->component;
|
||||
return rear_amp_power(component, SND_SOC_DAPM_EVENT_ON(event));
|
||||
}
|
||||
|
||||
/* mioa701 machine dapm widgets */
|
||||
@ -129,13 +129,13 @@ static const struct snd_soc_dapm_route audio_map[] = {
|
||||
|
||||
static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||
|
||||
/* Prepare GPIO8 for rear speaker amplifier */
|
||||
snd_soc_update_bits(codec, AC97_GPIO_CFG, 0x100, 0x100);
|
||||
snd_soc_component_update_bits(component, AC97_GPIO_CFG, 0x100, 0x100);
|
||||
|
||||
/* Prepare MIC input */
|
||||
snd_soc_update_bits(codec, AC97_3D_CONTROL, 0xc000, 0xc000);
|
||||
snd_soc_component_update_bits(component, AC97_3D_CONTROL, 0xc000, 0xc000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static const struct snd_soc_dapm_route ttc_audio_map[] = {
|
||||
|
||||
static int ttc_pm860x_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||
|
||||
/* Headset jack detection */
|
||||
snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE |
|
||||
@ -86,9 +86,9 @@ static int ttc_pm860x_init(struct snd_soc_pcm_runtime *rtd)
|
||||
ARRAY_SIZE(mic_jack_pins));
|
||||
|
||||
/* headphone, microphone detection & headset short detection */
|
||||
pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE,
|
||||
pm860x_hs_jack_detect(component, &hs_jack, SND_JACK_HEADPHONE,
|
||||
SND_JACK_BTN_0, SND_JACK_BTN_1, SND_JACK_BTN_2);
|
||||
pm860x_mic_jack_detect(codec, &hs_jack, SND_JACK_MICROPHONE);
|
||||
pm860x_mic_jack_detect(component, &hs_jack, SND_JACK_MICROPHONE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct snd_ac97_gpio_priv {
|
||||
struct gpio_chip gpio_chip;
|
||||
#endif
|
||||
unsigned int gpios_set;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
};
|
||||
|
||||
static struct snd_ac97_bus soc_ac97_bus = {
|
||||
@ -57,11 +57,11 @@ static void soc_ac97_device_release(struct device *dev)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GPIOLIB
|
||||
static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip)
|
||||
static inline struct snd_soc_component *gpio_to_component(struct gpio_chip *chip)
|
||||
{
|
||||
struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
|
||||
|
||||
return gpio_priv->codec;
|
||||
return gpio_priv->component;
|
||||
}
|
||||
|
||||
static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
@ -75,20 +75,22 @@ static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
static int snd_soc_ac97_gpio_direction_in(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
||||
struct snd_soc_component *component = gpio_to_component(chip);
|
||||
|
||||
dev_dbg(codec->dev, "set gpio %d to output\n", offset);
|
||||
return snd_soc_update_bits(codec, AC97_GPIO_CFG,
|
||||
dev_dbg(component->dev, "set gpio %d to output\n", offset);
|
||||
return snd_soc_component_update_bits(component, AC97_GPIO_CFG,
|
||||
1 << offset, 1 << offset);
|
||||
}
|
||||
|
||||
static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
||||
struct snd_soc_component *component = gpio_to_component(chip);
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_read(codec, AC97_GPIO_STATUS);
|
||||
dev_dbg(codec->dev, "get gpio %d : %d\n", offset,
|
||||
if (snd_soc_component_read(component, AC97_GPIO_STATUS, &ret) < 0)
|
||||
ret = -1;
|
||||
|
||||
dev_dbg(component->dev, "get gpio %d : %d\n", offset,
|
||||
ret < 0 ? ret : ret & (1 << offset));
|
||||
|
||||
return ret < 0 ? ret : !!(ret & (1 << offset));
|
||||
@ -98,22 +100,24 @@ static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset,
|
||||
int value)
|
||||
{
|
||||
struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
|
||||
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
||||
struct snd_soc_component *component = gpio_to_component(chip);
|
||||
|
||||
gpio_priv->gpios_set &= ~(1 << offset);
|
||||
gpio_priv->gpios_set |= (!!value) << offset;
|
||||
snd_soc_write(codec, AC97_GPIO_STATUS, gpio_priv->gpios_set);
|
||||
dev_dbg(codec->dev, "set gpio %d to %d\n", offset, !!value);
|
||||
snd_soc_component_write(component, AC97_GPIO_STATUS,
|
||||
gpio_priv->gpios_set);
|
||||
dev_dbg(component->dev, "set gpio %d to %d\n", offset, !!value);
|
||||
}
|
||||
|
||||
static int snd_soc_ac97_gpio_direction_out(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
||||
struct snd_soc_component *component = gpio_to_component(chip);
|
||||
|
||||
dev_dbg(codec->dev, "set gpio %d to output\n", offset);
|
||||
dev_dbg(component->dev, "set gpio %d to output\n", offset);
|
||||
snd_soc_ac97_gpio_set(chip, offset, value);
|
||||
return snd_soc_update_bits(codec, AC97_GPIO_CFG, 1 << offset, 0);
|
||||
return snd_soc_component_update_bits(component, AC97_GPIO_CFG,
|
||||
1 << offset, 0);
|
||||
}
|
||||
|
||||
static const struct gpio_chip snd_soc_ac97_gpio_chip = {
|
||||
@ -128,24 +132,24 @@ static const struct gpio_chip snd_soc_ac97_gpio_chip = {
|
||||
};
|
||||
|
||||
static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97,
|
||||
struct snd_soc_codec *codec)
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97_gpio_priv *gpio_priv;
|
||||
int ret;
|
||||
|
||||
gpio_priv = devm_kzalloc(codec->dev, sizeof(*gpio_priv), GFP_KERNEL);
|
||||
gpio_priv = devm_kzalloc(component->dev, sizeof(*gpio_priv), GFP_KERNEL);
|
||||
if (!gpio_priv)
|
||||
return -ENOMEM;
|
||||
ac97->gpio_priv = gpio_priv;
|
||||
gpio_priv->codec = codec;
|
||||
gpio_priv->component = component;
|
||||
gpio_priv->gpio_chip = snd_soc_ac97_gpio_chip;
|
||||
gpio_priv->gpio_chip.ngpio = AC97_NUM_GPIOS;
|
||||
gpio_priv->gpio_chip.parent = codec->dev;
|
||||
gpio_priv->gpio_chip.parent = component->dev;
|
||||
gpio_priv->gpio_chip.base = -1;
|
||||
|
||||
ret = gpiochip_add_data(&gpio_priv->gpio_chip, gpio_priv);
|
||||
if (ret != 0)
|
||||
dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret);
|
||||
dev_err(component->dev, "Failed to add GPIOs: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -155,7 +159,7 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97)
|
||||
}
|
||||
#else
|
||||
static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97,
|
||||
struct snd_soc_codec *codec)
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -166,8 +170,8 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* snd_soc_alloc_ac97_codec() - Allocate new a AC'97 device
|
||||
* @codec: The CODEC for which to create the AC'97 device
|
||||
* snd_soc_alloc_ac97_component() - Allocate new a AC'97 device
|
||||
* @component: The COMPONENT for which to create the AC'97 device
|
||||
*
|
||||
* Allocated a new snd_ac97 device and intializes it, but does not yet register
|
||||
* it. The caller is responsible to either call device_add(&ac97->dev) to
|
||||
@ -175,7 +179,7 @@ static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97)
|
||||
*
|
||||
* Returns: A snd_ac97 device or a PTR_ERR in case of an error.
|
||||
*/
|
||||
struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec)
|
||||
struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_ac97 *ac97;
|
||||
|
||||
@ -187,26 +191,26 @@ struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec)
|
||||
ac97->num = 0;
|
||||
|
||||
ac97->dev.bus = &ac97_bus_type;
|
||||
ac97->dev.parent = codec->component.card->dev;
|
||||
ac97->dev.parent = component->card->dev;
|
||||
ac97->dev.release = soc_ac97_device_release;
|
||||
|
||||
dev_set_name(&ac97->dev, "%d-%d:%s",
|
||||
codec->component.card->snd_card->number, 0,
|
||||
codec->component.name);
|
||||
component->card->snd_card->number, 0,
|
||||
component->name);
|
||||
|
||||
device_initialize(&ac97->dev);
|
||||
|
||||
return ac97;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_soc_alloc_ac97_codec);
|
||||
EXPORT_SYMBOL(snd_soc_alloc_ac97_component);
|
||||
|
||||
/**
|
||||
* snd_soc_new_ac97_codec - initailise AC97 device
|
||||
* @codec: audio codec
|
||||
* snd_soc_new_ac97_component - initailise AC97 device
|
||||
* @component: audio component
|
||||
* @id: The expected device ID
|
||||
* @id_mask: Mask that is applied to the device ID before comparing with @id
|
||||
*
|
||||
* Initialises AC97 codec resources for use by ad-hoc devices only.
|
||||
* Initialises AC97 component resources for use by ad-hoc devices only.
|
||||
*
|
||||
* If @id is not 0 this function will reset the device, then read the ID from
|
||||
* the device and check if it matches the expected ID. If it doesn't match an
|
||||
@ -214,20 +218,20 @@ EXPORT_SYMBOL(snd_soc_alloc_ac97_codec);
|
||||
*
|
||||
* Returns: A PTR_ERR() on failure or a valid snd_ac97 struct on success.
|
||||
*/
|
||||
struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
||||
struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component,
|
||||
unsigned int id, unsigned int id_mask)
|
||||
{
|
||||
struct snd_ac97 *ac97;
|
||||
int ret;
|
||||
|
||||
ac97 = snd_soc_alloc_ac97_codec(codec);
|
||||
ac97 = snd_soc_alloc_ac97_component(component);
|
||||
if (IS_ERR(ac97))
|
||||
return ac97;
|
||||
|
||||
if (id) {
|
||||
ret = snd_ac97_reset(ac97, false, id, id_mask);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to reset AC97 device: %d\n",
|
||||
dev_err(component->dev, "Failed to reset AC97 device: %d\n",
|
||||
ret);
|
||||
goto err_put_device;
|
||||
}
|
||||
@ -237,7 +241,7 @@ struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
||||
if (ret)
|
||||
goto err_put_device;
|
||||
|
||||
ret = snd_soc_ac97_init_gpio(ac97, codec);
|
||||
ret = snd_soc_ac97_init_gpio(ac97, component);
|
||||
if (ret)
|
||||
goto err_put_device;
|
||||
|
||||
@ -247,22 +251,22 @@ err_put_device:
|
||||
put_device(&ac97->dev);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
|
||||
EXPORT_SYMBOL_GPL(snd_soc_new_ac97_component);
|
||||
|
||||
/**
|
||||
* snd_soc_free_ac97_codec - free AC97 codec device
|
||||
* snd_soc_free_ac97_component - free AC97 component device
|
||||
* @ac97: snd_ac97 device to be freed
|
||||
*
|
||||
* Frees AC97 codec device resources.
|
||||
* Frees AC97 component device resources.
|
||||
*/
|
||||
void snd_soc_free_ac97_codec(struct snd_ac97 *ac97)
|
||||
void snd_soc_free_ac97_component(struct snd_ac97 *ac97)
|
||||
{
|
||||
snd_soc_ac97_free_gpio(ac97);
|
||||
device_del(&ac97->dev);
|
||||
ac97->bus = NULL;
|
||||
put_device(&ac97->dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
|
||||
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_component);
|
||||
|
||||
static struct snd_ac97_reset_cfg snd_ac97_rst_cfg;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user