devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vasiliy Doylov via B4 Relay
	<devnull+nekodevelopper.gmail.com@kernel.org>
Cc: nekodevelopper@gmail.com, Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 1/4] iio: accel: mc3230: add mount matrix support
Date: Sun, 12 Jan 2025 10:48:49 +0000	[thread overview]
Message-ID: <20250112104849.6ee09309@jic23-huawei> (raw)
In-Reply-To: <20250111-mainlining-mc3510c-v1-1-57be503addf8@gmail.com>

On Sat, 11 Jan 2025 23:11:06 +0300
Vasiliy Doylov via B4 Relay <devnull+nekodevelopper.gmail.com@kernel.org> wrote:

> From: Vasiliy Doylov <nekodevelopper@gmail.com>
> 
> This patch allows to read a mount-matrix device tree
> property and report to user-space or in-kernel iio
> clients.

Trivial, but wrap patch descriptions to 75 chars (slightly
shorter than patches because tooling tends to indent it a bit!)

Otherwise this looks good to me.

Jonathan


> 
> Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com>
> ---
>  drivers/iio/accel/mc3230.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
> index caa40a14a6316acae3a972f0ebe0b325db96eb44..48787c0494ae6f0ef1d4d22bc5a4608035cbe123 100644
> --- a/drivers/iio/accel/mc3230.c
> +++ b/drivers/iio/accel/mc3230.c
> @@ -44,18 +44,34 @@ static const int mc3230_nscale = 115411765;
>  	.channel2 = IIO_MOD_##axis,	\
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),	\
>  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
> +	.ext_info = mc3230_ext_info, \
>  }
>  
> +struct mc3230_data {
> +	struct i2c_client *client;
> +	struct iio_mount_matrix orientation;
> +};
> +
> +static const struct iio_mount_matrix *
> +mc3230_get_mount_matrix(const struct iio_dev *indio_dev,
> +			const struct iio_chan_spec *chan)
> +{
> +	struct mc3230_data *data = iio_priv(indio_dev);
> +
> +	return &data->orientation;
> +}
> +
> +static const struct iio_chan_spec_ext_info mc3230_ext_info[] = {
> +	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, mc3230_get_mount_matrix),
> +	{ }
> +};
> +
>  static const struct iio_chan_spec mc3230_channels[] = {
>  	MC3230_CHANNEL(MC3230_REG_XOUT, X),
>  	MC3230_CHANNEL(MC3230_REG_YOUT, Y),
>  	MC3230_CHANNEL(MC3230_REG_ZOUT, Z),
>  };
>  
> -struct mc3230_data {
> -	struct i2c_client *client;
> -};
> -
>  static int mc3230_set_opcon(struct mc3230_data *data, int opcon)
>  {
>  	int ret;
> @@ -141,6 +157,10 @@ static int mc3230_probe(struct i2c_client *client)
>  	if (ret < 0)
>  		return ret;
>  
> +	ret = iio_read_mount_matrix(&client->dev, &data->orientation);
> +	if (ret)
> +		return ret;
> +
>  	ret = iio_device_register(indio_dev);
>  	if (ret < 0) {
>  		dev_err(&client->dev, "device_register failed\n");
> 


  reply	other threads:[~2025-01-12 10:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11 20:11 [PATCH 0/4] iio: accel: mc3230: add mount matrix, of match and mc3510c support Vasiliy Doylov via B4 Relay
2025-01-11 20:11 ` [PATCH 1/4] iio: accel: mc3230: add mount matrix support Vasiliy Doylov via B4 Relay
2025-01-12 10:48   ` Jonathan Cameron [this message]
2025-01-11 20:11 ` [PATCH 2/4] iio: accel: mc3230: add OF match table Vasiliy Doylov via B4 Relay
2025-01-11 23:07   ` Markuss Broks
2025-01-12 10:42     ` Jonathan Cameron
2025-01-12 10:46   ` Jonathan Cameron
2025-01-11 20:11 ` [PATCH 3/4] iio: accel: mc3230: add mc3510c support Vasiliy Doylov via B4 Relay
2025-01-11 23:04   ` Markuss Broks
2025-01-12 10:52     ` Jonathan Cameron
2025-01-12 11:01   ` Jonathan Cameron
2025-01-11 20:11 ` [PATCH 4/4] dt-bindings: iio: accel: mc3230: document mc3510c Vasiliy Doylov via B4 Relay
2025-01-11 22:46   ` Markuss Broks
2025-01-12 11:03     ` 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=20250112104849.6ee09309@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+nekodevelopper.gmail.com@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nekodevelopper@gmail.com \
    --cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).