Skip to content

Commit a3b1aaf

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: rt5640: Change jack_work to a delayed_work
Change jack_work from a struct work_struct to a struct delayed_work, this is a preparation patch for adding support for boards where an external GPIO is used for jack-detect, rather then one of the JD pins of the codec. Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a2d6d84 commit a3b1aaf

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

sound/soc/codecs/rt5640.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ EXPORT_SYMBOL_GPL(rt5640_detect_headset);
22982298
static void rt5640_jack_work(struct work_struct *work)
22992299
{
23002300
struct rt5640_priv *rt5640 =
2301-
container_of(work, struct rt5640_priv, jack_work);
2301+
container_of(work, struct rt5640_priv, jack_work.work);
23022302
struct snd_soc_component *component = rt5640->component;
23032303
int status;
23042304

@@ -2381,7 +2381,7 @@ static void rt5640_jack_work(struct work_struct *work)
23812381
* disabled the OVCD IRQ, the IRQ pin will stay high and as
23822382
* we react to edges, we miss the unplug event -> recheck.
23832383
*/
2384-
queue_work(system_long_wq, &rt5640->jack_work);
2384+
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
23852385
}
23862386
}
23872387

@@ -2390,7 +2390,7 @@ static irqreturn_t rt5640_irq(int irq, void *data)
23902390
struct rt5640_priv *rt5640 = data;
23912391

23922392
if (rt5640->jack)
2393-
queue_work(system_long_wq, &rt5640->jack_work);
2393+
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
23942394

23952395
return IRQ_HANDLED;
23962396
}
@@ -2399,7 +2399,7 @@ static void rt5640_cancel_work(void *data)
23992399
{
24002400
struct rt5640_priv *rt5640 = data;
24012401

2402-
cancel_work_sync(&rt5640->jack_work);
2402+
cancel_delayed_work_sync(&rt5640->jack_work);
24032403
cancel_delayed_work_sync(&rt5640->bp_work);
24042404
}
24052405

@@ -2508,7 +2508,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
25082508
}
25092509

25102510
/* sync initial jack state */
2511-
queue_work(system_long_wq, &rt5640->jack_work);
2511+
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
25122512
}
25132513

25142514
static void rt5640_enable_hda_jack_detect(
@@ -2546,7 +2546,7 @@ static void rt5640_enable_hda_jack_detect(
25462546
}
25472547

25482548
/* sync initial jack state */
2549-
queue_work(system_long_wq, &rt5640->jack_work);
2549+
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
25502550
}
25512551

25522552
static int rt5640_set_jack(struct snd_soc_component *component,
@@ -2745,7 +2745,7 @@ static int rt5640_resume(struct snd_soc_component *component)
27452745
snd_soc_component_write(component, RT5640_DUMMY2,
27462746
0x4001);
27472747

2748-
queue_work(system_long_wq, &rt5640->jack_work);
2748+
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0);
27492749
}
27502750

27512751
return 0;
@@ -2950,7 +2950,7 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
29502950
rt5640->hp_mute = true;
29512951
rt5640->irq = i2c->irq;
29522952
INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work);
2953-
INIT_WORK(&rt5640->jack_work, rt5640_jack_work);
2953+
INIT_DELAYED_WORK(&rt5640->jack_work, rt5640_jack_work);
29542954

29552955
/* Make sure work is stopped on probe-error / remove */
29562956
ret = devm_add_action_or_reset(&i2c->dev, rt5640_cancel_work, rt5640);

sound/soc/codecs/rt5640.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ struct rt5640_priv {
21452145
int release_count;
21462146
int poll_count;
21472147
struct delayed_work bp_work;
2148-
struct work_struct jack_work;
2148+
struct delayed_work jack_work;
21492149
struct snd_soc_jack *jack;
21502150
unsigned int jd_src;
21512151
bool jd_inverted;

0 commit comments

Comments
 (0)