Commit 2aa5cad2 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/rt5645',...

Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/sam9g20_wm8731', 'asoc/topic/sam9x5_wm8731', 'asoc/topic/samsung' and 'asoc/topic/sgtl5000' into asoc-next
...@@ -25,6 +25,9 @@ struct rt5645_platform_data { ...@@ -25,6 +25,9 @@ struct rt5645_platform_data {
bool level_trigger_irq; bool level_trigger_irq;
/* Invert JD1_1 status polarity */ /* Invert JD1_1 status polarity */
bool inv_jd1_1; bool inv_jd1_1;
/* Value to asign to snd_soc_card.long_name */
const char *long_name;
}; };
#endif #endif
...@@ -110,16 +110,15 @@ static const struct snd_soc_dapm_route intercon[] = { ...@@ -110,16 +110,15 @@ static const struct snd_soc_dapm_route intercon[] = {
static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct device *dev = rtd->dev;
int ret; int ret;
printk(KERN_DEBUG dev_dbg(dev, "%s called\n", __func__);
"at91sam9g20ek_wm8731 "
": at91sam9g20ek_wm8731_init() called\n");
ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_MCLK, ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_MCLK,
MCLK_RATE, SND_SOC_CLOCK_IN); MCLK_RATE, SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); dev_err(dev, "Failed to set WM8731 SYSCLK: %d\n", ret);
return ret; return ret;
} }
...@@ -179,21 +178,21 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) ...@@ -179,21 +178,21 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
*/ */
mclk = clk_get(NULL, "pck0"); mclk = clk_get(NULL, "pck0");
if (IS_ERR(mclk)) { if (IS_ERR(mclk)) {
printk(KERN_ERR "ASoC: Failed to get MCLK\n"); dev_err(&pdev->dev, "Failed to get MCLK\n");
ret = PTR_ERR(mclk); ret = PTR_ERR(mclk);
goto err; goto err;
} }
pllb = clk_get(NULL, "pllb"); pllb = clk_get(NULL, "pllb");
if (IS_ERR(pllb)) { if (IS_ERR(pllb)) {
printk(KERN_ERR "ASoC: Failed to get PLLB\n"); dev_err(&pdev->dev, "Failed to get PLLB\n");
ret = PTR_ERR(pllb); ret = PTR_ERR(pllb);
goto err_mclk; goto err_mclk;
} }
ret = clk_set_parent(mclk, pllb); ret = clk_set_parent(mclk, pllb);
clk_put(pllb); clk_put(pllb);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR "ASoC: Failed to set MCLK parent\n"); dev_err(&pdev->dev, "Failed to set MCLK parent\n");
goto err_mclk; goto err_mclk;
} }
...@@ -236,7 +235,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) ...@@ -236,7 +235,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n"); dev_err(&pdev->dev, "snd_soc_register_card() failed\n");
} }
return ret; return ret;
......
...@@ -49,13 +49,13 @@ static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd) ...@@ -49,13 +49,13 @@ static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd)
struct device *dev = rtd->dev; struct device *dev = rtd->dev;
int ret; int ret;
dev_dbg(dev, "ASoC: %s called\n", __func__); dev_dbg(dev, "%s called\n", __func__);
/* set the codec system clock for DAC and ADC */ /* set the codec system clock for DAC and ADC */
ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL,
MCLK_RATE, SND_SOC_CLOCK_IN); MCLK_RATE, SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "ASoC: Failed to set WM8731 SYSCLK: %d\n", ret); dev_err(dev, "Failed to set WM8731 SYSCLK: %d\n", ret);
return ret; return ret;
} }
...@@ -146,8 +146,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) ...@@ -146,8 +146,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
ret = atmel_ssc_set_audio(priv->ssc_id); ret = atmel_ssc_set_audio(priv->ssc_id);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev, "Failed to set SSC %d for audio: %d\n",
"ASoC: Failed to set SSC %d for audio: %d\n",
ret, priv->ssc_id); ret, priv->ssc_id);
goto out; goto out;
} }
...@@ -157,12 +156,11 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) ...@@ -157,12 +156,11 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev, "Platform device allocation failed\n");
"ASoC: Platform device allocation failed\n");
goto out_put_audio; goto out_put_audio;
} }
dev_dbg(&pdev->dev, "ASoC: %s ok\n", __func__); dev_dbg(&pdev->dev, "%s ok\n", __func__);
return ret; return ret;
......
...@@ -1943,6 +1943,56 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w, ...@@ -1943,6 +1943,56 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w,
return 0; return 0;
} }
static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
RT5645_MICBIAS1_POW_CTRL_SEL_M);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
RT5645_MICBIAS1_POW_CTRL_SEL_A);
break;
default:
return 0;
}
return 0;
}
static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
RT5645_MICBIAS2_POW_CTRL_SEL_M);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
RT5645_MICBIAS2_POW_CTRL_SEL_A);
break;
default:
return 0;
}
return 0;
}
static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER,
RT5645_PWR_LDO2_BIT, 0, NULL, 0), RT5645_PWR_LDO2_BIT, 0, NULL, 0),
...@@ -1980,10 +2030,12 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { ...@@ -1980,10 +2030,12 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
/* Input Side */ /* Input Side */
/* micbias */ /* micbias */
SND_SOC_DAPM_MICBIAS("micbias1", RT5645_PWR_ANLG2, SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2,
RT5645_PWR_MB1_BIT, 0), RT5645_PWR_MB1_BIT, 0, rt5645_set_micbias1_event,
SND_SOC_DAPM_MICBIAS("micbias2", RT5645_PWR_ANLG2, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
RT5645_PWR_MB2_BIT, 0), SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2,
RT5645_PWR_MB2_BIT, 0, rt5645_set_micbias2_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
/* Input Lines */ /* Input Lines */
SND_SOC_DAPM_INPUT("DMIC L1"), SND_SOC_DAPM_INPUT("DMIC L1"),
SND_SOC_DAPM_INPUT("DMIC R1"), SND_SOC_DAPM_INPUT("DMIC R1"),
...@@ -3394,6 +3446,9 @@ static int rt5645_probe(struct snd_soc_codec *codec) ...@@ -3394,6 +3446,9 @@ static int rt5645_probe(struct snd_soc_codec *codec)
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
} }
if (rt5645->pdata.long_name)
codec->component.card->long_name = rt5645->pdata.long_name;
rt5645->eq_param = devm_kzalloc(codec->dev, rt5645->eq_param = devm_kzalloc(codec->dev,
RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL); RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL);
...@@ -3570,63 +3625,74 @@ static const struct acpi_device_id rt5645_acpi_match[] = { ...@@ -3570,63 +3625,74 @@ static const struct acpi_device_id rt5645_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
#endif #endif
static const struct rt5645_platform_data general_platform_data = { static const struct rt5645_platform_data intel_braswell_platform_data = {
.dmic1_data_pin = RT5645_DMIC1_DISABLE, .dmic1_data_pin = RT5645_DMIC1_DISABLE,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P, .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
.jd_mode = 3, .jd_mode = 3,
}; };
static const struct dmi_system_id dmi_platform_intel_braswell[] = { static const struct rt5645_platform_data buddy_platform_data = {
.dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
.jd_mode = 3,
.level_trigger_irq = true,
};
static const struct rt5645_platform_data gpd_win_platform_data = {
.jd_mode = 3,
.inv_jd1_1 = true,
.long_name = "gpd-win-pocket-rt5645",
/* The GPD pocket has a diff. mic, for the win this does not matter. */
.in2_diff = true,
};
static const struct rt5645_platform_data asus_t100ha_platform_data = {
.dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
.dmic2_data_pin = RT5645_DMIC2_DISABLE,
.jd_mode = 3,
.inv_jd1_1 = true,
};
static const struct rt5645_platform_data jd_mode3_platform_data = {
.jd_mode = 3,
};
static const struct dmi_system_id dmi_platform_data[] = {
{
.ident = "Chrome Buddy",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
},
.driver_data = (void *)&buddy_platform_data,
},
{ {
.ident = "Intel Strago", .ident = "Intel Strago",
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Strago"), DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
}, },
.driver_data = (void *)&intel_braswell_platform_data,
}, },
{ {
.ident = "Google Chrome", .ident = "Google Chrome",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
}, },
.driver_data = (void *)&intel_braswell_platform_data,
}, },
{ {
.ident = "Google Setzer", .ident = "Google Setzer",
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
}, },
.driver_data = (void *)&intel_braswell_platform_data,
}, },
{ {
.ident = "Microsoft Surface 3", .ident = "Microsoft Surface 3",
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
}, },
.driver_data = (void *)&intel_braswell_platform_data,
}, },
{ }
};
static const struct rt5645_platform_data buddy_platform_data = {
.dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
.jd_mode = 3,
.level_trigger_irq = true,
};
static const struct dmi_system_id dmi_platform_intel_broadwell[] = {
{
.ident = "Chrome Buddy",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
},
},
{ }
};
static const struct rt5645_platform_data gpd_win_platform_data = {
.jd_mode = 3,
.inv_jd1_1 = true,
};
static const struct dmi_system_id dmi_platform_gpd_win[] = {
{ {
/* /*
* Match for the GPDwin which unfortunately uses somewhat * Match for the GPDwin which unfortunately uses somewhat
...@@ -3637,46 +3703,38 @@ static const struct dmi_system_id dmi_platform_gpd_win[] = { ...@@ -3637,46 +3703,38 @@ static const struct dmi_system_id dmi_platform_gpd_win[] = {
* the same default product_name. Also the GPDwin is the * the same default product_name. Also the GPDwin is the
* only device to have both board_ and product_name not set. * only device to have both board_ and product_name not set.
*/ */
.ident = "GPD Win", .ident = "GPD Win / Pocket",
.matches = { .matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_BOARD_NAME, "Default string"),
DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
}, },
.driver_data = (void *)&gpd_win_platform_data,
}, },
{}
};
static const struct rt5645_platform_data general_platform_data2 = {
.dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
.dmic2_data_pin = RT5645_DMIC2_DISABLE,
.jd_mode = 3,
.inv_jd1_1 = true,
};
static const struct dmi_system_id dmi_platform_asus_t100ha[] = {
{ {
.ident = "ASUS T100HAN", .ident = "ASUS T100HAN",
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"), DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
}, },
.driver_data = (void *)&asus_t100ha_platform_data,
}, },
{ }
};
static const struct rt5645_platform_data minix_z83_4_platform_data = {
.jd_mode = 3,
};
static const struct dmi_system_id dmi_platform_minix_z83_4[] = {
{ {
.ident = "MINIX Z83-4", .ident = "MINIX Z83-4",
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"),
DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
}, },
.driver_data = (void *)&jd_mode3_platform_data,
},
{
.ident = "Teclast X80 Pro",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
DMI_MATCH(DMI_PRODUCT_NAME, "X80 Pro"),
},
.driver_data = (void *)&jd_mode3_platform_data,
}, },
{ } { }
}; };
...@@ -3710,6 +3768,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3710,6 +3768,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev); struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev);
const struct dmi_system_id *dmi_data;
struct rt5645_priv *rt5645; struct rt5645_priv *rt5645;
int ret, i; int ret, i;
unsigned int val; unsigned int val;
...@@ -3723,20 +3782,18 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3723,20 +3782,18 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
rt5645->i2c = i2c; rt5645->i2c = i2c;
i2c_set_clientdata(i2c, rt5645); i2c_set_clientdata(i2c, rt5645);
dmi_data = dmi_first_match(dmi_platform_data);
if (dmi_data) {
dev_info(&i2c->dev, "Detected %s platform\n", dmi_data->ident);
pdata = dmi_data->driver_data;
}
if (pdata) if (pdata)
rt5645->pdata = *pdata; rt5645->pdata = *pdata;
else if (dmi_check_system(dmi_platform_intel_broadwell))
rt5645->pdata = buddy_platform_data;
else if (rt5645_check_dp(&i2c->dev)) else if (rt5645_check_dp(&i2c->dev))
rt5645_parse_dt(rt5645, &i2c->dev); rt5645_parse_dt(rt5645, &i2c->dev);
else if (dmi_check_system(dmi_platform_intel_braswell)) else
rt5645->pdata = general_platform_data; rt5645->pdata = jd_mode3_platform_data;
else if (dmi_check_system(dmi_platform_gpd_win))
rt5645->pdata = gpd_win_platform_data;
else if (dmi_check_system(dmi_platform_asus_t100ha))
rt5645->pdata = general_platform_data2;
else if (dmi_check_system(dmi_platform_minix_z83_4))
rt5645->pdata = minix_z83_4_platform_data;
if (quirk != -1) { if (quirk != -1) {
rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk); rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
......
...@@ -2117,6 +2117,12 @@ enum { ...@@ -2117,6 +2117,12 @@ enum {
#define RT5645_RXDC_SRC_STO (0x0 << 7) #define RT5645_RXDC_SRC_STO (0x0 << 7)
#define RT5645_RXDC_SRC_MONO (0x1 << 7) #define RT5645_RXDC_SRC_MONO (0x1 << 7)
#define RT5645_RXDC_SRC_SFT (7) #define RT5645_RXDC_SRC_SFT (7)
#define RT5645_MICBIAS1_POW_CTRL_SEL_MASK (0x1 << 5)
#define RT5645_MICBIAS1_POW_CTRL_SEL_A (0x0 << 5)
#define RT5645_MICBIAS1_POW_CTRL_SEL_M (0x1 << 5)
#define RT5645_MICBIAS2_POW_CTRL_SEL_MASK (0x1 << 4)
#define RT5645_MICBIAS2_POW_CTRL_SEL_A (0x0 << 4)
#define RT5645_MICBIAS2_POW_CTRL_SEL_M (0x1 << 4)
#define RT5645_RXDP2_SEL_MASK (0x1 << 3) #define RT5645_RXDP2_SEL_MASK (0x1 << 3)
#define RT5645_RXDP2_SEL_IF2 (0x0 << 3) #define RT5645_RXDP2_SEL_IF2 (0x0 << 3)
#define RT5645_RXDP2_SEL_ADC (0x1 << 3) #define RT5645_RXDP2_SEL_ADC (0x1 << 3)
......
...@@ -1332,10 +1332,13 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, ...@@ -1332,10 +1332,13 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
sgtl5000->mclk = devm_clk_get(&client->dev, NULL); sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
if (IS_ERR(sgtl5000->mclk)) { if (IS_ERR(sgtl5000->mclk)) {
ret = PTR_ERR(sgtl5000->mclk); ret = PTR_ERR(sgtl5000->mclk);
dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
/* Defer the probe to see if the clk will be provided later */ /* Defer the probe to see if the clk will be provided later */
if (ret == -ENOENT) if (ret == -ENOENT)
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
if (ret != -EPROBE_DEFER)
dev_err(&client->dev, "Failed to get mclock: %d\n",
ret);
goto disable_regs; goto disable_regs;
} }
...@@ -1389,7 +1392,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, ...@@ -1389,7 +1392,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
ana_pwr |= SGTL5000_LINEREG_D_POWERUP; ana_pwr |= SGTL5000_LINEREG_D_POWERUP;
dev_info(&client->dev, dev_info(&client->dev,
"Using internal LDO instead of VDDD: check ER1\n"); "Using internal LDO instead of VDDD: check ER1 erratum\n");
} else { } else {
/* using external LDO for VDDD /* using external LDO for VDDD
* Clear startup powerup and simple powerup * Clear startup powerup and simple powerup
......
...@@ -118,6 +118,7 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] = { ...@@ -118,6 +118,7 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL),
SND_SOC_DAPM_MIC("Int Analog Mic", NULL),
SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL),
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
...@@ -128,6 +129,8 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = { ...@@ -128,6 +129,8 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
{"IN1N", NULL, "Headset Mic"}, {"IN1N", NULL, "Headset Mic"},
{"DMIC L1", NULL, "Int Mic"}, {"DMIC L1", NULL, "Int Mic"},
{"DMIC R1", NULL, "Int Mic"}, {"DMIC R1", NULL, "Int Mic"},
{"IN2P", NULL, "Int Analog Mic"},
{"IN2N", NULL, "Int Analog Mic"},
{"Headphone", NULL, "HPOL"}, {"Headphone", NULL, "HPOL"},
{"Headphone", NULL, "HPOR"}, {"Headphone", NULL, "HPOR"},
{"Ext Spk", NULL, "SPOL"}, {"Ext Spk", NULL, "SPOL"},
...@@ -135,6 +138,9 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = { ...@@ -135,6 +138,9 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
{"Headphone", NULL, "Platform Clock"}, {"Headphone", NULL, "Platform Clock"},
{"Headset Mic", NULL, "Platform Clock"}, {"Headset Mic", NULL, "Platform Clock"},
{"Int Mic", NULL, "Platform Clock"}, {"Int Mic", NULL, "Platform Clock"},
{"Int Analog Mic", NULL, "Platform Clock"},
{"Int Analog Mic", NULL, "micbias1"},
{"Int Analog Mic", NULL, "micbias2"},
{"Ext Spk", NULL, "Platform Clock"}, {"Ext Spk", NULL, "Platform Clock"},
}; };
...@@ -189,6 +195,7 @@ static const struct snd_kcontrol_new cht_mc_controls[] = { ...@@ -189,6 +195,7 @@ static const struct snd_kcontrol_new cht_mc_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
SOC_DAPM_PIN_SWITCH("Int Mic"), SOC_DAPM_PIN_SWITCH("Int Mic"),
SOC_DAPM_PIN_SWITCH("Int Analog Mic"),
SOC_DAPM_PIN_SWITCH("Ext Spk"), SOC_DAPM_PIN_SWITCH("Ext Spk"),
}; };
......
...@@ -60,13 +60,13 @@ static int bells_set_bias_level(struct snd_soc_card *card, ...@@ -60,13 +60,13 @@ static int bells_set_bias_level(struct snd_soc_card *card,
{ {
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct bells_drvdata *bells = card->drvdata; struct bells_drvdata *bells = card->drvdata;
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec_dai = rtd->codec_dai; codec_dai = rtd->codec_dai;
codec = codec_dai->codec; component = codec_dai->component;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -76,7 +76,7 @@ static int bells_set_bias_level(struct snd_soc_card *card, ...@@ -76,7 +76,7 @@ static int bells_set_bias_level(struct snd_soc_card *card,
if (dapm->bias_level != SND_SOC_BIAS_STANDBY) if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
break; break;
ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, ret = snd_soc_component_set_pll(component, WM5102_FLL1,
ARIZONA_FLL_SRC_MCLK1, ARIZONA_FLL_SRC_MCLK1,
MCLK_RATE, MCLK_RATE,
bells->sysclk_rate); bells->sysclk_rate);
...@@ -84,7 +84,7 @@ static int bells_set_bias_level(struct snd_soc_card *card, ...@@ -84,7 +84,7 @@ static int bells_set_bias_level(struct snd_soc_card *card,
pr_err("Failed to start FLL: %d\n", ret); pr_err("Failed to start FLL: %d\n", ret);
if (bells->asyncclk_rate) { if (bells->asyncclk_rate) {
ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, ret = snd_soc_component_set_pll(component, WM5102_FLL2,
ARIZONA_FLL_SRC_AIF2BCLK, ARIZONA_FLL_SRC_AIF2BCLK,
BCLK2_RATE, BCLK2_RATE,
bells->asyncclk_rate); bells->asyncclk_rate);
...@@ -106,27 +106,27 @@ static int bells_set_bias_level_post(struct snd_soc_card *card, ...@@ -106,27 +106,27 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
{ {
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct bells_drvdata *bells = card->drvdata; struct bells_drvdata *bells = card->drvdata;
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec_dai = rtd->codec_dai; codec_dai = rtd->codec_dai;
codec = codec_dai->codec; component = codec_dai->component;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
switch (level) { switch (level) {
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 0, 0, 0); ret = snd_soc_component_set_pll(component, WM5102_FLL1, 0, 0, 0);
if (ret < 0) { if (ret < 0) {
pr_err("Failed to stop FLL: %d\n", ret); pr_err("Failed to stop FLL: %d\n", ret);
return ret; return ret;
} }
if (bells->asyncclk_rate) { if (bells->asyncclk_rate) {
ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, ret = snd_soc_component_set_pll(component, WM5102_FLL2,
0, 0, 0); 0, 0, 0);
if (ret < 0) { if (ret < 0) {
pr_err("Failed to stop FLL: %d\n", ret); pr_err("Failed to stop FLL: %d\n", ret);
...@@ -148,8 +148,8 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -148,8 +148,8 @@ static int bells_late_probe(struct snd_soc_card *card)
{ {
struct bells_drvdata *bells = card->drvdata; struct bells_drvdata *bells = card->drvdata;
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *wm0010; struct snd_soc_component *wm0010;
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct snd_soc_dai *aif1_dai; struct snd_soc_dai *aif1_dai;
struct snd_soc_dai *aif2_dai; struct snd_soc_dai *aif2_dai;
struct snd_soc_dai *aif3_dai; struct snd_soc_dai *aif3_dai;
...@@ -157,22 +157,22 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -157,22 +157,22 @@ static int bells_late_probe(struct snd_soc_card *card)
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_AP_DSP].name); rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_AP_DSP].name);
wm0010 = rtd->codec; wm0010 = rtd->codec_dai->component;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec = rtd->codec; component = rtd->codec_dai->component;
aif1_dai = rtd->codec_dai; aif1_dai = rtd->codec_dai;
ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
ARIZONA_CLK_SRC_FLL1, ARIZONA_CLK_SRC_FLL1,
bells->sysclk_rate, bells->sysclk_rate,
SND_SOC_CLOCK_IN); SND_SOC_CLOCK_IN);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret); dev_err(component->dev, "Failed to set SYSCLK: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_codec_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0); ret = snd_soc_component_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0);
if (ret != 0) { if (ret != 0) {
dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret); dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret);
return ret; return ret;
...@@ -182,20 +182,20 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -182,20 +182,20 @@ static int bells_late_probe(struct snd_soc_card *card)
if (ret != 0) if (ret != 0)
dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret); dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret);
ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_OPCLK, 0, ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_OPCLK, 0,
SYS_MCLK_RATE, SND_SOC_CLOCK_OUT); SYS_MCLK_RATE, SND_SOC_CLOCK_OUT);
if (ret != 0) if (ret != 0)
dev_err(codec->dev, "Failed to set OPCLK: %d\n", ret); dev_err(component->dev, "Failed to set OPCLK: %d\n", ret);
if (card->num_rtd == DAI_CODEC_CP) if (card->num_rtd == DAI_CODEC_CP)
return 0; return 0;
ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK, ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_ASYNCCLK,
ARIZONA_CLK_SRC_FLL2, ARIZONA_CLK_SRC_FLL2,
bells->asyncclk_rate, bells->asyncclk_rate,
SND_SOC_CLOCK_IN); SND_SOC_CLOCK_IN);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to set ASYNCCLK: %d\n", ret); dev_err(component->dev, "Failed to set ASYNCCLK: %d\n", ret);
return ret; return ret;
} }
...@@ -221,7 +221,7 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -221,7 +221,7 @@ static int bells_late_probe(struct snd_soc_card *card)
return ret; return ret;
} }
ret = snd_soc_codec_set_sysclk(wm9081_dai->codec, WM9081_SYSCLK_MCLK, ret = snd_soc_component_set_sysclk(wm9081_dai->component, WM9081_SYSCLK_MCLK,
0, SYS_MCLK_RATE, 0); 0, SYS_MCLK_RATE, 0);
if (ret != 0) { if (ret != 0) {
dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret); dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret);
......
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