Commit b25d2803 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/rt5640', 'asoc/topic/rt5659',...

Merge remote-tracking branches 'asoc/topic/rt5640', 'asoc/topic/rt5659', 'asoc/topic/samsung' and 'asoc/topic/ssm4567' into asoc-next
...@@ -12,6 +12,9 @@ Required properties: ...@@ -12,6 +12,9 @@ Required properties:
Optional properties: Optional properties:
- clocks: The phandle of the master clock to the CODEC
- clock-names: Should be "mclk"
- realtek,in1-differential - realtek,in1-differential
- realtek,in2-differential - realtek,in2-differential
- realtek,in3-differential - realtek,in3-differential
......
...@@ -1217,11 +1217,14 @@ static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = { ...@@ -1217,11 +1217,14 @@ static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("DIG MIXR", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MIXER("DIG MIXR", SND_SOC_NOPM, 0, 0,
rt5640_dig_r_mix, ARRAY_SIZE(rt5640_dig_r_mix)), rt5640_dig_r_mix, ARRAY_SIZE(rt5640_dig_r_mix)),
/* DACs */ /* DACs */
SND_SOC_DAPM_DAC("DAC L1", NULL, RT5640_PWR_DIG1, SND_SOC_DAPM_DAC("DAC L1", NULL, SND_SOC_NOPM,
RT5640_PWR_DAC_L1_BIT, 0), 0, 0),
SND_SOC_DAPM_DAC("DAC R1", NULL, RT5640_PWR_DIG1, SND_SOC_DAPM_DAC("DAC R1", NULL, SND_SOC_NOPM,
RT5640_PWR_DAC_R1_BIT, 0), 0, 0),
SND_SOC_DAPM_SUPPLY("DAC L1 Power", RT5640_PWR_DIG1,
RT5640_PWR_DAC_L1_BIT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("DAC R1 Power", RT5640_PWR_DIG1,
RT5640_PWR_DAC_R1_BIT, 0, NULL, 0),
/* SPK/OUT Mixer */ /* SPK/OUT Mixer */
SND_SOC_DAPM_MIXER("SPK MIXL", RT5640_PWR_MIXER, RT5640_PWR_SM_L_BIT, SND_SOC_DAPM_MIXER("SPK MIXL", RT5640_PWR_MIXER, RT5640_PWR_SM_L_BIT,
0, rt5640_spk_l_mix, ARRAY_SIZE(rt5640_spk_l_mix)), 0, rt5640_spk_l_mix, ARRAY_SIZE(rt5640_spk_l_mix)),
...@@ -1298,9 +1301,9 @@ static const struct snd_soc_dapm_widget rt5640_specific_dapm_widgets[] = { ...@@ -1298,9 +1301,9 @@ static const struct snd_soc_dapm_widget rt5640_specific_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
rt5640_sto_dac_r_mix, ARRAY_SIZE(rt5640_sto_dac_r_mix)), rt5640_sto_dac_r_mix, ARRAY_SIZE(rt5640_sto_dac_r_mix)),
SND_SOC_DAPM_DAC("DAC R2", NULL, RT5640_PWR_DIG1, RT5640_PWR_DAC_R2_BIT, SND_SOC_DAPM_DAC("DAC R2", NULL, SND_SOC_NOPM, 0,
0), 0),
SND_SOC_DAPM_DAC("DAC L2", NULL, RT5640_PWR_DIG1, RT5640_PWR_DAC_L2_BIT, SND_SOC_DAPM_DAC("DAC L2", NULL, SND_SOC_NOPM, 0,
0), 0),
SND_SOC_DAPM_MIXER("OUT MIXL", RT5640_PWR_MIXER, RT5640_PWR_OM_L_BIT, SND_SOC_DAPM_MIXER("OUT MIXL", RT5640_PWR_MIXER, RT5640_PWR_OM_L_BIT,
...@@ -1317,6 +1320,10 @@ static const struct snd_soc_dapm_widget rt5640_specific_dapm_widgets[] = { ...@@ -1317,6 +1320,10 @@ static const struct snd_soc_dapm_widget rt5640_specific_dapm_widgets[] = {
rt5640_mono_mix, ARRAY_SIZE(rt5640_mono_mix)), rt5640_mono_mix, ARRAY_SIZE(rt5640_mono_mix)),
SND_SOC_DAPM_SUPPLY("Improve MONO Amp Drv", RT5640_PWR_ANLG1, SND_SOC_DAPM_SUPPLY("Improve MONO Amp Drv", RT5640_PWR_ANLG1,
RT5640_PWR_MA_BIT, 0, NULL, 0), RT5640_PWR_MA_BIT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("DAC L2 Power", RT5640_PWR_DIG1,
RT5640_PWR_DAC_L2_BIT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("DAC R2 Power", RT5640_PWR_DIG1,
RT5640_PWR_DAC_R2_BIT, 0, NULL, 0),
SND_SOC_DAPM_OUTPUT("MONOP"), SND_SOC_DAPM_OUTPUT("MONOP"),
SND_SOC_DAPM_OUTPUT("MONON"), SND_SOC_DAPM_OUTPUT("MONON"),
...@@ -1328,11 +1335,6 @@ static const struct snd_soc_dapm_widget rt5639_specific_dapm_widgets[] = { ...@@ -1328,11 +1335,6 @@ static const struct snd_soc_dapm_widget rt5639_specific_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
rt5639_sto_dac_r_mix, ARRAY_SIZE(rt5639_sto_dac_r_mix)), rt5639_sto_dac_r_mix, ARRAY_SIZE(rt5639_sto_dac_r_mix)),
SND_SOC_DAPM_SUPPLY("DAC L2 Filter", RT5640_PWR_DIG1,
RT5640_PWR_DAC_L2_BIT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("DAC R2 Filter", RT5640_PWR_DIG1,
RT5640_PWR_DAC_R2_BIT, 0, NULL, 0),
SND_SOC_DAPM_MIXER("OUT MIXL", RT5640_PWR_MIXER, RT5640_PWR_OM_L_BIT, SND_SOC_DAPM_MIXER("OUT MIXL", RT5640_PWR_MIXER, RT5640_PWR_OM_L_BIT,
0, rt5639_out_l_mix, ARRAY_SIZE(rt5639_out_l_mix)), 0, rt5639_out_l_mix, ARRAY_SIZE(rt5639_out_l_mix)),
SND_SOC_DAPM_MIXER("OUT MIXR", RT5640_PWR_MIXER, RT5640_PWR_OM_R_BIT, SND_SOC_DAPM_MIXER("OUT MIXR", RT5640_PWR_MIXER, RT5640_PWR_OM_R_BIT,
...@@ -1493,8 +1495,10 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = { ...@@ -1493,8 +1495,10 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
{"DAC MIXL", "Stereo ADC Switch", "Stereo ADC MIXL"}, {"DAC MIXL", "Stereo ADC Switch", "Stereo ADC MIXL"},
{"DAC MIXL", "INF1 Switch", "IF1 DAC L"}, {"DAC MIXL", "INF1 Switch", "IF1 DAC L"},
{"DAC MIXL", NULL, "DAC L1 Power"},
{"DAC MIXR", "Stereo ADC Switch", "Stereo ADC MIXR"}, {"DAC MIXR", "Stereo ADC Switch", "Stereo ADC MIXR"},
{"DAC MIXR", "INF1 Switch", "IF1 DAC R"}, {"DAC MIXR", "INF1 Switch", "IF1 DAC R"},
{"DAC MIXR", NULL, "DAC R1 Power"},
{"Stereo DAC MIXL", "DAC L1 Switch", "DAC MIXL"}, {"Stereo DAC MIXL", "DAC L1 Switch", "DAC MIXL"},
{"Stereo DAC MIXR", "DAC R1 Switch", "DAC MIXR"}, {"Stereo DAC MIXR", "DAC R1 Switch", "DAC MIXR"},
...@@ -1507,8 +1511,10 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = { ...@@ -1507,8 +1511,10 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
{"DAC L1", NULL, "Stereo DAC MIXL"}, {"DAC L1", NULL, "Stereo DAC MIXL"},
{"DAC L1", NULL, "PLL1", is_sys_clk_from_pll}, {"DAC L1", NULL, "PLL1", is_sys_clk_from_pll},
{"DAC L1", NULL, "DAC L1 Power"},
{"DAC R1", NULL, "Stereo DAC MIXR"}, {"DAC R1", NULL, "Stereo DAC MIXR"},
{"DAC R1", NULL, "PLL1", is_sys_clk_from_pll}, {"DAC R1", NULL, "PLL1", is_sys_clk_from_pll},
{"DAC R1", NULL, "DAC R1 Power"},
{"SPK MIXL", "REC MIXL Switch", "RECMIXL"}, {"SPK MIXL", "REC MIXL Switch", "RECMIXL"},
{"SPK MIXL", "INL Switch", "INL VOL"}, {"SPK MIXL", "INL Switch", "INL VOL"},
...@@ -1595,8 +1601,9 @@ static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = { ...@@ -1595,8 +1601,9 @@ static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = {
{"DAC L2 Mux", "IF2", "IF2 DAC L"}, {"DAC L2 Mux", "IF2", "IF2 DAC L"},
{"DAC L2 Mux", "Base L/R", "Audio DSP"}, {"DAC L2 Mux", "Base L/R", "Audio DSP"},
{"DAC L2 Mux", NULL, "DAC L2 Power"},
{"DAC R2 Mux", "IF2", "IF2 DAC R"}, {"DAC R2 Mux", "IF2", "IF2 DAC R"},
{"DAC R2 Mux", NULL, "DAC R2 Power"},
{"Stereo DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"}, {"Stereo DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"},
{"Stereo DAC MIXL", "ANC Switch", "ANC"}, {"Stereo DAC MIXL", "ANC Switch", "ANC"},
...@@ -1614,8 +1621,10 @@ static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = { ...@@ -1614,8 +1621,10 @@ static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = {
{"DAC L2", NULL, "Mono DAC MIXL"}, {"DAC L2", NULL, "Mono DAC MIXL"},
{"DAC L2", NULL, "PLL1", is_sys_clk_from_pll}, {"DAC L2", NULL, "PLL1", is_sys_clk_from_pll},
{"DAC L2", NULL, "DAC L2 Power"},
{"DAC R2", NULL, "Mono DAC MIXR"}, {"DAC R2", NULL, "Mono DAC MIXR"},
{"DAC R2", NULL, "PLL1", is_sys_clk_from_pll}, {"DAC R2", NULL, "PLL1", is_sys_clk_from_pll},
{"DAC R2", NULL, "DAC R2 Power"},
{"SPK MIXL", "DAC L2 Switch", "DAC L2"}, {"SPK MIXL", "DAC L2 Switch", "DAC L2"},
{"SPK MIXR", "DAC R2 Switch", "DAC R2"}, {"SPK MIXR", "DAC R2 Switch", "DAC R2"},
...@@ -1656,8 +1665,8 @@ static const struct snd_soc_dapm_route rt5639_specific_dapm_routes[] = { ...@@ -1656,8 +1665,8 @@ static const struct snd_soc_dapm_route rt5639_specific_dapm_routes[] = {
{"DIG MIXL", "DAC L2 Switch", "IF2 DAC L"}, {"DIG MIXL", "DAC L2 Switch", "IF2 DAC L"},
{"DIG MIXR", "DAC R2 Switch", "IF2 DAC R"}, {"DIG MIXR", "DAC R2 Switch", "IF2 DAC R"},
{"IF2 DAC L", NULL, "DAC L2 Filter"}, {"IF2 DAC L", NULL, "DAC L2 Power"},
{"IF2 DAC R", NULL, "DAC R2 Filter"}, {"IF2 DAC R", NULL, "DAC R2 Power"},
}; };
static int get_sdp_info(struct snd_soc_codec *codec, int dai_id) static int get_sdp_info(struct snd_soc_codec *codec, int dai_id)
...@@ -1880,7 +1889,7 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, ...@@ -1880,7 +1889,7 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
struct rl6231_pll_code pll_code; struct rl6231_pll_code pll_code;
int ret, dai_sel; int ret;
if (source == rt5640->pll_src && freq_in == rt5640->pll_in && if (source == rt5640->pll_src && freq_in == rt5640->pll_in &&
freq_out == rt5640->pll_out) freq_out == rt5640->pll_out)
...@@ -1902,21 +1911,12 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, ...@@ -1902,21 +1911,12 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_MCLK); RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_MCLK);
break; break;
case RT5640_PLL1_S_BCLK1: case RT5640_PLL1_S_BCLK1:
case RT5640_PLL1_S_BCLK2:
dai_sel = get_sdp_info(codec, dai->id);
if (dai_sel < 0) {
dev_err(codec->dev,
"Failed to get sdp info: %d\n", dai_sel);
return -EINVAL;
}
if (dai_sel & RT5640_U_IF1) {
snd_soc_update_bits(codec, RT5640_GLB_CLK, snd_soc_update_bits(codec, RT5640_GLB_CLK,
RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK1); RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK1);
} break;
if (dai_sel & RT5640_U_IF2) { case RT5640_PLL1_S_BCLK2:
snd_soc_update_bits(codec, RT5640_GLB_CLK, snd_soc_update_bits(codec, RT5640_GLB_CLK,
RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK2); RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK2);
}
break; break;
default: default:
dev_err(codec->dev, "Unknown PLL source %d\n", source); dev_err(codec->dev, "Unknown PLL source %d\n", source);
...@@ -1949,7 +1949,33 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, ...@@ -1949,7 +1949,33 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
static int rt5640_set_bias_level(struct snd_soc_codec *codec, static int rt5640_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
int ret;
switch (level) { switch (level) {
case SND_SOC_BIAS_ON:
break;
case SND_SOC_BIAS_PREPARE:
/*
* SND_SOC_BIAS_PREPARE is called while preparing for a
* transition to ON or away from ON. If current bias_level
* is SND_SOC_BIAS_ON, then it is preparing for a transition
* away from ON. Disable the clock in that case, otherwise
* enable it.
*/
if (IS_ERR(rt5640->mclk))
break;
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) {
clk_disable_unprepare(rt5640->mclk);
} else {
ret = clk_prepare_enable(rt5640->mclk);
if (ret)
return ret;
}
break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (SND_SOC_BIAS_OFF == snd_soc_codec_get_bias_level(codec)) { if (SND_SOC_BIAS_OFF == snd_soc_codec_get_bias_level(codec)) {
snd_soc_update_bits(codec, RT5640_PWR_ANLG1, snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
...@@ -2088,6 +2114,11 @@ static int rt5640_probe(struct snd_soc_codec *codec) ...@@ -2088,6 +2114,11 @@ static int rt5640_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
/* Check if MCLK provided */
rt5640->mclk = devm_clk_get(codec->dev, "mclk");
if (PTR_ERR(rt5640->mclk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
rt5640->codec = codec; rt5640->codec = codec;
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef _RT5640_H #ifndef _RT5640_H
#define _RT5640_H #define _RT5640_H
#include <linux/clk.h>
#include <sound/rt5640.h> #include <sound/rt5640.h>
/* Info */ /* Info */
...@@ -2097,6 +2098,7 @@ struct rt5640_priv { ...@@ -2097,6 +2098,7 @@ struct rt5640_priv {
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct rt5640_platform_data pdata; struct rt5640_platform_data pdata;
struct regmap *regmap; struct regmap *regmap;
struct clk *mclk;
int sysclk; int sysclk;
int sysclk_src; int sysclk_src;
......
...@@ -4176,7 +4176,7 @@ static int rt5659_i2c_remove(struct i2c_client *i2c) ...@@ -4176,7 +4176,7 @@ static int rt5659_i2c_remove(struct i2c_client *i2c)
return 0; return 0;
} }
void rt5659_i2c_shutdown(struct i2c_client *client) static void rt5659_i2c_shutdown(struct i2c_client *client)
{ {
struct rt5659_priv *rt5659 = i2c_get_clientdata(client); struct rt5659_priv *rt5659 = i2c_get_clientdata(client);
......
...@@ -352,6 +352,11 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable) ...@@ -352,6 +352,11 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
regcache_cache_only(ssm4567->regmap, !enable); regcache_cache_only(ssm4567->regmap, !enable);
if (enable) { if (enable) {
ret = regmap_write(ssm4567->regmap, SSM4567_REG_SOFT_RESET,
0x00);
if (ret)
return ret;
ret = regmap_update_bits(ssm4567->regmap, ret = regmap_update_bits(ssm4567->regmap,
SSM4567_REG_POWER_CTRL, SSM4567_REG_POWER_CTRL,
SSM4567_POWER_SPWDN, 0x00); SSM4567_POWER_SPWDN, 0x00);
......
...@@ -709,7 +709,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai) ...@@ -709,7 +709,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
#endif #endif
int s3c_i2sv2_register_component(struct device *dev, int id, int s3c_i2sv2_register_component(struct device *dev, int id,
struct snd_soc_component_driver *cmp_drv, const struct snd_soc_component_driver *cmp_drv,
struct snd_soc_dai_driver *dai_drv) struct snd_soc_dai_driver *dai_drv)
{ {
struct snd_soc_dai_ops *ops = (struct snd_soc_dai_ops *)dai_drv->ops; struct snd_soc_dai_ops *ops = (struct snd_soc_dai_ops *)dai_drv->ops;
......
...@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai, ...@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,
* soc core. * soc core.
*/ */
extern int s3c_i2sv2_register_component(struct device *dev, int id, extern int s3c_i2sv2_register_component(struct device *dev, int id,
struct snd_soc_component_driver *cmp_drv, const struct snd_soc_component_driver *cmp_drv,
struct snd_soc_dai_driver *dai_drv); struct snd_soc_dai_driver *dai_drv);
#endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */ #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */
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