wm8804-i2c.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * wm8804-i2c.c -- WM8804 S/PDIF transceiver driver - I2C
  4. *
  5. * Copyright 2015 Cirrus Logic Inc
  6. *
  7. * Author: Charles Keepax <[email protected]>
  8. */
  9. #include <linux/init.h>
  10. #include <linux/module.h>
  11. #include <linux/i2c.h>
  12. #include <linux/acpi.h>
  13. #include "wm8804.h"
  14. static int wm8804_i2c_probe(struct i2c_client *i2c)
  15. {
  16. struct regmap *regmap;
  17. regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
  18. if (IS_ERR(regmap))
  19. return PTR_ERR(regmap);
  20. return wm8804_probe(&i2c->dev, regmap);
  21. }
  22. static void wm8804_i2c_remove(struct i2c_client *i2c)
  23. {
  24. wm8804_remove(&i2c->dev);
  25. }
  26. static const struct i2c_device_id wm8804_i2c_id[] = {
  27. { "wm8804", 0 },
  28. { }
  29. };
  30. MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id);
  31. #if defined(CONFIG_OF)
  32. static const struct of_device_id wm8804_of_match[] = {
  33. { .compatible = "wlf,wm8804", },
  34. { }
  35. };
  36. MODULE_DEVICE_TABLE(of, wm8804_of_match);
  37. #endif
  38. #ifdef CONFIG_ACPI
  39. static const struct acpi_device_id wm8804_acpi_match[] = {
  40. { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */
  41. { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */
  42. { },
  43. };
  44. MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match);
  45. #endif
  46. static struct i2c_driver wm8804_i2c_driver = {
  47. .driver = {
  48. .name = "wm8804",
  49. .pm = &wm8804_pm,
  50. .of_match_table = of_match_ptr(wm8804_of_match),
  51. .acpi_match_table = ACPI_PTR(wm8804_acpi_match),
  52. },
  53. .probe_new = wm8804_i2c_probe,
  54. .remove = wm8804_i2c_remove,
  55. .id_table = wm8804_i2c_id
  56. };
  57. module_i2c_driver(wm8804_i2c_driver);
  58. MODULE_DESCRIPTION("ASoC WM8804 driver - I2C");
  59. MODULE_AUTHOR("Charles Keepax <[email protected]>");
  60. MODULE_LICENSE("GPL");