All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: mma8452: Add support for the "mount-matrix" device property
Date: Sun, 13 Feb 2022 18:12:09 +0000	[thread overview]
Message-ID: <20220213181209.68d593b0@jic23-huawei> (raw)
In-Reply-To: <20220208124336.511884-2-hdegoede@redhat.com>

On Tue,  8 Feb 2022 13:43:36 +0100
Hans de Goede <hdegoede@redhat.com> wrote:

> Add support for the standard "mount-matrix" device property to
> the mma8452 driver.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Change of plan. Both patches now applied to the togreg branch of iio.git
as you mentioned in v2 discussion that you don't need this until
5.18 and it saves me juggling patches taking different routes.

> ---
> Note this applies on top of the following recent patch from me:
> "iio: mma8452: Fix probe failing when an i2c_device_id is used"
> ---
>  drivers/iio/accel/mma8452.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 0528717d9f44..590d9431e1bd 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -104,6 +104,7 @@
>  struct mma8452_data {
>  	struct i2c_client *client;
>  	struct mutex lock;
> +	struct iio_mount_matrix orientation;
>  	u8 ctrl_reg1;
>  	u8 data_cfg;
>  	const struct mma_chip_info *chip_info;
> @@ -1190,6 +1191,20 @@ static const struct attribute_group mma8452_event_attribute_group = {
>  	.attrs = mma8452_event_attributes,
>  };
>  
> +static const struct iio_mount_matrix *
> +mma8452_get_mount_matrix(const struct iio_dev *indio_dev,
> +			   const struct iio_chan_spec *chan)
> +{
> +	struct mma8452_data *data = iio_priv(indio_dev);
> +
> +	return &data->orientation;
> +}
> +
> +static const struct iio_chan_spec_ext_info mma8452_ext_info[] = {
> +	IIO_MOUNT_MATRIX(IIO_SHARED_BY_TYPE, mma8452_get_mount_matrix),
> +	{ }
> +};
> +
>  #define MMA8452_FREEFALL_CHANNEL(modifier) { \
>  	.type = IIO_ACCEL, \
>  	.modified = 1, \
> @@ -1228,6 +1243,7 @@ static const struct attribute_group mma8452_event_attribute_group = {
>  	}, \
>  	.event_spec = mma8452_transient_event, \
>  	.num_event_specs = ARRAY_SIZE(mma8452_transient_event), \
> +	.ext_info = mma8452_ext_info, \
>  }
>  
>  #define MMA8652_CHANNEL(axis, idx, bits) { \
> @@ -1249,6 +1265,7 @@ static const struct attribute_group mma8452_event_attribute_group = {
>  	}, \
>  	.event_spec = mma8452_motion_event, \
>  	.num_event_specs = ARRAY_SIZE(mma8452_motion_event), \
> +	.ext_info = mma8452_ext_info, \
>  }
>  
>  static const struct iio_chan_spec mma8451_channels[] = {
> @@ -1546,6 +1563,10 @@ static int mma8452_probe(struct i2c_client *client,
>  		return -ENODEV;
>  	}
>  
> +	ret = iio_read_mount_matrix(&client->dev, &data->orientation);
> +	if (ret)
> +		return ret;
> +
>  	data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
>  	if (IS_ERR(data->vdd_reg))
>  		return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),


  reply	other threads:[~2022-02-13 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 12:43 [PATCH v3 1/2] iio: mma8452: Fix probe failing when an i2c_device_id is used Hans de Goede
2022-02-08 12:43 ` [PATCH v3 2/2] iio: mma8452: Add support for the "mount-matrix" device property Hans de Goede
2022-02-13 18:12   ` Jonathan Cameron [this message]
2022-02-13 18:03 ` [PATCH v3 1/2] iio: mma8452: Fix probe failing when an i2c_device_id is used Jonathan Cameron
2022-04-10 15:30   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220213181209.68d593b0@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=hdegoede@redhat.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.