pcm179x-spi.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * PCM179X ASoC SPI driver
  4. *
  5. * Copyright (c) Amarula Solutions B.V. 2013
  6. *
  7. * Michael Trimarchi <[email protected]>
  8. */
  9. #include <linux/module.h>
  10. #include <linux/of.h>
  11. #include <linux/spi/spi.h>
  12. #include <linux/regmap.h>
  13. #include "pcm179x.h"
  14. static int pcm179x_spi_probe(struct spi_device *spi)
  15. {
  16. struct regmap *regmap;
  17. int ret;
  18. regmap = devm_regmap_init_spi(spi, &pcm179x_regmap_config);
  19. if (IS_ERR(regmap)) {
  20. ret = PTR_ERR(regmap);
  21. dev_err(&spi->dev, "Failed to allocate regmap: %d\n", ret);
  22. return ret;
  23. }
  24. return pcm179x_common_init(&spi->dev, regmap);
  25. }
  26. static const struct of_device_id pcm179x_of_match[] = {
  27. { .compatible = "ti,pcm1792a", },
  28. { }
  29. };
  30. MODULE_DEVICE_TABLE(of, pcm179x_of_match);
  31. static const struct spi_device_id pcm179x_spi_ids[] = {
  32. { "pcm1792a", 0 },
  33. { "pcm179x", 0 },
  34. { },
  35. };
  36. MODULE_DEVICE_TABLE(spi, pcm179x_spi_ids);
  37. static struct spi_driver pcm179x_spi_driver = {
  38. .driver = {
  39. .name = "pcm179x",
  40. .of_match_table = of_match_ptr(pcm179x_of_match),
  41. },
  42. .id_table = pcm179x_spi_ids,
  43. .probe = pcm179x_spi_probe,
  44. };
  45. module_spi_driver(pcm179x_spi_driver);
  46. MODULE_DESCRIPTION("ASoC PCM179X SPI driver");
  47. MODULE_AUTHOR("Michael Trimarchi <[email protected]>");
  48. MODULE_LICENSE("GPL");