On Sun, Jul 20, 2008 at 09:47:04PM -0400, Jon Smirl wrote:
How about making them work on an array of bytes? unsigned int read(struct snd_soc_codec *codec, unsigned int reg, u8 *value); int write(struct snd_soc_codec *codec, unsigned int reg, u8* value);
This looks like a reasonable way of handling large registers. We'd need to have a look at the effect on driver code - the main concern would be the effect on drivers for chips with more normally sized registers. Currently they can just call their register access functions with immediate values and it'd be a usability problem if they lost that ability.
I think it's most likely that the best way forward would be to have both interfaces in parallel and let drivers use either (or a mix) rather than having the only interface be the large register one.
If read is sucessful, it returns the number of bytes read. Reading a non-existent register returns -ENODEV, or you can get other errors like -EIO when the IO fails.
You also need to pass in the size of the buffer being supplied by the caller.
Instead of u8 I've been using a union in my internal code. We can come up with better names for the members.
typedef struct { union { u16 s16; u8 byte[32];
There's a scalability issue here...
After the low level is changed, the ASOC core needs to be updated to allow 16 bit shifts and masks up to 64 bits.
We should be able support 15 bit masks with a small rearrangement of the existing stuff.