diff options
Diffstat (limited to 'sound/soc/codecs/wm8770.c')
-rw-r--r-- | sound/soc/codecs/wm8770.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index aa05e6507f84..19374a9e5ba6 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/of_device.h> | 17 | #include <linux/of_device.h> |
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/spi/spi.h> | 19 | #include <linux/spi/spi.h> |
21 | #include <linux/regulator/consumer.h> | 20 | #include <linux/regulator/consumer.h> |
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
@@ -528,7 +527,7 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, | |||
528 | #define WM8770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ | 527 | #define WM8770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ |
529 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) | 528 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
530 | 529 | ||
531 | static struct snd_soc_dai_ops wm8770_dai_ops = { | 530 | static const struct snd_soc_dai_ops wm8770_dai_ops = { |
532 | .digital_mute = wm8770_mute, | 531 | .digital_mute = wm8770_mute, |
533 | .hw_params = wm8770_hw_params, | 532 | .hw_params = wm8770_hw_params, |
534 | .set_fmt = wm8770_set_fmt, | 533 | .set_fmt = wm8770_set_fmt, |
@@ -556,7 +555,7 @@ static struct snd_soc_dai_driver wm8770_dai = { | |||
556 | }; | 555 | }; |
557 | 556 | ||
558 | #ifdef CONFIG_PM | 557 | #ifdef CONFIG_PM |
559 | static int wm8770_suspend(struct snd_soc_codec *codec, pm_message_t state) | 558 | static int wm8770_suspend(struct snd_soc_codec *codec) |
560 | { | 559 | { |
561 | wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF); | 560 | wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF); |
562 | return 0; | 561 | return 0; |
@@ -691,13 +690,13 @@ static const struct of_device_id wm8770_of_match[] = { | |||
691 | }; | 690 | }; |
692 | MODULE_DEVICE_TABLE(of, wm8770_of_match); | 691 | MODULE_DEVICE_TABLE(of, wm8770_of_match); |
693 | 692 | ||
694 | #if defined(CONFIG_SPI_MASTER) | ||
695 | static int __devinit wm8770_spi_probe(struct spi_device *spi) | 693 | static int __devinit wm8770_spi_probe(struct spi_device *spi) |
696 | { | 694 | { |
697 | struct wm8770_priv *wm8770; | 695 | struct wm8770_priv *wm8770; |
698 | int ret; | 696 | int ret; |
699 | 697 | ||
700 | wm8770 = kzalloc(sizeof(struct wm8770_priv), GFP_KERNEL); | 698 | wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv), |
699 | GFP_KERNEL); | ||
701 | if (!wm8770) | 700 | if (!wm8770) |
702 | return -ENOMEM; | 701 | return -ENOMEM; |
703 | 702 | ||
@@ -706,15 +705,13 @@ static int __devinit wm8770_spi_probe(struct spi_device *spi) | |||
706 | 705 | ||
707 | ret = snd_soc_register_codec(&spi->dev, | 706 | ret = snd_soc_register_codec(&spi->dev, |
708 | &soc_codec_dev_wm8770, &wm8770_dai, 1); | 707 | &soc_codec_dev_wm8770, &wm8770_dai, 1); |
709 | if (ret < 0) | 708 | |
710 | kfree(wm8770); | ||
711 | return ret; | 709 | return ret; |
712 | } | 710 | } |
713 | 711 | ||
714 | static int __devexit wm8770_spi_remove(struct spi_device *spi) | 712 | static int __devexit wm8770_spi_remove(struct spi_device *spi) |
715 | { | 713 | { |
716 | snd_soc_unregister_codec(&spi->dev); | 714 | snd_soc_unregister_codec(&spi->dev); |
717 | kfree(spi_get_drvdata(spi)); | ||
718 | return 0; | 715 | return 0; |
719 | } | 716 | } |
720 | 717 | ||
@@ -727,28 +724,23 @@ static struct spi_driver wm8770_spi_driver = { | |||
727 | .probe = wm8770_spi_probe, | 724 | .probe = wm8770_spi_probe, |
728 | .remove = __devexit_p(wm8770_spi_remove) | 725 | .remove = __devexit_p(wm8770_spi_remove) |
729 | }; | 726 | }; |
730 | #endif | ||
731 | 727 | ||
732 | static int __init wm8770_modinit(void) | 728 | static int __init wm8770_modinit(void) |
733 | { | 729 | { |
734 | int ret = 0; | 730 | int ret = 0; |
735 | 731 | ||
736 | #if defined(CONFIG_SPI_MASTER) | ||
737 | ret = spi_register_driver(&wm8770_spi_driver); | 732 | ret = spi_register_driver(&wm8770_spi_driver); |
738 | if (ret) { | 733 | if (ret) { |
739 | printk(KERN_ERR "Failed to register wm8770 SPI driver: %d\n", | 734 | printk(KERN_ERR "Failed to register wm8770 SPI driver: %d\n", |
740 | ret); | 735 | ret); |
741 | } | 736 | } |
742 | #endif | ||
743 | return ret; | 737 | return ret; |
744 | } | 738 | } |
745 | module_init(wm8770_modinit); | 739 | module_init(wm8770_modinit); |
746 | 740 | ||
747 | static void __exit wm8770_exit(void) | 741 | static void __exit wm8770_exit(void) |
748 | { | 742 | { |
749 | #if defined(CONFIG_SPI_MASTER) | ||
750 | spi_unregister_driver(&wm8770_spi_driver); | 743 | spi_unregister_driver(&wm8770_spi_driver); |
751 | #endif | ||
752 | } | 744 | } |
753 | module_exit(wm8770_exit); | 745 | module_exit(wm8770_exit); |
754 | 746 | ||