pcm3168a-spi.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * PCM3168A codec spi driver
  3. *
  4. * Copyright (C) 2015 Imagination Technologies Ltd.
  5. *
  6. * Author: Damien Horsley <Damien.Horsley@imgtec.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2, as 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 <sound/soc.h>
  16. #include "pcm3168a.h"
  17. static int pcm3168a_spi_probe(struct spi_device *spi)
  18. {
  19. struct regmap *regmap;
  20. regmap = devm_regmap_init_spi(spi, &pcm3168a_regmap);
  21. if (IS_ERR(regmap))
  22. return PTR_ERR(regmap);
  23. return pcm3168a_probe(&spi->dev, regmap);
  24. }
  25. static int pcm3168a_spi_remove(struct spi_device *spi)
  26. {
  27. pcm3168a_remove(&spi->dev);
  28. return 0;
  29. }
  30. static const struct spi_device_id pcm3168a_spi_id[] = {
  31. { "pcm3168a", },
  32. { },
  33. };
  34. MODULE_DEVICE_TABLE(spi, pcm3168a_spi_id);
  35. static const struct of_device_id pcm3168a_of_match[] = {
  36. { .compatible = "ti,pcm3168a", },
  37. { }
  38. };
  39. MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
  40. static struct spi_driver pcm3168a_spi_driver = {
  41. .probe = pcm3168a_spi_probe,
  42. .remove = pcm3168a_spi_remove,
  43. .id_table = pcm3168a_spi_id,
  44. .driver = {
  45. .name = "pcm3168a",
  46. .of_match_table = pcm3168a_of_match,
  47. .pm = &pcm3168a_pm_ops,
  48. },
  49. };
  50. module_spi_driver(pcm3168a_spi_driver);
  51. MODULE_DESCRIPTION("PCM3168A SPI codec driver");
  52. MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
  53. MODULE_LICENSE("GPL v2");