Re: [PATCH 2/2] iio: light: isl76682: Add ISL76682 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/16/23 18:25, Matti Vaittinen wrote:
+
+static int isl76682_write_raw(struct iio_dev *indio_dev,
+                  struct iio_chan_spec const *chan,
+                  int val, int val2, long mask)
+{
+    struct isl76682_chip *chip = iio_priv(indio_dev);
+    int ret;
+
+    if (chan->type != IIO_LIGHT)
+        return -EINVAL;
+
+    if (mask != IIO_CHAN_INFO_SCALE)
+        return -EINVAL;
+
+    mutex_lock(&chip->lock);
+    ret = isl76682_set_als_scale(chip, val);
+    mutex_unlock(&chip->lock);

This looks a bit odd to me. I was under impression that the values would by default be IIO_VAL_INT_PLUS_MICRO unless the format is given in iio_info struct. If so, I'd expect the val to be zero for all of the scales because all scales are smaller than 1. (I may be wrong though). Eg, I'd expect that when range 1000 is set (scale 1000 / 65535), val = 0, val1 roughly 15259 (to mean 0.015259).

I mean val2 is 15259. There is no val1. Well, as you see you can trust me, numbers are my strong "thing" :rolleyes:







[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux