Commit 551e13a4 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/rt5645' into asoc-next

parents 51a545a3 15b0f4d4
...@@ -64,7 +64,6 @@ static const struct reg_sequence init_list[] = { ...@@ -64,7 +64,6 @@ static const struct reg_sequence init_list[] = {
{RT5645_PR_BASE + 0x21, 0x4040}, {RT5645_PR_BASE + 0x21, 0x4040},
{RT5645_PR_BASE + 0x23, 0x0004}, {RT5645_PR_BASE + 0x23, 0x0004},
}; };
#define RT5645_INIT_REG_LEN ARRAY_SIZE(init_list)
static const struct reg_sequence rt5650_init_list[] = { static const struct reg_sequence rt5650_init_list[] = {
{0xf6, 0x0100}, {0xf6, 0x0100},
...@@ -405,6 +404,7 @@ struct rt5645_priv { ...@@ -405,6 +404,7 @@ struct rt5645_priv {
struct delayed_work jack_detect_work, rcclock_work; struct delayed_work jack_detect_work, rcclock_work;
struct regulator_bulk_data supplies[ARRAY_SIZE(rt5645_supply_names)]; struct regulator_bulk_data supplies[ARRAY_SIZE(rt5645_supply_names)];
struct rt5645_eq_param_s *eq_param; struct rt5645_eq_param_s *eq_param;
struct timer_list btn_check_timer;
int codec_type; int codec_type;
int sysclk; int sysclk;
...@@ -3066,6 +3066,7 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, ...@@ -3066,6 +3066,7 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec,
snd_soc_dapm_force_enable_pin(dapm, "ADC R power"); snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD1, 0x3, 0x3);
snd_soc_update_bits(codec, snd_soc_update_bits(codec,
RT5645_INT_IRQ_ST, 0x8, 0x8); RT5645_INT_IRQ_ST, 0x8, 0x8);
snd_soc_update_bits(codec, snd_soc_update_bits(codec,
...@@ -3134,7 +3135,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -3134,7 +3135,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
} }
if (rt5645->pdata.jd_invert) if (rt5645->pdata.jd_invert)
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV); RT5645_JD_1_1_MASK, RT5645_JD_1_1_NOR);
} else { /* jack out */ } else { /* jack out */
rt5645->jack_type = 0; rt5645->jack_type = 0;
...@@ -3155,7 +3156,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -3155,7 +3156,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
if (rt5645->pdata.jd_invert) if (rt5645->pdata.jd_invert)
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
RT5645_JD_1_1_MASK, RT5645_JD_1_1_NOR); RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV);
} }
return rt5645->jack_type; return rt5645->jack_type;
...@@ -3279,6 +3280,12 @@ static void rt5645_jack_detect_work(struct work_struct *work) ...@@ -3279,6 +3280,12 @@ static void rt5645_jack_detect_work(struct work_struct *work)
} }
if (btn_type == 0)/* button release */ if (btn_type == 0)/* button release */
report = rt5645->jack_type; report = rt5645->jack_type;
else {
if (rt5645->pdata.jd_invert) {
mod_timer(&rt5645->btn_check_timer,
msecs_to_jiffies(100));
}
}
break; break;
/* jack out */ /* jack out */
...@@ -3321,6 +3328,14 @@ static irqreturn_t rt5645_irq(int irq, void *data) ...@@ -3321,6 +3328,14 @@ static irqreturn_t rt5645_irq(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void rt5645_btn_check_callback(unsigned long data)
{
struct rt5645_priv *rt5645 = (struct rt5645_priv *)data;
queue_delayed_work(system_power_efficient_wq,
&rt5645->jack_detect_work, msecs_to_jiffies(5));
}
static int rt5645_probe(struct snd_soc_codec *codec) static int rt5645_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);
...@@ -3510,7 +3525,7 @@ static const struct i2c_device_id rt5645_i2c_id[] = { ...@@ -3510,7 +3525,7 @@ static const struct i2c_device_id rt5645_i2c_id[] = {
MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id);
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static struct acpi_device_id rt5645_acpi_match[] = { static const struct acpi_device_id rt5645_acpi_match[] = {
{ "10EC5645", 0 }, { "10EC5645", 0 },
{ "10EC5650", 0 }, { "10EC5650", 0 },
{}, {},
...@@ -3787,6 +3802,13 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3787,6 +3802,13 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
} }
} }
if (rt5645->pdata.jd_invert) {
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV);
setup_timer(&rt5645->btn_check_timer,
rt5645_btn_check_callback, (unsigned long)rt5645);
}
INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work);
INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work); INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work);
......
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