I have been able to get the Linux driver for the ADE7854 working, at least to the point of it creating a file structure under the /sys/bus/iio/ hierarchy. However, I seem to be getting lots of zeroes back when reading the various registers. I can see the SPI data going in and out of the part but have not connected an analyzer yet, so this could just be garbage. But I seem close here.
I have tried to write to the AIGAIN register as a test, but it still returns "0". I can see the data going out the SPI pins here as well. Can you please give me some idea as to how this driver is supposed to work so that I can start developing code to use it? This looks like a fairly well developed driver, it's a shame that there is no documentation for it available or even decent commenting in the code itself.
We do not currently support Linux drivers for ADE products. Please take a look at this post for more details: https://ez.analog.com/message/57691#57691
I am not sure from where you received this Linux driver file but I would suggest verifying the source of it and making sure that the driver works well, before debugging the setup.
This is curious, here is the header from the Linux driver source code:
2 * ADE7854/58/68/78 Polyphase Multifunction Energy Metering IC Driver (I2C Bus)
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
It was included in Linux kernel source code as part of the staging drivers in version 2.6.38. It is credited to Barry Song.
It at least appears to have been written by someone who at the time worked at Analog Devices. I will continue to look into this and let you know what I find out. Thanks!
This is definitely not written by someone from ADI. I checked with my team here. Maybe someone edited the Windows driver file written by us, for Linux drivers. Please look into the origin of this file.