sigma.h 956 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/firmware.h>
  11. #include <linux/types.h>
  12. struct i2c_client;
  13. #define SIGMA_MAGIC "ADISIGM"
  14. struct sigma_firmware {
  15. const struct firmware *fw;
  16. size_t pos;
  17. };
  18. struct sigma_firmware_header {
  19. unsigned char magic[7];
  20. u8 version;
  21. __le32 crc;
  22. };
  23. enum {
  24. SIGMA_ACTION_WRITEXBYTES = 0,
  25. SIGMA_ACTION_WRITESINGLE,
  26. SIGMA_ACTION_WRITESAFELOAD,
  27. SIGMA_ACTION_DELAY,
  28. SIGMA_ACTION_PLLWAIT,
  29. SIGMA_ACTION_NOOP,
  30. SIGMA_ACTION_END,
  31. };
  32. struct sigma_action {
  33. u8 instr;
  34. u8 len_hi;
  35. __le16 len;
  36. __be16 addr;
  37. unsigned char payload[];
  38. };
  39. static inline u32 sigma_action_len(struct sigma_action *sa)
  40. {
  41. return (sa->len_hi << 16) | le16_to_cpu(sa->len);
  42. }
  43. extern int process_sigma_firmware(struct i2c_client *client, const char *name);
  44. #endif