wm8804-spi.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * wm8804-spi.c -- WM8804 S/PDIF transceiver driver - SPI
  3. *
  4. * Copyright 2015 Cirrus Logic Inc
  5. *
  6. * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/spi/spi.h>
  15. #include "wm8804.h"
  16. static int wm8804_spi_probe(struct spi_device *spi)
  17. {
  18. struct regmap *regmap;
  19. regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config);
  20. if (IS_ERR(regmap))
  21. return PTR_ERR(regmap);
  22. return wm8804_probe(&spi->dev, regmap);
  23. }
  24. static int wm8804_spi_remove(struct spi_device *spi)
  25. {
  26. wm8804_remove(&spi->dev);
  27. return 0;
  28. }
  29. static const struct of_device_id wm8804_of_match[] = {
  30. { .compatible = "wlf,wm8804", },
  31. { }
  32. };
  33. MODULE_DEVICE_TABLE(of, wm8804_of_match);
  34. static struct spi_driver wm8804_spi_driver = {
  35. .driver = {
  36. .name = "wm8804",
  37. .pm = &wm8804_pm,
  38. .of_match_table = wm8804_of_match,
  39. },
  40. .probe = wm8804_spi_probe,
  41. .remove = wm8804_spi_remove
  42. };
  43. module_spi_driver(wm8804_spi_driver);
  44. MODULE_DESCRIPTION("ASoC WM8804 driver - SPI");
  45. MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
  46. MODULE_LICENSE("GPL");