Thread (16 messages) 16 messages, 4 authors, 2021-12-18

Re: [PATCH v7 5/5] iio: sx9324: Add dt_binding support

From: Stephen Boyd <hidden>
Date: 2021-12-15 01:13:28
Also in: linux-iio

Quoting Gwendal Grignou (2021-12-10 11:23:28)
Based on bindings/iio/proximity/semtech,sx9324.yaml, implement
retrieving sensor hardware property and alter default values.

Signed-off-by: Gwendal Grignou <redacted>
Reviewed-by: Stephen Boyd <redacted>
quoted hunk ↗ jump to hunk
diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
index ed7ac30e1915d5..78a173aeccf5ac 100644
--- a/drivers/iio/proximity/sx9324.c
+++ b/drivers/iio/proximity/sx9324.c
@@ -77,6 +77,7 @@
 #define SX9324_REG_PROX_CTRL0          0x30
 #define SX9324_REG_PROX_CTRL0_GAIN_MASK        GENMASK(5, 3)
 #define SX9324_REG_PROX_CTRL0_GAIN_1           0x80
+#define SX9324_REG_PROX_CTRL0_RAWFILT_MASK     GENMASK(2, 0)
 #define SX9324_REG_PROX_CTRL0_RAWFILT_1P50     0x01
 #define SX9324_REG_PROX_CTRL1          0x31
 #define SX9324_REG_PROX_CTRL2          0x32
@@ -753,6 +754,74 @@ static int sx9324_write_raw(struct iio_dev *indio_dev,
        return -EINVAL;
 }

+static const struct sx_common_reg_default sx9324_default_regs[] = {
+       { SX9324_REG_IRQ_MSK, 0x00 },
+       { SX9324_REG_IRQ_CFG0, 0x00 },
+       { SX9324_REG_IRQ_CFG1, SX9324_REG_IRQ_CFG1_FAILCOND },
+       { SX9324_REG_IRQ_CFG2, 0x00 },
+       { SX9324_REG_GNRL_CTRL0, SX9324_REG_GNRL_CTRL0_SCANPERIOD_100MS },
+       /*
+        * The lower 4 bits should not be set as it enable sensors measurements.
+        * Turning the detection on before the configuration values are set to
+        * good values can cause the device to return erroneous readings.
+        */
+       { SX9324_REG_GNRL_CTRL1, SX9324_REG_GNRL_CTRL1_PAUSECTRL },
+
+       { SX9324_REG_AFE_CTRL0, 0x00 },
+       { SX9324_REG_AFE_CTRL3, 0x00 },
+       { SX9324_REG_AFE_CTRL4, SX9324_REG_AFE_CTRL4_FREQ_83_33HZ |
+               SX9324_REG_AFE_CTRL4_RES_100 },
+       { SX9324_REG_AFE_CTRL6, 0x00 },
+       { SX9324_REG_AFE_CTRL7, SX9324_REG_AFE_CTRL4_FREQ_83_33HZ |
+               SX9324_REG_AFE_CTRL4_RES_100 },
+
+       /* TODO(gwendal): PHx use chip default or all grounded? */
+       { SX9324_REG_AFE_PH0, 0x29 },
[...]
+       { SX9324_REG_ADV_CTRL11, 0x00 },
+       { SX9324_REG_ADV_CTRL12, 0x00 },
+       /* TODO(gwendal): SAR currenly disabled */
s/currenly/currently/

Is there a plan to resolve these todos? Or should they simply be
removed and then we can deal with the defaults?
+       { SX9324_REG_ADV_CTRL13, 0x00 },
+       { SX9324_REG_ADV_CTRL14, 0x00 },
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help