tlv320aic23-spi.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * ALSA SoC TLV320AIC23 codec driver SPI interface
  3. *
  4. * Author: Arun KS, <arunks@mistralsolutions.com>
  5. * Copyright: (C) 2008 Mistral Solutions Pvt Ltd.,
  6. *
  7. * Based on sound/soc/codecs/wm8731.c by Richard Purdie
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/module.h>
  14. #include <linux/regmap.h>
  15. #include <linux/spi/spi.h>
  16. #include <sound/soc.h>
  17. #include "tlv320aic23.h"
  18. static int aic23_spi_probe(struct spi_device *spi)
  19. {
  20. int ret;
  21. struct regmap *regmap;
  22. dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n");
  23. spi->mode = SPI_MODE_0;
  24. ret = spi_setup(spi);
  25. if (ret < 0)
  26. return ret;
  27. regmap = devm_regmap_init_spi(spi, &tlv320aic23_regmap);
  28. return tlv320aic23_probe(&spi->dev, regmap);
  29. }
  30. static int aic23_spi_remove(struct spi_device *spi)
  31. {
  32. snd_soc_unregister_codec(&spi->dev);
  33. return 0;
  34. }
  35. static struct spi_driver aic23_spi = {
  36. .driver = {
  37. .name = "tlv320aic23",
  38. },
  39. .probe = aic23_spi_probe,
  40. .remove = aic23_spi_remove,
  41. };
  42. module_spi_driver(aic23_spi);
  43. MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver SPI");
  44. MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
  45. MODULE_LICENSE("GPL");