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  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]
Date:   Sun, 24 May 2020 12:43:55 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Jonathan Albrieux <jonathan.albrieux@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        ~postmarketos/upstreaming@...ts.sr.ht, daniel.baluta@....com,
        devicetree@...r.kernel.org (open list:OPEN FIRMWARE AND FLATTENED
        DEVICE TREE BINDINGS), Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio@...r.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS),
        Peter Meerwald-Stadler <pmeerw@...erw.net>
Subject: Re: [PATCH v3 5/5] iio: imu: bmi160: added mount-matrix support

On Wed, 20 May 2020 21:46:44 +0200
Jonathan Albrieux <jonathan.albrieux@...il.com> wrote:

> Add mount-matrix binding support. As chip could have different orientations
> a mount matrix support is needed to correctly translate these differences.
> 
> Signed-off-by: Jonathan Albrieux <jonathan.albrieux@...il.com>

Other than those bits for the binding doc, the rest of the series
looks good to me.   Given timing this will only go into mainline in the
next cycle now anyway so we have plenty of time to tidy up the corners.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/bmi160/bmi160.h      |  1 +
>  drivers/iio/imu/bmi160/bmi160_core.c | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h
> index 923c3b274fde..a82e040bd109 100644
> --- a/drivers/iio/imu/bmi160/bmi160.h
> +++ b/drivers/iio/imu/bmi160/bmi160.h
> @@ -9,6 +9,7 @@ struct bmi160_data {
>  	struct regmap *regmap;
>  	struct iio_trigger *trig;
>  	struct regulator_bulk_data supplies[2];
> +	struct iio_mount_matrix orientation;
>  };
>  
>  extern const struct regmap_config bmi160_regmap_config;
> diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
> index d3316ca02fbd..26d586daee26 100644
> --- a/drivers/iio/imu/bmi160/bmi160_core.c
> +++ b/drivers/iio/imu/bmi160/bmi160_core.c
> @@ -110,6 +110,7 @@
>  		.storagebits = 16,				\
>  		.endianness = IIO_LE,				\
>  	},							\
> +	.ext_info = bmi160_ext_info,				\
>  }
>  
>  /* scan indexes follow DATA register order */
> @@ -265,6 +266,20 @@ static const struct  bmi160_odr_item bmi160_odr_table[] = {
>  	},
>  };
>  
> +static const struct iio_mount_matrix *
> +bmi160_get_mount_matrix(const struct iio_dev *indio_dev,
> +			const struct iio_chan_spec *chan)
> +{
> +	struct bmi160_data *data = iio_priv(indio_dev);
> +
> +	return &data->orientation;
> +}
> +
> +static const struct iio_chan_spec_ext_info bmi160_ext_info[] = {
> +	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bmi160_get_mount_matrix),
> +	{ }
> +};
> +
>  static const struct iio_chan_spec bmi160_channels[] = {
>  	BMI160_CHANNEL(IIO_ACCEL, X, BMI160_SCAN_ACCEL_X),
>  	BMI160_CHANNEL(IIO_ACCEL, Y, BMI160_SCAN_ACCEL_Y),
> @@ -839,6 +854,11 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
>  		return ret;
>  	}
>  
> +	ret = iio_read_mount_matrix(dev, "mount-matrix",
> +				    &data->orientation);
> +	if (ret)
> +		return ret;
> +
>  	ret = bmi160_chip_init(data, use_spi);
>  	if (ret)
>  		return ret;

Powered by blists - more mailing lists