diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-03-22 16:34:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 17:44:15 -0700 |
commit | e359dc24d32e58c795fc339cb3e89ea6330fceae (patch) | |
tree | 824561f59ab4d217bf09462021095235df825f0e /include/linux/sigma.h | |
parent | 33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c (diff) | |
download | op-kernel-dev-e359dc24d32e58c795fc339cb3e89ea6330fceae.zip op-kernel-dev-e359dc24d32e58c795fc339cb3e89ea6330fceae.tar.gz |
sigma-firmware: loader for Analog Devices' SigmaStudio
Analog Devices' SigmaStudio can produce firmware blobs for devices with
these DSPs embedded (like some audio codecs). Allow these device drivers
to easily parse and load them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/sigma.h')
-rw-r--r-- | include/linux/sigma.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/linux/sigma.h b/include/linux/sigma.h new file mode 100644 index 0000000..e2accb3 --- /dev/null +++ b/include/linux/sigma.h @@ -0,0 +1,60 @@ +/* + * Load firmware files from Analog Devices SigmaStudio + * + * Copyright 2009-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __SIGMA_FIRMWARE_H__ +#define __SIGMA_FIRMWARE_H__ + +#include <linux/firmware.h> +#include <linux/types.h> + +struct i2c_client; + +#define SIGMA_MAGIC "ADISIGM" + +struct sigma_firmware { + const struct firmware *fw; + size_t pos; +}; + +struct sigma_firmware_header { + unsigned char magic[7]; + u8 version; + u32 crc; +}; + +enum { + SIGMA_ACTION_WRITEXBYTES = 0, + SIGMA_ACTION_WRITESINGLE, + SIGMA_ACTION_WRITESAFELOAD, + SIGMA_ACTION_DELAY, + SIGMA_ACTION_PLLWAIT, + SIGMA_ACTION_NOOP, + SIGMA_ACTION_END, +}; + +struct sigma_action { + u8 instr; + u8 len_hi; + u16 len; + u16 addr; + unsigned char payload[]; +}; + +static inline u32 sigma_action_len(struct sigma_action *sa) +{ + return (sa->len_hi << 16) | sa->len; +} + +static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len) +{ + return sizeof(*sa) + payload_len + (payload_len % 2); +} + +extern int process_sigma_firmware(struct i2c_client *client, const char *name); + +#endif |