wm8727.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * wm8727.c
  3. *
  4. * Created on: 15-Oct-2009
  5. * Author: neil.jones@imgtec.com
  6. *
  7. * Copyright (C) 2009 Imagination Technologies Ltd.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/slab.h>
  16. #include <linux/module.h>
  17. #include <linux/kernel.h>
  18. #include <linux/device.h>
  19. #include <sound/core.h>
  20. #include <sound/pcm.h>
  21. #include <sound/ac97_codec.h>
  22. #include <sound/initval.h>
  23. #include <sound/soc.h>
  24. /*
  25. * Note this is a simple chip with no configuration interface, sample rate is
  26. * determined automatically by examining the Master clock and Bit clock ratios
  27. */
  28. #define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
  29. SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
  30. SNDRV_PCM_RATE_192000)
  31. static struct snd_soc_dai_driver wm8727_dai = {
  32. .name = "wm8727-hifi",
  33. .playback = {
  34. .stream_name = "Playback",
  35. .channels_min = 2,
  36. .channels_max = 2,
  37. .rates = WM8727_RATES,
  38. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
  39. },
  40. };
  41. static struct snd_soc_codec_driver soc_codec_dev_wm8727;
  42. static __devinit int wm8727_probe(struct platform_device *pdev)
  43. {
  44. return snd_soc_register_codec(&pdev->dev,
  45. &soc_codec_dev_wm8727, &wm8727_dai, 1);
  46. }
  47. static int __devexit wm8727_remove(struct platform_device *pdev)
  48. {
  49. snd_soc_unregister_codec(&pdev->dev);
  50. return 0;
  51. }
  52. static struct platform_driver wm8727_codec_driver = {
  53. .driver = {
  54. .name = "wm8727",
  55. .owner = THIS_MODULE,
  56. },
  57. .probe = wm8727_probe,
  58. .remove = __devexit_p(wm8727_remove),
  59. };
  60. module_platform_driver(wm8727_codec_driver);
  61. MODULE_DESCRIPTION("ASoC wm8727 driver");
  62. MODULE_AUTHOR("Neil Jones");
  63. MODULE_LICENSE("GPL");