cs42l51-i2c.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * cs42l56.c -- CS42L51 ALSA SoC I2C audio driver
  3. *
  4. * Copyright 2014 CirrusLogic, Inc.
  5. *
  6. * Author: Brian Austin <brian.austin@cirrus.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. */
  13. #include <linux/i2c.h>
  14. #include <linux/module.h>
  15. #include <sound/soc.h>
  16. #include "cs42l51.h"
  17. static struct i2c_device_id cs42l51_i2c_id[] = {
  18. {"cs42l51", 0},
  19. {}
  20. };
  21. MODULE_DEVICE_TABLE(i2c, cs42l51_i2c_id);
  22. static int cs42l51_i2c_probe(struct i2c_client *i2c,
  23. const struct i2c_device_id *id)
  24. {
  25. struct regmap_config config;
  26. config = cs42l51_regmap;
  27. config.val_bits = 8;
  28. config.reg_bits = 8;
  29. return cs42l51_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &config));
  30. }
  31. static int cs42l51_i2c_remove(struct i2c_client *i2c)
  32. {
  33. snd_soc_unregister_codec(&i2c->dev);
  34. return 0;
  35. }
  36. static struct i2c_driver cs42l51_i2c_driver = {
  37. .driver = {
  38. .name = "cs42l51",
  39. .of_match_table = cs42l51_of_match,
  40. },
  41. .probe = cs42l51_i2c_probe,
  42. .remove = cs42l51_i2c_remove,
  43. .id_table = cs42l51_i2c_id,
  44. };
  45. module_i2c_driver(cs42l51_i2c_driver);
  46. MODULE_DESCRIPTION("ASoC CS42L51 I2C Driver");
  47. MODULE_AUTHOR("Brian Austin, Cirrus Logic Inc, <brian.austin@cirrus.com>");
  48. MODULE_LICENSE("GPL");