Commit ac4fc3ee authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: rt5645: remove unused field in pdata

We can know if dmic is used by reading the value of dmic1_data_pin
and dmic2_data_pin. Also IRQ must be used if codec JD or button
detection function is used. So, dmic_en and en_jd_func can be remove
from platform data.
Signed-off-by: default avatarBard Liao <bardliao@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 786aa09b
...@@ -15,7 +15,6 @@ struct rt5645_platform_data { ...@@ -15,7 +15,6 @@ struct rt5645_platform_data {
/* IN2 can optionally be differential */ /* IN2 can optionally be differential */
bool in2_diff; bool in2_diff;
bool dmic_en;
unsigned int dmic1_data_pin; unsigned int dmic1_data_pin;
/* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */ /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
unsigned int dmic2_data_pin; unsigned int dmic2_data_pin;
...@@ -24,8 +23,6 @@ struct rt5645_platform_data { ...@@ -24,8 +23,6 @@ struct rt5645_platform_data {
unsigned int hp_det_gpio; unsigned int hp_det_gpio;
bool gpio_hp_det_active_high; bool gpio_hp_det_active_high;
/* true if codec's jd function is used */
bool en_jd_func;
unsigned int jd_mode; unsigned int jd_mode;
}; };
......
...@@ -2968,7 +2968,7 @@ static int rt5645_probe(struct snd_soc_codec *codec) ...@@ -2968,7 +2968,7 @@ static int rt5645_probe(struct snd_soc_codec *codec)
snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200);
/* for JD function */ /* for JD function */
if (rt5645->pdata.en_jd_func) { if (rt5645->pdata.jd_mode) {
snd_soc_dapm_force_enable_pin(&codec->dapm, "JD Power"); snd_soc_dapm_force_enable_pin(&codec->dapm, "JD Power");
snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2"); snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2");
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(&codec->dapm);
...@@ -3111,10 +3111,8 @@ MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); ...@@ -3111,10 +3111,8 @@ MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
static struct rt5645_platform_data *rt5645_pdata; static struct rt5645_platform_data *rt5645_pdata;
static struct rt5645_platform_data strago_platform_data = { static struct rt5645_platform_data strago_platform_data = {
.dmic_en = true, .dmic1_data_pin = RT5645_DMIC1_DISABLE,
.dmic1_data_pin = -1,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P, .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
.en_jd_func = true,
.jd_mode = 3, .jd_mode = 3,
}; };
...@@ -3214,10 +3212,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3214,10 +3212,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
regmap_update_bits(rt5645->regmap, RT5645_IN2_CTRL, regmap_update_bits(rt5645->regmap, RT5645_IN2_CTRL,
RT5645_IN_DF2, RT5645_IN_DF2); RT5645_IN_DF2, RT5645_IN_DF2);
if (rt5645->pdata.dmic_en) { if (rt5645->pdata.dmic1_data_pin || rt5645->pdata.dmic2_data_pin) {
regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
RT5645_GP2_PIN_MASK, RT5645_GP2_PIN_DMIC1_SCL); RT5645_GP2_PIN_MASK, RT5645_GP2_PIN_DMIC1_SCL);
}
switch (rt5645->pdata.dmic1_data_pin) { switch (rt5645->pdata.dmic1_data_pin) {
case RT5645_DMIC_DATA_IN2N: case RT5645_DMIC_DATA_IN2N:
regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,
...@@ -3276,11 +3274,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3276,11 +3274,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
break; break;
} }
} if (rt5645->pdata.jd_mode) {
if (rt5645->pdata.en_jd_func) {
regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3,
RT5645_IRQ_CLK_GATE_CTRL, RT5645_IRQ_CLK_GATE_CTRL); RT5645_IRQ_CLK_GATE_CTRL,
RT5645_IRQ_CLK_GATE_CTRL);
regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1,
RT5645_CBJ_BST1_EN, RT5645_CBJ_BST1_EN); RT5645_CBJ_BST1_EN, RT5645_CBJ_BST1_EN);
regmap_update_bits(rt5645->regmap, RT5645_JD_CTRL3, regmap_update_bits(rt5645->regmap, RT5645_JD_CTRL3,
...@@ -3288,9 +3285,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3288,9 +3285,6 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
RT5645_JD_CBJ_EN | RT5645_JD_CBJ_POL); RT5645_JD_CBJ_EN | RT5645_JD_CBJ_POL);
regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, regmap_update_bits(rt5645->regmap, RT5645_MICBIAS,
RT5645_IRQ_CLK_INT, RT5645_IRQ_CLK_INT); RT5645_IRQ_CLK_INT, RT5645_IRQ_CLK_INT);
}
if (rt5645->pdata.jd_mode) {
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
RT5645_IRQ_JD_1_1_EN, RT5645_IRQ_JD_1_1_EN); RT5645_IRQ_JD_1_1_EN, RT5645_IRQ_JD_1_1_EN);
regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3,
......
...@@ -2145,6 +2145,7 @@ enum { ...@@ -2145,6 +2145,7 @@ enum {
}; };
enum { enum {
RT5645_DMIC1_DISABLE,
RT5645_DMIC_DATA_IN2P, RT5645_DMIC_DATA_IN2P,
RT5645_DMIC_DATA_GPIO6, RT5645_DMIC_DATA_GPIO6,
RT5645_DMIC_DATA_GPIO10, RT5645_DMIC_DATA_GPIO10,
...@@ -2152,6 +2153,7 @@ enum { ...@@ -2152,6 +2153,7 @@ enum {
}; };
enum { enum {
RT5645_DMIC2_DISABLE,
RT5645_DMIC_DATA_IN2N, RT5645_DMIC_DATA_IN2N,
RT5645_DMIC_DATA_GPIO5, RT5645_DMIC_DATA_GPIO5,
RT5645_DMIC_DATA_GPIO11, RT5645_DMIC_DATA_GPIO11,
......
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