mbox series

[0/7] Add settings for precharge and internal resistor

Message ID 20220315173042.1325858-1-gwendal@chromium.org
Headers show
Series Add settings for precharge and internal resistor | expand

Message

Gwendal Grignou March 15, 2022, 5:30 p.m. UTC
For Semtech sensors SX9324 and SX9360, allow confugration of the
pre-charge resistor (9324/9360) and internal resistor (9324).

Fix a register name spelling mistake first.
The 9360 changes are independant from the 9324 changes, but they are
very similar.

Gwendal Grignou (7):
  iio: sx9324: Fix register field spelling
  dt-bindings: iio: sx9324: Add precharge resistor setting
  iio: sx9324: Add precharge internal resistance setting
  dt-bindings: iio: sx9324: Add internal compensation resistor setting
  iio: sx9324: Add Setting for internal compensation resistor
  dt-bindings: iio: sx9360: Add precharge resistor setting
  iio: sx9360: Add pre-charge resistor setting

 .../iio/proximity/semtech,sx9324.yaml         | 20 +++++++++
 .../iio/proximity/semtech,sx9360.yaml         |  9 ++++
 drivers/iio/proximity/sx9324.c                | 42 ++++++++++++++++---
 drivers/iio/proximity/sx9360.c                | 12 +++++-
 4 files changed, 77 insertions(+), 6 deletions(-)

Comments

Stephen Boyd March 15, 2022, 6:19 p.m. UTC | #1
Quoting Gwendal Grignou (2022-03-15 10:30:36)
> Field for PROX_CTRL4 should contain PROX_CTRL4.
>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

Any Fixes tag? It's a typo though so not really a big deal.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Stephen Boyd March 15, 2022, 8:07 p.m. UTC | #2
Quoting Gwendal Grignou (2022-03-15 10:30:38)
> Add ability to set the precharge internal resistance from the device
> tree.
>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/iio/proximity/sx9324.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
> index 1bef16437aa84..785af857b23a1 100644
> --- a/drivers/iio/proximity/sx9324.c
> +++ b/drivers/iio/proximity/sx9324.c
> @@ -70,7 +70,8 @@
>  #define SX9324_REG_AFE_PH2             0x2a
>  #define SX9324_REG_AFE_PH3             0x2b
>  #define SX9324_REG_AFE_CTRL8           0x2c
> -#define SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM 0x02
> +#define SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM 0x02
> +#define SX9324_REG_AFE_CTRL8_RESFILTIN_MASK GENMASK(3, 0)
>  #define SX9324_REG_AFE_CTRL9           0x2d
>  #define SX9324_REG_AFE_CTRL9_AGAIN_1   0x08
>
> @@ -781,7 +782,7 @@ static const struct sx_common_reg_default sx9324_default_regs[] = {
>         { SX9324_REG_AFE_PH2, 0x1a },
>         { SX9324_REG_AFE_PH3, 0x16 },
>
> -       { SX9324_REG_AFE_CTRL8, SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM },
> +       { SX9324_REG_AFE_CTRL8, 0x10 | SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM },

Is this 0x10 an enable bit? So it wasn't being enabled before? Please
make a define for the 0x10 value.

>         { SX9324_REG_AFE_CTRL9, SX9324_REG_AFE_CTRL9_AGAIN_1 },
>
>         { SX9324_REG_PROX_CTRL0, SX9324_REG_PROX_CTRL0_GAIN_1 |
Gwendal Grignou March 16, 2022, 9:38 p.m. UTC | #3
On Tue, Mar 15, 2022 at 11:19 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Gwendal Grignou (2022-03-15 10:30:36)
> > Field for PROX_CTRL4 should contain PROX_CTRL4.
> >
> > Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
>
> Any Fixes tag? It's a typo though so not really a big deal.
Fixes: 4c18a890dff8d ("iio:proximity:sx9324: Add SX9324 support")
>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>