wm8804-i2c.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * wm8804-i2c.c -- WM8804 S/PDIF transceiver driver - I2C
  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/i2c.h>
  15. #include "wm8804.h"
  16. static int wm8804_i2c_probe(struct i2c_client *i2c,
  17. const struct i2c_device_id *id)
  18. {
  19. struct regmap *regmap;
  20. regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
  21. if (IS_ERR(regmap))
  22. return PTR_ERR(regmap);
  23. return wm8804_probe(&i2c->dev, regmap);
  24. }
  25. static int wm8804_i2c_remove(struct i2c_client *i2c)
  26. {
  27. wm8804_remove(&i2c->dev);
  28. return 0;
  29. }
  30. static const struct i2c_device_id wm8804_i2c_id[] = {
  31. { "wm8804", 0 },
  32. { }
  33. };
  34. MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id);
  35. static const struct of_device_id wm8804_of_match[] = {
  36. { .compatible = "wlf,wm8804", },
  37. { }
  38. };
  39. MODULE_DEVICE_TABLE(of, wm8804_of_match);
  40. static struct i2c_driver wm8804_i2c_driver = {
  41. .driver = {
  42. .name = "wm8804",
  43. .pm = &wm8804_pm,
  44. .of_match_table = wm8804_of_match,
  45. },
  46. .probe = wm8804_i2c_probe,
  47. .remove = wm8804_i2c_remove,
  48. .id_table = wm8804_i2c_id
  49. };
  50. module_i2c_driver(wm8804_i2c_driver);
  51. MODULE_DESCRIPTION("ASoC WM8804 driver - I2C");
  52. MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
  53. MODULE_LICENSE("GPL");