ads117x.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * ads117x.c -- Driver for ads1174/8 ADC chips
  3. *
  4. * Copyright 2009 ShotSpotter Inc.
  5. * Author: Graeme Gregory <gg@slimlogic.co.uk>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/slab.h>
  14. #include <linux/init.h>
  15. #include <linux/device.h>
  16. #include <linux/module.h>
  17. #include <sound/core.h>
  18. #include <sound/pcm.h>
  19. #include <sound/initval.h>
  20. #include <sound/soc.h>
  21. #define ADS117X_RATES (SNDRV_PCM_RATE_8000_48000)
  22. #define ADS117X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
  23. static struct snd_soc_dai_driver ads117x_dai = {
  24. /* ADC */
  25. .name = "ads117x-hifi",
  26. .capture = {
  27. .stream_name = "Capture",
  28. .channels_min = 1,
  29. .channels_max = 32,
  30. .rates = ADS117X_RATES,
  31. .formats = ADS117X_FORMATS,},
  32. };
  33. static struct snd_soc_codec_driver soc_codec_dev_ads117x;
  34. static __devinit int ads117x_probe(struct platform_device *pdev)
  35. {
  36. return snd_soc_register_codec(&pdev->dev,
  37. &soc_codec_dev_ads117x, &ads117x_dai, 1);
  38. }
  39. static int __devexit ads117x_remove(struct platform_device *pdev)
  40. {
  41. snd_soc_unregister_codec(&pdev->dev);
  42. return 0;
  43. }
  44. static struct platform_driver ads117x_codec_driver = {
  45. .driver = {
  46. .name = "ads117x-codec",
  47. .owner = THIS_MODULE,
  48. },
  49. .probe = ads117x_probe,
  50. .remove = __devexit_p(ads117x_remove),
  51. };
  52. module_platform_driver(ads117x_codec_driver);
  53. MODULE_DESCRIPTION("ASoC ads117x driver");
  54. MODULE_AUTHOR("Graeme Gregory");
  55. MODULE_LICENSE("GPL");