diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8350.c | 9 | ||||
-rw-r--r-- | sound/soc/codecs/wm8753.c | 21 | ||||
-rw-r--r-- | sound/soc/sh/fsi.c | 25 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 25 |
4 files changed, 22 insertions, 58 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index dc6912e9b667..f8a8a6944e65 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -1627,7 +1627,6 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) | |||
1627 | { | 1627 | { |
1628 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1628 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); |
1629 | struct wm8350 *wm8350 = dev_get_platdata(codec->dev); | 1629 | struct wm8350 *wm8350 = dev_get_platdata(codec->dev); |
1630 | int ret; | ||
1631 | 1630 | ||
1632 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, | 1631 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
1633 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1632 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
@@ -1642,15 +1641,9 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) | |||
1642 | priv->hpr.jack = NULL; | 1641 | priv->hpr.jack = NULL; |
1643 | priv->mic.jack = NULL; | 1642 | priv->mic.jack = NULL; |
1644 | 1643 | ||
1645 | /* cancel any work waiting to be queued. */ | ||
1646 | ret = cancel_delayed_work(&codec->dapm.delayed_work); | ||
1647 | |||
1648 | /* if there was any work waiting then we run it now and | 1644 | /* if there was any work waiting then we run it now and |
1649 | * wait for its completion */ | 1645 | * wait for its completion */ |
1650 | if (ret) { | 1646 | flush_delayed_work_sync(&codec->delayed_work); |
1651 | schedule_delayed_work(&codec->dapm.delayed_work, 0); | ||
1652 | flush_scheduled_work(); | ||
1653 | } | ||
1654 | 1647 | ||
1655 | wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1648 | wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1656 | 1649 | ||
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 57bf9468d39a..747457193887 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1528,25 +1528,6 @@ static int wm8753_resume(struct snd_soc_codec *codec) | |||
1528 | return 0; | 1528 | return 0; |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | /* | ||
1532 | * This function forces any delayed work to be queued and run. | ||
1533 | */ | ||
1534 | static int run_delayed_work(struct delayed_work *dwork) | ||
1535 | { | ||
1536 | int ret; | ||
1537 | |||
1538 | /* cancel any work waiting to be queued. */ | ||
1539 | ret = cancel_delayed_work(dwork); | ||
1540 | |||
1541 | /* if there was any work waiting then we run it now and | ||
1542 | * wait for it's completion */ | ||
1543 | if (ret) { | ||
1544 | schedule_delayed_work(dwork, 0); | ||
1545 | flush_scheduled_work(); | ||
1546 | } | ||
1547 | return ret; | ||
1548 | } | ||
1549 | |||
1550 | static int wm8753_probe(struct snd_soc_codec *codec) | 1531 | static int wm8753_probe(struct snd_soc_codec *codec) |
1551 | { | 1532 | { |
1552 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1533 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
@@ -1606,7 +1587,7 @@ static int wm8753_probe(struct snd_soc_codec *codec) | |||
1606 | /* power down chip */ | 1587 | /* power down chip */ |
1607 | static int wm8753_remove(struct snd_soc_codec *codec) | 1588 | static int wm8753_remove(struct snd_soc_codec *codec) |
1608 | { | 1589 | { |
1609 | run_delayed_work(&codec->dapm.delayed_work); | 1590 | flush_delayed_work_sync(&codec->delayed_work); |
1610 | wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1591 | wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1611 | 1592 | ||
1612 | return 0; | 1593 | return 0; |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 19a2f99be60c..97c5394aa7d7 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -142,6 +142,8 @@ struct fsi_priv { | |||
142 | 142 | ||
143 | struct fsi_stream playback; | 143 | struct fsi_stream playback; |
144 | struct fsi_stream capture; | 144 | struct fsi_stream capture; |
145 | |||
146 | long rate; | ||
145 | }; | 147 | }; |
146 | 148 | ||
147 | struct fsi_core { | 149 | struct fsi_core { |
@@ -829,10 +831,17 @@ static void fsi_dai_shutdown(struct snd_pcm_substream *substream, | |||
829 | { | 831 | { |
830 | struct fsi_priv *fsi = fsi_get_priv(substream); | 832 | struct fsi_priv *fsi = fsi_get_priv(substream); |
831 | int is_play = fsi_is_play(substream); | 833 | int is_play = fsi_is_play(substream); |
834 | struct fsi_master *master = fsi_get_master(fsi); | ||
835 | int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); | ||
832 | 836 | ||
833 | fsi_irq_disable(fsi, is_play); | 837 | fsi_irq_disable(fsi, is_play); |
834 | fsi_clk_ctrl(fsi, 0); | 838 | fsi_clk_ctrl(fsi, 0); |
835 | 839 | ||
840 | set_rate = master->info->set_rate; | ||
841 | if (set_rate && fsi->rate) | ||
842 | set_rate(dai->dev, fsi_is_port_a(fsi), fsi->rate, 0); | ||
843 | fsi->rate = 0; | ||
844 | |||
836 | pm_runtime_put_sync(dai->dev); | 845 | pm_runtime_put_sync(dai->dev); |
837 | } | 846 | } |
838 | 847 | ||
@@ -866,20 +875,20 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream, | |||
866 | { | 875 | { |
867 | struct fsi_priv *fsi = fsi_get_priv(substream); | 876 | struct fsi_priv *fsi = fsi_get_priv(substream); |
868 | struct fsi_master *master = fsi_get_master(fsi); | 877 | struct fsi_master *master = fsi_get_master(fsi); |
869 | int (*set_rate)(int is_porta, int rate) = master->info->set_rate; | 878 | int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); |
870 | int fsi_ver = master->core->ver; | 879 | int fsi_ver = master->core->ver; |
871 | int is_play = fsi_is_play(substream); | 880 | long rate = params_rate(params); |
872 | int ret; | 881 | int ret; |
873 | 882 | ||
874 | /* if slave mode, set_rate is not needed */ | 883 | set_rate = master->info->set_rate; |
875 | if (!fsi_is_master_mode(fsi, is_play)) | 884 | if (!set_rate) |
876 | return 0; | 885 | return 0; |
877 | 886 | ||
878 | /* it is error if no set_rate */ | 887 | ret = set_rate(dai->dev, fsi_is_port_a(fsi), rate, 1); |
879 | if (!set_rate) | 888 | if (ret < 0) /* error */ |
880 | return -EIO; | 889 | return ret; |
881 | 890 | ||
882 | ret = set_rate(fsi_is_port_a(fsi), params_rate(params)); | 891 | fsi->rate = rate; |
883 | if (ret > 0) { | 892 | if (ret > 0) { |
884 | u32 data = 0; | 893 | u32 data = 0; |
885 | 894 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a14a0507bbd0..68edc693a8a5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -70,25 +70,6 @@ static int pmdown_time = 5000; | |||
70 | module_param(pmdown_time, int, 0); | 70 | module_param(pmdown_time, int, 0); |
71 | MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)"); | 71 | MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)"); |
72 | 72 | ||
73 | /* | ||
74 | * This function forces any delayed work to be queued and run. | ||
75 | */ | ||
76 | static int run_delayed_work(struct delayed_work *dwork) | ||
77 | { | ||
78 | int ret; | ||
79 | |||
80 | /* cancel any work waiting to be queued. */ | ||
81 | ret = cancel_delayed_work(dwork); | ||
82 | |||
83 | /* if there was any work waiting then we run it now and | ||
84 | * wait for it's completion */ | ||
85 | if (ret) { | ||
86 | schedule_delayed_work(dwork, 0); | ||
87 | flush_scheduled_work(); | ||
88 | } | ||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | /* codec register dump */ | 73 | /* codec register dump */ |
93 | static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) | 74 | static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) |
94 | { | 75 | { |
@@ -1046,7 +1027,7 @@ static int soc_suspend(struct device *dev) | |||
1046 | 1027 | ||
1047 | /* close any waiting streams and save state */ | 1028 | /* close any waiting streams and save state */ |
1048 | for (i = 0; i < card->num_rtd; i++) { | 1029 | for (i = 0; i < card->num_rtd; i++) { |
1049 | run_delayed_work(&card->rtd[i].delayed_work); | 1030 | flush_delayed_work_sync(&card->rtd[i].delayed_work); |
1050 | card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level; | 1031 | card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level; |
1051 | } | 1032 | } |
1052 | 1033 | ||
@@ -1921,7 +1902,7 @@ static int soc_remove(struct platform_device *pdev) | |||
1921 | /* make sure any delayed work runs */ | 1902 | /* make sure any delayed work runs */ |
1922 | for (i = 0; i < card->num_rtd; i++) { | 1903 | for (i = 0; i < card->num_rtd; i++) { |
1923 | struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; | 1904 | struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; |
1924 | run_delayed_work(&rtd->delayed_work); | 1905 | flush_delayed_work_sync(&rtd->delayed_work); |
1925 | } | 1906 | } |
1926 | 1907 | ||
1927 | /* remove auxiliary devices */ | 1908 | /* remove auxiliary devices */ |
@@ -1958,7 +1939,7 @@ static int soc_poweroff(struct device *dev) | |||
1958 | * now, we're shutting down so no imminent restart. */ | 1939 | * now, we're shutting down so no imminent restart. */ |
1959 | for (i = 0; i < card->num_rtd; i++) { | 1940 | for (i = 0; i < card->num_rtd; i++) { |
1960 | struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; | 1941 | struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; |
1961 | run_delayed_work(&rtd->delayed_work); | 1942 | flush_delayed_work_sync(&rtd->delayed_work); |
1962 | } | 1943 | } |
1963 | 1944 | ||
1964 | snd_soc_dapm_shutdown(card); | 1945 | snd_soc_dapm_shutdown(card); |