On Mon, 23 Mar 2020 01:32:34 +0200Forgot to reply, its needed since I used struct of_device
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
On Mon, Mar 23, 2020 at 12:47 AM Saravanan Sekar <sravanhome@xxxxxxxxx> wrote:
Add support for 8-bit resolution ADC readings for input power...
supply and battery charging measurement. Provides voltage, current
readings to mp2629 power supply driver.
+#include <linux/platform_device.h>Don't see users of it.
+#include <linux/of_device.h>
Nope. I'm not totally sure it's always safe to do so+#include <linux/module.h>Any users?
+#include <linux/mutex.h>
+#include <linux/regulator/consumer.h>
+#include <linux/sysfs.h>
+#include <linux/regmap.h>Perhaps ordered?
+#include <linux/iio/iio.h>+ blank line?
+#include <linux/iio/machine.h>
+#include <linux/iio/driver.h>
+#include <linux/mfd/mp2629.h>...
+static int mp2629_read_raw(struct iio_dev *indio_dev,GENMASK() ?
+ struct iio_chan_spec const *chan,
+ int *val, int *val2, long mask)
+{
+ struct mp2629_adc *info = iio_priv(indio_dev);
+ unsigned int rval;
+ int ret;
+
+ switch (mask) {
+ case IIO_CHAN_INFO_RAW:
+ ret = regmap_read(info->regmap, chan->address, &rval);
+ if (ret < 0)
+ return ret;
+
+ if (chan->address == MP2629_INPUT_VOLT)
+ rval &= 0x7f;
+ *val = rval;...
+ return IIO_VAL_INT;
+ return 0;
+}
+ void **pdata = pdev->dev.platform_data;Same Qs as per other patch.
...
+ indio_dev->dev.of_node = pdev->dev.of_node;Jonathan, doesn't IIO core do this for all?
as we have some weird parent structures in some cases.
A quick grep suggests that we may be fine though, or
alternatively be able to get away with a set it if not
already set approach.
I'll take a look when I get some time. It would be nice
to clean this up.
Jonathan