Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5645', 'asoc/topic/samsung' and 'asoc/topic/si476x' into asoc-next

This commit is contained in:
Mark Brown 2018-01-12 12:29:23 +00:00
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
10 changed files with 267 additions and 100 deletions

View File

@ -14,6 +14,8 @@
struct rt5514_platform_data { struct rt5514_platform_data {
unsigned int dmic_init_delay; unsigned int dmic_init_delay;
const char *dsp_calib_clk_name;
unsigned int dsp_calib_clk_rate;
}; };
#endif #endif

View File

@ -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

View File

@ -381,6 +381,7 @@ int rt5514_spi_burst_read(unsigned int addr, u8 *rxbuf, size_t len)
return true; return true;
} }
EXPORT_SYMBOL_GPL(rt5514_spi_burst_read);
/** /**
* rt5514_spi_burst_write - Write data to SPI by rt5514 address. * rt5514_spi_burst_write - Write data to SPI by rt5514 address.

View File

@ -295,6 +295,33 @@ static int rt5514_dsp_voice_wake_up_get(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static int rt5514_calibration(struct rt5514_priv *rt5514, bool on)
{
if (on) {
regmap_write(rt5514->regmap, RT5514_ANA_CTRL_PLL3, 0x0000000a);
regmap_update_bits(rt5514->regmap, RT5514_PLL_SOURCE_CTRL, 0xf,
0xa);
regmap_update_bits(rt5514->regmap, RT5514_PWR_ANA1, 0x301,
0x301);
regmap_write(rt5514->regmap, RT5514_PLL3_CALIB_CTRL4,
0x80000000 | rt5514->pll3_cal_value);
regmap_write(rt5514->regmap, RT5514_PLL3_CALIB_CTRL1,
0x8bb80800);
regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
0xc0000000, 0x80000000);
regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
0xc0000000, 0xc0000000);
} else {
regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
0xc0000000, 0x40000000);
regmap_update_bits(rt5514->regmap, RT5514_PWR_ANA1, 0x301, 0);
regmap_update_bits(rt5514->regmap, RT5514_PLL_SOURCE_CTRL, 0xf,
0x4);
}
return 0;
}
static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
@ -302,6 +329,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
struct snd_soc_codec *codec = rt5514->codec; struct snd_soc_codec *codec = rt5514->codec;
const struct firmware *fw = NULL; const struct firmware *fw = NULL;
u8 buf[8];
if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled)
return 0; return 0;
@ -310,6 +338,35 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
rt5514->dsp_enabled = ucontrol->value.integer.value[0]; rt5514->dsp_enabled = ucontrol->value.integer.value[0];
if (rt5514->dsp_enabled) { if (rt5514->dsp_enabled) {
if (rt5514->pdata.dsp_calib_clk_name &&
!IS_ERR(rt5514->dsp_calib_clk)) {
if (clk_set_rate(rt5514->dsp_calib_clk,
rt5514->pdata.dsp_calib_clk_rate))
dev_err(codec->dev,
"Can't set rate for mclk");
if (clk_prepare_enable(rt5514->dsp_calib_clk))
dev_err(codec->dev,
"Can't enable dsp_calib_clk");
rt5514_calibration(rt5514, true);
msleep(20);
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
rt5514_spi_burst_read(RT5514_PLL3_CALIB_CTRL6 |
RT5514_DSP_MAPPING,
(u8 *)&buf, sizeof(buf));
#else
dev_err(codec->dev, "There is no SPI driver for"
" loading the firmware\n");
#endif
rt5514->pll3_cal_value = buf[0] | buf[1] << 8 |
buf[2] << 16 | buf[3] << 24;
rt5514_calibration(rt5514, false);
clk_disable_unprepare(rt5514->dsp_calib_clk);
}
rt5514_enable_dsp_prepare(rt5514); rt5514_enable_dsp_prepare(rt5514);
request_firmware(&fw, RT5514_FIRMWARE1, codec->dev); request_firmware(&fw, RT5514_FIRMWARE1, codec->dev);
@ -341,6 +398,20 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
/* DSP run */ /* DSP run */
regmap_write(rt5514->i2c_regmap, 0x18002f00, regmap_write(rt5514->i2c_regmap, 0x18002f00,
0x00055148); 0x00055148);
if (rt5514->pdata.dsp_calib_clk_name &&
!IS_ERR(rt5514->dsp_calib_clk)) {
msleep(20);
regmap_write(rt5514->i2c_regmap, 0x1800211c,
rt5514->pll3_cal_value);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0x00220012);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0x80220042);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0xe0220042);
}
} else { } else {
regmap_multi_reg_write(rt5514->i2c_regmap, regmap_multi_reg_write(rt5514->i2c_regmap,
rt5514_i2c_patch, ARRAY_SIZE(rt5514_i2c_patch)); rt5514_i2c_patch, ARRAY_SIZE(rt5514_i2c_patch));
@ -1024,12 +1095,22 @@ static int rt5514_set_bias_level(struct snd_soc_codec *codec,
static int rt5514_probe(struct snd_soc_codec *codec) static int rt5514_probe(struct snd_soc_codec *codec)
{ {
struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec);
struct platform_device *pdev = container_of(codec->dev,
struct platform_device, dev);
rt5514->mclk = devm_clk_get(codec->dev, "mclk"); rt5514->mclk = devm_clk_get(codec->dev, "mclk");
if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER) if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER)
return -EPROBE_DEFER; return -EPROBE_DEFER;
if (rt5514->pdata.dsp_calib_clk_name) {
rt5514->dsp_calib_clk = devm_clk_get(&pdev->dev,
rt5514->pdata.dsp_calib_clk_name);
if (PTR_ERR(rt5514->dsp_calib_clk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
}
rt5514->codec = codec; rt5514->codec = codec;
rt5514->pll3_cal_value = 0x0078b000;
return 0; return 0;
} }
@ -1147,6 +1228,10 @@ static int rt5514_parse_dp(struct rt5514_priv *rt5514, struct device *dev)
{ {
device_property_read_u32(dev, "realtek,dmic-init-delay-ms", device_property_read_u32(dev, "realtek,dmic-init-delay-ms",
&rt5514->pdata.dmic_init_delay); &rt5514->pdata.dmic_init_delay);
device_property_read_string(dev, "realtek,dsp-calib-clk-name",
&rt5514->pdata.dsp_calib_clk_name);
device_property_read_u32(dev, "realtek,dsp-calib-clk-rate",
&rt5514->pdata.dsp_calib_clk_rate);
return 0; return 0;
} }

View File

@ -34,7 +34,9 @@
#define RT5514_CLK_CTRL1 0x2104 #define RT5514_CLK_CTRL1 0x2104
#define RT5514_CLK_CTRL2 0x2108 #define RT5514_CLK_CTRL2 0x2108
#define RT5514_PLL3_CALIB_CTRL1 0x2110 #define RT5514_PLL3_CALIB_CTRL1 0x2110
#define RT5514_PLL3_CALIB_CTRL4 0x2120
#define RT5514_PLL3_CALIB_CTRL5 0x2124 #define RT5514_PLL3_CALIB_CTRL5 0x2124
#define RT5514_PLL3_CALIB_CTRL6 0x2128
#define RT5514_DELAY_BUF_CTRL1 0x2140 #define RT5514_DELAY_BUF_CTRL1 0x2140
#define RT5514_DELAY_BUF_CTRL3 0x2148 #define RT5514_DELAY_BUF_CTRL3 0x2148
#define RT5514_ASRC_IN_CTRL1 0x2180 #define RT5514_ASRC_IN_CTRL1 0x2180
@ -272,7 +274,7 @@ struct rt5514_priv {
struct rt5514_platform_data pdata; struct rt5514_platform_data pdata;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct regmap *i2c_regmap, *regmap; struct regmap *i2c_regmap, *regmap;
struct clk *mclk; struct clk *mclk, *dsp_calib_clk;
int sysclk; int sysclk;
int sysclk_src; int sysclk_src;
int lrck; int lrck;
@ -281,6 +283,7 @@ struct rt5514_priv {
int pll_in; int pll_in;
int pll_out; int pll_out;
int dsp_enabled; int dsp_enabled;
unsigned int pll3_cal_value;
}; };
#endif /* __RT5514_H__ */ #endif /* __RT5514_H__ */

View File

@ -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[] = {
/* 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)
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,40 +3625,12 @@ 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[] = {
{
.ident = "Intel Strago",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
},
},
{
.ident = "Google Chrome",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
},
},
{
.ident = "Google Setzer",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
},
},
{
.ident = "Microsoft Surface 3",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
},
},
{ }
};
static const struct rt5645_platform_data buddy_platform_data = { static const struct rt5645_platform_data buddy_platform_data = {
.dmic1_data_pin = RT5645_DMIC_DATA_GPIO5, .dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P, .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
@ -3611,22 +3638,61 @@ static const struct rt5645_platform_data buddy_platform_data = {
.level_trigger_irq = true, .level_trigger_irq = true,
}; };
static const struct dmi_system_id dmi_platform_intel_broadwell[] = { 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", .ident = "Chrome Buddy",
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"), DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
}, },
.driver_data = (void *)&buddy_platform_data,
},
{
.ident = "Intel Strago",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
},
.driver_data = (void *)&intel_braswell_platform_data,
},
{
.ident = "Google Chrome",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
},
.driver_data = (void *)&intel_braswell_platform_data,
},
{
.ident = "Google Setzer",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
},
.driver_data = (void *)&intel_braswell_platform_data,
},
{
.ident = "Microsoft Surface 3",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
},
.driver_data = (void *)&intel_braswell_platform_data,
}, },
{ }
};
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[] = {
* 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,
}, },
{ } { }
}; };
@ -3684,9 +3742,9 @@ static const struct dmi_system_id dmi_platform_minix_z83_4[] = {
static bool rt5645_check_dp(struct device *dev) static bool rt5645_check_dp(struct device *dev)
{ {
if (device_property_present(dev, "realtek,in2-differential") || if (device_property_present(dev, "realtek,in2-differential") ||
device_property_present(dev, "realtek,dmic1-data-pin") || device_property_present(dev, "realtek,dmic1-data-pin") ||
device_property_present(dev, "realtek,dmic2-data-pin") || device_property_present(dev, "realtek,dmic2-data-pin") ||
device_property_present(dev, "realtek,jd-mode")) device_property_present(dev, "realtek,jd-mode"))
return true; return true;
return false; return false;
@ -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,
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);

View File

@ -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)

View File

@ -231,14 +231,17 @@ static struct snd_soc_dai_driver si476x_dai = {
.ops = &si476x_dai_ops, .ops = &si476x_dai_ops,
}; };
static struct regmap *si476x_get_regmap(struct device *dev) static int si476x_probe(struct snd_soc_component *component)
{ {
return dev_get_regmap(dev->parent, NULL); snd_soc_component_init_regmap(component,
dev_get_regmap(component->dev->parent, NULL));
return 0;
} }
static const struct snd_soc_codec_driver soc_codec_dev_si476x = { static const struct snd_soc_codec_driver soc_codec_dev_si476x = {
.get_regmap = si476x_get_regmap,
.component_driver = { .component_driver = {
.probe = si476x_probe,
.dapm_widgets = si476x_dapm_widgets, .dapm_widgets = si476x_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets),
.dapm_routes = si476x_dapm_routes, .dapm_routes = si476x_dapm_routes,

View File

@ -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[] = {
{"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[] = {
{"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[] = {
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"),
}; };

View File

@ -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,
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,
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,
{ {
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)
{ {
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)
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)
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)
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);