mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 06:04:14 +08:00
Merge branch 'topic/wm9867' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-max9867
This commit is contained in:
commit
6f0a45c6d4
@ -179,8 +179,8 @@ static inline int get_ni_value(int mclk, int rate)
|
|||||||
static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
|
static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
|
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;
|
||||||
struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
unsigned int ni_h, ni_l;
|
unsigned int ni_h, ni_l;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
|
|||||||
bclk_value = MAX9867_IFC1B_PCLK_16;
|
bclk_value = MAX9867_IFC1B_PCLK_16;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"unsupported sampling rate\n");
|
"unsupported sampling rate\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
|
|||||||
bclk_value = MAX9867_IFC1B_32BIT;
|
bclk_value = MAX9867_IFC1B_32BIT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "unsupported sampling rate\n");
|
dev_err(component->dev, "unsupported sampling rate\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
regmap_update_bits(max9867->regmap, MAX9867_IFC1B,
|
regmap_update_bits(max9867->regmap, MAX9867_IFC1B,
|
||||||
@ -251,8 +251,8 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
|
|||||||
static int max9867_prepare(struct snd_pcm_substream *substream,
|
static int max9867_prepare(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 max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
regmap_update_bits(max9867->regmap, MAX9867_PWRMAN,
|
regmap_update_bits(max9867->regmap, MAX9867_PWRMAN,
|
||||||
MAX9867_SHTDOWN_MASK, MAX9867_SHTDOWN_MASK);
|
MAX9867_SHTDOWN_MASK, MAX9867_SHTDOWN_MASK);
|
||||||
@ -261,8 +261,8 @@ static int max9867_prepare(struct snd_pcm_substream *substream,
|
|||||||
|
|
||||||
static int max9867_mute(struct snd_soc_dai *dai, int mute)
|
static int max9867_mute(struct snd_soc_dai *dai, int mute)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = dai->codec;
|
struct snd_soc_component *component = dai->component;
|
||||||
struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
if (mute)
|
if (mute)
|
||||||
regmap_update_bits(max9867->regmap, MAX9867_DACLEVEL,
|
regmap_update_bits(max9867->regmap, MAX9867_DACLEVEL,
|
||||||
@ -276,8 +276,8 @@ static int max9867_mute(struct snd_soc_dai *dai, int mute)
|
|||||||
static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||||
int clk_id, unsigned int freq, int dir)
|
int clk_id, unsigned int freq, int dir)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
/* Set the prescaler based on the master clock frequency*/
|
/* Set the prescaler based on the master clock frequency*/
|
||||||
@ -308,8 +308,8 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
|||||||
static int max9867_dai_set_fmt(struct snd_soc_dai *codec_dai,
|
static int max9867_dai_set_fmt(struct snd_soc_dai *codec_dai,
|
||||||
unsigned int fmt)
|
unsigned int fmt)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = codec_dai->codec;
|
struct snd_soc_component *component = codec_dai->component;
|
||||||
struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
u8 iface1A = 0, iface1B = 0;
|
u8 iface1A = 0, iface1B = 0;
|
||||||
|
|
||||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||||
@ -413,25 +413,27 @@ static int max9867_resume(struct device *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int max9867_probe(struct snd_soc_codec *codec)
|
static int max9867_probe(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
|
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
dev_dbg(codec->dev, "max98090_probe\n");
|
dev_dbg(component->dev, "max98090_probe\n");
|
||||||
max9867->codec = codec;
|
max9867->component = component;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_codec_driver max9867_codec = {
|
static const struct snd_soc_component_driver max9867_component = {
|
||||||
.probe = max9867_probe,
|
.probe = max9867_probe,
|
||||||
.component_driver = {
|
.controls = max9867_snd_controls,
|
||||||
.controls = max9867_snd_controls,
|
.num_controls = ARRAY_SIZE(max9867_snd_controls),
|
||||||
.num_controls = ARRAY_SIZE(max9867_snd_controls),
|
.dapm_routes = max9867_audio_map,
|
||||||
.dapm_routes = max9867_audio_map,
|
.num_dapm_routes = ARRAY_SIZE(max9867_audio_map),
|
||||||
.num_dapm_routes = ARRAY_SIZE(max9867_audio_map),
|
.dapm_widgets = max9867_dapm_widgets,
|
||||||
.dapm_widgets = max9867_dapm_widgets,
|
.num_dapm_widgets = ARRAY_SIZE(max9867_dapm_widgets),
|
||||||
.num_dapm_widgets = ARRAY_SIZE(max9867_dapm_widgets),
|
.idle_bias_on = 1,
|
||||||
},
|
.use_pmdown_time = 1,
|
||||||
|
.endianness = 1,
|
||||||
|
.non_legacy_dai_naming = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool max9867_volatile_register(struct device *dev, unsigned int reg)
|
static bool max9867_volatile_register(struct device *dev, unsigned int reg)
|
||||||
@ -505,21 +507,15 @@ static int max9867_i2c_probe(struct i2c_client *i2c,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
dev_info(&i2c->dev, "device revision: %x\n", reg);
|
dev_info(&i2c->dev, "device revision: %x\n", reg);
|
||||||
ret = snd_soc_register_codec(&i2c->dev, &max9867_codec,
|
ret = devm_snd_soc_register_component(&i2c->dev, &max9867_component,
|
||||||
max9867_dai, ARRAY_SIZE(max9867_dai));
|
max9867_dai, ARRAY_SIZE(max9867_dai));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&i2c->dev, "Failed to register codec: %d\n", ret);
|
dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max9867_i2c_remove(struct i2c_client *client)
|
|
||||||
{
|
|
||||||
snd_soc_unregister_codec(&client->dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct i2c_device_id max9867_i2c_id[] = {
|
static const struct i2c_device_id max9867_i2c_id[] = {
|
||||||
{ "max9867", 0 },
|
{ "max9867", 0 },
|
||||||
{ }
|
{ }
|
||||||
@ -543,7 +539,6 @@ static struct i2c_driver max9867_i2c_driver = {
|
|||||||
.pm = &max9867_pm_ops,
|
.pm = &max9867_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = max9867_i2c_probe,
|
.probe = max9867_i2c_probe,
|
||||||
.remove = max9867_i2c_remove,
|
|
||||||
.id_table = max9867_i2c_id,
|
.id_table = max9867_i2c_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
/* codec private data */
|
/* codec private data */
|
||||||
struct max9867_priv {
|
struct max9867_priv {
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
struct snd_soc_codec *codec;
|
struct snd_soc_component *component;
|
||||||
unsigned int sysclk;
|
unsigned int sysclk;
|
||||||
unsigned int pclk;
|
unsigned int pclk;
|
||||||
unsigned int master;
|
unsigned int master;
|
||||||
|
Loading…
Reference in New Issue
Block a user