Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: light: apds9960: fix wrong register for gesture gain
@ 2022-11-06  1:56 Alejandro Concepción Rodríguez
  2022-11-06  5:42 ` Matt Ranostay
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Concepción Rodríguez @ 2022-11-06  1:56 UTC (permalink / raw)
  To: matt.ranostay@konsulko.com, jic23@kernel.org, lars@metafoo.de,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org

Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90).

Fixes: aff268cd532e ("iio: light: add APDS9960 ALS + promixity driver")

Signed-off-by: Alejandro Concepcion-Rodriguez <asconcepcion@acoro.eu>
---
 drivers/iio/light/apds9960.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index b62c139baf41..38d4c7644bef 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -54,9 +54,6 @@
 #define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT	2
 
 #define APDS9960_REG_CONFIG_2	0x90
-#define APDS9960_REG_CONFIG_2_GGAIN_MASK	0x60
-#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT	5
-
 #define APDS9960_REG_ID		0x92
 
 #define APDS9960_REG_STATUS	0x93
@@ -77,6 +74,9 @@
 #define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT	6
 
 #define APDS9960_REG_GCONF_2	0xa3
+#define APDS9960_REG_GCONF_2_GGAIN_MASK			0x60
+#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT		5
+
 #define APDS9960_REG_GOFFSET_U	0xa4
 #define APDS9960_REG_GOFFSET_D	0xa5
 #define APDS9960_REG_GPULSE	0xa6
@@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val)
 			}
 
 			ret = regmap_update_bits(data->regmap,
-				APDS9960_REG_CONFIG_2,
-				APDS9960_REG_CONFIG_2_GGAIN_MASK,
-				idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT);
+				APDS9960_REG_GCONF_2,
+				APDS9960_REG_GCONF_2_GGAIN_MASK,
+				idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT);
 			if (!ret)
 				data->pxs_gain = idx;
 			mutex_unlock(&data->lock);
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: apds9960: fix wrong register for gesture gain
  2022-11-06  1:56 [PATCH] iio: light: apds9960: fix wrong register for gesture gain Alejandro Concepción Rodríguez
@ 2022-11-06  5:42 ` Matt Ranostay
  2022-11-06 17:34   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Ranostay @ 2022-11-06  5:42 UTC (permalink / raw)
  To: Alejandro Concepción Rodríguez
  Cc: jic23@kernel.org, lars@metafoo.de, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org

On Sun, Nov 6, 2022 at 9:56 AM Alejandro Concepción Rodríguez
<asconcepcion@acoro.eu> wrote:
>
> Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90).
>
> Fixes: aff268cd532e ("iio: light: add APDS9960 ALS + promixity driver")
>

Good find. Odd that nobody ran into that issue before :/

NOTE: Sorry for the double emails to some.. seems gmail dropped my
Plain Text default setting and set it to HTML *sigh*

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Signed-off-by: Alejandro Concepcion-Rodriguez <asconcepcion@acoro.eu>
> ---
>  drivers/iio/light/apds9960.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
> index b62c139baf41..38d4c7644bef 100644
> --- a/drivers/iio/light/apds9960.c
> +++ b/drivers/iio/light/apds9960.c
> @@ -54,9 +54,6 @@
>  #define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT  2
>
>  #define APDS9960_REG_CONFIG_2  0x90
> -#define APDS9960_REG_CONFIG_2_GGAIN_MASK       0x60
> -#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5
> -
>  #define APDS9960_REG_ID                0x92
>
>  #define APDS9960_REG_STATUS    0x93
> @@ -77,6 +74,9 @@
>  #define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT    6
>
>  #define APDS9960_REG_GCONF_2   0xa3
> +#define APDS9960_REG_GCONF_2_GGAIN_MASK                        0x60
> +#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT          5
> +
>  #define APDS9960_REG_GOFFSET_U 0xa4
>  #define APDS9960_REG_GOFFSET_D 0xa5
>  #define APDS9960_REG_GPULSE    0xa6
> @@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val)
>                         }
>
>                         ret = regmap_update_bits(data->regmap,
> -                               APDS9960_REG_CONFIG_2,
> -                               APDS9960_REG_CONFIG_2_GGAIN_MASK,
> -                               idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT);
> +                               APDS9960_REG_GCONF_2,
> +                               APDS9960_REG_GCONF_2_GGAIN_MASK,
> +                               idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT);
>                         if (!ret)
>                                 data->pxs_gain = idx;
>                         mutex_unlock(&data->lock);
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: apds9960: fix wrong register for gesture gain
  2022-11-06  5:42 ` Matt Ranostay
@ 2022-11-06 17:34   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-11-06 17:34 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: Alejandro Concepción Rodríguez, lars@metafoo.de,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org

On Sun, 6 Nov 2022 13:42:24 +0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sun, Nov 6, 2022 at 9:56 AM Alejandro Concepción Rodríguez
> <asconcepcion@acoro.eu> wrote:
> >
> > Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90).
> >
> > Fixes: aff268cd532e ("iio: light: add APDS9960 ALS + promixity driver")
> >
There shouldn't be any blank lines in the tags block.  I fixed this whilst applying.  
> 
> Good find. Odd that nobody ran into that issue before :/
> 
> NOTE: Sorry for the double emails to some.. seems gmail dropped my
> Plain Text default setting and set it to HTML *sigh*
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
> 

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> > Signed-off-by: Alejandro Concepcion-Rodriguez <asconcepcion@acoro.eu>
> > ---
> >  drivers/iio/light/apds9960.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
> > index b62c139baf41..38d4c7644bef 100644
> > --- a/drivers/iio/light/apds9960.c
> > +++ b/drivers/iio/light/apds9960.c
> > @@ -54,9 +54,6 @@
> >  #define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT  2
> >
> >  #define APDS9960_REG_CONFIG_2  0x90
> > -#define APDS9960_REG_CONFIG_2_GGAIN_MASK       0x60
> > -#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5
> > -
> >  #define APDS9960_REG_ID                0x92
> >
> >  #define APDS9960_REG_STATUS    0x93
> > @@ -77,6 +74,9 @@
> >  #define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT    6
> >
> >  #define APDS9960_REG_GCONF_2   0xa3
> > +#define APDS9960_REG_GCONF_2_GGAIN_MASK                        0x60
> > +#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT          5
> > +
> >  #define APDS9960_REG_GOFFSET_U 0xa4
> >  #define APDS9960_REG_GOFFSET_D 0xa5
> >  #define APDS9960_REG_GPULSE    0xa6
> > @@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val)
> >                         }
> >
> >                         ret = regmap_update_bits(data->regmap,
> > -                               APDS9960_REG_CONFIG_2,
> > -                               APDS9960_REG_CONFIG_2_GGAIN_MASK,
> > -                               idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT);
> > +                               APDS9960_REG_GCONF_2,
> > +                               APDS9960_REG_GCONF_2_GGAIN_MASK,
> > +                               idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT);
> >                         if (!ret)
> >                                 data->pxs_gain = idx;
> >                         mutex_unlock(&data->lock);
> > --
> > 2.34.1  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-06 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-06  1:56 [PATCH] iio: light: apds9960: fix wrong register for gesture gain Alejandro Concepción Rodríguez
2022-11-06  5:42 ` Matt Ranostay
2022-11-06 17:34   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox