Commit 8c081faf authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/pcm512x' into asoc-next

parents 78a1287b 5bdef14a
...@@ -226,8 +226,8 @@ static bool pcm512x_volatile(struct device *dev, unsigned int reg) ...@@ -226,8 +226,8 @@ static bool pcm512x_volatile(struct device *dev, unsigned int reg)
static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = pcm512x->overclock_pll; ucontrol->value.integer.value[0] = pcm512x->overclock_pll;
return 0; return 0;
...@@ -236,10 +236,10 @@ static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, ...@@ -236,10 +236,10 @@ static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol,
static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
switch (snd_soc_codec_get_bias_level(codec)) { switch (snd_soc_component_get_bias_level(component)) {
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
break; break;
...@@ -254,8 +254,8 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, ...@@ -254,8 +254,8 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol,
static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = pcm512x->overclock_dsp; ucontrol->value.integer.value[0] = pcm512x->overclock_dsp;
return 0; return 0;
...@@ -264,10 +264,10 @@ static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, ...@@ -264,10 +264,10 @@ static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol,
static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
switch (snd_soc_codec_get_bias_level(codec)) { switch (snd_soc_component_get_bias_level(component)) {
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
break; break;
...@@ -282,8 +282,8 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, ...@@ -282,8 +282,8 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol,
static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = pcm512x->overclock_dac; ucontrol->value.integer.value[0] = pcm512x->overclock_dac;
return 0; return 0;
...@@ -292,10 +292,10 @@ static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, ...@@ -292,10 +292,10 @@ static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol,
static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol, static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
switch (snd_soc_codec_get_bias_level(codec)) { switch (snd_soc_component_get_bias_level(component)) {
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
break; break;
...@@ -522,8 +522,8 @@ static int pcm512x_hw_rule_rate(struct snd_pcm_hw_params *params, ...@@ -522,8 +522,8 @@ static int pcm512x_hw_rule_rate(struct snd_pcm_hw_params *params,
static int pcm512x_dai_startup_master(struct snd_pcm_substream *substream, static int pcm512x_dai_startup_master(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
struct device *dev = dai->dev; struct device *dev = dai->dev;
struct snd_pcm_hw_constraint_ratnums *constraints_no_pll; struct snd_pcm_hw_constraint_ratnums *constraints_no_pll;
struct snd_ratnum *rats_no_pll; struct snd_ratnum *rats_no_pll;
...@@ -564,8 +564,8 @@ static int pcm512x_dai_startup_master(struct snd_pcm_substream *substream, ...@@ -564,8 +564,8 @@ static int pcm512x_dai_startup_master(struct snd_pcm_substream *substream,
static int pcm512x_dai_startup_slave(struct snd_pcm_substream *substream, static int pcm512x_dai_startup_slave(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
struct device *dev = dai->dev; struct device *dev = dai->dev;
struct regmap *regmap = pcm512x->regmap; struct regmap *regmap = pcm512x->regmap;
...@@ -590,8 +590,8 @@ static int pcm512x_dai_startup_slave(struct snd_pcm_substream *substream, ...@@ -590,8 +590,8 @@ static int pcm512x_dai_startup_slave(struct snd_pcm_substream *substream,
static int pcm512x_dai_startup(struct snd_pcm_substream *substream, static int pcm512x_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
...@@ -606,10 +606,10 @@ static int pcm512x_dai_startup(struct snd_pcm_substream *substream, ...@@ -606,10 +606,10 @@ static int pcm512x_dai_startup(struct snd_pcm_substream *substream,
} }
} }
static int pcm512x_set_bias_level(struct snd_soc_codec *codec, static int pcm512x_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct pcm512x_priv *pcm512x = dev_get_drvdata(codec->dev); struct pcm512x_priv *pcm512x = dev_get_drvdata(component->dev);
int ret; int ret;
switch (level) { switch (level) {
...@@ -621,7 +621,7 @@ static int pcm512x_set_bias_level(struct snd_soc_codec *codec, ...@@ -621,7 +621,7 @@ static int pcm512x_set_bias_level(struct snd_soc_codec *codec,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER,
PCM512x_RQST, 0); PCM512x_RQST, 0);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to remove standby: %d\n", dev_err(component->dev, "Failed to remove standby: %d\n",
ret); ret);
return ret; return ret;
} }
...@@ -631,7 +631,7 @@ static int pcm512x_set_bias_level(struct snd_soc_codec *codec, ...@@ -631,7 +631,7 @@ static int pcm512x_set_bias_level(struct snd_soc_codec *codec,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER,
PCM512x_RQST, PCM512x_RQST); PCM512x_RQST, PCM512x_RQST);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to request standby: %d\n", dev_err(component->dev, "Failed to request standby: %d\n",
ret); ret);
return ret; return ret;
} }
...@@ -645,8 +645,8 @@ static unsigned long pcm512x_find_sck(struct snd_soc_dai *dai, ...@@ -645,8 +645,8 @@ static unsigned long pcm512x_find_sck(struct snd_soc_dai *dai,
unsigned long bclk_rate) unsigned long bclk_rate)
{ {
struct device *dev = dai->dev; struct device *dev = dai->dev;
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
unsigned long sck_rate; unsigned long sck_rate;
int pow2; int pow2;
...@@ -691,8 +691,8 @@ static int pcm512x_find_pll_coeff(struct snd_soc_dai *dai, ...@@ -691,8 +691,8 @@ static int pcm512x_find_pll_coeff(struct snd_soc_dai *dai,
unsigned long pll_rate) unsigned long pll_rate)
{ {
struct device *dev = dai->dev; struct device *dev = dai->dev;
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
unsigned long common; unsigned long common;
int R, J, D, P; int R, J, D, P;
unsigned long K; /* 10000 * J.D */ unsigned long K; /* 10000 * J.D */
...@@ -798,8 +798,8 @@ static unsigned long pcm512x_pllin_dac_rate(struct snd_soc_dai *dai, ...@@ -798,8 +798,8 @@ static unsigned long pcm512x_pllin_dac_rate(struct snd_soc_dai *dai,
unsigned long osr_rate, unsigned long osr_rate,
unsigned long pllin_rate) unsigned long pllin_rate)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
unsigned long dac_rate; unsigned long dac_rate;
if (!pcm512x->pll_out) if (!pcm512x->pll_out)
...@@ -829,8 +829,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, ...@@ -829,8 +829,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct device *dev = dai->dev; struct device *dev = dai->dev;
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
unsigned long pllin_rate = 0; unsigned long pllin_rate = 0;
unsigned long pll_rate; unsigned long pll_rate;
unsigned long sck_rate; unsigned long sck_rate;
...@@ -949,7 +949,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, ...@@ -949,7 +949,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF,
PCM512x_SDAC, PCM512x_SDAC_GPIO); PCM512x_SDAC, PCM512x_SDAC_GPIO);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to set gpio as dacref: %d\n", ret); "Failed to set gpio as dacref: %d\n", ret);
return ret; return ret;
} }
...@@ -958,7 +958,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, ...@@ -958,7 +958,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_DACIN, ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_DACIN,
PCM512x_GREF, gpio); PCM512x_GREF, gpio);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to set gpio %d as dacin: %d\n", "Failed to set gpio %d as dacin: %d\n",
pcm512x->pll_in, ret); pcm512x->pll_in, ret);
return ret; return ret;
...@@ -987,7 +987,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, ...@@ -987,7 +987,7 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF, ret = regmap_update_bits(pcm512x->regmap, PCM512x_DAC_REF,
PCM512x_SDAC, PCM512x_SDAC_SCK); PCM512x_SDAC, PCM512x_SDAC_SCK);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to set sck as dacref: %d\n", ret); "Failed to set sck as dacref: %d\n", ret);
return ret; return ret;
} }
...@@ -1082,18 +1082,18 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, ...@@ -1082,18 +1082,18 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_FS_SPEED_MODE, ret = regmap_update_bits(pcm512x->regmap, PCM512x_FS_SPEED_MODE,
PCM512x_FSSP, fssp); PCM512x_FSSP, fssp);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set fs speed: %d\n", ret); dev_err(component->dev, "Failed to set fs speed: %d\n", ret);
return ret; return ret;
} }
dev_dbg(codec->dev, "DSP divider %d\n", dsp_div); dev_dbg(component->dev, "DSP divider %d\n", dsp_div);
dev_dbg(codec->dev, "DAC divider %d\n", dac_div); dev_dbg(component->dev, "DAC divider %d\n", dac_div);
dev_dbg(codec->dev, "NCP divider %d\n", ncp_div); dev_dbg(component->dev, "NCP divider %d\n", ncp_div);
dev_dbg(codec->dev, "OSR divider %d\n", osr_div); dev_dbg(component->dev, "OSR divider %d\n", osr_div);
dev_dbg(codec->dev, "BCK divider %d\n", bclk_div); dev_dbg(component->dev, "BCK divider %d\n", bclk_div);
dev_dbg(codec->dev, "LRCK divider %d\n", lrclk_div); dev_dbg(component->dev, "LRCK divider %d\n", lrclk_div);
dev_dbg(codec->dev, "IDAC %d\n", idac); dev_dbg(component->dev, "IDAC %d\n", idac);
dev_dbg(codec->dev, "1<<FSSP %d\n", 1 << fssp); dev_dbg(component->dev, "1<<FSSP %d\n", 1 << fssp);
return 0; return 0;
} }
...@@ -1102,15 +1102,15 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1102,15 +1102,15 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
int alen; int alen;
int gpio; int gpio;
int clock_output; int clock_output;
int master_mode; int master_mode;
int ret; int ret;
dev_dbg(codec->dev, "hw_params %u Hz, %u channels\n", dev_dbg(component->dev, "hw_params %u Hz, %u channels\n",
params_rate(params), params_rate(params),
params_channels(params)); params_channels(params));
...@@ -1128,7 +1128,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1128,7 +1128,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
alen = PCM512x_ALEN_32; alen = PCM512x_ALEN_32;
break; break;
default: default:
dev_err(codec->dev, "Bad frame size: %d\n", dev_err(component->dev, "Bad frame size: %d\n",
params_width(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
...@@ -1141,7 +1141,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1141,7 +1141,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
| PCM512x_BCKO | PCM512x_LRKO, | PCM512x_BCKO | PCM512x_LRKO,
0); 0);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to enable slave mode: %d\n", ret); "Failed to enable slave mode: %d\n", ret);
return ret; return ret;
} }
...@@ -1149,7 +1149,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1149,7 +1149,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT, ret = regmap_update_bits(pcm512x->regmap, PCM512x_ERROR_DETECT,
PCM512x_DCAS, 0); PCM512x_DCAS, 0);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to enable clock divider autoset: %d\n", "Failed to enable clock divider autoset: %d\n",
ret); ret);
return ret; return ret;
...@@ -1170,20 +1170,20 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1170,20 +1170,20 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1,
PCM512x_ALEN, alen); PCM512x_ALEN, alen);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set frame size: %d\n", ret); dev_err(component->dev, "Failed to set frame size: %d\n", ret);
return ret; return ret;
} }
if (pcm512x->pll_out) { if (pcm512x->pll_out) {
ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_A, 0x11); ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_A, 0x11);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set FLEX_A: %d\n", ret); dev_err(component->dev, "Failed to set FLEX_A: %d\n", ret);
return ret; return ret;
} }
ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_B, 0xff); ret = regmap_write(pcm512x->regmap, PCM512x_FLEX_B, 0xff);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set FLEX_B: %d\n", ret); dev_err(component->dev, "Failed to set FLEX_B: %d\n", ret);
return ret; return ret;
} }
...@@ -1196,7 +1196,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1196,7 +1196,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
| PCM512x_IDSK | PCM512x_IDCH | PCM512x_IDSK | PCM512x_IDCH
| PCM512x_DCAS); | PCM512x_DCAS);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to ignore auto-clock failures: %d\n", "Failed to ignore auto-clock failures: %d\n",
ret); ret);
return ret; return ret;
...@@ -1211,7 +1211,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1211,7 +1211,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
| PCM512x_IDSK | PCM512x_IDCH | PCM512x_IDSK | PCM512x_IDCH
| PCM512x_DCAS | PCM512x_IPLK); | PCM512x_DCAS | PCM512x_IPLK);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to ignore auto-clock failures: %d\n", "Failed to ignore auto-clock failures: %d\n",
ret); ret);
return ret; return ret;
...@@ -1220,7 +1220,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1220,7 +1220,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN, ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN,
PCM512x_PLLE, 0); PCM512x_PLLE, 0);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to disable pll: %d\n", ret); dev_err(component->dev, "Failed to disable pll: %d\n", ret);
return ret; return ret;
} }
} }
...@@ -1233,7 +1233,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1233,7 +1233,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_REF, ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_REF,
PCM512x_SREF, PCM512x_SREF_GPIO); PCM512x_SREF, PCM512x_SREF_GPIO);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to set gpio as pllref: %d\n", ret); "Failed to set gpio as pllref: %d\n", ret);
return ret; return ret;
} }
...@@ -1242,7 +1242,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1242,7 +1242,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_PLLIN, ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_PLLIN,
PCM512x_GREF, gpio); PCM512x_GREF, gpio);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to set gpio %d as pllin: %d\n", "Failed to set gpio %d as pllin: %d\n",
pcm512x->pll_in, ret); pcm512x->pll_in, ret);
return ret; return ret;
...@@ -1251,7 +1251,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1251,7 +1251,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN, ret = regmap_update_bits(pcm512x->regmap, PCM512x_PLL_EN,
PCM512x_PLLE, PCM512x_PLLE); PCM512x_PLLE, PCM512x_PLLE);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable pll: %d\n", ret); dev_err(component->dev, "Failed to enable pll: %d\n", ret);
return ret; return ret;
} }
} }
...@@ -1260,7 +1260,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1260,7 +1260,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
PCM512x_BCKP | PCM512x_BCKO | PCM512x_LRKO, PCM512x_BCKP | PCM512x_BCKO | PCM512x_LRKO,
clock_output); clock_output);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable clock output: %d\n", ret); dev_err(component->dev, "Failed to enable clock output: %d\n", ret);
return ret; return ret;
} }
...@@ -1268,7 +1268,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1268,7 +1268,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
PCM512x_RLRK | PCM512x_RBCK, PCM512x_RLRK | PCM512x_RBCK,
master_mode); master_mode);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable master mode: %d\n", ret); dev_err(component->dev, "Failed to enable master mode: %d\n", ret);
return ret; return ret;
} }
...@@ -1277,7 +1277,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1277,7 +1277,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_EN, ret = regmap_update_bits(pcm512x->regmap, PCM512x_GPIO_EN,
gpio, gpio); gpio, gpio);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable gpio %d: %d\n", dev_err(component->dev, "Failed to enable gpio %d: %d\n",
pcm512x->pll_out, ret); pcm512x->pll_out, ret);
return ret; return ret;
} }
...@@ -1286,7 +1286,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1286,7 +1286,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, gpio, ret = regmap_update_bits(pcm512x->regmap, gpio,
PCM512x_GxSL, PCM512x_GxSL_PLLCK); PCM512x_GxSL, PCM512x_GxSL_PLLCK);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to output pll on %d: %d\n", dev_err(component->dev, "Failed to output pll on %d: %d\n",
ret, pcm512x->pll_out); ret, pcm512x->pll_out);
return ret; return ret;
} }
...@@ -1295,14 +1295,14 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1295,14 +1295,14 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE,
PCM512x_RQSY, PCM512x_RQSY_HALT); PCM512x_RQSY, PCM512x_RQSY_HALT);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to halt clocks: %d\n", ret); dev_err(component->dev, "Failed to halt clocks: %d\n", ret);
return ret; return ret;
} }
ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE, ret = regmap_update_bits(pcm512x->regmap, PCM512x_SYNCHRONIZE,
PCM512x_RQSY, PCM512x_RQSY_RESUME); PCM512x_RQSY, PCM512x_RQSY_RESUME);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to resume clocks: %d\n", ret); dev_err(component->dev, "Failed to resume clocks: %d\n", ret);
return ret; return ret;
} }
...@@ -1311,8 +1311,8 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1311,8 +1311,8 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
static int pcm512x_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int pcm512x_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
pcm512x->fmt = fmt; pcm512x->fmt = fmt;
...@@ -1341,18 +1341,17 @@ static struct snd_soc_dai_driver pcm512x_dai = { ...@@ -1341,18 +1341,17 @@ static struct snd_soc_dai_driver pcm512x_dai = {
.ops = &pcm512x_dai_ops, .ops = &pcm512x_dai_ops,
}; };
static const struct snd_soc_codec_driver pcm512x_codec_driver = { static const struct snd_soc_component_driver pcm512x_component_driver = {
.set_bias_level = pcm512x_set_bias_level, .set_bias_level = pcm512x_set_bias_level,
.idle_bias_off = true, .controls = pcm512x_controls,
.num_controls = ARRAY_SIZE(pcm512x_controls),
.component_driver = { .dapm_widgets = pcm512x_dapm_widgets,
.controls = pcm512x_controls, .num_dapm_widgets = ARRAY_SIZE(pcm512x_dapm_widgets),
.num_controls = ARRAY_SIZE(pcm512x_controls), .dapm_routes = pcm512x_dapm_routes,
.dapm_widgets = pcm512x_dapm_widgets, .num_dapm_routes = ARRAY_SIZE(pcm512x_dapm_routes),
.num_dapm_widgets = ARRAY_SIZE(pcm512x_dapm_widgets), .use_pmdown_time = 1,
.dapm_routes = pcm512x_dapm_routes, .endianness = 1,
.num_dapm_routes = ARRAY_SIZE(pcm512x_dapm_routes), .non_legacy_dai_naming = 1,
},
}; };
static const struct regmap_range_cfg pcm512x_range = { static const struct regmap_range_cfg pcm512x_range = {
...@@ -1498,7 +1497,7 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap) ...@@ -1498,7 +1497,7 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
} }
#endif #endif
ret = snd_soc_register_codec(dev, &pcm512x_codec_driver, ret = devm_snd_soc_register_component(dev, &pcm512x_component_driver,
&pcm512x_dai, 1); &pcm512x_dai, 1);
if (ret != 0) { if (ret != 0) {
dev_err(dev, "Failed to register CODEC: %d\n", ret); dev_err(dev, "Failed to register CODEC: %d\n", ret);
...@@ -1523,7 +1522,6 @@ void pcm512x_remove(struct device *dev) ...@@ -1523,7 +1522,6 @@ void pcm512x_remove(struct device *dev)
{ {
struct pcm512x_priv *pcm512x = dev_get_drvdata(dev); struct pcm512x_priv *pcm512x = dev_get_drvdata(dev);
snd_soc_unregister_codec(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
if (!IS_ERR(pcm512x->sclk)) if (!IS_ERR(pcm512x->sclk))
clk_disable_unprepare(pcm512x->sclk); clk_disable_unprepare(pcm512x->sclk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment