sigmadsp.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Load firmware files from Analog Devices SigmaStudio
  3. *
  4. * Copyright 2009-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __SIGMA_FIRMWARE_H__
  9. #define __SIGMA_FIRMWARE_H__
  10. #include <linux/device.h>
  11. #include <linux/regmap.h>
  12. #include <linux/list.h>
  13. #include <sound/pcm.h>
  14. struct sigmadsp;
  15. struct snd_soc_component;
  16. struct snd_pcm_substream;
  17. struct sigmadsp_ops {
  18. int (*safeload)(struct sigmadsp *sigmadsp, unsigned int addr,
  19. const uint8_t *data, size_t len);
  20. };
  21. struct sigmadsp {
  22. const struct sigmadsp_ops *ops;
  23. struct list_head ctrl_list;
  24. struct list_head data_list;
  25. struct snd_pcm_hw_constraint_list rate_constraints;
  26. unsigned int current_samplerate;
  27. struct snd_soc_component *component;
  28. struct device *dev;
  29. struct mutex lock;
  30. void *control_data;
  31. int (*write)(void *, unsigned int, const uint8_t *, size_t);
  32. int (*read)(void *, unsigned int, uint8_t *, size_t);
  33. };
  34. struct sigmadsp *devm_sigmadsp_init(struct device *dev,
  35. const struct sigmadsp_ops *ops, const char *firmware_name);
  36. void sigmadsp_reset(struct sigmadsp *sigmadsp);
  37. int sigmadsp_restrict_params(struct sigmadsp *sigmadsp,
  38. struct snd_pcm_substream *substream);
  39. struct i2c_client;
  40. struct sigmadsp *devm_sigmadsp_init_regmap(struct device *dev,
  41. struct regmap *regmap, const struct sigmadsp_ops *ops,
  42. const char *firmware_name);
  43. struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
  44. const struct sigmadsp_ops *ops, const char *firmware_name);
  45. int sigmadsp_attach(struct sigmadsp *sigmadsp,
  46. struct snd_soc_component *component);
  47. int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
  48. void sigmadsp_reset(struct sigmadsp *sigmadsp);
  49. #endif