All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iio: sx9360: fix iio event generation
@ 2022-01-22 21:34 Gwendal Grignou
  2022-01-30 12:41 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Gwendal Grignou @ 2022-01-22 21:34 UTC (permalink / raw)
  To: jic23, lars, andy.shevchenko; +Cc: linux-iio, Jongpil Jung, Gwendal Grignou

From: Jongpil Jung <jongpil19.jung@samsung.com>

To convert SX9360 status register ["REG_STAT"], into a channel
index, we need to right shift by |stat_offset|, not left shift.
Also the PROXSTAT bit (3) is for channel 1 (PHM, Phase Measured), not (PHR,
Phase Reference, channel 0), so the offset is 2 instead of 3.

Fixes: f75095753 ("iio:proximity:sx9360: Add sx9360 support")
Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
Changes since v1:
- Change title to highlight the patch is a fix.
- Put "Fixes:" tag in the commit message footer

 drivers/iio/proximity/sx9360.c    | 2 +-
 drivers/iio/proximity/sx_common.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c
index 6fd6561bb6f5b8..3ebb30c8a4f61d 100644
--- a/drivers/iio/proximity/sx9360.c
+++ b/drivers/iio/proximity/sx9360.c
@@ -775,7 +775,7 @@ static const struct sx_common_chip_info sx9360_chip_info = {
 	.reg_reset = SX9360_REG_RESET,
 
 	.mask_enable_chan = SX9360_REG_GNRL_CTRL0_PHEN_MASK,
-	.stat_offset = 3,
+	.stat_offset = 2,
 	.num_channels = SX9360_NUM_CHANNELS,
 	.num_default_regs = ARRAY_SIZE(sx9360_default_regs),
 
diff --git a/drivers/iio/proximity/sx_common.c b/drivers/iio/proximity/sx_common.c
index ac8fd5920481cb..a7c07316a0a91e 100644
--- a/drivers/iio/proximity/sx_common.c
+++ b/drivers/iio/proximity/sx_common.c
@@ -87,7 +87,7 @@ static void sx_common_push_events(struct iio_dev *indio_dev)
 		return;
 	}
 
-	val <<= data->chip_info->stat_offset;
+	val >>= data->chip_info->stat_offset;
 
 	/*
 	 * Only iterate over channels with changes on proximity status that have
-- 
2.35.0.rc0.227.g00780c9af4-goog


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

* Re: [PATCH v2] iio: sx9360: fix iio event generation
  2022-01-22 21:34 [PATCH v2] iio: sx9360: fix iio event generation Gwendal Grignou
@ 2022-01-30 12:41 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-01-30 12:41 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: lars, andy.shevchenko, linux-iio, Jongpil Jung

On Sat, 22 Jan 2022 13:34:44 -0800
Gwendal Grignou <gwendal@chromium.org> wrote:

> From: Jongpil Jung <jongpil19.jung@samsung.com>
> 
> To convert SX9360 status register ["REG_STAT"], into a channel
> index, we need to right shift by |stat_offset|, not left shift.
> Also the PROXSTAT bit (3) is for channel 1 (PHM, Phase Measured), not (PHR,
> Phase Reference, channel 0), so the offset is 2 instead of 3.
> 
> Fixes: f75095753 ("iio:proximity:sx9360: Add sx9360 support")
Should be 12 chars of the hash.

Also, tree rebased at rc1 so it's wrong anyway :)

Fixed it up and applied to the togreg branch of iio.git and pushed
out as testing for 0-day to see if it can find anything else.

Thanks,

Jonathan

> Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
> Changes since v1:
> - Change title to highlight the patch is a fix.
> - Put "Fixes:" tag in the commit message footer
> 
>  drivers/iio/proximity/sx9360.c    | 2 +-
>  drivers/iio/proximity/sx_common.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c
> index 6fd6561bb6f5b8..3ebb30c8a4f61d 100644
> --- a/drivers/iio/proximity/sx9360.c
> +++ b/drivers/iio/proximity/sx9360.c
> @@ -775,7 +775,7 @@ static const struct sx_common_chip_info sx9360_chip_info = {
>  	.reg_reset = SX9360_REG_RESET,
>  
>  	.mask_enable_chan = SX9360_REG_GNRL_CTRL0_PHEN_MASK,
> -	.stat_offset = 3,
> +	.stat_offset = 2,
>  	.num_channels = SX9360_NUM_CHANNELS,
>  	.num_default_regs = ARRAY_SIZE(sx9360_default_regs),
>  
> diff --git a/drivers/iio/proximity/sx_common.c b/drivers/iio/proximity/sx_common.c
> index ac8fd5920481cb..a7c07316a0a91e 100644
> --- a/drivers/iio/proximity/sx_common.c
> +++ b/drivers/iio/proximity/sx_common.c
> @@ -87,7 +87,7 @@ static void sx_common_push_events(struct iio_dev *indio_dev)
>  		return;
>  	}
>  
> -	val <<= data->chip_info->stat_offset;
> +	val >>= data->chip_info->stat_offset;
>  
>  	/*
>  	 * Only iterate over channels with changes on proximity status that have


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

end of thread, other threads:[~2022-01-30 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 21:34 [PATCH v2] iio: sx9360: fix iio event generation Gwendal Grignou
2022-01-30 12:41 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.