Commit 91898117 authored by Mark Brown's avatar Mark Brown

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

parents 09a37cbc 29751c1c
...@@ -287,8 +287,8 @@ static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a) ...@@ -287,8 +287,8 @@ static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a)
static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute) static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm3168a_priv *pcm3168a = snd_soc_codec_get_drvdata(codec); struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(component);
regmap_write(pcm3168a->regmap, PCM3168A_DAC_MUTE, mute ? 0xff : 0); regmap_write(pcm3168a->regmap, PCM3168A_DAC_MUTE, mute ? 0xff : 0);
...@@ -298,7 +298,7 @@ static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute) ...@@ -298,7 +298,7 @@ static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute)
static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai, static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct pcm3168a_priv *pcm3168a = snd_soc_codec_get_drvdata(dai->codec); struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(dai->component);
int ret; int ret;
if (freq > PCM1368A_MAX_SYSCLK) if (freq > PCM1368A_MAX_SYSCLK)
...@@ -316,8 +316,8 @@ static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai, ...@@ -316,8 +316,8 @@ static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai, static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
unsigned int format, bool dac) unsigned int format, bool dac)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct pcm3168a_priv *pcm3168a = snd_soc_codec_get_drvdata(codec); struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(component);
u32 fmt, reg, mask, shift; u32 fmt, reg, mask, shift;
bool master_mode; bool master_mode;
...@@ -338,7 +338,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai, ...@@ -338,7 +338,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
fmt = PCM3168A_FMT_DSP_B; fmt = PCM3168A_FMT_DSP_B;
break; break;
default: default:
dev_err(codec->dev, "unsupported dai format\n"); dev_err(component->dev, "unsupported dai format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -350,7 +350,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai, ...@@ -350,7 +350,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
master_mode = true; master_mode = true;
break; break;
default: default:
dev_err(codec->dev, "unsupported master/slave mode\n"); dev_err(component->dev, "unsupported master/slave mode\n");
return -EINVAL; return -EINVAL;
} }
...@@ -396,8 +396,8 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, ...@@ -396,8 +396,8 @@ static int pcm3168a_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 pcm3168a_priv *pcm3168a = snd_soc_codec_get_drvdata(codec); struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(component);
bool tx, master_mode; bool tx, master_mode;
u32 val, mask, shift, reg; u32 val, mask, shift, reg;
unsigned int rate, fmt, ratio, max_ratio; unsigned int rate, fmt, ratio, max_ratio;
...@@ -430,7 +430,7 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, ...@@ -430,7 +430,7 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
} }
if (i == max_ratio) { if (i == max_ratio) {
dev_err(codec->dev, "unsupported sysclk ratio\n"); dev_err(component->dev, "unsupported sysclk ratio\n");
return -EINVAL; return -EINVAL;
} }
...@@ -438,21 +438,21 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, ...@@ -438,21 +438,21 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
switch (min_frame_size) { switch (min_frame_size) {
case 32: case 32:
if (master_mode || (fmt != PCM3168A_FMT_RIGHT_J)) { if (master_mode || (fmt != PCM3168A_FMT_RIGHT_J)) {
dev_err(codec->dev, "32-bit frames are supported only for slave mode using right justified\n"); dev_err(component->dev, "32-bit frames are supported only for slave mode using right justified\n");
return -EINVAL; return -EINVAL;
} }
fmt = PCM3168A_FMT_RIGHT_J_16; fmt = PCM3168A_FMT_RIGHT_J_16;
break; break;
case 48: case 48:
if (master_mode || (fmt & PCM3168A_FMT_DSP_MASK)) { if (master_mode || (fmt & PCM3168A_FMT_DSP_MASK)) {
dev_err(codec->dev, "48-bit frames not supported in master mode, or slave mode using DSP\n"); dev_err(component->dev, "48-bit frames not supported in master mode, or slave mode using DSP\n");
return -EINVAL; return -EINVAL;
} }
break; break;
case 64: case 64:
break; break;
default: default:
dev_err(codec->dev, "unsupported frame size: %d\n", min_frame_size); dev_err(component->dev, "unsupported frame size: %d\n", min_frame_size);
return -EINVAL; return -EINVAL;
} }
...@@ -595,16 +595,16 @@ const struct regmap_config pcm3168a_regmap = { ...@@ -595,16 +595,16 @@ const struct regmap_config pcm3168a_regmap = {
}; };
EXPORT_SYMBOL_GPL(pcm3168a_regmap); EXPORT_SYMBOL_GPL(pcm3168a_regmap);
static const struct snd_soc_codec_driver pcm3168a_driver = { static const struct snd_soc_component_driver pcm3168a_driver = {
.idle_bias_off = true, .controls = pcm3168a_snd_controls,
.component_driver = { .num_controls = ARRAY_SIZE(pcm3168a_snd_controls),
.controls = pcm3168a_snd_controls, .dapm_widgets = pcm3168a_dapm_widgets,
.num_controls = ARRAY_SIZE(pcm3168a_snd_controls), .num_dapm_widgets = ARRAY_SIZE(pcm3168a_dapm_widgets),
.dapm_widgets = pcm3168a_dapm_widgets, .dapm_routes = pcm3168a_dapm_routes,
.num_dapm_widgets = ARRAY_SIZE(pcm3168a_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(pcm3168a_dapm_routes),
.dapm_routes = pcm3168a_dapm_routes, .use_pmdown_time = 1,
.num_dapm_routes = ARRAY_SIZE(pcm3168a_dapm_routes) .endianness = 1,
}, .non_legacy_dai_naming = 1,
}; };
int pcm3168a_probe(struct device *dev, struct regmap *regmap) int pcm3168a_probe(struct device *dev, struct regmap *regmap)
...@@ -669,10 +669,10 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) ...@@ -669,10 +669,10 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
pm_runtime_enable(dev); pm_runtime_enable(dev);
pm_runtime_idle(dev); pm_runtime_idle(dev);
ret = snd_soc_register_codec(dev, &pcm3168a_driver, pcm3168a_dais, ret = devm_snd_soc_register_component(dev, &pcm3168a_driver, pcm3168a_dais,
ARRAY_SIZE(pcm3168a_dais)); ARRAY_SIZE(pcm3168a_dais));
if (ret) { if (ret) {
dev_err(dev, "failed to register codec: %d\n", ret); dev_err(dev, "failed to register component: %d\n", ret);
goto err_regulator; goto err_regulator;
} }
...@@ -692,7 +692,6 @@ void pcm3168a_remove(struct device *dev) ...@@ -692,7 +692,6 @@ void pcm3168a_remove(struct device *dev)
{ {
struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev); struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev);
snd_soc_unregister_codec(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies),
pcm3168a->supplies); pcm3168a->supplies);
......
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