ssm2602-spi.c 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * SSM2602 SPI audio driver
  3. *
  4. * Copyright 2014 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2.
  7. */
  8. #include <linux/module.h>
  9. #include <linux/spi/spi.h>
  10. #include <linux/regmap.h>
  11. #include <sound/soc.h>
  12. #include "ssm2602.h"
  13. static int ssm2602_spi_probe(struct spi_device *spi)
  14. {
  15. return ssm2602_probe(&spi->dev, SSM2602,
  16. devm_regmap_init_spi(spi, &ssm2602_regmap_config));
  17. }
  18. static int ssm2602_spi_remove(struct spi_device *spi)
  19. {
  20. snd_soc_unregister_codec(&spi->dev);
  21. return 0;
  22. }
  23. static const struct of_device_id ssm2602_of_match[] = {
  24. { .compatible = "adi,ssm2602", },
  25. { }
  26. };
  27. MODULE_DEVICE_TABLE(of, ssm2602_of_match);
  28. static struct spi_driver ssm2602_spi_driver = {
  29. .driver = {
  30. .name = "ssm2602",
  31. .of_match_table = ssm2602_of_match,
  32. },
  33. .probe = ssm2602_spi_probe,
  34. .remove = ssm2602_spi_remove,
  35. };
  36. module_spi_driver(ssm2602_spi_driver);
  37. MODULE_DESCRIPTION("ASoC SSM2602 SPI driver");
  38. MODULE_AUTHOR("Cliff Cai");
  39. MODULE_LICENSE("GPL");