aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl6040.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index c973347d4f6b..1afc5966cbdb 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -103,8 +103,6 @@ struct twl6040_data {
103 struct mutex mutex; 103 struct mutex mutex;
104 struct twl6040_output headset; 104 struct twl6040_output headset;
105 struct twl6040_output handsfree; 105 struct twl6040_output handsfree;
106 struct workqueue_struct *hf_workqueue;
107 struct workqueue_struct *hs_workqueue;
108}; 106};
109 107
110/* 108/*
@@ -562,20 +560,17 @@ static int out_drv_event(struct snd_soc_dapm_widget *w,
562 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 560 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
563 struct twl6040_output *out; 561 struct twl6040_output *out;
564 struct delayed_work *work; 562 struct delayed_work *work;
565 struct workqueue_struct *queue;
566 563
567 switch (w->shift) { 564 switch (w->shift) {
568 case 2: 565 case 2:
569 case 3: 566 case 3:
570 out = &priv->headset; 567 out = &priv->headset;
571 queue = priv->hs_workqueue;
572 out->left_step = priv->hs_left_step; 568 out->left_step = priv->hs_left_step;
573 out->right_step = priv->hs_right_step; 569 out->right_step = priv->hs_right_step;
574 out->step_delay = 5; /* 5 ms between volume ramp steps */ 570 out->step_delay = 5; /* 5 ms between volume ramp steps */
575 break; 571 break;
576 case 4: 572 case 4:
577 out = &priv->handsfree; 573 out = &priv->handsfree;
578 queue = priv->hf_workqueue;
579 out->left_step = priv->hf_left_step; 574 out->left_step = priv->hf_left_step;
580 out->right_step = priv->hf_right_step; 575 out->right_step = priv->hf_right_step;
581 out->step_delay = 5; /* 5 ms between volume ramp steps */ 576 out->step_delay = 5; /* 5 ms between volume ramp steps */
@@ -601,7 +596,7 @@ static int out_drv_event(struct snd_soc_dapm_widget *w,
601 596
602 if (!delayed_work_pending(work)) { 597 if (!delayed_work_pending(work)) {
603 out->ramp = TWL6040_RAMP_UP; 598 out->ramp = TWL6040_RAMP_UP;
604 queue_delayed_work(queue, work, 599 queue_delayed_work(priv->workqueue, work,
605 msecs_to_jiffies(1)); 600 msecs_to_jiffies(1));
606 } 601 }
607 break; 602 break;
@@ -615,7 +610,7 @@ static int out_drv_event(struct snd_soc_dapm_widget *w,
615 out->ramp = TWL6040_RAMP_DOWN; 610 out->ramp = TWL6040_RAMP_DOWN;
616 INIT_COMPLETION(out->ramp_done); 611 INIT_COMPLETION(out->ramp_done);
617 612
618 queue_delayed_work(queue, work, 613 queue_delayed_work(priv->workqueue, work,
619 msecs_to_jiffies(1)); 614 msecs_to_jiffies(1));
620 615
621 wait_for_completion_timeout(&out->ramp_done, 616 wait_for_completion_timeout(&out->ramp_done,
@@ -1512,33 +1507,21 @@ static int twl6040_probe(struct snd_soc_codec *codec)
1512 goto work_err; 1507 goto work_err;
1513 } 1508 }
1514 1509
1515 priv->workqueue = create_singlethread_workqueue("twl6040-codec"); 1510 priv->workqueue = alloc_workqueue("twl6040-codec", 0, 0);
1516 if (!priv->workqueue) { 1511 if (!priv->workqueue) {
1517 ret = -ENOMEM; 1512 ret = -ENOMEM;
1518 goto work_err; 1513 goto work_err;
1519 } 1514 }
1520 1515
1521 INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work); 1516 INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work);
1517 INIT_DELAYED_WORK(&priv->headset.work, twl6040_pga_hs_work);
1518 INIT_DELAYED_WORK(&priv->handsfree.work, twl6040_pga_hf_work);
1522 1519
1523 mutex_init(&priv->mutex); 1520 mutex_init(&priv->mutex);
1524 1521
1525 init_completion(&priv->headset.ramp_done); 1522 init_completion(&priv->headset.ramp_done);
1526 init_completion(&priv->handsfree.ramp_done); 1523 init_completion(&priv->handsfree.ramp_done);
1527 1524
1528 priv->hf_workqueue = create_singlethread_workqueue("twl6040-hf");
1529 if (priv->hf_workqueue == NULL) {
1530 ret = -ENOMEM;
1531 goto hfwq_err;
1532 }
1533 priv->hs_workqueue = create_singlethread_workqueue("twl6040-hs");
1534 if (priv->hs_workqueue == NULL) {
1535 ret = -ENOMEM;
1536 goto hswq_err;
1537 }
1538
1539 INIT_DELAYED_WORK(&priv->headset.work, twl6040_pga_hs_work);
1540 INIT_DELAYED_WORK(&priv->handsfree.work, twl6040_pga_hf_work);
1541
1542 ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler, 1525 ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler,
1543 0, "twl6040_irq_plug", codec); 1526 0, "twl6040_irq_plug", codec);
1544 if (ret) { 1527 if (ret) {
@@ -1562,10 +1545,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
1562bias_err: 1545bias_err:
1563 free_irq(priv->plug_irq, codec); 1546 free_irq(priv->plug_irq, codec);
1564plugirq_err: 1547plugirq_err:
1565 destroy_workqueue(priv->hs_workqueue);
1566hswq_err:
1567 destroy_workqueue(priv->hf_workqueue);
1568hfwq_err:
1569 destroy_workqueue(priv->workqueue); 1548 destroy_workqueue(priv->workqueue);
1570work_err: 1549work_err:
1571 kfree(priv); 1550 kfree(priv);
@@ -1579,8 +1558,6 @@ static int twl6040_remove(struct snd_soc_codec *codec)
1579 twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF); 1558 twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
1580 free_irq(priv->plug_irq, codec); 1559 free_irq(priv->plug_irq, codec);
1581 destroy_workqueue(priv->workqueue); 1560 destroy_workqueue(priv->workqueue);
1582 destroy_workqueue(priv->hf_workqueue);
1583 destroy_workqueue(priv->hs_workqueue);
1584 kfree(priv); 1561 kfree(priv);
1585 1562
1586 return 0; 1563 return 0;