lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251018182032.657d6af6@jic23-huawei>
Date: Sat, 18 Oct 2025 18:20:32 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Petre Rodan <petre.rodan@...dimension.ro>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
 <nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] iio: accel: bma220: add low-g event detection

On Tue, 14 Oct 2025 19:43:00 +0300
Petre Rodan <petre.rodan@...dimension.ro> wrote:

> Add support for low-g detection.
> 
> Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
Just a follow on related units of _period attributes.

> ---
>  drivers/iio/accel/bma220_core.c | 101 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 101 insertions(+)
> 
> diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
> index c4bebf3e5548..daff22ec1f2d 100644
> --- a/drivers/iio/accel/bma220_core.c
> +++ b/drivers/iio/accel/bma220_core.c
> @@ -119,6 +119,14 @@ static const struct iio_event_spec bma220_events[] = {
>  		.mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
>  				       BIT(IIO_EV_INFO_PERIOD),
>  	},
> +	{
> +		.type = IIO_EV_TYPE_THRESH,
> +		.dir = IIO_EV_DIR_FALLING,
> +		.mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE) |
> +				       BIT(IIO_EV_INFO_VALUE) |
> +				       BIT(IIO_EV_INFO_PERIOD) |
> +				       BIT(IIO_EV_INFO_HYSTERESIS),
> +	},
>  };
>  
>  #define BMA220_ACCEL_CHANNEL(index, reg, axis) {			\
> @@ -509,6 +517,7 @@ static int bma220_read_event_config(struct iio_dev *indio_dev,

> @@ -602,6 +634,37 @@ static int bma220_read_event_value(struct iio_dev *indio_dev,
>  		default:
>  			return -EINVAL;
>  		}
> +	case IIO_EV_TYPE_THRESH:
> +		switch (dir) {
> +		case IIO_EV_DIR_FALLING:
> +			switch (info) {
> +			case IIO_EV_INFO_VALUE:
> +				ret = regmap_read(data->regmap, BMA220_REG_CONF1,
> +						  &reg_val);
> +				if (ret)
> +					return ret;
> +				*val = FIELD_GET(BMA220_LOW_TH_MSK, reg_val);
> +				return IIO_VAL_INT;
> +			case IIO_EV_INFO_PERIOD:
> +				ret = regmap_read(data->regmap, BMA220_REG_CONF2,
> +						  &reg_val);
> +				if (ret)
> +					return ret;
> +				*val = FIELD_GET(BMA220_LOW_DUR_MSK, reg_val);
As in previous. Seems very unlikely period is in second here, given that would be far too long
to make sense!  See the ABI docs.  Looks to be samples which means
you need to deal with variable sampling frequencies as part of this
calculation.

> +				return IIO_VAL_INT;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ