aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-26 09:59:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-27 06:56:34 -0500
commit6f8ab4ac292f81b9246ddf363bf1c6a2fc7a0629 (patch)
tree1ca2bcaefd986fb19b72a1ac741c9371aec2f28a /sound/soc/soc-core.c
parente7361ec4996c170c63c4ac379085896db85ff34d (diff)
ASoC: Export card PM callbacks for use in direct registered cards
Allow hookup of cards registered directly with the core to the PM operations by exporting the device power management operations to modules, also exporting the default PM operations since it is expected that most cards will end up using exactly the same setup. Note that the callbacks require that the driver data for the card be the snd_soc_card. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4bc2365bf1dd..5dffc7a469c0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -965,12 +965,11 @@ static struct snd_pcm_ops soc_pcm_ops = {
965 .pointer = soc_pcm_pointer, 965 .pointer = soc_pcm_pointer,
966}; 966};
967 967
968#ifdef CONFIG_PM 968#ifdef CONFIG_PM_SLEEP
969/* powers down audio subsystem for suspend */ 969/* powers down audio subsystem for suspend */
970static int soc_suspend(struct device *dev) 970int snd_soc_suspend(struct device *dev)
971{ 971{
972 struct platform_device *pdev = to_platform_device(dev); 972 struct snd_soc_card *card = dev_get_drvdata(dev);
973 struct snd_soc_card *card = platform_get_drvdata(pdev);
974 struct snd_soc_codec *codec; 973 struct snd_soc_codec *codec;
975 int i; 974 int i;
976 975
@@ -1082,6 +1081,7 @@ static int soc_suspend(struct device *dev)
1082 1081
1083 return 0; 1082 return 0;
1084} 1083}
1084EXPORT_SYMBOL_GPL(snd_soc_suspend);
1085 1085
1086/* deferred resume work, so resume can complete before we finished 1086/* deferred resume work, so resume can complete before we finished
1087 * setting our codec back up, which can be very slow on I2C 1087 * setting our codec back up, which can be very slow on I2C
@@ -1187,10 +1187,9 @@ static void soc_resume_deferred(struct work_struct *work)
1187} 1187}
1188 1188
1189/* powers up audio subsystem after a suspend */ 1189/* powers up audio subsystem after a suspend */
1190static int soc_resume(struct device *dev) 1190int snd_soc_resume(struct device *dev)
1191{ 1191{
1192 struct platform_device *pdev = to_platform_device(dev); 1192 struct snd_soc_card *card = dev_get_drvdata(dev);
1193 struct snd_soc_card *card = platform_get_drvdata(pdev);
1194 int i; 1193 int i;
1195 1194
1196 /* AC97 devices might have other drivers hanging off them so 1195 /* AC97 devices might have other drivers hanging off them so
@@ -1212,9 +1211,10 @@ static int soc_resume(struct device *dev)
1212 1211
1213 return 0; 1212 return 0;
1214} 1213}
1214EXPORT_SYMBOL_GPL(snd_soc_resume);
1215#else 1215#else
1216#define soc_suspend NULL 1216#define snd_soc_suspend NULL
1217#define soc_resume NULL 1217#define snd_soc_resume NULL
1218#endif 1218#endif
1219 1219
1220static struct snd_soc_dai_ops null_dai_ops = { 1220static struct snd_soc_dai_ops null_dai_ops = {
@@ -1924,10 +1924,9 @@ static int soc_remove(struct platform_device *pdev)
1924 return 0; 1924 return 0;
1925} 1925}
1926 1926
1927static int soc_poweroff(struct device *dev) 1927int snd_soc_poweroff(struct device *dev)
1928{ 1928{
1929 struct platform_device *pdev = to_platform_device(dev); 1929 struct snd_soc_card *card = dev_get_drvdata(dev);
1930 struct snd_soc_card *card = platform_get_drvdata(pdev);
1931 int i; 1930 int i;
1932 1931
1933 if (!card->instantiated) 1932 if (!card->instantiated)
@@ -1944,11 +1943,12 @@ static int soc_poweroff(struct device *dev)
1944 1943
1945 return 0; 1944 return 0;
1946} 1945}
1946EXPORT_SYMBOL_GPL(snd_soc_poweroff);
1947 1947
1948static const struct dev_pm_ops soc_pm_ops = { 1948const struct dev_pm_ops snd_soc_pm_ops = {
1949 .suspend = soc_suspend, 1949 .suspend = snd_soc_suspend,
1950 .resume = soc_resume, 1950 .resume = snd_soc_resume,
1951 .poweroff = soc_poweroff, 1951 .poweroff = snd_soc_poweroff,
1952}; 1952};
1953 1953
1954/* ASoC platform driver */ 1954/* ASoC platform driver */
@@ -1956,7 +1956,7 @@ static struct platform_driver soc_driver = {
1956 .driver = { 1956 .driver = {
1957 .name = "soc-audio", 1957 .name = "soc-audio",
1958 .owner = THIS_MODULE, 1958 .owner = THIS_MODULE,
1959 .pm = &soc_pm_ops, 1959 .pm = &snd_soc_pm_ops,
1960 }, 1960 },
1961 .probe = soc_probe, 1961 .probe = soc_probe,
1962 .remove = soc_remove, 1962 .remove = soc_remove,