sigmadsp.h 1.7 KB

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